Explorar el Código

qcacmn: Deregister HIF ext groups on rmmod

- Deregister & free the hif ext ctx when detaching DP interrupts.
- Unregister the hotcpu_notifier during rmmod.

Change-Id: Icbd3c6cee70b6b224059a4b301b9840485a96d11
CRs-Fixed: 2086729
psimha hace 7 años
padre
commit
a079b8c678
Se han modificado 4 ficheros con 53 adiciones y 2 borrados
  1. 2 0
      dp/wifi3.0/dp_main.c
  2. 3 0
      hif/inc/hif.h
  3. 41 0
      hif/src/hif_exec.c
  4. 7 2
      hif/src/hif_napi.c

+ 2 - 0
dp/wifi3.0/dp_main.c

@@ -1188,6 +1188,8 @@ static void dp_soc_interrupt_detach(void *txrx_soc)
 	if (soc->intr_mode == DP_INTR_POLL) {
 		qdf_timer_stop(&soc->int_timer);
 		qdf_timer_free(&soc->int_timer);
+	} else {
+		hif_deregister_exec_group(soc->hif_handle, "dp_intr");
 	}
 
 	for (i = 0; i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) {

+ 3 - 0
hif/inc/hif.h

@@ -299,6 +299,7 @@ struct qca_napi_data {
 	int                  lilcl_head, bigcl_head;
 	enum qca_napi_tput_state napi_mode;
 	struct notifier_block hnc_cpu_notifier;
+	bool cpu_notifier_registered;
 	uint8_t              flags;
 };
 
@@ -890,6 +891,8 @@ uint32_t  hif_register_ext_group(struct hif_opaque_softc *hif_ctx,
 		uint32_t numirq, uint32_t irq[], ext_intr_handler handler,
 		void *cb_ctx, const char *context_name,
 		uint32_t budget);
+void hif_deregister_exec_group(struct hif_opaque_softc *hif_ctx,
+				const char *context_name);
 
 void hif_update_pipe_callback(struct hif_opaque_softc *osc,
 				u_int8_t pipeid,

+ 41 - 0
hif/src/hif_exec.c

@@ -151,6 +151,8 @@ static void hif_exec_napi_kill(struct hif_exec_context *ctx)
 
 	for (irq_ind = 0; irq_ind < ctx->numirq; irq_ind++)
 		hif_irq_affinity_remove(ctx->os_irq[irq_ind]);
+
+	netif_napi_del(&(n_ctx->napi));
 }
 
 struct hif_execution_ops napi_sched_ops = {
@@ -413,3 +415,42 @@ void hif_exec_destroy(struct hif_exec_context *ctx)
 	qdf_spinlock_destroy(&ctx->irq_lock);
 	qdf_mem_free(ctx);
 }
+
+/**
+ * hif_deregister_exec_group() - API to free the exec contexts
+ * @hif_ctx: HIF context
+ * @context_name: name of the module whose contexts need to be deregistered
+ *
+ * This function deregisters the contexts of the requestor identified
+ * based on the context_name & frees the memory.
+ *
+ * Return: void
+ */
+void hif_deregister_exec_group(struct hif_opaque_softc *hif_ctx,
+				const char *context_name)
+{
+	struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
+	struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
+	struct hif_exec_context *hif_ext_group;
+	int i;
+
+	for (i = 0; i < HIF_MAX_GROUP; i++) {
+		hif_ext_group = hif_state->hif_ext_group[i];
+
+		if (!hif_ext_group)
+			continue;
+
+		HIF_INFO("%s: Deregistering grp id %d name %s\n",
+				__func__,
+				hif_ext_group->grp_id,
+				hif_ext_group->context_name);
+
+		if (strcmp(hif_ext_group->context_name, context_name) == 0) {
+			hif_ext_group->sched_ops->kill(hif_ext_group);
+			hif_state->hif_ext_group[i] = NULL;
+			hif_exec_destroy(hif_ext_group);
+			hif_state->hif_num_extgroup--;
+		}
+
+	}
+}

+ 7 - 2
hif/src/hif_napi.c

@@ -1146,9 +1146,14 @@ static int hnc_hotplug_hook(struct hif_softc *hif_sc, int install)
 			= hnc_cpu_notify_cb;
 		rc = register_hotcpu_notifier(
 			&hif_sc->napi_data.hnc_cpu_notifier);
+		if (rc == 0)
+			hif_sc->napi_data.cpu_notifier_registered = true;
 	} else {
-		unregister_hotcpu_notifier(
-			&hif_sc->napi_data.hnc_cpu_notifier);
+		if (hif_sc->napi_data.cpu_notifier_registered == true) {
+			unregister_hotcpu_notifier(
+				&hif_sc->napi_data.hnc_cpu_notifier);
+			hif_sc->napi_data.cpu_notifier_registered = false;
+		}
 	}
 
 	NAPI_DEBUG("<--%s()[%d]", __func__, rc);