wifi: mac80211: add link_sta_statistics ops to fill link station statistics

Currently, link station statistics for MLO are filled by mac80211.
But there are some statistics that kept by mac80211 might not be
accurate, so let the driver pre-fill the link statistics. The driver
can fill the values (indicating which field is filled, by setting the
filled bitmapin in link_station structure).
Statistics that driver don't fill are filled by mac80211.

Hence, add link_sta_statistics callback to fill link station statistics
for MLO in sta_set_link_sinfo() by drivers.

Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
Link: https://patch.msgid.link/20250528054420.3050133-11-quic_sarishar@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Sarika Sharma
2025-05-28 11:14:20 +05:30
committed by Johannes Berg
parent 5e9129f574
commit 4cb1ce7e25
4 changed files with 62 additions and 3 deletions

View File

@@ -4133,6 +4133,15 @@ struct ieee80211_prep_tx_info {
* Statistics that the driver doesn't fill will be filled by mac80211.
* The callback can sleep.
*
* @link_sta_statistics: Get link statistics for this station. For example with
* beacon filtering, the statistics kept by mac80211 might not be
* accurate, so let the driver pre-fill the statistics. The driver can
* fill most of the values (indicating which by setting the filled
* bitmap), but not all of them make sense - see the source for which
* ones are possible.
* Statistics that the driver doesn't fill will be filled by mac80211.
* The callback can sleep.
*
* @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
* bursting) for a hardware TX queue.
* Returns a negative error code on failure.
@@ -4627,6 +4636,10 @@ struct ieee80211_ops {
s64 offset);
void (*reset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
int (*tx_last_beacon)(struct ieee80211_hw *hw);
void (*link_sta_statistics)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_link_sta *link_sta,
struct link_station_info *link_sinfo);
/**
* @ampdu_action:

View File

@@ -631,6 +631,25 @@ static inline void drv_sta_statistics(struct ieee80211_local *local,
trace_drv_return_void(local);
}
static inline void drv_link_sta_statistics(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_link_sta *link_sta,
struct link_station_info *link_sinfo)
{
might_sleep();
lockdep_assert_wiphy(local->hw.wiphy);
sdata = get_bss_sdata(sdata);
if (!check_sdata_in_driver(sdata))
return;
trace_drv_link_sta_statistics(local, sdata, link_sta);
if (local->ops->link_sta_statistics)
local->ops->link_sta_statistics(&local->hw, &sdata->vif,
link_sta, link_sinfo);
trace_drv_return_void(local);
}
int drv_conf_tx(struct ieee80211_local *local,
struct ieee80211_link_data *link, u16 ac,
const struct ieee80211_tx_queue_params *params);

View File

@@ -2744,9 +2744,9 @@ static void sta_set_link_sinfo(struct sta_info *sta,
ether_addr_copy(link_sinfo->addr, link_sta_info->addr);
/* TODO: add drv_link_sta_statistics() ops to fill link_station
* statistics of station.
*/
drv_link_sta_statistics(sta->local, sdata,
link_sta_info->pub,
link_sinfo);
link_sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) |
BIT_ULL(NL80211_STA_INFO_BSS_PARAM) |

View File

@@ -1002,6 +1002,33 @@ DEFINE_EVENT(sta_event, drv_sta_statistics,
TP_ARGS(local, sdata, sta)
);
TRACE_EVENT(drv_link_sta_statistics,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_link_sta *link_sta),
TP_ARGS(local, sdata, link_sta),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
STA_ENTRY
__field(u32, link_id)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
STA_NAMED_ASSIGN(link_sta->sta);
__entry->link_id = link_sta->link_id;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " (link %d)",
LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->link_id
)
);
DEFINE_EVENT(sta_event, drv_sta_add,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,