Commit 1eeafd64 authored by Karthikeyan Periyasamy's avatar Karthikeyan Periyasamy Committed by Kalle Valo

wifi: ath12k: fix peer metadata parsing

Currently, the Rx data path only supports parsing peer metadata of version
zero. However, the QCN9274 platform configures the peer metadata version
as V1B. When V1B peer metadata is parsed using the version zero logic,
invalid data is populated, causing valid packets to be dropped. To address
this issue, refactor the peer metadata version and add the version based
parsing to populate the data from peer metadata correctly.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Fixes: 28703381 ("wifi: ath12k: add support for peer meta data version")
Signed-off-by: default avatarKarthikeyan Periyasamy <quic_periyasa@quicinc.com>
Acked-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20240624145418.2043461-1-quic_periyasa@quicinc.com
parent 2c785767
...@@ -333,6 +333,7 @@ struct ath12k_dp { ...@@ -333,6 +333,7 @@ struct ath12k_dp {
struct dp_srng reo_except_ring; struct dp_srng reo_except_ring;
struct dp_srng reo_cmd_ring; struct dp_srng reo_cmd_ring;
struct dp_srng reo_status_ring; struct dp_srng reo_status_ring;
enum ath12k_peer_metadata_version peer_metadata_ver;
struct dp_srng reo_dst_ring[DP_REO_DST_RING_MAX]; struct dp_srng reo_dst_ring[DP_REO_DST_RING_MAX];
struct dp_tx_ring tx_ring[DP_TCL_NUM_RING_MAX]; struct dp_tx_ring tx_ring[DP_TCL_NUM_RING_MAX];
struct hal_wbm_idle_scatter_list scatter_list[DP_IDLE_SCATTER_BUFS_MAX]; struct hal_wbm_idle_scatter_list scatter_list[DP_IDLE_SCATTER_BUFS_MAX];
......
...@@ -2583,6 +2583,29 @@ static void ath12k_dp_rx_process_received_packets(struct ath12k_base *ab, ...@@ -2583,6 +2583,29 @@ static void ath12k_dp_rx_process_received_packets(struct ath12k_base *ab,
rcu_read_unlock(); rcu_read_unlock();
} }
static u16 ath12k_dp_rx_get_peer_id(struct ath12k_base *ab,
enum ath12k_peer_metadata_version ver,
__le32 peer_metadata)
{
switch (ver) {
default:
ath12k_warn(ab, "Unknown peer metadata version: %d", ver);
fallthrough;
case ATH12K_PEER_METADATA_V0:
return le32_get_bits(peer_metadata,
RX_MPDU_DESC_META_DATA_V0_PEER_ID);
case ATH12K_PEER_METADATA_V1:
return le32_get_bits(peer_metadata,
RX_MPDU_DESC_META_DATA_V1_PEER_ID);
case ATH12K_PEER_METADATA_V1A:
return le32_get_bits(peer_metadata,
RX_MPDU_DESC_META_DATA_V1A_PEER_ID);
case ATH12K_PEER_METADATA_V1B:
return le32_get_bits(peer_metadata,
RX_MPDU_DESC_META_DATA_V1B_PEER_ID);
}
}
int ath12k_dp_rx_process(struct ath12k_base *ab, int ring_id, int ath12k_dp_rx_process(struct ath12k_base *ab, int ring_id,
struct napi_struct *napi, int budget) struct napi_struct *napi, int budget)
{ {
...@@ -2611,6 +2634,8 @@ int ath12k_dp_rx_process(struct ath12k_base *ab, int ring_id, ...@@ -2611,6 +2634,8 @@ int ath12k_dp_rx_process(struct ath12k_base *ab, int ring_id,
ath12k_hal_srng_access_begin(ab, srng); ath12k_hal_srng_access_begin(ab, srng);
while ((desc = ath12k_hal_srng_dst_get_next_entry(ab, srng))) { while ((desc = ath12k_hal_srng_dst_get_next_entry(ab, srng))) {
struct rx_mpdu_desc *mpdu_info;
struct rx_msdu_desc *msdu_info;
enum hal_reo_dest_ring_push_reason push_reason; enum hal_reo_dest_ring_push_reason push_reason;
u32 cookie; u32 cookie;
...@@ -2658,16 +2683,19 @@ int ath12k_dp_rx_process(struct ath12k_base *ab, int ring_id, ...@@ -2658,16 +2683,19 @@ int ath12k_dp_rx_process(struct ath12k_base *ab, int ring_id,
continue; continue;
} }
rxcb->is_first_msdu = !!(le32_to_cpu(desc->rx_msdu_info.info0) & msdu_info = &desc->rx_msdu_info;
mpdu_info = &desc->rx_mpdu_info;
rxcb->is_first_msdu = !!(le32_to_cpu(msdu_info->info0) &
RX_MSDU_DESC_INFO0_FIRST_MSDU_IN_MPDU); RX_MSDU_DESC_INFO0_FIRST_MSDU_IN_MPDU);
rxcb->is_last_msdu = !!(le32_to_cpu(desc->rx_msdu_info.info0) & rxcb->is_last_msdu = !!(le32_to_cpu(msdu_info->info0) &
RX_MSDU_DESC_INFO0_LAST_MSDU_IN_MPDU); RX_MSDU_DESC_INFO0_LAST_MSDU_IN_MPDU);
rxcb->is_continuation = !!(le32_to_cpu(desc->rx_msdu_info.info0) & rxcb->is_continuation = !!(le32_to_cpu(msdu_info->info0) &
RX_MSDU_DESC_INFO0_MSDU_CONTINUATION); RX_MSDU_DESC_INFO0_MSDU_CONTINUATION);
rxcb->mac_id = mac_id; rxcb->mac_id = mac_id;
rxcb->peer_id = le32_get_bits(desc->rx_mpdu_info.peer_meta_data, rxcb->peer_id = ath12k_dp_rx_get_peer_id(ab, dp->peer_metadata_ver,
RX_MPDU_DESC_META_DATA_PEER_ID); mpdu_info->peer_meta_data);
rxcb->tid = le32_get_bits(desc->rx_mpdu_info.info0, rxcb->tid = le32_get_bits(mpdu_info->info0,
RX_MPDU_DESC_INFO0_TID); RX_MPDU_DESC_INFO0_TID);
__skb_queue_tail(&msdu_list, msdu); __skb_queue_tail(&msdu_list, msdu);
......
...@@ -597,8 +597,30 @@ struct hal_tlv_64_hdr { ...@@ -597,8 +597,30 @@ struct hal_tlv_64_hdr {
#define RX_MPDU_DESC_INFO0_MPDU_QOS_CTRL_VALID BIT(27) #define RX_MPDU_DESC_INFO0_MPDU_QOS_CTRL_VALID BIT(27)
#define RX_MPDU_DESC_INFO0_TID GENMASK(31, 28) #define RX_MPDU_DESC_INFO0_TID GENMASK(31, 28)
/* TODO revisit after meta data is concluded */ /* Peer Metadata classification */
#define RX_MPDU_DESC_META_DATA_PEER_ID GENMASK(15, 0)
/* Version 0 */
#define RX_MPDU_DESC_META_DATA_V0_PEER_ID GENMASK(15, 0)
#define RX_MPDU_DESC_META_DATA_V0_VDEV_ID GENMASK(23, 16)
/* Version 1 */
#define RX_MPDU_DESC_META_DATA_V1_PEER_ID GENMASK(13, 0)
#define RX_MPDU_DESC_META_DATA_V1_LOGICAL_LINK_ID GENMASK(15, 14)
#define RX_MPDU_DESC_META_DATA_V1_VDEV_ID GENMASK(23, 16)
#define RX_MPDU_DESC_META_DATA_V1_LMAC_ID GENMASK(25, 24)
#define RX_MPDU_DESC_META_DATA_V1_DEVICE_ID GENMASK(28, 26)
/* Version 1A */
#define RX_MPDU_DESC_META_DATA_V1A_PEER_ID GENMASK(13, 0)
#define RX_MPDU_DESC_META_DATA_V1A_VDEV_ID GENMASK(21, 14)
#define RX_MPDU_DESC_META_DATA_V1A_LOGICAL_LINK_ID GENMASK(25, 22)
#define RX_MPDU_DESC_META_DATA_V1A_DEVICE_ID GENMASK(28, 26)
/* Version 1B */
#define RX_MPDU_DESC_META_DATA_V1B_PEER_ID GENMASK(13, 0)
#define RX_MPDU_DESC_META_DATA_V1B_VDEV_ID GENMASK(21, 14)
#define RX_MPDU_DESC_META_DATA_V1B_HW_LINK_ID GENMASK(25, 22)
#define RX_MPDU_DESC_META_DATA_V1B_DEVICE_ID GENMASK(28, 26)
struct rx_mpdu_desc { struct rx_mpdu_desc {
__le32 info0; /* %RX_MPDU_DESC_INFO */ __le32 info0; /* %RX_MPDU_DESC_INFO */
......
...@@ -78,8 +78,6 @@ ...@@ -78,8 +78,6 @@
#define TARGET_NUM_WDS_ENTRIES 32 #define TARGET_NUM_WDS_ENTRIES 32
#define TARGET_DMA_BURST_SIZE 1 #define TARGET_DMA_BURST_SIZE 1
#define TARGET_RX_BATCHMODE 1 #define TARGET_RX_BATCHMODE 1
#define TARGET_RX_PEER_METADATA_VER_V1A 2
#define TARGET_RX_PEER_METADATA_VER_V1B 3
#define TARGET_EMA_MAX_PROFILE_PERIOD 8 #define TARGET_EMA_MAX_PROFILE_PERIOD 8
#define ATH12K_HW_DEFAULT_QUEUE 0 #define ATH12K_HW_DEFAULT_QUEUE 0
......
...@@ -233,7 +233,7 @@ void ath12k_wmi_init_qcn9274(struct ath12k_base *ab, ...@@ -233,7 +233,7 @@ void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
config->beacon_tx_offload_max_vdev += config->ema_max_vap_cnt; config->beacon_tx_offload_max_vdev += config->ema_max_vap_cnt;
if (test_bit(WMI_TLV_SERVICE_PEER_METADATA_V1A_V1B_SUPPORT, ab->wmi_ab.svc_map)) if (test_bit(WMI_TLV_SERVICE_PEER_METADATA_V1A_V1B_SUPPORT, ab->wmi_ab.svc_map))
config->dp_peer_meta_data_ver = TARGET_RX_PEER_METADATA_VER_V1B; config->peer_metadata_ver = ATH12K_PEER_METADATA_V1B;
} }
void ath12k_wmi_init_wcn7850(struct ath12k_base *ab, void ath12k_wmi_init_wcn7850(struct ath12k_base *ab,
...@@ -3498,7 +3498,7 @@ ath12k_wmi_copy_resource_config(struct ath12k_wmi_resource_config_params *wmi_cf ...@@ -3498,7 +3498,7 @@ ath12k_wmi_copy_resource_config(struct ath12k_wmi_resource_config_params *wmi_cf
wmi_cfg->sched_params = cpu_to_le32(tg_cfg->sched_params); wmi_cfg->sched_params = cpu_to_le32(tg_cfg->sched_params);
wmi_cfg->twt_ap_pdev_count = cpu_to_le32(tg_cfg->twt_ap_pdev_count); wmi_cfg->twt_ap_pdev_count = cpu_to_le32(tg_cfg->twt_ap_pdev_count);
wmi_cfg->twt_ap_sta_count = cpu_to_le32(tg_cfg->twt_ap_sta_count); wmi_cfg->twt_ap_sta_count = cpu_to_le32(tg_cfg->twt_ap_sta_count);
wmi_cfg->flags2 = le32_encode_bits(tg_cfg->dp_peer_meta_data_ver, wmi_cfg->flags2 = le32_encode_bits(tg_cfg->peer_metadata_ver,
WMI_RSRC_CFG_FLAGS2_RX_PEER_METADATA_VERSION); WMI_RSRC_CFG_FLAGS2_RX_PEER_METADATA_VERSION);
wmi_cfg->host_service_flags = cpu_to_le32(tg_cfg->is_reg_cc_ext_event_supported << wmi_cfg->host_service_flags = cpu_to_le32(tg_cfg->is_reg_cc_ext_event_supported <<
WMI_RSRC_CFG_HOST_SVC_FLAG_REG_CC_EXT_SUPPORT_BIT); WMI_RSRC_CFG_HOST_SVC_FLAG_REG_CC_EXT_SUPPORT_BIT);
...@@ -3729,6 +3729,8 @@ int ath12k_wmi_cmd_init(struct ath12k_base *ab) ...@@ -3729,6 +3729,8 @@ int ath12k_wmi_cmd_init(struct ath12k_base *ab)
arg.num_band_to_mac = ab->num_radios; arg.num_band_to_mac = ab->num_radios;
ath12k_fill_band_to_mac_param(ab, arg.band_to_mac); ath12k_fill_band_to_mac_param(ab, arg.band_to_mac);
ab->dp.peer_metadata_ver = arg.res_cfg.peer_metadata_ver;
return ath12k_init_cmd_send(&wmi_ab->wmi[0], &arg); return ath12k_init_cmd_send(&wmi_ab->wmi[0], &arg);
} }
......
...@@ -2294,6 +2294,13 @@ struct ath12k_wmi_host_mem_chunk_arg { ...@@ -2294,6 +2294,13 @@ struct ath12k_wmi_host_mem_chunk_arg {
u32 req_id; u32 req_id;
}; };
enum ath12k_peer_metadata_version {
ATH12K_PEER_METADATA_V0,
ATH12K_PEER_METADATA_V1,
ATH12K_PEER_METADATA_V1A,
ATH12K_PEER_METADATA_V1B
};
struct ath12k_wmi_resource_config_arg { struct ath12k_wmi_resource_config_arg {
u32 num_vdevs; u32 num_vdevs;
u32 num_peers; u32 num_peers;
...@@ -2356,10 +2363,10 @@ struct ath12k_wmi_resource_config_arg { ...@@ -2356,10 +2363,10 @@ struct ath12k_wmi_resource_config_arg {
u32 sched_params; u32 sched_params;
u32 twt_ap_pdev_count; u32 twt_ap_pdev_count;
u32 twt_ap_sta_count; u32 twt_ap_sta_count;
bool is_reg_cc_ext_event_supported; enum ath12k_peer_metadata_version peer_metadata_ver;
u8 dp_peer_meta_data_ver;
u32 ema_max_vap_cnt; u32 ema_max_vap_cnt;
u32 ema_max_profile_period; u32 ema_max_profile_period;
bool is_reg_cc_ext_event_supported;
}; };
struct ath12k_wmi_init_cmd_arg { struct ath12k_wmi_init_cmd_arg {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment