Skip to contentSkip to conversation

ath10k: Add QCA vendor command/attr support to filter neighbor BSS frames

RFC Superseded Karthikeyan Periyasamy 3 participants 10 messages Jul 5, 2018 – Feb 15, 2019 1 message not in the archive Qualcomm Atheros ATH10K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ath10k: Add QCA vendor command/attr support to filter neighbor BSS frames

Allow AP to receive neighbor BSSs frames and user-space can get the statistics of the stations associated with neighbor BSSs.

User-space can use QCA_NL80211_VENDOR_SUBCMD_BSS_FILTER command to configure RX filter to receive frames from stations that are active on the operating channel, but not associated with the local device (e.g., STAs associated with neighbor APs). Filtering is done based on a list of BSSIDs and STA MAC addresses added by the user. This command is also used to fetch statistics of unassociated stations. The attributes used with this command are defined in enum qca_wlan_vendor_attr_bss_filter.

User can add/delete the filter by specifying the BSSID/STA MAC address in QCA_WLAN_VENDOR_ATTR_BSS_FILTER_MAC_ADDR, filter type as BSSID/STA in QCA_WLAN_VENDOR_ATTR_BSS_FILTER_TYPE and add/delete action in QCA_WLAN_VENDOR_ATTR_BSS_FILTER_ACTION using the QCA vendor command QCA_NL80211_VENDOR_SUBCMD_BSS_FILTER.

User can get the statistics of an unassociated station by specifying the MAC address in QCA_WLAN_VENDOR_ATTR_BSS_FILTER_MAC_ADDR, station type in QCA_WLAN_VENDOR_ATTR_BSS_FILTER_TYPE, GET action in QCA_WLAN_VENDOR_ATTR_BSS_FILTER_ACTION using the QCA vendor command QCA_NL80211_VENDOR_SUBCMD_BSS_FILTER. User can also get the statistics of all unassociated stations by specifying the Broadcast MAC address (ff:ff:ff:ff:ff:ff) in QCA_WLAN_VENDOR_ATTR_BSS_FILTER_MAC_ADDR with above procedure. In response, ath10k driver specify statistics information nested in QCA_WLAN_VENDOR_ATTR_BSS_FILTER_STA_STATS.

NOTE: Tested with debug firmware

Karthikeyan Periyasamy (2):
ath10k: add wmi interface for vdev_set_neighbor_rx_param
ath10k: Add QCA vendor command/attr support to filter neighbor BSS
frames

 drivers/net/wireless/ath/ath10k/Makefile  |   3 +-
 drivers/net/wireless/ath/ath10k/core.h    |   3 +
 drivers/net/wireless/ath/ath10k/htt_rx.c  |   5 +
 drivers/net/wireless/ath/ath10k/mac.c     |  15 +-
 drivers/net/wireless/ath/ath10k/vendor.c  | 770 ++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/vendor.h  | 289 +++++++++++
 drivers/net/wireless/ath/ath10k/wmi-ops.h |  28 +-
 drivers/net/wireless/ath/ath10k/wmi.c     |  33 ++
 drivers/net/wireless/ath/ath10k/wmi.h     |  76 +++
 9 files changed, 1219 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/vendor.c
 create mode 100644 drivers/net/wireless/ath/ath10k/vendor.h
Signature · 1 line
1.9.1
#1 lore raw

RFC 1/2 ath10k: add wmi interface for vdev_set_neighbor_rx_param

Add WMI command interface support for receiving neighbor BSS frames from the target. QCA9984, QCA4019 and QCA9888 support this WMI command with the capability advertisement through wmi service map.

Hardware tested: QCA9984, QCA4019 and QCA9888
Firmware tested: 10.4-3.6-xxxxx

NOTE: Tested with debug firmware

---
 drivers/net/wireless/ath/ath10k/wmi-ops.h | 28 +++++++++++-
 drivers/net/wireless/ath/ath10k/wmi.c     | 33 ++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h     | 76 +++++++++++++++++++++++++++++++
 3 files changed, 136 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/wmi-ops.h +27 -1
index 5ecce04..8444b41 100644
@@ -214,7 +214,12 @@ struct wmi_ops {
 	struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value);
 	struct sk_buff *(*gen_pdev_get_tpc_table_cmdid)(struct ath10k *ar,
 							u32 param);
-
+	struct sk_buff *(*gen_vdev_set_neighbor_rx_param)(struct ath10k *ar,
+							  u32 vdev_id,
+							  const u8 *addr,
+							  u32 idx,
+							  u32 action,
+							  u32 type);
 };
 
 int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
@@ -1543,4 +1548,25 @@ struct wmi_ops {
 				   ar->wmi.cmd->radar_found_cmdid);
 }
 
+static inline int
+ath10k_wmi_set_neighbor_rx_param(struct ath10k *ar, u32 vdev_id,
+				 const u8 *addr, u32 idx,
+				 u32 action, u32 type)
+{
+	struct sk_buff *skb;
+	u32 cmdid;
+
+	if (!ar->wmi.ops->gen_vdev_set_neighbor_rx_param)
+		return -EOPNOTSUPP;
+
+	cmdid = ar->wmi.cmd->vdev_filter_neighbor_rx_packets_cmdid;
+	skb = ar->wmi.ops->gen_vdev_set_neighbor_rx_param(ar,
+							  vdev_id, addr,
+							  idx, action, type);
+
+	if (IS_ERR(skb))
+		return PTR_ERR(skb);
+
+	return ath10k_wmi_cmd_send(ar, skb, cmdid);
+}
 #endif
drivers/net/wireless/ath/ath10k/wmi.c +33 -0
index 877249a..fe62489 100644
@@ -8662,6 +8662,37 @@ static u32 ath10k_wmi_prepare_peer_qos(u8 uapsd_queues, u8 sp)
 	return 0;
 }
 
+static struct sk_buff *
+ath10k_wmi_10_4_op_gen_vdev_set_neighbor_rx_param(struct ath10k *ar,
+						  u32 vdev_id,
+						  const u8 *addr,
+						  u32 idx, u32 action,
+						  u32 type)
+{
+	struct wmi_set_vdev_filter_nrp_10_4_cmd *cmd;
+	struct sk_buff *skb;
+
+	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+	if (!skb)
+		return ERR_PTR(-ENOMEM);
+
+	cmd = (struct wmi_set_vdev_filter_nrp_10_4_cmd *)skb->data;
+
+	cmd->vdev_id = __cpu_to_le32(vdev_id);
+	cmd->action = __cpu_to_le32(action);
+	cmd->type = __cpu_to_le32(type);
+	cmd->idx = __cpu_to_le32(idx);
+
+	ether_addr_copy(cmd->macaddr.addr, addr);
+
+	ath10k_dbg(ar, ATH10K_DBG_WMI,
+		   "vdev id:0x%x Macaddr[0x%x]:[0x%x] idx:0x%x action:0x%x type:0x%x flag:0x%x\n",
+		   cmd->vdev_id, cmd->macaddr.addr[0], cmd->macaddr.addr[5],
+		   cmd->idx, cmd->action, cmd->type, cmd->flag);
+
+	return skb;
+}
+
 static const struct wmi_ops wmi_ops = {
 	.rx = ath10k_wmi_op_rx,
 	.map_svc = wmi_main_svc_map,
@@ -9014,6 +9045,8 @@ static u32 ath10k_wmi_prepare_peer_qos(u8 uapsd_queues, u8 sp)
 	.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
 	.gen_echo = ath10k_wmi_op_gen_echo,
 	.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
+	.gen_vdev_set_neighbor_rx_param =
+		ath10k_wmi_10_4_op_gen_vdev_set_neighbor_rx_param,
 };
 
 int ath10k_wmi_attach(struct ath10k *ar)
drivers/net/wireless/ath/ath10k/wmi.h +76 -0

106 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

RFC 2/2 ath10k: Add QCA vendor command/attr support to filter neighbor BSS frames

In reply to Karthikeyan Periyasamy

Add operations to allow an AP to capture frames from stations that are active on the operating channel, but not associated to the current AP. Operations include add/delete the filter and get the statistics information of the unassociated stations.

User can able to add/delete two type of filters,
1. BSSID
2. STA MAC address

BSSID filter achieved by HW through vdev_set_neighbor_rx_param WMI command. Local device able to capture all frames of the specified BSS using the above WMI command. STA filter achieved by SW through RX addr2 matching with unassociated station rhash table list keyed by MAC address. rhash table used for efficient search. rhash table can grow/shrink by the add/delete STA filter request.

Hardware tested: QCA9984, QCA4019 and QCA9888
Firmware tested: 10.4-3.6-xxxxx

NOTE: Tested with debug firmware

---
 drivers/net/wireless/ath/ath10k/Makefile |   3 +-
 drivers/net/wireless/ath/ath10k/core.h   |   3 +
 drivers/net/wireless/ath/ath10k/htt_rx.c |   5 +
 drivers/net/wireless/ath/ath10k/mac.c    |  15 +-
 drivers/net/wireless/ath/ath10k/vendor.c | 770 +++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/vendor.h | 289 ++++++++++++
 6 files changed, 1083 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/vendor.c
 create mode 100644 drivers/net/wireless/ath/ath10k/vendor.h
drivers/net/wireless/ath/ath10k/Makefile +2 -1
index 44d60a6..65d824d 100644
@@ -13,7 +13,8 @@ ath10k_core-y += mac.o \
 		 bmi.o \
 		 hw.o \
 		 p2p.o \
-		 swap.o
+		 swap.o \
+		 vendor.o
 
 ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += spectral.o
 ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
drivers/net/wireless/ath/ath10k/core.h +3 -0
index 427ee57..a723028 100644
@@ -38,6 +38,7 @@
 #include "thermal.h"
 #include "wow.h"
 #include "swap.h"
+#include "vendor.h"
 
 #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)
 #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
@@ -1132,6 +1133,8 @@ struct ath10k {
 	struct ath10k_radar_found_info last_radar_info;
 	struct work_struct radar_confirmation_work;
 
+	struct ath10k_vendor vendor;
+
 	/* must be last */
 	u8 drv_priv[0] __aligned(sizeof(void *));
 };
drivers/net/wireless/ath/ath10k/htt_rx.c +5 -0
index 4d1cd90..e30ffad 100644
@@ -23,6 +23,7 @@
 #include "debug.h"
 #include "trace.h"
 #include "mac.h"
+#include "vendor.h"
 
 #include <linux/log2.h>
 #include <linux/bitfield.h>
@@ -1773,6 +1774,10 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
 		return false;
 	}
 
+	/* Do the Neighbor BSSID filter if configured */
+	if (ath10k_vendor_rx_h_bssid_filter(&ar->vendor, amsdu, rx_status))
+		return false;
+
 	return true;
 }
 
drivers/net/wireless/ath/ath10k/mac.c +14 -1
index 95243b4..05c8c4f 100644
@@ -5313,6 +5313,8 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	ath10k_vendor_bss_filter_cleanup(arvif);
+
 	spin_lock_bh(&ar->data_lock);
 	ath10k_mac_vif_beacon_cleanup(arvif);
 	spin_unlock_bh(&ar->data_lock);
@@ -8518,10 +8520,16 @@ int ath10k_mac_register(struct ath10k *ar)
 
 	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
 
+	ret = ath10k_vendor_register(ar);
+	if (ret) {
+		ath10k_err(ar, "failed to register vendor: %d\n", ret);
+		goto err_dfs_detector_exit;
+	}
+
 	ret = ieee80211_register_hw(ar->hw);
 	if (ret) {
 		ath10k_err(ar, "failed to register ieee80211: %d\n", ret);
-		goto err_dfs_detector_exit;
+		goto err_vendor_unregister;
 	}
 
 	if (!ath_is_world_regd(&ar->ath_common.regulatory)) {
@@ -8536,6 +8544,9 @@ int ath10k_mac_register(struct ath10k *ar)
 err_unregister:
 	ieee80211_unregister_hw(ar->hw);
 
+err_vendor_unregister:
+	ath10k_vendor_unregister(ar);
+
 err_dfs_detector_exit:
 	if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector)
 		ar->dfs_detector->exit(ar->dfs_detector);
@@ -8552,6 +8563,8 @@ void ath10k_mac_unregister(struct ath10k *ar)
 {
 	ieee80211_unregister_hw(ar->hw);
 
+	ath10k_vendor_unregister(ar);
+
 	if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector)
 		ar->dfs_detector->exit(ar->dfs_detector);
 
drivers/net/wireless/ath/ath10k/vendor.c new file +770 -0

770 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/vendor.h new file +289 -0

289 lines not on this page · raw message

Signature · 1 line
1.9.1
#3 lore raw

Re: [RFC 2/2] ath10k: Add QCA vendor command/attr support to filterneighbor BSS frames

Quoted 16 lines · Karthikeyan Periyasamy

Add operations to allow an AP to capture frames from stations that are active on the operating channel, but not associated to the current AP. Operations include add/delete the filter and get the statistics information of the unassociated stations.

User can able to add/delete two type of filters,
1. BSSID
2. STA MAC address

BSSID filter achieved by HW through vdev_set_neighbor_rx_param WMI command. Local device able to capture all frames of the specified BSS using the above WMI command. STA filter achieved by SW through RX addr2 matching with unassociated station rhash table list keyed by MAC address. rhash table used for efficient search. rhash table can grow/shrink by the add/delete STA filter request.

Quoted 6 lines

Hardware tested: QCA9984, QCA4019 and QCA9888
Firmware tested: 10.4-3.6-xxxxx

NOTE: Tested with debug firmware

So I'm not sure what to do with this. A bpf type of filtering system in mac80211 would be nice but then again we cannot benefit from HW offloading. Johannes, what do you think?

Here are the full patches:

https://patchwork.kernel.org/patch/10508821/

https://patchwork.kernel.org/patch/10508823/

Signature · 3 lines
https://patchwork.kernel.org/patch/10508823/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#4 lore raw

Re: [RFC 2/2] ath10k: Add QCA vendor command/attr support to filterneighbor BSS frames

In reply to Karthikeyan Periyasamy
Quoted 16 lines · Karthikeyan Periyasamy

Add operations to allow an AP to capture frames from stations that are active on the operating channel, but not associated to the current AP. Operations include add/delete the filter and get the statistics information of the unassociated stations.

User can able to add/delete two type of filters,
1. BSSID
2. STA MAC address

BSSID filter achieved by HW through vdev_set_neighbor_rx_param WMI command. Local device able to capture all frames of the specified BSS using the above WMI command. STA filter achieved by SW through RX addr2 matching with unassociated station rhash table list keyed by MAC address. rhash table used for efficient search. rhash table can grow/shrink by the add/delete STA filter request.

Quoted 6 lines

Hardware tested: QCA9984, QCA4019 and QCA9888
Firmware tested: 10.4-3.6-xxxxx

NOTE: Tested with debug firmware

So I'm not sure what to do with this. A bpf type of filtering system in mac80211 would be nice but then again we cannot benefit from HW offloading. Johannes, what do you think?

Here are the full patches:

https://patchwork.kernel.org/patch/10508821/

https://patchwork.kernel.org/patch/10508823/

Signature · 9 lines
https://patchwork.kernel.org/patch/10508823/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [RFC 2/2] ath10k: Add QCA vendor command/attr support to filterneighbor BSS frames

Quoted 3 lines · Kalle Valo

So I'm not sure what to do with this. A bpf type of filtering system in mac80211 would be nice

Yes, I think we really need to start implementing that sooner rather than later. I had something, must see if I can find time for it.

Quoted 1 line

but then again we cannot benefit from HW offloading.

Yes, that's a concern. But how big of a concern is it really?

This patch only talks about "allow an AP" etc. and so while important, power isn't the _utmost_ concern like on mobile. Given an efficient filtering solution in software, would that be sufficient?

johannes

#7 lore raw

Re: [RFC 2/2] ath10k: Add QCA vendor command/attr support to filterneighbor BSS frames

Quoted 6 lines · Johannes Berg
Quoted 2 lines

So I'm not sure what to do with this. A bpf type of filtering system in mac80211 would be nice

Yes, I think we really need to start implementing that sooner rather than later. I had something, must see if I can find time for it.

Quoted 7 lines
Quoted 1 line

but then again we cannot benefit from HW offloading.

Yes, that's a concern. But how big of a concern is it really?

This patch only talks about "allow an AP" etc. and so while important, power isn't the _utmost_ concern like on mobile. Given an efficient filtering solution in software, would that be sufficient?

Assume in a scenario where there are multiple APs (One Center AP and Multiple repeater AP) in same operating channel. Clients present in Neighbor APs causing higher traffic.

when we try to filter desire client packets,
In HW offload case, all Neighbor BSS packets are filtered by HW. so there is no impact in CPU load. AP performance not get impacted. In bpf (enabling monitor mode) case, all Neighbor BSS packets get filtered by software. It will consume CPU load which will impact AP performance.

Irrespective of how many neighbor APs present in the topology, HW offload take care of neighbor BSS filtering. Hence no impact in CPU load. so we decided to use HW offload. To use our HW offload feature, we ended up in vendor command approach.

Karthikeyan

#8 lore raw

Re: [RFC 2/2] ath10k: Add QCA vendor command/attr support to filterneighbor BSS frames

Quoted 15 lines · Karthikeyan Periyasamy
Quoted 3 lines

This patch only talks about "allow an AP" etc. and so while important, power isn't the _utmost_ concern like on mobile. Given an efficient filtering solution in software, would that be sufficient?

Assume in a scenario where there are multiple APs (One Center AP and Multiple repeater AP) in same operating channel.
Clients present in Neighbor APs causing higher traffic.

when we try to filter desire client packets,
In HW offload case, all Neighbor BSS packets are filtered by HW. so there is no impact in CPU load. AP performance not get impacted. In bpf (enabling monitor mode) case, all Neighbor BSS packets get filtered by software. It will consume CPU load which will impact AP performance.

Quoted 5 lines

Irrespective of how many neighbor APs present in the topology, HW offload take care of neighbor BSS filtering. Hence no impact in CPU load.
so we decided to use HW offload. To use our HW offload feature, we ended up in vendor command approach.

Sure. I guess my question was intended more along the lines of "how much CPU impact would you be able to live with?" :-)

At the same time, what happens today actually? Do all frames from non- associated clients come up to the host? If so, is this not a problem for all APs, not just ath10k?

And if they don't come up, what feature requires this? Sorry for the vague questions, but I'm not really sure what this is all about. If there's a need for these frames, wouldn't we need a generic way of enabling receiving them, and perhaps even signalling hostapd with them?

Also, what are the statistics and what do you intend to use them for?

johannes

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

#9 lore raw

Re: [RFC 2/2] ath10k: Add QCA vendor command/attr support to filterneighbor BSS frames

Quoted 3 lines · Johannes Berg

Sure. I guess my question was intended more along the lines of "how much CPU impact would you be able to live with?" :-)

As much as no CPU impact.

Quoted 4 lines

At the same time, what happens today actually? Do all frames from non- associated clients come up to the host? If so, is this not a problem for all APs, not just ath10k?

Today, without this patch. No frames from non-associated clients come up to the host in AP mode.

Quoted 4 lines

And if they don't come up, what feature requires this? Sorry for the vague questions, but I'm not really sure what this is all about. If there's a need for these frames, wouldn't we need a generic way of enabling receiving them, and perhaps even signalling hostapd with them?

Steering application use this feature in their logical part of client steering.

This feature allow an application to configure filtering rules to capture from stations that are active on the operating channel but not associated to this AP. It also allow to get the statistics information of the configured non associated stations.

Ath10k driver use HW filter to capture other BSS frames and drop these packets after collecting statistics information of configured non associated stations.

QCA vendor command/attr details:
https://w1.fi/cgit/hostap/commit/?id=6b21df0bb7a261ef890a02d1fef95ffa5ff54cfc

Quoted 1 line

Also, what are the statistics and what do you intend to use them for?

In this patch, we are providing the below information as a statistics of non associated stations.

- MAC address
- Last received signal strength
- Time stamp of the last received signal strength

Thanks,
Karthikeyan

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

#10 lore raw

Re: [RFC 2/2] ath10k: Add QCA vendor command/attr support to filterneighbor BSS frames

Quoted 6 lines · Karthikeyan Periyasamy
Quoted 3 lines

At the same time, what happens today actually? Do all frames from non- associated clients come up to the host? If so, is this not a problem for all APs, not just ath10k?

Today, without this patch. No frames from non-associated clients come up to the host in AP mode.

So it's not just _filtering_ but also enabling to see them, right?

Quoted 7 lines
Quoted 4 lines

And if they don't come up, what feature requires this? Sorry for the vague questions, but I'm not really sure what this is all about. If there's a need for these frames, wouldn't we need a generic way of enabling receiving them, and perhaps even signalling hostapd with them?

Steering application use this feature in their logical part of client steering.

But there aren't even any steering applications that are open source or anything like that, right?

I don't see why we should include this upstream. Clearly you can use this for whatever you like to do with your driver in non-upstream builds, and you can open-source this code, but if there are no applications that could possibly use it upstream why bother?

johannes