Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'ethtool-netlink-interface-preliminary-part'

Michal Kubecek says:

====================
ethtool netlink interface, preliminary part

As Jakub Kicinski suggested in ethtool netlink v7 discussion, this
submission consists only of preliminary patches which raised no objections;
first four patches already have Acked-by or Reviewed-by.

- patch 1 exposes permanent hardware address (as shown by "ethtool -P")
via rtnetlink
- patch 2 is renames existing netlink helper to a better name
- patch 3 and 4 reorganize existing ethtool code (no functional change)
- patch 5 makes the table of link mode names available as an ethtool string
set (will be needed for the netlink interface)

Once we get these out of the way, v8 of the first part of the ethtool
netlink interface will follow.

Changes from v2 to v3: fix SPDX licence identifiers (patch 3 and 5).

Changes from v1 to v2: restore build time check that all link modes have
assigned a name (patch 5).
====================

Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

+219 -90
+4 -4
include/net/netlink.h
··· 1735 1735 } 1736 1736 1737 1737 /** 1738 - * nla_validate_nested - Validate a stream of nested attributes 1738 + * __nla_validate_nested - Validate a stream of nested attributes 1739 1739 * @start: container attribute 1740 1740 * @maxtype: maximum attribute type to be expected 1741 1741 * @policy: validation policy ··· 1758 1758 } 1759 1759 1760 1760 static inline int 1761 - nl80211_validate_nested(const struct nlattr *start, int maxtype, 1762 - const struct nla_policy *policy, 1763 - struct netlink_ext_ack *extack) 1761 + nla_validate_nested(const struct nlattr *start, int maxtype, 1762 + const struct nla_policy *policy, 1763 + struct netlink_ext_ack *extack) 1764 1764 { 1765 1765 return __nla_validate_nested(start, maxtype, policy, 1766 1766 NL_VALIDATE_STRICT, extack);
+2
include/uapi/linux/ethtool.h
··· 593 593 * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names 594 594 * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS 595 595 * @ETH_SS_PHY_TUNABLES: PHY tunable names 596 + * @ETH_SS_LINK_MODES: link mode names 596 597 */ 597 598 enum ethtool_stringset { 598 599 ETH_SS_TEST = 0, ··· 605 604 ETH_SS_TUNABLES, 606 605 ETH_SS_PHY_STATS, 607 606 ETH_SS_PHY_TUNABLES, 607 + ETH_SS_LINK_MODES, 608 608 }; 609 609 610 610 /**
+1
include/uapi/linux/if_link.h
··· 169 169 IFLA_MAX_MTU, 170 170 IFLA_PROP_LIST, 171 171 IFLA_ALT_IFNAME, /* Alternative ifname */ 172 + IFLA_PERM_ADDRESS, 172 173 __IFLA_MAX 173 174 }; 174 175
+1 -1
net/Makefile
··· 13 13 14 14 # LLC has to be linked before the files in net/802/ 15 15 obj-$(CONFIG_LLC) += llc/ 16 - obj-$(CONFIG_NET) += ethernet/ 802/ sched/ netlink/ bpf/ 16 + obj-$(CONFIG_NET) += ethernet/ 802/ sched/ netlink/ bpf/ ethtool/ 17 17 obj-$(CONFIG_NETFILTER) += netfilter/ 18 18 obj-$(CONFIG_INET) += ipv4/ 19 19 obj-$(CONFIG_TLS) += tls/
+1 -1
net/core/Makefile
··· 8 8 9 9 obj-$(CONFIG_SYSCTL) += sysctl_net_core.o 10 10 11 - obj-y += dev.o ethtool.o dev_addr_lists.o dst.o netevent.o \ 11 + obj-y += dev.o dev_addr_lists.o dst.o netevent.o \ 12 12 neighbour.o rtnetlink.o utils.o link_watch.o filter.o \ 13 13 sock_diag.o dev_ioctl.o tso.o sock_reuseport.o \ 14 14 fib_notifier.o xdp.o flow_offload.o
+8 -82
net/core/ethtool.c net/ethtool/ioctl.c
··· 27 27 #include <net/xdp_sock.h> 28 28 #include <net/flow_offload.h> 29 29 30 + #include "common.h" 31 + 30 32 /* 31 33 * Some useful ethtool_ops methods that're device independent. 32 34 * If we find that all drivers want to do the same thing here, ··· 55 53 /* Handlers for each ethtool command */ 56 54 57 55 #define ETHTOOL_DEV_FEATURE_WORDS ((NETDEV_FEATURE_COUNT + 31) / 32) 58 - 59 - static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = { 60 - [NETIF_F_SG_BIT] = "tx-scatter-gather", 61 - [NETIF_F_IP_CSUM_BIT] = "tx-checksum-ipv4", 62 - [NETIF_F_HW_CSUM_BIT] = "tx-checksum-ip-generic", 63 - [NETIF_F_IPV6_CSUM_BIT] = "tx-checksum-ipv6", 64 - [NETIF_F_HIGHDMA_BIT] = "highdma", 65 - [NETIF_F_FRAGLIST_BIT] = "tx-scatter-gather-fraglist", 66 - [NETIF_F_HW_VLAN_CTAG_TX_BIT] = "tx-vlan-hw-insert", 67 - 68 - [NETIF_F_HW_VLAN_CTAG_RX_BIT] = "rx-vlan-hw-parse", 69 - [NETIF_F_HW_VLAN_CTAG_FILTER_BIT] = "rx-vlan-filter", 70 - [NETIF_F_HW_VLAN_STAG_TX_BIT] = "tx-vlan-stag-hw-insert", 71 - [NETIF_F_HW_VLAN_STAG_RX_BIT] = "rx-vlan-stag-hw-parse", 72 - [NETIF_F_HW_VLAN_STAG_FILTER_BIT] = "rx-vlan-stag-filter", 73 - [NETIF_F_VLAN_CHALLENGED_BIT] = "vlan-challenged", 74 - [NETIF_F_GSO_BIT] = "tx-generic-segmentation", 75 - [NETIF_F_LLTX_BIT] = "tx-lockless", 76 - [NETIF_F_NETNS_LOCAL_BIT] = "netns-local", 77 - [NETIF_F_GRO_BIT] = "rx-gro", 78 - [NETIF_F_GRO_HW_BIT] = "rx-gro-hw", 79 - [NETIF_F_LRO_BIT] = "rx-lro", 80 - 81 - [NETIF_F_TSO_BIT] = "tx-tcp-segmentation", 82 - [NETIF_F_GSO_ROBUST_BIT] = "tx-gso-robust", 83 - [NETIF_F_TSO_ECN_BIT] = "tx-tcp-ecn-segmentation", 84 - [NETIF_F_TSO_MANGLEID_BIT] = "tx-tcp-mangleid-segmentation", 85 - [NETIF_F_TSO6_BIT] = "tx-tcp6-segmentation", 86 - [NETIF_F_FSO_BIT] = "tx-fcoe-segmentation", 87 - [NETIF_F_GSO_GRE_BIT] = "tx-gre-segmentation", 88 - [NETIF_F_GSO_GRE_CSUM_BIT] = "tx-gre-csum-segmentation", 89 - [NETIF_F_GSO_IPXIP4_BIT] = "tx-ipxip4-segmentation", 90 - [NETIF_F_GSO_IPXIP6_BIT] = "tx-ipxip6-segmentation", 91 - [NETIF_F_GSO_UDP_TUNNEL_BIT] = "tx-udp_tnl-segmentation", 92 - [NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation", 93 - [NETIF_F_GSO_PARTIAL_BIT] = "tx-gso-partial", 94 - [NETIF_F_GSO_SCTP_BIT] = "tx-sctp-segmentation", 95 - [NETIF_F_GSO_ESP_BIT] = "tx-esp-segmentation", 96 - [NETIF_F_GSO_UDP_L4_BIT] = "tx-udp-segmentation", 97 - 98 - [NETIF_F_FCOE_CRC_BIT] = "tx-checksum-fcoe-crc", 99 - [NETIF_F_SCTP_CRC_BIT] = "tx-checksum-sctp", 100 - [NETIF_F_FCOE_MTU_BIT] = "fcoe-mtu", 101 - [NETIF_F_NTUPLE_BIT] = "rx-ntuple-filter", 102 - [NETIF_F_RXHASH_BIT] = "rx-hashing", 103 - [NETIF_F_RXCSUM_BIT] = "rx-checksum", 104 - [NETIF_F_NOCACHE_COPY_BIT] = "tx-nocache-copy", 105 - [NETIF_F_LOOPBACK_BIT] = "loopback", 106 - [NETIF_F_RXFCS_BIT] = "rx-fcs", 107 - [NETIF_F_RXALL_BIT] = "rx-all", 108 - [NETIF_F_HW_L2FW_DOFFLOAD_BIT] = "l2-fwd-offload", 109 - [NETIF_F_HW_TC_BIT] = "hw-tc-offload", 110 - [NETIF_F_HW_ESP_BIT] = "esp-hw-offload", 111 - [NETIF_F_HW_ESP_TX_CSUM_BIT] = "esp-tx-csum-hw-offload", 112 - [NETIF_F_RX_UDP_TUNNEL_PORT_BIT] = "rx-udp_tunnel-port-offload", 113 - [NETIF_F_HW_TLS_RECORD_BIT] = "tls-hw-record", 114 - [NETIF_F_HW_TLS_TX_BIT] = "tls-hw-tx-offload", 115 - [NETIF_F_HW_TLS_RX_BIT] = "tls-hw-rx-offload", 116 - }; 117 - 118 - static const char 119 - rss_hash_func_strings[ETH_RSS_HASH_FUNCS_COUNT][ETH_GSTRING_LEN] = { 120 - [ETH_RSS_HASH_TOP_BIT] = "toeplitz", 121 - [ETH_RSS_HASH_XOR_BIT] = "xor", 122 - [ETH_RSS_HASH_CRC32_BIT] = "crc32", 123 - }; 124 - 125 - static const char 126 - tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN] = { 127 - [ETHTOOL_ID_UNSPEC] = "Unspec", 128 - [ETHTOOL_RX_COPYBREAK] = "rx-copybreak", 129 - [ETHTOOL_TX_COPYBREAK] = "tx-copybreak", 130 - [ETHTOOL_PFC_PREVENTION_TOUT] = "pfc-prevention-tout", 131 - }; 132 - 133 - static const char 134 - phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN] = { 135 - [ETHTOOL_ID_UNSPEC] = "Unspec", 136 - [ETHTOOL_PHY_DOWNSHIFT] = "phy-downshift", 137 - [ETHTOOL_PHY_FAST_LINK_DOWN] = "phy-fast-link-down", 138 - [ETHTOOL_PHY_EDPD] = "phy-energy-detect-power-down", 139 - }; 140 56 141 57 static int ethtool_get_features(struct net_device *dev, void __user *useraddr) 142 58 { ··· 154 234 !ops->get_ethtool_phy_stats) 155 235 return phy_ethtool_get_sset_count(dev->phydev); 156 236 237 + if (sset == ETH_SS_LINK_MODES) 238 + return __ETHTOOL_LINK_MODE_MASK_NBITS; 239 + 157 240 if (ops->get_sset_count && ops->get_strings) 158 241 return ops->get_sset_count(dev, sset); 159 242 else ··· 181 258 else if (stringset == ETH_SS_PHY_STATS && dev->phydev && 182 259 !ops->get_ethtool_phy_stats) 183 260 phy_ethtool_get_strings(dev->phydev, data); 261 + else if (stringset == ETH_SS_LINK_MODES) 262 + memcpy(data, link_mode_names, 263 + __ETHTOOL_LINK_MODE_MASK_NBITS * ETH_GSTRING_LEN); 184 264 else 185 265 /* ops->get_strings is valid because checked earlier */ 186 266 ops->get_strings(dev, stringset, data);
+5
net/core/rtnetlink.c
··· 1041 1041 + nla_total_size(4) /* IFLA_MIN_MTU */ 1042 1042 + nla_total_size(4) /* IFLA_MAX_MTU */ 1043 1043 + rtnl_prop_list_size(dev) 1044 + + nla_total_size(MAX_ADDR_LEN) /* IFLA_PERM_ADDRESS */ 1044 1045 + 0; 1045 1046 } 1046 1047 ··· 1758 1757 nla_put_s32(skb, IFLA_NEW_IFINDEX, new_ifindex) < 0) 1759 1758 goto nla_put_failure; 1760 1759 1760 + if (memchr_inv(dev->perm_addr, '\0', dev->addr_len) && 1761 + nla_put(skb, IFLA_PERM_ADDRESS, dev->addr_len, dev->perm_addr)) 1762 + goto nla_put_failure; 1761 1763 1762 1764 rcu_read_lock(); 1763 1765 if (rtnl_fill_link_af(skb, dev, ext_filter_mask)) ··· 1826 1822 [IFLA_PROP_LIST] = { .type = NLA_NESTED }, 1827 1823 [IFLA_ALT_IFNAME] = { .type = NLA_STRING, 1828 1824 .len = ALTIFNAMSIZ - 1 }, 1825 + [IFLA_PERM_ADDRESS] = { .type = NLA_REJECT }, 1829 1826 }; 1830 1827 1831 1828 static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
+3
net/ethtool/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + obj-y += ioctl.o common.o
+171
net/ethtool/common.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + 3 + #include "common.h" 4 + 5 + const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = { 6 + [NETIF_F_SG_BIT] = "tx-scatter-gather", 7 + [NETIF_F_IP_CSUM_BIT] = "tx-checksum-ipv4", 8 + [NETIF_F_HW_CSUM_BIT] = "tx-checksum-ip-generic", 9 + [NETIF_F_IPV6_CSUM_BIT] = "tx-checksum-ipv6", 10 + [NETIF_F_HIGHDMA_BIT] = "highdma", 11 + [NETIF_F_FRAGLIST_BIT] = "tx-scatter-gather-fraglist", 12 + [NETIF_F_HW_VLAN_CTAG_TX_BIT] = "tx-vlan-hw-insert", 13 + 14 + [NETIF_F_HW_VLAN_CTAG_RX_BIT] = "rx-vlan-hw-parse", 15 + [NETIF_F_HW_VLAN_CTAG_FILTER_BIT] = "rx-vlan-filter", 16 + [NETIF_F_HW_VLAN_STAG_TX_BIT] = "tx-vlan-stag-hw-insert", 17 + [NETIF_F_HW_VLAN_STAG_RX_BIT] = "rx-vlan-stag-hw-parse", 18 + [NETIF_F_HW_VLAN_STAG_FILTER_BIT] = "rx-vlan-stag-filter", 19 + [NETIF_F_VLAN_CHALLENGED_BIT] = "vlan-challenged", 20 + [NETIF_F_GSO_BIT] = "tx-generic-segmentation", 21 + [NETIF_F_LLTX_BIT] = "tx-lockless", 22 + [NETIF_F_NETNS_LOCAL_BIT] = "netns-local", 23 + [NETIF_F_GRO_BIT] = "rx-gro", 24 + [NETIF_F_GRO_HW_BIT] = "rx-gro-hw", 25 + [NETIF_F_LRO_BIT] = "rx-lro", 26 + 27 + [NETIF_F_TSO_BIT] = "tx-tcp-segmentation", 28 + [NETIF_F_GSO_ROBUST_BIT] = "tx-gso-robust", 29 + [NETIF_F_TSO_ECN_BIT] = "tx-tcp-ecn-segmentation", 30 + [NETIF_F_TSO_MANGLEID_BIT] = "tx-tcp-mangleid-segmentation", 31 + [NETIF_F_TSO6_BIT] = "tx-tcp6-segmentation", 32 + [NETIF_F_FSO_BIT] = "tx-fcoe-segmentation", 33 + [NETIF_F_GSO_GRE_BIT] = "tx-gre-segmentation", 34 + [NETIF_F_GSO_GRE_CSUM_BIT] = "tx-gre-csum-segmentation", 35 + [NETIF_F_GSO_IPXIP4_BIT] = "tx-ipxip4-segmentation", 36 + [NETIF_F_GSO_IPXIP6_BIT] = "tx-ipxip6-segmentation", 37 + [NETIF_F_GSO_UDP_TUNNEL_BIT] = "tx-udp_tnl-segmentation", 38 + [NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation", 39 + [NETIF_F_GSO_PARTIAL_BIT] = "tx-gso-partial", 40 + [NETIF_F_GSO_SCTP_BIT] = "tx-sctp-segmentation", 41 + [NETIF_F_GSO_ESP_BIT] = "tx-esp-segmentation", 42 + [NETIF_F_GSO_UDP_L4_BIT] = "tx-udp-segmentation", 43 + 44 + [NETIF_F_FCOE_CRC_BIT] = "tx-checksum-fcoe-crc", 45 + [NETIF_F_SCTP_CRC_BIT] = "tx-checksum-sctp", 46 + [NETIF_F_FCOE_MTU_BIT] = "fcoe-mtu", 47 + [NETIF_F_NTUPLE_BIT] = "rx-ntuple-filter", 48 + [NETIF_F_RXHASH_BIT] = "rx-hashing", 49 + [NETIF_F_RXCSUM_BIT] = "rx-checksum", 50 + [NETIF_F_NOCACHE_COPY_BIT] = "tx-nocache-copy", 51 + [NETIF_F_LOOPBACK_BIT] = "loopback", 52 + [NETIF_F_RXFCS_BIT] = "rx-fcs", 53 + [NETIF_F_RXALL_BIT] = "rx-all", 54 + [NETIF_F_HW_L2FW_DOFFLOAD_BIT] = "l2-fwd-offload", 55 + [NETIF_F_HW_TC_BIT] = "hw-tc-offload", 56 + [NETIF_F_HW_ESP_BIT] = "esp-hw-offload", 57 + [NETIF_F_HW_ESP_TX_CSUM_BIT] = "esp-tx-csum-hw-offload", 58 + [NETIF_F_RX_UDP_TUNNEL_PORT_BIT] = "rx-udp_tunnel-port-offload", 59 + [NETIF_F_HW_TLS_RECORD_BIT] = "tls-hw-record", 60 + [NETIF_F_HW_TLS_TX_BIT] = "tls-hw-tx-offload", 61 + [NETIF_F_HW_TLS_RX_BIT] = "tls-hw-rx-offload", 62 + }; 63 + 64 + const char 65 + rss_hash_func_strings[ETH_RSS_HASH_FUNCS_COUNT][ETH_GSTRING_LEN] = { 66 + [ETH_RSS_HASH_TOP_BIT] = "toeplitz", 67 + [ETH_RSS_HASH_XOR_BIT] = "xor", 68 + [ETH_RSS_HASH_CRC32_BIT] = "crc32", 69 + }; 70 + 71 + const char 72 + tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN] = { 73 + [ETHTOOL_ID_UNSPEC] = "Unspec", 74 + [ETHTOOL_RX_COPYBREAK] = "rx-copybreak", 75 + [ETHTOOL_TX_COPYBREAK] = "tx-copybreak", 76 + [ETHTOOL_PFC_PREVENTION_TOUT] = "pfc-prevention-tout", 77 + }; 78 + 79 + const char 80 + phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN] = { 81 + [ETHTOOL_ID_UNSPEC] = "Unspec", 82 + [ETHTOOL_PHY_DOWNSHIFT] = "phy-downshift", 83 + [ETHTOOL_PHY_FAST_LINK_DOWN] = "phy-fast-link-down", 84 + [ETHTOOL_PHY_EDPD] = "phy-energy-detect-power-down", 85 + }; 86 + 87 + #define __LINK_MODE_NAME(speed, type, duplex) \ 88 + #speed "base" #type "/" #duplex 89 + #define __DEFINE_LINK_MODE_NAME(speed, type, duplex) \ 90 + [ETHTOOL_LINK_MODE(speed, type, duplex)] = \ 91 + __LINK_MODE_NAME(speed, type, duplex) 92 + #define __DEFINE_SPECIAL_MODE_NAME(_mode, _name) \ 93 + [ETHTOOL_LINK_MODE_ ## _mode ## _BIT] = _name 94 + 95 + const char link_mode_names[][ETH_GSTRING_LEN] = { 96 + __DEFINE_LINK_MODE_NAME(10, T, Half), 97 + __DEFINE_LINK_MODE_NAME(10, T, Full), 98 + __DEFINE_LINK_MODE_NAME(100, T, Half), 99 + __DEFINE_LINK_MODE_NAME(100, T, Full), 100 + __DEFINE_LINK_MODE_NAME(1000, T, Half), 101 + __DEFINE_LINK_MODE_NAME(1000, T, Full), 102 + __DEFINE_SPECIAL_MODE_NAME(Autoneg, "Autoneg"), 103 + __DEFINE_SPECIAL_MODE_NAME(TP, "TP"), 104 + __DEFINE_SPECIAL_MODE_NAME(AUI, "AUI"), 105 + __DEFINE_SPECIAL_MODE_NAME(MII, "MII"), 106 + __DEFINE_SPECIAL_MODE_NAME(FIBRE, "FIBRE"), 107 + __DEFINE_SPECIAL_MODE_NAME(BNC, "BNC"), 108 + __DEFINE_LINK_MODE_NAME(10000, T, Full), 109 + __DEFINE_SPECIAL_MODE_NAME(Pause, "Pause"), 110 + __DEFINE_SPECIAL_MODE_NAME(Asym_Pause, "Asym_Pause"), 111 + __DEFINE_LINK_MODE_NAME(2500, X, Full), 112 + __DEFINE_SPECIAL_MODE_NAME(Backplane, "Backplane"), 113 + __DEFINE_LINK_MODE_NAME(1000, KX, Full), 114 + __DEFINE_LINK_MODE_NAME(10000, KX4, Full), 115 + __DEFINE_LINK_MODE_NAME(10000, KR, Full), 116 + __DEFINE_SPECIAL_MODE_NAME(10000baseR_FEC, "10000baseR_FEC"), 117 + __DEFINE_LINK_MODE_NAME(20000, MLD2, Full), 118 + __DEFINE_LINK_MODE_NAME(20000, KR2, Full), 119 + __DEFINE_LINK_MODE_NAME(40000, KR4, Full), 120 + __DEFINE_LINK_MODE_NAME(40000, CR4, Full), 121 + __DEFINE_LINK_MODE_NAME(40000, SR4, Full), 122 + __DEFINE_LINK_MODE_NAME(40000, LR4, Full), 123 + __DEFINE_LINK_MODE_NAME(56000, KR4, Full), 124 + __DEFINE_LINK_MODE_NAME(56000, CR4, Full), 125 + __DEFINE_LINK_MODE_NAME(56000, SR4, Full), 126 + __DEFINE_LINK_MODE_NAME(56000, LR4, Full), 127 + __DEFINE_LINK_MODE_NAME(25000, CR, Full), 128 + __DEFINE_LINK_MODE_NAME(25000, KR, Full), 129 + __DEFINE_LINK_MODE_NAME(25000, SR, Full), 130 + __DEFINE_LINK_MODE_NAME(50000, CR2, Full), 131 + __DEFINE_LINK_MODE_NAME(50000, KR2, Full), 132 + __DEFINE_LINK_MODE_NAME(100000, KR4, Full), 133 + __DEFINE_LINK_MODE_NAME(100000, SR4, Full), 134 + __DEFINE_LINK_MODE_NAME(100000, CR4, Full), 135 + __DEFINE_LINK_MODE_NAME(100000, LR4_ER4, Full), 136 + __DEFINE_LINK_MODE_NAME(50000, SR2, Full), 137 + __DEFINE_LINK_MODE_NAME(1000, X, Full), 138 + __DEFINE_LINK_MODE_NAME(10000, CR, Full), 139 + __DEFINE_LINK_MODE_NAME(10000, SR, Full), 140 + __DEFINE_LINK_MODE_NAME(10000, LR, Full), 141 + __DEFINE_LINK_MODE_NAME(10000, LRM, Full), 142 + __DEFINE_LINK_MODE_NAME(10000, ER, Full), 143 + __DEFINE_LINK_MODE_NAME(2500, T, Full), 144 + __DEFINE_LINK_MODE_NAME(5000, T, Full), 145 + __DEFINE_SPECIAL_MODE_NAME(FEC_NONE, "None"), 146 + __DEFINE_SPECIAL_MODE_NAME(FEC_RS, "RS"), 147 + __DEFINE_SPECIAL_MODE_NAME(FEC_BASER, "BASER"), 148 + __DEFINE_LINK_MODE_NAME(50000, KR, Full), 149 + __DEFINE_LINK_MODE_NAME(50000, SR, Full), 150 + __DEFINE_LINK_MODE_NAME(50000, CR, Full), 151 + __DEFINE_LINK_MODE_NAME(50000, LR_ER_FR, Full), 152 + __DEFINE_LINK_MODE_NAME(50000, DR, Full), 153 + __DEFINE_LINK_MODE_NAME(100000, KR2, Full), 154 + __DEFINE_LINK_MODE_NAME(100000, SR2, Full), 155 + __DEFINE_LINK_MODE_NAME(100000, CR2, Full), 156 + __DEFINE_LINK_MODE_NAME(100000, LR2_ER2_FR2, Full), 157 + __DEFINE_LINK_MODE_NAME(100000, DR2, Full), 158 + __DEFINE_LINK_MODE_NAME(200000, KR4, Full), 159 + __DEFINE_LINK_MODE_NAME(200000, SR4, Full), 160 + __DEFINE_LINK_MODE_NAME(200000, LR4_ER4_FR4, Full), 161 + __DEFINE_LINK_MODE_NAME(200000, DR4, Full), 162 + __DEFINE_LINK_MODE_NAME(200000, CR4, Full), 163 + __DEFINE_LINK_MODE_NAME(100, T1, Full), 164 + __DEFINE_LINK_MODE_NAME(1000, T1, Full), 165 + __DEFINE_LINK_MODE_NAME(400000, KR8, Full), 166 + __DEFINE_LINK_MODE_NAME(400000, SR8, Full), 167 + __DEFINE_LINK_MODE_NAME(400000, LR8_ER8_FR8, Full), 168 + __DEFINE_LINK_MODE_NAME(400000, DR8, Full), 169 + __DEFINE_LINK_MODE_NAME(400000, CR8, Full), 170 + }; 171 + static_assert(ARRAY_SIZE(link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS);
+22
net/ethtool/common.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + 3 + #ifndef _ETHTOOL_COMMON_H 4 + #define _ETHTOOL_COMMON_H 5 + 6 + #include <linux/ethtool.h> 7 + 8 + /* compose link mode index from speed, type and duplex */ 9 + #define ETHTOOL_LINK_MODE(speed, type, duplex) \ 10 + ETHTOOL_LINK_MODE_ ## speed ## base ## type ## _ ## duplex ## _BIT 11 + 12 + extern const char 13 + netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]; 14 + extern const char 15 + rss_hash_func_strings[ETH_RSS_HASH_FUNCS_COUNT][ETH_GSTRING_LEN]; 16 + extern const char 17 + tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN]; 18 + extern const char 19 + phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN]; 20 + extern const char link_mode_names[][ETH_GSTRING_LEN]; 21 + 22 + #endif /* _ETHTOOL_COMMON_H */
+1 -2
net/wireless/nl80211.c
··· 12900 12900 return -EINVAL; 12901 12901 } 12902 12902 12903 - return nl80211_validate_nested(attr, vcmd->maxattr, vcmd->policy, 12904 - extack); 12903 + return nla_validate_nested(attr, vcmd->maxattr, vcmd->policy, extack); 12905 12904 } 12906 12905 12907 12906 static int nl80211_vendor_cmd(struct sk_buff *skb, struct genl_info *info)