summaryrefslogtreecommitdiffstats
path: root/net/mac802154/wpan.c
diff options
context:
space:
mode:
authorPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>2014-03-14 21:24:02 +0100
committerDavid S. Miller <davem@davemloft.net>2014-03-15 03:15:26 +0100
commitae531b9475f62c5e1863508604cd6b3faf362d56 (patch)
treec719f25779f44c4241d799e44c8fc2c8c8065957 /net/mac802154/wpan.c
parentmac802154: use header operations to create/parse headers (diff)
downloadlinux-ae531b9475f62c5e1863508604cd6b3faf362d56.tar.xz
linux-ae531b9475f62c5e1863508604cd6b3faf362d56.zip
ieee802154: use ieee802154_addr instead of *_sa variants
Change all internal uses of ieee802154_addr_sa to ieee802154_addr, except for those instances that communicate directly with userspace. Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac802154/wpan.c')
-rw-r--r--net/mac802154/wpan.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 051ed46ffca9..b61426662867 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -251,18 +251,18 @@ static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
static int
mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb)
{
- u16 span, sshort;
+ __le16 span, sshort;
pr_debug("getting packet via slave interface %s\n", sdata->dev->name);
spin_lock_bh(&sdata->mib_lock);
- span = le16_to_cpu(sdata->pan_id);
- sshort = le16_to_cpu(sdata->short_addr);
+ span = sdata->pan_id;
+ sshort = sdata->short_addr;
- switch (mac_cb(skb)->da.addr_type) {
+ switch (mac_cb(skb)->dest.mode) {
case IEEE802154_ADDR_NONE:
- if (mac_cb(skb)->sa.addr_type != IEEE802154_ADDR_NONE)
+ if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
/* FIXME: check if we are PAN coordinator */
skb->pkt_type = PACKET_OTHERHOST;
else
@@ -270,23 +270,22 @@ mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb)
skb->pkt_type = PACKET_HOST;
break;
case IEEE802154_ADDR_LONG:
- if (mac_cb(skb)->da.pan_id != span &&
- mac_cb(skb)->da.pan_id != IEEE802154_PANID_BROADCAST)
+ if (mac_cb(skb)->dest.pan_id != span &&
+ mac_cb(skb)->dest.pan_id != cpu_to_le16(IEEE802154_PANID_BROADCAST))
skb->pkt_type = PACKET_OTHERHOST;
- else if (!memcmp(mac_cb(skb)->da.hwaddr, sdata->dev->dev_addr,
- IEEE802154_ADDR_LEN))
+ else if (mac_cb(skb)->dest.extended_addr == sdata->extended_addr)
skb->pkt_type = PACKET_HOST;
else
skb->pkt_type = PACKET_OTHERHOST;
break;
case IEEE802154_ADDR_SHORT:
- if (mac_cb(skb)->da.pan_id != span &&
- mac_cb(skb)->da.pan_id != IEEE802154_PANID_BROADCAST)
+ if (mac_cb(skb)->dest.pan_id != span &&
+ mac_cb(skb)->dest.pan_id != cpu_to_le16(IEEE802154_PANID_BROADCAST))
skb->pkt_type = PACKET_OTHERHOST;
- else if (mac_cb(skb)->da.short_addr == sshort)
+ else if (mac_cb(skb)->dest.short_addr == sshort)
skb->pkt_type = PACKET_HOST;
- else if (mac_cb(skb)->da.short_addr ==
- IEEE802154_ADDR_BROADCAST)
+ else if (mac_cb(skb)->dest.short_addr ==
+ cpu_to_le16(IEEE802154_ADDR_BROADCAST))
skb->pkt_type = PACKET_BROADCAST;
else
skb->pkt_type = PACKET_OTHERHOST;
@@ -332,8 +331,8 @@ static void mac802154_print_addr(const char *name,
static int mac802154_parse_frame_start(struct sk_buff *skb)
{
- struct ieee802154_hdr hdr;
int hlen;
+ struct ieee802154_hdr hdr;
hlen = ieee802154_hdr_pull(skb, &hdr);
if (hlen < 0)
@@ -346,9 +345,6 @@ static int mac802154_parse_frame_start(struct sk_buff *skb)
mac_cb(skb)->flags = hdr.fc.type;
- ieee802154_addr_to_sa(&mac_cb(skb)->sa, &hdr.source);
- ieee802154_addr_to_sa(&mac_cb(skb)->da, &hdr.dest);
-
if (hdr.fc.ack_request)
mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ;
if (hdr.fc.security_enabled)
@@ -357,6 +353,9 @@ static int mac802154_parse_frame_start(struct sk_buff *skb)
mac802154_print_addr("destination", &hdr.dest);
mac802154_print_addr("source", &hdr.source);
+ mac_cb(skb)->source = hdr.source;
+ mac_cb(skb)->dest = hdr.dest;
+
if (hdr.fc.security_enabled) {
u64 key;