Skip to contentSkip to conversation

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

RFC New Karthikeyan Periyasamy 1 participant 3 messages Jul 10, 2018 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

v2 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

v2:
* Solved kbuild test warning

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 v2 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 v2 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

---

v2:
* Solved kbuild test warning

 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