Commit 4cb1ce7e authored by Sarika Sharma's avatar Sarika Sharma Committed by Johannes Berg
Browse files

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: default avatarSarika Sharma <quic_sarishar@quicinc.com>
Link: https://patch.msgid.link/20250528054420.3050133-11-quic_sarishar@quicinc.com


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 5e9129f5
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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:
+19 −0
Original line number Diff line number Diff line
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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) |
+27 −0
Original line number Diff line number Diff line
@@ -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,