Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

nl/mac80211: add roaming capability event to API (INTERNAL)

Some drivers (e.g. wlcore) may want to notify
userspace that roaming is limited and that
background scan and roaming attempts can be stopped.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information...
commit fe8261507235dff8a68621fb891754fc2bf49f3a 1 parent 730245c
@eyalsh eyalsh authored ariknem committed
View
11 include/linux/nl80211.h
@@ -578,6 +578,11 @@
* On reception of this notification, userspace may decide to stop earlier
* currently running scan with (@NL80211_CMD_SCAN_CANCEL).
*
+ * @NL80211_CMD_ROAMING_SUPPORT: A notify event used to alert userspace
+ * regarding changes in roaming support by the driver. If roaming is
+ * disabled (marked by the presence of @NL80211_ATTR_ROAMING_DISABLED flag)
+ * userspace should disable background scans and roaming attempts.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -725,6 +730,8 @@ enum nl80211_commands {
NL80211_CMD_IM_SCAN_RESULT,
+ NL80211_CMD_ROAMING_SUPPORT,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -1291,6 +1298,8 @@ enum nl80211_commands {
* each short interval scheduled scan cycle in msecs.
* @NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS: number of short
* sched scan intervals before switching to the long interval
+ * @NL80211_ATTR_ROAMING_DISABLED: indicates that the driver can't do roaming
+ * currently.
*
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -1553,6 +1562,8 @@ enum nl80211_attrs {
NL80211_ATTR_SCHED_SCAN_SHORT_INTERVAL,
NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS,
+ NL80211_ATTR_ROAMING_DISABLED,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
View
10 include/net/cfg80211.h
@@ -3404,6 +3404,16 @@ void cfg80211_cqm_pktloss_notify(struct net_device *dev,
const u8 *peer, u32 num_packets, gfp_t gfp);
/**
+ * cfg80211_roaming_status - notify userspace about changes in the driver
+ * ability to support roaming
+ * @dev: network device
+ * @enabled: indicates whether roaming is supported at the current time
+ * @gfp: allocation flags
+ */
+void cfg80211_roaming_status(struct net_device *dev,
+ bool enabled, gfp_t gfp);
+
+/**
* cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
* @dev: network device
* @bssid: BSSID of AP (to avoid races)
View
11 include/net/mac80211.h
@@ -2815,6 +2815,17 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
/**
+ * ieee80211_roaming_status - report if roaming support by the driver changed
+ *
+ * Some drivers have limitations on roaming in certain conditions (e.g. multi
+ * role) and need to report this back to userspace.
+ *
+ * @vif: interface
+ * @enabled: is roaming supported
+ */
+void ieee80211_roaming_status(struct ieee80211_vif *vif, bool enabled);
+
+/**
* ieee80211_beacon_get_tim - beacon generation function
* @hw: pointer obtained from ieee80211_alloc_hw().
* @vif: &struct ieee80211_vif pointer from the add_interface callback.
View
8 net/mac80211/status.c
@@ -618,6 +618,14 @@ void ieee80211_report_low_ack(struct ieee80211_sta *pubsta, u32 num_packets)
}
EXPORT_SYMBOL(ieee80211_report_low_ack);
+
+void ieee80211_roaming_status(struct ieee80211_vif *vif, bool enabled)
+{
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+ cfg80211_roaming_status(sdata->dev, enabled, GFP_KERNEL);
+}
+EXPORT_SYMBOL(ieee80211_roaming_status);
+
void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb)
{
struct ieee80211_local *local = hw_to_local(hw);
View
45 net/wireless/nl80211.c
@@ -301,6 +301,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
[NL80211_ATTR_SCAN_NUM_PROBE] = { .type = NLA_U8 },
[NL80211_ATTR_SCHED_SCAN_SHORT_INTERVAL] = { .type = NLA_U32 },
[NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS] = { .type = NLA_U8 },
+ [NL80211_ATTR_ROAMING_DISABLED] = { .type = NLA_FLAG },
};
/* policy for the key attributes */
@@ -8544,6 +8545,50 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
}
EXPORT_SYMBOL(cfg80211_probe_status);
+
+void cfg80211_roaming_status(struct net_device *dev, bool enabled, gfp_t gfp)
+{
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+ struct sk_buff *msg;
+ void *hdr;
+ int err;
+
+ msg = nlmsg_new(NLMSG_GOODSIZE, gfp);
+ if (!msg)
+ return;
+
+ hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_ROAMING_SUPPORT);
+ if (!hdr) {
+ nlmsg_free(msg);
+ return;
+ }
+
+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
+ nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex))
+ goto nla_put_failure;
+
+ if (!enabled)
+ if (nla_put_flag(msg, NL80211_ATTR_ROAMING_DISABLED))
+ goto nla_put_failure;
+
+ err = genlmsg_end(msg, hdr);
+ if (err < 0) {
+ nlmsg_free(msg);
+ return;
+ }
+
+ genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
+ nl80211_mlme_mcgrp.id, gfp);
+ return;
+
+ nla_put_failure:
+ genlmsg_cancel(msg, hdr);
+ nlmsg_free(msg);
+}
+EXPORT_SYMBOL(cfg80211_roaming_status);
+
+
void cfg80211_report_obss_beacon(struct wiphy *wiphy,
const u8 *frame, size_t len,
int freq, int sig_dbm, gfp_t gfp)
Please sign in to comment.
Something went wrong with that request. Please try again.