From dbe1cf2b017a24e929a4d359091741bc124fcef2 Mon Sep 17 00:00:00 2001 From: Rakesh Pillai Date: Tue, 23 Aug 2022 06:21:26 -0700 Subject: [PATCH] qcacld-3.0: Validate fse metadata before aggregation of FISA flow When aggregation of a flow is in progress, there can be case when the HW flow table entry match may fail for few packets. Such packets, even though belong to a flow already present in flow table, are routed independently to any RX ring. When software checks this rx ring ID, from the independently routed packet and compares the ring ID against the one which is assigned for the flow, there will be a mismatch leading to unwanted behaviour. Hence, always validate the fse_metadata before taking any action on the basis of rx ring ID mismatch. The non-matching packets, with invalid fse metadata can be submitted to network stack independently. Change-Id: Ia95f20ef1050bc981b2d22571b612fd2af6f6a65 CRs-Fixed: 3272353 --- core/dp/txrx3.0/dp_fisa_rx.c | 24 +++++++++++++++++++++--- core/dp/txrx3.0/dp_rx_fst.c | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/core/dp/txrx3.0/dp_fisa_rx.c b/core/dp/txrx3.0/dp_fisa_rx.c index 3d199c26ef..021f34c1ae 100644 --- a/core/dp/txrx3.0/dp_fisa_rx.c +++ b/core/dp/txrx3.0/dp_fisa_rx.c @@ -1729,15 +1729,33 @@ static int dp_add_nbuf_to_fisa_flow(struct dp_rx_fst *fisa_hdl, fse_metadata = hal_rx_msdu_fse_metadata_get(hal_soc_hdl, rx_tlv_hdr); cce_match = hal_rx_msdu_cce_match_get(hal_soc_hdl, rx_tlv_hdr); - if (cce_match || (fisa_hdl->del_flow_count && - fse_metadata != fisa_flow->metadata)) { + /* + * For two cases the fse_metadata will not match the metadata + * from the fisa_flow_table entry + * 1) Flow has been evicted (lru deletion), and this packet is + * one of the few packets pending in the rx ring from the prev + * flow + * 2) HW flow table match fails for some packets in the + * currently active flow. + */ + if (cce_match) { dp_rx_fisa_release_ft_lock(fisa_hdl, napi_id); + DP_STATS_INC(fisa_hdl, reo_mismatch.allow_cce_match, + 1); + return FISA_AGGR_NOT_ELIGIBLE; + } + + if (fse_metadata != fisa_flow->metadata) { + dp_rx_fisa_release_ft_lock(fisa_hdl, napi_id); + DP_STATS_INC(fisa_hdl, + reo_mismatch.allow_fse_metdata_mismatch, + 1); return FISA_AGGR_NOT_ELIGIBLE; } dp_err("REO id mismatch flow: %pK napi_id: %u nbuf: %pK reo_id: %u", fisa_flow, fisa_flow->napi_id, nbuf, napi_id); - DP_STATS_INC(fisa_hdl, reo_mismatch, 1); + DP_STATS_INC(fisa_hdl, reo_mismatch.allow_non_aggr, 1); QDF_BUG(0); dp_rx_fisa_release_ft_lock(fisa_hdl, napi_id); return FISA_AGGR_NOT_ELIGIBLE; diff --git a/core/dp/txrx3.0/dp_rx_fst.c b/core/dp/txrx3.0/dp_rx_fst.c index 67f5828b62..4850abaf5c 100644 --- a/core/dp/txrx3.0/dp_rx_fst.c +++ b/core/dp/txrx3.0/dp_rx_fst.c @@ -71,6 +71,24 @@ void dp_rx_dump_fisa_table(struct dp_soc *soc) } } +void dp_print_fisa_stats(struct dp_soc *soc) +{ + struct wlan_cfg_dp_soc_ctxt *cfg = soc->wlan_cfg_ctx; + struct dp_rx_fst *fst = soc->rx_fst; + + /* Check if it is enabled in the INI */ + if (!wlan_cfg_is_rx_fisa_enabled(cfg)) + return; + + dp_info("invalid flow index: %u", fst->stats.invalid_flow_index); + dp_info("reo_mismatch: cce_match: %u", + fst->stats.reo_mismatch.allow_cce_match); + dp_info("reo_mismatch: allow_fse_metdata_mismatch: %u", + fst->stats.reo_mismatch.allow_fse_metdata_mismatch); + dp_info("reo_mismatch: allow_non_aggr: %u", + fst->stats.reo_mismatch.allow_non_aggr); +} + /** * dp_rx_flow_send_htt_operation_cmd() - Invalidate FSE cache on FT change * @pdev: handle to DP pdev