2021-12-02 16:38:46 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/* Copyright (C) 2019-2021, Intel Corporation. */
|
|
|
|
|
|
|
|
#include "ice_vsi_vlan_ops.h"
|
|
|
|
#include "ice_vsi_vlan_lib.h"
|
2021-12-02 16:38:49 +00:00
|
|
|
#include "ice_vlan_mode.h"
|
2021-12-02 16:38:46 +00:00
|
|
|
#include "ice.h"
|
|
|
|
#include "ice_vf_vsi_vlan_ops.h"
|
2022-02-23 00:26:49 +00:00
|
|
|
#include "ice_sriov.h"
|
2021-12-02 16:38:46 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
noop_vlan_arg(struct ice_vsi __always_unused *vsi,
|
|
|
|
struct ice_vlan __always_unused *vlan)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2
Add support for the VF driver to be able to request
VIRTCHNL_VF_OFFLOAD_VLAN_V2, negotiate its VLAN capabilities via
VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS, add/delete VLAN filters, and
enable/disable VLAN offloads.
VFs supporting VIRTCHNL_OFFLOAD_VLAN_V2 will be able to use the
following virtchnl opcodes:
VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS
VIRTCHNL_OP_ADD_VLAN_V2
VIRTCHNL_OP_DEL_VLAN_V2
VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2
VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2
VIRTCHNL_OP_ENABLE_VLAN_INSERTION_V2
VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2
Legacy VF drivers may expect the initial VLAN stripping settings to be
configured by the PF, so the PF initializes VLAN stripping based on the
VIRTCHNL_OP_GET_VF_RESOURCES opcode. However, with VLAN support via
VIRTCHNL_VF_OFFLOAD_VLAN_V2, this function is only expected to be used
for VFs that only support VIRTCHNL_VF_OFFLOAD_VLAN, which will only
be supported when a port VLAN is configured. Update the function
based on the new expectations. Also, change the message when the PF
can't enable/disable VLAN stripping to a dev_dbg() as this isn't fatal.
When a VF isn't in a port VLAN and it only supports
VIRTCHNL_VF_OFFLOAD_VLAN when Double VLAN Mode (DVM) is enabled, then
the PF needs to reject the VIRTCHNL_VF_OFFLOAD_VLAN capability and
configure the VF in software only VLAN mode. To do this add the new
function ice_vf_vsi_cfg_legacy_vlan_mode(), which updates the VF's
inner and outer ice_vsi_vlan_ops functions and sets up software only
VLAN mode.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-12-02 16:38:48 +00:00
|
|
|
static int
|
|
|
|
noop_vlan(struct ice_vsi __always_unused *vsi)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-07-12 11:03:35 +00:00
|
|
|
static void ice_port_vlan_on(struct ice_vsi *vsi)
|
|
|
|
{
|
|
|
|
struct ice_vsi_vlan_ops *vlan_ops;
|
|
|
|
struct ice_pf *pf = vsi->back;
|
|
|
|
|
2024-03-25 20:19:01 +00:00
|
|
|
/* setup inner VLAN ops */
|
|
|
|
vlan_ops = &vsi->inner_vlan_ops;
|
2023-07-12 11:03:35 +00:00
|
|
|
|
2024-03-25 20:19:01 +00:00
|
|
|
if (ice_is_dvm_ena(&pf->hw)) {
|
2023-07-12 11:03:35 +00:00
|
|
|
vlan_ops->add_vlan = noop_vlan_arg;
|
|
|
|
vlan_ops->del_vlan = noop_vlan_arg;
|
|
|
|
vlan_ops->ena_stripping = ice_vsi_ena_inner_stripping;
|
|
|
|
vlan_ops->dis_stripping = ice_vsi_dis_inner_stripping;
|
|
|
|
vlan_ops->ena_insertion = ice_vsi_ena_inner_insertion;
|
|
|
|
vlan_ops->dis_insertion = ice_vsi_dis_inner_insertion;
|
|
|
|
|
2024-03-25 20:19:01 +00:00
|
|
|
/* setup outer VLAN ops */
|
|
|
|
vlan_ops = &vsi->outer_vlan_ops;
|
|
|
|
vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan;
|
|
|
|
vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan;
|
|
|
|
} else {
|
2023-07-12 11:03:35 +00:00
|
|
|
vlan_ops->set_port_vlan = ice_vsi_set_inner_port_vlan;
|
|
|
|
vlan_ops->clear_port_vlan = ice_vsi_clear_inner_port_vlan;
|
|
|
|
}
|
2023-11-07 13:51:38 +00:00
|
|
|
|
|
|
|
/* all Rx traffic should be in the domain of the assigned port VLAN,
|
|
|
|
* so prevent disabling Rx VLAN filtering
|
|
|
|
*/
|
|
|
|
vlan_ops->dis_rx_filtering = noop_vlan;
|
|
|
|
|
2023-07-12 11:03:35 +00:00
|
|
|
vlan_ops->ena_rx_filtering = ice_vsi_ena_rx_vlan_filtering;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ice_port_vlan_off(struct ice_vsi *vsi)
|
|
|
|
{
|
|
|
|
struct ice_vsi_vlan_ops *vlan_ops;
|
|
|
|
struct ice_pf *pf = vsi->back;
|
|
|
|
|
|
|
|
/* setup inner VLAN ops */
|
|
|
|
vlan_ops = &vsi->inner_vlan_ops;
|
|
|
|
|
|
|
|
vlan_ops->ena_stripping = ice_vsi_ena_inner_stripping;
|
|
|
|
vlan_ops->dis_stripping = ice_vsi_dis_inner_stripping;
|
|
|
|
vlan_ops->ena_insertion = ice_vsi_ena_inner_insertion;
|
|
|
|
vlan_ops->dis_insertion = ice_vsi_dis_inner_insertion;
|
|
|
|
|
|
|
|
if (ice_is_dvm_ena(&pf->hw)) {
|
|
|
|
vlan_ops = &vsi->outer_vlan_ops;
|
|
|
|
|
|
|
|
vlan_ops->del_vlan = ice_vsi_del_vlan;
|
|
|
|
vlan_ops->ena_stripping = ice_vsi_ena_outer_stripping;
|
|
|
|
vlan_ops->dis_stripping = ice_vsi_dis_outer_stripping;
|
|
|
|
vlan_ops->ena_insertion = ice_vsi_ena_outer_insertion;
|
|
|
|
vlan_ops->dis_insertion = ice_vsi_dis_outer_insertion;
|
|
|
|
} else {
|
|
|
|
vlan_ops->del_vlan = ice_vsi_del_vlan;
|
|
|
|
}
|
|
|
|
|
2023-11-07 13:51:38 +00:00
|
|
|
vlan_ops->dis_rx_filtering = ice_vsi_dis_rx_vlan_filtering;
|
|
|
|
|
2023-07-12 11:03:35 +00:00
|
|
|
if (!test_bit(ICE_FLAG_VF_VLAN_PRUNING, pf->flags))
|
|
|
|
vlan_ops->ena_rx_filtering = noop_vlan;
|
|
|
|
else
|
|
|
|
vlan_ops->ena_rx_filtering =
|
|
|
|
ice_vsi_ena_rx_vlan_filtering;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ice_vf_vsi_enable_port_vlan - Set VSI VLAN ops to support port VLAN
|
|
|
|
* @vsi: VF's VSI being configured
|
|
|
|
*
|
|
|
|
* The function won't create port VLAN, it only allows to create port VLAN
|
|
|
|
* using VLAN ops on the VF VSI.
|
|
|
|
*/
|
|
|
|
void ice_vf_vsi_enable_port_vlan(struct ice_vsi *vsi)
|
|
|
|
{
|
|
|
|
if (WARN_ON_ONCE(!vsi->vf))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ice_port_vlan_on(vsi);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ice_vf_vsi_disable_port_vlan - Clear VSI support for creating port VLAN
|
|
|
|
* @vsi: VF's VSI being configured
|
|
|
|
*
|
|
|
|
* The function should be called after removing port VLAN on VSI
|
|
|
|
* (using VLAN ops)
|
|
|
|
*/
|
|
|
|
void ice_vf_vsi_disable_port_vlan(struct ice_vsi *vsi)
|
|
|
|
{
|
|
|
|
if (WARN_ON_ONCE(!vsi->vf))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ice_port_vlan_off(vsi);
|
|
|
|
}
|
|
|
|
|
2021-12-02 16:38:46 +00:00
|
|
|
/**
|
|
|
|
* ice_vf_vsi_init_vlan_ops - Initialize default VSI VLAN ops for VF VSI
|
|
|
|
* @vsi: VF's VSI being configured
|
ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2
Add support for the VF driver to be able to request
VIRTCHNL_VF_OFFLOAD_VLAN_V2, negotiate its VLAN capabilities via
VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS, add/delete VLAN filters, and
enable/disable VLAN offloads.
VFs supporting VIRTCHNL_OFFLOAD_VLAN_V2 will be able to use the
following virtchnl opcodes:
VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS
VIRTCHNL_OP_ADD_VLAN_V2
VIRTCHNL_OP_DEL_VLAN_V2
VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2
VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2
VIRTCHNL_OP_ENABLE_VLAN_INSERTION_V2
VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2
Legacy VF drivers may expect the initial VLAN stripping settings to be
configured by the PF, so the PF initializes VLAN stripping based on the
VIRTCHNL_OP_GET_VF_RESOURCES opcode. However, with VLAN support via
VIRTCHNL_VF_OFFLOAD_VLAN_V2, this function is only expected to be used
for VFs that only support VIRTCHNL_VF_OFFLOAD_VLAN, which will only
be supported when a port VLAN is configured. Update the function
based on the new expectations. Also, change the message when the PF
can't enable/disable VLAN stripping to a dev_dbg() as this isn't fatal.
When a VF isn't in a port VLAN and it only supports
VIRTCHNL_VF_OFFLOAD_VLAN when Double VLAN Mode (DVM) is enabled, then
the PF needs to reject the VIRTCHNL_VF_OFFLOAD_VLAN capability and
configure the VF in software only VLAN mode. To do this add the new
function ice_vf_vsi_cfg_legacy_vlan_mode(), which updates the VF's
inner and outer ice_vsi_vlan_ops functions and sets up software only
VLAN mode.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-12-02 16:38:48 +00:00
|
|
|
*
|
|
|
|
* If Double VLAN Mode (DVM) is enabled, assume that the VF supports the new
|
|
|
|
* VIRTCHNL_VF_VLAN_OFFLOAD_V2 capability and set up the VLAN ops accordingly.
|
|
|
|
* If SVM is enabled maintain the same level of VLAN support previous to
|
|
|
|
* VIRTCHNL_VF_VLAN_OFFLOAD_V2.
|
2021-12-02 16:38:46 +00:00
|
|
|
*/
|
|
|
|
void ice_vf_vsi_init_vlan_ops(struct ice_vsi *vsi)
|
|
|
|
{
|
|
|
|
struct ice_vsi_vlan_ops *vlan_ops;
|
|
|
|
struct ice_pf *pf = vsi->back;
|
2022-02-16 21:37:29 +00:00
|
|
|
struct ice_vf *vf = vsi->vf;
|
2021-12-02 16:38:46 +00:00
|
|
|
|
2022-02-16 21:37:29 +00:00
|
|
|
if (WARN_ON(!vf))
|
|
|
|
return;
|
2021-12-02 16:38:46 +00:00
|
|
|
|
2023-07-12 11:03:35 +00:00
|
|
|
if (ice_vf_is_port_vlan_ena(vf))
|
|
|
|
ice_port_vlan_on(vsi);
|
|
|
|
else
|
|
|
|
ice_port_vlan_off(vsi);
|
2021-12-02 16:38:46 +00:00
|
|
|
|
2023-07-12 11:03:35 +00:00
|
|
|
vlan_ops = ice_is_dvm_ena(&pf->hw) ?
|
|
|
|
&vsi->outer_vlan_ops : &vsi->inner_vlan_ops;
|
2021-12-02 16:38:46 +00:00
|
|
|
|
2023-07-12 11:03:35 +00:00
|
|
|
vlan_ops->add_vlan = ice_vsi_add_vlan;
|
|
|
|
vlan_ops->ena_tx_filtering = ice_vsi_ena_tx_vlan_filtering;
|
|
|
|
vlan_ops->dis_tx_filtering = ice_vsi_dis_tx_vlan_filtering;
|
2021-12-02 16:38:46 +00:00
|
|
|
}
|
ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2
Add support for the VF driver to be able to request
VIRTCHNL_VF_OFFLOAD_VLAN_V2, negotiate its VLAN capabilities via
VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS, add/delete VLAN filters, and
enable/disable VLAN offloads.
VFs supporting VIRTCHNL_OFFLOAD_VLAN_V2 will be able to use the
following virtchnl opcodes:
VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS
VIRTCHNL_OP_ADD_VLAN_V2
VIRTCHNL_OP_DEL_VLAN_V2
VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2
VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2
VIRTCHNL_OP_ENABLE_VLAN_INSERTION_V2
VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2
Legacy VF drivers may expect the initial VLAN stripping settings to be
configured by the PF, so the PF initializes VLAN stripping based on the
VIRTCHNL_OP_GET_VF_RESOURCES opcode. However, with VLAN support via
VIRTCHNL_VF_OFFLOAD_VLAN_V2, this function is only expected to be used
for VFs that only support VIRTCHNL_VF_OFFLOAD_VLAN, which will only
be supported when a port VLAN is configured. Update the function
based on the new expectations. Also, change the message when the PF
can't enable/disable VLAN stripping to a dev_dbg() as this isn't fatal.
When a VF isn't in a port VLAN and it only supports
VIRTCHNL_VF_OFFLOAD_VLAN when Double VLAN Mode (DVM) is enabled, then
the PF needs to reject the VIRTCHNL_VF_OFFLOAD_VLAN capability and
configure the VF in software only VLAN mode. To do this add the new
function ice_vf_vsi_cfg_legacy_vlan_mode(), which updates the VF's
inner and outer ice_vsi_vlan_ops functions and sets up software only
VLAN mode.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-12-02 16:38:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ice_vf_vsi_cfg_dvm_legacy_vlan_mode - Config VLAN mode for old VFs in DVM
|
|
|
|
* @vsi: VF's VSI being configured
|
|
|
|
*
|
|
|
|
* This should only be called when Double VLAN Mode (DVM) is enabled, there
|
|
|
|
* is not a port VLAN enabled on this VF, and the VF negotiates
|
|
|
|
* VIRTCHNL_VF_OFFLOAD_VLAN.
|
|
|
|
*
|
|
|
|
* This function sets up the VF VSI's inner and outer ice_vsi_vlan_ops and also
|
|
|
|
* initializes software only VLAN mode (i.e. allow all VLANs). Also, use no-op
|
|
|
|
* implementations for any functions that may be called during the lifetime of
|
|
|
|
* the VF so these methods do nothing and succeed.
|
|
|
|
*/
|
|
|
|
void ice_vf_vsi_cfg_dvm_legacy_vlan_mode(struct ice_vsi *vsi)
|
|
|
|
{
|
|
|
|
struct ice_vsi_vlan_ops *vlan_ops;
|
2022-02-16 21:37:29 +00:00
|
|
|
struct ice_vf *vf = vsi->vf;
|
|
|
|
struct device *dev;
|
|
|
|
|
|
|
|
if (WARN_ON(!vf))
|
|
|
|
return;
|
|
|
|
|
|
|
|
dev = ice_pf_to_dev(vf->pf);
|
ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2
Add support for the VF driver to be able to request
VIRTCHNL_VF_OFFLOAD_VLAN_V2, negotiate its VLAN capabilities via
VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS, add/delete VLAN filters, and
enable/disable VLAN offloads.
VFs supporting VIRTCHNL_OFFLOAD_VLAN_V2 will be able to use the
following virtchnl opcodes:
VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS
VIRTCHNL_OP_ADD_VLAN_V2
VIRTCHNL_OP_DEL_VLAN_V2
VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2
VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2
VIRTCHNL_OP_ENABLE_VLAN_INSERTION_V2
VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2
Legacy VF drivers may expect the initial VLAN stripping settings to be
configured by the PF, so the PF initializes VLAN stripping based on the
VIRTCHNL_OP_GET_VF_RESOURCES opcode. However, with VLAN support via
VIRTCHNL_VF_OFFLOAD_VLAN_V2, this function is only expected to be used
for VFs that only support VIRTCHNL_VF_OFFLOAD_VLAN, which will only
be supported when a port VLAN is configured. Update the function
based on the new expectations. Also, change the message when the PF
can't enable/disable VLAN stripping to a dev_dbg() as this isn't fatal.
When a VF isn't in a port VLAN and it only supports
VIRTCHNL_VF_OFFLOAD_VLAN when Double VLAN Mode (DVM) is enabled, then
the PF needs to reject the VIRTCHNL_VF_OFFLOAD_VLAN capability and
configure the VF in software only VLAN mode. To do this add the new
function ice_vf_vsi_cfg_legacy_vlan_mode(), which updates the VF's
inner and outer ice_vsi_vlan_ops functions and sets up software only
VLAN mode.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-12-02 16:38:48 +00:00
|
|
|
|
|
|
|
if (!ice_is_dvm_ena(&vsi->back->hw) || ice_vf_is_port_vlan_ena(vf))
|
|
|
|
return;
|
|
|
|
|
|
|
|
vlan_ops = &vsi->outer_vlan_ops;
|
|
|
|
|
|
|
|
/* Rx VLAN filtering always disabled to allow software offloaded VLANs
|
|
|
|
* for VFs that only support VIRTCHNL_VF_OFFLOAD_VLAN and don't have a
|
|
|
|
* port VLAN configured
|
|
|
|
*/
|
|
|
|
vlan_ops->dis_rx_filtering = ice_vsi_dis_rx_vlan_filtering;
|
|
|
|
/* Don't fail when attempting to enable Rx VLAN filtering */
|
|
|
|
vlan_ops->ena_rx_filtering = noop_vlan;
|
|
|
|
|
|
|
|
/* Tx VLAN filtering always disabled to allow software offloaded VLANs
|
|
|
|
* for VFs that only support VIRTCHNL_VF_OFFLOAD_VLAN and don't have a
|
|
|
|
* port VLAN configured
|
|
|
|
*/
|
|
|
|
vlan_ops->dis_tx_filtering = ice_vsi_dis_tx_vlan_filtering;
|
|
|
|
/* Don't fail when attempting to enable Tx VLAN filtering */
|
|
|
|
vlan_ops->ena_tx_filtering = noop_vlan;
|
|
|
|
|
|
|
|
if (vlan_ops->dis_rx_filtering(vsi))
|
|
|
|
dev_dbg(dev, "Failed to disable Rx VLAN filtering for old VF without VIRTCHNL_VF_OFFLOAD_VLAN_V2 support\n");
|
|
|
|
if (vlan_ops->dis_tx_filtering(vsi))
|
|
|
|
dev_dbg(dev, "Failed to disable Tx VLAN filtering for old VF without VIRTHCNL_VF_OFFLOAD_VLAN_V2 support\n");
|
|
|
|
|
|
|
|
/* All outer VLAN offloads must be disabled */
|
|
|
|
vlan_ops->dis_stripping = ice_vsi_dis_outer_stripping;
|
|
|
|
vlan_ops->dis_insertion = ice_vsi_dis_outer_insertion;
|
|
|
|
|
|
|
|
if (vlan_ops->dis_stripping(vsi))
|
|
|
|
dev_dbg(dev, "Failed to disable outer VLAN stripping for old VF without VIRTCHNL_VF_OFFLOAD_VLAN_V2 support\n");
|
|
|
|
|
|
|
|
if (vlan_ops->dis_insertion(vsi))
|
|
|
|
dev_dbg(dev, "Failed to disable outer VLAN insertion for old VF without VIRTCHNL_VF_OFFLOAD_VLAN_V2 support\n");
|
|
|
|
|
|
|
|
/* All inner VLAN offloads must be disabled */
|
|
|
|
vlan_ops = &vsi->inner_vlan_ops;
|
|
|
|
|
|
|
|
vlan_ops->dis_stripping = ice_vsi_dis_outer_stripping;
|
|
|
|
vlan_ops->dis_insertion = ice_vsi_dis_outer_insertion;
|
|
|
|
|
|
|
|
if (vlan_ops->dis_stripping(vsi))
|
|
|
|
dev_dbg(dev, "Failed to disable inner VLAN stripping for old VF without VIRTCHNL_VF_OFFLOAD_VLAN_V2 support\n");
|
|
|
|
|
|
|
|
if (vlan_ops->dis_insertion(vsi))
|
|
|
|
dev_dbg(dev, "Failed to disable inner VLAN insertion for old VF without VIRTCHNL_VF_OFFLOAD_VLAN_V2 support\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ice_vf_vsi_cfg_svm_legacy_vlan_mode - Config VLAN mode for old VFs in SVM
|
|
|
|
* @vsi: VF's VSI being configured
|
|
|
|
*
|
|
|
|
* This should only be called when Single VLAN Mode (SVM) is enabled, there is
|
|
|
|
* not a port VLAN enabled on this VF, and the VF negotiates
|
|
|
|
* VIRTCHNL_VF_OFFLOAD_VLAN.
|
|
|
|
*
|
|
|
|
* All of the normal SVM VLAN ops are identical for this case. However, by
|
|
|
|
* default Rx VLAN filtering should be turned off by default in this case.
|
|
|
|
*/
|
|
|
|
void ice_vf_vsi_cfg_svm_legacy_vlan_mode(struct ice_vsi *vsi)
|
|
|
|
{
|
2022-02-16 21:37:29 +00:00
|
|
|
struct ice_vf *vf = vsi->vf;
|
|
|
|
|
|
|
|
if (WARN_ON(!vf))
|
|
|
|
return;
|
ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2
Add support for the VF driver to be able to request
VIRTCHNL_VF_OFFLOAD_VLAN_V2, negotiate its VLAN capabilities via
VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS, add/delete VLAN filters, and
enable/disable VLAN offloads.
VFs supporting VIRTCHNL_OFFLOAD_VLAN_V2 will be able to use the
following virtchnl opcodes:
VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS
VIRTCHNL_OP_ADD_VLAN_V2
VIRTCHNL_OP_DEL_VLAN_V2
VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2
VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2
VIRTCHNL_OP_ENABLE_VLAN_INSERTION_V2
VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2
Legacy VF drivers may expect the initial VLAN stripping settings to be
configured by the PF, so the PF initializes VLAN stripping based on the
VIRTCHNL_OP_GET_VF_RESOURCES opcode. However, with VLAN support via
VIRTCHNL_VF_OFFLOAD_VLAN_V2, this function is only expected to be used
for VFs that only support VIRTCHNL_VF_OFFLOAD_VLAN, which will only
be supported when a port VLAN is configured. Update the function
based on the new expectations. Also, change the message when the PF
can't enable/disable VLAN stripping to a dev_dbg() as this isn't fatal.
When a VF isn't in a port VLAN and it only supports
VIRTCHNL_VF_OFFLOAD_VLAN when Double VLAN Mode (DVM) is enabled, then
the PF needs to reject the VIRTCHNL_VF_OFFLOAD_VLAN capability and
configure the VF in software only VLAN mode. To do this add the new
function ice_vf_vsi_cfg_legacy_vlan_mode(), which updates the VF's
inner and outer ice_vsi_vlan_ops functions and sets up software only
VLAN mode.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-12-02 16:38:48 +00:00
|
|
|
|
|
|
|
if (ice_is_dvm_ena(&vsi->back->hw) || ice_vf_is_port_vlan_ena(vf))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (vsi->inner_vlan_ops.dis_rx_filtering(vsi))
|
|
|
|
dev_dbg(ice_pf_to_dev(vf->pf), "Failed to disable Rx VLAN filtering for old VF with VIRTCHNL_VF_OFFLOAD_VLAN support\n");
|
|
|
|
}
|