From 617ff247dd1ae206ec829ab9e30abb6f4e308b0c Mon Sep 17 00:00:00 2001 From: Manjunathappa Prakash Date: Tue, 29 May 2018 19:17:25 -0700 Subject: [PATCH] qcacmn: Affine NAPIs based INI CPU mask Affine NAPI CPUs based CPU mask specified in INI config. Change-Id: I0bea3389a7565f8ec157d4587a442b5e11c33fb2 CRs-Fixed: 2255756 --- hif/inc/hif.h | 2 ++ hif/src/hif_napi.c | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 3773b5d489..23bfc219fa 100644 --- a/hif/inc/hif.h +++ b/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; diff --git a/hif/src/hif_napi.c b/hif/src/hif_napi.c index ebbd1a6f54..a609fab001 100644 --- a/hif/src/hif_napi.c +++ b/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;