summaryrefslogtreecommitdiffstats
path: root/net/mac802154
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-14 22:15:26 -0400
commitae531b9475f62c5e1863508604cd6b3faf362d56 (patch)
treec719f25779f44c4241d799e44c8fc2c8c8065957 /net/mac802154
parente6278d92005e9d6e374f269b4ce39c908a68ad5d (diff)
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')
-rw-r--r--net/mac802154/mac_cmd.c8
-rw-r--r--net/mac802154/wpan.c35
2 files changed, 21 insertions, 22 deletions
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index f551ef2cdf5..15bac335888 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
@@ -34,16 +34,16 @@
#include "mac802154.h"
static int mac802154_mlme_start_req(struct net_device *dev,
- struct ieee802154_addr_sa *addr,
+ struct ieee802154_addr *addr,
u8 channel, u8 page,
u8 bcn_ord, u8 sf_ord,
u8 pan_coord, u8 blx,
u8 coord_realign)
{
- BUG_ON(addr->addr_type != IEEE802154_ADDR_SHORT);
+ BUG_ON(addr->mode != IEEE802154_ADDR_SHORT);
- mac802154_dev_set_pan_id(dev, cpu_to_le16(addr->pan_id));
- mac802154_dev_set_short_addr(dev, cpu_to_le16(addr->short_addr));
+ mac802154_dev_set_pan_id(dev, addr->pan_id);
+ mac802154_dev_set_short_addr(dev, addr->short_addr);
mac802154_dev_set_ieee_addr(dev);
mac802154_dev_set_page_channel(dev, page, channel);
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 051ed46ffca..b6142666286 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;