OSDN Git Service

mlxsw: spectrum: Mirror certain packets to CPU
authorIdo Schimmel <idosch@mellanox.com>
Thu, 25 Aug 2016 16:42:40 +0000 (18:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Aug 2016 20:13:37 +0000 (13:13 -0700)
commit1c6c6d221e2b2efb7084b215ef7f59f2bf211b14
tree2bc2ff94ee7c44d90a6773fba11abeb0c121db28
parent63a811417d97015feb049ba411300990d6835fab
mlxsw: spectrum: Mirror certain packets to CPU

Instead of trapping certain packets to the CPU and then relying on it to
flood them we can instead make the device mirror them.

The following packet types are mirrored:

* DHCP: Broadcast packets that should be flooded by the device, but also
trapped in case CPU is running the DHCP server.

* IGMP query: Multicast packets that need to be forwarded to other
bridge ports, but also trapped so that receiving netdev will be marked
as a router port by the bridge driver.

* ARP request: Broadcast packets that should be forwarded to other
bridge ports, but also trapped in case requested IP is of the local
machine.

* ARP response: Unicast packets that should be forwarded by the bridge
but also trapped in case response is directed at us.

Set the trap action of such packets to mirror and mark them using
'offload_fwd_mark' to prevent the bridge driver from forwarding them
itself.

Note that OSPF packets are also marked despite their action being trap.
The reason for this is that the device traps such packets in the
pipeline after they were already flooded.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c