Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1008117ybt; Fri, 19 Jun 2020 21:26:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAMUgOUYHgl6FAlGtQwPbEntjmOLuoG1Xbxb43cD5Ku65fzH+L4FTF6heQParbFVFM5sBh X-Received: by 2002:a05:6402:3092:: with SMTP id de18mr6723252edb.367.1592627187155; Fri, 19 Jun 2020 21:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592627187; cv=none; d=google.com; s=arc-20160816; b=tdfD5UXFpgNZ1q9iDEqJjm4k74egFfDdumMuKyy/1GLrEgb7qW71xwd/w1Ws36eJqq QtV3hJNCigwsSqAmUco0+ix93nsdm0KPVBK0EBr3ppUAFeCFiB9QrdZP93XbLg4Wpc1Z jOaE5k4pdtvjhrC4BpYxd3ckKwgKnzAOpm5kzPBY/6sALBPqDywZXZDIfUEo6rdMkS01 wnqBxHvSpk55ocAAUhU2ohG6uvqrkNvRedDorMyv4QGRMjtlqZC78fp6yfB45uU29t8a pNxccsTCa8P59zSfipZQghFMpJtvoBVOQmskzV/p15Mj6+6TrJpKAdmG1Qzv/ydfLbbA ig0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=g0HP1Oqtt2tWvdPrfD8uRVaU3hxTt+LfGRRANNn2PNI=; b=rDBw9f3/oBtxVmyTogIg1xKbqvmGsMIiSo/v5aaM+8OPSnJI/h8Fj3laCUM6apHbEr YxWmtCioTVu3poO4SWQ7z4bhXb9W6jgI2OoAesD32uY1P7bR7eYvNu0ZyoEa037rb+Kx 6i9p5I61tUNwJZxKUsihvj6EtDNSY0cuueUhaqijb+VCkQX00QFGg4dwpWUs+fKI4ZOk KcEWAjd6+6yUvKAn08gHQnPu282Cjeir7woNCtPfrZLY41PvuoBvHkIpYLEI/xHVRB4P Gr80tpr6rg7ukBKLYw9LVruXGTqQCfUFHoW5U21xfYBlOTbSMR9NW/Nou+O0iVlK2zVA PikA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=AcBrdfPZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw14si5004035ejb.359.2020.06.19.21.26.05; Fri, 19 Jun 2020 21:26:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=AcBrdfPZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388990AbgFSSkL (ORCPT + 99 others); Fri, 19 Jun 2020 14:40:11 -0400 Received: from mail-40136.protonmail.ch ([185.70.40.136]:20262 "EHLO mail-40136.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731358AbgFSSkJ (ORCPT ); Fri, 19 Jun 2020 14:40:09 -0400 Date: Fri, 19 Jun 2020 18:39:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1592592006; bh=g0HP1Oqtt2tWvdPrfD8uRVaU3hxTt+LfGRRANNn2PNI=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=AcBrdfPZ9GQwVEnKR58YVZ4hFuZ8vjuZFKRZ/+ZkdANyi82kClVnFfTpWvS2ianMZ wCVfzJ8+m5FNwFhd9mlwpZ8x05UO1zqbrJQ1KuTb6IyIE5CfiFpDJxJbH3yIHs/w7f unJFKkjv4XPMRxk7aFXNsbtLSbiAd36TKB+hS7JFvLidvSdRTrxhltIF59PnPrvBCF fqmkDu/AExjpvH+AxGN2Q3acyRQuQO3hLoZFWcb85yBCStBJ3sm7pshWYzuvuCC+20 G2gJNImIIJMZR53lP2PasWaho63TNassymIA3pexwDoRrPGBTYjHQAOifcZnUSknTa ywWk9h56Ew5sQ== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Michal Kubecek , Florian Fainelli , Andrew Lunn , Jiri Pirko , Antoine Tenart , Steffen Klassert , Aya Levin , Tom Herbert , Alexander Lobakin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH net 3/3] net: ethtool: sync netdev_features_strings order with enum netdev_features Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mail.protonmail.ch Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ordering of netdev_features_strings[] makes no sense when it comes to user interaction, as list of features in `ethtool -k` input is sorted according to the corresponding bit's position. Instead, it *does* make sense when it comes to adding new netdev_features or modifying existing ones. We have at least 2 occasions of forgetting to add the strings for newly introduced features, and one of them existed since 3.1x times till now. Let's keep this stringtable sorted according to bit's position in enum netdev_features, as this simplifies both reading and modification of the source code and can help not to miss or forget anything. Signed-off-by: Alexander Lobakin --- net/ethtool/common.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/net/ethtool/common.c b/net/ethtool/common.c index c8e3fce6e48d..24f35d47832d 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -8,25 +8,25 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = =3D { =09[NETIF_F_SG_BIT]=09=09=09=3D "tx-scatter-gather", =09[NETIF_F_IP_CSUM_BIT]=09=09=09=3D "tx-checksum-ipv4", + +=09/* __UNUSED_NETIF_F_1 - deprecated */ + =09[NETIF_F_HW_CSUM_BIT]=09=09=09=3D "tx-checksum-ip-generic", =09[NETIF_F_IPV6_CSUM_BIT]=09=09=09=3D "tx-checksum-ipv6", =09[NETIF_F_HIGHDMA_BIT]=09=09=09=3D "highdma", =09[NETIF_F_FRAGLIST_BIT]=09=09=09=3D "tx-scatter-gather-fraglist", =09[NETIF_F_HW_VLAN_CTAG_TX_BIT]=09=09=3D "tx-vlan-hw-insert", - =09[NETIF_F_HW_VLAN_CTAG_RX_BIT]=09=09=3D "rx-vlan-hw-parse", =09[NETIF_F_HW_VLAN_CTAG_FILTER_BIT]=09=3D "rx-vlan-filter", -=09[NETIF_F_HW_VLAN_STAG_TX_BIT]=09=09=3D "tx-vlan-stag-hw-insert", -=09[NETIF_F_HW_VLAN_STAG_RX_BIT]=09=09=3D "rx-vlan-stag-hw-parse", -=09[NETIF_F_HW_VLAN_STAG_FILTER_BIT]=09=3D "rx-vlan-stag-filter", =09[NETIF_F_VLAN_CHALLENGED_BIT]=09=09=3D "vlan-challenged", =09[NETIF_F_GSO_BIT]=09=09=09=3D "tx-generic-segmentation", =09[NETIF_F_LLTX_BIT]=09=09=09=3D "tx-lockless", =09[NETIF_F_NETNS_LOCAL_BIT]=09=09=3D "netns-local", =09[NETIF_F_GRO_BIT]=09=09=09=3D "rx-gro", -=09[NETIF_F_GRO_HW_BIT]=09=09=09=3D "rx-gro-hw", =09[NETIF_F_LRO_BIT]=09=09=09=3D "rx-lro", =20 +=09/* NETIF_F_GSO_SHIFT =3D NETIF_F_TSO_BIT */ + =09[NETIF_F_TSO_BIT]=09=09=09=3D "tx-tcp-segmentation", =09[NETIF_F_GSO_ROBUST_BIT]=09=09=3D "tx-gso-robust", =09[NETIF_F_TSO_ECN_BIT]=09=09=09=3D "tx-tcp-ecn-segmentation", @@ -43,9 +43,14 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT]= [ETH_GSTRING_LEN] =3D { =09[NETIF_F_GSO_TUNNEL_REMCSUM_BIT]=09=3D "tx-tunnel-remcsum-segmentation"= , =09[NETIF_F_GSO_SCTP_BIT]=09=09=09=3D "tx-sctp-segmentation", =09[NETIF_F_GSO_ESP_BIT]=09=09=09=3D "tx-esp-segmentation", + +=09/* NETIF_F_GSO_UDP_BIT - deprecated */ + =09[NETIF_F_GSO_UDP_L4_BIT]=09=09=3D "tx-udp-segmentation", =09[NETIF_F_GSO_FRAGLIST_BIT]=09=09=3D "tx-gso-list", =20 +=09/* NETIF_F_GSO_LAST =3D NETIF_F_GSO_FRAGLIST_BIT */ + =09[NETIF_F_FCOE_CRC_BIT]=09=09=09=3D "tx-checksum-fcoe-crc", =09[NETIF_F_SCTP_CRC_BIT]=09=09=09=3D "tx-checksum-sctp", =09[NETIF_F_FCOE_MTU_BIT]=09=09=09=3D "fcoe-mtu", @@ -56,16 +61,25 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT= ][ETH_GSTRING_LEN] =3D { =09[NETIF_F_LOOPBACK_BIT]=09=09=09=3D "loopback", =09[NETIF_F_RXFCS_BIT]=09=09=09=3D "rx-fcs", =09[NETIF_F_RXALL_BIT]=09=09=09=3D "rx-all", +=09[NETIF_F_HW_VLAN_STAG_TX_BIT]=09=09=3D "tx-vlan-stag-hw-insert", +=09[NETIF_F_HW_VLAN_STAG_RX_BIT]=09=09=3D "rx-vlan-stag-hw-parse", +=09[NETIF_F_HW_VLAN_STAG_FILTER_BIT]=09=3D "rx-vlan-stag-filter", =09[NETIF_F_HW_L2FW_DOFFLOAD_BIT]=09=09=3D "l2-fwd-offload", + =09[NETIF_F_HW_TC_BIT]=09=09=09=3D "hw-tc-offload", =09[NETIF_F_HW_ESP_BIT]=09=09=09=3D "esp-hw-offload", =09[NETIF_F_HW_ESP_TX_CSUM_BIT]=09=09=3D "esp-tx-csum-hw-offload", =09[NETIF_F_RX_UDP_TUNNEL_PORT_BIT]=09=3D "rx-udp_tunnel-port-offload", -=09[NETIF_F_HW_TLS_RECORD_BIT]=09=09=3D "tls-hw-record", =09[NETIF_F_HW_TLS_TX_BIT]=09=09=09=3D "tls-hw-tx-offload", =09[NETIF_F_HW_TLS_RX_BIT]=09=09=09=3D "tls-hw-rx-offload", + +=09[NETIF_F_GRO_HW_BIT]=09=09=09=3D "rx-gro-hw", +=09[NETIF_F_HW_TLS_RECORD_BIT]=09=09=3D "tls-hw-record", =09[NETIF_F_GRO_FRAGLIST_BIT]=09=09=3D "rx-gro-list", + =09[NETIF_F_HW_MACSEC_BIT]=09=09=09=3D "macsec-hw-offload", + +=09/* NETDEV_FEATURE_COUNT */ }; =20 const char --=20 2.27.0