Skip to contentSkip to conversation

ice base code update batch 3

PATCH In review Qi Zhang 2 participants 7 messages Jan 21, 2021 Network drivers

lore
Share & tools
lore

Qi Zhang

author
#0 lore raw

cover ice base code update batch 3

Qi Zhang (4):
net/ice/base: fix wrong macro value
net/ice/base: add VLAN TPID for VLAN filters net/ice/base: add support for configuring the device in Double VLAN
Mode
net/ice: add new supported device IDs

 drivers/net/ice/base/README           |   2 +-
 drivers/net/ice/base/ice_adminq_cmd.h |  38 +++-
 drivers/net/ice/base/ice_common.c     |   2 -
 drivers/net/ice/base/ice_devids.h     |  10 +
 drivers/net/ice/base/ice_flex_pipe.c  |   9 +-
 drivers/net/ice/base/ice_switch.c     |  64 ++++++
 drivers/net/ice/base/ice_switch.h     |  14 ++
 drivers/net/ice/base/ice_type.h       |   2 +-
 drivers/net/ice/base/ice_vlan_mode.c  | 284 ++++++++++++++++++++++++--
 drivers/net/ice/base/ice_vlan_mode.h  |  24 +--
 drivers/net/ice/ice_ethdev.c          |   5 +
 11 files changed, 406 insertions(+), 48 deletions(-)
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH 1/4 net/ice/base: fix wrong macro value

Fix the wrong value of ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST

Fixes 9ea028123a0b ("net/ice/base: align add VSI and update VSI AQ command buffer")
---
 drivers/net/ice/base/ice_adminq_cmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ice/base/ice_adminq_cmd.h +1 -1
index 09d0f176c9..74ac76a132 100644
@@ -500,7 +500,7 @@ struct ice_aqc_vsi_props {
 #define ICE_AQ_VSI_OUTER_TAG_VLAN_8100		0x2
 #define ICE_AQ_VSI_OUTER_TAG_VLAN_9100		0x3
 #define ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_INSERT		BIT(4)
-#define ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST		BIT(4)
+#define ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST	BIT(6)
 #define ICE_AQ_VSI_OUTER_VLAN_TX_MODE_S			5
 #define ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M			(0x3 << ICE_AQ_VSI_OUTER_VLAN_TX_MODE_S)
 #define ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ACCEPTUNTAGGED	0x1
Signature · 1 line
2.26.2
author
#2 lore raw

PATCH 2/4 net/ice/base: add VLAN TPID for VLAN filters

In reply to Qi Zhang

Currently VLAN filters via RID4 are only based on VLAN ID. However, with incoming support for Double VLAN Mode (DVM), the driver needs to be able to support filtering on VLAN ID + VLAN TPID (i.e. 0x8100, 0x88a8, etc.). Add support for this by adding two fields to the ice_fltr_info structure. First, add the tpid_valid field so the code can determine whether or not to overwrite the default 0x8100 value for programming packets or use the tpid field.

---
 drivers/net/ice/base/ice_switch.c | 6 ++++++
 drivers/net/ice/base/ice_switch.h | 2 ++
 2 files changed, 8 insertions(+)
drivers/net/ice/base/ice_switch.c +6 -0
index 692a147e66..277623d2bb 100644
@@ -14,6 +14,7 @@
 #define ICE_PPP_IPV6_PROTO_ID		0x0057
 #define ICE_IPV6_ETHER_ID		0x86DD
 #define ICE_TCP_PROTO_ID		0x06
+#define ICE_ETH_P_8021Q			0x8100
 
 /* Dummy ethernet header needed in the ice_aqc_sw_rules_elem
  * struct to configure any switch filter rules.
@@ -3441,6 +3442,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
 		 struct ice_aqc_sw_rules_elem *s_rule, enum ice_adminq_opc opc)
 {
 	u16 vlan_id = ICE_MAX_VLAN_ID + 1;
+	u16 vlan_tpid = ICE_ETH_P_8021Q;
 	void *daddr = NULL;
 	u16 eth_hdr_sz;
 	u8 *eth_hdr;
@@ -3513,6 +3515,8 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
 		break;
 	case ICE_SW_LKUP_VLAN:
 		vlan_id = f_info->l_data.vlan.vlan_id;
+		if (f_info->l_data.vlan.tpid_valid)
+			vlan_tpid = f_info->l_data.vlan.tpid;
 		if (f_info->fltr_act == ICE_FWD_TO_VSI ||
 		    f_info->fltr_act == ICE_FWD_TO_VSI_LIST) {
 			act |= ICE_SINGLE_ACT_PRUNE;
@@ -3556,6 +3560,8 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
 	if (!(vlan_id > ICE_MAX_VLAN_ID)) {
 		off = (_FORCE_ __be16 *)(eth_hdr + ICE_ETH_VLAN_TCI_OFFSET);
 		*off = CPU_TO_BE16(vlan_id);
+		off = (_FORCE_ __be16 *)(eth_hdr + ICE_ETH_ETHTYPE_OFFSET);
+		*off = CPU_TO_BE16(vlan_tpid);
 	}
 
 	/* Create the switch rule with the final dummy Ethernet header */
drivers/net/ice/base/ice_switch.h +2 -0
index c11c064725..a0a7a2e533 100644
@@ -160,6 +160,8 @@ struct ice_fltr_info {
 		} mac_vlan;
 		struct {
 			u16 vlan_id;
+			u16 tpid;
+			u8 tpid_valid;
 		} vlan;
 		/* Set lkup_type as ICE_SW_LKUP_ETHERTYPE
 		 * if just using ethertype as filter. Set lkup_type as
Signature · 1 line
2.26.2
author
#3 lore raw

PATCH 3/4 net/ice/base: add support for configuring the device in Double VLAN Mode

In reply to Qi Zhang

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.

---
 drivers/net/ice/base/ice_adminq_cmd.h |  36 ++++
 drivers/net/ice/base/ice_common.c     |   2 -
 drivers/net/ice/base/ice_flex_pipe.c  |   9 +-
 drivers/net/ice/base/ice_switch.c     |  58 ++++++
 drivers/net/ice/base/ice_switch.h     |  12 ++
 drivers/net/ice/base/ice_type.h       |   2 +-
 drivers/net/ice/base/ice_vlan_mode.c  | 284 ++++++++++++++++++++++++--
 drivers/net/ice/base/ice_vlan_mode.h  |  24 +--
 8 files changed, 381 insertions(+), 46 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +36 -0
index 74ac76a132..8f72f0db33 100644
@@ -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,
drivers/net/ice/base/ice_common.c +0 -2
index d3178240b2..bef7c83512 100644
@@ -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:
drivers/net/ice/base/ice_flex_pipe.c +7 -2
index 31047d1eda..cf470bc4f0 100644
@@ -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;
 }
 
 /**
drivers/net/ice/base/ice_switch.c +58 -0

64 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +12 -0
index a0a7a2e533..04d3c31006 100644
@@ -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_ */
drivers/net/ice/base/ice_type.h +1 -1
index 8d259397a6..414424b66e 100644
@@ -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 */
drivers/net/ice/base/ice_vlan_mode.c +263 -21

328 lines not on this page · raw message

drivers/net/ice/base/ice_vlan_mode.h +4 -20
index fc1069fb6b..e9f13e7814 100644
@@ -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 */
Signature · 1 line
2.26.2
author
#4 lore raw

PATCH 4/4 net/ice: add new supported device IDs

In reply to Qi Zhang

Add device ID support for family E823C, also update the base code BSD version.

---
 drivers/net/ice/base/README       |  2 +-
 drivers/net/ice/base/ice_devids.h | 10 ++++++++++
 drivers/net/ice/ice_ethdev.c      |  5 +++++
 3 files changed, 16 insertions(+), 1 deletion(-)
drivers/net/ice/base/README +1 -1
index bc42736bdd..7d32e58a52 100644
@@ -6,7 +6,7 @@ Intel® ICE driver
 ==================
 
 This directory contains source code of FreeBSD ice driver of version
-2021.01.07 released by the team which develops
+2021.01.20 released by the team which develops
 basic drivers for any ice NIC. The directory of base/ contains the
 original source package.
 This driver is valid for the product(s) listed below
drivers/net/ice/base/ice_devids.h +10 -0
index 93110055e2..b4cdddc8e7 100644
@@ -28,6 +28,16 @@
 #define ICE_DEV_ID_E810_XXV_QSFP	0x159A
 /* Intel(R) Ethernet Controller E810-XXV for SFP */
 #define ICE_DEV_ID_E810_XXV_SFP		0x159B
+/* Intel(R) Ethernet Connection E823-C for backplane */
+#define ICE_DEV_ID_E823C_BACKPLANE	0x188A
+/* Intel(R) Ethernet Connection E823-C for QSFP */
+#define ICE_DEV_ID_E823C_QSFP		0x188B
+/* Intel(R) Ethernet Connection E823-C for SFP */
+#define ICE_DEV_ID_E823C_SFP		0x188C
+/* Intel(R) Ethernet Connection E823-C/X557-AT 10GBASE-T */
+#define ICE_DEV_ID_E823C_10G_BASE_T	0x188D
+/* Intel(R) Ethernet Connection E823-C 1GbE */
+#define ICE_DEV_ID_E823C_SGMII		0x188E
 /* Intel(R) Ethernet Connection E822-C for backplane */
 #define ICE_DEV_ID_E822C_BACKPLANE	0x1890
 /* Intel(R) Ethernet Connection E822-C for QSFP */
drivers/net/ice/ice_ethdev.c +5 -0
index ec29f0fe40..f33c3cbffe 100644
@@ -152,6 +152,11 @@ static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810_XXV_BACKPLANE) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810_XXV_QSFP) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810_XXV_SFP) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E823C_BACKPLANE) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E823C_QSFP) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E823C_SFP) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E823C_10G_BASE_T) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E823C_SGMII) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E822C_BACKPLANE) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E822C_QSFP) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E822C_SFP) },
Signature · 1 line
2.26.2
Acked-by on the v1 series
#5 lore raw
In reply to Qi Zhang
Quoted 29 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, January 21, 2021 09:44
To: Yang, Qiming <[email protected]>
Cc: [email protected]; [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH 0/4] ice base code update batch 3

Qi Zhang (4):
net/ice/base: fix wrong macro value
net/ice/base: add VLAN TPID for VLAN filters net/ice/base: add support for configuring the device in Double VLAN
Mode
net/ice: add new supported device IDs

 drivers/net/ice/base/README           |   2 +-
 drivers/net/ice/base/ice_adminq_cmd.h |  38 +++-
 drivers/net/ice/base/ice_common.c     |   2 -
 drivers/net/ice/base/ice_devids.h     |  10 +
 drivers/net/ice/base/ice_flex_pipe.c  |   9 +-
 drivers/net/ice/base/ice_switch.c     |  64 ++++++
 drivers/net/ice/base/ice_switch.h     |  14 ++
 drivers/net/ice/base/ice_type.h       |   2 +-
 drivers/net/ice/base/ice_vlan_mode.c  | 284 ++++++++++++++++++++++++--
drivers/net/ice/base/ice_vlan_mode.h  |  24 +--
 drivers/net/ice/ice_ethdev.c          |   5 +
 11 files changed, 406 insertions(+), 48 deletions(-)

--
2.26.2

author Applied
#6 lore raw
Quoted 36 lines

-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Thursday, January 21, 2021 11:04 AM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 0/4] ice base code update batch 3

Quoted 24 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, January 21, 2021 09:44
To: Yang, Qiming <[email protected]>
Cc: [email protected]; [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH 0/4] ice base code update batch 3

Qi Zhang (4):
net/ice/base: fix wrong macro value
net/ice/base: add VLAN TPID for VLAN filters net/ice/base: add support for configuring the device in Double VLAN
Mode
net/ice: add new supported device IDs

 drivers/net/ice/base/README           |   2 +-
 drivers/net/ice/base/ice_adminq_cmd.h |  38 +++-
 drivers/net/ice/base/ice_common.c     |   2 -
 drivers/net/ice/base/ice_devids.h     |  10 +
 drivers/net/ice/base/ice_flex_pipe.c  |   9 +-
 drivers/net/ice/base/ice_switch.c     |  64 ++++++
 drivers/net/ice/base/ice_switch.h     |  14 ++
 drivers/net/ice/base/ice_type.h       |   2 +-
 drivers/net/ice/base/ice_vlan_mode.c  | 284
Quoted 1 line

++++++++++++++++++++++++-- drivers/net/ice/base/ice_vlan_mode.h | 24

Quoted 7 lines
+--
>  drivers/net/ice/ice_ethdev.c          |   5 +
>  11 files changed, 406 insertions(+), 48 deletions(-)
Quoted 3 lines

--
2.26.2

Applied to dpdk-next-net-intel.

Thanks
Qi