Przeglądaj źródła

qcacld-3.0: Optimize the driver transition checks for cds

Currently there are multiple driver calls in per packet path
w.r.t recovery, bad state, load/unload which is leading tput impact.

Move all the cds driver checks into one function to avoid multiple
calls.

Change-Id: I70f4fcc6bfbd1df32ae17ce6a0485fa3f55ca561
CRs-Fixed: 3057573
Arun Kumar Khandavalli 3 lat temu
rodzic
commit
7b9d985091

+ 16 - 0
core/cds/inc/cds_api.h

@@ -606,4 +606,20 @@ QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev, bool ipa_present);
  * Return: Status of map operation
  */
 int cds_smmu_map_unmap(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr);
+
+/**
+ * cds_is_driver_transitioning() - Is driver transitioning
+ *
+ * Return: true if driver is loading/unloading/recovering and false otherwise.
+ */
+static inline bool cds_is_driver_transitioning(void)
+{
+	enum cds_driver_state state = cds_get_driver_state();
+
+	return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_LOADING) ||
+		__CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_UNLOADING) ||
+		__CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_RECOVERING) ||
+		__CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_BAD);
+}
+
 #endif /* if !defined __CDS_API_H */

+ 1 - 2
core/hdd/src/wlan_hdd_softap_tx_rx.c

@@ -581,8 +581,7 @@ static void __hdd_softap_hard_start_xmit(struct sk_buff *skb,
 	 * context may not be reinitialized at this time which may
 	 * lead to a crash.
 	 */
-	if (cds_is_driver_recovering() || cds_is_driver_in_bad_state() ||
-	    cds_is_load_or_unload_in_progress()) {
+	if (cds_is_driver_transitioning()) {
 		QDF_TRACE_DEBUG_RL(
 			  QDF_MODULE_ID_HDD_SAP_DATA,
 			  "%s: Recovery/(Un)load in Progress. Ignore!!!",

+ 2 - 5
core/hdd/src/wlan_hdd_tx_rx.c

@@ -1050,18 +1050,15 @@ static void __hdd_hard_start_xmit(struct sk_buff *skb,
 	adapter->hdd_stats.tx_rx_stats.cont_txtimeout_cnt = 0;
 	qdf_mem_copy(mac_addr.bytes, skb->data, sizeof(mac_addr.bytes));
 
-	if (cds_is_driver_recovering() || cds_is_driver_in_bad_state() ||
-	    cds_is_load_or_unload_in_progress()) {
+	if (cds_is_driver_transitioning()) {
 		QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_HDD_DATA,
 				   "Recovery/(Un)load in progress, dropping the packet");
 		goto drop_pkt;
 	}
 
 	hdd_ctx = adapter->hdd_ctx;
-	if (wlan_hdd_validate_context(hdd_ctx))
-		goto drop_pkt;
 
-	if (hdd_ctx->hdd_wlan_suspended) {
+	if (!hdd_ctx || hdd_ctx->hdd_wlan_suspended) {
 		hdd_err_rl("Device is system suspended, drop pkt");
 		goto drop_pkt;
 	}