diff options
| author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2009-08-19 11:32:24 -0400 |
|---|---|---|
| committer | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2009-08-19 15:08:22 -0400 |
| commit | 16eea493da563b5a3356a77c6d8776dffc29d3b6 (patch) | |
| tree | 6a6444442b8d7789d4c2fcb8ba990453969121fc /net/ieee802154 | |
| parent | 81f9510381ee43205564063f2e8650672b11d453 (diff) | |
ieee802154: add support for channel pages from IEEE 802.15.4-2006
IEEE 802.15.4-2006 adds new concept: channel pages, which can contain several
channels. Add support for channel pages in the API and in the fakehard driver.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Diffstat (limited to 'net/ieee802154')
| -rw-r--r-- | net/ieee802154/netlink.c | 28 | ||||
| -rw-r--r-- | net/ieee802154/nl_policy.c | 1 |
2 files changed, 26 insertions, 3 deletions
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c index cd0567f06716..2106ecbf0308 100644 --- a/net/ieee802154/netlink.c +++ b/net/ieee802154/netlink.c | |||
| @@ -232,7 +232,7 @@ nla_put_failure: | |||
| 232 | EXPORT_SYMBOL(ieee802154_nl_beacon_indic); | 232 | EXPORT_SYMBOL(ieee802154_nl_beacon_indic); |
| 233 | 233 | ||
| 234 | int ieee802154_nl_scan_confirm(struct net_device *dev, | 234 | int ieee802154_nl_scan_confirm(struct net_device *dev, |
| 235 | u8 status, u8 scan_type, u32 unscanned, | 235 | u8 status, u8 scan_type, u32 unscanned, u8 page, |
| 236 | u8 *edl/* , struct list_head *pan_desc_list */) | 236 | u8 *edl/* , struct list_head *pan_desc_list */) |
| 237 | { | 237 | { |
| 238 | struct sk_buff *msg; | 238 | struct sk_buff *msg; |
| @@ -251,6 +251,7 @@ int ieee802154_nl_scan_confirm(struct net_device *dev, | |||
| 251 | NLA_PUT_U8(msg, IEEE802154_ATTR_STATUS, status); | 251 | NLA_PUT_U8(msg, IEEE802154_ATTR_STATUS, status); |
| 252 | NLA_PUT_U8(msg, IEEE802154_ATTR_SCAN_TYPE, scan_type); | 252 | NLA_PUT_U8(msg, IEEE802154_ATTR_SCAN_TYPE, scan_type); |
| 253 | NLA_PUT_U32(msg, IEEE802154_ATTR_CHANNELS, unscanned); | 253 | NLA_PUT_U32(msg, IEEE802154_ATTR_CHANNELS, unscanned); |
| 254 | NLA_PUT_U8(msg, IEEE802154_ATTR_PAGE, page); | ||
| 254 | 255 | ||
| 255 | if (edl) | 256 | if (edl) |
| 256 | NLA_PUT(msg, IEEE802154_ATTR_ED_LIST, 27, edl); | 257 | NLA_PUT(msg, IEEE802154_ATTR_ED_LIST, 27, edl); |
| @@ -349,6 +350,7 @@ static int ieee802154_associate_req(struct sk_buff *skb, | |||
| 349 | { | 350 | { |
| 350 | struct net_device *dev; | 351 | struct net_device *dev; |
| 351 | struct ieee802154_addr addr; | 352 | struct ieee802154_addr addr; |
| 353 | u8 page; | ||
| 352 | int ret = -EINVAL; | 354 | int ret = -EINVAL; |
| 353 | 355 | ||
| 354 | if (!info->attrs[IEEE802154_ATTR_CHANNEL] || | 356 | if (!info->attrs[IEEE802154_ATTR_CHANNEL] || |
| @@ -374,8 +376,14 @@ static int ieee802154_associate_req(struct sk_buff *skb, | |||
| 374 | } | 376 | } |
| 375 | addr.pan_id = nla_get_u16(info->attrs[IEEE802154_ATTR_COORD_PAN_ID]); | 377 | addr.pan_id = nla_get_u16(info->attrs[IEEE802154_ATTR_COORD_PAN_ID]); |
| 376 | 378 | ||
| 379 | if (info->attrs[IEEE802154_ATTR_PAGE]) | ||
| 380 | page = nla_get_u8(info->attrs[IEEE802154_ATTR_PAGE]); | ||
| 381 | else | ||
| 382 | page = 0; | ||
| 383 | |||
| 377 | ret = ieee802154_mlme_ops(dev)->assoc_req(dev, &addr, | 384 | ret = ieee802154_mlme_ops(dev)->assoc_req(dev, &addr, |
| 378 | nla_get_u8(info->attrs[IEEE802154_ATTR_CHANNEL]), | 385 | nla_get_u8(info->attrs[IEEE802154_ATTR_CHANNEL]), |
| 386 | page, | ||
| 379 | nla_get_u8(info->attrs[IEEE802154_ATTR_CAPABILITY])); | 387 | nla_get_u8(info->attrs[IEEE802154_ATTR_CAPABILITY])); |
| 380 | 388 | ||
| 381 | dev_put(dev); | 389 | dev_put(dev); |
| @@ -458,6 +466,7 @@ static int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info) | |||
| 458 | struct ieee802154_addr addr; | 466 | struct ieee802154_addr addr; |
| 459 | 467 | ||
| 460 | u8 channel, bcn_ord, sf_ord; | 468 | u8 channel, bcn_ord, sf_ord; |
| 469 | u8 page; | ||
| 461 | int pan_coord, blx, coord_realign; | 470 | int pan_coord, blx, coord_realign; |
| 462 | int ret; | 471 | int ret; |
| 463 | 472 | ||
| @@ -488,13 +497,19 @@ static int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info) | |||
| 488 | blx = nla_get_u8(info->attrs[IEEE802154_ATTR_BAT_EXT]); | 497 | blx = nla_get_u8(info->attrs[IEEE802154_ATTR_BAT_EXT]); |
| 489 | coord_realign = nla_get_u8(info->attrs[IEEE802154_ATTR_COORD_REALIGN]); | 498 | coord_realign = nla_get_u8(info->attrs[IEEE802154_ATTR_COORD_REALIGN]); |
| 490 | 499 | ||
| 500 | if (info->attrs[IEEE802154_ATTR_PAGE]) | ||
| 501 | page = nla_get_u8(info->attrs[IEEE802154_ATTR_PAGE]); | ||
| 502 | else | ||
| 503 | page = 0; | ||
| 504 | |||
| 505 | |||
| 491 | if (addr.short_addr == IEEE802154_ADDR_BROADCAST) { | 506 | if (addr.short_addr == IEEE802154_ADDR_BROADCAST) { |
| 492 | ieee802154_nl_start_confirm(dev, IEEE802154_NO_SHORT_ADDRESS); | 507 | ieee802154_nl_start_confirm(dev, IEEE802154_NO_SHORT_ADDRESS); |
| 493 | dev_put(dev); | 508 | dev_put(dev); |
| 494 | return -EINVAL; | 509 | return -EINVAL; |
| 495 | } | 510 | } |
| 496 | 511 | ||
| 497 | ret = ieee802154_mlme_ops(dev)->start_req(dev, &addr, channel, | 512 | ret = ieee802154_mlme_ops(dev)->start_req(dev, &addr, channel, page, |
| 498 | bcn_ord, sf_ord, pan_coord, blx, coord_realign); | 513 | bcn_ord, sf_ord, pan_coord, blx, coord_realign); |
| 499 | 514 | ||
| 500 | dev_put(dev); | 515 | dev_put(dev); |
| @@ -508,6 +523,7 @@ static int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info) | |||
| 508 | u8 type; | 523 | u8 type; |
| 509 | u32 channels; | 524 | u32 channels; |
| 510 | u8 duration; | 525 | u8 duration; |
| 526 | u8 page; | ||
| 511 | 527 | ||
| 512 | if (!info->attrs[IEEE802154_ATTR_SCAN_TYPE] || | 528 | if (!info->attrs[IEEE802154_ATTR_SCAN_TYPE] || |
| 513 | !info->attrs[IEEE802154_ATTR_CHANNELS] || | 529 | !info->attrs[IEEE802154_ATTR_CHANNELS] || |
| @@ -522,7 +538,13 @@ static int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info) | |||
| 522 | channels = nla_get_u32(info->attrs[IEEE802154_ATTR_CHANNELS]); | 538 | channels = nla_get_u32(info->attrs[IEEE802154_ATTR_CHANNELS]); |
| 523 | duration = nla_get_u8(info->attrs[IEEE802154_ATTR_DURATION]); | 539 | duration = nla_get_u8(info->attrs[IEEE802154_ATTR_DURATION]); |
| 524 | 540 | ||
| 525 | ret = ieee802154_mlme_ops(dev)->scan_req(dev, type, channels, | 541 | if (info->attrs[IEEE802154_ATTR_PAGE]) |
| 542 | page = nla_get_u8(info->attrs[IEEE802154_ATTR_PAGE]); | ||
| 543 | else | ||
| 544 | page = 0; | ||
| 545 | |||
| 546 | |||
| 547 | ret = ieee802154_mlme_ops(dev)->scan_req(dev, type, channels, page, | ||
| 526 | duration); | 548 | duration); |
| 527 | 549 | ||
| 528 | dev_put(dev); | 550 | dev_put(dev); |
diff --git a/net/ieee802154/nl_policy.c b/net/ieee802154/nl_policy.c index 83cb4ccef90d..2363ebee02e7 100644 --- a/net/ieee802154/nl_policy.c +++ b/net/ieee802154/nl_policy.c | |||
| @@ -33,6 +33,7 @@ const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = { | |||
| 33 | [IEEE802154_ATTR_HW_ADDR] = { .type = NLA_HW_ADDR, }, | 33 | [IEEE802154_ATTR_HW_ADDR] = { .type = NLA_HW_ADDR, }, |
| 34 | [IEEE802154_ATTR_PAN_ID] = { .type = NLA_U16, }, | 34 | [IEEE802154_ATTR_PAN_ID] = { .type = NLA_U16, }, |
| 35 | [IEEE802154_ATTR_CHANNEL] = { .type = NLA_U8, }, | 35 | [IEEE802154_ATTR_CHANNEL] = { .type = NLA_U8, }, |
| 36 | [IEEE802154_ATTR_PAGE] = { .type = NLA_U8, }, | ||
| 36 | [IEEE802154_ATTR_COORD_SHORT_ADDR] = { .type = NLA_U16, }, | 37 | [IEEE802154_ATTR_COORD_SHORT_ADDR] = { .type = NLA_U16, }, |
| 37 | [IEEE802154_ATTR_COORD_HW_ADDR] = { .type = NLA_HW_ADDR, }, | 38 | [IEEE802154_ATTR_COORD_HW_ADDR] = { .type = NLA_HW_ADDR, }, |
| 38 | [IEEE802154_ATTR_COORD_PAN_ID] = { .type = NLA_U16, }, | 39 | [IEEE802154_ATTR_COORD_PAN_ID] = { .type = NLA_U16, }, |
