summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/netronome/nfp/flower/main.h
diff options
context:
space:
mode:
authorJohn Hurley2019-01-16 04:06:59 +0100
committerDavid S. Miller2019-01-17 00:23:15 +0100
commit20cce88650981ec504d328dbbdd004d991eb8535 (patch)
tree00d8a44ffe117233144d828fe371f69151f91491 /drivers/net/ethernet/netronome/nfp/flower/main.h
parentnfp: flower: ensure MAC cleanup on address change (diff)
downloadkernel-qcow2-linux-20cce88650981ec504d328dbbdd004d991eb8535.tar.gz
kernel-qcow2-linux-20cce88650981ec504d328dbbdd004d991eb8535.tar.xz
kernel-qcow2-linux-20cce88650981ec504d328dbbdd004d991eb8535.zip
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>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/flower/main.h')
-rw-r--r--drivers/net/ethernet/netronome/nfp/flower/main.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h
index 15b794d0d1e4..c0945a5fd1a4 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/main.h
+++ b/drivers/net/ethernet/netronome/nfp/flower/main.h
@@ -58,20 +58,18 @@ struct nfp_fl_stats_id {
/**
* struct nfp_fl_tunnel_offloads - priv data for tunnel offloads
- * @mac_index_list: List of unique 8-bit indexes for non NFP netdevs
+ * @offloaded_macs: Hashtable of the offloaded MAC addresses
* @ipv4_off_list: List of IPv4 addresses to offload
* @neigh_off_list: List of neighbour offloads
- * @mac_index_lock: Lock for the MAC index list
* @ipv4_off_lock: Lock for the IPv4 address list
* @neigh_off_lock: Lock for the neighbour address list
* @mac_off_ids: IDA to manage id assignment for offloaded MACs
* @neigh_nb: Notifier to monitor neighbour state
*/
struct nfp_fl_tunnel_offloads {
- struct list_head mac_index_list;
+ struct rhashtable offloaded_macs;
struct list_head ipv4_off_list;
struct list_head neigh_off_list;
- struct mutex mac_index_lock;
struct mutex ipv4_off_lock;
spinlock_t neigh_off_lock;
struct ida mac_off_ids;
@@ -178,14 +176,18 @@ struct nfp_flower_priv {
/**
* struct nfp_flower_repr_priv - Flower APP per-repr priv data
+ * @nfp_repr: Back pointer to nfp_repr
* @lag_port_flags: Extended port flags to record lag state of repr
* @mac_offloaded: Flag indicating a MAC address is offloaded for repr
* @offloaded_mac_addr: MAC address that has been offloaded for repr
+ * @mac_list: List entry of reprs that share the same offloaded MAC
*/
struct nfp_flower_repr_priv {
+ struct nfp_repr *nfp_repr;
unsigned long lag_port_flags;
bool mac_offloaded;
u8 offloaded_mac_addr[ETH_ALEN];
+ struct list_head mac_list;
};
/**