From 0c616f6306175e89ee767a8aef99999f0c86c1ff Mon Sep 17 00:00:00 2001 From: Roopavathi Lingampalli Date: Tue, 25 Oct 2022 12:09:17 +0530 Subject: [PATCH] qcacld-3.0: Add support for flush GRO packets using RX thread Add support for flush GRO packets using RX thread in OSIF module. Change-Id: I776e863d03923bcaac685547d3047df2c8afb27e CRs-Fixed: 3316855 --- os_if/dp/src/os_if_dp_txrx.c | 58 ++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/os_if/dp/src/os_if_dp_txrx.c b/os_if/dp/src/os_if_dp_txrx.c index d10d5dcbc7..c5fb011e7e 100644 --- a/os_if/dp/src/os_if_dp_txrx.c +++ b/os_if/dp/src/os_if_dp_txrx.c @@ -37,8 +37,6 @@ #include #include #include -#include -#include #include #include "wlan_hdd_wmm.h" @@ -171,6 +169,46 @@ void osif_dp_mark_pkt_type(struct sk_buff *skb) #endif #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) +/** + * osif_dp_rx_thread_napi_gro_flush() - do gro flush + * @napi: napi used to do gro flush + * @flush_code: flush_code differentiating low_tput_flush and normal_flush + * + * if there is RX GRO_NORMAL packets pending in napi + * rx_list, flush them manually right after napi_gro_flush. + * + * Return: none + */ +static inline +void osif_dp_rx_thread_napi_gro_flush(struct napi_struct *napi, + enum dp_rx_gro_flush_code flush_code) +{ + if (napi->poll) { + /* Skipping GRO flush in low TPUT */ + if (flush_code != DP_RX_GRO_LOW_TPUT_FLUSH) + napi_gro_flush(napi, false); + + if (napi->rx_count) { + netif_receive_skb_list(&napi->rx_list); + qdf_init_list_head(&napi->rx_list); + napi->rx_count = 0; + } + } +} +#else +static inline +void osif_dp_rx_thread_napi_gro_flush(struct napi_struct *napi, + enum dp_rx_gro_flush_code flush_code) +{ + if (napi->poll) { + /* Skipping GRO flush in low TPUT */ + if (flush_code != DP_RX_GRO_LOW_TPUT_FLUSH) + napi_gro_flush(napi, false); + } +} +#endif + /** * osif_dp_rx_napi_gro_flush() - GRO RX/flush function. * @napi_to_use: napi to be used to give packets to the stack, gro flush @@ -201,8 +239,8 @@ osif_dp_rx_napi_gro_flush(qdf_napi_struct *napi_to_use, if (DP_IS_EXTRA_GRO_FLUSH_NECESSARY(gro_ret)) { *low_tput_force_flush = 1; - dp_rx_napi_gro_flush((struct napi_struct *)napi_to_use, - DP_RX_GRO_NORMAL_FLUSH); + osif_dp_rx_thread_napi_gro_flush((struct napi_struct *)napi_to_use, + DP_RX_GRO_NORMAL_FLUSH); } local_bh_enable(); @@ -243,12 +281,13 @@ osif_dp_rx_napi_gro_receive(qdf_napi_struct *napi_to_use, #ifdef RECEIVE_OFFLOAD /** - * osif_dp_rxthread_napi_gro_flush() - GRO flush cbk for NAPI+Rx_Thread Rx mode + * osif_dp_rxthread_napi_normal_gro_flush() - GRO flush cbk for NAPI+Rx_Thread + * Rx mode * @data: hif NAPI context * * Return: none */ -static void osif_dp_rxthread_napi_gro_flush(void *data) +static void osif_dp_rxthread_napi_normal_gro_flush(void *data) { struct qca_napi_info *qca_napi = (struct qca_napi_info *)data; @@ -257,8 +296,8 @@ static void osif_dp_rxthread_napi_gro_flush(void *data) * As we are breaking context in Rxthread mode, there is rx_thread NAPI * corresponds each hif_napi. */ - dp_rx_napi_gro_flush(&qca_napi->rx_thread_napi, - DP_RX_GRO_NORMAL_FLUSH); + osif_dp_rx_thread_napi_gro_flush(&qca_napi->rx_thread_napi, + DP_RX_GRO_NORMAL_FLUSH); local_bh_enable(); } @@ -509,7 +548,7 @@ void osif_dp_register_rx_offld_flush_cb(enum dp_rx_offld_flush_cb cb_type) cdp_register_rx_offld_flush_cb(soc, osif_dp_qdf_lro_flush); else if (cb_type == DP_RX_FLUSH_THREAD) cdp_register_rx_offld_flush_cb(soc, - osif_dp_rxthread_napi_gro_flush); + osif_dp_rxthread_napi_normal_gro_flush); else if (cb_type == DP_RX_FLUSH_NAPI) cdp_register_rx_offld_flush_cb(soc, osif_dp_hif_napi_gro_flush); @@ -548,6 +587,7 @@ void os_if_dp_register_txrx_callbacks(struct wlan_dp_psoc_callbacks *cb_obj) cb_obj->dp_nbuf_push_pkt = osif_dp_rx_pkt_to_nw; cb_obj->dp_rx_napi_gro_flush = osif_dp_rx_napi_gro_flush; cb_obj->dp_rx_napi_gro_receive = osif_dp_rx_napi_gro_receive; + cb_obj->dp_rx_thread_napi_gro_flush = osif_dp_rx_thread_napi_gro_flush; cb_obj->dp_lro_rx_cb = osif_dp_lro_rx; cb_obj->dp_register_rx_offld_flush_cb = osif_dp_register_rx_offld_flush_cb;