Browse Source

qcacmn: Fix and Clean up code under NAPI_YIELD_BUDGET_BASED

Enable interrupts after processing the available
rx buffers on CE5 or complete napi after reaching the budget.

NAPI_YIELD_BUDGET_BASED:
This flag enables napi to return once the budget is exceeded,
or after processing the available packets and re-enables
interrupt and this feature doesn't honor the napi
yeild time configured.Napi budget will be configured as
256 for this feature

Change-Id: I75ac75ede46124bc773e3625173f33ca29da8142
CRs-fixed: 1094034
Nandha Kishore Easwaran 8 years ago
parent
commit
858a769d6b
5 changed files with 15 additions and 13 deletions
  1. 6 0
      hif/inc/hif.h
  2. 6 0
      hif/src/ce/ce_service.c
  3. 0 10
      hif/src/hif_main.c
  4. 0 2
      hif/src/hif_main.h
  5. 3 1
      hif/src/hif_napi.c

+ 6 - 0
hif/inc/hif.h

@@ -157,6 +157,7 @@ struct CE_state;
 #endif
 #endif
 
+#ifndef NAPI_YIELD_BUDGET_BASED
 #ifdef HIF_CONFIG_SLUB_DEBUG_ON
 #define QCA_NAPI_BUDGET    64
 #define QCA_NAPI_DEF_SCALE  2
@@ -164,6 +165,11 @@ struct CE_state;
 #define QCA_NAPI_BUDGET    64
 #define QCA_NAPI_DEF_SCALE 16
 #endif /* SLUB_DEBUG_ON */
+#else /* NAPI_YIELD_BUDGET_BASED */
+#define QCA_NAPI_BUDGET    64
+#define QCA_NAPI_DEF_SCALE 4
+#endif
+
 #define HIF_NAPI_MAX_RECEIVES (QCA_NAPI_BUDGET * QCA_NAPI_DEF_SCALE)
 
 /* NOTE: "napi->scale" can be changed,

+ 6 - 0
hif/src/ce/ce_service.c

@@ -1876,6 +1876,12 @@ more_data:
 				  CE_DEST_RING_READ_IDX_GET(scn, ctrl_addr));
 		}
 	}
+#ifdef NAPI_YIELD_BUDGET_BASED
+	/* Caution : Before you modify this code, please refer hif_napi_poll function
+	to understand how napi_complete gets called and make the necessary changes
+	Force break has to be done till WIN disables the interrupt at source */
+	ce_state->force_break = 1;
+#endif
 }
 
 #else

+ 0 - 10
hif/src/hif_main.c

@@ -196,15 +196,6 @@ 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
@@ -221,7 +212,6 @@ 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

+ 0 - 2
hif/src/hif_main.h

@@ -66,8 +66,6 @@
 
 #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

+ 3 - 1
hif/src/hif_napi.c

@@ -766,7 +766,9 @@ int hif_napi_poll(struct hif_opaque_softc *hif_ctx, struct napi_struct *napi,
 	if (ce_state && (!ce_check_rx_pending(ce_state) || 0 == rc)) {
 #endif
 		napi_info->stats[cpu].napi_completes++;
-
+#ifdef NAPI_YIELD_BUDGET_BASED
+		ce_state->force_break = 0;
+#endif
 		hif_record_ce_desc_event(hif, ce_state->id, NAPI_COMPLETE,
 					 NULL, NULL, 0);
 		if (normalized >= budget)