| 1 | From ca7f714fc8c9981eda5d85594333f955f75510f7 Mon Sep 17 00:00:00 2001 |
| 2 | From: Xiangfu <xiangfu@openmobilefree.net> |
| 3 | Date: Tue, 5 Jun 2012 11:32:43 +0800 |
| 4 | Subject: [PATCH 1/3] 002 |
| 5 | |
| 6 | --- |
| 7 | drivers/ieee802154/Kconfig | 55 +++++++++++++++++++++++++++++++++++++-- |
| 8 | drivers/ieee802154/Makefile | 11 ++++++++ |
| 9 | drivers/ieee802154/fakehard.c | 12 ++++++++- |
| 10 | include/linux/if.h | 2 ++ |
| 11 | include/linux/if_arp.h | 2 ++ |
| 12 | include/linux/nl802154.h | 10 +++++-- |
| 13 | include/net/ieee802154_netdev.h | 17 +++++++++--- |
| 14 | include/net/wpan-phy.h | 8 +++--- |
| 15 | net/Kconfig | 2 ++ |
| 16 | net/Makefile | 1 + |
| 17 | net/ieee802154/Kconfig | 8 ++++++ |
| 18 | net/ieee802154/Makefile | 3 +++ |
| 19 | net/ieee802154/dgram.c | 3 +-- |
| 20 | net/ieee802154/ieee802154.h | 4 +++ |
| 21 | net/ieee802154/nl-mac.c | 2 +- |
| 22 | net/ieee802154/nl-phy.c | 20 +++++++++++--- |
| 23 | net/ieee802154/nl_policy.c | 1 + |
| 24 | net/ieee802154/wpan-class.c | 2 +- |
| 25 | 18 files changed, 145 insertions(+), 18 deletions(-) |
| 26 | |
| 27 | diff --git a/drivers/ieee802154/Kconfig b/drivers/ieee802154/Kconfig |
| 28 | index 9b9f43a..5345e40 100644 |
| 29 | --- a/drivers/ieee802154/Kconfig |
| 30 | +++ b/drivers/ieee802154/Kconfig |
| 31 | @@ -10,13 +10,64 @@ menuconfig IEEE802154_DRIVERS |
| 32 | If you say N, all options in this submenu will be skipped and |
| 33 | disabled. |
| 34 | |
| 35 | +config IEEE802154_DRIVER_DEBUG |
| 36 | + bool "Driver debugging messages" |
| 37 | + depends on IEEE802154_DRIVERS |
| 38 | + default y |
| 39 | + help |
| 40 | + Say Y here to make the IEEE 802.15.4 drivers generate extensive |
| 41 | + debugging messages. |
| 42 | + |
| 43 | config IEEE802154_FAKEHARD |
| 44 | tristate "Fake LR-WPAN driver with several interconnected devices" |
| 45 | depends on IEEE802154_DRIVERS |
| 46 | ---help--- |
| 47 | Say Y here to enable the fake driver that serves as an example |
| 48 | - of HardMAC device driver. |
| 49 | + of HardMAC device driver. |
| 50 | |
| 51 | - This driver can also be built as a module. To do so say M here. |
| 52 | + This driver can also be built as a module. To do so say M here. |
| 53 | The module will be called 'fakehard'. |
| 54 | |
| 55 | + |
| 56 | +config IEEE802154_FAKELB |
| 57 | + depends on IEEE802154_DRIVERS && MAC802154 |
| 58 | + tristate "Fake LR-WPAN driver with several interconnected devices" |
| 59 | + ---help--- |
| 60 | + Say Y here to enable the fake driver that can emulate a net |
| 61 | + of several interconnected radio devices. |
| 62 | + |
| 63 | + This driver can also be built as a module. To do so say M here. |
| 64 | + The module will be called 'fakelb'. |
| 65 | + |
| 66 | +config IEEE802154_SERIAL |
| 67 | + depends on IEEE802154_DRIVERS && MAC802154 |
| 68 | + tristate "Simple LR-WPAN UART driver" |
| 69 | + |
| 70 | +config IEEE802154_AT86RF230 |
| 71 | + depends on IEEE802154_DRIVERS && MAC802154 |
| 72 | + tristate "AT86RF230 transceiver driver" |
| 73 | + depends on SPI |
| 74 | + |
| 75 | +config SPI_ATBEN |
| 76 | + tristate "ATBEN 8:10 SPI interface" |
| 77 | + depends on JZ4740_QI_LB60 && IEEE802154_AT86RF230 |
| 78 | + help |
| 79 | + Bit-banging SPI driver for the 8:10 interface of the Ben NanoNote |
| 80 | + when equipped with an ATBEN board. |
| 81 | + |
| 82 | +config SPI_ATUSB |
| 83 | + tristate "ATUSB SPI interface" |
| 84 | + depends on USB && IEEE802154_AT86RF230 |
| 85 | + help |
| 86 | + SPI-over-USB driver for the ATUSB IEEE 802.15.4 board. |
| 87 | + |
| 88 | +config IEEE802154_CC2420 |
| 89 | + tristate "CC2420 driver" |
| 90 | + depends on SPI |
| 91 | + depends on IEEE802154_DRIVERS |
| 92 | + |
| 93 | +config IEEE802154_ADF7242 |
| 94 | + tristate "ADF7242 transceiver driver" |
| 95 | + depends on IEEE802154_DRIVERS && MAC802154 |
| 96 | + depends on SPI |
| 97 | + |
| 98 | diff --git a/drivers/ieee802154/Makefile b/drivers/ieee802154/Makefile |
| 99 | index 800a389..4f669bc 100644 |
| 100 | --- a/drivers/ieee802154/Makefile |
| 101 | +++ b/drivers/ieee802154/Makefile |
| 102 | @@ -1 +1,12 @@ |
| 103 | obj-$(CONFIG_IEEE802154_FAKEHARD) += fakehard.o |
| 104 | +obj-$(CONFIG_IEEE802154_FAKELB) += fakelb.o |
| 105 | +obj-$(CONFIG_IEEE802154_SERIAL) += serial.o |
| 106 | +obj-$(CONFIG_IEEE802154_AT86RF230) += at86rf230.o |
| 107 | +obj-$(CONFIG_IEEE802154_CC2420) += cc2420.o |
| 108 | +obj-$(CONFIG_IEEE802154_ADF7242) += adf7242.o |
| 109 | +obj-$(CONFIG_SPI_ATBEN) += spi_atben.o |
| 110 | +obj-$(CONFIG_SPI_ATUSB) += spi_atusb.o |
| 111 | + |
| 112 | +ccflags-y := -DDEBUG -DCONFIG_FFD |
| 113 | +ccflags-$(CONFIG_IEEE802154_DRIVER_DEBUG) += -DDEBUG |
| 114 | +ccflags-y += -DCONFIG_FFD |
| 115 | diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c |
| 116 | index 73d4531..996e1db 100644 |
| 117 | --- a/drivers/ieee802154/fakehard.c |
| 118 | +++ b/drivers/ieee802154/fakehard.c |
| 119 | @@ -259,7 +259,7 @@ static struct ieee802154_mlme_ops fake_mlme = { |
| 120 | .start_req = fake_start_req, |
| 121 | .scan_req = fake_scan_req, |
| 122 | |
| 123 | - .get_phy = fake_get_phy, |
| 124 | + .wpan_ops.get_phy = fake_get_phy, |
| 125 | |
| 126 | .get_pan_id = fake_get_pan_id, |
| 127 | .get_short_addr = fake_get_short_addr, |
| 128 | @@ -391,6 +391,16 @@ static int __devinit ieee802154fake_probe(struct platform_device *pdev) |
| 129 | priv = netdev_priv(dev); |
| 130 | priv->phy = phy; |
| 131 | |
| 132 | + /* |
| 133 | + * If the name is a format string the caller wants us to do a |
| 134 | + * name allocation. |
| 135 | + */ |
| 136 | + if (strchr(dev->name, '%')) { |
| 137 | + err = dev_alloc_name(dev, dev->name); |
| 138 | + if (err < 0) |
| 139 | + goto out; |
| 140 | + } |
| 141 | + |
| 142 | wpan_phy_set_dev(phy, &pdev->dev); |
| 143 | SET_NETDEV_DEV(dev, &phy->dev); |
| 144 | |
| 145 | diff --git a/include/linux/if.h b/include/linux/if.h |
| 146 | index cffa754..9f402a1 100644 |
| 147 | --- a/include/linux/if.h |
| 148 | +++ b/include/linux/if.h |
| 149 | @@ -82,6 +82,8 @@ |
| 150 | #define IFF_TEAM_PORT 0x40000 /* device used as team port */ |
| 151 | #define IFF_NO_IP_ALIGN 0x80000 /* do not ip-align allocated rx pkts */ |
| 152 | |
| 153 | +#define IFF_IEEE802154_COORD 0x400 /* IEEE802.15.4 PAN coordinator */ |
| 154 | + |
| 155 | #define IF_GET_IFACE 0x0001 /* for querying only */ |
| 156 | #define IF_GET_PROTO 0x0002 |
| 157 | |
| 158 | diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h |
| 159 | index 6d722f4..47a57d8 100644 |
| 160 | --- a/include/linux/if_arp.h |
| 161 | +++ b/include/linux/if_arp.h |
| 162 | @@ -87,6 +87,8 @@ |
| 163 | #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ |
| 164 | #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ |
| 165 | #define ARPHRD_IEEE802154 804 |
| 166 | +#define ARPHRD_IEEE802154_MONITOR 805 |
| 167 | +#define ARPHRD_SMAC 806 /* Freescale Simple MAC */ |
| 168 | |
| 169 | #define ARPHRD_PHONET 820 /* PhoNet media type */ |
| 170 | #define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ |
| 171 | diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h |
| 172 | index 33d9f51..a379fc7 100644 |
| 173 | --- a/include/linux/nl802154.h |
| 174 | +++ b/include/linux/nl802154.h |
| 175 | @@ -68,14 +68,13 @@ enum { |
| 176 | IEEE802154_ATTR_CHANNEL_PAGE_LIST, |
| 177 | |
| 178 | IEEE802154_ATTR_PHY_NAME, |
| 179 | + IEEE802154_ATTR_DEV_TYPE, |
| 180 | |
| 181 | __IEEE802154_ATTR_MAX, |
| 182 | }; |
| 183 | |
| 184 | #define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) |
| 185 | |
| 186 | -extern const struct nla_policy ieee802154_policy[]; |
| 187 | - |
| 188 | /* commands */ |
| 189 | /* REQ should be responded with CONF |
| 190 | * and INDIC with RESP |
| 191 | @@ -126,4 +125,11 @@ enum { |
| 192 | |
| 193 | #define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) |
| 194 | |
| 195 | +enum { |
| 196 | + IEEE802154_DEV_WPAN, |
| 197 | + IEEE802154_DEV_MONITOR, |
| 198 | + IEEE802154_DEV_SMAC, |
| 199 | + __IEEE802154_DEV_MAX, |
| 200 | +}; |
| 201 | + |
| 202 | #endif |
| 203 | diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h |
| 204 | index 5743055..e12ce9a 100644 |
| 205 | --- a/include/net/ieee802154_netdev.h |
| 206 | +++ b/include/net/ieee802154_netdev.h |
| 207 | @@ -26,6 +26,8 @@ |
| 208 | #ifndef IEEE802154_NETDEVICE_H |
| 209 | #define IEEE802154_NETDEVICE_H |
| 210 | |
| 211 | +#include <net/af_ieee802154.h> |
| 212 | + |
| 213 | /* |
| 214 | * A control block of skb passed between the ARPHRD_IEEE802154 device |
| 215 | * and other stack parts. |
| 216 | @@ -81,7 +83,12 @@ struct wpan_phy; |
| 217 | * get_phy should increment the reference counting on returned phy. |
| 218 | * Use wpan_wpy_put to put that reference. |
| 219 | */ |
| 220 | +struct simple_mlme_ops { |
| 221 | + struct wpan_phy *(*get_phy)(const struct net_device *dev); |
| 222 | +}; |
| 223 | struct ieee802154_mlme_ops { |
| 224 | + struct simple_mlme_ops wpan_ops; |
| 225 | + |
| 226 | int (*assoc_req)(struct net_device *dev, |
| 227 | struct ieee802154_addr *addr, |
| 228 | u8 channel, u8 page, u8 cap); |
| 229 | @@ -98,8 +105,6 @@ struct ieee802154_mlme_ops { |
| 230 | int (*scan_req)(struct net_device *dev, |
| 231 | u8 type, u32 channels, u8 page, u8 duration); |
| 232 | |
| 233 | - struct wpan_phy *(*get_phy)(const struct net_device *dev); |
| 234 | - |
| 235 | /* |
| 236 | * FIXME: these should become the part of PIB/MIB interface. |
| 237 | * However we still don't have IB interface of any kind |
| 238 | @@ -110,12 +115,18 @@ struct ieee802154_mlme_ops { |
| 239 | u8 (*get_bsn)(const struct net_device *dev); |
| 240 | }; |
| 241 | |
| 242 | -static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( |
| 243 | +static inline struct simple_mlme_ops *simple_mlme_ops( |
| 244 | const struct net_device *dev) |
| 245 | { |
| 246 | return dev->ml_priv; |
| 247 | } |
| 248 | |
| 249 | +static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( |
| 250 | + const struct net_device *dev) |
| 251 | +{ |
| 252 | + return container_of(dev->ml_priv, struct ieee802154_mlme_ops, wpan_ops); |
| 253 | +} |
| 254 | + |
| 255 | #endif |
| 256 | |
| 257 | |
| 258 | diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h |
| 259 | index d86fffd..9e119c5 100644 |
| 260 | --- a/include/net/wpan-phy.h |
| 261 | +++ b/include/net/wpan-phy.h |
| 262 | @@ -24,17 +24,19 @@ |
| 263 | #include <linux/netdevice.h> |
| 264 | #include <linux/mutex.h> |
| 265 | |
| 266 | +#define WPAN_NUM_PAGES 32 |
| 267 | + |
| 268 | struct wpan_phy { |
| 269 | struct mutex pib_lock; |
| 270 | |
| 271 | /* |
| 272 | - * This is a PIB according to 802.15.4-2006. |
| 273 | + * This is a PIB acording to 802.15.4-2006. |
| 274 | * We do not provide timing-related variables, as they |
| 275 | * aren't used outside of driver |
| 276 | */ |
| 277 | u8 current_channel; |
| 278 | u8 current_page; |
| 279 | - u32 channels_supported[32]; |
| 280 | + u32 channels_supported[WPAN_NUM_PAGES]; |
| 281 | u8 transmit_power; |
| 282 | u8 cca_mode; |
| 283 | |
| 284 | @@ -42,7 +44,7 @@ struct wpan_phy { |
| 285 | int idx; |
| 286 | |
| 287 | struct net_device *(*add_iface)(struct wpan_phy *phy, |
| 288 | - const char *name); |
| 289 | + const char *name, int type); |
| 290 | void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); |
| 291 | |
| 292 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); |
| 293 | diff --git a/net/Kconfig b/net/Kconfig |
| 294 | index b3904e8..578eb11 100644 |
| 295 | --- a/net/Kconfig |
| 296 | +++ b/net/Kconfig |
| 297 | @@ -217,6 +217,8 @@ source "net/econet/Kconfig" |
| 298 | source "net/wanrouter/Kconfig" |
| 299 | source "net/phonet/Kconfig" |
| 300 | source "net/ieee802154/Kconfig" |
| 301 | +source "net/mac802154/Kconfig" |
| 302 | +source "net/zigbee/Kconfig" |
| 303 | source "net/sched/Kconfig" |
| 304 | source "net/dcb/Kconfig" |
| 305 | source "net/dns_resolver/Kconfig" |
| 306 | diff --git a/net/Makefile b/net/Makefile |
| 307 | index ad432fa..2a97cde 100644 |
| 308 | --- a/net/Makefile |
| 309 | +++ b/net/Makefile |
| 310 | @@ -60,6 +60,7 @@ ifneq ($(CONFIG_DCB),) |
| 311 | obj-y += dcb/ |
| 312 | endif |
| 313 | obj-$(CONFIG_IEEE802154) += ieee802154/ |
| 314 | +obj-$(CONFIG_MAC802154) += mac802154/ |
| 315 | |
| 316 | ifeq ($(CONFIG_NET),y) |
| 317 | obj-$(CONFIG_SYSCTL) += sysctl_net.o |
| 318 | diff --git a/net/ieee802154/Kconfig b/net/ieee802154/Kconfig |
| 319 | index 7dee650..3dea3c1 100644 |
| 320 | --- a/net/ieee802154/Kconfig |
| 321 | +++ b/net/ieee802154/Kconfig |
| 322 | @@ -16,3 +16,11 @@ config IEEE802154_6LOWPAN |
| 323 | depends on IEEE802154 && IPV6 |
| 324 | ---help--- |
| 325 | IPv6 compression over IEEE 802.15.4. |
| 326 | + |
| 327 | +config IEEE802154_PROTO_DEBUG |
| 328 | + bool "IEEE 802.15.4 protocol stack debugging messages" |
| 329 | + depends on IEEE802154 |
| 330 | + default y |
| 331 | + help |
| 332 | + Say Y here to make the IEEE 802.15.4 protocol stack generate |
| 333 | + extensive debugging messages. |
| 334 | diff --git a/net/ieee802154/Makefile b/net/ieee802154/Makefile |
| 335 | index d7716d6..e2b6735 100644 |
| 336 | --- a/net/ieee802154/Makefile |
| 337 | +++ b/net/ieee802154/Makefile |
| 338 | @@ -3,3 +3,6 @@ obj-$(CONFIG_IEEE802154_6LOWPAN) += 6lowpan.o |
| 339 | |
| 340 | ieee802154-y := netlink.o nl-mac.o nl-phy.o nl_policy.o wpan-class.o |
| 341 | af_802154-y := af_ieee802154.o raw.o dgram.o |
| 342 | + |
| 343 | +ccflags-$(CONFIG_IEEE802154_PROTO_DEBUG) += -DDEBUG |
| 344 | +ccflags-y += -Wall |
| 345 | diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c |
| 346 | index 1b09eaa..7883fa6 100644 |
| 347 | --- a/net/ieee802154/dgram.c |
| 348 | +++ b/net/ieee802154/dgram.c |
| 349 | @@ -130,8 +130,7 @@ static int dgram_ioctl(struct sock *sk, int cmd, unsigned long arg) |
| 350 | switch (cmd) { |
| 351 | case SIOCOUTQ: |
| 352 | { |
| 353 | - int amount = sk_wmem_alloc_get(sk); |
| 354 | - |
| 355 | + int amount = atomic_read(&sk->sk_wmem_alloc); |
| 356 | return put_user(amount, (int __user *)arg); |
| 357 | } |
| 358 | |
| 359 | diff --git a/net/ieee802154/ieee802154.h b/net/ieee802154/ieee802154.h |
| 360 | index aadec42..e78d6c6 100644 |
| 361 | --- a/net/ieee802154/ieee802154.h |
| 362 | +++ b/net/ieee802154/ieee802154.h |
| 363 | @@ -21,6 +21,10 @@ |
| 364 | int __init ieee802154_nl_init(void); |
| 365 | void __exit ieee802154_nl_exit(void); |
| 366 | |
| 367 | +#include <net/netlink.h> |
| 368 | + |
| 369 | +extern const struct nla_policy ieee802154_policy[]; |
| 370 | + |
| 371 | #define IEEE802154_OP(_cmd, _func) \ |
| 372 | { \ |
| 373 | .cmd = _cmd, \ |
| 374 | diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c |
| 375 | index adaf462..1d23aa6 100644 |
| 376 | --- a/net/ieee802154/nl-mac.c |
| 377 | +++ b/net/ieee802154/nl-mac.c |
| 378 | @@ -263,7 +263,7 @@ static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 pid, |
| 379 | if (!hdr) |
| 380 | goto out; |
| 381 | |
| 382 | - phy = ieee802154_mlme_ops(dev)->get_phy(dev); |
| 383 | + phy = simple_mlme_ops(dev)->get_phy(dev); |
| 384 | BUG_ON(!phy); |
| 385 | |
| 386 | NLA_PUT_STRING(msg, IEEE802154_ATTR_DEV_NAME, dev->name); |
| 387 | diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c |
| 388 | index c64a38d..76ef7a3 100644 |
| 389 | --- a/net/ieee802154/nl-phy.c |
| 390 | +++ b/net/ieee802154/nl-phy.c |
| 391 | @@ -57,7 +57,7 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 pid, |
| 392 | |
| 393 | NLA_PUT_U8(msg, IEEE802154_ATTR_PAGE, phy->current_page); |
| 394 | NLA_PUT_U8(msg, IEEE802154_ATTR_CHANNEL, phy->current_channel); |
| 395 | - for (i = 0; i < 32; i++) { |
| 396 | + for (i = 0; i < WPAN_NUM_PAGES; i++) { |
| 397 | if (phy->channels_supported[i]) |
| 398 | buf[pages++] = phy->channels_supported[i] | (i << 27); |
| 399 | } |
| 400 | @@ -179,6 +179,7 @@ static int ieee802154_add_iface(struct sk_buff *skb, |
| 401 | const char *devname; |
| 402 | int rc = -ENOBUFS; |
| 403 | struct net_device *dev; |
| 404 | + int type = IEEE802154_DEV_WPAN; |
| 405 | |
| 406 | pr_debug("%s\n", __func__); |
| 407 | |
| 408 | @@ -201,6 +202,19 @@ static int ieee802154_add_iface(struct sk_buff *skb, |
| 409 | if (strlen(devname) >= IFNAMSIZ) |
| 410 | return -ENAMETOOLONG; |
| 411 | |
| 412 | + if (info->attrs[IEEE802154_ATTR_HW_ADDR] && |
| 413 | + nla_len(info->attrs[IEEE802154_ATTR_HW_ADDR]) != |
| 414 | + IEEE802154_ADDR_LEN) { |
| 415 | + return -EINVAL; |
| 416 | + } |
| 417 | + |
| 418 | + if (info->attrs[IEEE802154_ATTR_DEV_TYPE]) { |
| 419 | + type = nla_get_u8(info->attrs[IEEE802154_ATTR_DEV_TYPE]); |
| 420 | + if (type > __IEEE802154_DEV_MAX) { |
| 421 | + return -EINVAL; |
| 422 | + } |
| 423 | + } |
| 424 | + |
| 425 | phy = wpan_phy_find(name); |
| 426 | if (!phy) |
| 427 | return -ENODEV; |
| 428 | @@ -221,7 +235,7 @@ static int ieee802154_add_iface(struct sk_buff *skb, |
| 429 | goto nla_put_failure; |
| 430 | } |
| 431 | |
| 432 | - dev = phy->add_iface(phy, devname); |
| 433 | + dev = phy->add_iface(phy, devname, type); |
| 434 | if (IS_ERR(dev)) { |
| 435 | rc = PTR_ERR(dev); |
| 436 | goto nla_put_failure; |
| 437 | @@ -288,7 +302,7 @@ static int ieee802154_del_iface(struct sk_buff *skb, |
| 438 | if (!dev) |
| 439 | return -ENODEV; |
| 440 | |
| 441 | - phy = ieee802154_mlme_ops(dev)->get_phy(dev); |
| 442 | + phy = simple_mlme_ops(dev)->get_phy(dev); |
| 443 | BUG_ON(!phy); |
| 444 | |
| 445 | rc = -EINVAL; |
| 446 | diff --git a/net/ieee802154/nl_policy.c b/net/ieee802154/nl_policy.c |
| 447 | index 6adda4d..235cd65 100644 |
| 448 | --- a/net/ieee802154/nl_policy.c |
| 449 | +++ b/net/ieee802154/nl_policy.c |
| 450 | @@ -28,6 +28,7 @@ const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = { |
| 451 | [IEEE802154_ATTR_DEV_NAME] = { .type = NLA_STRING, }, |
| 452 | [IEEE802154_ATTR_DEV_INDEX] = { .type = NLA_U32, }, |
| 453 | [IEEE802154_ATTR_PHY_NAME] = { .type = NLA_STRING, }, |
| 454 | + [IEEE802154_ATTR_DEV_TYPE] = { .type = NLA_U8, }, |
| 455 | |
| 456 | [IEEE802154_ATTR_STATUS] = { .type = NLA_U8, }, |
| 457 | [IEEE802154_ATTR_SHORT_ADDR] = { .type = NLA_U16, }, |
| 458 | diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c |
| 459 | index 1627ef2..380fe1a 100644 |
| 460 | --- a/net/ieee802154/wpan-class.c |
| 461 | +++ b/net/ieee802154/wpan-class.c |
| 462 | @@ -56,7 +56,7 @@ static ssize_t channels_supported_show(struct device *dev, |
| 463 | int i, len = 0; |
| 464 | |
| 465 | mutex_lock(&phy->pib_lock); |
| 466 | - for (i = 0; i < 32; i++) { |
| 467 | + for (i = 0; i < WPAN_NUM_PAGES; i++) { |
| 468 | ret = snprintf(buf + len, PAGE_SIZE - len, |
| 469 | "%#09x\n", phy->channels_supported[i]); |
| 470 | if (ret < 0) |
| 471 | -- |
| 472 | 1.7.9.5 |
| 473 | |
| 474 | |