Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1903053ybt; Sun, 21 Jun 2020 03:02:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvAE8iJnEAc1YeuYFimkjm9G7lrGilEQr5Mx2keaKfqRqbKyZDxta4YuQnmojAvQE6gwwx X-Received: by 2002:a05:6402:659:: with SMTP id u25mr12221622edx.124.1592733762994; Sun, 21 Jun 2020 03:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592733762; cv=none; d=google.com; s=arc-20160816; b=DarDGAKXIUQPMb+ze6k/J5VrLqar4seJduuqe87f1eRFIWE0TSwqmhn1I+fv94UNfV /ocS6itQ8fPPfKE6vWgy9z3dMs88xqOBlF1BVFTUGL88BC0fKZYJ7OR+yvWZsZRBEJIb 8Sn8Gs7fl60b8y7rij+d/c9aMSG9QhGRFw+HrlPsv/pRyug7jcfpT2wZ21HAZtHHKj1c zFXu02HqfcR9bYZmeWrfthU4KKoyUrO24vcwcqFTlWlzE3gpNJrOOjS+Foae5Pmvttx/ KTPDzMhuLpA3iAHWe0QFCRG+cI3QQ7SzGSxyNc+XbERkJKyBUjb7JKkxLeV0j1R8N3If lG8g== 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=C7pGTHtwyxY79CKsHJLk+51BPg4zJQbdZhpVjA7ETAfUnzdRFq2Mjuo/AUf7KEFypl jvVDKuno/t7ETUlAHVfrT00VafF3+rk2UcvJTsAGb77FDgbApN+hLetpteIw/2VebQSF KmrpLh9xvh7cDGnQUKCjZQKKuZvg7foEIecMMs9oZRAXmexqw0UK7alN3TR+GO641lKa QPvKkdDLf3Tdmy6G7wI2gxOVNlSOvtNbhPb3sM40oX/y0uvmP0wJznbjtLWAZwlyvh6s uBoCsYGQSg1uiaWUxeoihma5fv1uKZD3rxaMwcSBk4rI6Apw562H58ZpHZZw9VqXkk5g Xovg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=d69fPDed; 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 x26si6806429ejc.746.2020.06.21.03.02.20; Sun, 21 Jun 2020 03:02:42 -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=d69fPDed; 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 S1729809AbgFUJ5K (ORCPT + 99 others); Sun, 21 Jun 2020 05:57:10 -0400 Received: from mail-40134.protonmail.ch ([185.70.40.134]:28464 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729797AbgFUJ5J (ORCPT ); Sun, 21 Jun 2020 05:57:09 -0400 Date: Sun, 21 Jun 2020 09:56:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1592733425; bh=g0HP1Oqtt2tWvdPrfD8uRVaU3hxTt+LfGRRANNn2PNI=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=d69fPDedzbp0jZ8s3UAQUwPPwJOjzsWrIAEwc1TBZrR8d4myYLZwz/aVYqXYh0eUD 6bt4H2iWD95vUrGusiPO7Zbw84WwLvGVSLWh8/i1iOFT/QJgk0vlc2PuBQWkFpDdNN KOweMuTWeUkKyBzKw3R+KvkCEMQb0mhwL9b+tFiTld5lDpIfqHbWeY2CJCNoSC277h pWTmKjQ0r6fVhtLbZOF9hpgRXghyIozzT4LQuCdKXJ5QlBEjCwaNI9caf1Zjtwxoeu Pq4MT52KSy/XHMx/FlTmu1KUKMDgPjgdz4tpQVKcUPkkmS9sMQ0GytGQcagvlHZVT7 4MB2wk6zBYKfA== 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 v2 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