On 15/03/2023 15:11, Ido Schimmel wrote: > Integrate MDB support into the Tx path of the VXLAN driver, allowing it > to selectively forward IP multicast traffic according to the matched MDB > entry. > > If MDB entries are configured (i.e., 'VXLAN_F_MDB' is set) and the > packet is an IP multicast packet, perform up to three different lookups > according to the following priority: > > 1. For an (S, G) entry, using {Source VNI, Source IP, Destination IP}. > 2. For a (*, G) entry, using {Source VNI, Destination IP}. > 3. For the catchall MDB entry (0.0.0.0 or ::), using the source VNI. > > The catchall MDB entry is similar to the catchall FDB entry > (00:00:00:00:00:00) that is currently used to transmit BUM (broadcast, > unknown unicast and multicast) traffic. However, unlike the catchall FDB > entry, this entry is only used to transmit unregistered IP multicast > traffic that is not link-local. Therefore, when configured, the catchall > FDB entry will only transmit BULL (broadcast, unknown unicast, > link-local multicast) traffic. > > The catchall MDB entry is useful in deployments where inter-subnet > multicast forwarding is used and not all the VTEPs in a tenant domain > are members in all the broadcast domains. In such deployments it is > advantageous to transmit BULL (broadcast, unknown unicast and link-local > multicast) and unregistered IP multicast traffic on different tunnels. > If the same tunnel was used, a VTEP only interested in IP multicast > traffic would also pull all the BULL traffic and drop it as it is not a > member in the originating broadcast domain [1]. > > If the packet did not match an MDB entry (or if the packet is not an IP > multicast packet), return it to the Tx path, allowing it to be forwarded > according to the FDB. > > If the packet did match an MDB entry, forward it to the associated > remote VTEPs. However, if the entry is a (*, G) entry and the associated > remote is in INCLUDE mode, then skip over it as the source IP is not in > its source list (otherwise the packet would have matched on an (S, G) > entry). Similarly, if the associated remote is marked as BLOCKED (can > only be set on (S, G) entries), then skip over it as well as the remote > is in EXCLUDE mode and the source IP is in its source list. > > [1] https://datatracker.ietf.org/doc/html/draft-ietf-bess-evpn-irb-mcast#section-2.6 > > Signed-off-by: Ido Schimmel <idosch@xxxxxxxxxx> > --- > > Notes: > v2: > * Use htons() in 'case' instead of ntohs() in 'switch'. > > drivers/net/vxlan/vxlan_core.c | 15 ++++ > drivers/net/vxlan/vxlan_mdb.c | 114 ++++++++++++++++++++++++++++++ > drivers/net/vxlan/vxlan_private.h | 6 ++ > 3 files changed, 135 insertions(+) > Reviewed-by: Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>