net/ice/base: support configuring device in double VLAN mode
In order to support configuring the device in Double VLAN Mode (DVM), the DDP and FW have to support DVM. If both support DVM, the PF that downloads the package needs to update the default recipes and set the VLAN mode. This is done in ice_set_dvm(). In order to support updating the default recipes in DVM add support for updating an existing switch recipe's lkup_idx and mask. This is done by first calling the get recipe AQ (0x0292) with the desired recipe ID. Then, if that is successful update one of the lookup indices (lkup_idx) and its associated mask if the mask is valid otherwise the already existing mask will be used. Signed-off-by: Brett Creeley <brett.creeley@intel.com> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> Acked-by: Qiming Yang <qiming.yang@intel.com>
This commit is contained in:
parent
a6b975d23c
commit
14e7a4b37b
@ -358,6 +358,40 @@ struct ice_aqc_get_allocd_res_desc {
|
||||
__le32 addr_low;
|
||||
};
|
||||
|
||||
/* Request buffer for Set VLAN Mode AQ command (indirect 0x020C) */
|
||||
struct ice_aqc_set_vlan_mode {
|
||||
u8 reserved;
|
||||
u8 l2tag_prio_tagging;
|
||||
#define ICE_AQ_VLAN_PRIO_TAG_S 0
|
||||
#define ICE_AQ_VLAN_PRIO_TAG_M (0x7 << ICE_AQ_VLAN_PRIO_TAG_S)
|
||||
#define ICE_AQ_VLAN_PRIO_TAG_NOT_SUPPORTED 0x0
|
||||
#define ICE_AQ_VLAN_PRIO_TAG_STAG 0x1
|
||||
#define ICE_AQ_VLAN_PRIO_TAG_OUTER_CTAG 0x2
|
||||
#define ICE_AQ_VLAN_PRIO_TAG_OUTER_VLAN 0x3
|
||||
#define ICE_AQ_VLAN_PRIO_TAG_INNER_CTAG 0x4
|
||||
#define ICE_AQ_VLAN_PRIO_TAG_MAX 0x4
|
||||
#define ICE_AQ_VLAN_PRIO_TAG_ERROR 0x7
|
||||
u8 l2tag_reserved[64];
|
||||
u8 rdma_packet;
|
||||
#define ICE_AQ_VLAN_RDMA_TAG_S 0
|
||||
#define ICE_AQ_VLAN_RDMA_TAG_M (0x3F << ICE_AQ_VLAN_RDMA_TAG_S)
|
||||
#define ICE_AQ_SVM_VLAN_RDMA_PKT_FLAG_SETTING 0x10
|
||||
#define ICE_AQ_DVM_VLAN_RDMA_PKT_FLAG_SETTING 0x1A
|
||||
u8 rdma_reserved[2];
|
||||
u8 mng_vlan_prot_id;
|
||||
#define ICE_AQ_VLAN_MNG_PROTOCOL_ID_OUTER 0x10
|
||||
#define ICE_AQ_VLAN_MNG_PROTOCOL_ID_INNER 0x11
|
||||
u8 prot_id_reserved[30];
|
||||
};
|
||||
|
||||
/* Response buffer for Get VLAN Mode AQ command (indirect 0x020D) */
|
||||
struct ice_aqc_get_vlan_mode {
|
||||
u8 vlan_mode;
|
||||
#define ICE_AQ_VLAN_MODE_DVM_ENA BIT(0)
|
||||
u8 l2tag_prio_tagging;
|
||||
u8 reserved[98];
|
||||
};
|
||||
|
||||
/* Add VSI (indirect 0x0210)
|
||||
* Update VSI (indirect 0x0211)
|
||||
* Get VSI (indirect 0x0212)
|
||||
@ -2911,6 +2945,8 @@ enum ice_adminq_opc {
|
||||
ice_aqc_opc_alloc_res = 0x0208,
|
||||
ice_aqc_opc_free_res = 0x0209,
|
||||
ice_aqc_opc_get_allocd_res_desc = 0x020A,
|
||||
ice_aqc_opc_set_vlan_mode_parameters = 0x020C,
|
||||
ice_aqc_opc_get_vlan_mode_parameters = 0x020D,
|
||||
|
||||
/* VSI commands */
|
||||
ice_aqc_opc_add_vsi = 0x0210,
|
||||
|
@ -836,8 +836,6 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
|
||||
goto err_unroll_fltr_mgmt_struct;
|
||||
ice_init_lock(&hw->tnl_lock);
|
||||
|
||||
ice_init_vlan_mode_ops(hw);
|
||||
|
||||
return ICE_SUCCESS;
|
||||
|
||||
err_unroll_fltr_mgmt_struct:
|
||||
|
@ -1152,6 +1152,7 @@ static enum ice_status
|
||||
ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg)
|
||||
{
|
||||
struct ice_buf_table *ice_buf_tbl;
|
||||
enum ice_status status;
|
||||
|
||||
ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__);
|
||||
ice_debug(hw, ICE_DBG_PKG, "Segment format version: %d.%d.%d.%d\n",
|
||||
@ -1169,8 +1170,12 @@ ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg)
|
||||
ice_debug(hw, ICE_DBG_PKG, "Seg buf count: %d\n",
|
||||
LE32_TO_CPU(ice_buf_tbl->buf_count));
|
||||
|
||||
return ice_dwnld_cfg_bufs(hw, ice_buf_tbl->buf_array,
|
||||
LE32_TO_CPU(ice_buf_tbl->buf_count));
|
||||
status = ice_dwnld_cfg_bufs(hw, ice_buf_tbl->buf_array,
|
||||
LE32_TO_CPU(ice_buf_tbl->buf_count));
|
||||
|
||||
ice_cache_vlan_mode(hw);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3175,6 +3175,64 @@ ice_aq_get_recipe(struct ice_hw *hw,
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_update_recipe_lkup_idx - update a default recipe based on the lkup_idx
|
||||
* @hw: pointer to the HW struct
|
||||
* @params: parameters used to update the default recipe
|
||||
*
|
||||
* This function only supports updating default recipes and it only supports
|
||||
* updating a single recipe based on the lkup_idx at a time.
|
||||
*
|
||||
* This is done as a read-modify-write operation. First, get the current recipe
|
||||
* contents based on the recipe's ID. Then modify the field vector index and
|
||||
* mask if it's valid at the lkup_idx. Finally, use the add recipe AQ to update
|
||||
* the pre-existing recipe with the modifications.
|
||||
*/
|
||||
enum ice_status
|
||||
ice_update_recipe_lkup_idx(struct ice_hw *hw,
|
||||
struct ice_update_recipe_lkup_idx_params *params)
|
||||
{
|
||||
struct ice_aqc_recipe_data_elem *rcp_list;
|
||||
u16 num_recps = ICE_MAX_NUM_RECIPES;
|
||||
enum ice_status status;
|
||||
|
||||
rcp_list = (struct ice_aqc_recipe_data_elem *)ice_malloc(hw, num_recps * sizeof(*rcp_list));
|
||||
if (!rcp_list)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
|
||||
/* read current recipe list from firmware */
|
||||
rcp_list->recipe_indx = params->rid;
|
||||
status = ice_aq_get_recipe(hw, rcp_list, &num_recps, params->rid, NULL);
|
||||
if (status) {
|
||||
ice_debug(hw, ICE_DBG_SW, "Failed to get recipe %d, status %d\n",
|
||||
params->rid, status);
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
/* only modify existing recipe's lkup_idx and mask if valid, while
|
||||
* leaving all other fields the same, then update the recipe firmware
|
||||
*/
|
||||
rcp_list->content.lkup_indx[params->lkup_idx] = params->fv_idx;
|
||||
if (params->mask_valid)
|
||||
rcp_list->content.mask[params->lkup_idx] =
|
||||
CPU_TO_LE16(params->mask);
|
||||
|
||||
if (params->ignore_valid)
|
||||
rcp_list->content.lkup_indx[params->lkup_idx] |=
|
||||
ICE_AQ_RECIPE_LKUP_IGNORE;
|
||||
|
||||
status = ice_aq_add_recipe(hw, &rcp_list[0], 1, NULL);
|
||||
if (status)
|
||||
ice_debug(hw, ICE_DBG_SW, "Failed to update recipe %d lkup_idx %d fv_idx %d mask %d mask_valid %s, status %d\n",
|
||||
params->rid, params->lkup_idx, params->fv_idx,
|
||||
params->mask, params->mask_valid ? "true" : "false",
|
||||
status);
|
||||
|
||||
error_out:
|
||||
ice_free(hw, rcp_list);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_aq_map_recipe_to_profile - Map recipe to packet profile
|
||||
* @hw: pointer to the HW struct
|
||||
|
@ -201,6 +201,15 @@ struct ice_fltr_info {
|
||||
u8 lan_en; /* Indicate if packet can be forwarded to the uplink */
|
||||
};
|
||||
|
||||
struct ice_update_recipe_lkup_idx_params {
|
||||
u16 rid;
|
||||
u16 fv_idx;
|
||||
bool ignore_valid;
|
||||
u16 mask;
|
||||
bool mask_valid;
|
||||
u8 lkup_idx;
|
||||
};
|
||||
|
||||
struct ice_adv_lkup_elem {
|
||||
enum ice_protocol_type type;
|
||||
union ice_prot_hdr h_u; /* Header values */
|
||||
@ -523,4 +532,7 @@ ice_replay_vsi_all_fltr(struct ice_hw *hw, struct ice_port_info *pi,
|
||||
void ice_rm_sw_replay_rule_info(struct ice_hw *hw, struct ice_switch_info *sw);
|
||||
void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw);
|
||||
bool ice_is_prof_rule(enum ice_sw_tunnel_type type);
|
||||
enum ice_status
|
||||
ice_update_recipe_lkup_idx(struct ice_hw *hw,
|
||||
struct ice_update_recipe_lkup_idx_params *params);
|
||||
#endif /* _ICE_SWITCH_H_ */
|
||||
|
@ -1012,8 +1012,8 @@ struct ice_hw {
|
||||
ice_declare_bitmap(fdir_perfect_fltr, ICE_FLTR_PTYPE_MAX);
|
||||
struct ice_lock rss_locks; /* protect RSS configuration */
|
||||
struct LIST_HEAD_TYPE rss_list_head;
|
||||
struct ice_vlan_mode_ops vlan_mode_ops;
|
||||
ice_declare_bitmap(hw_ptype, ICE_FLOW_PTYPE_MAX);
|
||||
u8 dvm_ena;
|
||||
};
|
||||
|
||||
/* Statistics collected by each port, VSI, VEB, and S-channel */
|
||||
|
@ -55,21 +55,100 @@ ice_pkg_get_supported_vlan_mode(struct ice_hw *hw, bool *dvm)
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_is_dvm_supported - check if double VLAN mode is supported based on DDP
|
||||
* ice_aq_get_vlan_mode - get the VLAN mode of the device
|
||||
* @hw: pointer to the HW structure
|
||||
* @get_params: structure FW fills in based on the current VLAN mode config
|
||||
*
|
||||
* Get VLAN Mode Parameters (0x020D)
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_aq_get_vlan_mode(struct ice_hw *hw,
|
||||
struct ice_aqc_get_vlan_mode *get_params)
|
||||
{
|
||||
struct ice_aq_desc desc;
|
||||
|
||||
if (!get_params)
|
||||
return ICE_ERR_PARAM;
|
||||
|
||||
ice_fill_dflt_direct_cmd_desc(&desc,
|
||||
ice_aqc_opc_get_vlan_mode_parameters);
|
||||
|
||||
return ice_aq_send_cmd(hw, &desc, get_params, sizeof(*get_params),
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_aq_is_dvm_ena - query FW to check if double VLAN mode is enabled
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Returns true if the hardware/firmware is configured in double VLAN mode,
|
||||
* else return false signaling that the hardware/firmware is configured in
|
||||
* single VLAN mode.
|
||||
*
|
||||
* Also, return false if this call fails for any reason (i.e. firmware doesn't
|
||||
* support this AQ call).
|
||||
*/
|
||||
static bool ice_aq_is_dvm_ena(struct ice_hw *hw)
|
||||
{
|
||||
struct ice_aqc_get_vlan_mode get_params = { 0 };
|
||||
enum ice_status status;
|
||||
|
||||
status = ice_aq_get_vlan_mode(hw, &get_params);
|
||||
if (status) {
|
||||
ice_debug(hw, ICE_DBG_AQ, "Failed to get VLAN mode, status %d\n",
|
||||
status);
|
||||
return false;
|
||||
}
|
||||
|
||||
return (get_params.vlan_mode & ICE_AQ_VLAN_MODE_DVM_ENA);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_is_dvm_ena - check if double VLAN mode is enabled
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* The device is configured in single or double VLAN mode on initialization and
|
||||
* this cannot be dynamically changed during runtime. Based on this there is no
|
||||
* need to make an AQ call every time the driver needs to know the VLAN mode.
|
||||
* Instead, use the cached VLAN mode.
|
||||
*/
|
||||
bool ice_is_dvm_ena(struct ice_hw *hw)
|
||||
{
|
||||
return hw->dvm_ena;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_cache_vlan_mode - cache VLAN mode after DDP is downloaded
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* This is only called after downloading the DDP and after the global
|
||||
* configuration lock has been released because all ports on a device need to
|
||||
* cache the VLAN mode.
|
||||
*/
|
||||
void ice_cache_vlan_mode(struct ice_hw *hw)
|
||||
{
|
||||
hw->dvm_ena = ice_aq_is_dvm_ena(hw) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_is_dvm_supported - check if Double VLAN Mode is supported
|
||||
* @hw: pointer to the hardware structure
|
||||
*
|
||||
* Returns true if DVM is supported and false if only SVM is supported. This
|
||||
* function should only be called while the global config lock is held and after
|
||||
* the package has been successfully downloaded.
|
||||
* Returns true if Double VLAN Mode (DVM) is supported and false if only Single
|
||||
* VLAN Mode (SVM) is supported. In order for DVM to be supported the DDP and
|
||||
* firmware must support it, otherwise only SVM is supported. This function
|
||||
* should only be called while the global config lock is held and after the
|
||||
* package has been successfully downloaded.
|
||||
*/
|
||||
static bool ice_is_dvm_supported(struct ice_hw *hw)
|
||||
{
|
||||
struct ice_aqc_get_vlan_mode get_vlan_mode = { 0 };
|
||||
enum ice_status status;
|
||||
bool pkg_supports_dvm;
|
||||
|
||||
status = ice_pkg_get_supported_vlan_mode(hw, &pkg_supports_dvm);
|
||||
if (status) {
|
||||
ice_debug(hw, ICE_DBG_PKG, "Failed to get supported VLAN mode, err %d\n",
|
||||
ice_debug(hw, ICE_DBG_PKG, "Failed to get supported VLAN mode, status %d\n",
|
||||
status);
|
||||
return false;
|
||||
}
|
||||
@ -77,28 +156,196 @@ static bool ice_is_dvm_supported(struct ice_hw *hw)
|
||||
if (!pkg_supports_dvm)
|
||||
return false;
|
||||
|
||||
/* If firmware returns success, then it supports DVM, else it only
|
||||
* supports SVM
|
||||
*/
|
||||
status = ice_aq_get_vlan_mode(hw, &get_vlan_mode);
|
||||
if (status) {
|
||||
ice_debug(hw, ICE_DBG_NVM, "Failed to get VLAN mode, status %d\n",
|
||||
status);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define ICE_EXTERNAL_VLAN_ID_FV_IDX 11
|
||||
#define ICE_SW_LKUP_VLAN_LOC_LKUP_IDX 1
|
||||
#define ICE_SW_LKUP_VLAN_PKT_FLAGS_LKUP_IDX 2
|
||||
#define ICE_SW_LKUP_PROMISC_VLAN_LOC_LKUP_IDX 2
|
||||
#define ICE_PKT_FLAGS_0_TO_15_FV_IDX 1
|
||||
#define ICE_PKT_FLAGS_0_TO_15_VLAN_FLAGS_MASK 0xD000
|
||||
static struct ice_update_recipe_lkup_idx_params ice_dvm_dflt_recipes[] = {
|
||||
{
|
||||
/* Update recipe ICE_SW_LKUP_VLAN to filter based on the
|
||||
* outer/single VLAN in DVM
|
||||
*/
|
||||
.rid = ICE_SW_LKUP_VLAN,
|
||||
.fv_idx = ICE_EXTERNAL_VLAN_ID_FV_IDX,
|
||||
.ignore_valid = true,
|
||||
.mask = 0,
|
||||
.mask_valid = false, /* use pre-existing mask */
|
||||
.lkup_idx = ICE_SW_LKUP_VLAN_LOC_LKUP_IDX,
|
||||
},
|
||||
{
|
||||
/* Update recipe ICE_SW_LKUP_VLAN to filter based on the VLAN
|
||||
* packet flags to support VLAN filtering on multiple VLAN
|
||||
* ethertypes (i.e. 0x8100 and 0x88a8) in DVM
|
||||
*/
|
||||
.rid = ICE_SW_LKUP_VLAN,
|
||||
.fv_idx = ICE_PKT_FLAGS_0_TO_15_FV_IDX,
|
||||
.ignore_valid = false,
|
||||
.mask = ICE_PKT_FLAGS_0_TO_15_VLAN_FLAGS_MASK,
|
||||
.mask_valid = true,
|
||||
.lkup_idx = ICE_SW_LKUP_VLAN_PKT_FLAGS_LKUP_IDX,
|
||||
},
|
||||
{
|
||||
/* Update recipe ICE_SW_LKUP_PROMISC_VLAN to filter based on the
|
||||
* outer/single VLAN in DVM
|
||||
*/
|
||||
.rid = ICE_SW_LKUP_PROMISC_VLAN,
|
||||
.fv_idx = ICE_EXTERNAL_VLAN_ID_FV_IDX,
|
||||
.ignore_valid = true,
|
||||
.mask = 0,
|
||||
.mask_valid = false, /* use pre-existing mask */
|
||||
.lkup_idx = ICE_SW_LKUP_PROMISC_VLAN_LOC_LKUP_IDX,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* ice_dvm_update_dflt_recipes - update default switch recipes in DVM
|
||||
* @hw: hardware structure used to update the recipes
|
||||
*/
|
||||
static enum ice_status ice_dvm_update_dflt_recipes(struct ice_hw *hw)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ice_dvm_dflt_recipes); i++) {
|
||||
struct ice_update_recipe_lkup_idx_params *params;
|
||||
enum ice_status status;
|
||||
|
||||
params = &ice_dvm_dflt_recipes[i];
|
||||
|
||||
status = ice_update_recipe_lkup_idx(hw, params);
|
||||
if (status) {
|
||||
ice_debug(hw, ICE_DBG_INIT, "Failed to update RID %d lkup_idx %d fv_idx %d mask_valid %s mask 0x%04x\n",
|
||||
params->rid, params->lkup_idx, params->fv_idx,
|
||||
params->mask_valid ? "true" : "false",
|
||||
params->mask);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
return ICE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_aq_set_vlan_mode - set the VLAN mode of the device
|
||||
* @hw: pointer to the HW structure
|
||||
* @set_params: requested VLAN mode configuration
|
||||
*
|
||||
* Set VLAN Mode Parameters (0x020C)
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_aq_set_vlan_mode(struct ice_hw *hw,
|
||||
struct ice_aqc_set_vlan_mode *set_params)
|
||||
{
|
||||
u8 rdma_packet, mng_vlan_prot_id;
|
||||
struct ice_aq_desc desc;
|
||||
|
||||
if (!set_params)
|
||||
return ICE_ERR_PARAM;
|
||||
|
||||
if (set_params->l2tag_prio_tagging > ICE_AQ_VLAN_PRIO_TAG_MAX)
|
||||
return ICE_ERR_PARAM;
|
||||
|
||||
rdma_packet = set_params->rdma_packet;
|
||||
if (rdma_packet != ICE_AQ_SVM_VLAN_RDMA_PKT_FLAG_SETTING &&
|
||||
rdma_packet != ICE_AQ_DVM_VLAN_RDMA_PKT_FLAG_SETTING)
|
||||
return ICE_ERR_PARAM;
|
||||
|
||||
mng_vlan_prot_id = set_params->mng_vlan_prot_id;
|
||||
if (mng_vlan_prot_id != ICE_AQ_VLAN_MNG_PROTOCOL_ID_OUTER &&
|
||||
mng_vlan_prot_id != ICE_AQ_VLAN_MNG_PROTOCOL_ID_INNER)
|
||||
return ICE_ERR_PARAM;
|
||||
|
||||
ice_fill_dflt_direct_cmd_desc(&desc,
|
||||
ice_aqc_opc_set_vlan_mode_parameters);
|
||||
desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
|
||||
|
||||
return ice_aq_send_cmd(hw, &desc, set_params, sizeof(*set_params),
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_set_dvm - sets up software and hardware for double VLAN mode
|
||||
* @hw: pointer to the hardware structure
|
||||
*/
|
||||
static enum ice_status ice_set_dvm(struct ice_hw *hw)
|
||||
{
|
||||
struct ice_aqc_set_vlan_mode params = { 0 };
|
||||
enum ice_status status;
|
||||
|
||||
params.l2tag_prio_tagging = ICE_AQ_VLAN_PRIO_TAG_OUTER_CTAG;
|
||||
params.rdma_packet = ICE_AQ_DVM_VLAN_RDMA_PKT_FLAG_SETTING;
|
||||
params.mng_vlan_prot_id = ICE_AQ_VLAN_MNG_PROTOCOL_ID_OUTER;
|
||||
|
||||
status = ice_aq_set_vlan_mode(hw, ¶ms);
|
||||
if (status) {
|
||||
ice_debug(hw, ICE_DBG_INIT, "Failed to set double VLAN mode parameters, status %d\n",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = ice_dvm_update_dflt_recipes(hw);
|
||||
if (status) {
|
||||
ice_debug(hw, ICE_DBG_INIT, "Failed to update default recipes for double VLAN mode, status %d\n",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = ice_aq_set_port_params(hw->port_info, 0, false, false, true,
|
||||
NULL);
|
||||
if (status) {
|
||||
ice_debug(hw, ICE_DBG_INIT, "Failed to set port in double VLAN mode, status %d\n",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
return ICE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_set_svm - set single VLAN mode
|
||||
* @hw: pointer to the HW structure
|
||||
*/
|
||||
static enum ice_status ice_set_svm_dflt(struct ice_hw *hw)
|
||||
static enum ice_status ice_set_svm(struct ice_hw *hw)
|
||||
{
|
||||
ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__);
|
||||
struct ice_aqc_set_vlan_mode *set_params;
|
||||
enum ice_status status;
|
||||
|
||||
return ice_aq_set_port_params(hw->port_info, 0, false, false, false, NULL);
|
||||
}
|
||||
status = ice_aq_set_port_params(hw->port_info, 0, false, false, false, NULL);
|
||||
if (status) {
|
||||
ice_debug(hw, ICE_DBG_INIT, "Failed to set port parameters for single VLAN mode\n");
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_init_vlan_mode_ops - initialize VLAN mode configuration ops
|
||||
* @hw: pointer to the HW structure
|
||||
*/
|
||||
void ice_init_vlan_mode_ops(struct ice_hw *hw)
|
||||
{
|
||||
hw->vlan_mode_ops.set_dvm = NULL;
|
||||
hw->vlan_mode_ops.set_svm = ice_set_svm_dflt;
|
||||
set_params = (struct ice_aqc_set_vlan_mode *)
|
||||
ice_malloc(hw, sizeof(*set_params));
|
||||
if (!set_params)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
|
||||
/* default configuration for SVM configurations */
|
||||
set_params->l2tag_prio_tagging = ICE_AQ_VLAN_PRIO_TAG_INNER_CTAG;
|
||||
set_params->rdma_packet = ICE_AQ_SVM_VLAN_RDMA_PKT_FLAG_SETTING;
|
||||
set_params->mng_vlan_prot_id = ICE_AQ_VLAN_MNG_PROTOCOL_ID_INNER;
|
||||
|
||||
status = ice_aq_set_vlan_mode(hw, set_params);
|
||||
if (status)
|
||||
ice_debug(hw, ICE_DBG_INIT, "Failed to configure port in single VLAN mode\n");
|
||||
|
||||
ice_free(hw, set_params);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,16 +354,11 @@ void ice_init_vlan_mode_ops(struct ice_hw *hw)
|
||||
*/
|
||||
enum ice_status ice_set_vlan_mode(struct ice_hw *hw)
|
||||
{
|
||||
enum ice_status status = ICE_ERR_NOT_IMPL;
|
||||
|
||||
if (!ice_is_dvm_supported(hw))
|
||||
return ICE_SUCCESS;
|
||||
|
||||
if (hw->vlan_mode_ops.set_dvm)
|
||||
status = hw->vlan_mode_ops.set_dvm(hw);
|
||||
if (!ice_set_dvm(hw))
|
||||
return ICE_SUCCESS;
|
||||
|
||||
if (status)
|
||||
return hw->vlan_mode_ops.set_svm(hw);
|
||||
|
||||
return ICE_SUCCESS;
|
||||
return ice_set_svm(hw);
|
||||
}
|
||||
|
@ -5,28 +5,12 @@
|
||||
#ifndef _ICE_VLAN_MODE_H_
|
||||
#define _ICE_VLAN_MODE_H_
|
||||
|
||||
#include "ice_osdep.h"
|
||||
|
||||
struct ice_hw;
|
||||
|
||||
bool ice_is_dvm_ena(struct ice_hw *hw);
|
||||
void ice_cache_vlan_mode(struct ice_hw *hw);
|
||||
enum ice_status ice_set_vlan_mode(struct ice_hw *hw);
|
||||
void ice_init_vlan_mode_ops(struct ice_hw *hw);
|
||||
|
||||
/* This structure defines the VLAN mode configuration interface. It is used to set the VLAN mode.
|
||||
*
|
||||
* Note: These operations will be called while the global configuration lock is held.
|
||||
*
|
||||
* enum ice_status (*set_svm)(struct ice_hw *hw);
|
||||
* This function is called when the DDP and/or Firmware don't support double VLAN mode (DVM) or
|
||||
* if the set_dvm op is not implemented and/or returns failure. It will set the device in
|
||||
* single VLAN mode (SVM).
|
||||
*
|
||||
* enum ice_status (*set_dvm)(struct ice_hw *hw);
|
||||
* This function is called when the DDP and Firmware support double VLAN mode (DVM). It should
|
||||
* be implemented to set double VLAN mode. If it fails or remains unimplemented, set_svm will
|
||||
* be called as a fallback plan.
|
||||
*/
|
||||
struct ice_vlan_mode_ops {
|
||||
enum ice_status (*set_svm)(struct ice_hw *hw);
|
||||
enum ice_status (*set_dvm)(struct ice_hw *hw);
|
||||
};
|
||||
|
||||
#endif /* _ICE_VLAN_MODE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user