Re: [RFC PATCH net-next] net: bridge: switchdev: expose the port hwdom as a netlink attribute
From: Ido Schimmel <hidden>
Date: 2021-08-12 15:35:48
On Thu, Aug 12, 2021 at 03:17:03PM +0300, Vladimir Oltean wrote:
It is useful for a user to see whether a bridge port is offloaded or not, and sometimes this may depend on hardware capability. For example, a switchdev driver might be able to offload bonding/team interfaces as bridge ports, but only for certain xmit hash policies. When running into that situation, DSA for example prints a warning extack that the interface is not offloaded, but not all drivers do that. In fact, since the recent bridge switchdev explicit offloading API, all switchdev drivers should be able to fall back to software LAGs being bridge ports without having any explicit code to handle them. So they don't have the warning extack printed anywhere.
[...]
With this change, the "hardware domain" concept becomes UAPI. It is a
read-only link attribute which is zero for non-offloaded bridge ports,
and has a non-zero value that is unique per bridge otherwise (i.e. two
different bridge ports, in two different bridges, might have a hwdom of
1 and they are still different hardware domains).
./ip -d link
13: sw1p3@swp2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0
state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
link/ether 00:04:9f:0a:0b:0c brd ff:ff:ff:ff:ff:ff promiscuity 1 minmtu 68
maxmtu 2021 bridge_slave state disabled priority 32 cost 100 hairpin off guard off
root_block off fastleave off learning on flood on port_id 0x8007 port_no 0x7
designated_port 32775 designated_cost 0 designated_bridge 8000.0:4:9f:a:b:c
designated_root 8000.0:4:9f:a:b:c hold_timer 0.00 message_age_timer 0.00
forward_delay_timer 0.00 topology_change_ack 0 config_pending 0 proxy_arp off
proxy_arp_wifi off mcast_router 1 mcast_fast_leave off mcast_flood on
mcast_to_unicast off neigh_suppress off group_fwd_mask 0 group_fwd_mask_str 0x0
vlan_tunnel off isolated off hwdom 2 addrgenmode none numtxqueues 8 numrxqueues 1
gso_max_size 65536 gso_max_segs 65535 portname p3 switchid 02000000 parentbus spi
parentdev spi2.1Makes sense to me. Gives us further insight into the offload process. I vaguely remember discussing this with Nik in the past. The hwdom/fwd_mark is in the tree for long enough to be considered a stable and useful concept. You are saying that it is useful to expose despite already having "switchid" exposed because you can have interfaces with the same "switchid" that are not member in the same hardware domain? E.g., the LAG example. If so, might be worth explicitly spelling it out in the commit message.