Przeglądaj źródła

qcacld-3.0: Save and restore DBAM config post SSR

Currently the driver doesn't store the DBAM configuration
sent by userspace via vendor command. So, whenever SSR happens,
the DBAM configuration is also lost.

To prevent this, save the DBAM config in the hdd context
when received via vendor command and restore it after re-init.

Change-Id: I186f96505ab9856d23996a7884afff6cd5d85f2f
CRs-Fixed: 3279467
Aditya Kodukula 2 lat temu
rodzic
commit
846b81eb50

+ 6 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -1309,6 +1309,9 @@ struct hdd_adapter {
 #ifdef DP_TRAFFIC_END_INDICATION
 	bool traffic_end_ind_en;
 #endif
+#ifdef WLAN_FEATURE_DBAM_CONFIG
+	bool is_dbam_configured;
+#endif
 };
 
 #define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station)
@@ -2027,6 +2030,9 @@ struct hdd_context {
 	uint8_t oem_data_len;
 	uint8_t *file_name;
 	qdf_mutex_t wifi_kobj_lock;
+#ifdef WLAN_FEATURE_DBAM_CONFIG
+	enum coex_dbam_config_mode dbam_mode;
+#endif
 };
 
 /**

+ 41 - 25
core/hdd/src/wlan_hdd_cfg80211.c

@@ -10017,22 +10017,12 @@ hdd_dbam_config_resp_cb(void *context,
 	osif_request_put(request);
 }
 
-/**
- * hdd_set_dbam_config() - enable/disable DBAM config
- * @adapter: hdd adapter
- * @attr: pointer to nla attr
- *
- * Return: 0 on success, negative errno on failure
- */
-static int hdd_set_dbam_config(struct hdd_adapter *adapter,
-			       const struct nlattr *attr)
+int hdd_send_dbam_config(struct hdd_adapter *adapter,
+			 enum coex_dbam_config_mode dbam_mode)
 {
-	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-	struct wlan_objmgr_vdev *vdev;
 	int errno;
 	QDF_STATUS status;
-	enum qca_dbam_config dbam_config;
-	enum coex_dbam_config_mode dbam_mode;
+	struct wlan_objmgr_vdev *vdev;
 	enum coex_dbam_comp_status dbam_resp;
 	struct coex_dbam_config_params dbam_params = {0};
 	void *cookie;
@@ -10043,18 +10033,7 @@ static int hdd_set_dbam_config(struct hdd_adapter *adapter,
 		.timeout_ms = WLAN_SET_DBAM_CONFIG_TIMEOUT,
 	};
 
-	errno = wlan_hdd_validate_context(hdd_ctx);
-	if (errno)
-		return -EINVAL;
-
-	if (hdd_ctx->num_rf_chains < 2) {
-		hdd_debug("Num of chains [%u] < 2, DBAM config is not allowed",
-			  hdd_ctx->num_rf_chains);
-		return -EINVAL;
-	}
-
-	dbam_config = nla_get_u8(attr);
-	errno = hdd_convert_qca_dbam_config_mode(dbam_config, &dbam_mode);
+	errno = hdd_validate_adapter(adapter);
 	if (errno)
 		return errno;
 
@@ -10099,6 +10078,43 @@ err:
 	osif_request_put(request);
 	return errno;
 }
+
+/**
+ * hdd_set_dbam_config() - set DBAM config
+ * @adapter: hdd adapter
+ * @attr: pointer to nla attr
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+static int hdd_set_dbam_config(struct hdd_adapter *adapter,
+			       const struct nlattr *attr)
+{
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	int errno;
+	enum qca_dbam_config dbam_config;
+	enum coex_dbam_config_mode dbam_mode;
+
+	errno = wlan_hdd_validate_context(hdd_ctx);
+	if (errno)
+		return -EINVAL;
+
+	if (hdd_ctx->num_rf_chains < 2) {
+		hdd_debug("Num of chains [%u] < 2, DBAM config is not allowed",
+			  hdd_ctx->num_rf_chains);
+		return -EINVAL;
+	}
+
+	dbam_config = nla_get_u8(attr);
+	errno = hdd_convert_qca_dbam_config_mode(dbam_config, &dbam_mode);
+	if (errno)
+		return errno;
+
+	/* Store dbam config in hdd_ctx, to restore in case of an SSR */
+	adapter->is_dbam_configured = true;
+	hdd_ctx->dbam_mode = dbam_mode;
+
+	return hdd_send_dbam_config(adapter, dbam_mode);
+}
 #endif
 
 /**

+ 11 - 0
core/hdd/src/wlan_hdd_cfg80211.h

@@ -971,4 +971,15 @@ bool wlan_hdd_cfg80211_rx_control_port(struct net_device *dev,
 				       struct sk_buff *skb,
 				       bool unencrypted);
 
+#ifdef WLAN_FEATURE_DBAM_CONFIG
+/**
+ * hdd_send_dbam_config() - send DBAM config
+ * @adapter: hdd adapter
+ * @dbam_mode: dbam mode configuration
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+int hdd_send_dbam_config(struct hdd_adapter *adapter,
+			 enum coex_dbam_config_mode dbam_mode);
+#endif
 #endif

+ 29 - 0
core/hdd/src/wlan_hdd_power.c

@@ -1902,6 +1902,34 @@ static inline void hdd_wlan_ssr_reinit_event(void)
 }
 #endif
 
+#ifdef WLAN_FEATURE_DBAM_CONFIG
+/**
+ * hdd_retore_dbam_config - restore and send dbam config to fw
+ *
+ * This function is used to send  store dbam config to fw
+ * in case of wlan re-init
+ *
+ * Return: void
+ */
+static void hdd_restore_dbam_config(struct hdd_context *hdd_ctx)
+{
+	struct hdd_adapter *adapter, *next_adapter = NULL;
+	wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_ADAPTER;
+
+	hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
+					   dbgid) {
+		if (hdd_is_interface_up(adapter) &&
+		    adapter->is_dbam_configured)
+			hdd_send_dbam_config(adapter, hdd_ctx->dbam_mode);
+		hdd_adapter_dev_put_debug(adapter, dbgid);
+	}
+}
+#else
+static inline void hdd_restore_dbam_config(struct hdd_context *hdd_ctx)
+{
+}
+#endif
+
 /**
  * hdd_restore_dual_sta_config() - Restore dual sta configuration
  * @hdd_ctx: pointer to struct hdd_context
@@ -2082,6 +2110,7 @@ QDF_STATUS hdd_wlan_re_init(void)
 
 	hdd_send_default_scan_ies(hdd_ctx);
 	hdd_restore_dual_sta_config(hdd_ctx);
+	hdd_restore_dbam_config(hdd_ctx);
 	hdd_info("WLAN host driver reinitiation completed!");
 
 	ucfg_mlme_get_sap_internal_restart(hdd_ctx->psoc, &value);