Browse Source

qcacmn: Affine NAPIs based INI CPU mask

Affine NAPI CPUs based CPU mask specified in INI config.

Change-Id: I0bea3389a7565f8ec157d4587a442b5e11c33fb2
CRs-Fixed: 2255756
Manjunathappa Prakash 6 years ago
parent
commit
617ff247dd
2 changed files with 9 additions and 3 deletions
  1. 2 0
      hif/inc/hif.h
  2. 7 3
      hif/src/hif_napi.c

+ 2 - 0
hif/inc/hif.h

@@ -239,6 +239,7 @@ struct qca_napi_cpu {
  * @state: state variable used in the napi stat machine
  * @ce_map: bit map indicating which ce's have napis running
  * @exec_map: bit map of instanciated exec contexts
+ * @user_cpu_affin_map: CPU affinity map from INI config.
  * @napi_cpu: cpu info for irq affinty
  * @lilcl_head:
  * @bigcl_head:
@@ -255,6 +256,7 @@ struct qca_napi_data {
 	 */
 	uint32_t             ce_map;
 	uint32_t             exec_map;
+	uint32_t             user_cpu_affin_mask;
 	struct qca_napi_info *napis[CE_COUNT_MAX];
 	struct qca_napi_cpu  napi_cpu[NR_CPUS];
 	int                  lilcl_head, bigcl_head;

+ 7 - 3
hif/src/hif_napi.c

@@ -1110,7 +1110,7 @@ static void hnc_dump_cpus(struct qca_napi_data *napid) { /* no-op */ };
  *         !0: error (at least one of lil/big clusters could not be found)
  */
 #define HNC_MIN_CLUSTER 0
-#define HNC_MAX_CLUSTER 31
+#define HNC_MAX_CLUSTER 1
 static int hnc_link_clusters(struct qca_napi_data *napid)
 {
 	int rc = 0;
@@ -1521,13 +1521,17 @@ retry_disperse:
 			}
 			i = napid->napi_cpu[i].cluster_nxt;
 		}
-		destidx = smallidx;
-		if ((destidx < 0) && (head == napid->bigcl_head)) {
+		/* Check if matches with user sepecified CPU mask */
+		smallidx = ((1 << smallidx) & napid->user_cpu_affin_mask) ?
+								smallidx : -1;
+
+		if ((smallidx < 0) && (head == napid->bigcl_head)) {
 			NAPI_DEBUG("%s: DISPERSE: no bigcl dest, try lilcl",
 				__func__);
 			head = i = napid->lilcl_head;
 			goto retry_disperse;
 		}
+		destidx = smallidx;
 	}
 	NAPI_DEBUG("<--%s[dest=%d]", __func__, destidx);
 	return destidx;