Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2617310rwd; Mon, 15 May 2023 14:25:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5QOi+k/q5vHMfq+0IjMS5Tmpp2QegEPGielWT2oaTKv7Bt5jmgJB2/sjf75+NScbYMpHvn X-Received: by 2002:a17:90a:4a0a:b0:250:6730:a364 with SMTP id e10-20020a17090a4a0a00b002506730a364mr30027141pjh.3.1684185910959; Mon, 15 May 2023 14:25:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684185910; cv=none; d=google.com; s=arc-20160816; b=njYORZ9/jH8rX+IyJjpwFj5egS5wT+NM2cSpYwh/V/qFdBa36MCPcAT2zaGm2L5UyC sFb4iFJoWyc1yaEuiXK0qpYKDjqp/2ggx01IkuItsfJOgB/+rsBCRspbfpmLOEdShP+H sBUadmwA5yUn6VQ6tkRxKWwbd8JOFkh/6jIBAyCzm0mIIElLj91FpdgHlVaLCGYMRJ1z bgizLQOfO7WUBSMh10EPlFLF2Tqq+IzBWF5T8nz7oQnp7HmXfdTl80Sw9dvUqKTnR7uk cSxxEfum5cooBOyruQ5GoYZqn/qjsQO/EEoRdZuENO31O6hc8XSA41UnYcejNMwWtjYb 7uXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=AlWAmVsl7irAccLtHAJVyd5vUYcLc+X5Bu9dK4SgkZs=; b=QDVqLPBnzRibYNYEQchcQfS7AceQZCaSoxRgdQQpCv/MtmGofVm+L/n2XgwZPYUcbG Vhdo5Q+sOCdBgIEE/JBtLvQPCvNzdlLkVYtfDBHZMghjl/srouXVICgD98Er6M5J9rkm 8ktYgbkvhofdBlg4K8G9Bk25jwvvAWu3Sb7fngO7J7+B01YDUV77mAipiaotz70UP+lz QqPRg0TmQZzD9mBh1tNOejYzwCT+K9GmX9kFYtE6ZOO1KN/TSyfXpH/3sMBzX5eLhANg 0W36udmhABtXyDWy8QhmD7PDSy9dtlCj3IRalFBL58F0ycLVWibO3W1/NBMhbTLQ7CEp WdVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=IwVwJqmT; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l17-20020a637011000000b0052c3b9a643csi10784476pgc.528.2023.05.15.14.25.02; Mon, 15 May 2023 14:25:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=IwVwJqmT; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245354AbjEOVPd (ORCPT + 62 others); Mon, 15 May 2023 17:15:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245308AbjEOVPc (ORCPT ); Mon, 15 May 2023 17:15:32 -0400 Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E14DA27C for ; Mon, 15 May 2023 14:15:31 -0700 (PDT) X-Virus-Scanned: Proofpoint Essentials engine Received: from mail3.candelatech.com (mail2.candelatech.com [208.74.158.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 882C970007B for ; Mon, 15 May 2023 21:15:26 +0000 (UTC) Received: from ben-dt5.candelatech.com (50-251-239-81-static.hfc.comcastbusiness.net [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id EA58213C2B0; Mon, 15 May 2023 14:15:25 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com EA58213C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1684185326; bh=7Aztba1opyGoq8zbkB4ZnH5PiSepjILqor8LDujQ9Ck=; h=From:To:Cc:Subject:Date:From; b=IwVwJqmT6FX/3f2eiYokU7oY+A3Kqkw0Rd5QfzKhIAyyJVJ4mSbVVYFs2ZSWh8cTZ i+4gcP8ZDw1yLAgpo89kra+gUM9dVkIV144JpEaBnT64RbDt0IkldiF+y9JRxKs2Ki YiHs/LrOOR4CVG4feFJ5UWZHjYdwo6a7W+m1iCg4= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH] iw: Only print EHT info if fields are defined. Date: Mon, 15 May 2023 14:15:24 -0700 Message-Id: <20230515211524.470451-1-greearb@candelatech.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-MDID: 1684185327-Q1gK2gZZ6qvF X-MDID-O: us5;ut7;1684185327;Q1gK2gZZ6qvF;;f7146c1849a4b08a52804beb1c1cdf45 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ben Greear Without this patch, a bunch of blank EHT fields are printed when iw phy info is run against an /ax phy devices. Signed-off-by: Ben Greear --- util.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/util.c b/util.c index 8a2ba10..31b0308 100644 --- a/util.c +++ b/util.c @@ -1588,6 +1588,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band) __u8 ppet[31] = { 0 }; __u16 he_phy_cap[6] = { 0 }; size_t len, mcs_len = 0, ppet_len = 0; + bool did_one = false; nla_parse(tb, NL80211_BAND_IFTYPE_ATTR_MAX, nla_data(nl_iftype), nla_len(nl_iftype), NULL); @@ -1595,11 +1596,8 @@ void print_eht_info(struct nlattr *nl_iftype, int band) if (!tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES]) return; - printf("\t\tEHT Iftypes: "); - print_iftype_line(tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES]); - printf("\n"); - if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC]) { + did_one = true; len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC]); if (len > sizeof(mac_cap)) len = sizeof(mac_cap); @@ -1609,6 +1607,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band) } if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY]) { + did_one = true; len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY]); if (len > sizeof(phy_cap)) @@ -1620,6 +1619,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band) } if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET]) { + did_one = true; len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET]); if (len > sizeof(mcs_set)) len = sizeof(mcs_set); @@ -1632,6 +1632,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band) } if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE]) { + did_one = true; len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE]); if (len > sizeof(ppet)) len = sizeof(ppet); @@ -1651,6 +1652,13 @@ void print_eht_info(struct nlattr *nl_iftype, int band) len); } + if (!did_one) + return; + + printf("\t\tEHT Iftypes: "); + print_iftype_line(tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES]); + printf("\n"); + __print_eht_capa(band, mac_cap, phy_cap, mcs_set, mcs_len, ppet, ppet_len, he_phy_cap, true); } -- 2.40.0