From patchwork Mon Feb 11 17:04:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 10806367 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 674AE6C2 for ; Mon, 11 Feb 2019 17:04:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 521492A473 for ; Mon, 11 Feb 2019 17:04:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 461EC2A528; Mon, 11 Feb 2019 17:04:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F7EE2A473 for ; Mon, 11 Feb 2019 17:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729806AbfBKREh (ORCPT ); Mon, 11 Feb 2019 12:04:37 -0500 Received: from mail.toke.dk ([52.28.52.200]:39217 "EHLO mail.toke.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728106AbfBKREg (ORCPT ); Mon, 11 Feb 2019 12:04:36 -0500 Subject: [PATCH 1/3] iw: Add command to set airtime weight DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1549904674; bh=sxwTZCTFZvn0qpe9FpwDc9n7OJoBbdRCnW+i3x5MFZA=; h=Subject:From:To:Date:From; b=vBQJmP41guX2YDAOmZp35IvMM70ewKq71FXIf9lhCsAZGoHz83EezSBqzh8EqFKB+ a4oOZNoPc/fGS9OmIWA4ZA0miE3P+eyr9SOmHC6nT3FocCbMuShT3ro//VnHae5uiq ULROwtCiZ/TWSXPN9+6MaGtp6cqYIx/8b4MytrqK0BWAXFXcLjLwrPT9cZKx28OkEG l4Ihw0/+vxRhSBaflqBoCyOlTQAsF5dWYW2t5gr5zpIVmveTRYxr2OfnooMyv/1t2o bR5ZReBI1GkstcFE4BXTwYUlNbw+uvo9sOaAXaY5Dw4YzQjP2g0zm9JpXSpu9um2W5 J3x7iB+37nWfw== From: Toke =?utf-8?q?H=C3=B8iland-J=C3=B8rgensen?= To: linux-wireless@vger.kernel.org Date: Mon, 11 Feb 2019 18:04:34 +0100 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <154990467406.6770.8841156470323507480.stgit@alrua-x1> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds a new iw command to set the airtime weight for a station, support for which was recently introduced into mac80211. Signed-off-by: Toke Høiland-Jørgensen --- station.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/station.c b/station.c index e1477ef..536120c 100644 --- a/station.c +++ b/station.c @@ -651,6 +651,7 @@ COMMAND(station, del, " [subtype ] [reason-code ]", static const struct cmd *station_set_plink; static const struct cmd *station_set_vlan; static const struct cmd *station_set_mesh_power_mode; +static const struct cmd *station_set_airtime_weight; static const struct cmd *select_station_cmd(int argc, char **argv) { @@ -662,6 +663,8 @@ static const struct cmd *select_station_cmd(int argc, char **argv) return station_set_vlan; if (strcmp(argv[1], "mesh_power_mode") == 0) return station_set_mesh_power_mode; + if (strcmp(argv[1], "airtime_weight") == 0) + return station_set_airtime_weight; return NULL; } @@ -813,6 +816,54 @@ COMMAND_ALIAS(station, set, " mesh_power_mode " "Set link-specific mesh power mode for this station", select_station_cmd, station_set_mesh_power_mode); +static int handle_station_set_airtime_weight(struct nl80211_state *state, + struct nl_msg *msg, + int argc, char **argv, + enum id_input id) +{ + unsigned char mac_addr[ETH_ALEN]; + unsigned long airtime_weight = 0; + char *err = NULL; + + if (argc < 3) + return 1; + + if (mac_addr_a2n(mac_addr, argv[0])) { + fprintf(stderr, "invalid mac address\n"); + return 2; + } + argc--; + argv++; + + if (strcmp("airtime_weight", argv[0]) != 0) + return 1; + argc--; + argv++; + + airtime_weight = strtoul(argv[0], &err, 0); + if (err && *err) { + fprintf(stderr, "invalid airtime weight\n"); + return 2; + } + argc--; + argv++; + + if (argc) + return 1; + + NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); + NLA_PUT_U16(msg, NL80211_ATTR_AIRTIME_WEIGHT, airtime_weight); + + return 0; + nla_put_failure: + return -ENOBUFS; + +} +COMMAND_ALIAS(station, set, " airtime_weight ", + NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_airtime_weight, + "Set airtime weight for this station.", + select_station_cmd, station_set_airtime_weight); + static int handle_station_dump(struct nl80211_state *state, struct nl_msg *msg, int argc, char **argv, From patchwork Mon Feb 11 17:04:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 10806369 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD4DF6C2 for ; Mon, 11 Feb 2019 17:04:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B67672A473 for ; Mon, 11 Feb 2019 17:04:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAC432A528; Mon, 11 Feb 2019 17:04:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5121E2A473 for ; Mon, 11 Feb 2019 17:04:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729826AbfBKREj (ORCPT ); Mon, 11 Feb 2019 12:04:39 -0500 Received: from mail.toke.dk ([52.28.52.200]:55017 "EHLO mail.toke.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729148AbfBKREh (ORCPT ); Mon, 11 Feb 2019 12:04:37 -0500 Subject: [PATCH 2/3] iw: Add printing of station tx duration and airtime weight DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1549904674; bh=4GkId4IC3bp4udG1xQUuZAlhtGc7HIzCJ22On33V9vU=; h=Subject:From:To:Date:In-Reply-To:References:From; b=CgWSWm2VHruCljGEAckkvnL6ipDCYRXE5eJQ7NQoFXazVe6lBE8xZLy/KNfQEI1UY c/oF+UbX6P24e0fVFldD+2jTWkD8Mgq2s27a5HzpD95Y3dDFIUiih7AmBzrznDjjK9 F3iMHsyxllg0UI25NlbFz5kxozCPSJdHw7ry2lRDwVm3lEdwsmwRSOKpSRKMC+8R/B VUyaZf65/MoMMBI4wzLFt9i4plAAmoexgDdfO4OfHTmzbjBVd0Svi7pgj1m8Ka9mjK 5EOb5wzrrKFxEZ4L4l3T2zLWNmX/b8wWHo37B5xJvPNLXBbJFjpkkOa79InzcuSjLE u5jQaaB6nctHQ== From: Toke =?utf-8?q?H=C3=B8iland-J=C3=B8rgensen?= To: linux-wireless@vger.kernel.org Date: Mon, 11 Feb 2019 18:04:34 +0100 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <154990467412.6770.17555468557188569403.stgit@alrua-x1> In-Reply-To: <154990467406.6770.8841156470323507480.stgit@alrua-x1> References: <154990467406.6770.8841156470323507480.stgit@alrua-x1> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds printing of the station TX duration (along with the existing RX duration), and the airtime weight, both of which were added as part of the airtime fairness patches that were recently merged into mac80211. Signed-off-by: Toke Høiland-Jørgensen --- station.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/station.c b/station.c index 536120c..25cbbc3 100644 --- a/station.c +++ b/station.c @@ -309,6 +309,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg) [NL80211_STA_INFO_TID_STATS] = { .type = NLA_NESTED }, [NL80211_STA_INFO_BSS_PARAM] = { .type = NLA_NESTED }, [NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 }, + [NL80211_STA_INFO_TX_DURATION] = { .type = NLA_U64 }, [NL80211_STA_INFO_ACK_SIGNAL] = {.type = NLA_U8 }, [NL80211_STA_INFO_ACK_SIGNAL_AVG] = { .type = NLA_U8 }, }; @@ -401,6 +402,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg) printf("\n\ttx bitrate:\t%s", buf); } + if (sinfo[NL80211_STA_INFO_TX_DURATION]) + printf("\n\ttx duration:\t%lld us", + (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_TX_DURATION])); + if (sinfo[NL80211_STA_INFO_RX_BITRATE]) { char buf[100]; @@ -420,6 +425,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg) printf("\n\tavg ack signal:\t%d dBm", (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_ACK_SIGNAL_AVG])); + if (sinfo[NL80211_STA_INFO_AIRTIME_WEIGHT]) { + printf("\n\tairtime weight: %d", nla_get_u16(sinfo[NL80211_STA_INFO_AIRTIME_WEIGHT])); + } + if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) { uint32_t thr; From patchwork Mon Feb 11 17:04:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 10806371 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D2ECE6C2 for ; Mon, 11 Feb 2019 17:04:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD3D12A473 for ; Mon, 11 Feb 2019 17:04:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B18C12A528; Mon, 11 Feb 2019 17:04:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E7992A473 for ; Mon, 11 Feb 2019 17:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729809AbfBKREj (ORCPT ); Mon, 11 Feb 2019 12:04:39 -0500 Received: from mail.toke.dk ([52.28.52.200]:47033 "EHLO mail.toke.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728640AbfBKREh (ORCPT ); Mon, 11 Feb 2019 12:04:37 -0500 Subject: [PATCH 3/3] iw: Print airtime fairness feature DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1549904675; bh=zdN5I5K73u7dELp6JvRfvfXDJn2pR63cxAxFm4vrb6U=; h=Subject:From:To:Date:In-Reply-To:References:From; b=F/yyxudrtdZm/p+r/IQYYPmeJyc3/tJSlKQGcT7Ynd9dZH1/uR9WbYUMOQOWXr4UK bMjwBqBPvJsDPyYqFC2dv0VXLyFNddM/9BBJlp3NOC2vzxELOKrpHfuBdq+U1IOdXC TpaYVaO1Z8q4qG5TlOuXekZHbgC2TF+3DzfXEPqbIoAKE0QHiy0EsgElmGbrL/lY8N 8Wbeukrfqz0uDJmWDrk6JkwQDbnvwgJJ+ID6M+WuOG/gkXo8RZTEltyfwSryO6yQyP rDFG1ovMMRErTkWW1Ih3UbeRIRJQWd3X8RWCL5nx5apgFZmNoUA8vhF7uGuYcf6Jm3 HV5t2EbHmBekQ== From: Toke =?utf-8?q?H=C3=B8iland-J=C3=B8rgensen?= To: linux-wireless@vger.kernel.org Date: Mon, 11 Feb 2019 18:04:34 +0100 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <154990467416.6770.1883292163406897027.stgit@alrua-x1> In-Reply-To: <154990467406.6770.8841156470323507480.stgit@alrua-x1> References: <154990467406.6770.8841156470323507480.stgit@alrua-x1> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds printing of the newly introduced airtime fairness EXT_FEATURE flag to iw. Signed-off-by: Toke Høiland-Jørgensen --- info.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/info.c b/info.c index f1a25da..92c7d1d 100644 --- a/info.c +++ b/info.c @@ -694,6 +694,8 @@ broken_combination: "control port over nl80211"); ext_feat_print(tb, NL80211_EXT_FEATURE_TXQS, "TXQS", "FQ-CoDel-enabled intermediate TXQs"); + ext_feat_print(tb, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS, + "AIRTIME_FAIRNESS", "airtime fairness scheduling"); } if (tb_msg[NL80211_ATTR_COALESCE_RULE]) {