diff options
author | Grzegorz Nitka <grzegorz.nitka@intel.com> | 2021-08-20 03:08:54 +0300 |
---|---|---|
committer | Tony Nguyen <anthony.l.nguyen@intel.com> | 2021-10-07 20:41:42 +0300 |
commit | 1a1c40df2e8074f5c4551137eeacaa64b21a31a4 (patch) | |
tree | cbc3bd0531775d5601d7701b11c29da0399aa84c /drivers/net/ethernet/intel/ice/ice_eswitch.h | |
parent | bd676b29292e4597c0b30948724159f4cf8690bf (diff) | |
download | linux-1a1c40df2e8074f5c4551137eeacaa64b21a31a4.tar.xz |
ice: set and release switchdev environment
Switchdev environment has to be set up when user create VFs
and eswitch mode is switchdev. Release is done when user
delete all VFs.
Data path in this implementation is based on control plane VSI.
This VSI is used to pass traffic from port representors to
corresponding VFs and vice versa. Default TX rule has to be
added to forward packet to control plane VSI. This will redirect
packets from VFs which don't match other rules to control plane
VSI.
On RX side default rule is added on uplink VSI to receive all
traffic that doesn't match other rules. When setting switchdev
environment all other rules from VFs should be removed. Packet to
VFs will be forwarded by control plane VSI.
As VF without any mac rules can't send any packet because of
antispoof mechanism, VSI antispoof should be turned off on each VFs.
To send packet from representor to correct VSI, destination VSI
field in TX descriptor will have to be filled. Allow that by
setting destination override bit in control plane VSI security config.
Packet from VFs will be received on control plane VSI. Driver
should decide to which netdev forward the packet. Decision is
made based on src_vsi field from descriptor. There is a target
netdev list in control plane VSI struct which choose netdev
based on src_vsi number.
Co-developed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Grzegorz Nitka <grzegorz.nitka@intel.com>
Tested-by: Sandeep Penigalapati <sandeep.penigalapati@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_eswitch.h')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_eswitch.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.h b/drivers/net/ethernet/intel/ice/ice_eswitch.h index 1964b060562a..2bf10f5b7025 100644 --- a/drivers/net/ethernet/intel/ice/ice_eswitch.h +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.h @@ -7,14 +7,23 @@ #include <net/devlink.h> #ifdef CONFIG_ICE_SWITCHDEV +void ice_eswitch_release(struct ice_pf *pf); +int ice_eswitch_configure(struct ice_pf *pf); + int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode); int ice_eswitch_mode_set(struct devlink *devlink, u16 mode, struct netlink_ext_ack *extack); bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf); #else /* CONFIG_ICE_SWITCHDEV */ -static inline int -ice_eswitch_mode_get(struct devlink *devlink, u16 *mode) +static inline void ice_eswitch_release(struct ice_pf *pf) { } + +static inline int ice_eswitch_configure(struct ice_pf *pf) +{ + return -EOPNOTSUPP; +} + +static inline int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode) { return DEVLINK_ESWITCH_MODE_LEGACY; } @@ -26,8 +35,7 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode, return -EOPNOTSUPP; } -static inline bool -ice_is_eswitch_mode_switchdev(struct ice_pf *pf) +static inline bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf) { return false; } |