Parcourir la source

qcacld-3.0: Add support to reset def_link during dynamic mac addr update

Dynamic mac address update is a special case, where the
(sta)connection can change without the vdevs corresponding
to an interface. The tx/rx happens on the def_link of the
dp_intf, which does not get reset in case of dynamic mac
addr update. Due to this, all the tx of packets might be
attempted on an invalid dp_link, leading to drop of all
the packets queued for TX.

Add support to reset the def_link of an interface during
dynamic mac address update.

Change-Id: I1e87c083f39b56525f69c225117bcce538931dbb
CRs-Fixed: 3570440
Rakesh Pillai il y a 1 an
Parent
commit
273eee3139

+ 6 - 4
components/dp/dispatcher/inc/wlan_dp_ucfg_api.h

@@ -76,15 +76,17 @@ QDF_STATUS ucfg_dp_update_link_mac_addr(struct wlan_objmgr_vdev *vdev,
 					bool is_link_switch);
 
 /**
- * ucfg_dp_update_inf_mac() - update DP interface MAC address
+ * ucfg_dp_update_intf_mac() - update DP interface MAC address
  * @psoc: psoc handle
  * @cur_mac: Current MAC address
  * @new_mac: new MAC address
+ * @vdev: objmgr vdev handle to set the def_link in dp_intf
  *
  */
-void ucfg_dp_update_inf_mac(struct wlan_objmgr_psoc *psoc,
-			    struct qdf_mac_addr *cur_mac,
-			    struct qdf_mac_addr *new_mac);
+void ucfg_dp_update_intf_mac(struct wlan_objmgr_psoc *psoc,
+			     struct qdf_mac_addr *cur_mac,
+			     struct qdf_mac_addr *new_mac,
+			     struct wlan_objmgr_vdev *vdev);
 
 /**
  * ucfg_dp_destroy_intf() - DP module interface deletion

+ 20 - 3
components/dp/dispatcher/src/wlan_dp_ucfg_api.c

@@ -103,11 +103,13 @@ QDF_STATUS ucfg_dp_update_link_mac_addr(struct wlan_objmgr_vdev *vdev,
 	return status;
 }
 
-void ucfg_dp_update_inf_mac(struct wlan_objmgr_psoc *psoc,
-			    struct qdf_mac_addr *cur_mac,
-			    struct qdf_mac_addr *new_mac)
+void ucfg_dp_update_intf_mac(struct wlan_objmgr_psoc *psoc,
+			     struct qdf_mac_addr *cur_mac,
+			     struct qdf_mac_addr *new_mac,
+			     struct wlan_objmgr_vdev *vdev)
 {
 	struct wlan_dp_intf *dp_intf;
+	struct wlan_dp_link *dp_link;
 	struct wlan_dp_psoc_context *dp_ctx;
 
 	dp_ctx =  dp_psoc_get_priv(psoc);
@@ -126,6 +128,21 @@ void ucfg_dp_update_inf_mac(struct wlan_objmgr_psoc *psoc,
 
 	qdf_copy_macaddr(&dp_intf->mac_addr, new_mac);
 
+	/*
+	 * update of dp_intf mac address happens only during dynamic mac
+	 * address update. This is a special case, where the connection
+	 * can change without vdevs getting deleted.
+	 * Hence its expected to reset the def_link in dp_intf to the
+	 * def_link used by UMAC, for the next connection.
+	 */
+	dp_link = dp_get_vdev_priv_obj(vdev);
+	dp_info("Try def_link update for dp_intf %pK from %pK to %pK (intf %pK id %d)",
+		dp_intf, dp_intf->def_link, dp_link,
+		dp_link ? dp_link->dp_intf : NULL,
+		dp_link ? dp_link->link_id : 255);
+	if (dp_link && dp_link->dp_intf == dp_intf)
+		dp_intf->def_link = dp_link;
+
 	wlan_dp_set_vdev_direct_link_cfg(psoc, dp_intf);
 }
 

+ 3 - 2
core/hdd/src/wlan_hdd_cfg80211.c

@@ -21609,8 +21609,9 @@ hdd_adapter_update_mac_on_mode_change(struct hdd_adapter *adapter)
 		if (!link_adapter)
 			continue;
 
-		ucfg_dp_update_inf_mac(hdd_ctx->psoc, &link_adapter->mac_addr,
-				       &link_addr[i]);
+		ucfg_dp_update_intf_mac(hdd_ctx->psoc, &link_adapter->mac_addr,
+					&link_addr[i],
+					link_adapter->deflink->vdev);
 		qdf_copy_macaddr(&link_adapter->mac_addr, &link_addr[i]);
 	}
 	qdf_copy_macaddr(&adapter->link_info[i].link_addr, &link_addr[i]);

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

@@ -808,7 +808,8 @@ static int __hdd_hostapd_set_mac_address(struct net_device *dev, void *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);
+	ucfg_dp_update_intf_mac(hdd_ctx->psoc, &adapter->mac_addr, &mac_addr,
+				adapter->deflink->vdev);
 	memcpy(&adapter->mac_addr, psta_mac_addr->sa_data, ETH_ALEN);
 	qdf_net_update_net_device_dev_addr(dev, psta_mac_addr->sa_data,
 					   ETH_ALEN);

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

@@ -5893,7 +5893,8 @@ static int __hdd_set_mac_address(struct net_device *dev, void *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);
+	ucfg_dp_update_intf_mac(hdd_ctx->psoc, &adapter->mac_addr, &mac_addr,
+				adapter->deflink->vdev);
 	memcpy(&adapter->mac_addr, psta_mac_addr->sa_data, ETH_ALEN);
 	qdf_net_update_net_device_dev_addr(dev, psta_mac_addr->sa_data,
 					   ETH_ALEN);

+ 3 - 2
core/hdd/src/wlan_hdd_mlo.c

@@ -428,8 +428,9 @@ int hdd_update_vdev_mac_address(struct hdd_adapter *adapter,
 
 		/* Update DP intf and new link address in link adapter
 		 */
-		ucfg_dp_update_inf_mac(hdd_ctx->psoc, &link_adapter->mac_addr,
-				       &link_addrs[i]);
+		ucfg_dp_update_intf_mac(hdd_ctx->psoc, &link_adapter->mac_addr,
+					&link_addrs[i],
+					link_adapter->deflink->vdev);
 		qdf_copy_macaddr(&link_adapter->mac_addr, &link_addrs[i]);
 		qdf_copy_macaddr(&adapter->link_info[i].link_addr,
 				 &link_addrs[i]);

+ 3 - 2
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -775,8 +775,9 @@ int hdd_ndi_set_mode(const char *iface_name)
 			return -EFAULT;
 		}
 		ndi_mac_addr = &random_ndi_mac.bytes[0];
-		ucfg_dp_update_inf_mac(hdd_ctx->psoc, &adapter->mac_addr,
-				       (struct qdf_mac_addr *)ndi_mac_addr);
+		ucfg_dp_update_intf_mac(hdd_ctx->psoc, &adapter->mac_addr,
+					(struct qdf_mac_addr *)ndi_mac_addr,
+					adapter->deflink->vdev);
 		hdd_update_dynamic_mac(hdd_ctx, &adapter->mac_addr,
 				       (struct qdf_mac_addr *)ndi_mac_addr);
 		qdf_mem_copy(&adapter->mac_addr, ndi_mac_addr, ETH_ALEN);