Procházet zdrojové kódy

qcacld-3.0: Use netdev to get dp_interface

Currently, while we request netdev stats
we use the MAC address to find the DP interface.
There is a possibility that while we are
passing mac address to find DP interface
in parallel dynamic MAC update can happen
which will cause MAC address mismatch,
which will result in the DP interface not found
issue.

To fix the issue, instead of MAC address use
netdev name to search DP interface from
the list of available DP interface.

Change-Id: Ib04ce2fc7193be4733b16707600a10d3d729813c
CRs-Fixed: 3247725
Amit Mehta před 2 roky
rodič
revize
14e5d5f4cb

+ 10 - 0
components/dp/core/inc/wlan_dp_main.h

@@ -134,6 +134,16 @@ struct wlan_dp_intf*
 dp_get_intf_by_macaddr(struct wlan_dp_psoc_context *dp_ctx,
 		       struct qdf_mac_addr *addr);
 
+/**
+ * dp_get_intf_by_netdev() - Api to Get interface from netdev
+ * @dp_ctx: DP context
+ * @dev: Pointer to network device
+ *
+ * Return: Pointer to DP interface.
+ */
+struct wlan_dp_intf*
+dp_get_intf_by_netdev(struct wlan_dp_psoc_context *dp_ctx, qdf_netdev_t dev);
+
 /* MAX iteration count to wait for dp packet process to complete */
 #define DP_TASK_MAX_WAIT_CNT  100
 /* Milli seconds to wait when packet is getting processed */

+ 19 - 0
components/dp/core/src/wlan_dp_main.c

@@ -128,6 +128,25 @@ dp_get_intf_by_macaddr(struct wlan_dp_psoc_context *dp_ctx,
 	return NULL;
 }
 
+struct wlan_dp_intf*
+dp_get_intf_by_netdev(struct wlan_dp_psoc_context *dp_ctx, qdf_netdev_t dev)
+{
+	struct wlan_dp_intf *dp_intf;
+
+	qdf_spin_lock_bh(&dp_ctx->intf_list_lock);
+	for (dp_get_front_intf_no_lock(dp_ctx, &dp_intf); dp_intf;
+	     dp_get_next_intf_no_lock(dp_ctx, dp_intf, &dp_intf)) {
+		if (!qdf_str_cmp(qdf_netdev_get_devname(dp_intf->dev),
+				 qdf_netdev_get_devname(dev))) {
+			qdf_spin_unlock_bh(&dp_ctx->intf_list_lock);
+			return dp_intf;
+		}
+	}
+	qdf_spin_unlock_bh(&dp_ctx->intf_list_lock);
+
+	return NULL;
+}
+
 /**
  * validate_interface_id() - Check if interface ID is valid
  * @intf_id: interface ID

+ 2 - 2
components/dp/dispatcher/inc/wlan_dp_ucfg_api.h

@@ -373,11 +373,11 @@ ucfg_dp_softap_start_xmit(qdf_nbuf_t nbuf, struct wlan_objmgr_vdev *vdev);
 
 /**
  * ucfg_dp_get_dev_stats() - Get netdev stats info
- * @intf_addr: DP interface MAC address
+ * @dev: Pointer to network device
  *
  * Return: qdf_net_dev_stats info
  */
-qdf_net_dev_stats *ucfg_dp_get_dev_stats(struct qdf_mac_addr *intf_addr);
+qdf_net_dev_stats *ucfg_dp_get_dev_stats(qdf_netdev_t dev);
 
 /**
  * ucfg_dp_inc_rx_pkt_stats() - DP increment RX pkt stats

+ 4 - 4
components/dp/dispatcher/src/wlan_dp_ucfg_api.c

@@ -1259,17 +1259,17 @@ void ucfg_dp_softap_tx_timeout(struct wlan_objmgr_vdev *vdev)
 	dp_softap_tx_timeout(dp_intf);
 }
 
-qdf_net_dev_stats *ucfg_dp_get_dev_stats(struct qdf_mac_addr *intf_addr)
+qdf_net_dev_stats *ucfg_dp_get_dev_stats(qdf_netdev_t dev)
 {
 	struct wlan_dp_intf *dp_intf;
 	struct wlan_dp_psoc_context *dp_ctx;
 
 	dp_ctx =  dp_get_context();
 
-	dp_intf = dp_get_intf_by_macaddr(dp_ctx, intf_addr);
+	dp_intf = dp_get_intf_by_netdev(dp_ctx, dev);
 	if (!dp_intf) {
-		dp_err("DP interface not found addr:"QDF_MAC_ADDR_FMT,
-		       QDF_MAC_ADDR_REF(intf_addr));
+		dp_err("DP interface not found dev: %s",
+		       qdf_netdev_get_devname(dev));
 		QDF_BUG(0);
 		return NULL;
 	}

+ 1 - 3
core/hdd/src/wlan_hdd_stats.c

@@ -6480,9 +6480,7 @@ int wlan_hdd_cfg80211_dump_station(struct wiphy *wiphy,
  */
 struct net_device_stats *hdd_get_stats(struct net_device *dev)
 {
-	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-
-	return (struct net_device_stats *)ucfg_dp_get_dev_stats(&adapter->mac_addr);
+	return (struct net_device_stats *)ucfg_dp_get_dev_stats(dev);
 }