History

cfg80211: Add support to notify station's opmode change to userspace

ht/vht action frames will be sent to AP from station to notify change of its ht/vht opmode(max bandwidth, smps mode or nss) modified values. Currently these valuse used by driver/firmware for rate control algorithm. This patch introduces NL80211_CMD_STA_OPMODE_CHANGED command to notify those modified/current supported values(max bandwidth, smps mode, max nss) to userspace application. This will be useful for the application like steering, which closely monitoring station's capability changes. Since the application has taken these values during station association.

tamizhr@codeaurora.org committed 8 years ago

Commit 466b9931 parent 25b0ba73 files · +110 −0Browse files

Unified · Split

3 files
  1. include/net/cfg80211.h +43 −0
  2. include/uapi/linux/nl80211.h +12 −0
  3. net/wireless/nl80211.c +55 −0
include/net/cfg80211.h+43−0
@@ -3553,6 +3553,35 @@ enum wiphy_vendor_command_flags { · 3552 unmodified lines
3553 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),3553 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
3554};3554};
3555 3555
3556/**
3557 * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
3558 *
3559 * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
3560 * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
3561 * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
3562 *
3563 */
3564enum wiphy_opmode_flag {
3565 STA_OPMODE_MAX_BW_CHANGED = BIT(0),
3566 STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),
3567 STA_OPMODE_N_SS_CHANGED = BIT(2),
3568};
3569
3570/**
3571 * struct sta_opmode_info - Station's ht/vht operation mode information
3572 * @changed: contains value from &enum wiphy_opmode_flag
3573 * @smps_mode: New SMPS mode of a station
3574 * @bw: new max bandwidth value of a station
3575 * @rx_nss: new rx_nss value of a station
3576 */
3577
3578struct sta_opmode_info {
3579 u32 changed;
3580 u8 smps_mode;
3581 u8 bw;
3582 u8 rx_nss;
3583};
3584
3556/**3585/**
3557 * struct wiphy_vendor_command - vendor command definition3586 * struct wiphy_vendor_command - vendor command definition
3558 * @info: vendor command identifying information, as used in nl802113587 * @info: vendor command identifying information, as used in nl80211
@@ -5721,6 +5750,20 @@ void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); · 2162 unmodified lines
5721void cfg80211_radar_event(struct wiphy *wiphy,5750void cfg80211_radar_event(struct wiphy *wiphy,
5722 struct cfg80211_chan_def *chandef, gfp_t gfp);5751 struct cfg80211_chan_def *chandef, gfp_t gfp);
5723 5752
5753/**
5754 * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
5755 * @dev: network device
5756 * @mac: MAC address of a station which opmode got modified
5757 * @sta_opmode: station's current opmode value
5758 * @gfp: context flags
5759 *
5760 * Driver should call this function when station's opmode modified via action
5761 * frame.
5762 */
5763void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
5764 struct sta_opmode_info *sta_opmode,
5765 gfp_t gfp);
5766
5724/**5767/**
5725 * cfg80211_cac_event - Channel availability check (CAC) event5768 * cfg80211_cac_event - Channel availability check (CAC) event
5726 * @netdev: network device5769 * @netdev: network device
include/uapi/linux/nl80211.h+12−0
@@ -1013,6 +1013,11 @@ · 1012 unmodified lines
1013 * user space through the connect result as the user space would have1013 * user space through the connect result as the user space would have
1014 * initiated the connection through the connect request.1014 * initiated the connection through the connect request.
1015 *1015 *
1016 * @NL80211_CMD_STA_OPMODE_CHANGED: An event that notify station's
1017 * ht opmode or vht opmode changes using any of &NL80211_ATTR_SMPS_MODE,
1018 * &NL80211_ATTR_CHANNEL_WIDTH,&NL80211_ATTR_NSS attributes with its
1019 * address(specified in &NL80211_ATTR_MAC).
1020 *
1016 * @NL80211_CMD_MAX: highest used command number1021 * @NL80211_CMD_MAX: highest used command number
1017 * @__NL80211_CMD_AFTER_LAST: internal use1022 * @__NL80211_CMD_AFTER_LAST: internal use
1018 */1023 */
@@ -1221,6 +1226,8 @@ enum nl80211_commands { · 202 unmodified lines
1221 1226
1222 NL80211_CMD_EXTERNAL_AUTH,1227 NL80211_CMD_EXTERNAL_AUTH,
1223 1228
1229 NL80211_CMD_STA_OPMODE_CHANGED,
1230
1224 /* add new commands above here */1231 /* add new commands above here */
1225 1232
1226 /* used to define NL80211_CMD_MAX below */1233 /* used to define NL80211_CMD_MAX below */
@@ -2186,6 +2193,9 @@ enum nl80211_commands { · 959 unmodified lines
2186 * authentication processing to user space if this capability is indicated2193 * authentication processing to user space if this capability is indicated
2187 * in NL80211_CMD_CONNECT requests from the user space.2194 * in NL80211_CMD_CONNECT requests from the user space.
2188 *2195 *
2196 * @NL80211_ATTR_NSS: Station's New/updated RX_NSS value notified using this
2197 * u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED.
2198 *
2189 * @NUM_NL80211_ATTR: total number of nl80211_attrs available2199 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
2190 * @NL80211_ATTR_MAX: highest attribute number currently defined2200 * @NL80211_ATTR_MAX: highest attribute number currently defined
2191 * @__NL80211_ATTR_AFTER_LAST: internal use2201 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2615,6 +2625,8 @@ enum nl80211_attrs { · 423 unmodified lines
2615 NL80211_ATTR_EXTERNAL_AUTH_ACTION,2625 NL80211_ATTR_EXTERNAL_AUTH_ACTION,
2616 NL80211_ATTR_EXTERNAL_AUTH_SUPPORT,2626 NL80211_ATTR_EXTERNAL_AUTH_SUPPORT,
2617 2627
2628 NL80211_ATTR_NSS,
2629
2618 /* add attributes here, update the policy in nl80211.c */2630 /* add attributes here, update the policy in nl80211.c */
2619 2631
2620 __NL80211_ATTR_AFTER_LAST,2632 __NL80211_ATTR_AFTER_LAST,
net/wireless/nl80211.c+55−0
@@ -14950,6 +14950,61 @@ nl80211_radar_notify(struct cfg80211_registered_device *rdev, · 14949 unmodified lines
14950 nlmsg_free(msg);14950 nlmsg_free(msg);
14951}14951}
14952 14952
14953void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
14954 struct sta_opmode_info *sta_opmode,
14955 gfp_t gfp)
14956{
14957 struct sk_buff *msg;
14958 struct wireless_dev *wdev = dev->ieee80211_ptr;
14959 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
14960 void *hdr;
14961
14962 if (WARN_ON(!mac))
14963 return;
14964
14965 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
14966 if (!msg)
14967 return;
14968
14969 hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_STA_OPMODE_CHANGED);
14970 if (!hdr) {
14971 nlmsg_free(msg);
14972 return;
14973 }
14974
14975 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx))
14976 goto nla_put_failure;
14977
14978 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex))
14979 goto nla_put_failure;
14980
14981 if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac))
14982 goto nla_put_failure;
14983
14984 if ((sta_opmode->changed & STA_OPMODE_SMPS_MODE_CHANGED) &&
14985 nla_put_u8(msg, NL80211_ATTR_SMPS_MODE, sta_opmode->smps_mode))
14986 goto nla_put_failure;
14987
14988 if ((sta_opmode->changed & STA_OPMODE_MAX_BW_CHANGED) &&
14989 nla_put_u8(msg, NL80211_ATTR_CHANNEL_WIDTH, sta_opmode->bw))
14990 goto nla_put_failure;
14991
14992 if ((sta_opmode->changed & STA_OPMODE_N_SS_CHANGED) &&
14993 nla_put_u8(msg, NL80211_ATTR_NSS, sta_opmode->rx_nss))
14994 goto nla_put_failure;
14995
14996 genlmsg_end(msg, hdr);
14997
14998 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
14999 NL80211_MCGRP_MLME, gfp);
15000
15001 return;
15002
15003nla_put_failure:
15004 nlmsg_free(msg);
15005}
15006EXPORT_SYMBOL(cfg80211_sta_opmode_change_notify);
15007
14953void cfg80211_probe_status(struct net_device *dev, const u8 *addr,15008void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
14954 u64 cookie, bool acked, gfp_t gfp)15009 u64 cookie, bool acked, gfp_t gfp)
14955{15010{