diff mbox series

iw: event: add sta opmode changed command

Message ID 20191210144356.15377-1-markus.theil@tu-ilmenau.de (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series iw: event: add sta opmode changed command | expand

Commit Message

Markus Theil Dec. 10, 2019, 2:43 p.m. UTC
Parsing this command helps tracking num spatial stream
and bandwidth changes.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
 event.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff mbox series

Patch

diff --git a/event.c b/event.c
index 0cedeb9..7600781 100644
--- a/event.c
+++ b/event.c
@@ -708,6 +708,32 @@  static void parse_set_interface(struct nlattr **attrs)
 	printf("\n");
 }
 
+static void parse_sta_opmode_changed(struct nlattr **attrs)
+{
+	char macbuf[ETH_ALEN*3];
+
+	printf("sta opmode changed");
+
+	if (attrs[NL80211_ATTR_MAC]) {
+		mac_addr_n2a(macbuf, nla_data(attrs[NL80211_ATTR_MAC]));
+		printf(" %s", macbuf);
+	}
+
+	if (attrs[NL80211_ATTR_SMPS_MODE]) {
+		printf(" smps mode %i", nla_get_u8(attrs[NL80211_ATTR_SMPS_MODE]));
+	}
+
+	if (attrs[NL80211_ATTR_CHANNEL_WIDTH]) {
+		printf(" chan width %i", nla_get_u8(attrs[NL80211_ATTR_CHANNEL_WIDTH]));
+	}
+
+	if (attrs[NL80211_ATTR_NSS]) {
+		printf(" nss %i", nla_get_u8(attrs[NL80211_ATTR_NSS]));
+	}
+
+	printf("\n");
+}
+
 static int print_event(struct nl_msg *msg, void *arg)
 {
 	struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
@@ -1055,6 +1081,10 @@  static int print_event(struct nl_msg *msg, void *arg)
 		parse_set_interface(tb);
 		break;
 	}
+	case NL80211_CMD_STA_OPMODE_CHANGED: {
+		parse_sta_opmode_changed(tb);
+		break;
+	}
 	default:
 		printf("unknown event %d (%s)\n",
 		       gnlh->cmd, command_name(gnlh->cmd));