ipv4: ipmr: Don't forward packets already forwarded by hardware
authorYotam Gigi <yotamg@mellanox.com>
Tue, 3 Oct 2017 07:58:08 +0000 (09:58 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 Oct 2017 17:06:30 +0000 (10:06 -0700)
commita5bc9294d70fe85729bb343eef281ccbe78ff119
tree5e122c80aafdc2c30baed336b36663a3af4056e4
parent5d8b3e69fc5e5ccafc9db1251bb7c78a8622fddd
ipv4: ipmr: Don't forward packets already forwarded by hardware

Change the ipmr module to not forward packets if:
 - The packet is marked with the offload_mr_fwd_mark, and
 - Both input interface and output interface share the same parent ID.

This way, a packet can go through partial multicast forwarding in the
hardware, where it will be forwarded only to the devices that share the
same parent ID (AKA, reside inside the same hardware). The kernel will
forward the packet to all other interfaces.

To do this, add the ipmr_offload_forward helper, which per skb, ingress VIF
and egress VIF, returns whether the forwarding was offloaded to hardware.
The ipmr_queue_xmit frees the skb and does not forward it if the result is
a true value.

All the forwarding path code compiles out when the CONFIG_NET_SWITCHDEV is
not set.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ipmr.c