diff --git a/hif/src/ce/ce_service.c b/hif/src/ce/ce_service.c index 1299f78f96..ad0031e09f 100644 --- a/hif/src/ce/ce_service.c +++ b/hif/src/ce/ce_service.c @@ -198,6 +198,14 @@ inline void ce_init_ce_desc_event_log(int ce_id, int size) } #endif +#ifdef NAPI_YIELD_BUDGET_BASED +bool hif_ce_service_should_yield(struct hif_softc *scn, + struct CE_state *ce_state) +{ + bool yield = hif_max_num_receives_reached(scn, ce_state->receive_count); + return yield; +} +#else /** * hif_ce_service_should_yield() - return true if the service is hogging the cpu * @scn: hif context @@ -213,7 +221,7 @@ bool hif_ce_service_should_yield(struct hif_softc *scn, hif_max_num_receives_reached(scn, ce_state->receive_count); return yield; } - +#endif /* * Support for Copy Engine hardware, which is mainly used for * communication between Host and Target over a PCIe interconnect. diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index d79e9c461e..1cd69cffcd 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -196,6 +196,15 @@ uint32_t hif_hia_item_address(uint32_t target_type, uint32_t item_offset) } } +#ifdef NAPI_YIELD_BUDGET_BASED +bool hif_max_num_receives_reached(struct hif_softc *scn, unsigned int count) +{ + if (QDF_IS_EPPING_ENABLED(hif_get_conparam(scn))) + return count > 120; + else + return count > MAX_REAP_COUNT_PER_NAPI_POLL; +} +#else /** * hif_max_num_receives_reached() - check max receive is reached * @scn: HIF Context @@ -212,6 +221,7 @@ bool hif_max_num_receives_reached(struct hif_softc *scn, unsigned int count) else return count > MAX_NUM_OF_RECEIVES; } +#endif /** * init_buffer_count() - initial buffer count diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h index ea41aa89e8..f9d346db18 100644 --- a/hif/src/hif_main.h +++ b/hif/src/hif_main.h @@ -66,6 +66,8 @@ #define MAX_NUM_OF_RECEIVES HIF_NAPI_MAX_RECEIVES +#define MAX_REAP_COUNT_PER_NAPI_POLL 256 + #ifdef QCA_WIFI_3_0_ADRASTEA #define ADRASTEA_BU 1 #else diff --git a/hif/src/hif_napi.c b/hif/src/hif_napi.c index 2617e7e194..3b019ec041 100644 --- a/hif/src/hif_napi.c +++ b/hif/src/hif_napi.c @@ -761,8 +761,11 @@ int hif_napi_poll(struct hif_opaque_softc *hif_ctx, struct napi_struct *napi, if (0 == rc) NAPI_DEBUG("%s:%d: nothing processed by CE. Completing NAPI", __func__, __LINE__); - +#ifdef NAPI_YIELD_BUDGET_BASED + if (ce_state && (ce_state->force_break || 0 == rc)) { +#else if (ce_state && (!ce_check_rx_pending(ce_state) || 0 == rc)) { +#endif napi_info->stats[cpu].napi_completes++; hif_record_ce_desc_event(hif, ce_state->id, NAPI_COMPLETE,