Browse Source

qcacld-3.0: Add changes to support ML-SAP dynamic MAC update

Current implementation for MAC address update for SAP
doesn't check if the adapter is ML capable or not.
Add the logic to check if the adapter is ML capable
in SAP mode and update MLD address if it is true.

Change-Id: I06ce99e53439904acbc1f96f3aedba816d58f0da
CRs-Fixed: 3323654
Vinod Kumar Pirla 2 years ago
parent
commit
fec271cfb2
3 changed files with 33 additions and 15 deletions
  1. 25 0
      core/hdd/inc/wlan_hdd_main.h
  2. 3 0
      core/hdd/src/wlan_hdd_hostapd.c
  3. 5 15
      core/hdd/src/wlan_hdd_main.c

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

@@ -4081,6 +4081,31 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, qdf_freq_t freq,
 }
 #endif
 
+#if defined(WLAN_FEATURE_11BE_MLO) && defined(CFG80211_11BE_BASIC)
+/**
+ *  hdd_set_mld_address() - Set the MLD address of the adapter
+ *  @adapter: Handle to adapter
+ *  @mac_addr: MAC address to be copied
+ *
+ *  The function copies the MAC address sent in @mac_addr to
+ *  the adapter's MLD address and the MLD address of each
+ *  link adapter mapped of the @adapter.
+ *  The mode of operation must be 11be capable and @adapter
+ *  has to be ML type.
+ *
+ *  Return: void
+ */
+void
+hdd_set_mld_address(struct hdd_adapter *adapter,
+		    struct qdf_mac_addr *mac_addr);
+#else
+static inline void
+hdd_set_mld_address(struct hdd_adapter *adapter,
+		    struct qdf_mac_addr *mac_addr)
+{
+}
+#endif
+
 /**
  * hdd_wlan_get_version() - Get version information
  * @hdd_ctx: Global HDD context

+ 3 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -794,6 +794,9 @@ static int __hdd_hostapd_set_mac_address(struct net_device *dev, void *addr)
 			return ret;
 	}
 
+	hdd_set_mld_address(adapter, &mac_addr);
+
+	/* Currently for SL-ML-SAP use same MAC for both MLD and link */
 	hdd_update_dynamic_mac(hdd_ctx, &adapter->mac_addr, &mac_addr);
 	ucfg_dp_update_inf_mac(hdd_ctx->psoc, &adapter->mac_addr, &mac_addr);
 	memcpy(&adapter->mac_addr, psta_mac_addr->sa_data, ETH_ALEN);

+ 5 - 15
core/hdd/src/wlan_hdd_main.c

@@ -4934,8 +4934,8 @@ void hdd_update_dynamic_mac(struct hdd_context *hdd_ctx,
 }
 
 #if defined(WLAN_FEATURE_11BE_MLO) && defined(CFG80211_11BE_BASIC)
-static void
-hdd_set_mld_address(struct hdd_adapter *adapter, struct hdd_context *hdd_ctx,
+void
+hdd_set_mld_address(struct hdd_adapter *adapter,
 		    struct qdf_mac_addr *mac_addr)
 {
 	int i;
@@ -4943,9 +4943,8 @@ hdd_set_mld_address(struct hdd_adapter *adapter, struct hdd_context *hdd_ctx,
 	struct hdd_adapter *link_adapter;
 	struct hdd_mlo_adapter_info *mlo_adapter_info;
 
-	ucfg_psoc_mlme_get_11be_capab(hdd_ctx->psoc, &eht_capab);
-	if (adapter->device_mode == QDF_STA_MODE &&
-	    adapter->mlo_adapter_info.is_ml_adapter && eht_capab) {
+	ucfg_psoc_mlme_get_11be_capab(adapter->hdd_ctx->psoc, &eht_capab);
+	if (adapter->mlo_adapter_info.is_ml_adapter && eht_capab) {
 		mlo_adapter_info = &adapter->mlo_adapter_info;
 		for (i = 0; i < WLAN_MAX_MLD; i++) {
 			link_adapter = mlo_adapter_info->link_adapter[i];
@@ -4994,12 +4993,6 @@ hdd_get_netdev_by_vdev_mac(struct qdf_mac_addr *mac_addr)
 	return adapter->dev;
 }
 #else
-static void
-hdd_set_mld_address(struct hdd_adapter *adapter, struct hdd_context *hdd_ctx,
-		    struct qdf_mac_addr *mac_addr)
-{
-}
-
 static qdf_netdev_t
 hdd_get_netdev_by_vdev_mac(struct qdf_mac_addr *mac_addr)
 {
@@ -5274,12 +5267,9 @@ static int __hdd_set_mac_address(struct net_device *dev, void *addr)
 			return ret;
 	}
 
-	ucfg_psoc_mlme_get_11be_capab(hdd_ctx->psoc, &eht_capab);
-	if (hdd_adapter_is_ml_adapter(adapter) && eht_capab)
-		hdd_set_mld_address(adapter, hdd_ctx, &mac_addr);
+	hdd_set_mld_address(adapter, &mac_addr);
 
 	hdd_update_dynamic_mac(hdd_ctx, &adapter->mac_addr, &mac_addr);
-
 	ucfg_dp_update_inf_mac(hdd_ctx->psoc, &adapter->mac_addr, &mac_addr);
 	memcpy(&adapter->mac_addr, psta_mac_addr->sa_data, ETH_ALEN);
 	qdf_net_update_net_device_dev_addr(dev, psta_mac_addr->sa_data,