Skip to content

Commit a1ffafb

Browse files
bcreeley13anguy11
authored andcommitted
ice: Support configuring the device to 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, set the VLAN mode, and update boost TCAM entries. 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. The VLAN mode of the device has to be configured while the global configuration lock is held while downloading the DDP, specifically after the DDP has been downloaded. If supported, the device will default to DVM. Co-developed-by: Dan Nowlin <dan.nowlin@intel.com> Signed-off-by: Dan Nowlin <dan.nowlin@intel.com> Signed-off-by: Brett Creeley <brett.creeley@intel.com> Tested-by: Gurucharan G <gurucharanx.g@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent cc71de8 commit a1ffafb

17 files changed

+996
-59
lines changed

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ice-y := ice_main.o \
2323
ice_vsi_vlan_lib.o \
2424
ice_fdir.o \
2525
ice_ethtool_fdir.o \
26+
ice_vlan_mode.o \
2627
ice_flex_pipe.o \
2728
ice_flow.o \
2829
ice_idc.o \

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ struct ice_aqc_get_sw_cfg_resp_elem {
226226
#define ICE_AQC_GET_SW_CONF_RESP_IS_VF BIT(15)
227227
};
228228

229+
/* Set Port parameters, (direct, 0x0203) */
230+
struct ice_aqc_set_port_params {
231+
__le16 cmd_flags;
232+
#define ICE_AQC_SET_P_PARAMS_DOUBLE_VLAN_ENA BIT(2)
233+
__le16 bad_frame_vsi;
234+
__le16 swid;
235+
u8 reserved[10];
236+
};
237+
229238
/* These resource type defines are used for all switch resource
230239
* commands where a resource type is required, such as:
231240
* Get Resource Allocation command (indirect 0x0204)
@@ -283,6 +292,40 @@ struct ice_aqc_alloc_free_res_elem {
283292
struct ice_aqc_res_elem elem[];
284293
};
285294

295+
/* Request buffer for Set VLAN Mode AQ command (indirect 0x020C) */
296+
struct ice_aqc_set_vlan_mode {
297+
u8 reserved;
298+
u8 l2tag_prio_tagging;
299+
#define ICE_AQ_VLAN_PRIO_TAG_S 0
300+
#define ICE_AQ_VLAN_PRIO_TAG_M (0x7 << ICE_AQ_VLAN_PRIO_TAG_S)
301+
#define ICE_AQ_VLAN_PRIO_TAG_NOT_SUPPORTED 0x0
302+
#define ICE_AQ_VLAN_PRIO_TAG_STAG 0x1
303+
#define ICE_AQ_VLAN_PRIO_TAG_OUTER_CTAG 0x2
304+
#define ICE_AQ_VLAN_PRIO_TAG_OUTER_VLAN 0x3
305+
#define ICE_AQ_VLAN_PRIO_TAG_INNER_CTAG 0x4
306+
#define ICE_AQ_VLAN_PRIO_TAG_MAX 0x4
307+
#define ICE_AQ_VLAN_PRIO_TAG_ERROR 0x7
308+
u8 l2tag_reserved[64];
309+
u8 rdma_packet;
310+
#define ICE_AQ_VLAN_RDMA_TAG_S 0
311+
#define ICE_AQ_VLAN_RDMA_TAG_M (0x3F << ICE_AQ_VLAN_RDMA_TAG_S)
312+
#define ICE_AQ_SVM_VLAN_RDMA_PKT_FLAG_SETTING 0x10
313+
#define ICE_AQ_DVM_VLAN_RDMA_PKT_FLAG_SETTING 0x1A
314+
u8 rdma_reserved[2];
315+
u8 mng_vlan_prot_id;
316+
#define ICE_AQ_VLAN_MNG_PROTOCOL_ID_OUTER 0x10
317+
#define ICE_AQ_VLAN_MNG_PROTOCOL_ID_INNER 0x11
318+
u8 prot_id_reserved[30];
319+
};
320+
321+
/* Response buffer for Get VLAN Mode AQ command (indirect 0x020D) */
322+
struct ice_aqc_get_vlan_mode {
323+
u8 vlan_mode;
324+
#define ICE_AQ_VLAN_MODE_DVM_ENA BIT(0)
325+
u8 l2tag_prio_tagging;
326+
u8 reserved[98];
327+
};
328+
286329
/* Add VSI (indirect 0x0210)
287330
* Update VSI (indirect 0x0211)
288331
* Get VSI (indirect 0x0212)
@@ -494,9 +537,13 @@ struct ice_aqc_add_get_recipe {
494537

495538
struct ice_aqc_recipe_content {
496539
u8 rid;
540+
#define ICE_AQ_RECIPE_ID_S 0
541+
#define ICE_AQ_RECIPE_ID_M (0x3F << ICE_AQ_RECIPE_ID_S)
497542
#define ICE_AQ_RECIPE_ID_IS_ROOT BIT(7)
498543
#define ICE_AQ_SW_ID_LKUP_IDX 0
499544
u8 lkup_indx[5];
545+
#define ICE_AQ_RECIPE_LKUP_DATA_S 0
546+
#define ICE_AQ_RECIPE_LKUP_DATA_M (0x3F << ICE_AQ_RECIPE_LKUP_DATA_S)
500547
#define ICE_AQ_RECIPE_LKUP_IGNORE BIT(7)
501548
#define ICE_AQ_SW_ID_LKUP_MASK 0x00FF
502549
__le16 mask[5];
@@ -507,15 +554,25 @@ struct ice_aqc_recipe_content {
507554
u8 rsvd0[3];
508555
u8 act_ctrl_join_priority;
509556
u8 act_ctrl_fwd_priority;
557+
#define ICE_AQ_RECIPE_FWD_PRIORITY_S 0
558+
#define ICE_AQ_RECIPE_FWD_PRIORITY_M (0xF << ICE_AQ_RECIPE_FWD_PRIORITY_S)
510559
u8 act_ctrl;
560+
#define ICE_AQ_RECIPE_ACT_NEED_PASS_L2 BIT(0)
561+
#define ICE_AQ_RECIPE_ACT_ALLOW_PASS_L2 BIT(1)
511562
#define ICE_AQ_RECIPE_ACT_INV_ACT BIT(2)
563+
#define ICE_AQ_RECIPE_ACT_PRUNE_INDX_S 4
564+
#define ICE_AQ_RECIPE_ACT_PRUNE_INDX_M (0x3 << ICE_AQ_RECIPE_ACT_PRUNE_INDX_S)
512565
u8 rsvd1;
513566
__le32 dflt_act;
567+
#define ICE_AQ_RECIPE_DFLT_ACT_S 0
568+
#define ICE_AQ_RECIPE_DFLT_ACT_M (0x7FFFF << ICE_AQ_RECIPE_DFLT_ACT_S)
569+
#define ICE_AQ_RECIPE_DFLT_ACT_VALID BIT(31)
514570
};
515571

516572
struct ice_aqc_recipe_data_elem {
517573
u8 recipe_indx;
518574
u8 resp_bits;
575+
#define ICE_AQ_RECIPE_WAS_UPDATED BIT(0)
519576
u8 rsvd0[2];
520577
u8 recipe_bitmap[8];
521578
u8 rsvd1[4];
@@ -1888,7 +1945,7 @@ struct ice_aqc_get_clear_fw_log {
18881945
};
18891946

18901947
/* Download Package (indirect 0x0C40) */
1891-
/* Also used for Update Package (indirect 0x0C42) */
1948+
/* Also used for Update Package (indirect 0x0C41 and 0x0C42) */
18921949
struct ice_aqc_download_pkg {
18931950
u8 flags;
18941951
#define ICE_AQC_DOWNLOAD_PKG_LAST_BUF 0x01
@@ -2014,6 +2071,7 @@ struct ice_aq_desc {
20142071
struct ice_aqc_sff_eeprom read_write_sff_param;
20152072
struct ice_aqc_set_port_id_led set_port_id_led;
20162073
struct ice_aqc_get_sw_cfg get_sw_conf;
2074+
struct ice_aqc_set_port_params set_port_params;
20172075
struct ice_aqc_sw_rules sw_rules;
20182076
struct ice_aqc_add_get_recipe add_get_recipe;
20192077
struct ice_aqc_recipe_to_profile recipe_to_profile;
@@ -2115,10 +2173,13 @@ enum ice_adminq_opc {
21152173

21162174
/* internal switch commands */
21172175
ice_aqc_opc_get_sw_cfg = 0x0200,
2176+
ice_aqc_opc_set_port_params = 0x0203,
21182177

21192178
/* Alloc/Free/Get Resources */
21202179
ice_aqc_opc_alloc_res = 0x0208,
21212180
ice_aqc_opc_free_res = 0x0209,
2181+
ice_aqc_opc_set_vlan_mode_parameters = 0x020C,
2182+
ice_aqc_opc_get_vlan_mode_parameters = 0x020D,
21222183

21232184
/* VSI commands */
21242185
ice_aqc_opc_add_vsi = 0x0210,
@@ -2209,6 +2270,7 @@ enum ice_adminq_opc {
22092270

22102271
/* package commands */
22112272
ice_aqc_opc_download_pkg = 0x0C40,
2273+
ice_aqc_opc_upload_section = 0x0C41,
22122274
ice_aqc_opc_update_pkg = 0x0C42,
22132275
ice_aqc_opc_get_pkg_info_list = 0x0C43,
22142276

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,16 +1518,27 @@ ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf,
15181518

15191519
/* When a package download is in process (i.e. when the firmware's
15201520
* Global Configuration Lock resource is held), only the Download
1521-
* Package, Get Version, Get Package Info List and Release Resource
1522-
* (with resource ID set to Global Config Lock) AdminQ commands are
1523-
* allowed; all others must block until the package download completes
1524-
* and the Global Config Lock is released. See also
1525-
* ice_acquire_global_cfg_lock().
1521+
* Package, Get Version, Get Package Info List, Upload Section,
1522+
* Update Package, Set Port Parameters, Get/Set VLAN Mode Parameters,
1523+
* Add Recipe, Set Recipes to Profile Association, Get Recipe, and Get
1524+
* Recipes to Profile Association, and Release Resource (with resource
1525+
* ID set to Global Config Lock) AdminQ commands are allowed; all others
1526+
* must block until the package download completes and the Global Config
1527+
* Lock is released. See also ice_acquire_global_cfg_lock().
15261528
*/
15271529
switch (le16_to_cpu(desc->opcode)) {
15281530
case ice_aqc_opc_download_pkg:
15291531
case ice_aqc_opc_get_pkg_info_list:
15301532
case ice_aqc_opc_get_ver:
1533+
case ice_aqc_opc_upload_section:
1534+
case ice_aqc_opc_update_pkg:
1535+
case ice_aqc_opc_set_port_params:
1536+
case ice_aqc_opc_get_vlan_mode_parameters:
1537+
case ice_aqc_opc_set_vlan_mode_parameters:
1538+
case ice_aqc_opc_add_recipe:
1539+
case ice_aqc_opc_recipe_to_profile:
1540+
case ice_aqc_opc_get_recipe:
1541+
case ice_aqc_opc_get_recipe_to_profile:
15311542
break;
15321543
case ice_aqc_opc_release_res:
15331544
if (le16_to_cpu(cmd->res_id) == ICE_AQC_RES_ID_GLBL_LOCK)
@@ -2736,6 +2747,34 @@ void ice_clear_pxe_mode(struct ice_hw *hw)
27362747
ice_aq_clear_pxe_mode(hw);
27372748
}
27382749

2750+
/**
2751+
* ice_aq_set_port_params - set physical port parameters.
2752+
* @pi: pointer to the port info struct
2753+
* @double_vlan: if set double VLAN is enabled
2754+
* @cd: pointer to command details structure or NULL
2755+
*
2756+
* Set Physical port parameters (0x0203)
2757+
*/
2758+
int
2759+
ice_aq_set_port_params(struct ice_port_info *pi, bool double_vlan,
2760+
struct ice_sq_cd *cd)
2761+
2762+
{
2763+
struct ice_aqc_set_port_params *cmd;
2764+
struct ice_hw *hw = pi->hw;
2765+
struct ice_aq_desc desc;
2766+
u16 cmd_flags = 0;
2767+
2768+
cmd = &desc.params.set_port_params;
2769+
2770+
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_set_port_params);
2771+
if (double_vlan)
2772+
cmd_flags |= ICE_AQC_SET_P_PARAMS_DOUBLE_VLAN_ENA;
2773+
cmd->cmd_flags = cpu_to_le16(cmd_flags);
2774+
2775+
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
2776+
}
2777+
27392778
/**
27402779
* ice_get_link_speed_based_on_phy_type - returns link speed
27412780
* @phy_type_low: lower part of phy_type

drivers/net/ethernet/intel/ice/ice_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ int
8585
ice_aq_send_driver_ver(struct ice_hw *hw, struct ice_driver_ver *dv,
8686
struct ice_sq_cd *cd);
8787
int
88+
ice_aq_set_port_params(struct ice_port_info *pi, bool double_vlan,
89+
struct ice_sq_cd *cd);
90+
int
8891
ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,
8992
struct ice_aqc_get_phy_caps_data *caps,
9093
struct ice_sq_cd *cd);

0 commit comments

Comments
 (0)