Commit e9dda2cf authored by Marcin Szycik's avatar Marcin Szycik Committed by Tony Nguyen

ice: Add VLAN FDB support in switchdev mode

Add support for matching on VLAN tag in bridge offloads.
Currently only trunk mode is supported.

To enable VLAN filtering (existing FDB entries will be deleted):
ip link set $BR type bridge vlan_filtering 1

To add VLANs to bridge in trunk mode:
bridge vlan add dev $PF1 vid 110-111
bridge vlan add dev $VF1_PR vid 110-111
Signed-off-by: default avatarMarcin Szycik <marcin.szycik@intel.com>
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 bccd9bce
...@@ -42,6 +42,11 @@ struct ice_esw_br_port { ...@@ -42,6 +42,11 @@ struct ice_esw_br_port {
struct ice_vsi *vsi; struct ice_vsi *vsi;
enum ice_esw_br_port_type type; enum ice_esw_br_port_type type;
u16 vsi_idx; u16 vsi_idx;
struct xarray vlans;
};
enum {
ICE_ESWITCH_BR_VLAN_FILTERING = BIT(0),
}; };
struct ice_esw_br { struct ice_esw_br {
...@@ -52,12 +57,14 @@ struct ice_esw_br { ...@@ -52,12 +57,14 @@ struct ice_esw_br {
struct list_head fdb_list; struct list_head fdb_list;
int ifindex; int ifindex;
u32 flags;
}; };
struct ice_esw_br_offloads { struct ice_esw_br_offloads {
struct ice_pf *pf; struct ice_pf *pf;
struct ice_esw_br *bridge; struct ice_esw_br *bridge;
struct notifier_block netdev_nb; struct notifier_block netdev_nb;
struct notifier_block switchdev_blk;
struct notifier_block switchdev_nb; struct notifier_block switchdev_nb;
struct workqueue_struct *wq; struct workqueue_struct *wq;
...@@ -70,6 +77,11 @@ struct ice_esw_br_fdb_work { ...@@ -70,6 +77,11 @@ struct ice_esw_br_fdb_work {
unsigned long event; unsigned long event;
}; };
struct ice_esw_br_vlan {
u16 vid;
u16 flags;
};
#define ice_nb_to_br_offloads(nb, nb_name) \ #define ice_nb_to_br_offloads(nb, nb_name) \
container_of(nb, \ container_of(nb, \
struct ice_esw_br_offloads, \ struct ice_esw_br_offloads, \
...@@ -80,6 +92,15 @@ struct ice_esw_br_fdb_work { ...@@ -80,6 +92,15 @@ struct ice_esw_br_fdb_work {
struct ice_esw_br_fdb_work, \ struct ice_esw_br_fdb_work, \
work) work)
static inline bool ice_eswitch_br_is_vid_valid(u16 vid)
{
/* In trunk VLAN mode, for untagged traffic the bridge sends requests
* to offload VLAN 1 with pvid and untagged flags set. Since these
* flags are not supported, add a MAC filter instead.
*/
return vid > 1;
}
void void
ice_eswitch_br_offloads_deinit(struct ice_pf *pf); ice_eswitch_br_offloads_deinit(struct ice_pf *pf);
int 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