wlan-ap-Telecominfraproject/feeds/ipq95xx/iw/patches/612-iw-Add-support-for-link-specific-station-dump-fields.patch
John Crispin 460050a114 ipq50xx: add CIF WF-198 support
Signed-off-by: John Crispin <john@phrozen.org>
2024-02-28 18:56:21 +01:00

116 lines
4.2 KiB
Diff

From 1898807476c589bf140d7cf9690f172e9c97ab18 Mon Sep 17 00:00:00 2001
From: Sivashankari Madhavan <quic_sivamadh@quicinc.com>
Date: Fri, 5 May 2023 10:34:40 +0530
Subject: [PATCH] iw: Add support for link specific station dump fields display
While connecting the AP with a station in SLO/MLO mode observe
the Dtim period and Beacon Interval as 0 in the station dump.
During the start AP, these fields are updated in the specific
link config. But when setting the station info, it's referring
to the sdata bss config. Due to this, observing the issue.
Fix it by updating these fields with corresponding link config data
per active link.
Signed-off-by: Sivashankari Madhavan <quic_sivamadh@quicinc.com>
---
nl80211.h | 8 ++++++++
station.c | 51 +++++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 51 insertions(+), 8 deletions(-)
Index: iw-5.19/station.c
===================================================================
--- iw-5.19.orig/station.c
+++ iw-5.19/station.c
@@ -148,9 +148,11 @@ static void parse_tid_stats(struct nlatt
printf("\n\tTXQs:%s", txqbuf);
}
-static void parse_bss_param(struct nlattr *bss_param_attr)
+static void parse_bss_param(struct nlattr *bss_param_attr,
+ struct nlattr *tb[NL80211_ATTR_MAX + 1])
{
struct nlattr *bss_param_info[NL80211_STA_BSS_PARAM_MAX + 1], *info;
+ struct nlattr *attrs;
static struct nla_policy bss_poilcy[NL80211_STA_BSS_PARAM_MAX + 1] = {
[NL80211_STA_BSS_PARAM_CTS_PROT] = { .type = NLA_FLAG },
[NL80211_STA_BSS_PARAM_SHORT_PREAMBLE] = { .type = NLA_FLAG },
@@ -159,17 +161,58 @@ static void parse_bss_param(struct nlatt
[NL80211_STA_BSS_PARAM_BEACON_INTERVAL] = { .type = NLA_U16 },
};
- if (nla_parse_nested(bss_param_info, NL80211_STA_BSS_PARAM_MAX,
- bss_param_attr, bss_poilcy)) {
- printf("failed to parse nested bss param attributes!");
+ if (tb[NL80211_ATTR_MLO_LINKS]) {
+ int ret = 0, dtim_offset = 0, beacon_int_offset = 0;
+ const char *dtim_indent = "", *beacon_int_indent = "";
+ char dtim_buf[MLD_MAX_LINK_BUF_SIZE],
+ beacon_int_buf[MLD_MAX_LINK_BUF_SIZE];
+
+ nla_for_each_nested(attrs, bss_param_attr, ret) {
+ if (nla_parse_nested(bss_param_info,
+ NL80211_STA_BSS_PARAM_MAX,
+ attrs, bss_poilcy)) {
+ printf("\nFailed to parse nested bss param attributes!\n");
+ }
+
+ info = bss_param_info[NL80211_STA_BSS_PARAM_DTIM_PERIOD];
+
+ if (info) {
+ dtim_offset += snprintf(dtim_buf + dtim_offset,
+ MLD_MAX_LINK_BUF_SIZE - dtim_offset,
+ "%s%u", dtim_indent,
+ nla_get_u8(info));
+ dtim_indent = ", ";
+ }
+
+ info = bss_param_info[NL80211_STA_BSS_PARAM_BEACON_INTERVAL];
+
+ if (info) {
+ beacon_int_offset += snprintf(beacon_int_buf + beacon_int_offset,
+ MLD_MAX_LINK_BUF_SIZE - beacon_int_offset,
+ "%s%u", beacon_int_indent,
+ nla_get_u16(info));
+ beacon_int_indent = ", ";
+ }
+ }
+
+ printf("\n\tDTIM period:\t%s",dtim_buf);
+
+ printf("\n\tbeacon interval:%s",beacon_int_buf);
+ } else {
+ if (nla_parse_nested(bss_param_info,
+ NL80211_STA_BSS_PARAM_MAX,
+ bss_param_attr, bss_poilcy)) {
+ printf("\nFailed to parse nested bss param attributes!\n");
+ }
+
+ info = bss_param_info[NL80211_STA_BSS_PARAM_DTIM_PERIOD];
+ if (info)
+ printf("\n\tDTIM period:\t%u", nla_get_u8(info));
+ info = bss_param_info[NL80211_STA_BSS_PARAM_BEACON_INTERVAL];
+ if (info)
+ printf("\n\tbeacon interval:%u", nla_get_u16(info));
}
- info = bss_param_info[NL80211_STA_BSS_PARAM_DTIM_PERIOD];
- if (info)
- printf("\n\tDTIM period:\t%u", nla_get_u8(info));
- info = bss_param_info[NL80211_STA_BSS_PARAM_BEACON_INTERVAL];
- if (info)
- printf("\n\tbeacon interval:%u", nla_get_u16(info));
info = bss_param_info[NL80211_STA_BSS_PARAM_CTS_PROT];
if (info) {
printf("\n\tCTS protection:");
@@ -622,7 +665,7 @@ static int print_sta_handler(struct nl_m
!strcmp((char *)arg, "-v"))
parse_tid_stats(sinfo[NL80211_STA_INFO_TID_STATS]);
if (sinfo[NL80211_STA_INFO_BSS_PARAM])
- parse_bss_param(sinfo[NL80211_STA_INFO_BSS_PARAM]);
+ parse_bss_param(sinfo[NL80211_STA_INFO_BSS_PARAM], tb);
if (sinfo[NL80211_STA_INFO_CONNECTED_TIME])
printf("\n\tconnected time:\t%u seconds",
nla_get_u32(sinfo[NL80211_STA_INFO_CONNECTED_TIME]));