diff --git a/components/dp/core/inc/wlan_dp_main.h b/components/dp/core/inc/wlan_dp_main.h index 8fc36d8888..98228a758d 100644 --- a/components/dp/core/inc/wlan_dp_main.h +++ b/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 */ diff --git a/components/dp/core/src/wlan_dp_main.c b/components/dp/core/src/wlan_dp_main.c index b80ad40e94..d7e154cdb2 100644 --- a/components/dp/core/src/wlan_dp_main.c +++ b/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 diff --git a/components/dp/dispatcher/inc/wlan_dp_ucfg_api.h b/components/dp/dispatcher/inc/wlan_dp_ucfg_api.h index 9536d9f2e7..26f5343fc9 100644 --- a/components/dp/dispatcher/inc/wlan_dp_ucfg_api.h +++ b/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 diff --git a/components/dp/dispatcher/src/wlan_dp_ucfg_api.c b/components/dp/dispatcher/src/wlan_dp_ucfg_api.c index 52d3d598a9..d3f03c5365 100644 --- a/components/dp/dispatcher/src/wlan_dp_ucfg_api.c +++ b/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; } diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index d5b165c9a5..6a3f89455b 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/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); }