• Petr Machata's avatar
    net: bridge: Add netlink knobs for number / maximum MDB entries · a1aee20d
    Petr Machata authored
    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: default avatarPetr Machata <petrm@nvidia.com>
    Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
    Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    a1aee20d
br_netlink.c 55.2 KB