diff options
-rw-r--r-- | drivers/net/ieee802154/at86rf230.c | 25 | ||||
-rw-r--r-- | drivers/net/ieee802154/fakehard.c | 14 | ||||
-rw-r--r-- | drivers/net/ieee802154/mrf24j40.c | 17 | ||||
-rw-r--r-- | include/net/ieee802154_netdev.h | 6 | ||||
-rw-r--r-- | include/net/mac802154.h | 5 | ||||
-rw-r--r-- | include/net/nl802154.h | 6 | ||||
-rw-r--r-- | net/ieee802154/6lowpan_rtnl.c | 8 | ||||
-rw-r--r-- | net/ieee802154/Makefile | 2 | ||||
-rw-r--r-- | net/ieee802154/af_ieee802154.c | 10 | ||||
-rw-r--r-- | net/ieee802154/dgram.c | 4 | ||||
-rw-r--r-- | net/ieee802154/nl-mac.c | 32 | ||||
-rw-r--r-- | net/mac802154/Makefile | 2 | ||||
-rw-r--r-- | net/mac802154/ieee802154_dev.c | 5 | ||||
-rw-r--r-- | net/mac802154/mac802154.h | 9 | ||||
-rw-r--r-- | net/mac802154/mac_cmd.c | 4 | ||||
-rw-r--r-- | net/mac802154/mib.c | 24 | ||||
-rw-r--r-- | net/mac802154/wpan.c | 43 |
17 files changed, 121 insertions, 95 deletions
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index b8e732121a85..934a12c03552 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c | |||
@@ -745,30 +745,31 @@ at86rf230_set_hw_addr_filt(struct ieee802154_dev *dev, | |||
745 | struct at86rf230_local *lp = dev->priv; | 745 | struct at86rf230_local *lp = dev->priv; |
746 | 746 | ||
747 | if (changed & IEEE802515_AFILT_SADDR_CHANGED) { | 747 | if (changed & IEEE802515_AFILT_SADDR_CHANGED) { |
748 | u16 addr = le16_to_cpu(filt->short_addr); | ||
749 | |||
748 | dev_vdbg(&lp->spi->dev, | 750 | dev_vdbg(&lp->spi->dev, |
749 | "at86rf230_set_hw_addr_filt called for saddr\n"); | 751 | "at86rf230_set_hw_addr_filt called for saddr\n"); |
750 | __at86rf230_write(lp, RG_SHORT_ADDR_0, filt->short_addr); | 752 | __at86rf230_write(lp, RG_SHORT_ADDR_0, addr); |
751 | __at86rf230_write(lp, RG_SHORT_ADDR_1, filt->short_addr >> 8); | 753 | __at86rf230_write(lp, RG_SHORT_ADDR_1, addr >> 8); |
752 | } | 754 | } |
753 | 755 | ||
754 | if (changed & IEEE802515_AFILT_PANID_CHANGED) { | 756 | if (changed & IEEE802515_AFILT_PANID_CHANGED) { |
757 | u16 pan = le16_to_cpu(filt->pan_id); | ||
758 | |||
755 | dev_vdbg(&lp->spi->dev, | 759 | dev_vdbg(&lp->spi->dev, |
756 | "at86rf230_set_hw_addr_filt called for pan id\n"); | 760 | "at86rf230_set_hw_addr_filt called for pan id\n"); |
757 | __at86rf230_write(lp, RG_PAN_ID_0, filt->pan_id); | 761 | __at86rf230_write(lp, RG_PAN_ID_0, pan); |
758 | __at86rf230_write(lp, RG_PAN_ID_1, filt->pan_id >> 8); | 762 | __at86rf230_write(lp, RG_PAN_ID_1, pan >> 8); |
759 | } | 763 | } |
760 | 764 | ||
761 | if (changed & IEEE802515_AFILT_IEEEADDR_CHANGED) { | 765 | if (changed & IEEE802515_AFILT_IEEEADDR_CHANGED) { |
766 | u8 i, addr[8]; | ||
767 | |||
768 | memcpy(addr, &filt->ieee_addr, 8); | ||
762 | dev_vdbg(&lp->spi->dev, | 769 | dev_vdbg(&lp->spi->dev, |
763 | "at86rf230_set_hw_addr_filt called for IEEE addr\n"); | 770 | "at86rf230_set_hw_addr_filt called for IEEE addr\n"); |
764 | at86rf230_write_subreg(lp, SR_IEEE_ADDR_0, filt->ieee_addr[7]); | 771 | for (i = 0; i < 8; i++) |
765 | at86rf230_write_subreg(lp, SR_IEEE_ADDR_1, filt->ieee_addr[6]); | 772 | __at86rf230_write(lp, RG_IEEE_ADDR_0 + i, addr[i]); |
766 | at86rf230_write_subreg(lp, SR_IEEE_ADDR_2, filt->ieee_addr[5]); | ||
767 | at86rf230_write_subreg(lp, SR_IEEE_ADDR_3, filt->ieee_addr[4]); | ||
768 | at86rf230_write_subreg(lp, SR_IEEE_ADDR_4, filt->ieee_addr[3]); | ||
769 | at86rf230_write_subreg(lp, SR_IEEE_ADDR_5, filt->ieee_addr[2]); | ||
770 | at86rf230_write_subreg(lp, SR_IEEE_ADDR_6, filt->ieee_addr[1]); | ||
771 | at86rf230_write_subreg(lp, SR_IEEE_ADDR_7, filt->ieee_addr[0]); | ||
772 | } | 773 | } |
773 | 774 | ||
774 | if (changed & IEEE802515_AFILT_PANC_CHANGED) { | 775 | if (changed & IEEE802515_AFILT_PANC_CHANGED) { |
diff --git a/drivers/net/ieee802154/fakehard.c b/drivers/net/ieee802154/fakehard.c index 06a400f10565..3c98030e0e0b 100644 --- a/drivers/net/ieee802154/fakehard.c +++ b/drivers/net/ieee802154/fakehard.c | |||
@@ -63,11 +63,11 @@ static struct wpan_phy *fake_get_phy(const struct net_device *dev) | |||
63 | * | 63 | * |
64 | * Return the ID of the PAN from the PIB. | 64 | * Return the ID of the PAN from the PIB. |
65 | */ | 65 | */ |
66 | static u16 fake_get_pan_id(const struct net_device *dev) | 66 | static __le16 fake_get_pan_id(const struct net_device *dev) |
67 | { | 67 | { |
68 | BUG_ON(dev->type != ARPHRD_IEEE802154); | 68 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
69 | 69 | ||
70 | return 0xeba1; | 70 | return cpu_to_le16(0xeba1); |
71 | } | 71 | } |
72 | 72 | ||
73 | /** | 73 | /** |
@@ -78,11 +78,11 @@ static u16 fake_get_pan_id(const struct net_device *dev) | |||
78 | * device. If the device has not yet had a short address assigned | 78 | * device. If the device has not yet had a short address assigned |
79 | * then this should return 0xFFFF to indicate a lack of association. | 79 | * then this should return 0xFFFF to indicate a lack of association. |
80 | */ | 80 | */ |
81 | static u16 fake_get_short_addr(const struct net_device *dev) | 81 | static __le16 fake_get_short_addr(const struct net_device *dev) |
82 | { | 82 | { |
83 | BUG_ON(dev->type != ARPHRD_IEEE802154); | 83 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
84 | 84 | ||
85 | return 0x1; | 85 | return cpu_to_le16(0x1); |
86 | } | 86 | } |
87 | 87 | ||
88 | /** | 88 | /** |
@@ -149,7 +149,7 @@ static int fake_assoc_req(struct net_device *dev, | |||
149 | * 802.15.4-2006 document. | 149 | * 802.15.4-2006 document. |
150 | */ | 150 | */ |
151 | static int fake_assoc_resp(struct net_device *dev, | 151 | static int fake_assoc_resp(struct net_device *dev, |
152 | struct ieee802154_addr_sa *addr, u16 short_addr, u8 status) | 152 | struct ieee802154_addr_sa *addr, __le16 short_addr, u8 status) |
153 | { | 153 | { |
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
@@ -281,8 +281,8 @@ static int ieee802154_fake_ioctl(struct net_device *dev, struct ifreq *ifr, | |||
281 | switch (cmd) { | 281 | switch (cmd) { |
282 | case SIOCGIFADDR: | 282 | case SIOCGIFADDR: |
283 | /* FIXME: fixed here, get from device IRL */ | 283 | /* FIXME: fixed here, get from device IRL */ |
284 | pan_id = fake_get_pan_id(dev); | 284 | pan_id = le16_to_cpu(fake_get_pan_id(dev)); |
285 | short_addr = fake_get_short_addr(dev); | 285 | short_addr = le16_to_cpu(fake_get_short_addr(dev)); |
286 | if (pan_id == IEEE802154_PANID_BROADCAST || | 286 | if (pan_id == IEEE802154_PANID_BROADCAST || |
287 | short_addr == IEEE802154_ADDR_BROADCAST) | 287 | short_addr == IEEE802154_ADDR_BROADCAST) |
288 | return -EADDRNOTAVAIL; | 288 | return -EADDRNOTAVAIL; |
diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c index 246befa4ba05..78a6552ed707 100644 --- a/drivers/net/ieee802154/mrf24j40.c +++ b/drivers/net/ieee802154/mrf24j40.c | |||
@@ -465,8 +465,8 @@ static int mrf24j40_filter(struct ieee802154_dev *dev, | |||
465 | if (changed & IEEE802515_AFILT_SADDR_CHANGED) { | 465 | if (changed & IEEE802515_AFILT_SADDR_CHANGED) { |
466 | /* Short Addr */ | 466 | /* Short Addr */ |
467 | u8 addrh, addrl; | 467 | u8 addrh, addrl; |
468 | addrh = filt->short_addr >> 8 & 0xff; | 468 | addrh = le16_to_cpu(filt->short_addr) >> 8 & 0xff; |
469 | addrl = filt->short_addr & 0xff; | 469 | addrl = le16_to_cpu(filt->short_addr) & 0xff; |
470 | 470 | ||
471 | write_short_reg(devrec, REG_SADRH, addrh); | 471 | write_short_reg(devrec, REG_SADRH, addrh); |
472 | write_short_reg(devrec, REG_SADRL, addrl); | 472 | write_short_reg(devrec, REG_SADRL, addrl); |
@@ -476,15 +476,16 @@ static int mrf24j40_filter(struct ieee802154_dev *dev, | |||
476 | 476 | ||
477 | if (changed & IEEE802515_AFILT_IEEEADDR_CHANGED) { | 477 | if (changed & IEEE802515_AFILT_IEEEADDR_CHANGED) { |
478 | /* Device Address */ | 478 | /* Device Address */ |
479 | int i; | 479 | u8 i, addr[8]; |
480 | |||
481 | memcpy(addr, &filt->ieee_addr, 8); | ||
480 | for (i = 0; i < 8; i++) | 482 | for (i = 0; i < 8; i++) |
481 | write_short_reg(devrec, REG_EADR0+i, | 483 | write_short_reg(devrec, REG_EADR0 + i, addr[i]); |
482 | filt->ieee_addr[7-i]); | ||
483 | 484 | ||
484 | #ifdef DEBUG | 485 | #ifdef DEBUG |
485 | printk(KERN_DEBUG "Set long addr to: "); | 486 | printk(KERN_DEBUG "Set long addr to: "); |
486 | for (i = 0; i < 8; i++) | 487 | for (i = 0; i < 8; i++) |
487 | printk("%02hhx ", filt->ieee_addr[i]); | 488 | printk("%02hhx ", addr[7 - i]); |
488 | printk(KERN_DEBUG "\n"); | 489 | printk(KERN_DEBUG "\n"); |
489 | #endif | 490 | #endif |
490 | } | 491 | } |
@@ -492,8 +493,8 @@ static int mrf24j40_filter(struct ieee802154_dev *dev, | |||
492 | if (changed & IEEE802515_AFILT_PANID_CHANGED) { | 493 | if (changed & IEEE802515_AFILT_PANID_CHANGED) { |
493 | /* PAN ID */ | 494 | /* PAN ID */ |
494 | u8 panidl, panidh; | 495 | u8 panidl, panidh; |
495 | panidh = filt->pan_id >> 8 & 0xff; | 496 | panidh = le16_to_cpu(filt->pan_id) >> 8 & 0xff; |
496 | panidl = filt->pan_id & 0xff; | 497 | panidl = le16_to_cpu(filt->pan_id) & 0xff; |
497 | write_short_reg(devrec, REG_PANIDH, panidh); | 498 | write_short_reg(devrec, REG_PANIDH, panidh); |
498 | write_short_reg(devrec, REG_PANIDL, panidl); | 499 | write_short_reg(devrec, REG_PANIDL, panidl); |
499 | 500 | ||
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h index 86d5d50a6a53..e4810d566b1b 100644 --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h | |||
@@ -171,7 +171,7 @@ struct ieee802154_mlme_ops { | |||
171 | u8 channel, u8 page, u8 cap); | 171 | u8 channel, u8 page, u8 cap); |
172 | int (*assoc_resp)(struct net_device *dev, | 172 | int (*assoc_resp)(struct net_device *dev, |
173 | struct ieee802154_addr_sa *addr, | 173 | struct ieee802154_addr_sa *addr, |
174 | u16 short_addr, u8 status); | 174 | __le16 short_addr, u8 status); |
175 | int (*disassoc_req)(struct net_device *dev, | 175 | int (*disassoc_req)(struct net_device *dev, |
176 | struct ieee802154_addr_sa *addr, | 176 | struct ieee802154_addr_sa *addr, |
177 | u8 reason); | 177 | u8 reason); |
@@ -190,8 +190,8 @@ struct ieee802154_mlme_ops { | |||
190 | * FIXME: these should become the part of PIB/MIB interface. | 190 | * FIXME: these should become the part of PIB/MIB interface. |
191 | * However we still don't have IB interface of any kind | 191 | * However we still don't have IB interface of any kind |
192 | */ | 192 | */ |
193 | u16 (*get_pan_id)(const struct net_device *dev); | 193 | __le16 (*get_pan_id)(const struct net_device *dev); |
194 | u16 (*get_short_addr)(const struct net_device *dev); | 194 | __le16 (*get_short_addr)(const struct net_device *dev); |
195 | u8 (*get_dsn)(const struct net_device *dev); | 195 | u8 (*get_dsn)(const struct net_device *dev); |
196 | }; | 196 | }; |
197 | 197 | ||
diff --git a/include/net/mac802154.h b/include/net/mac802154.h index 8ca3d04e7558..f74b2a8bf2b6 100644 --- a/include/net/mac802154.h +++ b/include/net/mac802154.h | |||
@@ -50,7 +50,7 @@ struct ieee802154_hw_addr_filt { | |||
50 | * devices across independent networks. | 50 | * devices across independent networks. |
51 | */ | 51 | */ |
52 | __le16 short_addr; | 52 | __le16 short_addr; |
53 | u8 ieee_addr[IEEE802154_ADDR_LEN]; | 53 | __le64 ieee_addr; |
54 | u8 pan_coord; | 54 | u8 pan_coord; |
55 | }; | 55 | }; |
56 | 56 | ||
@@ -153,8 +153,7 @@ struct ieee802154_ops { | |||
153 | int (*set_hw_addr_filt)(struct ieee802154_dev *dev, | 153 | int (*set_hw_addr_filt)(struct ieee802154_dev *dev, |
154 | struct ieee802154_hw_addr_filt *filt, | 154 | struct ieee802154_hw_addr_filt *filt, |
155 | unsigned long changed); | 155 | unsigned long changed); |
156 | int (*ieee_addr)(struct ieee802154_dev *dev, | 156 | int (*ieee_addr)(struct ieee802154_dev *dev, __le64 addr); |
157 | u8 addr[IEEE802154_ADDR_LEN]); | ||
158 | int (*set_txpower)(struct ieee802154_dev *dev, int db); | 157 | int (*set_txpower)(struct ieee802154_dev *dev, int db); |
159 | int (*set_lbt)(struct ieee802154_dev *dev, bool on); | 158 | int (*set_lbt)(struct ieee802154_dev *dev, bool on); |
160 | int (*set_cca_mode)(struct ieee802154_dev *dev, u8 mode); | 159 | int (*set_cca_mode)(struct ieee802154_dev *dev, u8 mode); |
diff --git a/include/net/nl802154.h b/include/net/nl802154.h index 06ead976755a..3121ed047c1e 100644 --- a/include/net/nl802154.h +++ b/include/net/nl802154.h | |||
@@ -52,7 +52,7 @@ int ieee802154_nl_assoc_indic(struct net_device *dev, | |||
52 | * Note: This is in section 7.3.2 of the IEEE 802.15.4 document. | 52 | * Note: This is in section 7.3.2 of the IEEE 802.15.4 document. |
53 | */ | 53 | */ |
54 | int ieee802154_nl_assoc_confirm(struct net_device *dev, | 54 | int ieee802154_nl_assoc_confirm(struct net_device *dev, |
55 | u16 short_addr, u8 status); | 55 | __le16 short_addr, u8 status); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * ieee802154_nl_disassoc_indic - Notify userland of disassociation. | 58 | * ieee802154_nl_disassoc_indic - Notify userland of disassociation. |
@@ -111,8 +111,8 @@ int ieee802154_nl_scan_confirm(struct net_device *dev, | |||
111 | * Note: This API cannot indicate a beacon frame for a coordinator | 111 | * Note: This API cannot indicate a beacon frame for a coordinator |
112 | * operating in long addressing mode. | 112 | * operating in long addressing mode. |
113 | */ | 113 | */ |
114 | int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid, | 114 | int ieee802154_nl_beacon_indic(struct net_device *dev, __le16 panid, |
115 | u16 coord_addr); | 115 | __le16 coord_addr); |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * ieee802154_nl_start_confirm - Notify userland of completion of start. | 118 | * ieee802154_nl_start_confirm - Notify userland of completion of start. |
diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c index 331180e617ca..c23349d737ae 100644 --- a/net/ieee802154/6lowpan_rtnl.c +++ b/net/ieee802154/6lowpan_rtnl.c | |||
@@ -120,11 +120,11 @@ static int lowpan_header_create(struct sk_buff *skb, | |||
120 | 120 | ||
121 | /* prepare wpan address data */ | 121 | /* prepare wpan address data */ |
122 | sa.addr_type = IEEE802154_ADDR_LONG; | 122 | sa.addr_type = IEEE802154_ADDR_LONG; |
123 | sa.pan_id = ieee802154_mlme_ops(dev)->get_pan_id(dev); | 123 | sa.pan_id = le16_to_cpu(ieee802154_mlme_ops(dev)->get_pan_id(dev)); |
124 | 124 | ||
125 | memcpy(&(sa.hwaddr), saddr, 8); | 125 | memcpy(&(sa.hwaddr), saddr, 8); |
126 | /* intra-PAN communications */ | 126 | /* intra-PAN communications */ |
127 | da.pan_id = ieee802154_mlme_ops(dev)->get_pan_id(dev); | 127 | da.pan_id = sa.pan_id; |
128 | 128 | ||
129 | /* if the destination address is the broadcast address, use the | 129 | /* if the destination address is the broadcast address, use the |
130 | * corresponding short address | 130 | * corresponding short address |
@@ -352,13 +352,13 @@ static struct wpan_phy *lowpan_get_phy(const struct net_device *dev) | |||
352 | return ieee802154_mlme_ops(real_dev)->get_phy(real_dev); | 352 | return ieee802154_mlme_ops(real_dev)->get_phy(real_dev); |
353 | } | 353 | } |
354 | 354 | ||
355 | static u16 lowpan_get_pan_id(const struct net_device *dev) | 355 | static __le16 lowpan_get_pan_id(const struct net_device *dev) |
356 | { | 356 | { |
357 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | 357 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; |
358 | return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev); | 358 | return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev); |
359 | } | 359 | } |
360 | 360 | ||
361 | static u16 lowpan_get_short_addr(const struct net_device *dev) | 361 | static __le16 lowpan_get_short_addr(const struct net_device *dev) |
362 | { | 362 | { |
363 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | 363 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; |
364 | return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev); | 364 | return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev); |
diff --git a/net/ieee802154/Makefile b/net/ieee802154/Makefile index b113fc4be3e0..78b1fa23d30e 100644 --- a/net/ieee802154/Makefile +++ b/net/ieee802154/Makefile | |||
@@ -5,3 +5,5 @@ obj-$(CONFIG_6LOWPAN_IPHC) += 6lowpan_iphc.o | |||
5 | 6lowpan-y := 6lowpan_rtnl.o reassembly.o | 5 | 6lowpan-y := 6lowpan_rtnl.o reassembly.o |
6 | ieee802154-y := netlink.o nl-mac.o nl-phy.o nl_policy.o wpan-class.o | 6 | ieee802154-y := netlink.o nl-mac.o nl-phy.o nl_policy.o wpan-class.o |
7 | af_802154-y := af_ieee802154.o raw.o dgram.o | 7 | af_802154-y := af_ieee802154.o raw.o dgram.o |
8 | |||
9 | ccflags-y += -D__CHECK_ENDIAN__ | ||
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c index a8db341581ac..973cb11da42b 100644 --- a/net/ieee802154/af_ieee802154.c +++ b/net/ieee802154/af_ieee802154.c | |||
@@ -48,7 +48,7 @@ struct net_device *ieee802154_get_dev(struct net *net, | |||
48 | { | 48 | { |
49 | struct net_device *dev = NULL; | 49 | struct net_device *dev = NULL; |
50 | struct net_device *tmp; | 50 | struct net_device *tmp; |
51 | u16 pan_id, short_addr; | 51 | __le16 pan_id, short_addr; |
52 | 52 | ||
53 | switch (addr->addr_type) { | 53 | switch (addr->addr_type) { |
54 | case IEEE802154_ADDR_LONG: | 54 | case IEEE802154_ADDR_LONG: |
@@ -59,9 +59,9 @@ struct net_device *ieee802154_get_dev(struct net *net, | |||
59 | rcu_read_unlock(); | 59 | rcu_read_unlock(); |
60 | break; | 60 | break; |
61 | case IEEE802154_ADDR_SHORT: | 61 | case IEEE802154_ADDR_SHORT: |
62 | if (addr->pan_id == 0xffff || | 62 | if (addr->pan_id == IEEE802154_PANID_BROADCAST || |
63 | addr->short_addr == IEEE802154_ADDR_UNDEF || | 63 | addr->short_addr == IEEE802154_ADDR_UNDEF || |
64 | addr->short_addr == 0xffff) | 64 | addr->short_addr == IEEE802154_ADDR_UNDEF) |
65 | break; | 65 | break; |
66 | 66 | ||
67 | rtnl_lock(); | 67 | rtnl_lock(); |
@@ -74,8 +74,8 @@ struct net_device *ieee802154_get_dev(struct net *net, | |||
74 | short_addr = | 74 | short_addr = |
75 | ieee802154_mlme_ops(tmp)->get_short_addr(tmp); | 75 | ieee802154_mlme_ops(tmp)->get_short_addr(tmp); |
76 | 76 | ||
77 | if (pan_id == addr->pan_id && | 77 | if (le16_to_cpu(pan_id) == addr->pan_id && |
78 | short_addr == addr->short_addr) { | 78 | le16_to_cpu(short_addr) == addr->short_addr) { |
79 | dev = tmp; | 79 | dev = tmp; |
80 | dev_hold(dev); | 80 | dev_hold(dev); |
81 | break; | 81 | break; |
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c index 405fdf9bf5e1..9df3a1d94376 100644 --- a/net/ieee802154/dgram.c +++ b/net/ieee802154/dgram.c | |||
@@ -363,8 +363,8 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb) | |||
363 | /* Data frame processing */ | 363 | /* Data frame processing */ |
364 | BUG_ON(dev->type != ARPHRD_IEEE802154); | 364 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
365 | 365 | ||
366 | pan_id = ieee802154_mlme_ops(dev)->get_pan_id(dev); | 366 | pan_id = le16_to_cpu(ieee802154_mlme_ops(dev)->get_pan_id(dev)); |
367 | short_addr = ieee802154_mlme_ops(dev)->get_short_addr(dev); | 367 | short_addr = le16_to_cpu(ieee802154_mlme_ops(dev)->get_short_addr(dev)); |
368 | 368 | ||
369 | read_lock(&dgram_lock); | 369 | read_lock(&dgram_lock); |
370 | sk_for_each(sk, &dgram_head) { | 370 | sk_for_each(sk, &dgram_head) { |
diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c index 7ae93e1f8aa0..58fa523fb536 100644 --- a/net/ieee802154/nl-mac.c +++ b/net/ieee802154/nl-mac.c | |||
@@ -72,7 +72,7 @@ nla_put_failure: | |||
72 | } | 72 | } |
73 | EXPORT_SYMBOL(ieee802154_nl_assoc_indic); | 73 | EXPORT_SYMBOL(ieee802154_nl_assoc_indic); |
74 | 74 | ||
75 | int ieee802154_nl_assoc_confirm(struct net_device *dev, u16 short_addr, | 75 | int ieee802154_nl_assoc_confirm(struct net_device *dev, __le16 short_addr, |
76 | u8 status) | 76 | u8 status) |
77 | { | 77 | { |
78 | struct sk_buff *msg; | 78 | struct sk_buff *msg; |
@@ -87,7 +87,8 @@ int ieee802154_nl_assoc_confirm(struct net_device *dev, u16 short_addr, | |||
87 | nla_put_u32(msg, IEEE802154_ATTR_DEV_INDEX, dev->ifindex) || | 87 | nla_put_u32(msg, IEEE802154_ATTR_DEV_INDEX, dev->ifindex) || |
88 | nla_put(msg, IEEE802154_ATTR_HW_ADDR, IEEE802154_ADDR_LEN, | 88 | nla_put(msg, IEEE802154_ATTR_HW_ADDR, IEEE802154_ADDR_LEN, |
89 | dev->dev_addr) || | 89 | dev->dev_addr) || |
90 | nla_put_u16(msg, IEEE802154_ATTR_SHORT_ADDR, short_addr) || | 90 | nla_put_u16(msg, IEEE802154_ATTR_SHORT_ADDR, |
91 | le16_to_cpu(short_addr)) || | ||
91 | nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) | 92 | nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) |
92 | goto nla_put_failure; | 93 | goto nla_put_failure; |
93 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); | 94 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); |
@@ -157,8 +158,8 @@ nla_put_failure: | |||
157 | } | 158 | } |
158 | EXPORT_SYMBOL(ieee802154_nl_disassoc_confirm); | 159 | EXPORT_SYMBOL(ieee802154_nl_disassoc_confirm); |
159 | 160 | ||
160 | int ieee802154_nl_beacon_indic(struct net_device *dev, | 161 | int ieee802154_nl_beacon_indic(struct net_device *dev, __le16 panid, |
161 | u16 panid, u16 coord_addr) | 162 | __le16 coord_addr) |
162 | { | 163 | { |
163 | struct sk_buff *msg; | 164 | struct sk_buff *msg; |
164 | 165 | ||
@@ -172,8 +173,10 @@ int ieee802154_nl_beacon_indic(struct net_device *dev, | |||
172 | nla_put_u32(msg, IEEE802154_ATTR_DEV_INDEX, dev->ifindex) || | 173 | nla_put_u32(msg, IEEE802154_ATTR_DEV_INDEX, dev->ifindex) || |
173 | nla_put(msg, IEEE802154_ATTR_HW_ADDR, IEEE802154_ADDR_LEN, | 174 | nla_put(msg, IEEE802154_ATTR_HW_ADDR, IEEE802154_ADDR_LEN, |
174 | dev->dev_addr) || | 175 | dev->dev_addr) || |
175 | nla_put_u16(msg, IEEE802154_ATTR_COORD_SHORT_ADDR, coord_addr) || | 176 | nla_put_u16(msg, IEEE802154_ATTR_COORD_SHORT_ADDR, |
176 | nla_put_u16(msg, IEEE802154_ATTR_COORD_PAN_ID, panid)) | 177 | le16_to_cpu(coord_addr)) || |
178 | nla_put_u16(msg, IEEE802154_ATTR_COORD_PAN_ID, | ||
179 | le16_to_cpu(panid))) | ||
177 | goto nla_put_failure; | 180 | goto nla_put_failure; |
178 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); | 181 | return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP); |
179 | 182 | ||
@@ -243,6 +246,7 @@ static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 portid, | |||
243 | { | 246 | { |
244 | void *hdr; | 247 | void *hdr; |
245 | struct wpan_phy *phy; | 248 | struct wpan_phy *phy; |
249 | u16 short_addr, pan_id; | ||
246 | 250 | ||
247 | pr_debug("%s\n", __func__); | 251 | pr_debug("%s\n", __func__); |
248 | 252 | ||
@@ -254,15 +258,16 @@ static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 portid, | |||
254 | phy = ieee802154_mlme_ops(dev)->get_phy(dev); | 258 | phy = ieee802154_mlme_ops(dev)->get_phy(dev); |
255 | BUG_ON(!phy); | 259 | BUG_ON(!phy); |
256 | 260 | ||
261 | short_addr = le16_to_cpu(ieee802154_mlme_ops(dev)->get_short_addr(dev)); | ||
262 | pan_id = le16_to_cpu(ieee802154_mlme_ops(dev)->get_pan_id(dev)); | ||
263 | |||
257 | if (nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name) || | 264 | if (nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name) || |
258 | nla_put_string(msg, IEEE802154_ATTR_PHY_NAME, wpan_phy_name(phy)) || | 265 | nla_put_string(msg, IEEE802154_ATTR_PHY_NAME, wpan_phy_name(phy)) || |
259 | nla_put_u32(msg, IEEE802154_ATTR_DEV_INDEX, dev->ifindex) || | 266 | nla_put_u32(msg, IEEE802154_ATTR_DEV_INDEX, dev->ifindex) || |
260 | nla_put(msg, IEEE802154_ATTR_HW_ADDR, IEEE802154_ADDR_LEN, | 267 | nla_put(msg, IEEE802154_ATTR_HW_ADDR, IEEE802154_ADDR_LEN, |
261 | dev->dev_addr) || | 268 | dev->dev_addr) || |
262 | nla_put_u16(msg, IEEE802154_ATTR_SHORT_ADDR, | 269 | nla_put_u16(msg, IEEE802154_ATTR_SHORT_ADDR, short_addr) || |
263 | ieee802154_mlme_ops(dev)->get_short_addr(dev)) || | 270 | nla_put_u16(msg, IEEE802154_ATTR_PAN_ID, pan_id)) |
264 | nla_put_u16(msg, IEEE802154_ATTR_PAN_ID, | ||
265 | ieee802154_mlme_ops(dev)->get_pan_id(dev))) | ||
266 | goto nla_put_failure; | 271 | goto nla_put_failure; |
267 | wpan_phy_put(phy); | 272 | wpan_phy_put(phy); |
268 | return genlmsg_end(msg, hdr); | 273 | return genlmsg_end(msg, hdr); |
@@ -368,11 +373,10 @@ int ieee802154_associate_resp(struct sk_buff *skb, struct genl_info *info) | |||
368 | addr.addr_type = IEEE802154_ADDR_LONG; | 373 | addr.addr_type = IEEE802154_ADDR_LONG; |
369 | nla_memcpy(addr.hwaddr, info->attrs[IEEE802154_ATTR_DEST_HW_ADDR], | 374 | nla_memcpy(addr.hwaddr, info->attrs[IEEE802154_ATTR_DEST_HW_ADDR], |
370 | IEEE802154_ADDR_LEN); | 375 | IEEE802154_ADDR_LEN); |
371 | addr.pan_id = ieee802154_mlme_ops(dev)->get_pan_id(dev); | 376 | addr.pan_id = le16_to_cpu(ieee802154_mlme_ops(dev)->get_pan_id(dev)); |
372 | |||
373 | 377 | ||
374 | ret = ieee802154_mlme_ops(dev)->assoc_resp(dev, &addr, | 378 | ret = ieee802154_mlme_ops(dev)->assoc_resp(dev, &addr, |
375 | nla_get_u16(info->attrs[IEEE802154_ATTR_DEST_SHORT_ADDR]), | 379 | cpu_to_le16(nla_get_u16(info->attrs[IEEE802154_ATTR_DEST_SHORT_ADDR])), |
376 | nla_get_u8(info->attrs[IEEE802154_ATTR_STATUS])); | 380 | nla_get_u8(info->attrs[IEEE802154_ATTR_STATUS])); |
377 | 381 | ||
378 | out: | 382 | out: |
@@ -407,7 +411,7 @@ int ieee802154_disassociate_req(struct sk_buff *skb, struct genl_info *info) | |||
407 | addr.short_addr = nla_get_u16( | 411 | addr.short_addr = nla_get_u16( |
408 | info->attrs[IEEE802154_ATTR_DEST_SHORT_ADDR]); | 412 | info->attrs[IEEE802154_ATTR_DEST_SHORT_ADDR]); |
409 | } | 413 | } |
410 | addr.pan_id = ieee802154_mlme_ops(dev)->get_pan_id(dev); | 414 | addr.pan_id = le16_to_cpu(ieee802154_mlme_ops(dev)->get_pan_id(dev)); |
411 | 415 | ||
412 | ret = ieee802154_mlme_ops(dev)->disassoc_req(dev, &addr, | 416 | ret = ieee802154_mlme_ops(dev)->disassoc_req(dev, &addr, |
413 | nla_get_u8(info->attrs[IEEE802154_ATTR_REASON])); | 417 | nla_get_u8(info->attrs[IEEE802154_ATTR_REASON])); |
diff --git a/net/mac802154/Makefile b/net/mac802154/Makefile index 57cf5d1a2e4a..15d62df52182 100644 --- a/net/mac802154/Makefile +++ b/net/mac802154/Makefile | |||
@@ -1,2 +1,4 @@ | |||
1 | obj-$(CONFIG_MAC802154) += mac802154.o | 1 | obj-$(CONFIG_MAC802154) += mac802154.o |
2 | mac802154-objs := ieee802154_dev.o rx.o tx.o mac_cmd.o mib.o monitor.o wpan.o | 2 | mac802154-objs := ieee802154_dev.o rx.o tx.o mac_cmd.o mib.o monitor.o wpan.o |
3 | |||
4 | ccflags-y += -D__CHECK_ENDIAN__ | ||
diff --git a/net/mac802154/ieee802154_dev.c b/net/mac802154/ieee802154_dev.c index b75bb01e5c6b..10cdb091b775 100644 --- a/net/mac802154/ieee802154_dev.c +++ b/net/mac802154/ieee802154_dev.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <net/netlink.h> | 27 | #include <net/netlink.h> |
28 | #include <linux/nl802154.h> | 28 | #include <linux/nl802154.h> |
29 | #include <net/mac802154.h> | 29 | #include <net/mac802154.h> |
30 | #include <net/ieee802154_netdev.h> | ||
30 | #include <net/route.h> | 31 | #include <net/route.h> |
31 | #include <net/wpan-phy.h> | 32 | #include <net/wpan-phy.h> |
32 | 33 | ||
@@ -46,7 +47,9 @@ int mac802154_slave_open(struct net_device *dev) | |||
46 | } | 47 | } |
47 | 48 | ||
48 | if (ipriv->ops->ieee_addr) { | 49 | if (ipriv->ops->ieee_addr) { |
49 | res = ipriv->ops->ieee_addr(&ipriv->hw, dev->dev_addr); | 50 | __le64 addr = ieee802154_devaddr_from_raw(dev->dev_addr); |
51 | |||
52 | res = ipriv->ops->ieee_addr(&ipriv->hw, addr); | ||
50 | WARN_ON(res); | 53 | WARN_ON(res); |
51 | if (res) | 54 | if (res) |
52 | goto err; | 55 | goto err; |
diff --git a/net/mac802154/mac802154.h b/net/mac802154/mac802154.h index d48422e27110..4619486f1da2 100644 --- a/net/mac802154/mac802154.h +++ b/net/mac802154/mac802154.h | |||
@@ -76,6 +76,7 @@ struct mac802154_sub_if_data { | |||
76 | 76 | ||
77 | __le16 pan_id; | 77 | __le16 pan_id; |
78 | __le16 short_addr; | 78 | __le16 short_addr; |
79 | __le64 extended_addr; | ||
79 | 80 | ||
80 | u8 chan; | 81 | u8 chan; |
81 | u8 page; | 82 | u8 page; |
@@ -106,11 +107,11 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, | |||
106 | u8 page, u8 chan); | 107 | u8 page, u8 chan); |
107 | 108 | ||
108 | /* MIB callbacks */ | 109 | /* MIB callbacks */ |
109 | void mac802154_dev_set_short_addr(struct net_device *dev, u16 val); | 110 | void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val); |
110 | u16 mac802154_dev_get_short_addr(const struct net_device *dev); | 111 | __le16 mac802154_dev_get_short_addr(const struct net_device *dev); |
111 | void mac802154_dev_set_ieee_addr(struct net_device *dev); | 112 | void mac802154_dev_set_ieee_addr(struct net_device *dev); |
112 | u16 mac802154_dev_get_pan_id(const struct net_device *dev); | 113 | __le16 mac802154_dev_get_pan_id(const struct net_device *dev); |
113 | void mac802154_dev_set_pan_id(struct net_device *dev, u16 val); | 114 | void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val); |
114 | void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan); | 115 | void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan); |
115 | u8 mac802154_dev_get_dsn(const struct net_device *dev); | 116 | u8 mac802154_dev_get_dsn(const struct net_device *dev); |
116 | 117 | ||
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c index e079c57c48ca..f551ef2cdf56 100644 --- a/net/mac802154/mac_cmd.c +++ b/net/mac802154/mac_cmd.c | |||
@@ -42,8 +42,8 @@ static int mac802154_mlme_start_req(struct net_device *dev, | |||
42 | { | 42 | { |
43 | BUG_ON(addr->addr_type != IEEE802154_ADDR_SHORT); | 43 | BUG_ON(addr->addr_type != IEEE802154_ADDR_SHORT); |
44 | 44 | ||
45 | mac802154_dev_set_pan_id(dev, addr->pan_id); | 45 | mac802154_dev_set_pan_id(dev, cpu_to_le16(addr->pan_id)); |
46 | mac802154_dev_set_short_addr(dev, addr->short_addr); | 46 | mac802154_dev_set_short_addr(dev, cpu_to_le16(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/mib.c b/net/mac802154/mib.c index f48f40c1da1a..ba5abdcbd25f 100644 --- a/net/mac802154/mib.c +++ b/net/mac802154/mib.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/if_arp.h> | 24 | #include <linux/if_arp.h> |
25 | 25 | ||
26 | #include <net/mac802154.h> | 26 | #include <net/mac802154.h> |
27 | #include <net/ieee802154_netdev.h> | ||
27 | #include <net/wpan-phy.h> | 28 | #include <net/wpan-phy.h> |
28 | 29 | ||
29 | #include "mac802154.h" | 30 | #include "mac802154.h" |
@@ -79,7 +80,7 @@ static void set_hw_addr_filt(struct net_device *dev, unsigned long changed) | |||
79 | queue_work(priv->hw->dev_workqueue, &work->work); | 80 | queue_work(priv->hw->dev_workqueue, &work->work); |
80 | } | 81 | } |
81 | 82 | ||
82 | void mac802154_dev_set_short_addr(struct net_device *dev, u16 val) | 83 | void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val) |
83 | { | 84 | { |
84 | struct mac802154_sub_if_data *priv = netdev_priv(dev); | 85 | struct mac802154_sub_if_data *priv = netdev_priv(dev); |
85 | 86 | ||
@@ -96,10 +97,10 @@ void mac802154_dev_set_short_addr(struct net_device *dev, u16 val) | |||
96 | } | 97 | } |
97 | } | 98 | } |
98 | 99 | ||
99 | u16 mac802154_dev_get_short_addr(const struct net_device *dev) | 100 | __le16 mac802154_dev_get_short_addr(const struct net_device *dev) |
100 | { | 101 | { |
101 | struct mac802154_sub_if_data *priv = netdev_priv(dev); | 102 | struct mac802154_sub_if_data *priv = netdev_priv(dev); |
102 | u16 ret; | 103 | __le16 ret; |
103 | 104 | ||
104 | BUG_ON(dev->type != ARPHRD_IEEE802154); | 105 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
105 | 106 | ||
@@ -114,20 +115,21 @@ void mac802154_dev_set_ieee_addr(struct net_device *dev) | |||
114 | { | 115 | { |
115 | struct mac802154_sub_if_data *priv = netdev_priv(dev); | 116 | struct mac802154_sub_if_data *priv = netdev_priv(dev); |
116 | struct mac802154_priv *mac = priv->hw; | 117 | struct mac802154_priv *mac = priv->hw; |
118 | __le64 addr; | ||
117 | 119 | ||
118 | if (mac->ops->set_hw_addr_filt && | 120 | addr = ieee802154_devaddr_from_raw(dev->dev_addr); |
119 | memcmp(mac->hw.hw_filt.ieee_addr, | 121 | priv->extended_addr = addr; |
120 | dev->dev_addr, IEEE802154_ADDR_LEN)) { | 122 | |
121 | memcpy(mac->hw.hw_filt.ieee_addr, | 123 | if (mac->ops->set_hw_addr_filt && mac->hw.hw_filt.ieee_addr != addr) { |
122 | dev->dev_addr, IEEE802154_ADDR_LEN); | 124 | mac->hw.hw_filt.ieee_addr = addr; |
123 | set_hw_addr_filt(dev, IEEE802515_AFILT_IEEEADDR_CHANGED); | 125 | set_hw_addr_filt(dev, IEEE802515_AFILT_IEEEADDR_CHANGED); |
124 | } | 126 | } |
125 | } | 127 | } |
126 | 128 | ||
127 | u16 mac802154_dev_get_pan_id(const struct net_device *dev) | 129 | __le16 mac802154_dev_get_pan_id(const struct net_device *dev) |
128 | { | 130 | { |
129 | struct mac802154_sub_if_data *priv = netdev_priv(dev); | 131 | struct mac802154_sub_if_data *priv = netdev_priv(dev); |
130 | u16 ret; | 132 | __le16 ret; |
131 | 133 | ||
132 | BUG_ON(dev->type != ARPHRD_IEEE802154); | 134 | BUG_ON(dev->type != ARPHRD_IEEE802154); |
133 | 135 | ||
@@ -138,7 +140,7 @@ u16 mac802154_dev_get_pan_id(const struct net_device *dev) | |||
138 | return ret; | 140 | return ret; |
139 | } | 141 | } |
140 | 142 | ||
141 | void mac802154_dev_set_pan_id(struct net_device *dev, u16 val) | 143 | void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val) |
142 | { | 144 | { |
143 | struct mac802154_sub_if_data *priv = netdev_priv(dev); | 145 | struct mac802154_sub_if_data *priv = netdev_priv(dev); |
144 | 146 | ||
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index b2bc3f030190..43e886bb9073 100644 --- a/net/mac802154/wpan.c +++ b/net/mac802154/wpan.c | |||
@@ -76,19 +76,25 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
76 | 76 | ||
77 | switch (cmd) { | 77 | switch (cmd) { |
78 | case SIOCGIFADDR: | 78 | case SIOCGIFADDR: |
79 | if (priv->pan_id == IEEE802154_PANID_BROADCAST || | 79 | { |
80 | priv->short_addr == IEEE802154_ADDR_BROADCAST) { | 80 | u16 pan_id, short_addr; |
81 | |||
82 | pan_id = le16_to_cpu(priv->pan_id); | ||
83 | short_addr = le16_to_cpu(priv->short_addr); | ||
84 | if (pan_id == IEEE802154_PANID_BROADCAST || | ||
85 | short_addr == IEEE802154_ADDR_BROADCAST) { | ||
81 | err = -EADDRNOTAVAIL; | 86 | err = -EADDRNOTAVAIL; |
82 | break; | 87 | break; |
83 | } | 88 | } |
84 | 89 | ||
85 | sa->family = AF_IEEE802154; | 90 | sa->family = AF_IEEE802154; |
86 | sa->addr.addr_type = IEEE802154_ADDR_SHORT; | 91 | sa->addr.addr_type = IEEE802154_ADDR_SHORT; |
87 | sa->addr.pan_id = priv->pan_id; | 92 | sa->addr.pan_id = pan_id; |
88 | sa->addr.short_addr = priv->short_addr; | 93 | sa->addr.short_addr = short_addr; |
89 | 94 | ||
90 | err = 0; | 95 | err = 0; |
91 | break; | 96 | break; |
97 | } | ||
92 | case SIOCSIFADDR: | 98 | case SIOCSIFADDR: |
93 | dev_warn(&dev->dev, | 99 | dev_warn(&dev->dev, |
94 | "Using DEBUGing ioctl SIOCSIFADDR isn't recommened!\n"); | 100 | "Using DEBUGing ioctl SIOCSIFADDR isn't recommened!\n"); |
@@ -101,8 +107,8 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
101 | break; | 107 | break; |
102 | } | 108 | } |
103 | 109 | ||
104 | priv->pan_id = sa->addr.pan_id; | 110 | priv->pan_id = cpu_to_le16(sa->addr.pan_id); |
105 | priv->short_addr = sa->addr.short_addr; | 111 | priv->short_addr = cpu_to_le16(sa->addr.short_addr); |
106 | 112 | ||
107 | err = 0; | 113 | err = 0; |
108 | break; | 114 | break; |
@@ -151,18 +157,18 @@ static int mac802154_header_create(struct sk_buff *skb, | |||
151 | if (!saddr) { | 157 | if (!saddr) { |
152 | spin_lock_bh(&priv->mib_lock); | 158 | spin_lock_bh(&priv->mib_lock); |
153 | 159 | ||
154 | if (priv->short_addr == IEEE802154_ADDR_BROADCAST || | 160 | if (priv->short_addr == cpu_to_le16(IEEE802154_ADDR_BROADCAST) || |
155 | priv->short_addr == IEEE802154_ADDR_UNDEF || | 161 | priv->short_addr == cpu_to_le16(IEEE802154_ADDR_UNDEF) || |
156 | priv->pan_id == IEEE802154_PANID_BROADCAST) { | 162 | priv->pan_id == cpu_to_le16(IEEE802154_PANID_BROADCAST)) { |
157 | dev_addr.addr_type = IEEE802154_ADDR_LONG; | 163 | dev_addr.addr_type = IEEE802154_ADDR_LONG; |
158 | memcpy(dev_addr.hwaddr, dev->dev_addr, | 164 | memcpy(dev_addr.hwaddr, dev->dev_addr, |
159 | IEEE802154_ADDR_LEN); | 165 | IEEE802154_ADDR_LEN); |
160 | } else { | 166 | } else { |
161 | dev_addr.addr_type = IEEE802154_ADDR_SHORT; | 167 | dev_addr.addr_type = IEEE802154_ADDR_SHORT; |
162 | dev_addr.short_addr = priv->short_addr; | 168 | dev_addr.short_addr = le16_to_cpu(priv->short_addr); |
163 | } | 169 | } |
164 | 170 | ||
165 | dev_addr.pan_id = priv->pan_id; | 171 | dev_addr.pan_id = le16_to_cpu(priv->pan_id); |
166 | saddr = &dev_addr; | 172 | saddr = &dev_addr; |
167 | 173 | ||
168 | spin_unlock_bh(&priv->mib_lock); | 174 | spin_unlock_bh(&priv->mib_lock); |
@@ -382,8 +388,8 @@ void mac802154_wpan_setup(struct net_device *dev) | |||
382 | get_random_bytes(&priv->bsn, 1); | 388 | get_random_bytes(&priv->bsn, 1); |
383 | get_random_bytes(&priv->dsn, 1); | 389 | get_random_bytes(&priv->dsn, 1); |
384 | 390 | ||
385 | priv->pan_id = IEEE802154_PANID_BROADCAST; | 391 | priv->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST); |
386 | priv->short_addr = IEEE802154_ADDR_BROADCAST; | 392 | priv->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST); |
387 | } | 393 | } |
388 | 394 | ||
389 | static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb) | 395 | static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb) |
@@ -394,10 +400,15 @@ static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb) | |||
394 | static int | 400 | static int |
395 | mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb) | 401 | mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb) |
396 | { | 402 | { |
403 | u16 span, sshort; | ||
404 | |||
397 | pr_debug("getting packet via slave interface %s\n", sdata->dev->name); | 405 | pr_debug("getting packet via slave interface %s\n", sdata->dev->name); |
398 | 406 | ||
399 | spin_lock_bh(&sdata->mib_lock); | 407 | spin_lock_bh(&sdata->mib_lock); |
400 | 408 | ||
409 | span = le16_to_cpu(sdata->pan_id); | ||
410 | sshort = le16_to_cpu(sdata->short_addr); | ||
411 | |||
401 | switch (mac_cb(skb)->da.addr_type) { | 412 | switch (mac_cb(skb)->da.addr_type) { |
402 | case IEEE802154_ADDR_NONE: | 413 | case IEEE802154_ADDR_NONE: |
403 | if (mac_cb(skb)->sa.addr_type != IEEE802154_ADDR_NONE) | 414 | if (mac_cb(skb)->sa.addr_type != IEEE802154_ADDR_NONE) |
@@ -408,7 +419,7 @@ mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb) | |||
408 | skb->pkt_type = PACKET_HOST; | 419 | skb->pkt_type = PACKET_HOST; |
409 | break; | 420 | break; |
410 | case IEEE802154_ADDR_LONG: | 421 | case IEEE802154_ADDR_LONG: |
411 | if (mac_cb(skb)->da.pan_id != sdata->pan_id && | 422 | if (mac_cb(skb)->da.pan_id != span && |
412 | mac_cb(skb)->da.pan_id != IEEE802154_PANID_BROADCAST) | 423 | mac_cb(skb)->da.pan_id != IEEE802154_PANID_BROADCAST) |
413 | skb->pkt_type = PACKET_OTHERHOST; | 424 | skb->pkt_type = PACKET_OTHERHOST; |
414 | else if (!memcmp(mac_cb(skb)->da.hwaddr, sdata->dev->dev_addr, | 425 | else if (!memcmp(mac_cb(skb)->da.hwaddr, sdata->dev->dev_addr, |
@@ -418,10 +429,10 @@ mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb) | |||
418 | skb->pkt_type = PACKET_OTHERHOST; | 429 | skb->pkt_type = PACKET_OTHERHOST; |
419 | break; | 430 | break; |
420 | case IEEE802154_ADDR_SHORT: | 431 | case IEEE802154_ADDR_SHORT: |
421 | if (mac_cb(skb)->da.pan_id != sdata->pan_id && | 432 | if (mac_cb(skb)->da.pan_id != span && |
422 | mac_cb(skb)->da.pan_id != IEEE802154_PANID_BROADCAST) | 433 | mac_cb(skb)->da.pan_id != IEEE802154_PANID_BROADCAST) |
423 | skb->pkt_type = PACKET_OTHERHOST; | 434 | skb->pkt_type = PACKET_OTHERHOST; |
424 | else if (mac_cb(skb)->da.short_addr == sdata->short_addr) | 435 | else if (mac_cb(skb)->da.short_addr == sshort) |
425 | skb->pkt_type = PACKET_HOST; | 436 | skb->pkt_type = PACKET_HOST; |
426 | else if (mac_cb(skb)->da.short_addr == | 437 | else if (mac_cb(skb)->da.short_addr == |
427 | IEEE802154_ADDR_BROADCAST) | 438 | IEEE802154_ADDR_BROADCAST) |