瀏覽代碼

qcacld-3.0: Use provision/derived list for MLD address

In current implementation ML adapter will get MLD address
from a separate pool of addresses rather than provision or
derived list.

Remove this separate pool for MLD address and get MLD address
from the provision list or derived list.

Change-Id: I11a10fe1331dba6d16f82cbd1ab4c04ada70acb6
CRs-Fixed: 3308051
Vinod Kumar Pirla 2 年之前
父節點
當前提交
093d9e5262
共有 5 個文件被更改,包括 23 次插入293 次删除
  1. 0 3
      core/hdd/inc/wlan_hdd_main.h
  2. 0 95
      core/hdd/inc/wlan_hdd_mlo.h
  3. 1 2
      core/hdd/src/wlan_hdd_cfg.c
  4. 22 50
      core/hdd/src/wlan_hdd_main.c
  5. 0 143
      core/hdd/src/wlan_hdd_mlo.c

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

@@ -2024,9 +2024,6 @@ struct hdd_context {
 	bool is_wifi3_0_target;
 	bool dump_in_progress;
 	struct hdd_dual_sta_policy dual_sta_policy;
-#if defined(WLAN_FEATURE_11BE_MLO) && defined(CFG80211_11BE_BASIC)
-	struct hdd_mld_mac_info mld_mac_info;
-#endif
 #ifdef THERMAL_STATS_SUPPORT
 	bool is_therm_stats_in_progress;
 #endif

+ 0 - 95
core/hdd/inc/wlan_hdd_mlo.h

@@ -57,27 +57,6 @@ struct hdd_adapter_create_param {
 #endif
 
 #if defined(WLAN_FEATURE_11BE_MLO) && defined(CFG80211_11BE_BASIC)
-/**
- * struct hdd_mld_mac - hdd structure to hold mld address
- * @mld_mac: mld addr
- * @device_mode: Device mode for mld address
- */
-struct hdd_mld_mac {
-	struct qdf_mac_addr mld_addr;
-	uint8_t device_mode;
-};
-
-/**
- * struct hdd_mld_mac_info - HDD structure to hold mld mac address information
- * @num_mld_addr: Number of mld address supported
- * @mld_intf_addr_mask: mask to dervice the multiple mld address
- * @mld_mac_list: Mac address assigned for device mode
- */
-struct hdd_mld_mac_info {
-	uint8_t num_mld_addr;
-	unsigned long mld_intf_addr_mask;
-	struct hdd_mld_mac mld_mac_list[WLAN_MAX_MLD];
-};
 
 /**
  * struct hdd_mlo_adapter_info - Mlo specific adapter information
@@ -99,29 +78,6 @@ struct hdd_mlo_adapter_info {
 	struct hdd_adapter *link_adapter[WLAN_MAX_MLD];
 };
 
-/**
- * hdd_update_mld_mac_addr() - Derive mld mac address
- * @hdd_context: Global hdd context
- * @hw_macaddr: Hardware mac address
- *
- * This function derives mld mac address based on the input hardware mac address
- *
- * Return: none
- */
-void hdd_update_mld_mac_addr(struct hdd_context *hdd_ctx,
-			     struct qdf_mac_addr hw_macaddr);
-
-/**
- * wlan_hdd_get_mld_addr() - Function to get MLD address
- * @hdd_ctx: hdd_context pointer
- * @device_mode: QDF_DEVICE_MODE
- *
- * Function returns the mld address for device mode
- * Return: MLD address for success, NULL failure
- */
-uint8_t *wlan_hdd_get_mld_addr(struct hdd_context *hdd_ctx,
-			       uint8_t device_mode);
-
 /**
  * hdd_register_wdev() - Function to register only wdev
  * @sta_adapter : Station adapter linked with netdevice
@@ -155,36 +111,6 @@ QDF_STATUS hdd_wlan_unregister_mlo_interfaces(struct hdd_adapter *adapter,
  */
 void hdd_wlan_register_mlo_interfaces(struct hdd_context *hdd_ctx);
 
-/**
- * hdd_update_dynamic_mld_mac_addr() - Updates the dynamic MLD MAC list
- * @hdd_ctx: Pointer to HDD context
- * @curr_mac_addr: Current interface mac address
- * @new_mac_addr: New mac address which needs to be updated
- *
- * This function updates newly configured MAC address to the
- * dynamic MLD MAC address list corresponding to the current
- * adapter MLD MAC address
- *
- * Return: None
- */
-void hdd_update_dynamic_mld_mac_addr(struct hdd_context *hdd_ctx,
-				     struct qdf_mac_addr *curr_mac_addr,
-				     struct qdf_mac_addr *new_mac_addr,
-				     uint8_t device_mode);
-
-/**
- * hdd_populate_mld_vdev_params() - populates vdev object mld params
- * @adapter: HDD adapter
- * @vdev_params: vdev create parameters
- *
- * This function populates the mld params in the vdev create params
- *
- * Return: None
- */
-void
-hdd_populate_mld_vdev_params(struct hdd_adapter *adapter,
-			     struct wlan_vdev_create_params *vdev_params);
-
 /**
  * hdd_adapter_set_ml_adapter() - set adapter as ml adapter
  * @adapter: HDD adapter
@@ -203,19 +129,6 @@ void hdd_adapter_set_ml_adapter(struct hdd_adapter *adapter);
  */
 struct hdd_adapter *hdd_get_ml_adater(struct hdd_context *hdd_ctx);
 #else
-static inline
-void hdd_update_mld_mac_addr(struct hdd_context *hdd_ctx,
-			     struct qdf_mac_addr hw_macaddr)
-{
-}
-
-static inline
-uint8_t *wlan_hdd_get_mld_addr(struct hdd_context *hdd_ctx,
-			       uint8_t device_mode)
-{
-	return NULL;
-}
-
 static inline
 QDF_STATUS hdd_wlan_unregister_mlo_interfaces(struct hdd_adapter *adapter,
 					      bool rtnl_held)
@@ -235,14 +148,6 @@ void hdd_wlan_register_mlo_interfaces(struct hdd_context *hdd_ctx)
 {
 }
 
-static inline
-void hdd_update_dynamic_mld_mac_addr(struct hdd_context *hdd_ctx,
-				     struct qdf_mac_addr *curr_mac_addr,
-				     struct qdf_mac_addr *new_macaddr,
-				     uint8_t device_mode)
-{
-}
-
 static inline void
 hdd_adapter_set_ml_adapter(struct hdd_adapter *adapter)
 {

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

@@ -318,8 +318,7 @@ QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx)
 			     &hdd_ctx->derived_mac_addr[0].bytes[0],
 			     sizeof(custom_mac_addr));
 
-	hdd_update_mld_mac_addr(hdd_ctx, custom_mac_addr);
-	sme_set_custom_mac_addr(custom_mac_addr.bytes);
+	qdf_status = sme_set_custom_mac_addr(custom_mac_addr.bytes);
 
 config_exit:
 	qdf_mem_free(temp);

+ 22 - 50
core/hdd/src/wlan_hdd_main.c

@@ -1323,7 +1323,6 @@ void hdd_update_macaddr(struct hdd_context *hdd_ctx,
 			QDF_MAC_ADDR_REF(hdd_ctx->derived_mac_addr[i].bytes));
 		hdd_ctx->num_derived_addr++;
 	}
-	hdd_update_mld_mac_addr(hdd_ctx, hw_macaddr);
 }
 
 #ifdef FEATURE_WLAN_TDLS
@@ -4839,15 +4838,22 @@ static void
 hdd_set_mld_address(struct hdd_adapter *adapter, struct hdd_context *hdd_ctx,
 		    struct qdf_mac_addr *mac_addr)
 {
+	int i;
 	bool eht_capab;
+	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) {
-		hdd_update_dynamic_mld_mac_addr(hdd_ctx, &adapter->mld_addr,
-						mac_addr,
-						adapter->device_mode);
-		memcpy(&adapter->mld_addr, mac_addr, ETH_ALEN);
+		mlo_adapter_info = &adapter->mlo_adapter_info;
+		for (i = 0; i < WLAN_MAX_MLD; i++) {
+			link_adapter = mlo_adapter_info->link_adapter[i];
+			if (link_adapter)
+				qdf_copy_macaddr(&link_adapter->mld_addr,
+						 mac_addr);
+		}
+		qdf_copy_macaddr(&adapter->mld_addr, mac_addr);
 	}
 }
 
@@ -5171,8 +5177,8 @@ static int __hdd_set_mac_address(struct net_device *dev, void *addr)
 	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);
-	else
-		hdd_update_dynamic_mac(hdd_ctx, &adapter->mac_addr, &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);
@@ -6254,8 +6260,10 @@ hdd_populate_vdev_create_params(struct hdd_adapter *adapter,
 
 	vdev_params->opmode = adapter->device_mode;
 
-	if (eht_capab)
-		hdd_populate_mld_vdev_params(adapter, vdev_params);
+	if (eht_capab) {
+		qdf_mem_copy(vdev_params->mldaddr, adapter->mld_addr.bytes,
+			     QDF_MAC_ADDR_SIZE);
+	}
 
 	vdev_params->size_vdev_priv = sizeof(struct vdev_osif_priv);
 	hdd_exit();
@@ -13650,7 +13658,6 @@ static int hdd_platform_wlan_mac(struct hdd_context *hdd_ctx)
 	struct device *dev = hdd_ctx->parent_dev;
 	tSirMacAddr mac_addr;
 	QDF_STATUS status;
-	struct qdf_mac_addr hw_macaddr;
 
 	addr = hdd_get_platform_wlan_mac_buff(dev, &no_of_mac_addr);
 
@@ -13671,13 +13678,8 @@ static int hdd_platform_wlan_mac(struct hdd_context *hdd_ctx)
 		qdf_mem_copy(buf, addr, QDF_MAC_ADDR_SIZE);
 		hdd_info("provisioned MAC Addr [%d] "QDF_MAC_ADDR_FMT, iter,
 			 QDF_MAC_ADDR_REF(buf));
-		if (iter == 0) {
-			qdf_mem_copy(&hw_macaddr.bytes, buf, QDF_MAC_ADDR_SIZE);
-			hdd_update_mld_mac_addr(hdd_ctx, hw_macaddr);
-		}
 	}
 
-
 	hdd_ctx->num_provisioned_addr = no_of_mac_addr;
 
 	if (hdd_ctx->config->mac_provision) {
@@ -13697,11 +13699,6 @@ static int hdd_platform_wlan_mac(struct hdd_context *hdd_ctx)
 			qdf_mem_copy(buf, addr, QDF_MAC_ADDR_SIZE);
 			hdd_debug("derived MAC Addr [%d] "QDF_MAC_ADDR_FMT, iter,
 				  QDF_MAC_ADDR_REF(buf));
-			if (iter == 0) {
-				qdf_mem_copy(&hw_macaddr.bytes, buf,
-					     QDF_MAC_ADDR_SIZE);
-				hdd_update_mld_mac_addr(hdd_ctx, hw_macaddr);
-			}
 		}
 		hdd_ctx->num_derived_addr = no_of_mac_addr;
 	}
@@ -13762,7 +13759,6 @@ static int hdd_initialize_mac_address(struct hdd_context *hdd_ctx)
 {
 	QDF_STATUS status;
 	int ret;
-	bool update_mac_addr_to_fw = true;
 
 	ret = hdd_platform_wlan_mac(hdd_ctx);
 	if (!ret) {
@@ -13784,7 +13780,6 @@ static int hdd_initialize_mac_address(struct hdd_context *hdd_ctx)
 	/* Use fw provided MAC */
 	if (!qdf_is_macaddr_zero(&hdd_ctx->hw_macaddr)) {
 		hdd_update_macaddr(hdd_ctx, hdd_ctx->hw_macaddr, false);
-		update_mac_addr_to_fw = false;
 		return 0;
 	} else if (hdd_generate_macaddr_auto(hdd_ctx) != 0) {
 		struct qdf_mac_addr mac_addr;
@@ -13799,11 +13794,9 @@ static int hdd_initialize_mac_address(struct hdd_context *hdd_ctx)
 		hdd_update_macaddr(hdd_ctx, mac_addr, true);
 	}
 
-	if (update_mac_addr_to_fw) {
-		ret = hdd_update_mac_addr_to_fw(hdd_ctx);
-		if (ret)
-			hdd_err("MAC address out-of-sync, ret:%d", ret);
-	}
+	ret = hdd_update_mac_addr_to_fw(hdd_ctx);
+	if (ret)
+		hdd_err("MAC address out-of-sync, ret:%d", ret);
 	return ret;
 }
 
@@ -15200,28 +15193,6 @@ destroy_sync:
 	return status;
 }
 
-#if defined(WLAN_FEATURE_11BE_MLO) && defined(CFG80211_11BE_BASIC)
-static
-uint8_t *wlan_hdd_get_mlo_intf_addr(struct hdd_context *hdd_ctx,
-				    enum QDF_OPMODE interface_type)
-{
-		bool eht_capab;
-
-		ucfg_psoc_mlme_get_11be_capab(hdd_ctx->psoc, &eht_capab);
-		if (eht_capab)
-			return wlan_hdd_get_mld_addr(hdd_ctx, QDF_STA_MODE);
-		else
-			return wlan_hdd_get_intf_addr(hdd_ctx, QDF_STA_MODE);
-}
-#else
-static inline
-uint8_t *wlan_hdd_get_mlo_intf_addr(struct hdd_context *hdd_ctx,
-				    enum QDF_OPMODE interface_type)
-{
-		return wlan_hdd_get_intf_addr(hdd_ctx, QDF_STA_MODE);
-}
-#endif
-
 #ifdef WLAN_OPEN_P2P_INTERFACE
 /**
  * hdd_open_p2p_interface - Open P2P interface
@@ -15362,7 +15333,7 @@ hdd_open_adapters_for_mission_mode(struct hdd_context *hdd_ctx)
 	if (dot11p_mode == CFG_11P_STANDALONE)
 		return hdd_open_ocb_interface(hdd_ctx);
 
-	mac_addr = wlan_hdd_get_mlo_intf_addr(hdd_ctx, QDF_STA_MODE);
+	mac_addr = wlan_hdd_get_intf_addr(hdd_ctx, QDF_STA_MODE);
 	if (!mac_addr)
 		return QDF_STATUS_E_INVAL;
 
@@ -15387,6 +15358,7 @@ hdd_open_adapters_for_mission_mode(struct hdd_context *hdd_ctx)
 	 * should go on this new interface.
 	 */
 	if (wlan_hdd_is_vdev_creation_allowed(hdd_ctx->psoc)) {
+		qdf_mem_zero(&params, sizeof(params));
 		mac_addr = wlan_hdd_get_intf_addr(hdd_ctx, QDF_NAN_DISC_MODE);
 		if (!mac_addr)
 			goto err_close_adapters;

+ 0 - 143
core/hdd/src/wlan_hdd_mlo.c

@@ -30,57 +30,6 @@
 #include "wlan_psoc_mlme_ucfg_api.h"
 
 #if defined(CFG80211_11BE_BASIC)
-void hdd_update_mld_mac_addr(struct hdd_context *hdd_ctx,
-			     struct qdf_mac_addr hw_macaddr)
-{
-	uint8_t i;
-	struct hdd_mld_mac_info *mac_info;
-	struct qdf_mac_addr temp_addr;
-
-	qdf_mem_copy(temp_addr.bytes, hw_macaddr.bytes,
-		     sizeof(struct qdf_mac_addr));
-
-	mac_info = &hdd_ctx->mld_mac_info;
-	for (i = 0; i < WLAN_MAX_MLD; i++) {
-		eth_random_addr(temp_addr.bytes);
-		qdf_mem_copy(mac_info->mld_mac_list[i].mld_addr.bytes,
-			     temp_addr.bytes, QDF_MAC_ADDR_SIZE);
-
-		hdd_debug("mld addr[%d]: " QDF_MAC_ADDR_FMT, i,
-		    QDF_MAC_ADDR_REF(mac_info->mld_mac_list[i].mld_addr.bytes));
-
-		mac_info->mld_mac_list[i].device_mode = QDF_MAX_NO_OF_MODE;
-		mac_info->num_mld_addr++;
-
-		hdd_debug("num_mld_addr: %d", mac_info->num_mld_addr);
-	};
-}
-
-uint8_t *wlan_hdd_get_mld_addr(struct hdd_context *hdd_ctx, uint8_t device_mode)
-{
-	int i;
-	struct hdd_mld_mac_info *mac_info;
-
-	if (device_mode != QDF_STA_MODE && device_mode != QDF_SAP_MODE)
-		return NULL;
-
-	mac_info = &hdd_ctx->mld_mac_info;
-	for (i = 0; i <  mac_info->num_mld_addr; i++) {
-		if (mac_info->mld_mac_list[i].device_mode == device_mode)
-			return mac_info->mld_mac_list[i].mld_addr.bytes;
-	}
-
-	i = qdf_ffz(mac_info->mld_intf_addr_mask);
-	if (i < 0 || i >= mac_info->num_mld_addr)
-		return NULL;
-	qdf_atomic_set_bit(i, &mac_info->mld_intf_addr_mask);
-	hdd_nofl_debug("Assigning MLD MAC from derived list " QDF_MAC_ADDR_FMT,
-		    QDF_MAC_ADDR_REF(mac_info->mld_mac_list[i].mld_addr.bytes));
-
-	mac_info->mld_mac_list[i].device_mode = device_mode;
-	return mac_info->mld_mac_list[i].mld_addr.bytes;
-}
-
 #ifdef CFG80211_IFTYPE_MLO_LINK_SUPPORT
 static
 void wlan_hdd_register_ml_link(struct hdd_adapter *sta_adapter,
@@ -239,61 +188,6 @@ void hdd_wlan_register_mlo_interfaces(struct hdd_context *hdd_ctx)
 	}
 }
 
-void hdd_update_dynamic_mld_mac_addr(struct hdd_context *hdd_ctx,
-				     struct qdf_mac_addr *curr_mac_addr,
-				     struct qdf_mac_addr *new_mac_addr,
-				     uint8_t device_mode)
-{
-	uint8_t i;
-	struct hdd_mld_mac_info *mac_info;
-
-	hdd_enter();
-
-	mac_info = &hdd_ctx->mld_mac_info;
-	for (i = 0; i < WLAN_MAX_MLD; i++) {
-		if (device_mode != QDF_STA_MODE)
-			continue;
-		if (!qdf_mem_cmp(curr_mac_addr->bytes,
-				 mac_info->mld_mac_list[i].mld_addr.bytes,
-				 sizeof(struct qdf_mac_addr))) {
-			qdf_mem_copy(mac_info->mld_mac_list[i].mld_addr.bytes,
-				     new_mac_addr->bytes,
-				     sizeof(struct qdf_mac_addr));
-			break;
-		}
-	}
-	hdd_exit();
-}
-
-/**
- * MLD address can be shared with the same device mode but should be different
- * across device modes. Return error if the macaddress is currently held by a
- * different device mode.
- */
-static
-QDF_STATUS hdd_check_for_existing_mldaddr(struct hdd_context *hdd_ctx,
-					  uint8_t *mac_addr,
-					  uint32_t device_mode)
-{
-	struct hdd_adapter *adapter, *next_adapter = NULL;
-	wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CHECK_FOR_EXISTING_MACADDR;
-
-	hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
-					   dbgid) {
-		if (adapter->device_mode != device_mode &&
-		    !qdf_mem_cmp(adapter->mac_addr.bytes, mac_addr,
-		    sizeof(struct qdf_mac_addr))) {
-			hdd_adapter_dev_put_debug(adapter, dbgid);
-			if (next_adapter)
-				hdd_adapter_dev_put_debug(next_adapter, dbgid);
-			return QDF_STATUS_E_FAILURE;
-		}
-		hdd_adapter_dev_put_debug(adapter, dbgid);
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-
 #ifdef CFG80211_MLD_MAC_IN_WDEV
 static inline
 void wlan_hdd_populate_mld_address(struct hdd_adapter *adapter,
@@ -309,43 +203,6 @@ void wlan_hdd_populate_mld_address(struct hdd_adapter *adapter,
 {
 }
 #endif
-void
-hdd_populate_mld_vdev_params(struct hdd_adapter *adapter,
-			     struct wlan_vdev_create_params *vdev_params)
-{
-	uint8_t *mld_addr;
-	QDF_STATUS qdf_status;
-	uint8_t device_mode = adapter->device_mode;
-
-	if (device_mode != QDF_SAP_MODE &&
-	    !adapter->mlo_adapter_info.is_ml_adapter &&
-	    !adapter->mlo_adapter_info.is_link_adapter)
-		return;
-
-	mld_addr = wlan_hdd_get_mld_addr(adapter->hdd_ctx,
-					 adapter->device_mode);
-	if (mld_addr) {
-		/**
-		 * Check if this mld address is getting used by any other
-		 * device mode netdev
-		 */
-		qdf_status = hdd_check_for_existing_mldaddr(adapter->hdd_ctx,
-							    mld_addr,
-							    device_mode);
-		if (QDF_IS_STATUS_ERROR(qdf_status)) {
-			qdf_mem_copy(vdev_params->mldaddr,
-				     adapter->mac_addr.bytes,
-				     QDF_MAC_ADDR_SIZE);
-			return;
-		}
-		qdf_mem_copy(vdev_params->mldaddr, mld_addr,
-			     QDF_NET_MAC_ADDR_MAX_LEN);
-		qdf_mem_copy(adapter->mld_addr.bytes, mld_addr,
-			     QDF_NET_MAC_ADDR_MAX_LEN);
-		wlan_hdd_populate_mld_address(adapter, mld_addr);
-	}
-}
-
 void
 hdd_adapter_set_ml_adapter(struct hdd_adapter *adapter)
 {