mac802154: rx: change naming convention

This patch changes the naming convention of mac802154 rx file. It should
be more named like mac80211 stack. Furthermore we introduce a new frame
parsing implementation which is much similar the mac80211
implementation.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Alexander Aring 2014-10-27 17:13:43 +01:00 committed by Marcel Holtmann
parent b89c33417f
commit be9d215fa9

View File

@ -29,7 +29,7 @@
#include "ieee802154_i.h" #include "ieee802154_i.h"
static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb) static int ieee802154_deliver_skb(struct net_device *dev, struct sk_buff *skb)
{ {
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
skb->protocol = htons(ETH_P_IEEE802154); skb->protocol = htons(ETH_P_IEEE802154);
@ -38,8 +38,8 @@ static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
} }
static int static int
mac802154_subif_frame(struct ieee802154_sub_if_data *sdata, struct sk_buff *skb, ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
const struct ieee802154_hdr *hdr) struct sk_buff *skb, const struct ieee802154_hdr *hdr)
{ {
__le16 span, sshort; __le16 span, sshort;
int rc; int rc;
@ -103,7 +103,7 @@ mac802154_subif_frame(struct ieee802154_sub_if_data *sdata, struct sk_buff *skb,
switch (mac_cb(skb)->type) { switch (mac_cb(skb)->type) {
case IEEE802154_FC_TYPE_DATA: case IEEE802154_FC_TYPE_DATA:
return mac802154_process_data(sdata->dev, skb); return ieee802154_deliver_skb(sdata->dev, skb);
default: default:
pr_warn("ieee802154: bad frame received (type = %d)\n", pr_warn("ieee802154: bad frame received (type = %d)\n",
mac_cb(skb)->type); mac_cb(skb)->type);
@ -115,8 +115,8 @@ fail:
return NET_RX_DROP; return NET_RX_DROP;
} }
static void mac802154_print_addr(const char *name, static void
const struct ieee802154_addr *addr) ieee802154_print_addr(const char *name, const struct ieee802154_addr *addr)
{ {
if (addr->mode == IEEE802154_ADDR_NONE) if (addr->mode == IEEE802154_ADDR_NONE)
pr_debug("%s not present\n", name); pr_debug("%s not present\n", name);
@ -132,8 +132,8 @@ static void mac802154_print_addr(const char *name,
} }
} }
static int mac802154_parse_frame_start(struct sk_buff *skb, static int
struct ieee802154_hdr *hdr) ieee802154_parse_frame_start(struct sk_buff *skb, struct ieee802154_hdr *hdr)
{ {
int hlen; int hlen;
struct ieee802154_mac_cb *cb = mac_cb_init(skb); struct ieee802154_mac_cb *cb = mac_cb_init(skb);
@ -153,8 +153,8 @@ static int mac802154_parse_frame_start(struct sk_buff *skb,
cb->ackreq = hdr->fc.ack_request; cb->ackreq = hdr->fc.ack_request;
cb->secen = hdr->fc.security_enabled; cb->secen = hdr->fc.security_enabled;
mac802154_print_addr("destination", &hdr->dest); ieee802154_print_addr("destination", &hdr->dest);
mac802154_print_addr("source", &hdr->source); ieee802154_print_addr("source", &hdr->source);
cb->source = hdr->source; cb->source = hdr->source;
cb->dest = hdr->dest; cb->dest = hdr->dest;
@ -192,13 +192,14 @@ static int mac802154_parse_frame_start(struct sk_buff *skb,
} }
static void static void
mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb) __ieee802154_rx_handle_packet(struct ieee802154_local *local,
struct sk_buff *skb)
{ {
int ret; int ret;
struct ieee802154_sub_if_data *sdata; struct ieee802154_sub_if_data *sdata;
struct ieee802154_hdr hdr; struct ieee802154_hdr hdr;
ret = mac802154_parse_frame_start(skb, &hdr); ret = ieee802154_parse_frame_start(skb, &hdr);
if (ret) { if (ret) {
pr_debug("got invalid frame\n"); pr_debug("got invalid frame\n");
kfree_skb(skb); kfree_skb(skb);
@ -210,7 +211,7 @@ mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
!netif_running(sdata->dev)) !netif_running(sdata->dev))
continue; continue;
mac802154_subif_frame(sdata, skb, &hdr); ieee802154_subif_frame(sdata, skb, &hdr);
skb = NULL; skb = NULL;
break; break;
} }
@ -220,7 +221,7 @@ mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
} }
static void static void
mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb) ieee802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
{ {
struct sk_buff *skb2; struct sk_buff *skb2;
struct ieee802154_sub_if_data *sdata; struct ieee802154_sub_if_data *sdata;
@ -271,8 +272,8 @@ void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb)
rcu_read_lock(); rcu_read_lock();
mac802154_monitors_rx(local, skb); ieee802154_monitors_rx(local, skb);
mac802154_wpans_rx(local, skb); __ieee802154_rx_handle_packet(local, skb);
rcu_read_unlock(); rcu_read_unlock();