qcacmn: Use peer mac to get station stats
Currently, it uses the dev mac as peer mac addr for parameter and
the function wlan_obj_psoc_peerlist_get_peer_by_pdev_id returns
NULL because the mac addr does not match. Then the callback will
be ignored for WMI_UPDATE_STATS_EVENTID.
Change-Id: I6e257d3103315bbacb66b3f5db660cfa883966b5
CRs-Fixed: 2272056
diff --git a/os_if/linux/cp_stats/src/wlan_cfg80211_mc_cp_stats.c b/os_if/linux/cp_stats/src/wlan_cfg80211_mc_cp_stats.c
index 10ec1d8..f0fdcea 100644
--- a/os_if/linux/cp_stats/src/wlan_cfg80211_mc_cp_stats.c
+++ b/os_if/linux/cp_stats/src/wlan_cfg80211_mc_cp_stats.c
@@ -27,6 +27,7 @@
#include <wlan_cp_stats_mc_ucfg_api.h>
#include <wlan_cfg80211_mc_cp_stats.h>
#include "wlan_osif_request_manager.h"
+#include "wlan_objmgr_peer_obj.h"
/* max time in ms, caller may wait for stats request get serviced */
#define CP_STATS_WAIT_TIME_STAT 800
@@ -212,6 +213,7 @@
void *cookie;
QDF_STATUS status;
struct request_info info = {0};
+ struct wlan_objmgr_peer *peer;
struct tx_power_priv *priv = NULL;
struct osif_request *request = NULL;
static const struct osif_request_params params = {
@@ -230,8 +232,13 @@
info.u.get_tx_power_cb = get_tx_power_cb;
info.vdev_id = wlan_vdev_get_id(vdev);
info.pdev_id = wlan_objmgr_pdev_get_pdev_id(wlan_vdev_get_pdev(vdev));
- qdf_mem_copy(info.peer_mac_addr, wlan_vdev_mlme_get_macaddr(vdev),
- WLAN_MACADDR_LEN);
+ peer = wlan_vdev_get_bsspeer(vdev);
+ if (!peer) {
+ ret = -EINVAL;
+ goto peer_is_null;
+ }
+ qdf_mem_copy(info.peer_mac_addr, peer->macaddr, WLAN_MACADDR_LEN);
+
status = ucfg_mc_cp_stats_send_stats_request(vdev,
TYPE_CONNECTION_TX_POWER,
&info);
@@ -259,6 +266,7 @@
}
}
+peer_is_null:
/*
* either we never sent a request, we sent a request and
* received a response or we sent a request and timed out.
@@ -384,6 +392,7 @@
void *cookie;
QDF_STATUS status;
struct stats_event *priv;
+ struct wlan_objmgr_peer *peer;
struct osif_request *request;
struct request_info info = {0};
static const struct osif_request_params params = {
@@ -404,8 +413,13 @@
info.u.get_station_stats_cb = get_station_stats_cb;
info.vdev_id = wlan_vdev_get_id(vdev);
info.pdev_id = wlan_objmgr_pdev_get_pdev_id(wlan_vdev_get_pdev(vdev));
- qdf_mem_copy(info.peer_mac_addr, wlan_vdev_mlme_get_macaddr(vdev),
- WLAN_MACADDR_LEN);
+ peer = wlan_vdev_get_bsspeer(vdev);
+ if (!peer) {
+ ret = -EINVAL;
+ goto peer_is_null;
+ }
+ qdf_mem_copy(info.peer_mac_addr, peer->macaddr, WLAN_MACADDR_LEN);
+
status = ucfg_mc_cp_stats_send_stats_request(vdev, TYPE_STATION_STATS,
&info);
if (QDF_IS_STATUS_ERROR(status)) {
@@ -420,6 +434,7 @@
*out = *priv;
}
+peer_is_null:
/*
* either we never sent a request, we sent a request and
* received a response or we sent a request and timed out.