Commit 7c945a1a authored by Wojciech Drewek's avatar Wojciech Drewek Committed by Tony Nguyen

ice: Switchdev FDB events support

Listen for SWITCHDEV_FDB_{ADD|DEL}_TO_DEVICE events while in switchdev
mode. Accept these events on both uplink and VF PR ports. Add HW
rules in newly created workqueue. FDB entries are stored in rhashtable
for lookup when removing the entry and in the list for cleanup
purpose. Direction of the HW rule depends on the type of the ports
on which the FDB event was received:

ICE_ESWITCH_BR_UPLINK_PORT:
TX rule that forwards the packet to the LAN (egress).

ICE_ESWITCH_BR_VF_REPR_PORT:
RX rule that forwards the packet to the VF associated
with the port representor.

In both cases the rule matches on the dst mac address.
All the FDB entries are stored in the bridge structure.
When the port is removed all the FDB entries associated with
this port are removed as well. This is achieved thanks to the reference
to the port that FDB entry holds.

In the fwd rule we use only one lookup type (MAC address)
but lkups_cnt variable is already introduced because
we will have more lookups in the subsequent patches.
Signed-off-by: default avatarWojciech Drewek <wojciech.drewek@intel.com>
Tested-by: default avatarSujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent f6e8fb55
......@@ -4,6 +4,33 @@
#ifndef _ICE_ESWITCH_BR_H_
#define _ICE_ESWITCH_BR_H_
#include <linux/rhashtable.h>
struct ice_esw_br_fdb_data {
unsigned char addr[ETH_ALEN];
u16 vid;
};
struct ice_esw_br_flow {
struct ice_rule_query_data *fwd_rule;
};
enum {
ICE_ESWITCH_BR_FDB_ADDED_BY_USER = BIT(0),
};
struct ice_esw_br_fdb_entry {
struct ice_esw_br_fdb_data data;
struct rhash_head ht_node;
struct list_head list;
int flags;
struct net_device *dev;
struct ice_esw_br_port *br_port;
struct ice_esw_br_flow *flow;
};
enum ice_esw_br_port_type {
ICE_ESWITCH_BR_UPLINK_PORT = 0,
ICE_ESWITCH_BR_VF_REPR_PORT = 1,
......@@ -20,6 +47,9 @@ struct ice_esw_br {
struct ice_esw_br_offloads *br_offloads;
struct xarray ports;
struct rhashtable fdb_ht;
struct list_head fdb_list;
int ifindex;
};
......@@ -27,6 +57,16 @@ struct ice_esw_br_offloads {
struct ice_pf *pf;
struct ice_esw_br *bridge;
struct notifier_block netdev_nb;
struct notifier_block switchdev_nb;
struct workqueue_struct *wq;
};
struct ice_esw_br_fdb_work {
struct work_struct work;
struct switchdev_notifier_fdb_info fdb_info;
struct net_device *dev;
unsigned long event;
};
#define ice_nb_to_br_offloads(nb, nb_name) \
......@@ -34,6 +74,11 @@ struct ice_esw_br_offloads {
struct ice_esw_br_offloads, \
nb_name)
#define ice_work_to_fdb_work(w) \
container_of(w, \
struct ice_esw_br_fdb_work, \
work)
void
ice_eswitch_br_offloads_deinit(struct ice_pf *pf);
int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment