Browse Source

qcacmn: Use QDF NAPI APIs in HIF

Currently the HIF code directly calls Linux NAPI APIs. However, the
QDF has abstractions for these. Furthermore, the QDF implementation
properly handles NAPI API changes introduced in Linux Kernel versions
5.19 through 6.1. Therefore, modify HIF to use the QDF NAPI APIs so
that the version-specific changes are only needed in QDF.

Change-Id: Ibc6c69c9add8d2829ac34dcdcf8b2b262f7304b7
CRs-Fixed: 3364162
Jeff Johnson 2 years ago
parent
commit
6d84faa9cf
2 changed files with 15 additions and 14 deletions
  1. 5 5
      hif/src/hif_exec.c
  2. 10 9
      hif/src/hif_napi.c

+ 5 - 5
hif/src/hif_exec.c

@@ -715,7 +715,7 @@ static void hif_exec_napi_kill(struct hif_exec_context *ctx)
 	int irq_ind;
 
 	if (ctx->inited) {
-		napi_disable(&n_ctx->napi);
+		qdf_napi_disable(&n_ctx->napi);
 		ctx->inited = 0;
 	}
 
@@ -723,7 +723,7 @@ static void hif_exec_napi_kill(struct hif_exec_context *ctx)
 		hif_irq_affinity_remove(ctx->os_irq[irq_ind]);
 
 	hif_core_ctl_set_boost(false);
-	netif_napi_del(&(n_ctx->napi));
+	qdf_netif_napi_del(&(n_ctx->napi));
 }
 
 struct hif_execution_ops napi_sched_ops = {
@@ -748,9 +748,9 @@ static struct hif_exec_context *hif_exec_napi_create(uint32_t scale)
 	ctx->exec_ctx.inited = true;
 	ctx->exec_ctx.scale_bin_shift = scale;
 	qdf_net_if_create_dummy_if((struct qdf_net_if *)&ctx->netdev);
-	netif_napi_add(&(ctx->netdev), &(ctx->napi), hif_exec_poll,
-		       QCA_NAPI_BUDGET);
-	napi_enable(&ctx->napi);
+	qdf_netif_napi_add(&(ctx->netdev), &(ctx->napi), hif_exec_poll,
+			   QCA_NAPI_BUDGET);
+	qdf_napi_enable(&ctx->napi);
 
 	return &ctx->exec_ctx;
 }

+ 10 - 9
hif/src/hif_napi.c

@@ -83,9 +83,9 @@ static void hif_init_rx_thread_napi(struct qca_napi_info *napii)
 	struct qdf_net_if *nd = (struct qdf_net_if *)&napii->rx_thread_netdev;
 
 	qdf_net_if_create_dummy_if(nd);
-	netif_napi_add(&napii->rx_thread_netdev, &napii->rx_thread_napi,
-		       hif_rxthread_napi_poll, 64);
-	napi_enable(&napii->rx_thread_napi);
+	qdf_netif_napi_add(&napii->rx_thread_netdev, &napii->rx_thread_napi,
+			   hif_rxthread_napi_poll, 64);
+	qdf_napi_enable(&napii->rx_thread_napi);
 }
 
 /**
@@ -96,7 +96,7 @@ static void hif_init_rx_thread_napi(struct qca_napi_info *napii)
  */
 static void hif_deinit_rx_thread_napi(struct qca_napi_info *napii)
 {
-	netif_napi_del(&napii->rx_thread_napi);
+	qdf_netif_napi_del(&napii->rx_thread_napi);
 }
 #else /* RECEIVE_OFFLOAD */
 static void hif_init_rx_thread_napi(struct qca_napi_info *napii)
@@ -207,7 +207,8 @@ int hif_napi_create(struct hif_opaque_softc   *hif_ctx,
 
 		NAPI_DEBUG("adding napi=%pK to netdev=%pK (poll=%pK, bdgt=%d)",
 			   &(napii->napi), &(napii->netdev), poll, budget);
-		netif_napi_add(&(napii->netdev), &(napii->napi), poll, budget);
+		qdf_netif_napi_add(&(napii->netdev), &(napii->napi),
+				   poll, budget);
 
 		NAPI_DEBUG("after napi_add");
 		NAPI_DEBUG("napi=0x%pK, netdev=0x%pK",
@@ -365,7 +366,7 @@ int hif_napi_destroy(struct hif_opaque_softc *hif_ctx,
 
 		if (hif->napi_data.state == HIF_NAPI_CONF_UP) {
 			if (force) {
-				napi_disable(&(napii->napi));
+				qdf_napi_disable(&(napii->napi));
 				hif_debug("NAPI entry %d force disabled", id);
 				NAPI_DEBUG("NAPI %d force disabled", id);
 			} else {
@@ -383,7 +384,7 @@ int hif_napi_destroy(struct hif_opaque_softc *hif_ctx,
 				   napii->netdev.napi_list.next);
 
 			qdf_lro_deinit(napii->lro_ctx);
-			netif_napi_del(&(napii->napi));
+			qdf_netif_napi_del(&(napii->napi));
 			hif_deinit_rx_thread_napi(napii);
 
 			napid->ce_map &= ~(0x01 << ce);
@@ -671,7 +672,7 @@ int hif_napi_event(struct hif_opaque_softc *hif_ctx, enum qca_napi_event event,
 					napi = &(napii->napi);
 					NAPI_DEBUG("%s: enabling NAPI %d",
 						   __func__, i);
-					napi_enable(napi);
+					qdf_napi_enable(napi);
 				}
 			}
 		} else {
@@ -682,7 +683,7 @@ int hif_napi_event(struct hif_opaque_softc *hif_ctx, enum qca_napi_event event,
 					napi = &(napii->napi);
 					NAPI_DEBUG("%s: disabling NAPI %d",
 						   __func__, i);
-					napi_disable(napi);
+					qdf_napi_disable(napi);
 					/* in case it is affined, remove it */
 					qdf_dev_set_irq_affinity(napii->irq,
 								 NULL);