OSDN Git Service

nfp: flower: enable MAC address sharing for offloadable devs
authorJohn Hurley <john.hurley@netronome.com>
Wed, 16 Jan 2019 03:06:59 +0000 (19:06 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Jan 2019 23:23:15 +0000 (15:23 -0800)
commit20cce88650981ec504d328dbbdd004d991eb8535
tree00d8a44ffe117233144d828fe371f69151f91491
parent13cf71031d797d37bbc960a8260ba47505f6b597
nfp: flower: enable MAC address sharing for offloadable devs

A MAC address is not necessarily a unique identifier for a netdev. Drivers
such as Linux bonds, for example, can apply the same MAC address to the
upper layer device and all lower layer devices.

NFP MAC offload for tunnel decap includes port verification for reprs but
also supports the offload of non-repr MAC addresses by assigning 'global'
indexes to these. This means that the FW will not verify the incoming port
of a packet matching this destination MAC.

Modify the MAC offload logic to assign global indexes based on MAC address
instead of net device (as it currently does). Use this to allow multiple
devices to share the same MAC. In other words, if a repr shares its MAC
address with another device then give the offloaded MAC a global index
rather than associate it with an ingress port. Track this so that changes
can be reverted as MACs stop being shared.

Implement this by removing the current list based assignment of global
indexes and replacing it with an rhashtable that maps an offloaded MAC
address to the number of devices sharing it, distributing global indexes
based on this.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/flower/main.c
drivers/net/ethernet/netronome/nfp/flower/main.h
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c