diff options
| author | Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> | 2013-07-11 10:09:05 -0400 |
|---|---|---|
| committer | Johannes Berg <johannes.berg@intel.com> | 2013-08-01 12:30:28 -0400 |
| commit | 16ef1fe272332b2f7fd99236017b891db48d9cd6 (patch) | |
| tree | 95b7a750ade214349282f1858ac44640890fce9c | |
| parent | 7cf1f14ecf1f5025abb0e30e22e8f7ad219fa32e (diff) | |
nl80211/cfg80211: add channel switch command
To allow channel switch announcements within beacons, add
the channel switch command to nl80211/cfg80211. This is
implementation is intended for AP and (later) IBSS mode.
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
| -rw-r--r-- | include/net/cfg80211.h | 33 | ||||
| -rw-r--r-- | include/uapi/linux/nl80211.h | 30 | ||||
| -rw-r--r-- | net/wireless/nl80211.c | 122 | ||||
| -rw-r--r-- | net/wireless/rdev-ops.h | 12 | ||||
| -rw-r--r-- | net/wireless/trace.h | 33 |
5 files changed, 229 insertions, 1 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index aeaf6dff6e05..b7495c72061c 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -666,6 +666,30 @@ struct cfg80211_ap_settings { | |||
| 666 | }; | 666 | }; |
| 667 | 667 | ||
| 668 | /** | 668 | /** |
| 669 | * struct cfg80211_csa_settings - channel switch settings | ||
| 670 | * | ||
| 671 | * Used for channel switch | ||
| 672 | * | ||
| 673 | * @chandef: defines the channel to use after the switch | ||
| 674 | * @beacon_csa: beacon data while performing the switch | ||
| 675 | * @counter_offset_beacon: offset for the counter within the beacon (tail) | ||
| 676 | * @counter_offset_presp: offset for the counter within the probe response | ||
| 677 | * @beacon_after: beacon data to be used on the new channel | ||
| 678 | * @radar_required: whether radar detection is required on the new channel | ||
| 679 | * @block_tx: whether transmissions should be blocked while changing | ||
| 680 | * @count: number of beacons until switch | ||
| 681 | */ | ||
| 682 | struct cfg80211_csa_settings { | ||
| 683 | struct cfg80211_chan_def chandef; | ||
| 684 | struct cfg80211_beacon_data beacon_csa; | ||
| 685 | u16 counter_offset_beacon, counter_offset_presp; | ||
| 686 | struct cfg80211_beacon_data beacon_after; | ||
| 687 | bool radar_required; | ||
| 688 | bool block_tx; | ||
| 689 | u8 count; | ||
| 690 | }; | ||
| 691 | |||
| 692 | /** | ||
| 669 | * enum station_parameters_apply_mask - station parameter values to apply | 693 | * enum station_parameters_apply_mask - station parameter values to apply |
| 670 | * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) | 694 | * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) |
| 671 | * @STATION_PARAM_APPLY_CAPABILITY: apply new capability | 695 | * @STATION_PARAM_APPLY_CAPABILITY: apply new capability |
| @@ -2139,6 +2163,8 @@ struct cfg80211_update_ft_ies_params { | |||
| 2139 | * @crit_proto_stop: Indicates critical protocol no longer needs increased link | 2163 | * @crit_proto_stop: Indicates critical protocol no longer needs increased link |
| 2140 | * reliability. This operation can not fail. | 2164 | * reliability. This operation can not fail. |
| 2141 | * @set_coalesce: Set coalesce parameters. | 2165 | * @set_coalesce: Set coalesce parameters. |
| 2166 | * | ||
| 2167 | * @channel_switch: initiate channel-switch procedure (with CSA) | ||
| 2142 | */ | 2168 | */ |
| 2143 | struct cfg80211_ops { | 2169 | struct cfg80211_ops { |
| 2144 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); | 2170 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); |
| @@ -2376,6 +2402,10 @@ struct cfg80211_ops { | |||
| 2376 | struct wireless_dev *wdev); | 2402 | struct wireless_dev *wdev); |
| 2377 | int (*set_coalesce)(struct wiphy *wiphy, | 2403 | int (*set_coalesce)(struct wiphy *wiphy, |
| 2378 | struct cfg80211_coalesce *coalesce); | 2404 | struct cfg80211_coalesce *coalesce); |
| 2405 | |||
| 2406 | int (*channel_switch)(struct wiphy *wiphy, | ||
| 2407 | struct net_device *dev, | ||
| 2408 | struct cfg80211_csa_settings *params); | ||
| 2379 | }; | 2409 | }; |
| 2380 | 2410 | ||
| 2381 | /* | 2411 | /* |
| @@ -2441,6 +2471,8 @@ struct cfg80211_ops { | |||
| 2441 | * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. | 2471 | * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. |
| 2442 | * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. | 2472 | * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. |
| 2443 | * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. | 2473 | * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. |
| 2474 | * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in | ||
| 2475 | * beaconing mode (AP, IBSS, Mesh, ...). | ||
| 2444 | */ | 2476 | */ |
| 2445 | enum wiphy_flags { | 2477 | enum wiphy_flags { |
| 2446 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), | 2478 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), |
| @@ -2465,6 +2497,7 @@ enum wiphy_flags { | |||
| 2465 | WIPHY_FLAG_OFFCHAN_TX = BIT(20), | 2497 | WIPHY_FLAG_OFFCHAN_TX = BIT(20), |
| 2466 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), | 2498 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), |
| 2467 | WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), | 2499 | WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), |
| 2500 | WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), | ||
| 2468 | }; | 2501 | }; |
| 2469 | 2502 | ||
| 2470 | /** | 2503 | /** |
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index eb68735b3318..1f42bc3dcb9c 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
| @@ -676,6 +676,16 @@ | |||
| 676 | * @NL80211_CMD_GET_COALESCE: Get currently supported coalesce rules. | 676 | * @NL80211_CMD_GET_COALESCE: Get currently supported coalesce rules. |
| 677 | * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules. | 677 | * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules. |
| 678 | * | 678 | * |
| 679 | * @NL80211_CMD_CHANNEL_SWITCH: Perform a channel switch by announcing the | ||
| 680 | * the new channel information (Channel Switch Announcement - CSA) | ||
| 681 | * in the beacon for some time (as defined in the | ||
| 682 | * %NL80211_ATTR_CH_SWITCH_COUNT parameter) and then change to the | ||
| 683 | * new channel. Userspace provides the new channel information (using | ||
| 684 | * %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel | ||
| 685 | * width). %NL80211_ATTR_CH_SWITCH_BLOCK_TX may be supplied to inform | ||
| 686 | * other station that transmission must be blocked until the channel | ||
| 687 | * switch is complete. | ||
| 688 | * | ||
| 679 | * @NL80211_CMD_MAX: highest used command number | 689 | * @NL80211_CMD_MAX: highest used command number |
| 680 | * @__NL80211_CMD_AFTER_LAST: internal use | 690 | * @__NL80211_CMD_AFTER_LAST: internal use |
| 681 | */ | 691 | */ |
| @@ -841,6 +851,8 @@ enum nl80211_commands { | |||
| 841 | NL80211_CMD_GET_COALESCE, | 851 | NL80211_CMD_GET_COALESCE, |
| 842 | NL80211_CMD_SET_COALESCE, | 852 | NL80211_CMD_SET_COALESCE, |
| 843 | 853 | ||
| 854 | NL80211_CMD_CHANNEL_SWITCH, | ||
| 855 | |||
| 844 | /* add new commands above here */ | 856 | /* add new commands above here */ |
| 845 | 857 | ||
| 846 | /* used to define NL80211_CMD_MAX below */ | 858 | /* used to define NL80211_CMD_MAX below */ |
| @@ -1469,6 +1481,18 @@ enum nl80211_commands { | |||
| 1469 | * | 1481 | * |
| 1470 | * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information. | 1482 | * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information. |
| 1471 | * | 1483 | * |
| 1484 | * @NL80211_ATTR_CH_SWITCH_COUNT: u32 attribute specifying the number of TBTT's | ||
| 1485 | * until the channel switch event. | ||
| 1486 | * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: flag attribute specifying that transmission | ||
| 1487 | * must be blocked on the current channel (before the channel switch | ||
| 1488 | * operation). | ||
| 1489 | * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information | ||
| 1490 | * for the time while performing a channel switch. | ||
| 1491 | * @NL80211_ATTR_CSA_C_OFF_BEACON: Offset of the channel switch counter | ||
| 1492 | * field in the beacons tail (%NL80211_ATTR_BEACON_TAIL). | ||
| 1493 | * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter | ||
| 1494 | * field in the probe response (%NL80211_ATTR_PROBE_RESP). | ||
| 1495 | * | ||
| 1472 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 1496 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 1473 | * @__NL80211_ATTR_AFTER_LAST: internal use | 1497 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| 1474 | */ | 1498 | */ |
| @@ -1771,6 +1795,12 @@ enum nl80211_attrs { | |||
| 1771 | 1795 | ||
| 1772 | NL80211_ATTR_COALESCE_RULE, | 1796 | NL80211_ATTR_COALESCE_RULE, |
| 1773 | 1797 | ||
| 1798 | NL80211_ATTR_CH_SWITCH_COUNT, | ||
| 1799 | NL80211_ATTR_CH_SWITCH_BLOCK_TX, | ||
| 1800 | NL80211_ATTR_CSA_IES, | ||
| 1801 | NL80211_ATTR_CSA_C_OFF_BEACON, | ||
| 1802 | NL80211_ATTR_CSA_C_OFF_PRESP, | ||
| 1803 | |||
| 1774 | /* add attributes here, update the policy in nl80211.c */ | 1804 | /* add attributes here, update the policy in nl80211.c */ |
| 1775 | 1805 | ||
| 1776 | __NL80211_ATTR_AFTER_LAST, | 1806 | __NL80211_ATTR_AFTER_LAST, |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 03d4ef95292e..f7cb12178bd2 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -349,6 +349,11 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
| 349 | [NL80211_ATTR_IE_RIC] = { .type = NLA_BINARY, | 349 | [NL80211_ATTR_IE_RIC] = { .type = NLA_BINARY, |
| 350 | .len = IEEE80211_MAX_DATA_LEN }, | 350 | .len = IEEE80211_MAX_DATA_LEN }, |
| 351 | [NL80211_ATTR_PEER_AID] = { .type = NLA_U16 }, | 351 | [NL80211_ATTR_PEER_AID] = { .type = NLA_U16 }, |
| 352 | [NL80211_ATTR_CH_SWITCH_COUNT] = { .type = NLA_U32 }, | ||
| 353 | [NL80211_ATTR_CH_SWITCH_BLOCK_TX] = { .type = NLA_FLAG }, | ||
| 354 | [NL80211_ATTR_CSA_IES] = { .type = NLA_NESTED }, | ||
| 355 | [NL80211_ATTR_CSA_C_OFF_BEACON] = { .type = NLA_U16 }, | ||
| 356 | [NL80211_ATTR_CSA_C_OFF_PRESP] = { .type = NLA_U16 }, | ||
| 352 | }; | 357 | }; |
| 353 | 358 | ||
| 354 | /* policy for the key attributes */ | 359 | /* policy for the key attributes */ |
| @@ -1422,6 +1427,8 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, | |||
| 1422 | if (state->split) { | 1427 | if (state->split) { |
| 1423 | CMD(crit_proto_start, CRIT_PROTOCOL_START); | 1428 | CMD(crit_proto_start, CRIT_PROTOCOL_START); |
| 1424 | CMD(crit_proto_stop, CRIT_PROTOCOL_STOP); | 1429 | CMD(crit_proto_stop, CRIT_PROTOCOL_STOP); |
| 1430 | if (dev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH) | ||
| 1431 | CMD(channel_switch, CHANNEL_SWITCH); | ||
| 1425 | } | 1432 | } |
| 1426 | 1433 | ||
| 1427 | #ifdef CONFIG_NL80211_TESTMODE | 1434 | #ifdef CONFIG_NL80211_TESTMODE |
| @@ -5613,6 +5620,111 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, | |||
| 5613 | return err; | 5620 | return err; |
| 5614 | } | 5621 | } |
| 5615 | |||
