Pārlūkot izejas kodu

msm: ipa3: Disable NAPI after entering interrupt mode

Handle all packets to enter interrupt mode before disabling and
deleting NAPI. This avoids waiting on unlisted NAPI to be scheduled
resulting in crashes.

Change-Id: Ic78763686187c252e15950c1aaafd8f69bf02f82
Signed-off-by: Pavan Kumar M <[email protected]>
Pavan Kumar M 1 gadu atpakaļ
vecāks
revīzija
b44e564fa1
1 mainītis faili ar 16 papildinājumiem un 5 dzēšanām
  1. 16 5
      drivers/platform/msm/ipa/ipa_v3/ipa_dp.c

+ 16 - 5
drivers/platform/msm/ipa/ipa_v3/ipa_dp.c

@@ -2011,11 +2011,6 @@ int ipa_teardown_sys_pipe(u32 clnt_hdl)
 			netif_napi_del(&ep->sys->napi_tx);
 	}
 
-	if (IPA_CLIENT_IS_WAN_CONS(ep->client)) {
-		napi_disable(ep->sys->napi_obj);
-		netif_napi_del(ep->sys->napi_obj);
-	}
-
 	if(ep->client == IPA_CLIENT_APPS_WAN_LOW_LAT_DATA_CONS) {
 		napi_disable(&ep->sys->napi_rx);
 		netif_napi_del(&ep->sys->napi_rx);
@@ -2077,6 +2072,9 @@ int ipa_teardown_sys_pipe(u32 clnt_hdl)
 				IPAERR("failed to teardown default coal pipe\n");
 				return result;
 			}
+		} else {
+			napi_disable(ep->sys->napi_obj);
+			netif_napi_del(ep->sys->napi_obj);
 		}
 	}
 
@@ -2226,6 +2224,19 @@ static int ipa3_teardown_pipe(u32 clnt_hdl)
 		ipa_assert();
 		return result;
 	}
+
+	if (IPA_CLIENT_IS_WAN_CONS(ep->client)) {
+		/* Wait for any pending irqs */
+		usleep_range(POLLING_MIN_SLEEP_RX, POLLING_MAX_SLEEP_RX);
+		/* Wait until end point moving to interrupt mode before teardown */
+		do {
+			usleep_range(95, 105);
+		} while (atomic_read(&ep->sys->curr_polling_state));
+
+		napi_disable(ep->sys->napi_obj);
+		netif_napi_del(ep->sys->napi_obj);
+	}
+
 	result = ipa3_reset_gsi_channel(clnt_hdl);
 	if (result != GSI_STATUS_SUCCESS) {
 		IPAERR("Failed to reset chan: %d.\n", result);