ソースを参照

qcacld-3.0: Fix add interface issue for multiple softaps

Conditional check to avoid add of same softap interface again
during SSR in __wlan_hdd_add_virtual_intf() is causing
regression (Ic3cd1eebb23482e9cebf04683533face178698b4) and
not allowing to add more than one softap interface.

To fix, add check for newly requested softap interface name with
previously registered softap interfaces and add if name is different
else return the existing one.

Change-Id: I103bd577db5c38e53b1ef12278a856a39790f8f7
CRs-Fixed: 2155854
Rajeev Kumar Sirasanagandla 7 年 前
コミット
bb03b2cd0e
1 ファイル変更52 行追加11 行削除
  1. 52 11
      core/hdd/src/wlan_hdd_p2p.c

+ 52 - 11
core/hdd/src/wlan_hdd_p2p.c

@@ -541,6 +541,52 @@ static uint8_t wlan_hdd_get_session_type(enum nl80211_iftype type)
 	}
 }
 
+/**
+ * wlan_hdd_allow_sap_add() - check to add new sap interface
+ * @hdd_ctx: pointer to hdd context
+ * @name: name of the new interface
+ * @sap_dev: output pointer to hold existing interface
+ *
+ * Return: If able to add interface return true else false
+ */
+static bool
+wlan_hdd_allow_sap_add(struct hdd_context *hdd_ctx, const char *name,
+		       struct wireless_dev **sap_dev)
+{
+	hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
+	QDF_STATUS status;
+	struct hdd_adapter *adapter;
+
+	*sap_dev = NULL;
+	status = hdd_get_front_adapter(hdd_ctx, &adapter_node);
+	while (adapter_node && QDF_IS_STATUS_SUCCESS(status)) {
+		adapter = adapter_node->adapter;
+		if (adapter && adapter->device_mode == QDF_SAP_MODE &&
+		    test_bit(NET_DEVICE_REGISTERED, &adapter->event_flags) &&
+		    !strncmp(adapter->dev->name, name, IFNAMSIZ)) {
+			struct hdd_beacon_data *beacon =
+						adapter->session.ap.beacon;
+
+			hdd_debug("iface already registered");
+			if (beacon) {
+				adapter->session.ap.beacon = NULL;
+				qdf_mem_free(beacon);
+			}
+			if (adapter->dev && adapter->dev->ieee80211_ptr) {
+				*sap_dev = adapter->dev->ieee80211_ptr;
+				return false;
+			}
+
+			hdd_err("ieee80211_ptr points to NULL");
+			return false;
+		}
+		status = hdd_get_next_adapter(hdd_ctx, adapter_node, &next);
+		adapter_node = next;
+	}
+
+	return true;
+}
+
 /**
  * __wlan_hdd_add_virtual_intf() - Add virtual interface
  * @wiphy: wiphy pointer
@@ -606,18 +652,13 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
 	}
 
 	if (session_type == QDF_SAP_MODE) {
-		adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE);
-		if (adapter && test_bit(NET_DEVICE_REGISTERED,
-					 &adapter->event_flags)) {
-			hdd_debug("iface already registered");
-			if (adapter->session.ap.beacon) {
-				qdf_mem_free(adapter->session.ap.beacon);
-				adapter->session.ap.beacon = NULL;
-			}
-			if (adapter->dev && adapter->dev->ieee80211_ptr)
-				return adapter->dev->ieee80211_ptr;
+		struct wireless_dev *sap_dev;
+		bool allow_add_sap = wlan_hdd_allow_sap_add(hdd_ctx, name,
+							    &sap_dev);
+		if (!allow_add_sap) {
+			if (sap_dev)
+				return sap_dev;
 
-			hdd_err("ieee80211_ptr points to NULL");
 			return ERR_PTR(-EINVAL);
 		}
 	}