mbox series

[RFC,v2,00/12] wifi: cfg80211/mac80211: add support to handle per link statistics of multi-link station

Message ID 20250117124554.3719808-1-quic_sarishar@quicinc.com (mailing list archive)
Headers show
Series wifi: cfg80211/mac80211: add support to handle per link statistics of multi-link station | expand

Message

Sarika Sharma Jan. 17, 2025, 12:45 p.m. UTC
Current implementation of NL80211_CMD_GET_STATION does not work
for multi-link operation(MLO) since in case of MLO only deflink
(or one of the links) is considered and not all links.

Hence, add the link_sinfo structure to provide infrastructure
for link-level station statistics for multi-link operation(MLO).

Additionally, accumulated stats for MLO are included in a concise
manner to provide a comprehensive overview of the ML stations.

NOTE:
   1. Current code changes are done to get an early feedback on design.
   2. Once RFC patches are approved will add the required driver changes.
   3. Ath12k changes are included in this series for reference to other
      driver changes.

V2:
 - Update cover letter to give more details on structural changes.
 - Split the patch(1/7) in two patches.
 - Do the required changes for MLO bringup before as seperate patches.
 - Remove link_sinfo naming to sinfo for better clarity on changes.
 - Add accumulated stats logic in cfg80211.
 - Add flag to indicate driver supports per-link station statistics or not.

Current flow:
  cfg80211:
  - Structure station_info is used to fill all station information (station
    level as well link level).
  - Nl80211_get_station() - locally define sinfo, call -.get_station() ops

  mac80211:
  - Sta_set_sinfo() - fill station information and call mac80211
    ops - .sta_statistics()(to fill the station_info structure).

Purposed flow:
 cfg80211:
  - Structure changes for station_info
    structure station_info {
      filled
      packets
      sta_flags
      ... etc // station specific fields
      link_station_info *links[IEEE80211_MLD_MAX_NUM_LINKS]
    }
    structure link_station_info {
      filled
      rates
      ...etc // all link specific fields
    }

  - Split station_info structure into station specific and link specific
    fields- (station_info and link_station_info).
  - Add array pointers in station_info structure for link_station_info.
    for non-ML use links[0], for ML use *links for each valid links.
  - Nl80211_get_station() - locally define sinfo, call -.get_station() ops.
  - Once link station information filled, fill mld level information in
    cfg80211_sta_set_mld_sinfo() for MLO.
  - Introduce a flag to indicate if driver provides per-link station
    statistics or not and embed NL attributes accordingly.

 mac80211:
  - Sta_set_sinfo() - fill station specific information and call
    sta_set_link_sinfo()
     a. If MLO and driver provides per-link statistics
         - For each link fill link specific data in *links[link_id]
         - Call mac80211 ops for each link- .link_sta_statistics() to
           fill link statistics.
     b. If non-ML or driver does not provides per-link statistics
         - Fill link level data for links[0]
         - Call mac80211 ops- .link_sta_statistics() to fill link statistics
  - Maintain accumulated data for removed links in sta_info structure
    and fill in to station_info structure for consistency.

Alternate approach:
   - Keep sinfo structure as it is and use this for non-ML or
     accumulated statistics for ML station.
   - Add link sinfo for links with only certain link specific statistics.
   - Keep mac_op_sta_statistics at MLD level and let driver fill the
     MLO and link level data, if driver not filling let mac80211 fill
     the data.
   - Corresponding changes done to embed statistics into the NL message
     based on the sinfo/link_sinfo.
	 
pseudo code for alternate approach:

 - cfg80211/mac80211:
	structure sinfo {
	filled
	packets
	bytes
	etc... //retain the structure as it was there before
	add structure link_sinfo{
		filled
		packets
		bytes
		etc ... //all link level applicable fields
		}
	}
 - Call drv_sta_statistics at MLO level or deflink if non-ML and let
   driver fill MLO statistics and link level statistics.
 - Check if sinfo->filled is set if not fill the corresponding data
   in sinfo and link sinfo for MLO or sinfo for non-ML.

Why not considered this approach for implementation:

 - The required changes here to other drivers are minimal. However,
   since sinfo is retained, every field needs to be filled at the MLO
   level. MLO statistics for tx_duration, pertid, etc., may not be
   very useful.
 - If these elements are not filled for MLO, they will remain unused
   in sinfo.

Sarika Sharma (12):
  wifi: cfg80211: reorg sinfo structure elements for mesh
  wifi: mac80211: add API to populated mesh related fields in sinfo
  wifi: mac80211: add support towards MLO handling of station statistics
  wifi: mac80211: introduce sta_set_link_sinfo API to add support
    towards MLO statistics
  wifi: cfg80211: introduced nl80211_fill_link_station API for link
    attributes towards MLO
  wifi: cfg80211: reorg sinfo structure elements for MLO
  wifi: cfg80211: extend statistics for link level in sinfo
  wifi: cfg80211: add flag to indicate driver supports ML station
    statistics
  wifi: cfg80211: add accumulated statistics for MLO links
  wifi: mac80211: add support to accumulate removed link statistics
  wifi: cfg80211: add additional MLO statistics
  wifi: ath12k: correctly fetch arsta for MLO

 drivers/net/wireless/ath/ath12k/mac.c        |  22 +-
 drivers/net/wireless/intel/iwlwifi/dvm/lib.c |   2 +-
 include/net/cfg80211.h                       | 210 ++++++++----
 include/net/mac80211.h                       |  21 +-
 net/mac80211/driver-ops.h                    |  14 +-
 net/mac80211/ethtool.c                       |  31 +-
 net/mac80211/ibss.c                          |   4 +-
 net/mac80211/sta_info.c                      | 340 +++++++++++++------
 net/mac80211/sta_info.h                      |  30 +-
 net/mac80211/trace.h                         |   2 +-
 net/mac80211/util.c                          |  18 +-
 net/wireless/nl80211.c                       | 298 +++++++++++++---
 net/wireless/trace.h                         |  33 +-
 net/wireless/util.c                          |   6 +-
 net/wireless/wext-compat.c                   |  22 +-
 15 files changed, 743 insertions(+), 310 deletions(-)


base-commit: 7bf1659bad4e9413cdba132ef9cbd0caa9cabcc4