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
diff --git a/hif/inc/hif.h b/hif/inc/hif.h
index 8220831..98a1692 100644
--- a/hif/inc/hif.h
+++ b/hif/inc/hif.h
@@ -157,6 +157,7 @@
 #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 @@
 #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,
diff --git a/hif/src/ce/ce_service.c b/hif/src/ce/ce_service.c
index ad0031e..b6173e0 100644
--- a/hif/src/ce/ce_service.c
+++ b/hif/src/ce/ce_service.c
@@ -1876,6 +1876,12 @@
 				  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
diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c
index 8a82d58..27e3c73 100644
--- a/hif/src/hif_main.c
+++ b/hif/src/hif_main.c
@@ -196,15 +196,6 @@
 	}
 }
 
-#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 @@
 	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 45e41f3..642051e 100644
--- a/hif/src/hif_main.h
+++ b/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
diff --git a/hif/src/hif_napi.c b/hif/src/hif_napi.c
index e7850a9..7ac3480 100644
--- a/hif/src/hif_napi.c
+++ b/hif/src/hif_napi.c
@@ -766,7 +766,9 @@
 	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)