mirror-linux/net
Petr Machata a1aee20d5d net: bridge: Add netlink knobs for number / maximum MDB entries
The previous patch added accounting for number of MDB entries per port and
per port-VLAN, and the logic to verify that these values stay within
configured bounds. However it didn't provide means to actually configure
those bounds or read the occupancy. This patch does that.

Two new netlink attributes are added for the MDB occupancy:
IFLA_BRPORT_MCAST_N_GROUPS for the per-port occupancy and
BRIDGE_VLANDB_ENTRY_MCAST_N_GROUPS for the per-port-VLAN occupancy.
And another two for the maximum number of MDB entries:
IFLA_BRPORT_MCAST_MAX_GROUPS for the per-port maximum, and
BRIDGE_VLANDB_ENTRY_MCAST_MAX_GROUPS for the per-port-VLAN one.

Note that the two new IFLA_BRPORT_ attributes prompt bumping of
RTNL_SLAVE_MAX_TYPE to size the slave attribute tables large enough.

The new attributes are used like this:

 # ip link add name br up type bridge vlan_filtering 1 mcast_snooping 1 \
                                      mcast_vlan_snooping 1 mcast_querier 1
 # ip link set dev v1 master br
 # bridge vlan add dev v1 vid 2

 # bridge vlan set dev v1 vid 1 mcast_max_groups 1
 # bridge mdb add dev br port v1 grp 230.1.2.3 temp vid 1
 # bridge mdb add dev br port v1 grp 230.1.2.4 temp vid 1
 Error: bridge: Port-VLAN is already in 1 groups, and mcast_max_groups=1.

 # bridge link set dev v1 mcast_max_groups 1
 # bridge mdb add dev br port v1 grp 230.1.2.3 temp vid 2
 Error: bridge: Port is already in 1 groups, and mcast_max_groups=1.

 # bridge -d link show
 5: v1@v2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br [...]
     [...] mcast_n_groups 1 mcast_max_groups 1

 # bridge -d vlan show
 port              vlan-id
 br                1 PVID Egress Untagged
                     state forwarding mcast_router 1
 v1                1 PVID Egress Untagged
                     [...] mcast_n_groups 1 mcast_max_groups 1
                   2
                     [...] mcast_n_groups 0 mcast_max_groups 0

Signed-off-by: Petr Machata <petrm@nvidia.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-02-06 08:48:26 +00:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth net/sock: Introduce trace_sk_data_ready() 2023-01-23 11:26:50 +00:00
bpf bpf/selftests: Verify struct_ops prog sleepable behavior 2023-01-25 10:25:57 -08:00
bpfilter
bridge net: bridge: Add netlink knobs for number / maximum MDB entries 2023-02-06 08:48:26 +00:00
caif
can can: isotp: split tx timer into transmission and timeout 2023-02-02 10:33:26 +01:00
ceph net/sock: Introduce trace_sk_data_ready() 2023-01-23 11:26:50 +00:00
core net: bridge: Add netlink knobs for number / maximum MDB entries 2023-02-06 08:48:26 +00:00
dcb
dccp
devlink devlink: Move devlink dev selftest code to dev 2023-02-03 19:25:26 -08:00
dns_resolver
dsa net: dsa: use NL_SET_ERR_MSG_WEAK_MOD() more consistently 2023-02-03 19:23:32 -08:00
ethernet
ethtool ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
hsr
ieee802154
ife
ipv4 raw: use net_hash_mix() in hash function 2023-02-03 19:56:23 -08:00
ipv6 raw: use net_hash_mix() in hash function 2023-02-03 19:56:23 -08:00
iucv
kcm net/sock: Introduce trace_sk_data_ready() 2023-01-23 11:26:50 +00:00
key
l2tp
l3mdev
lapb
llc
mac80211
mac802154
mctp net: mctp: purge receive queues on sk destruction 2023-01-28 00:26:09 -08:00
mpls
mptcp mptcp: userspace pm: use a single point of exit 2023-01-26 13:33:30 +01:00
ncsi
netfilter netfilter: nf_conntrack: allow early drop of offloaded UDP conns 2023-02-03 09:31:24 +00:00
netlabel
netlink netlink: annotate data races around sk_state 2023-01-23 21:35:53 -08:00
netrom netrom: Fix use-after-free caused by accept on already connected socket 2023-01-30 07:30:47 +00:00
nfc
nsh
openvswitch Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-02-02 14:49:55 -08:00
packet packet: add TP_STATUS_GSO_TCP for tp_status 2023-02-01 20:54:27 -08:00
phonet net/sock: Introduce trace_sk_data_ready() 2023-01-23 11:26:50 +00:00
psample
qrtr Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-02-02 14:49:55 -08:00
rds net: add missing includes of linux/sched/clock.h 2023-01-27 11:19:46 +00:00
rfkill
rose net/rose: Fix to not accept on connected socket 2023-01-28 00:19:57 -08:00
rxrpc rxrpc: Kill service bundle 2023-01-31 16:38:35 +00:00
sched net/sched: act_ct: offload UDP NEW connections 2023-02-03 09:31:24 +00:00
sctp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-02-02 14:49:55 -08:00
smc net/smc: replace mutex rmbs_lock and sndbufs_lock with rw_semaphore 2023-02-04 09:48:19 +00:00
strparser
sunrpc net/sock: Introduce trace_sk_data_ready() 2023-01-23 11:26:50 +00:00
switchdev
tipc net/sock: Introduce trace_sk_data_ready() 2023-01-23 11:26:50 +00:00
tls Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-02-02 14:49:55 -08:00
unix net: add missing includes of linux/splice.h 2023-01-27 11:19:46 +00:00
vmw_vsock
wireless
x25 net/x25: Fix to not accept on connected socket 2023-01-25 09:51:04 +00:00
xdp
xfrm netlink: provide an ability to set default extack message 2023-02-01 21:04:09 -08:00
Kconfig
Kconfig.debug
Makefile
compat.c
devres.c
socket.c
sysctl_net.c