diff options
author | Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> | 2014-03-14 16:24:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-14 22:15:26 -0400 |
commit | ae531b9475f62c5e1863508604cd6b3faf362d56 (patch) | |
tree | c719f25779f44c4241d799e44c8fc2c8c8065957 /net/mac802154 | |
parent | e6278d92005e9d6e374f269b4ce39c908a68ad5d (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.c | 8 | ||||
-rw-r--r-- | net/mac802154/wpan.c | 35 |
2 files changed, 21 insertions, 22 deletions
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c index f551ef2cdf56..15bac3358889 100644 --- a/net/mac802154/mac_cmd.c +++ b/net/mac802154/mac_cmd.c | |||
@@ -34,16 +34,16 @@ | |||
34 | #include "mac802154.h" | 34 | #include "mac802154.h" |
35 | 35 | ||
36 | static int mac802154_mlme_start_req(struct net_device *dev, | 36 | static int mac802154_mlme_start_req(struct net_device *dev, |
37 | struct ieee802154_addr_sa *addr, | 37 | struct ieee802154_addr *addr, |
38 | u8 channel, u8 page, | 38 | u8 channel, u8 page, |
39 | u8 bcn_ord, u8 sf_ord, | 39 | u8 bcn_ord, u8 sf_ord, |
40 | u8 pan_coord, u8 blx, | 40 | u8 pan_coord, u8 blx, |
41 | u8 coord_realign) | 41 | u8 coord_realign) |
42 | { | 42 | { |
43 | BUG_ON(addr->addr_type != IEEE802154_ADDR_SHORT); | 43 | BUG_ON(addr->mode != IEEE802154_ADDR_SHORT); |
44 | 44 | ||
45 | mac802154_dev_set_pan_id(dev, cpu_to_le16(addr->pan_id)); | 45 | mac802154_dev_set_pan_id(dev, addr->pan_id); |
46 | mac802154_dev_set_short_addr(dev, cpu_to_le16(addr->short_addr)); | 46 | mac802154_dev_set_short_addr(dev, addr->short_addr); |
47 | mac802154_dev_set_ieee_addr(dev); | 47 | mac802154_dev_set_ieee_addr(dev); |
48 | mac802154_dev_set_page_channel(dev, page, channel); | 48 | mac802154_dev_set_page_channel(dev, page, channel); |
49 | 49 | ||
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) | |||
251 | static int | 251 | static int |
252 | mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb) | 252 | mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb) |
253 | { | 253 | { |
254 | u16 span, sshort; | 254 | __le16 span, sshort; |
255 | 255 | ||
256 | pr_debug("getting packet via slave interface %s\n", sdata->dev->name); | 256 | pr_debug("getting packet via slave interface %s\n", sdata->dev->name); |
257 | 257 | ||
258 | spin_lock_bh(&sdata->mib_lock); | 258 | spin_lock_bh(&sdata->mib_lock); |
259 | 259 | ||
260 | span = le16_to_cpu(sdata->pan_id); | 260 | span = sdata->pan_id; |
261 | sshort = le16_to_cpu(sdata->short_addr); | 261 | sshort = sdata->short_addr; |
262 | 262 | ||
263 | switch (mac_cb(skb)->da.addr_type) { | 263 | switch (mac_cb(skb)->dest.mode) { |
264 | case IEEE802154_ADDR_NONE: | 264 | case IEEE802154_ADDR_NONE: |
265 | if (mac_cb(skb)->sa.addr_type != IEEE802154_ADDR_NONE) | 265 | if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE) |
266 | /* FIXME: check if we are PAN coordinator */ | 266 | /* FIXME: check if we are PAN coordinator */ |
267 | skb->pkt_type = PACKET_OTHERHOST; | 267 | skb->pkt_type = PACKET_OTHERHOST; |
268 | else | 268 | else |
@@ -270,23 +270,22 @@ mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb) | |||
270 | skb->pkt_type = PACKET_HOST; | 270 | skb->pkt_type = PACKET_HOST; |
271 | break; | 271 | break; |
272 | case IEEE802154_ADDR_LONG: | 272 | case IEEE802154_ADDR_LONG: |
273 | if (mac_cb(skb)->da.pan_id != span && | 273 | if (mac_cb(skb)->dest.pan_id != span && |
274 | mac_cb(skb)->da.pan_id != IEEE802154_PANID_BROADCAST) | 274 | mac_cb(skb)->dest.pan_id != cpu_to_le16(IEEE802154_PANID_BROADCAST)) |
275 | skb->pkt_type = PACKET_OTHERHOST; | 275 | skb->pkt_type = PACKET_OTHERHOST; |
276 | else if (!memcmp(mac_cb(skb)->da.hwaddr, sdata->dev->dev_addr, | 276 | else if (mac_cb(skb)->dest.extended_addr == sdata->extended_addr) |
277 | IEEE802154_ADDR_LEN)) | ||
278 | skb->pkt_type = PACKET_HOST; | 277 | skb->pkt_type = PACKET_HOST; |
279 | else | 278 | else |
280 | skb->pkt_type = PACKET_OTHERHOST; | 279 | skb->pkt_type = PACKET_OTHERHOST; |
281 | break; | 280 | break; |
282 | case IEEE802154_ADDR_SHORT: | 281 | case IEEE802154_ADDR_SHORT: |
283 | if (mac_cb(skb)->da.pan_id != span && | 282 | if (mac_cb(skb)->dest.pan_id != span && |
284 | mac_cb(skb)->da.pan_id != IEEE802154_PANID_BROADCAST) | 283 | mac_cb(skb)->dest.pan_id != cpu_to_le16(IEEE802154_PANID_BROADCAST)) |
285 | skb->pkt_type = PACKET_OTHERHOST; | 284 | skb->pkt_type = PACKET_OTHERHOST; |
286 | else if (mac_cb(skb)->da.short_addr == sshort) | 285 | else if (mac_cb(skb)->dest.short_addr == sshort) |
287 | skb->pkt_type = PACKET_HOST; | 286 | skb->pkt_type = PACKET_HOST; |
288 | else if (mac_cb(skb)->da.short_addr == | 287 | else if (mac_cb(skb)->dest.short_addr == |
289 | IEEE802154_ADDR_BROADCAST) | 288 | cpu_to_le16(IEEE802154_ADDR_BROADCAST)) |
290 | skb->pkt_type = PACKET_BROADCAST; | 289 | skb->pkt_type = PACKET_BROADCAST; |
291 | else | 290 | else |
292 | skb->pkt_type = PACKET_OTHERHOST; | 291 | skb->pkt_type = PACKET_OTHERHOST; |
@@ -332,8 +331,8 @@ static void mac802154_print_addr(const char *name, | |||
332 | 331 | ||
333 | static int mac802154_parse_frame_start(struct sk_buff *skb) | 332 | static int mac802154_parse_frame_start(struct sk_buff *skb) |
334 | { | 333 | { |
335 | struct ieee802154_hdr hdr; | ||
336 | int hlen; | 334 | int hlen; |
335 | struct ieee802154_hdr hdr; | ||
337 | 336 | ||
338 | hlen = ieee802154_hdr_pull(skb, &hdr); | 337 | hlen = ieee802154_hdr_pull(skb, &hdr); |
339 | if (hlen < 0) | 338 | if (hlen < 0) |
@@ -346,9 +345,6 @@ static int mac802154_parse_frame_start(struct sk_buff *skb) | |||
346 | 345 | ||
347 | mac_cb(skb)->flags = hdr.fc.type; | 346 | mac_cb(skb)->flags = hdr.fc.type; |
348 | 347 | ||
349 | ieee802154_addr_to_sa(&mac_cb(skb)->sa, &hdr.source); | ||
350 | ieee802154_addr_to_sa(&mac_cb(skb)->da, &hdr.dest); | ||
351 | |||
352 | if (hdr.fc.ack_request) | 348 | if (hdr.fc.ack_request) |
353 | mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ; | 349 | mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ; |
354 | if (hdr.fc.security_enabled) | 350 | if (hdr.fc.security_enabled) |
@@ -357,6 +353,9 @@ static int mac802154_parse_frame_start(struct sk_buff *skb) | |||
357 | mac802154_print_addr("destination", &hdr.dest); | 353 | mac802154_print_addr("destination", &hdr.dest); |
358 | mac802154_print_addr("source", &hdr.source); | 354 | mac802154_print_addr("source", &hdr.source); |
359 | 355 | ||
356 | mac_cb(skb)->source = hdr.source; | ||
357 | mac_cb(skb)->dest = hdr.dest; | ||
358 | |||
360 | if (hdr.fc.security_enabled) { | 359 | if (hdr.fc.security_enabled) { |
361 | u64 key; | 360 | u64 key; |
362 | 361 | ||