ath11k: add full monitor mode support for QCN9074
v2 cover ath11k: add full monitor mode support for QCN9074
QCN9074 HW supports full monitor mode. The advantage with full monitor mode is HW has status buffers available for all the MPDUs in mon_dst_ring.
HTT_H2T_MSG_TYPE_RX_FULL_MONITOR_MODE cmd is sent to FW to enable the full monitor mode.
A new hw_param full_monitor_mode is added to enable full monitor support for QCN9074.
In full monitor mode, monitor destination ring is read in software monitor ring descriptor format instead of reo_entrance_ring format. Add new sw_mon_ring descriptor.
In full monitor mode, monitor destination ring is read before monitor status ring. mon_dst_ring has ppdu id, reap till the end of ppdu. Add all the MPDUs to a list. Start processing the status ring, if PPDU id in status ring is lagging behind, reap the status ring, once the PPDU ID matches, deliver the msdu to upper layer. If status PPDU id leading, reap the mon_dst_ring.
Anilkumar Kolli (3):
ath11k: Add htt cmd to enable full monitor mode
ath11k: add software monitor ring descriptor for full monitor
ath11k: Process full monitor mode rx support
---
V2:
- Rebased on ToT
- Update commit log (kalle)
- Tested on qca6390
drivers/net/wireless/ath/ath11k/core.c | 5 + drivers/net/wireless/ath/ath11k/dp.c | 1 + drivers/net/wireless/ath/ath11k/dp.h | 54 +++- drivers/net/wireless/ath/ath11k/dp_rx.c | 409 ++++++++++++++++++++++++++++- drivers/net/wireless/ath/ath11k/dp_tx.c | 48 ++++ drivers/net/wireless/ath/ath11k/dp_tx.h | 2 + drivers/net/wireless/ath/ath11k/hal_desc.h | 19 ++ drivers/net/wireless/ath/ath11k/hal_rx.c | 44 ++++ drivers/net/wireless/ath/ath11k/hal_rx.h | 17 ++ drivers/net/wireless/ath/ath11k/hw.h | 1 + 10 files changed, 597 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/3 ath11k: Add htt cmd to enable full monitor mode
A new hw_param full_monitor_mode is added to enable full monitor support for QCN9074. HTT_H2T_MSG_TYPE_RX_FULL_MONITOR_MODE cmd is sent to FW to enable the full monitor mode.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1
---
V2:
- Rebase on latest ath.git
drivers/net/wireless/ath/ath11k/core.c | 5 ++++ drivers/net/wireless/ath/ath11k/dp.h | 28 +++++++++++++++++++ drivers/net/wireless/ath/ath11k/dp_tx.c | 48 +++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/dp_tx.h | 2 ++ drivers/net/wireless/ath/ath11k/hw.h | 1 + 5 files changed, 84 insertions(+)
drivers/net/wireless/ath/ath11k/core.c +5 -0
@@ -74,6 +74,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {BIT (NL80211_IFTYPE_AP ) | BIT(NL80211_IFTYPE_MESH_POINT), .supports_monitor = true, + .full_monitor_mode = false, .supports_shadow_regs = false, .idle_ps = false, .supports_sta_ps = false,
@@ -128,6 +129,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {BIT (NL80211_IFTYPE_AP ) | BIT(NL80211_IFTYPE_MESH_POINT), .supports_monitor = true, + .full_monitor_mode = false, .supports_shadow_regs = false, .idle_ps = false, .supports_sta_ps = false,
@@ -181,6 +183,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP), .supports_monitor = false, + .full_monitor_mode = false, .supports_shadow_regs = true, .idle_ps = true, .supports_sta_ps = true,
@@ -234,6 +237,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {BIT (NL80211_IFTYPE_AP ) | BIT(NL80211_IFTYPE_MESH_POINT), .supports_monitor = true, + .full_monitor_mode = true, .supports_shadow_regs = false, .idle_ps = false, .supports_sta_ps = false,
@@ -287,6 +291,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP), .supports_monitor = false, + .full_monitor_mode = false, .supports_shadow_regs = true, .idle_ps = true, .supports_sta_ps = true,
drivers/net/wireless/ath/ath11k/dp.h +28 -0
@@ -292,6 +292,7 @@ enum htt_h2t_msg_type {HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG =0xc ,HTT_H2T_MSG_TYPE_EXT_STATS_CFG =0x10 ,HTT_H2T_MSG_TYPE_PPDU_STATS_CFG =0x11 , + HTT_H2T_MSG_TYPE_RX_FULL_MONITOR_MODE = 0x17, };#define HTT_VER_REQ_INFO_MSG_ID GENMASK(7, 0)
@@ -957,6 +958,33 @@ struct htt_rx_ring_tlv_filter {u32 pkt_filter_flags3;/* DATA */ }; +#define HTT_RX_FULL_MON_MODE_CFG_CMD_INFO0_MSG_TYPE GENMASK(7, 0) +#define HTT_RX_FULL_MON_MODE_CFG_CMD_INFO0_PDEV_ID GENMASK(15, 8) + +#define HTT_RX_FULL_MON_MODE_CFG_CMD_CFG_ENABLE BIT(0) +#define HTT_RX_FULL_MON_MODE_CFG_CMD_CFG_ZERO_MPDUS_END BIT(1) +#define HTT_RX_FULL_MON_MODE_CFG_CMD_CFG_NON_ZERO_MPDUS_END BIT(2) +#define HTT_RX_FULL_MON_MODE_CFG_CMD_CFG_RELEASE_RING GENMASK(10, 3) + +/** +* Enumeration for full monitor mode destination ring select +* 0 - REO destination ring select +* 1 - FW destination ring select +* 2 - SW destination ring select +* 3 - Release destination ring select +*/ +enum htt_rx_full_mon_release_ring { +HTT_RX_MON_RING_REO , +HTT_RX_MON_RING_FW , +HTT_RX_MON_RING_SW , +HTT_RX_MON_RING_RELEASE , +}; + +struct htt_rx_full_monitor_mode_cfg_cmd { +u32 info0; +u32 cfg; +} __packed; +/* HTT message target->host */ enum htt_t2h_msg_type {
drivers/net/wireless/ath/ath11k/dp_tx.c +48 -0
57 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/dp_tx.h +2 -0
@@ -37,4 +37,6 @@ int ath11k_dp_tx_htt_rx_filter_setup(struct ath11k_base *ab, u32 ring_id,int rx_buf_size, struct htt_rx_ring_tlv_filter *tlv_filter); +int ath11k_dp_tx_htt_rx_full_mon_setup (struct ath11k_base *ab,int mac_id, +bool config);#endif
drivers/net/wireless/ath/ath11k/hw.h +1 -0
@@ -168,6 +168,7 @@ struct ath11k_hw_params {u16 interface_modes;bool supports_monitor; +bool full_monitor_mode;bool supports_shadow_regs;bool idle_ps;bool supports_sta_ps;
Signature · 1 line
2.7.4
PATCH v2 2/3 ath11k: add software monitor ring descriptor for full monitor
In reply to Anilkumar KolliIn full monitor mode, monitor destination ring is read in software monitor ring descriptor format instead of reo_entrance_ring format. Add new sw_mon_ring descriptor.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/hal_desc.h | 19 +++++++++++++ drivers/net/wireless/ath/ath11k/hal_rx.c | 44 ++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/hal_rx.h | 17 ++++++++++++ 3 files changed, 80 insertions(+)
drivers/net/wireless/ath/ath11k/hal_desc.h +19 -0
@@ -858,6 +858,25 @@ struct hal_reo_entrance_ring {* this ring has looped around the ring. */ +#define HAL_SW_MON_RING_INFO0_RXDMA_PUSH_REASON GENMASK(1, 0) +#define HAL_SW_MON_RING_INFO0_RXDMA_ERROR_CODE GENMASK(6, 2) +#define HAL_SW_MON_RING_INFO0_MPDU_FRAG_NUMBER GENMASK(10, 7) +#define HAL_SW_MON_RING_INFO0_FRAMELESS_BAR BIT(11) +#define HAL_SW_MON_RING_INFO0_STATUS_BUF_CNT GENMASK(15, 12) +#define HAL_SW_MON_RING_INFO0_END_OF_PPDU BIT(16) + +#define HAL_SW_MON_RING_INFO1_PHY_PPDU_ID GENMASK(15, 0) +#define HAL_SW_MON_RING_INFO1_RING_ID GENMASK(27, 20) +#define HAL_SW_MON_RING_INFO1_LOOPING_COUNT GENMASK(31, 28) + +struct hal_sw_monitor_ring { +struct ath11k_buffer_addr buf_addr_info; +struct rx_mpdu_desc rx_mpdu_info; +struct ath11k_buffer_addr status_buf_addr_info; +u32 info0; +u32 info1; +} __packed; +#define HAL_REO_CMD_HDR_INFO0_CMD_NUMBER GENMASK(15, 0)#define HAL_REO_CMD_HDR_INFO0_STATUS_REQUIRED BIT(16)
drivers/net/wireless/ath/ath11k/hal_rx.c +44 -0
47 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/hal_rx.h +17 -0
@@ -77,6 +77,20 @@ enum hal_rx_mon_status { HAL_RX_MON_STATUS_BUF_DONE, }; +struct hal_sw_mon_ring_entries { +dma_addr_t mon_dst_paddr; +dma_addr_t mon_status_paddr; +u32 mon_dst_sw_cookie; +u32 mon_status_sw_cookie; +void *dst_buf_addr_info; +void *status_buf_addr_info; +u16 ppdu_id; +u8 status_buf_count; +u8 msdu_cnt; +bool end_of_ppdu; +bool drop_ppdu; +}; +struct hal_rx_mon_ppdu_info {u32 ppdu_id;u32 ppdu_ts;
@@ -331,6 +345,9 @@ void ath11k_hal_rx_reo_ent_buf_paddr_get(void *rx_desc, dma_addr_t *paddr, u32 *sw_cookie, void **pp_buf_addr_info, u8 *rbm, u32 *msdu_cnt); +void +ath11k_hal_rx_sw_mon_ring_buf_paddr_get (void *rx_desc, +struct hal_sw_mon_ring_entries *sw_mon_ent); enum hal_rx_mon_status ath11k_hal_rx_parse_mon_status(struct ath11k_base *ab, struct hal_rx_mon_ppdu_info *ppdu_info,
Signature · 1 line
2.7.4
PATCH v2 3/3 ath11k: Process full monitor mode rx support
In reply to Anilkumar KolliIn full monitor mode, monitor destination ring is read before monitor status ring. mon_dst_ring has ppdu id, reap till the end of PPDU. Add all the MPDUs to list. Start processing the status ring, if PPDU id in status ring is lagging behind, reap the status ring, once the PPDU ID matches, deliver the MSDU to upper layer. If status PPDU id leading, reap the mon_dst_ring.
The advantage with full monitor mode is hardware has status buffers available for all the MPDUs in mon_dst_ring, which makes it possible to deliver more frames to be seen on sniffer.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1
---
V2:
- Update commit log (Kalle)
drivers/net/wireless/ath/ath11k/dp.c | 1 + drivers/net/wireless/ath/ath11k/dp.h | 26 +- drivers/net/wireless/ath/ath11k/dp_rx.c | 409 +++++++++++++++++++++++++++++++- 3 files changed, 433 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath11k/dp.c +1 -0
@@ -1051,6 +1051,7 @@ int ath11k_dp_alloc(struct ath11k_base *ab)INIT_LIST_HEAD (&dp->reo_cmd_list);INIT_LIST_HEAD (&dp->reo_cmd_cache_flush_list); +INIT_LIST_HEAD (&dp->dp_full_mon_mpdu_list);spin_lock_init (&dp->reo_cmd_lock); dp->reo_cmd_cache_flush_count =0 ;
drivers/net/wireless/ath/ath11k/dp.h +25 -1
@@ -89,6 +89,19 @@ struct dp_tx_ring {int tx_status_tail; }; +enum dp_mon_status_buf_state { +/* PPDU id matches in dst ring and status ring */ +DP_MON_STATUS_MATCH , +/* status ring dma is not done */ +DP_MON_STATUS_NO_DMA , +/* status ring is lagging, reap status ring */ +DP_MON_STATUS_LAG , +/* status ring is leading, reap dst ring and drop */ +DP_MON_STATUS_LEAD , +/* replinish monitor status ring */ +DP_MON_STATUS_REPLINISH , +}; +struct ath11k_pdev_mon_stats {u32 status_ppdu_state;u32 status_ppdu_start;
@@ -104,6 +117,12 @@ struct ath11k_pdev_mon_stats {u32 dup_mon_buf_cnt; }; +struct dp_full_mon_mpdu { +struct list_head list; +struct sk_buff *head; +struct sk_buff *tail; +}; +struct dp_link_desc_bank {void *vaddr_unaligned;void *vaddr;
@@ -135,7 +154,11 @@ struct ath11k_mon_data {u32 mon_last_buf_cookie;u64 mon_last_linkdesc_paddr;u16 chan_noise_floor; - +bool hold_mon_dst_ring; +enum dp_mon_status_buf_state buf_state; +dma_addr_t mon_status_paddr; +struct dp_full_mon_mpdu *mon_mpdu; +struct hal_sw_mon_ring_entries sw_mon_entries;struct ath11k_pdev_mon_stats rx_mon_stats;/* lock for monitor data */ spinlock_t mon_lock;
@@ -245,6 +268,7 @@ struct ath11k_dp {struct hal_wbm_idle_scatter_list scatter_list[DP_IDLE_SCATTER_BUFS_MAX ];struct list_head reo_cmd_list;struct list_head reo_cmd_cache_flush_list; +struct list_head dp_full_mon_mpdu_list;u32 reo_cmd_cache_flush_count;/** * protects access to below fields,
drivers/net/wireless/ath/ath11k/dp_rx.c +407 -2
465 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 1/3] ath11k: Add htt cmd to enable full monitor mode
In reply to Anilkumar KolliQuoted 9 lines · Anilkumar Kolli
A new
hw_paramfull_monitor_modeis added to enable full monitor support for QCN9074.HTT_H2T_MSG_TYPE_RX_FULL_MONITOR_MODEcmd is sent to FW to enable the full monitor mode.Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1
Signed-off-by Anilkumar Kolli <[email protected]>Signed-off-by Kalle Valo <[email protected]>
3 patches applied to ath-next branch of ath.git, thanks.
5c1f74d24d92 ath11k: Add htt cmd to enable full monitor mode 88ee00d130f7 ath11k: add software monitor ring descriptor for full monitor 7e2ea2e94704 ath11k: Process full monitor mode rx support
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches