cfg80211: support multiple scheduled scans
Subsystems (7)
Arend van Spriel
maintainerv2 cover cfg80211: support multiple scheduled scans
After the RFC rounds here is multi-scheduled scan submission. What has been added since the RFC is support for user-space to specify a BSSID in the matchset (PATCH 3/10). As example this could be used for roaming algorithm done in user-space. The patches for scheduled scan notification api have been collapsed into a single patch and rtnl locking was needed for the cfg80211_sched_scan_results() function.
This series also adds a driver implementation for the new features. Not surprisingly being brcmfmac.
This series applies to master branch of the mac80211-next repository. In this version a couple of build issues reported by Kbuild test robot has been addressed where applicable. The conflict with wireless-drivers-next is still there, but we have a plan for that.
---
changes:
V2:
- patch 5/10 changed to resolve kerneldoc issue.
- patch 8/10 and 10/10 resolving uninitialized warnings.
---
Arend van Spriel (10):
nl80211: add request id in scheduled scan event messages
nl80211: allow multiple active scheduled scan requests
nl80211: add support for BSSIDs in scheduled scan matchsets
cfg80211: add request id parameter to .sched_scan_stop() signature
cfg80211: add request id to cfg80211_sched_scan_*() api
brcmfmac: add firmware feature detection for gscan feature
brcmfmac: move scheduled scan wiphy param setting to pno module
brcmfmac: add support multi-scheduled scan
brcmfmac: add mutex to protect pno requests
brcmfmac: add scheduled scan support for specified BSSIDs
drivers/net/wireless/ath/ath6kl/cfg80211.c | 6 +- drivers/net/wireless/ath/ath6kl/wmi.c | 2 +- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 93 +++-- .../broadcom/brcm80211/brcmfmac/cfg80211.h | 8 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 1 + .../wireless/broadcom/brcm80211/brcmfmac/debug.h | 2 + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 22 +- .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +- .../broadcom/brcm80211/brcmfmac/fwil_types.h | 75 ++++ .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 455 ++++++++++++++++++--- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.h | 55 ++- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 10 +- drivers/net/wireless/marvell/mwifiex/main.c | 2 +- drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 2 +- drivers/net/wireless/marvell/mwifiex/sta_event.c | 2 +- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 2 +- drivers/net/wireless/ti/wlcore/main.c | 2 +- include/net/cfg80211.h | 41 +- include/uapi/linux/nl80211.h | 14 +- net/mac80211/cfg.c | 3 +- net/mac80211/pm.c | 2 +- net/mac80211/scan.c | 4 +- net/mac80211/util.c | 2 +- net/wireless/core.c | 27 +- net/wireless/core.h | 11 +- net/wireless/nl80211.c | 116 ++++-- net/wireless/nl80211.h | 3 +- net/wireless/rdev-ops.h | 8 +- net/wireless/scan.c | 146 +++++-- net/wireless/trace.h | 54 ++- 31 files changed, 941 insertions(+), 235 deletions(-)
Signature · 1 line
1.9.1
Arend van Spriel
maintainerPATCH v2 1/10 nl80211: add request id in scheduled scan event messages
For multi-scheduled scan support in subsequent patch a request id will be added. This patch add this request id to the scheduled scan event messages. For now the request id will always be zero. With multi-scheduled scan its value will inform user-space to which scan the event relates.
--- include/net/cfg80211.h | 2 ++ net/wireless/nl80211.c | 23 +++++++++++------------ net/wireless/nl80211.h | 3 +-- net/wireless/scan.c | 5 ++--- 4 files changed, 16 insertions(+), 17 deletions(-)
include/net/cfg80211.h +2 -0
@@ -1649,6 +1649,7 @@ struct cfg80211_bss_select_adjust {/** * struct cfg80211_sched_scan_request - scheduled scan request description * +* @reqid: identifies this request. * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) * @n_ssids: number of SSIDs * @n_channels: total number of channels to scan
@@ -1693,6 +1694,7 @@ struct cfg80211_bss_select_adjust {* comparisions. */ struct cfg80211_sched_scan_request { +u64 reqid;struct cfg80211_ssid *ssids;int n_ssids;u32 n_channels;
net/wireless/nl80211.c +11 -12
@@ -7371,8 +7371,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,rcu_assign_pointer (rdev->sched_scan_req, sched_scan_req); -nl80211_send_sched_scan (rdev, dev, -NL80211_CMD_START_SCHED_SCAN ); +nl80211_send_sched_scan (sched_scan_req,NL80211_CMD_START_SCHED_SCAN );return 0 ; out_free:
@@ -13219,18 +13218,19 @@ static int nl80211_prep_scan_msg(struct sk_buff *msg,static int nl80211_prep_sched_scan_msg (struct sk_buff *msg, -struct cfg80211_registered_device *rdev, -struct net_device *netdev, -u32 portid,u32 seq,int flags,u32 cmd) +struct cfg80211_sched_scan_request *req,u32 cmd) {void *hdr; - hdr =nl80211hdr_put (msg, portid, seq, flags, cmd); + hdr =nl80211hdr_put (msg,0 ,0 ,0 , cmd);if (!hdr)return -1 ; -if (nla_put_u32 (msg,NL80211_ATTR_WIPHY , rdev->wiphy_idx) || -nla_put_u32 (msg,NL80211_ATTR_IFINDEX , netdev->ifindex)) +if (nla_put_u32 (msg,NL80211_ATTR_WIPHY , +wiphy_to_rdev (req->wiphy)->wiphy_idx) || +nla_put_u32 (msg,NL80211_ATTR_IFINDEX , req->dev->ifindex) || +nla_put_u64_64bit (msg,NL80211_ATTR_COOKIE , req->reqid, +NL80211_ATTR_PAD )) goto nla_put_failure;genlmsg_end (msg, hdr);
@@ -13290,8 +13290,7 @@ void nl80211_send_scan_msg(struct cfg80211_registered_device *rdev, NL80211_MCGRP_SCAN, GFP_KERNEL); } -void nl80211_send_sched_scan (struct cfg80211_registered_device *rdev, -struct net_device *netdev,u32 cmd) +void nl80211_send_sched_scan (struct cfg80211_sched_scan_request *req,u32 cmd) {struct sk_buff *msg;
@@ -13299,12 +13298,12 @@ void nl80211_send_sched_scan(struct cfg80211_registered_device *rdev,if (!msg)return ; -if (nl80211_prep_sched_scan_msg (msg, rdev, netdev,0 ,0 ,0 , cmd) <0 ) { +if (nl80211_prep_sched_scan_msg (msg, req, cmd) <0 ) {nlmsg_free (msg);return ; } -genlmsg_multicast_netns (&nl80211_fam,wiphy_net (&rdev->wiphy), msg,0 , +genlmsg_multicast_netns (&nl80211_fam,wiphy_net (req->wiphy), msg,0 ,NL80211_MCGRP_SCAN ,GFP_KERNEL ); }
net/wireless/nl80211.h +1 -2
@@ -16,8 +16,7 @@ struct sk_buff *nl80211_build_scan_msg(struct cfg80211_registered_device *rdev, struct wireless_dev *wdev, bool aborted);void nl80211_send_scan_msg (struct cfg80211_registered_device *rdev,struct sk_buff *msg); -void nl80211_send_sched_scan (struct cfg80211_registered_device *rdev, -struct net_device *netdev,u32 cmd); +void nl80211_send_sched_scan (struct cfg80211_sched_scan_request *req,u32 cmd);void nl80211_common_reg_change_event (enum nl80211_commands cmd_id,struct regulatory_request *request);
net/wireless/scan.c +2 -3
@@ -321,8 +321,7 @@ void __cfg80211_sched_scan_results(struct work_struct *wk)spin_unlock_bh (&rdev->bss_lock); request->scan_start = jiffies; } -nl80211_send_sched_scan (rdev, request->dev, -NL80211_CMD_SCHED_SCAN_RESULTS ); +nl80211_send_sched_scan (request,NL80211_CMD_SCHED_SCAN_RESULTS ); }rtnl_unlock ();
@@ -379,7 +378,7 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,return err; } -nl80211_send_sched_scan (rdev, dev,NL80211_CMD_SCHED_SCAN_STOPPED ); +nl80211_send_sched_scan (sched_scan_req,NL80211_CMD_SCHED_SCAN_STOPPED );RCU_INIT_POINTER (rdev->sched_scan_req,NULL );kfree_rcu (sched_scan_req, rcu_head);
Signature · 1 line
1.9.1
Arend van Spriel
maintainerPATCH v2 2/10 nl80211: allow multiple active scheduled scan requests
In reply to Arend van SprielThis patch implements the idea to have multiple scheduled scan requests running concurrently. It mainly illustrates how to deal with the incoming request from user-space in terms of backward compatibility. In order to use multiple scheduled scans user-space needs to provide a flag attribute NL80211_ATTR_SCHED_SCAN_MULTI to indicate support. If not the request is treated as a legacy scan.
Drivers currently supporting scheduled scan are now indicating they support a single scheduled scan request. This obsoletes WIPHY_FLAG_SUPPORTS_SCHED_SCAN.
--- drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +- drivers/net/wireless/ti/wlcore/main.c | 2 +- include/net/cfg80211.h | 7 +- include/uapi/linux/nl80211.h | 12 ++- net/wireless/core.c | 26 ++++-- net/wireless/core.h | 10 +- net/wireless/nl80211.c | 50 ++++++++-- net/wireless/rdev-ops.h | 2 +- net/wireless/scan.c | 102 +++++++++++++++++---- net/wireless/trace.h | 18 ++-- 13 files changed, 186 insertions(+), 51 deletions(-)
drivers/net/wireless/ath/ath6kl/cfg80211.c +1 -1
@@ -3975,7 +3975,7 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD ;if (test_bit (ATH6KL_FW_CAPABILITY_SCHED_SCAN_V2 , ar->fw_capabilities)) - ar->wiphy->flags |=WIPHY_FLAG_SUPPORTS_SCHED_SCAN ; + ar->wiphy->max_sched_scan_reqs =1 ;if (test_bit (ATH6KL_FW_CAPABILITY_INACTIVITY_TIMEOUT , ar->fw_capabilities))
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +1 -1
@@ -6356,11 +6356,11 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)static void brcmf_wiphy_pno_params (struct wiphy *wiphy) {/* scheduled scan settings */ + wiphy->max_sched_scan_reqs =1 ; wiphy->max_sched_scan_ssids =BRCMF_PNO_MAX_PFN_COUNT ; wiphy->max_match_sets =BRCMF_PNO_MAX_PFN_COUNT ; wiphy->max_sched_scan_ie_len =BRCMF_SCAN_IE_LEN_MAX ; wiphy->max_sched_scan_plan_interval =BRCMF_PNO_SCHED_SCAN_MAX_PERIOD ; - wiphy->flags |=WIPHY_FLAG_SUPPORTS_SCHED_SCAN ; }#ifdef CONFIG_PM
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +1 -1
@@ -619,7 +619,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)else hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT ; - hw->wiphy->flags |=WIPHY_FLAG_SUPPORTS_SCHED_SCAN ; + hw->wiphy->max_sched_scan_reqs =1 ; hw->wiphy->max_sched_scan_ssids =PROBE_OPTION_MAX ; hw->wiphy->max_match_sets =IWL_SCAN_MAX_PROFILES ;/* we create the 802.11 header and zero length SSID IE. */
drivers/net/wireless/marvell/mwifiex/cfg80211.c +1 -1
@@ -4276,7 +4276,6 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) wiphy->flags |=WIPHY_FLAG_HAVE_AP_SME |WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |WIPHY_FLAG_AP_UAPSD | -WIPHY_FLAG_SUPPORTS_SCHED_SCAN |WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |WIPHY_FLAG_HAS_CHANNEL_SWITCH |WIPHY_FLAG_PS_ON_BY_DEFAULT ;
@@ -4295,6 +4294,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 |NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P ; + wiphy->max_sched_scan_reqs =1 ; wiphy->max_sched_scan_ssids =MWIFIEX_MAX_SSID_LIST_LENGTH ; wiphy->max_sched_scan_ie_len =MWIFIEX_MAX_VSIE_LEN ; wiphy->max_match_sets =MWIFIEX_MAX_SSID_LIST_LENGTH ;
drivers/net/wireless/ti/wlcore/main.c +1 -1
@@ -6128,6 +6128,7 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) wl->hw->wiphy->max_scan_ie_len =WL1271_CMD_TEMPL_MAX_SIZE -sizeof (struct ieee80211_header ); + wl->hw->wiphy->max_sched_scan_reqs =1 ; wl->hw->wiphy->max_sched_scan_ie_len =WL1271_CMD_TEMPL_MAX_SIZE -sizeof (struct ieee80211_header );
@@ -6135,7 +6136,6 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) wl->hw->wiphy->flags |=WIPHY_FLAG_AP_UAPSD |WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | -WIPHY_FLAG_SUPPORTS_SCHED_SCAN |WIPHY_FLAG_HAS_CHANNEL_SWITCH ; wl->hw->wiphy->features |=NL80211_FEATURE_AP_SCAN ;
include/net/cfg80211.h +6 -1
@@ -1678,6 +1678,7 @@ struct cfg80211_bss_select_adjust {* @rcu_head: RCU callback used to free the struct * @owner_nlportid: netlink portid of owner (if this should is a request * owned by a particular socket) +* @list: for keeping list of requests. * @delay: delay in seconds to use before starting the first scan * cycle. The driver may ignore this parameter and start * immediately (or at any other time), if this feature is not
@@ -1722,6 +1723,7 @@ struct cfg80211_sched_scan_request {unsigned long scan_start;struct rcu_head rcu_head;u32 owner_nlportid; +struct list_head list;/* keep last */ struct ieee80211_channel *channels[0 ];
@@ -3213,7 +3215,7 @@ enum wiphy_flags {WIPHY_FLAG_CONTROL_PORT_PROTOCOL =BIT (7 ),WIPHY_FLAG_IBSS_RSN =BIT (8 ),WIPHY_FLAG_MESH_AUTH =BIT (10 ), -WIPHY_FLAG_SUPPORTS_SCHED_SCAN =BIT (11 ), +/* use hole at 11 */ /* use hole at 12 */ WIPHY_FLAG_SUPPORTS_FW_ROAM =BIT (13 ), WIPHY_FLAG_AP_UAPSD = BIT(14),
@@ -3551,6 +3553,8 @@ struct wiphy_iftype_ext_capab {* this variable determines its size * @max_scan_ssids: maximum number of SSIDs the device can scan for in * any given scan +* @max_sched_scan_reqs: maximum number of scheduled scan requests that +* the device can run concurrently. * @max_sched_scan_ssids: maximum number of SSIDs the device can scan * for in any given scheduled scan * @max_match_sets: maximum number of match sets the device can handle
@@ -3687,6 +3691,7 @@ struct wiphy {int bss_priv_size;u8 max_scan_ssids; +u8 max_sched_scan_reqs;u8 max_sched_scan_ssids;u8 max_match_sets;u16 max_scan_ie_len;
include/uapi/linux/nl80211.h +11 -1
@@ -387,7 +387,9 @@* are used. Extra IEs can also be passed from the userspace by * using the %NL80211_ATTR_IE attribute. The first cycle of the * scheduled scan can be delayed by %NL80211_ATTR_SCHED_SCAN_DELAY -* is supplied. +* is supplied. If the device supports multiple concurrent scheduled +* scans, it will allow such when the caller provides the flag attribute +* %NL80211_ATTR_SCHED_SCAN_MULTI to indicate user-space support for it. * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if * scheduled scan is not running. The caller may assume that as soon * as the call returns, it is safe to start a new scheduled scan again.
@@ -2081,6 +2083,11 @@ enum nl80211_commands {* @NL80211_ATTR_PMK: PMK for the PMKSA identified by %NL80211_ATTR_PMKID. * This is used with @NL80211_CMD_SET_PMKSA. * +* @NL80211_ATTR_SCHED_SCAN_MULTI: flag attribute which user-space shall use to +* indicate that it supports multiple active scheduled scan requests. +* @NL80211_ATTR_SCHED_SCAN_MAX_REQS: indicates maximum number of scheduled +* scan request that may be active for the device (u32). +* * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2500,6 +2507,9 @@ enum nl80211_attrs {NL80211_ATTR_PMK , +NL80211_ATTR_SCHED_SCAN_MULTI , +NL80211_ATTR_SCHED_SCAN_MAX_REQS , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
net/wireless/core.c +16 -10
@@ -346,13 +346,17 @@ static void cfg80211_destroy_iface_wk(struct work_struct *work)static void cfg80211_sched_scan_stop_wk (struct work_struct *work) {struct cfg80211_registered_device *rdev; +struct cfg80211_sched_scan_request *pos, *tmp; rdev = container_of(work, struct cfg80211_registered_device, sched_scan_stop_wk);rtnl_lock (); -__cfg80211_stop_sched_scan (rdev, false); +/* request gets removed from list so need safe iterator */ +list_for_each_entry_safe (pos, tmp, &rdev->sched_scan_req_list, list) { +cfg80211_stop_sched_scan_req (rdev, pos, false); + }rtnl_unlock (); }
@@ -468,6 +472,7 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,spin_lock_init (&rdev->beacon_registrations_lock);spin_lock_init (&rdev->bss_lock);INIT_LIST_HEAD (&rdev->bss_list); +INIT_LIST_HEAD (&rdev->sched_scan_req_list);INIT_WORK (&rdev->scan_done_wk, __cfg80211_scan_done);INIT_WORK (&rdev->sched_scan_results_wk, __cfg80211_sched_scan_results);INIT_LIST_HEAD (&rdev->mlme_unreg);
@@ -1046,7 +1051,7 @@ void __cfg80211_leave(struct cfg80211_registered_device *rdev, struct wireless_dev *wdev) {struct net_device *dev = wdev->netdev; -struct cfg80211_sched_scan_request *sched_scan_req; +struct cfg80211_sched_scan_request *pos, *tmp;ASSERT_RTNL ();ASSERT_WDEV_LOCK (wdev);
@@ -1057,9 +1062,10 @@ void __cfg80211_leave(struct cfg80211_registered_device *rdev,break ;case NL80211_IFTYPE_P2P_CLIENT :case NL80211_IFTYPE_STATION : - sched_scan_req =rtnl_dereference (rdev->sched_scan_req); -if (sched_scan_req && dev == sched_scan_req->dev) -__cfg80211_stop_sched_scan (rdev, false); +list_for_each_entry_safe (pos, tmp, &rdev->sched_scan_req_list, list) { +if (dev == pos->dev) +cfg80211_stop_sched_scan_req (rdev, pos, false); + }#ifdef CONFIG_CFG80211_WEXT kfree (wdev->wext.ie);
@@ -1134,7 +1140,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,struct net_device *dev =netdev_notifier_info_to_dev (ptr);struct wireless_dev *wdev = dev->ieee80211_ptr;struct cfg80211_registered_device *rdev; -struct cfg80211_sched_scan_request *sched_scan_req; +struct cfg80211_sched_scan_request *pos, *tmp;if (!wdev)return NOTIFY_DONE ;
@@ -1211,10 +1217,10 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,___cfg80211_scan_done (rdev, false); } - sched_scan_req =rtnl_dereference (rdev->sched_scan_req); -if (WARN_ON (sched_scan_req && - sched_scan_req->dev == wdev->netdev)) { -__cfg80211_stop_sched_scan (rdev, false); +list_for_each_entry_safe (pos, tmp, + &rdev->sched_scan_req_list, list) { +if (WARN_ON (pos && pos->dev == wdev->netdev)) +cfg80211_stop_sched_scan_req (rdev, pos, false); } rdev->opencount--;
net/wireless/core.h +9 -1
@@ -74,6 +74,7 @@ struct cfg80211_registered_device {u32 bss_entries;struct cfg80211_scan_request *scan_req;/* protected by RTNL */ struct sk_buff *scan_msg; +struct list_head sched_scan_req_list;struct cfg80211_sched_scan_request __rcu *sched_scan_req;unsigned long suspend_at;struct work_struct scan_done_wk;
@@ -424,9 +425,16 @@ int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev,void __cfg80211_scan_done (struct work_struct *wk);void ___cfg80211_scan_done (struct cfg80211_registered_device *rdev,bool send_message); +void cfg80211_add_sched_scan_req (struct cfg80211_registered_device *rdev, +struct cfg80211_sched_scan_request *req); +int cfg80211_sched_scan_req_possible (struct cfg80211_registered_device *rdev, +bool want_multi);void __cfg80211_sched_scan_results (struct work_struct *wk); +int cfg80211_stop_sched_scan_req (struct cfg80211_registered_device *rdev, +struct cfg80211_sched_scan_request *req, +bool driver_initiated);int __cfg80211_stop_sched_scan (struct cfg80211_registered_device *rdev, -bool driver_initiated); +u64 reqid,bool driver_initiated);void cfg80211_upload_connect_keys (struct wireless_dev *wdev); int cfg80211_change_iface(struct cfg80211_registered_device *rdev, struct net_device *dev, enum nl80211_iftype ntype,
net/wireless/nl80211.c +40 -10
106 lines not on this page · raw message
net/wireless/rdev-ops.h +1 -1
@@ -813,7 +813,7 @@ static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev, struct cfg80211_sched_scan_request *request) {int ret; -trace_rdev_sched_scan_start (&rdev->wiphy, dev, request); +trace_rdev_sched_scan_start (&rdev->wiphy, dev, request->reqid); ret = rdev->ops->sched_scan_start (&rdev->wiphy, dev, request);trace_rdev_return_int (&rdev->wiphy, ret);return ret;
net/wireless/scan.c +86 -16
133 lines not on this page · raw message
net/wireless/trace.h +12 -6
@@ -1610,20 +1610,26 @@TP_ARGS (wiphy, rx, tx) ); -TRACE_EVENT (rdev_sched_scan_start, - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_sched_scan_request *request), -TP_ARGS (wiphy, netdev, request), +DECLARE_EVENT_CLASS (wiphy_netdev_id_evt, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u64 id), +TP_ARGS (wiphy, netdev, id),TP_STRUCT__entry ( WIPHY_ENTRY NETDEV_ENTRY +__field (u64, id) ),TP_fast_assign ( WIPHY_ASSIGN; NETDEV_ASSIGN; + __entry->id = id; ), -TP_printk (WIPHY_PR_FMT ", " NETDEV_PR_FMT , -WIPHY_PR_ARG ,NETDEV_PR_ARG ) +TP_printk (WIPHY_PR_FMT ", " NETDEV_PR_FMT ", id: %llu" , +WIPHY_PR_ARG ,NETDEV_PR_ARG , __entry->id) +); + +DEFINE_EVENT (wiphy_netdev_id_evt, rdev_sched_scan_start, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u64 id), +TP_ARGS (wiphy, netdev, id) ); TRACE_EVENT(rdev_tdls_mgmt,
Signature · 1 line
1.9.1
Arend van Spriel
maintainerPATCH v2 3/10 nl80211: add support for BSSIDs in scheduled scan matchsets
In reply to Arend van SprielThis patch allows for the scheduled scan request to specify matchsets for specific BSSIDs.
--- include/net/cfg80211.h | 6 +++++- include/uapi/linux/nl80211.h | 2 ++ net/wireless/nl80211.c | 41 +++++++++++++++++++++++++++++++---------- 3 files changed, 38 insertions(+), 11 deletions(-)
include/net/cfg80211.h +5 -1
@@ -1613,11 +1613,15 @@ static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)/** * struct cfg80211_match_set - sets of attributes to match * -* @ssid: SSID to be matched; may be zero-length for no match (RSSI only) +* @ssid: SSID to be matched; may be zero-length in case of BSSID match +* or no match (RSSI only) +* @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match +* or no match (RSSI only) * @rssi_thold: don't report scan results below this threshold (in s32 dBm) */ struct cfg80211_match_set {struct cfg80211_ssid ssid; +u8 bssid[ETH_ALEN ];s32 rssi_thold; };
include/uapi/linux/nl80211.h +2 -0
@@ -3209,6 +3209,7 @@ enum nl80211_reg_rule_attr {* BSS-es in the specified band is to be adjusted before doing * RSSI-based BSS selection. The attribute value is a packed structure * value as specified by &struct nl80211_bss_select_rssi_adjust. +* @NL80211_SCHED_SCAN_MATCH_ATTR_BSSID: BSSID to be used for matching. * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter * attribute number currently defined * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use
@@ -3220,6 +3221,7 @@ enum nl80211_sched_scan_match_attr {NL80211_SCHED_SCAN_MATCH_ATTR_RSSI ,NL80211_SCHED_SCAN_MATCH_ATTR_RELATIVE_RSSI ,NL80211_SCHED_SCAN_MATCH_ATTR_RSSI_ADJUST , +NL80211_SCHED_SCAN_MATCH_ATTR_BSSID ,/* keep last */ __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST,
net/wireless/nl80211.c +31 -10
73 lines not on this page · raw message
Signature · 1 line
1.9.1
Arend van Spriel
maintainerPATCH v2 4/10 cfg80211: add request id parameter to .sched_scan_stop() signature
In reply to Arend van SprielFor multiple scheduled scan support the driver needs to know which scheduled scan request is being stopped. Pass the request id in the .sched_scan_stop() callback.
--- drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +- .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 +++--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +- include/net/cfg80211.h | 15 ++++++++------- net/mac80211/cfg.c | 3 ++- net/wireless/rdev-ops.h | 6 +++--- net/wireless/scan.c | 2 +- net/wireless/trace.h | 10 +++++----- 8 files changed, 24 insertions(+), 22 deletions(-)
drivers/net/wireless/ath/ath6kl/cfg80211.c +1 -1
@@ -3354,7 +3354,7 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy, }static int ath6kl_cfg80211_sscan_stop (struct wiphy *wiphy, -struct net_device *dev) +struct net_device *dev,u64 reqid) {struct ath6kl_vif *vif =netdev_priv (dev);bool stopped;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +3 -3
@@ -3387,7 +3387,7 @@ static int brcmf_start_internal_escan(struct brcmf_if *ifp, }static int brcmf_cfg80211_sched_scan_stop (struct wiphy *wiphy, -struct net_device *ndev) +struct net_device *ndev,u64 reqid) {struct brcmf_cfg80211_info *cfg =wiphy_to_cfg (wiphy);struct brcmf_if *ifp =netdev_priv (ndev);
@@ -3589,7 +3589,7 @@ static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) cfg->wowl.pre_pmmode); cfg->wowl.active = false;if (cfg->wowl.nd_enabled) { -brcmf_cfg80211_sched_scan_stop (cfg->wiphy, ifp->ndev); +brcmf_cfg80211_sched_scan_stop (cfg->wiphy, ifp->ndev,0 );brcmf_fweh_unregister (cfg->pub,BRCMF_E_PFN_NET_FOUND );brcmf_fweh_register (cfg->pub,BRCMF_E_PFN_NET_FOUND , brcmf_notify_sched_scan_results);
@@ -3673,7 +3673,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,/* Stop scheduled scan */ if (brcmf_feat_is_enabled (ifp,BRCMF_FEAT_PNO )) -brcmf_cfg80211_sched_scan_stop (wiphy, ndev); +brcmf_cfg80211_sched_scan_stop (wiphy, ndev,0 );/* end any scanning */ if (test_bit (BRCMF_SCAN_STATUS_BUSY , &cfg->scan_status))
drivers/net/wireless/marvell/mwifiex/cfg80211.c +1 -1
@@ -2699,7 +2699,7 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv,* previous bgscan configuration in the firmware */ static int mwifiex_cfg80211_sched_scan_stop (struct wiphy *wiphy, -struct net_device *dev) +struct net_device *dev,u64 reqid) {struct mwifiex_private *priv =mwifiex_netdev_get_priv (dev);
include/net/cfg80211.h +8 -7
@@ -2771,12 +2771,12 @@ struct cfg80211_nan_func {* @set_cqm_txe_config: Configure connection quality monitor TX error * thresholds. * @sched_scan_start: Tell the driver to start a scheduled scan. -* @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This -* call must stop the scheduled scan and be ready for starting a new one -* before it returns, i.e. @sched_scan_start may be called immediately -* after that again and should not fail in that case. The driver should -* not call cfg80211_sched_scan_stopped() for a requested stop (when this -* method returns 0.) +* @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with +* given request id. This call must stop the scheduled scan and be ready +* for starting a new one before it returns, i.e. @sched_scan_start may be +* called immediately after that again and should not fail in that case. +* The driver should not call cfg80211_sched_scan_stopped() for a requested +* stop (when this method returns 0). * * @mgmt_frame_register: Notify driver that a management frame type was * registered. The callback is allowed to sleep.
@@ -3074,7 +3074,8 @@ struct cfg80211_ops {int (*sched_scan_start)(struct wiphy *wiphy,struct net_device *dev,struct cfg80211_sched_scan_request *request); -int (*sched_scan_stop)(struct wiphy *wiphy,struct net_device *dev); +int (*sched_scan_stop)(struct wiphy *wiphy,struct net_device *dev, +u64 reqid);int (*set_rekey_data)(struct wiphy *wiphy,struct net_device *dev,struct cfg80211_gtk_rekey_data *data);
net/mac80211/cfg.c +2 -1
@@ -2242,7 +2242,8 @@ static void ieee80211_abort_scan(struct wiphy *wiphy, struct wireless_dev *wdev) }static int -ieee80211_sched_scan_stop (struct wiphy *wiphy,struct net_device *dev) +ieee80211_sched_scan_stop (struct wiphy *wiphy,struct net_device *dev, +u64 reqid) {struct ieee80211_local *local =wiphy_priv (wiphy);
net/wireless/rdev-ops.h +3 -3
@@ -820,11 +820,11 @@ static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev, }static inline int rdev_sched_scan_stop (struct cfg80211_registered_device *rdev, -struct net_device *dev) +struct net_device *dev,u64 reqid) {int ret; -trace_rdev_sched_scan_stop (&rdev->wiphy, dev); - ret = rdev->ops->sched_scan_stop (&rdev->wiphy, dev); +trace_rdev_sched_scan_stop (&rdev->wiphy, dev, reqid); + ret = rdev->ops->sched_scan_stop (&rdev->wiphy, dev, reqid);trace_rdev_return_int (&rdev->wiphy, ret);return ret; }
net/wireless/scan.c +1 -1
@@ -429,7 +429,7 @@ int cfg80211_stop_sched_scan_req(struct cfg80211_registered_device *rdev,ASSERT_RTNL ();if (!driver_initiated) { -int err =rdev_sched_scan_stop (rdev, req->dev); +int err =rdev_sched_scan_stop (rdev, req->dev, req->reqid);if (err)return err; }
net/wireless/trace.h +5 -5
@@ -576,11 +576,6 @@TP_ARGS (wiphy, netdev) ); -DEFINE_EVENT (wiphy_netdev_evt, rdev_sched_scan_stop, - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), -TP_ARGS (wiphy, netdev) -); -DEFINE_EVENT (wiphy_netdev_evt, rdev_set_rekey_data, TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), TP_ARGS(wiphy, netdev)
@@ -1632,6 +1627,11 @@TP_ARGS (wiphy, netdev, id) ); +DEFINE_EVENT (wiphy_netdev_id_evt, rdev_sched_scan_stop, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u64 id), +TP_ARGS (wiphy, netdev, id) +); + TRACE_EVENT(rdev_tdls_mgmt, TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *peer, u8 action_code, u8 dialog_token,
Signature · 1 line
1.9.1
Arend van Spriel
maintainerPATCH v2 5/10 cfg80211: add request id to cfg80211_sched_scan_*() api
In reply to Arend van SprielHave proper request id filled in the SCHED_SCAN_RESULTS and SCHED_SCAN_STOPPED notifications toward user-space by having the driver provide it through the api.
---
V2:
- added kerneldoc for struct cfg80211_sched_scan_request::results_wk.
--- drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +- drivers/net/wireless/ath/ath6kl/wmi.c | 2 +- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 4 +- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 6 +-- drivers/net/wireless/marvell/mwifiex/main.c | 2 +- drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 2 +- drivers/net/wireless/marvell/mwifiex/sta_event.c | 2 +- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 2 +- include/net/cfg80211.h | 11 ++++-- net/mac80211/pm.c | 2 +- net/mac80211/scan.c | 4 +- net/mac80211/util.c | 2 +- net/wireless/core.c | 1 - net/wireless/core.h | 1 - net/wireless/nl80211.c | 2 + net/wireless/scan.c | 45 ++++++++++++---------- net/wireless/trace.h | 26 ++++++++++--- 17 files changed, 70 insertions(+), 46 deletions(-)
drivers/net/wireless/ath/ath6kl/cfg80211.c +1 -1
@@ -171,7 +171,7 @@ static void ath6kl_cfg80211_sscan_disable(struct ath6kl_vif *vif)if (!stopped)return ; -cfg80211_sched_scan_stopped (ar->wiphy); +cfg80211_sched_scan_stopped (ar->wiphy,0 ); } static int ath6kl_set_wpa_version(struct ath6kl_vif *vif,
drivers/net/wireless/ath/ath6kl/wmi.c +1 -1
@@ -1082,7 +1082,7 @@ void ath6kl_wmi_sscan_timer(unsigned long ptr) {struct ath6kl_vif *vif = (struct ath6kl_vif *) ptr; -cfg80211_sched_scan_results (vif->ar->wiphy); +cfg80211_sched_scan_results (vif->ar->wiphy,0 ); } static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len,
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +2 -2
@@ -762,7 +762,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,brcmf_dbg (SCAN ,"scheduled scan completed\n" ); cfg->internal_escan = false;if (!aborted) -cfg80211_sched_scan_results (cfg_to_wiphy (cfg)); +cfg80211_sched_scan_results (cfg_to_wiphy (cfg),0 ); } else if (scan_request) {struct cfg80211_scan_info info = { .aborted = aborted,
@@ -3354,7 +3354,7 @@ static int brcmf_start_internal_escan(struct brcmf_if *ifp, goto free_req; out_err: -cfg80211_sched_scan_stopped (wiphy); +cfg80211_sched_scan_stopped (wiphy,0 ); free_req:kfree (request);return err;
drivers/net/wireless/marvell/mwifiex/cfg80211.c +3 -3
@@ -2034,7 +2034,7 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,struct mwifiex_private *priv =mwifiex_netdev_get_priv (dev);if (!mwifiex_stop_bg_scan (priv)) -cfg80211_sched_scan_stopped_rtnl (priv->wdev.wiphy); +cfg80211_sched_scan_stopped_rtnl (priv->wdev.wiphy,0 );if (mwifiex_deauthenticate (priv,NULL ))return -EFAULT ;
@@ -2302,7 +2302,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv) (int)sme->ssid_len, (char *)sme->ssid, sme->bssid);if (!mwifiex_stop_bg_scan (priv)) -cfg80211_sched_scan_stopped_rtnl (priv->wdev.wiphy); +cfg80211_sched_scan_stopped_rtnl (priv->wdev.wiphy,0 ); ret =mwifiex_cfg80211_assoc (priv, sme->ssid_len, sme->ssid, sme->bssid, priv->bss_mode, sme->channel, sme,0 );
@@ -2511,7 +2511,7 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv, priv->scan_block = false;if (!mwifiex_stop_bg_scan (priv)) -cfg80211_sched_scan_stopped_rtnl (priv->wdev.wiphy); +cfg80211_sched_scan_stopped_rtnl (priv->wdev.wiphy,0 ); user_scan_cfg =kzalloc (sizeof (*user_scan_cfg),GFP_KERNEL );if (!user_scan_cfg)
drivers/net/wireless/marvell/mwifiex/main.c +1 -1
@@ -743,7 +743,7 @@ static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter,mwifiex_dbg (priv->adapter,INFO ,"aborting bgscan on ndo_stop\n" );mwifiex_stop_bg_scan (priv); -cfg80211_sched_scan_stopped (priv->wdev.wiphy); +cfg80211_sched_scan_stopped (priv->wdev.wiphy,0 ); }return 0 ;
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +1 -1
@@ -1201,7 +1201,7 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,break ;case HostCmd_CMD_802_11_BG_SCAN_QUERY: ret =mwifiex_ret_802_11_scan (priv, resp); -cfg80211_sched_scan_results (priv->wdev.wiphy); +cfg80211_sched_scan_results (priv->wdev.wiphy,0 );mwifiex_dbg (adapter,CMD ,"info: CMD_RESP: BG_SCAN result is ready!\n" );break ;
drivers/net/wireless/marvell/mwifiex/sta_event.c +1 -1
@@ -793,7 +793,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)case EVENT_BG_SCAN_STOPPED :dev_dbg (adapter->dev,"event: BGS_STOPPED\n" ); -cfg80211_sched_scan_stopped (priv->wdev.wiphy); +cfg80211_sched_scan_stopped (priv->wdev.wiphy,0 );if (priv->sched_scanning) priv->sched_scanning = false;break ;
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +1 -1
@@ -560,7 +560,7 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)#endif mwifiex_dbg (adapter,CMD ,"aborting bgscan!\n" );mwifiex_stop_bg_scan (priv); -cfg80211_sched_scan_stopped (priv->wdev.wiphy); +cfg80211_sched_scan_stopped (priv->wdev.wiphy,0 ); #ifdef CONFIG_PM }#endif
include/net/cfg80211.h +8 -3
@@ -1666,6 +1666,7 @@ struct cfg80211_bss_select_adjust {* (others are filtered out). * If ommited, all results are passed. * @n_match_sets: number of match sets +* @results_wk: worker for processing results notification. * @wiphy: the wiphy this was for * @dev: the interface * @scan_start: start time of the scheduled scan
@@ -1722,6 +1723,7 @@ struct cfg80211_sched_scan_request {struct cfg80211_bss_select_adjust rssi_adjust;/* internal */ +struct work_struct results_wk;struct wiphy *wiphy;struct net_device *dev;unsigned long scan_start;
@@ -4561,31 +4563,34 @@ void cfg80211_scan_done(struct cfg80211_scan_request *request,* cfg80211_sched_scan_results - notify that new scan results are available * * @wiphy: the wiphy which got scheduled scan results +* @reqid: identifier for the related scheduled scan request */ -void cfg80211_sched_scan_results (struct wiphy *wiphy); +void cfg80211_sched_scan_results (struct wiphy *wiphy,u64 reqid);/** * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped * * @wiphy: the wiphy on which the scheduled scan stopped +* @reqid: identifier for the related scheduled scan request * * The driver can call this function to inform cfg80211 that the * scheduled scan had to be stopped, for whatever reason. The driver * is then called back via the sched_scan_stop operation when done. */ -void cfg80211_sched_scan_stopped (struct wiphy *wiphy); +void cfg80211_sched_scan_stopped (struct wiphy *wiphy,u64 reqid);/** * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped * * @wiphy: the wiphy on which the scheduled scan stopped +* @reqid: identifier for the related scheduled scan request * * The driver can call this function to inform cfg80211 that the * scheduled scan had to be stopped, for whatever reason. The driver * is then called back via the sched_scan_stop operation when done. * This function should be called with rtnl locked. */ -void cfg80211_sched_scan_stopped_rtnl (struct wiphy *wiphy); +void cfg80211_sched_scan_stopped_rtnl (struct wiphy *wiphy,u64 reqid);/** * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
net/mac80211/pm.c +1 -1
@@ -10,7 +10,7 @@ static void ieee80211_sched_scan_cancel(struct ieee80211_local *local) {if (ieee80211_request_sched_scan_stop (local))return ; -cfg80211_sched_scan_stopped_rtnl (local->hw.wiphy); +cfg80211_sched_scan_stopped_rtnl (local->hw.wiphy,0 ); }int __ieee80211_suspend (struct ieee80211_hw *hw,struct cfg80211_wowlan *wowlan)
net/mac80211/scan.c +2 -2
@@ -1219,7 +1219,7 @@ void ieee80211_sched_scan_results(struct ieee80211_hw *hw)trace_api_sched_scan_results (local); -cfg80211_sched_scan_results (hw->wiphy); +cfg80211_sched_scan_results (hw->wiphy,0 ); }EXPORT_SYMBOL (ieee80211_sched_scan_results);
@@ -1239,7 +1239,7 @@ void ieee80211_sched_scan_end(struct ieee80211_local *local)mutex_unlock (&local->mtx); -cfg80211_sched_scan_stopped (local->hw.wiphy); +cfg80211_sched_scan_stopped (local->hw.wiphy,0 ); }void ieee80211_sched_scan_stopped_work (struct work_struct *work)
net/mac80211/util.c +1 -1
@@ -2103,7 +2103,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)mutex_unlock (&local->mtx);if (sched_scan_stopped) -cfg80211_sched_scan_stopped_rtnl (local->hw.wiphy); +cfg80211_sched_scan_stopped_rtnl (local->hw.wiphy,0 ); wake_up:if (local->in_reconfig) {
net/wireless/core.c +0 -1
@@ -474,7 +474,6 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,INIT_LIST_HEAD (&rdev->bss_list);INIT_LIST_HEAD (&rdev->sched_scan_req_list);INIT_WORK (&rdev->scan_done_wk, __cfg80211_scan_done); -INIT_WORK (&rdev->sched_scan_results_wk, __cfg80211_sched_scan_results);INIT_LIST_HEAD (&rdev->mlme_unreg);spin_lock_init (&rdev->mlme_unreg_lock);INIT_WORK (&rdev->mlme_unreg_wk, cfg80211_mlme_unreg_wk);
net/wireless/core.h +0 -1
@@ -78,7 +78,6 @@ struct cfg80211_registered_device {struct cfg80211_sched_scan_request __rcu *sched_scan_req;unsigned long suspend_at;struct work_struct scan_done_wk; -struct work_struct sched_scan_results_wk;struct genl_info *cur_cmd_info;
net/wireless/nl80211.c +2 -0
@@ -7388,6 +7388,8 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,if (err) goto out_err; +INIT_WORK (&sched_scan_req->results_wk, __cfg80211_sched_scan_results); +/* leave request id zero for legacy request * or if driver does not support multi-scheduled scan */
net/wireless/scan.c +25 -20
82 lines not on this page · raw message
net/wireless/trace.h +20 -6
@@ -2820,14 +2820,28 @@ MAC_PR_ARG(tsf_bssid)) ); -DEFINE_EVENT (wiphy_only_evt, cfg80211_sched_scan_results, - TP_PROTO(struct wiphy *wiphy), -TP_ARGS (wiphy) +DECLARE_EVENT_CLASS (wiphy_id_evt, + TP_PROTO(struct wiphy *wiphy, u64 id), +TP_ARGS (wiphy, id), +TP_STRUCT__entry ( + WIPHY_ENTRY +__field (u64, id) + ), +TP_fast_assign ( + WIPHY_ASSIGN; + __entry->id = id; + ), +TP_printk (WIPHY_PR_FMT ", id: %llu" ,WIPHY_PR_ARG , __entry->id) ); -DEFINE_EVENT (wiphy_only_evt, cfg80211_sched_scan_stopped, - TP_PROTO(struct wiphy *wiphy), -TP_ARGS (wiphy) +DEFINE_EVENT (wiphy_id_evt, cfg80211_sched_scan_stopped, + TP_PROTO(struct wiphy *wiphy, u64 id), +TP_ARGS (wiphy, id) +); + +DEFINE_EVENT (wiphy_id_evt, cfg80211_sched_scan_results, + TP_PROTO(struct wiphy *wiphy, u64 id), +TP_ARGS (wiphy, id) ); TRACE_EVENT(cfg80211_get_bss,
Signature · 1 line
1.9.1
Arend van Spriel
maintainerPATCH v2 6/10 brcmfmac: add firmware feature detection for gscan feature
In reply to Arend van SprielFrom: Arend van Spriel <[email protected]>
Detect gscan support in firmware by doing pfn_gscan_cfg iovar with invalid version.
--- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 22 +++++++- .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +- .../broadcom/brcm80211/brcmfmac/fwil_types.h | 59 ++++++++++++++++++++++ 3 files changed, 83 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +21 -1
@@ -27,6 +27,7 @@#include "feature.h" #include "common.h" +#define BRCMF_FW_UNSUPPORTED 23/* * expand feature list to array of feature strings.
@@ -113,6 +114,22 @@ static void brcmf_feat_iovar_int_get(struct brcmf_if *ifp, } } +static void brcmf_feat_iovar_data_set (struct brcmf_if *ifp, +enum brcmf_feat_id id,char *name, +const void *data,size_t len) +{ +int err; + + err =brcmf_fil_iovar_data_set (ifp, name, data, len); +if (err != -BRCMF_FW_UNSUPPORTED ) { +brcmf_dbg (INFO ,"enabling feature: %s\n" , brcmf_feat_names[id]); + ifp->drvr->feat_flags |=BIT (id); + }else { +brcmf_dbg (TRACE ,"%s feature check failed: %d\n" , + brcmf_feat_names[id], err); + } +} +static void brcmf_feat_firmware_capabilities (struct brcmf_if *ifp) {char caps[256 ];
@@ -136,11 +153,14 @@ void brcmf_feat_attach(struct brcmf_pub *drvr) {struct brcmf_if *ifp =brcmf_get_ifp (drvr,0 );struct brcmf_pno_macaddr_le pfn_mac; +struct brcmf_gscan_config gscan_cfg;u32 wowl_cap;s32 err;brcmf_feat_firmware_capabilities (ifp); - +memset (&gscan_cfg,0 ,sizeof (gscan_cfg)); +brcmf_feat_iovar_data_set (ifp,BRCMF_FEAT_GSCAN ,"pfn_gscan_cfg" , + &gscan_cfg,sizeof (gscan_cfg));brcmf_feat_iovar_int_get (ifp,BRCMF_FEAT_PNO ,"pfn" );if (drvr->bus_if->wowl_supported)brcmf_feat_iovar_int_get (ifp,BRCMF_FEAT_WOWL ,"wowl" );
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +3 -1
@@ -31,6 +31,7 @@* WOWL_GTK: (WOWL) GTK rekeying offload * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL. * MFP: 802.11w Management Frame Protection. +* GSCAN: enhanced scan offload feature. */ #define BRCMF_FEAT_LIST \ BRCMF_FEAT_DEF(MBSS) \
@@ -44,7 +45,8 @@ BRCMF_FEAT_DEF(WOWL_ND) \ BRCMF_FEAT_DEF(WOWL_GTK) \ BRCMF_FEAT_DEF(WOWL_ARP_ND) \ - BRCMF_FEAT_DEF(MFP) + BRCMF_FEAT_DEF(MFP) \ + BRCMF_FEAT_DEF(GSCAN)/* * Quirks:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +59 -0
63 lines not on this page · raw message
Signature · 1 line
1.9.1
Arend van Spriel
maintainerPATCH v2 7/10 brcmfmac: move scheduled scan wiphy param setting to pno module
In reply to Arend van SprielAs pno module is providing scheduled scan functionality have it taking care of setting related wiphy parameters as well.
--- .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 18 +++++------------- .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 2 ++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 10 ++++++++++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h | 8 ++++++++ 4 files changed, 25 insertions(+), 13 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +5 -13
@@ -6353,16 +6353,6 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)return -ENOMEM ; } -static void brcmf_wiphy_pno_params (struct wiphy *wiphy) -{ -/* scheduled scan settings */ - wiphy->max_sched_scan_reqs =1 ; - wiphy->max_sched_scan_ssids =BRCMF_PNO_MAX_PFN_COUNT ; - wiphy->max_match_sets =BRCMF_PNO_MAX_PFN_COUNT ; - wiphy->max_sched_scan_ie_len =BRCMF_SCAN_IE_LEN_MAX ; - wiphy->max_sched_scan_plan_interval =BRCMF_PNO_SCHED_SCAN_MAX_PERIOD ; -} -#ifdef CONFIG_PM static const struct wiphy_wowlan_support brcmf_wowlan_support = { .flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT,
@@ -6409,6 +6399,7 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)const struct ieee80211_iface_combination *combo;struct ieee80211_supported_band *band;u16 max_interfaces =0 ; +bool gscan;__le32 bandlist[3 ];u32 n_bands;int err, i;
@@ -6457,9 +6448,10 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp) wiphy->flags |=WIPHY_FLAG_SUPPORTS_FW_ROAM ; wiphy->mgmt_stypes = brcmf_txrx_stypes; wiphy->max_remain_on_channel_duration =5000 ; -if (brcmf_feat_is_enabled (ifp,BRCMF_FEAT_PNO )) -brcmf_wiphy_pno_params (wiphy); - +if (brcmf_feat_is_enabled (ifp,BRCMF_FEAT_PNO )) { + gscan =brcmf_feat_is_enabled (ifp,BRCMF_FEAT_GSCAN ); +brcmf_pno_wiphy_params (wiphy, gscan); + }/* vendor commands/events support */ wiphy->vendor_commands = brcmf_vendor_cmds; wiphy->n_vendor_commands =BRCMF_VNDR_CMDS_LAST -1 ;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +2 -0
@@ -24,6 +24,8 @@#include "fwil_types.h" #include "p2p.h" +#define BRCMF_SCAN_IE_LEN_MAX 2048 +#define WL_NUM_SCAN_MAX 10#define WL_TLV_INFO_MAX 1024#define WL_BSS_INFO_MAX 2048
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +10 -0
@@ -241,3 +241,13 @@ int brcmf_pno_start_sched_scan(struct brcmf_if *ifp,return ret; } +void brcmf_pno_wiphy_params (struct wiphy *wiphy,bool gscan) +{ +/* scheduled scan settings */ + wiphy->max_sched_scan_reqs = gscan ?2 :1 ; + wiphy->max_sched_scan_ssids =BRCMF_PNO_MAX_PFN_COUNT ; + wiphy->max_match_sets =BRCMF_PNO_MAX_PFN_COUNT ; + wiphy->max_sched_scan_ie_len =BRCMF_SCAN_IE_LEN_MAX ; + wiphy->max_sched_scan_plan_interval =BRCMF_PNO_SCHED_SCAN_MAX_PERIOD ; +} +
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h +8 -0
@@ -37,4 +37,12 @@int brcmf_pno_start_sched_scan (struct brcmf_if *ifp,struct cfg80211_sched_scan_request *req); +/** +* brcmf_pno_wiphy_params - fill scheduled scan parameters in wiphy instance. +* +* @wiphy: wiphy instance to be used. +* @gscan: indicates whether the device has support for g-scan feature. +*/ +void brcmf_pno_wiphy_params (struct wiphy *wiphy,bool gscan); +#endif /* _BRCMF_PNO_H */
Signature · 1 line
1.9.1
Arend van Spriel
maintainerPATCH v2 8/10 brcmfmac: add support multi-scheduled scan
In reply to Arend van SprielThis change adds support for multi-scheduled scan in the driver. It currently relies on g-scan support in firmware and will set struct wiphy::max_sched_scan_reqs accordingly. This is limited to 16 concurrent requests.
The firmware currently has a limit of 64 channels that can be configured for all requests in total regardless whether there are duplicates. So if a request uses 35 channels there are 29 channels left for another request. When user-space does not specify any channels cfg80211 will add all channels defined by the wiphy instance to the request, which makes reaching the limit rather easy for dual-band devices.
---
V2:
- change return value to -ENODATA in brcmf_pno_prep_fwconfig() if called without active requests.
--- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 67 +++- .../broadcom/brcm80211/brcmfmac/cfg80211.h | 6 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 1 + .../wireless/broadcom/brcm80211/brcmfmac/debug.h | 2 + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 31 +- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 400 ++++++++++++++++++--- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.h | 47 ++- 7 files changed, 463 insertions(+), 91 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +49 -18
@@ -719,6 +719,8 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, {struct brcmf_scan_params_le params_le;struct cfg80211_scan_request *scan_request; +u64 reqid; +u32 bucket;s32 err =0 ;brcmf_dbg (SCAN ,"Enter\n" );
@@ -749,7 +751,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, err =brcmf_fil_cmd_data_set (ifp,BRCMF_C_SCAN , ¶ms_le,sizeof (params_le));if (err) -brcmf_err ("Scan abort failed\n" ); +brcmf_err ("Scan abort failed\n" ); }brcmf_scan_config_mpc (ifp,1 );
@@ -758,11 +760,21 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,* e-scan can be initiated internally * which takes precedence. */ -if (cfg->internal_escan) { -brcmf_dbg (SCAN ,"scheduled scan completed\n" ); - cfg->internal_escan = false; -if (!aborted) -cfg80211_sched_scan_results (cfg_to_wiphy (cfg),0 ); +if (cfg->int_escan_map) { +brcmf_dbg (SCAN ,"scheduled scan completed (%x)\n" , + cfg->int_escan_map); +while (cfg->int_escan_map) { + bucket =__ffs (cfg->int_escan_map); + cfg->int_escan_map &= ~BIT (bucket); + reqid =brcmf_pno_find_reqid_by_bucket (cfg->pno, + bucket); +if (!aborted) { +brcmf_dbg (SCAN ,"report results: reqid=%llu\n" , + reqid); +cfg80211_sched_scan_results (cfg_to_wiphy (cfg), + reqid); + } + } }else if (scan_request) {struct cfg80211_scan_info info = { .aborted = aborted,
@@ -1011,7 +1023,7 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,if (!ssid_le.SSID_len)brcmf_dbg (SCAN ,"%d: Broadcast scan\n" , i);else -brcmf_dbg (SCAN ,"%d: scan for %s size =%d\n" , +brcmf_dbg (SCAN ,"%d: scan for %.32s size=%d\n" , i, ssid_le.SSID, ssid_le.SSID_len);memcpy (ptr, &ssid_le,sizeof (ssid_le)); ptr +=sizeof (ssid_le);
@@ -3011,7 +3023,7 @@ void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg)struct escan_info *escan = &cfg->escan_info;set_bit (BRCMF_SCAN_STATUS_ABORT , &cfg->scan_status); -if (cfg->internal_escan || cfg->scan_request) { +if (cfg->int_escan_map || cfg->scan_request) { escan->escan_state =WL_ESCAN_STATE_IDLE ;brcmf_notify_escan_complete (cfg, escan->ifp, true, true); }
@@ -3034,7 +3046,7 @@ static void brcmf_escan_timeout(unsigned long data)struct brcmf_cfg80211_info *cfg = (struct brcmf_cfg80211_info *)data; -if (cfg->internal_escan || cfg->scan_request) { +if (cfg->int_escan_map || cfg->scan_request) {brcmf_err ("timer expired\n" );schedule_work (&cfg->escan_timeout_work); }
@@ -3117,7 +3129,7 @@ static void brcmf_escan_timeout(unsigned long data)if (brcmf_p2p_scan_finding_common_channel (cfg, bss_info_le)) goto exit; -if (!cfg->internal_escan && !cfg->scan_request) { +if (!cfg->int_escan_map && !cfg->scan_request) {brcmf_dbg (SCAN ,"result without cfg80211 request\n" ); goto exit; }
@@ -3163,7 +3175,7 @@ static void brcmf_escan_timeout(unsigned long data) cfg->escan_info.escan_state =WL_ESCAN_STATE_IDLE ;if (brcmf_p2p_scan_finding_common_channel (cfg,NULL )) goto exit; -if (cfg->internal_escan || cfg->scan_request) { +if (cfg->int_escan_map || cfg->scan_request) {brcmf_inform_bss (cfg); aborted = status !=BRCMF_E_STATUS_SUCCESS ;brcmf_notify_escan_complete (cfg, ifp, aborted, false);
@@ -3233,17 +3245,21 @@ static int brcmf_internal_escan_add_info(struct cfg80211_scan_request *req,return 0 ; } -static int brcmf_start_internal_escan (struct brcmf_if *ifp, +static int brcmf_start_internal_escan (struct brcmf_if *ifp,u32 fwmap,struct cfg80211_scan_request *request) {struct brcmf_cfg80211_info *cfg = ifp->drvr->config;int err;if (test_bit (BRCMF_SCAN_STATUS_BUSY , &cfg->scan_status)) { +if (cfg->int_escan_map) +brcmf_dbg (SCAN ,"aborting internal scan: map=%u\n" , + cfg->int_escan_map);/* Abort any on-going scan */ brcmf_abort_scanning (cfg); } +brcmf_dbg (SCAN ,"start internal scan: map=%u\n" , fwmap);set_bit (BRCMF_SCAN_STATUS_BUSY , &cfg->scan_status); cfg->escan_info.run = brcmf_run_escan; err =brcmf_do_escan (ifp, request);
@@ -3251,7 +3267,7 @@ static int brcmf_start_internal_escan(struct brcmf_if *ifp,clear_bit (BRCMF_SCAN_STATUS_BUSY , &cfg->scan_status);return err; } - cfg->internal_escan = true; + cfg->int_escan_map = fwmap;return 0 ; }
@@ -3293,6 +3309,7 @@ static int brcmf_start_internal_escan(struct brcmf_if *ifp,struct wiphy *wiphy =cfg_to_wiphy (cfg);int i, err =0 ;struct brcmf_pno_scanresults_le *pfn_result; +u32 bucket_map;u32 result_count;u32 status;
@@ -3330,6 +3347,7 @@ static int brcmf_start_internal_escan(struct brcmf_if *ifp, netinfo_start =brcmf_get_netinfo_array (pfn_result); + bucket_map =0 ;for (i =0 ; i < result_count; i++) { netinfo = &netinfo_start[i];if (!netinfo) {
@@ -3341,6 +3359,7 @@ static int brcmf_start_internal_escan(struct brcmf_if *ifp,brcmf_dbg (SCAN ,"SSID:%.32s Channel:%d\n" , netinfo->SSID, netinfo->channel); + bucket_map |=brcmf_pno_get_bucket_map (cfg->pno, netinfo); err = brcmf_internal_escan_add_info(request, netinfo->SSID, netinfo->SSID_len,
@@ -3349,7 +3368,10 @@ static int brcmf_start_internal_escan(struct brcmf_if *ifp, goto out_err; } - err =brcmf_start_internal_escan (ifp, request); +if (!bucket_map) + goto free_req; + + err =brcmf_start_internal_escan (ifp, bucket_map, request);if (!err) goto free_req;
@@ -3368,11 +3390,11 @@ static int brcmf_start_internal_escan(struct brcmf_if *ifp,struct brcmf_if *ifp =netdev_priv (ndev);struct brcmf_cfg80211_info *cfg =wiphy_priv (wiphy); -brcmf_dbg (SCAN ,"Enter n_match_sets:%d n_ssids:%d\n" , +brcmf_dbg (SCAN ,"Enter: n_match_sets=%d n_ssids=%d\n" , req->n_match_sets, req->n_ssids);if (test_bit (BRCMF_SCAN_STATUS_SUPPRESS , &cfg->scan_status)) { -brcmf_err ("Scanning suppressed: status (%lu)\n" , +brcmf_err ("Scanning suppressed: status=%lu\n" , cfg->scan_status);return -EAGAIN ; }
@@ -3393,8 +3415,8 @@ static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy,struct brcmf_if *ifp =netdev_priv (ndev);brcmf_dbg (SCAN ,"enter\n" ); -brcmf_pno_clean (ifp); -if (cfg->internal_escan) +brcmf_pno_stop_sched_scan (ifp, reqid); +if (cfg->int_escan_map)brcmf_notify_escan_complete (cfg, ifp, true, true);return 0 ; }
@@ -6914,6 +6936,13 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,brcmf_p2p_detach (&cfg->p2p); goto wiphy_unreg_out; } + err =brcmf_pno_attach (cfg); +if (err) { +brcmf_err ("PNO initialisation failed (%d)\n" , err); +brcmf_btcoex_detach (cfg); +brcmf_p2p_detach (&cfg->p2p); + goto wiphy_unreg_out; + }if (brcmf_feat_is_enabled (ifp,BRCMF_FEAT_TDLS )) { err =brcmf_fil_iovar_int_set (ifp,"tdls_enable" ,1 );
@@ -6946,6 +6975,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,return cfg; detach: +brcmf_pno_detach (cfg);brcmf_btcoex_detach (cfg);brcmf_p2p_detach (&cfg->p2p); wiphy_unreg_out:
@@ -6965,6 +6995,7 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg)if (!cfg)return ; +brcmf_pno_detach (cfg);brcmf_btcoex_detach (cfg);wiphy_unregister (cfg->wiphy);kfree (cfg->ops);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +4 -2
@@ -273,7 +273,7 @@ struct brcmf_cfg80211_wowl {* @pub: common driver information. * @channel: current channel. * @active_scan: current scan mode. -* @internal_escan: indicates internally initiated e-scan is running. +* @int_escan_map: bucket map for which internal e-scan is done. * @ibss_starter: indicates this sta is ibss starter. * @pwr_save: indicate whether dongle to support power save mode. * @dongle_up: indicate whether dongle up or not.
@@ -289,6 +289,7 @@ struct brcmf_cfg80211_wowl {* @vif_cnt: number of vif instances. * @vif_event: vif event signalling. * @wowl: wowl related information. +* @pno: information of pno module. */ struct brcmf_cfg80211_info {struct wiphy *wiphy;
@@ -305,7 +306,7 @@ struct brcmf_cfg80211_info {struct brcmf_pub *pub;u32 channel;bool active_scan; -bool internal_escan; +u32 int_escan_map;bool ibss_starter;bool pwr_save;bool dongle_up;
@@ -322,6 +323,7 @@ struct brcmf_cfg80211_info {struct brcmu_d11inf d11inf;struct brcmf_assoclist_le assoclist;struct brcmf_cfg80211_wowl wowl; +struct brcmf_pno_info *pno; };/**
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +1 -0
@@ -30,6 +30,7 @@#include "debug.h" #include "fwil_types.h" #include "p2p.h" +#include "pno.h" #include "cfg80211.h" #include "fwil.h" #include "fwsignal.h"
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +2 -0
@@ -74,6 +74,7 @@#define BRCMF_EVENT_ON () (brcmf_msg_level & BRCMF_EVENT_VAL)#define BRCMF_FIL_ON () (brcmf_msg_level & BRCMF_FIL_VAL)#define BRCMF_FWCON_ON () (brcmf_msg_level & BRCMF_FWCON_VAL) +#define BRCMF_SCAN_ON () (brcmf_msg_level & BRCMF_SCAN_VAL)#else /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */
@@ -87,6 +88,7 @@#define BRCMF_EVENT_ON () 0#define BRCMF_FIL_ON () 0#define BRCMF_FWCON_ON () 0 +#define BRCMF_SCAN_ON () 0#endif /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +18 -13
@@ -835,15 +835,17 @@ struct brcmf_gtk_keyinfo_le {u8 replay_counter[BRCMF_RSN_REPLAY_LEN ]; }; +#define BRCMF_PNO_REPORT_NO_BATCH BIT(2) +/** * struct brcmf_gscan_bucket_config - configuration data for channel bucket. * -* @bucket_end_index: !unknown! -* @bucket_freq_multiple: !unknown! -* @flag: !unknown! -* @reserved: !unknown! -* @repeat: !unknown! -* @max_freq_multiple: !unknown! +* @bucket_end_index: last channel index in @channel_list in @struct brcmf_pno_config_le. +* @bucket_freq_multiple: scan interval expressed in N * @scan_freq. +* @flag: channel bucket report flags. +* @reserved: for future use. +* @repeat: number of scan at interval for exponential scan. +* @max_freq_multiple: maximum scan interval for exponential scan. */ struct brcmf_gscan_bucket_config {u8 bucket_end_index;
@@ -855,16 +857,19 @@ struct brcmf_gscan_bucket_config { };/* version supported which must match firmware */ -#define BRCMF_GSCAN_CFG_VERSION 1 +#define BRCMF_GSCAN_CFG_VERSION 2/** * enum brcmf_gscan_cfg_flags - bit values for gscan flags. * * @BRCMF_GSCAN_CFG_FLAGS_ALL_RESULTS: send probe responses/beacons to host. +* @BRCMF_GSCAN_CFG_ALL_BUCKETS_IN_1ST_SCAN: all buckets will be included in +* first scan cycle. * @BRCMF_GSCAN_CFG_FLAGS_CHANGE_ONLY: indicated only flags member is changed. */ enum brcmf_gscan_cfg_flags {BRCMF_GSCAN_CFG_FLAGS_ALL_RESULTS =BIT (0 ), +BRCMF_GSCAN_CFG_ALL_BUCKETS_IN_1ST_SCAN =BIT (3 ),BRCMF_GSCAN_CFG_FLAGS_CHANGE_ONLY =BIT (7 ), };
@@ -884,12 +889,12 @@ enum brcmf_gscan_cfg_flags {*/ struct brcmf_gscan_config {__le16 version; -u8 flags; -u8 buffer_threshold; -u8 swc_nbssid_threshold; -u8 swc_rssi_window_size; -u8 count_of_channel_buckets; -u8 retry_threshold; +u8 flags; +u8 buffer_threshold; +u8 swc_nbssid_threshold; +u8 swc_rssi_window_size; +u8 count_of_channel_buckets; +u8 retry_threshold;__le16 lost_ap_window;struct brcmf_gscan_bucket_config bucket[1 ]; };
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +348 -52
470 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h +41 -6
63 lines not on this page · raw message
Signature · 1 line
1.9.1
Arend van Spriel
maintainerPATCH v2 9/10 brcmfmac: add mutex to protect pno requests
In reply to Arend van SprielThe request references kept in pno are accessed in user-space context and in firmware event handler context. As such we need to protect it with a lock. As both context allow sleep a mutex seems appropriate.
--- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 33 ++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +25 -8
@@ -43,6 +43,7 @@struct brcmf_pno_info {int n_reqs;struct cfg80211_sched_scan_request *reqs[BRCMF_PNO_MAX_BUCKETS ]; +struct mutex req_lock; };#define ifp_to_pno (_ifp) (_ifp)->drvr->config->pno
@@ -55,13 +56,17 @@ static int brcmf_pno_store_request(struct brcmf_pno_info *pi,return -ENOSPC ; }brcmf_dbg (SCAN ,"reqid=%llu\n" , req->reqid); +mutex_lock (&pi->req_lock); pi->reqs[pi->n_reqs++] = req; +mutex_unlock (&pi->req_lock);return 0 ; }static int brcmf_pno_remove_request (struct brcmf_pno_info *pi,u64 reqid) { -int i; +int i, err =0 ; + +mutex_lock (&pi->req_lock);/* find request */ for (i =0 ; i < pi->n_reqs; i++) {
@@ -71,7 +76,8 @@ static int brcmf_pno_remove_request(struct brcmf_pno_info *pi, u64 reqid)/* request not found */ if (WARN_ON (i == pi->n_reqs)) {brcmf_err ("reqid not found\n" ); -return -ENOENT ; + err = -ENOENT ; + goto done; }brcmf_dbg (SCAN ,"reqid=%llu\n" , reqid);
@@ -79,14 +85,17 @@ static int brcmf_pno_remove_request(struct brcmf_pno_info *pi, u64 reqid)/* if last we are done */ if (!pi->n_reqs || i == pi->n_reqs) -return 0 ; + goto done;/* fill the gap with remaining requests */ while (i <= pi->n_reqs -1 ) { pi->reqs[i] = pi->reqs[i +1 ]; i++; } -return 0 ; + +done: +mutex_unlock (&pi->req_lock); +return err; } static int brcmf_pno_channel_config(struct brcmf_if *ifp,
@@ -489,6 +498,7 @@ int brcmf_pno_attach(struct brcmf_cfg80211_info *cfg)return -ENOMEM ; cfg->pno = pi; +mutex_init (&pi->req_lock);return 0 ; }
@@ -501,6 +511,7 @@ void brcmf_pno_detach(struct brcmf_cfg80211_info *cfg) cfg->pno =NULL ;WARN_ON (pi->n_reqs); +mutex_destroy (&pi->req_lock);kfree (pi); }
@@ -516,11 +527,15 @@ void brcmf_pno_wiphy_params(struct wiphy *wiphy, bool gscan)u64 brcmf_pno_find_reqid_by_bucket (struct brcmf_pno_info *pi,u32 bucket) { -/* bucket appears to be gone */ -if (bucket >= pi->n_reqs) -return 0 ; +u64 reqid =0 ; + +mutex_lock (&pi->req_lock); + +if (bucket < pi->n_reqs) + reqid = pi->reqs[bucket]->reqid; -return pi->reqs[bucket]->reqid; +mutex_unlock (&pi->req_lock); +return reqid; } u32 brcmf_pno_get_bucket_map(struct brcmf_pno_info *pi,
@@ -531,6 +546,7 @@ u32 brcmf_pno_get_bucket_map(struct brcmf_pno_info *pi,u32 bucket_map =0 ;int i, j; +mutex_lock (&pi->req_lock);for (i =0 ; i < pi->n_reqs; i++) { req = pi->reqs[i];
@@ -545,5 +561,6 @@ u32 brcmf_pno_get_bucket_map(struct brcmf_pno_info *pi, } } } +mutex_unlock (&pi->req_lock);return bucket_map; }
Signature · 1 line
1.9.1
Arend van Spriel
maintainerPATCH v2 10/10 brcmfmac: add scheduled scan support for specified BSSIDs
In reply to Arend van SprielAdd support to handle scheduled scan request containing BSSID in the matchsets. The firmware can send event upon finding BSSIDs and SSIDs. To get these in one event the bit REPORT_SEPERATELY needed to be removed from the flags in brcmf_pno_config().
---
V2:
- initialize err variable in brcmf_pno_config_networks().
--- .../broadcom/brcm80211/brcmfmac/fwil_types.h | 11 ++++ .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 58 ++++++++++++++++------ 2 files changed, 53 insertions(+), 16 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +11 -0
@@ -806,6 +806,17 @@ struct brcmf_pno_macaddr_le { };/** +* struct brcmf_pno_bssid_le - bssid configuration for PNO scan. +* +* @bssid: BSS network identifier. +* @flags: flags for this BSSID. +*/ +struct brcmf_pno_bssid_le { +u8 bssid[ETH_ALEN ]; +__le16 flags; +}; + +/** * struct brcmf_pktcnt_le - packet counters. * * @rx_good_pkt: packets (MSDUs & MMPDUs) received from this station
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +42 -16
105 lines not on this page · raw message
Signature · 1 line
1.9.1
Johannes Berg
maintainerRe: [PATCH V2 02/10] nl80211: allow multiple active scheduled scan requests
In reply to Arend van SprielHi Arend,
Overall this looks good, and I've almost applied it - but I have a question on this patch.
You have this list:
Quoted 3 lines
net/wireless/core.h +1
-0+struct list_head sched_scan_req_list;struct
cfg80211_sched_scan_request__rcu*sched_scan_req;
but you kept this. In fact, it's even still *used*. I don't understand that part.
Also, you used RCU primitives for the new list, but you never actually used them - except in one place (in nl80211_stop_sched_scan) where it's actually not needed at all and the _rcu should be removed (since it holds the lock)
What's up with that?
johannes
Johannes Berg
maintainerRe: [PATCH V2 02/10] nl80211: allow multiple active scheduled scan requests
Quoted 14 lines · Johannes Berg
Hi Arend,
Overall this looks good, and I've almost applied it - but I have a question on this patch.
You have this list:
Quoted 2 lines
net/wireless/core.h +1
-0+struct list_head sched_scan_req_list;struct
cfg80211_sched_scan_request__rcu*sched_scan_req;but you kept this. In fact, it's even still *used*. I don't understand
that part.
Quoted 8 lines
Also, you used RCU primitives for the new list, but you never actually
used them - except in one place (innl80211_stop_sched_scan) where it's
actually not needed at all and the_rcushould be removed (since it holds the lock)What's up with that?
Actually, I think I see what's up - you simply forgot to remove the sched_scan_req member, and then didn't realize that it was still used in nl80211_netlink_notify(), and that's the place that *does* need the RCU stuff.
johannes
Johannes Berg
maintainerRe: [PATCH V2 01/10] nl80211: add request id in scheduled scan event messages
In reply to Arend van SprielQuoted 5 lines · Arend van Spriel
For multi-scheduled scan support in subsequent patch a request id will be added. This patch add this request id to the scheduled scan event messages. For now the request id will always be zero. With multi-scheduled scan its value will inform user-space to which scan the event relates.
I've applied this, but please resend all of the remaining ones, even if only patch 2 changes.
johannes
Arend van Spriel
maintainerRe: [PATCH V2 02/10] nl80211: allow multiple active scheduled scan requests
In reply to Johannes BergQuoted 22 lines · Johannes Berg
Quoted 21 lines · Johannes Berg
Hi Arend,
Overall this looks good, and I've almost applied it - but I have a question on this patch.
You have this list:
net/wireless/core.h struct cfg80211_registered_device { · line 78
Quoted 2 lines
net/wireless/core.h +1
-0+struct list_head sched_scan_req_list;struct cfg80211_sched_scan_request __rcu *sched_scan_req;but you kept this. In fact, it's even still *used*. I don't understand
that part.Also, you used RCU primitives for the new list, but you never actually
used them - except in one place (innl80211_stop_sched_scan) where it's
actually not needed at all and the_rcushould be removed (since it holds the lock)
Quoted 6 lines
Quoted 1 line
What's up with that?
Actually, I think I see what's up - you simply forgot to remove the
sched_scan_reqmember, and then didn't realize that it was still used innl80211_netlink_notify(), and that's the place that *does* need the RCU stuff.
Yes. Sorry for screwing it up. Will rebase the series and fix it.
Regards,
Arend