linux-stable/drivers/net/ethernet/intel/ice/ice_vsi_vlan_ops.h
Michal Swiatkowski 2946204b3f ice: implement bridge port vlan
Port VLAN in this case means push and pop VLAN action on specific vid.
There are a few limitation in hardware:
- push and pop can't be used separately
- if port VLAN is used there can't be any trunk VLANs, because pop
  action is done on all traffic received by VSI in port VLAN mode
- port VLAN mode on uplink port isn't supported

Reflect these limitations in code using dev_info to inform the user
about unsupported configuration.

In bridge mode there is a need to configure port vlan without resetting
VFs. To do that implement ice_port_vlan_on/off() functions. They are
only configuring correct vlan_ops to allow setting port vlan.

We also need to clear port vlan without resetting the VF which is not
supported right now. Change it by implementing clear_port_vlan ops.
As previous VLAN configuration isn't always the same, store current
config while creating port vlan and restore it in clear function.

Configuration steps:
- configure switchdev with bridge
- #bridge vlan add dev eth0 vid 120 pvid untagged
- #bridge vlan add dev eth1 vid 120 pvid untagged
- ping from VF0 to VF1

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2023-07-24 08:53:35 -07:00

30 lines
1 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2019-2021, Intel Corporation. */
#ifndef _ICE_VSI_VLAN_OPS_H_
#define _ICE_VSI_VLAN_OPS_H_
#include "ice_type.h"
#include "ice_vsi_vlan_lib.h"
struct ice_vsi;
struct ice_vsi_vlan_ops {
int (*add_vlan)(struct ice_vsi *vsi, struct ice_vlan *vlan);
int (*del_vlan)(struct ice_vsi *vsi, struct ice_vlan *vlan);
int (*ena_stripping)(struct ice_vsi *vsi, const u16 tpid);
int (*dis_stripping)(struct ice_vsi *vsi);
int (*ena_insertion)(struct ice_vsi *vsi, const u16 tpid);
int (*dis_insertion)(struct ice_vsi *vsi);
int (*ena_rx_filtering)(struct ice_vsi *vsi);
int (*dis_rx_filtering)(struct ice_vsi *vsi);
int (*ena_tx_filtering)(struct ice_vsi *vsi);
int (*dis_tx_filtering)(struct ice_vsi *vsi);
int (*set_port_vlan)(struct ice_vsi *vsi, struct ice_vlan *vlan);
int (*clear_port_vlan)(struct ice_vsi *vsi);
};
void ice_vsi_init_vlan_ops(struct ice_vsi *vsi);
struct ice_vsi_vlan_ops *ice_get_compat_vsi_vlan_ops(struct ice_vsi *vsi);
#endif /* _ICE_VSI_VLAN_OPS_H_ */