linux/net
Vladimir Oltean 5df5661a13 net: dsa: stop overriding master's ndo_get_phys_port_name
The purpose of this override is to give the user an indication of what
the number of the CPU port is (in DSA, the CPU port is a hardware
implementation detail and not a network interface capable of traffic).

However, it has always failed (by design) at providing this information
to the user in a reliable fashion.

Prior to commit 3369afba1e ("net: Call into DSA netdevice_ops
wrappers"), the behavior was to only override this callback if it was
not provided by the DSA master.

That was its first failure: if the DSA master itself was a DSA port or a
switchdev, then the user would not see the number of the CPU port in
/sys/class/net/eth0/phys_port_name, but the number of the DSA master
port within its respective physical switch.

But that was actually ok in a way. The commit mentioned above changed
that behavior, and now overrides the master's ndo_get_phys_port_name
unconditionally. That comes with problems of its own, which are worse in
a way.

The idea is that it's typical for switchdev users to have udev rules for
consistent interface naming. These are based, among other things, on
the phys_port_name attribute. If we let the DSA switch at the bottom
to start randomly overriding ndo_get_phys_port_name with its own CPU
port, we basically lose any predictability in interface naming, or even
uniqueness, for that matter.

So, there are reasons to let DSA override the master's callback (to
provide a consistent interface, a number which has a clear meaning and
must not be interpreted according to context), and there are reasons to
not let DSA override it (it breaks udev matching for the DSA master).

But, there is an alternative method for users to retrieve the number of
the CPU port of each DSA switch in the system:

  $ devlink port
  pci/0000:00:00.5/0: type eth netdev swp0 flavour physical port 0
  pci/0000:00:00.5/2: type eth netdev swp2 flavour physical port 2
  pci/0000:00:00.5/4: type notset flavour cpu port 4
  spi/spi2.0/0: type eth netdev sw0p0 flavour physical port 0
  spi/spi2.0/1: type eth netdev sw0p1 flavour physical port 1
  spi/spi2.0/2: type eth netdev sw0p2 flavour physical port 2
  spi/spi2.0/4: type notset flavour cpu port 4
  spi/spi2.1/0: type eth netdev sw1p0 flavour physical port 0
  spi/spi2.1/1: type eth netdev sw1p1 flavour physical port 1
  spi/spi2.1/2: type eth netdev sw1p2 flavour physical port 2
  spi/spi2.1/3: type eth netdev sw1p3 flavour physical port 3
  spi/spi2.1/4: type notset flavour cpu port 4

So remove this duplicated, unreliable and troublesome method. From this
patch on, the phys_port_name attribute of the DSA master will only
contain information about itself (if at all). If the users need reliable
information about the CPU port they're probably using devlink anyway.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-23 15:14:58 -07:00
..
6lowpan treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
9p net: 9p: kerneldoc fixes 2020-07-13 17:20:39 -07:00
802
8021q net: get rid of lockdep_set_class_and_subclass() 2020-06-28 21:37:23 -07:00
appletalk net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
atm net/atm: remove the atmdev_ops {get, set}sockopt methods 2020-07-19 18:16:40 -07:00
ax25 AX.25 Kconfig: Replace HTTP links with HTTPS ones 2020-07-13 12:34:06 -07:00
batman-adv batman-adv: Introduce a configurable per interface hop penalty 2020-06-26 10:37:11 +02:00
bluetooth net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
bpf bpf: Add tests for PTR_TO_BTF_ID vs. null comparison 2020-06-30 22:21:29 +02:00
bpfilter bpfilter: Allow to build bpfilter_umh as a module without static library 2020-07-14 12:37:06 -07:00
bridge netfilter/ebtables: clean up compat {get, set}sockopt handling 2020-07-19 18:16:40 -07:00
caif net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
can net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
ceph libceph: don't omit used_replica in target_copy() 2020-06-16 16:02:08 +02:00
core net: dsa: stop overriding master's ndo_get_phys_port_name 2020-07-23 15:14:58 -07:00
dcb dcb_doit: remove redundant skb check 2020-06-23 20:27:09 -07:00
dccp net: dccp: Add SIOCOUTQ IOCTL support (send buffer fill) 2020-07-22 17:00:37 -07:00
decnet net: decnet: af_decnet: Simplify goto loop. 2020-07-17 12:56:11 -07:00
dns_resolver
dsa net: dsa: stop overriding master's ndo_get_phys_port_name 2020-07-23 15:14:58 -07:00
ethernet net: move devres helpers into a separate source file 2020-05-23 16:56:17 -07:00
ethtool Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-07-11 00:46:00 -07:00
hsr net: hsr: remove redundant null check 2020-07-20 18:33:32 -07:00
ieee802154 net: remove compat_sock_common_{get,set}sockopt 2020-07-19 18:16:40 -07:00
ife
ipv4 Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-07-22 12:35:33 -07:00
ipv6 Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-07-22 12:35:33 -07:00
iucv net/af_iucv: clean up function prototypes 2020-05-19 12:50:14 -07:00
kcm treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
key net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
l2tp l2tp: cleanup kzalloc calls 2020-07-23 11:54:40 -07:00
l3mdev l3mdev: add infrastructure for table to VRF mapping 2020-06-20 17:22:22 -07:00
lapb treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
llc net: llc: kerneldoc fixes 2020-07-13 17:20:39 -07:00
mac80211 net: mac80211: kerneldoc fixes 2020-07-13 17:20:39 -07:00
mac802154 treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
mpls treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
mptcp subflow: introduce and use mptcp_can_accept_new_subflow() 2020-07-23 11:47:25 -07:00
ncsi net/ncsi: use eth_zero_addr() to clear mac address 2020-07-23 11:49:41 -07:00
netfilter netfilter: split nf_sockopt 2020-07-19 18:16:40 -07:00
netlabel net: netlabel: kerneldoc fixes 2020-07-13 17:20:40 -07:00
netlink bpf: net: Use precomputed btf_id for bpf iterators 2020-07-21 13:26:26 -07:00
netrom net: change addr_list_lock back to static key 2020-06-09 12:59:45 -07:00
nfc net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
nsh treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
openvswitch net: openvswitch: reorder masks array based on usage 2020-07-17 10:36:50 -07:00
packet net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
phonet net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
psample net: psample: fix build error when CONFIG_INET is not enabled 2020-05-23 16:36:05 -07:00
qrtr net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
rds net: rds: rdma_transport.h: delete duplicated word 2020-07-19 18:14:51 -07:00
rfkill
rose net: change addr_list_lock back to static key 2020-06-09 12:59:45 -07:00
rxrpc net: rxrpc: kerneldoc fixes 2020-07-13 17:20:40 -07:00
sched sched: sch_api: add missing rcu read lock to silence the warning 2020-07-20 17:00:02 -07:00
sctp sctp: remove the out_nounlock label in sctp_setsockopt 2020-07-19 18:26:44 -07:00
smc net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
strparser
sunrpc Fixes for a umask bug on exported filesystems lacking ACL support, a 2020-07-02 20:35:33 -07:00
switchdev net: switchdev: kerneldoc fixes 2020-07-13 17:20:40 -07:00
tipc net: tipc: kerneldoc fixes 2020-07-13 17:20:40 -07:00
tls net/tls: Add asynchronous resync 2020-06-27 14:00:22 -07:00
unix net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
vmw_vsock net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
wimax
wireless net: wireless: kerneldoc fixes 2020-07-13 17:20:40 -07:00
x25 net: x25: kerneldoc fixes 2020-07-13 17:20:40 -07:00
xdp Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-07-13 18:04:05 -07:00
xfrm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-07-11 00:46:00 -07:00
compat.c net: remove compat_sys_{get,set}sockopt 2020-07-19 18:16:40 -07:00
devres.c net: devres: rename the release callback of devm_register_netdev() 2020-06-30 15:57:34 -07:00
Kconfig net: ethtool: Remove PHYLIB direct dependency 2020-07-07 15:41:05 -07:00
Makefile net: move devres helpers into a separate source file 2020-05-23 16:56:17 -07:00
socket.c net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
sysctl_net.c