Skip to contentSkip to conversation

base code update

PATCH Superseded Qi Zhang 4 participants 30 messages Dec 5, 2019 – Jan 9, 2020 Network drivers

lore
Share & tools
lore

Qi Zhang

author
#0 lore raw

cover base code update

Main changes:
1. add support for MAC rules on specific port
2. support MAC/VLAN with TCP/UDP in switch rule
3. support 1/10G device
4. couple bug fix and code clean.

Qi Zhang (12):
net/ice/base: whitelist register for NVM access net/ice/base: support MAC/VLAN with TCP/UDP in switch net/ice/base: do not wait for PE unit to load net/ice/base: cleanup format of static const declarations net/ice/base: flexbytes should match on header data net/ice/base: enable clearing of the HW tables net/ice/base: fix loop limit
net/ice/base: increase PF reset wait timeout net/ice/base: change fdir desc preparation net/ice/base: support add MAC rules on specific port net/ice: support 1/10G device IDs
net/ice/base: minor code clean

 drivers/net/ice/base/ice_adminq_cmd.h |   1 +
 drivers/net/ice/base/ice_common.c     |  26 +-
 drivers/net/ice/base/ice_devids.h     |   4 +
 drivers/net/ice/base/ice_fdir.c       |  92 +++---
 drivers/net/ice/base/ice_flex_pipe.c  |  63 ++++-
 drivers/net/ice/base/ice_flex_pipe.h  |   1 +
 drivers/net/ice/base/ice_flow.c       |  17 +-
 drivers/net/ice/base/ice_flow.h       |   2 +-
 drivers/net/ice/base/ice_nvm.c        |  10 +-
 drivers/net/ice/base/ice_switch.c     | 517 +++++++++++++++++++++++++---------
 drivers/net/ice/base/ice_switch.h     |   3 +-
 drivers/net/ice/base/ice_type.h       |   4 -
 drivers/net/ice/ice_ethdev.c          |   2 +
 13 files changed, 534 insertions(+), 208 deletions(-)
Signature · 1 line
2.13.6
author
#1 lore raw

PATCH 1/12 net/ice/base: whitelist register for NVM access

Allow tools to access register offset 0xB8188 (GLGEN_RSTAT) for NVMUpdate operations. This is a read-only register, so risk of other issues stemming from this change is low. Even so, update the write command to prevent and reject any commands which attempt to write to this register, just like we do for GL_HICR_EN.

---
 drivers/net/ice/base/ice_nvm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_nvm.c +8 -2
index 1dbfc2dcc..2d92524f2 100644
@@ -504,6 +504,7 @@ ice_validate_nvm_rw_reg(struct ice_nvm_access_cmd *cmd)
 	case GL_FWSTS:
 	case GL_MNG_FWSM:
 	case GLGEN_CSR_DEBUG_C:
+	case GLGEN_RSTAT:
 	case GLPCI_LBARCTRL:
 	case GLNVM_GENS:
 	case GLNVM_FLA:
@@ -579,9 +580,14 @@ ice_nvm_access_write(struct ice_hw *hw, struct ice_nvm_access_cmd *cmd,
 	if (status)
 		return status;
 
-	/* The HICR_EN register is read-only */
-	if (cmd->offset == GL_HICR_EN)
+	/* Reject requests to write to read-only registers */
+	switch (cmd->offset) {
+	case GL_HICR_EN:
+	case GLGEN_RSTAT:
 		return ICE_ERR_OUT_OF_RANGE;
+	default:
+		break;
+	}
 
 	ice_debug(hw, ICE_DBG_NVM,
 		  "NVM access: writing register %08x with value %08x\n",
Signature · 1 line
2.13.6
author
#2 lore raw

PATCH 2/12 net/ice/base: support MAC/VLAN with TCP/UDP in switch

In reply to Qi Zhang

Add a feature to allow user to add switch filter using input like MAC + VLAN (C-tag only) + L4 (TCP/UDP) port. API "ice_add_adv_rule" is extended to handle this filter type.

---
 drivers/net/ice/base/ice_switch.c | 206 ++++++++++++++++++++++++++++++++++----
 1 file changed, 188 insertions(+), 18 deletions(-)
drivers/net/ice/base/ice_switch.c +188 -18
index afa4fe30d..f8f5fde3c 100644
@@ -251,8 +251,8 @@ u8 dummy_udp_tun_udp_packet[] = {
 	0x00, 0x08, 0x00, 0x00,
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = {
+/* offset info for MAC + IPv4 + UDP dummy packet */
+static const struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -260,8 +260,8 @@ struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_udp_packet[] = {
+/* Dummy packet for MAC + IPv4 + UDP */
+static const u8 dummy_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -280,8 +280,40 @@ dummy_udp_packet[] = {
 	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = {
+/* offset info for MAC + VLAN + IPv4 + UDP dummy packet */
+static const struct ice_dummy_pkt_offsets dummy_vlan_udp_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_VLAN_OFOS,	14 },
+	{ ICE_IPV4_OFOS,	18 },
+	{ ICE_UDP_ILOS,		38 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* C-tag (801.1Q), IPv4:UDP dummy packet */
+static const u8 dummy_vlan_udp_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x81, 0x00,		/* ICE_ETYPE_OL 12 */
+
+	0x00, 0x00, 0x08, 0x00, /* ICE_VLAN_OFOS 14 */
+
+	0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_OFOS 18 */
+	0x00, 0x01, 0x00, 0x00,
+	0x00, 0x11, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 38 */
+	0x00, 0x08, 0x00, 0x00,
+
+	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
+};
+
+/* offset info for MAC + IPv4 + TCP dummy packet */
+static const struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -289,8 +321,8 @@ struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_tcp_packet[] = {
+/* Dummy packet for MAC + IPv4 + TCP */
+static const u8 dummy_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -312,8 +344,42 @@ dummy_tcp_packet[] = {
 	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_tcp_ipv6_packet_offsets[] = {
+/* offset info for MAC + VLAN (C-tag, 802.1Q) + IPv4 + TCP dummy packet */
+static const struct ice_dummy_pkt_offsets dummy_vlan_tcp_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_VLAN_OFOS,	14 },
+	{ ICE_IPV4_OFOS,	18 },
+	{ ICE_TCP_IL,		38 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* C-tag (801.1Q), IPv4:TCP dummy packet */
+static const u8 dummy_vlan_tcp_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x81, 0x00,		/* ICE_ETYPE_OL 12 */
+
+	0x00, 0x00, 0x08, 0x00, /* ICE_VLAN_OFOS 14 */
+
+	0x45, 0x00, 0x00, 0x28, /* ICE_IPV4_OFOS 18 */
+	0x00, 0x01, 0x00, 0x00,
+	0x00, 0x06, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 38 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x50, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_tcp_ipv6_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV6_OFOS,	14 },
@@ -349,8 +415,49 @@ dummy_tcp_ipv6_packet[] = {
 	0x00, 0x00, /* 2 bytes for 4 byte alignment */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_ipv6_packet_offsets[] = {
+/* C-tag (802.1Q): IPv6 + TCP */
+static const struct ice_dummy_pkt_offsets
+dummy_vlan_tcp_ipv6_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_VLAN_OFOS,	14 },
+	{ ICE_IPV6_OFOS,	18 },
+	{ ICE_TCP_IL,		58 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* C-tag (802.1Q), IPv6 + TCP dummy packet */
+static const u8 dummy_vlan_tcp_ipv6_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x81, 0x00,		/* ICE_ETYPE_OL 12 */
+
+	0x00, 0x00, 0x86, 0xDD, /* ICE_VLAN_OFOS 14 */
+
+	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 18 */
+	0x00, 0x14, 0x06, 0x00, /* Next header is TCP */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 58 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x50, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, /* 2 bytes for 4 byte alignment */
+};
+
+/* IPv6 + UDP */
+static const struct ice_dummy_pkt_offsets dummy_udp_ipv6_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV6_OFOS,	14 },
@@ -383,8 +490,45 @@ dummy_udp_ipv6_packet[] = {
 	0x00, 0x00, /* 2 bytes for 4 byte alignment */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_gtp_packet_offsets[] = {
+/* C-tag (802.1Q): IPv6 + UDP */
+static const struct ice_dummy_pkt_offsets
+dummy_vlan_udp_ipv6_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_VLAN_OFOS,	14 },
+	{ ICE_IPV6_OFOS,	18 },
+	{ ICE_UDP_ILOS,		58 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* C-tag (802.1Q), IPv6 + UDP dummy packet */
+static const u8 dummy_vlan_udp_ipv6_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x81, 0x00,		/* ICE_ETYPE_OL 12 */
+
+	0x00, 0x00, 0x86, 0xDD, /* ICE_VLAN_OFOS 14 */
+
+	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 18 */
+	0x00, 0x08, 0x11, 0x00, /* Next header UDP */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 58 */
+	0x00, 0x08, 0x00, 0x00,
+
+	0x00, 0x00, /* 2 bytes for 4 byte alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_udp_gtp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_IPV4_OFOS,	14 },
 	{ ICE_UDP_OF,		34 },
@@ -5643,7 +5787,7 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		      u16 *pkt_len,
 		      const struct ice_dummy_pkt_offsets **offsets)
 {
-	bool tcp = false, udp = false, ipv6 = false;
+	bool tcp = false, udp = false, ipv6 = false, vlan = false;
 	u16 i;
 
 	if (tun_type == ICE_SW_TUN_GTP) {
@@ -5665,6 +5809,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 			tcp = true;
 		else if (lkups[i].type == ICE_IPV6_OFOS)
 			ipv6 = true;
+		else if (lkups[i].type == ICE_VLAN_OFOS)
+			vlan = true;
 	}
 
 	if (tun_type == ICE_ALL_TUNNELS) {
@@ -5704,25 +5850,49 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 	}
 
 	if (udp && !ipv6) {
+		if (vlan) {
+			*pkt = dummy_vlan_udp_packet;
+			*pkt_len = sizeof(dummy_vlan_udp_packet);
+			*offsets = dummy_vlan_udp_packet_offsets;
+			return;
+		}
 		*pkt = dummy_udp_packet;
 		*pkt_len = sizeof(dummy_udp_packet);
 		*offsets = dummy_udp_packet_offsets;
 		return;
 	} else if (udp && ipv6) {
+		if (vlan) {
+			*pkt = dummy_vlan_udp_ipv6_packet;
+			*pkt_len = sizeof(dummy_vlan_udp_ipv6_packet);
+			*offsets = dummy_vlan_udp_ipv6_packet_offsets;
+			return;
+		}
 		*pkt = dummy_udp_ipv6_packet;
 		*pkt_len = sizeof(dummy_udp_ipv6_packet);
 		*offsets = dummy_udp_ipv6_packet_offsets;
 		return;
 	} else if ((tcp && ipv6) || ipv6) {
+		if (vlan) {
+			*pkt = dummy_vlan_tcp_ipv6_packet;
+			*pkt_len = sizeof(dummy_vlan_tcp_ipv6_packet);
+			*offsets = dummy_vlan_tcp_ipv6_packet_offsets;
+			return;
+		}
 		*pkt = dummy_tcp_ipv6_packet;
 		*pkt_len = sizeof(dummy_tcp_ipv6_packet);
 		*offsets = dummy_tcp_ipv6_packet_offsets;
 		return;
 	}
 
-	*pkt = dummy_tcp_packet;
-	*pkt_len = sizeof(dummy_tcp_packet);
-	*offsets = dummy_tcp_packet_offsets;
+	if (vlan) {
+		*pkt = dummy_vlan_tcp_packet;
+		*pkt_len = sizeof(dummy_vlan_tcp_packet);
+		*offsets = dummy_vlan_tcp_packet_offsets;
+	} else {
+		*pkt = dummy_tcp_packet;
+		*pkt_len = sizeof(dummy_tcp_packet);
+		*offsets = dummy_tcp_packet_offsets;
+	}
 }
 
 /**
Signature · 1 line
2.13.6
author
#3 lore raw

PATCH 3/12 net/ice/base: do not wait for PE unit to load

In reply to Qi Zhang

When RDMA is not enabled, when checking for completion of a CORER or GLOBR do not wait for the PE unit to be loaded (indicated by GLNVM_ULD register's PE_DONE bit being set) since that does not happen and will cause issues such as failing to initialize the device.

---
 drivers/net/ice/base/ice_common.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_common.c +13 -7
index 4ba3ab202..bb763913a 100644
@@ -325,6 +325,7 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
 	if (!pi)
 		return ICE_ERR_PARAM;
 	hw = pi->hw;
+
 	li_old = &pi->phy.link_info_old;
 	hw_media_type = &pi->phy.media_type;
 	li = &pi->phy.link_info;
@@ -645,7 +646,6 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
 
 	ice_clear_pxe_mode(hw);
 
-
 	status = ice_get_caps(hw);
 	if (status)
 		goto err_unroll_cqinit;
@@ -666,7 +666,6 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
 		goto err_unroll_alloc;
 
 	hw->evb_veb = true;
-
 	/* Query the allocated resources for Tx scheduler */
 	status = ice_sched_query_res_alloc(hw);
 	if (status) {
@@ -785,7 +784,7 @@ void ice_deinit_hw(struct ice_hw *hw)
  */
 enum ice_status ice_check_reset(struct ice_hw *hw)
 {
-	u32 cnt, reg = 0, grst_delay;
+	u32 cnt, reg = 0, grst_delay, uld_mask;
 
 	/* Poll for Device Active state in case a recent CORER, GLOBR,
 	 * or EMPR has occurred. The grst delay value is in 100ms units.
@@ -807,13 +806,20 @@ enum ice_status ice_check_reset(struct ice_hw *hw)
 		return ICE_ERR_RESET_FAILED;
 	}
 
-#define ICE_RESET_DONE_MASK	(GLNVM_ULD_CORER_DONE_M | \
-				 GLNVM_ULD_GLOBR_DONE_M)
+#define ICE_RESET_DONE_MASK	(GLNVM_ULD_PCIER_DONE_M |\
+				 GLNVM_ULD_PCIER_DONE_1_M |\
+				 GLNVM_ULD_CORER_DONE_M |\
+				 GLNVM_ULD_GLOBR_DONE_M |\
+				 GLNVM_ULD_POR_DONE_M |\
+				 GLNVM_ULD_POR_DONE_1_M |\
+				 GLNVM_ULD_PCIER_DONE_2_M)
+
+	uld_mask = ICE_RESET_DONE_MASK;
 
 	/* Device is Active; check Global Reset processes are done */
 	for (cnt = 0; cnt < ICE_PF_RESET_WAIT_COUNT; cnt++) {
-		reg = rd32(hw, GLNVM_ULD) & ICE_RESET_DONE_MASK;
-		if (reg == ICE_RESET_DONE_MASK) {
+		reg = rd32(hw, GLNVM_ULD) & uld_mask;
+		if (reg == uld_mask) {
 			ice_debug(hw, ICE_DBG_INIT,
 				  "Global reset processes done. %d\n", cnt);
 			break;
Signature · 1 line
2.13.6
author
#4 lore raw

PATCH 4/12 net/ice/base: cleanup format of static const declarations

In reply to Qi Zhang

Use a format consistent with the rest of the code.

---
 drivers/net/ice/base/ice_switch.c | 40 ++++++++++++++-------------------------
 1 file changed, 14 insertions(+), 26 deletions(-)
drivers/net/ice/base/ice_switch.c +14 -26
index f8f5fde3c..3ed84ca01 100644
@@ -57,8 +57,7 @@ struct ice_dummy_pkt_offsets {
 	u16 offset; /* ICE_PROTOCOL_LAST indicates end of list */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_gre_tcp_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_gre_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -69,8 +68,7 @@ struct ice_dummy_pkt_offsets dummy_gre_tcp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const
-u8 dummy_gre_tcp_packet[] = {
+static const u8 dummy_gre_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,	/* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -104,8 +102,7 @@ u8 dummy_gre_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_gre_udp_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_gre_udp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -116,8 +113,7 @@ struct ice_dummy_pkt_offsets dummy_gre_udp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const
-u8 dummy_gre_udp_packet[] = {
+static const u8 dummy_gre_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,	/* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -148,8 +144,7 @@ u8 dummy_gre_udp_packet[] = {
 	0x00, 0x08, 0x00, 0x00,
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -163,8 +158,7 @@ struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const
-u8 dummy_udp_tun_tcp_packet[] = {
+static const u8 dummy_udp_tun_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,  /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -201,8 +195,7 @@ u8 dummy_udp_tun_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_tun_udp_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_udp_tun_udp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -216,8 +209,7 @@ struct ice_dummy_pkt_offsets dummy_udp_tun_udp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const
-u8 dummy_udp_tun_udp_packet[] = {
+static const u8 dummy_udp_tun_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,  /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -387,8 +379,7 @@ static const struct ice_dummy_pkt_offsets dummy_tcp_ipv6_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_tcp_ipv6_packet[] = {
+static const u8 dummy_tcp_ipv6_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -465,8 +456,8 @@ static const struct ice_dummy_pkt_offsets dummy_udp_ipv6_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_udp_ipv6_packet[] = {
+/* IPv6 + UDP dummy packet */
+static const u8 dummy_udp_ipv6_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -536,8 +527,7 @@ static const struct ice_dummy_pkt_offsets dummy_udp_gtp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_udp_gtp_packet[] = {
+static const u8 dummy_udp_gtp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -560,8 +550,7 @@ dummy_udp_gtp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_VLAN_OFOS,	14},
@@ -569,8 +558,7 @@ struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_pppoe_packet[] = {
+static const u8 dummy_pppoe_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
Signature · 1 line
2.13.6
author
#5 lore raw

PATCH 5/12 net/ice/base: flexbytes should match on header data

In reply to Qi Zhang

Change the extraction sequence generated by flow director flexbytes to use package mac protocol. Without this change data in packet headers cannot be used for flexbyte matching. The old extraction for flex bytes started at the beginning of the payload which is after the header.

---
 drivers/net/ice/base/ice_flow.c | 17 ++++-------------
 drivers/net/ice/base/ice_flow.h |  2 +-
 2 files changed, 5 insertions(+), 14 deletions(-)
drivers/net/ice/base/ice_flow.c +4 -13
index 391df1b54..eaa7a3b96 100644
@@ -868,20 +868,11 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 
 		raw = &params->prof->segs[seg].raws[i];
 
-		/* Only support matching raw fields in the payload */
-		if (raw->off < hdrs_sz)
-			return ICE_ERR_PARAM;
-
-		/* Convert the segment-relative offset into payload-relative
-		 * offset.
-		 */
-		off = raw->off - hdrs_sz;
-
 		/* Storing extraction information */
-		raw->info.xtrct.prot_id = ICE_PROT_PAY;
-		raw->info.xtrct.off = (off / ICE_FLOW_FV_EXTRACT_SZ) *
+		raw->info.xtrct.prot_id = ICE_PROT_MAC_OF_OR_S;
+		raw->info.xtrct.off = (raw->off / ICE_FLOW_FV_EXTRACT_SZ) *
 			ICE_FLOW_FV_EXTRACT_SZ;
-		raw->info.xtrct.disp = (off % ICE_FLOW_FV_EXTRACT_SZ) *
+		raw->info.xtrct.disp = (raw->off % ICE_FLOW_FV_EXTRACT_SZ) *
 			BITS_PER_BYTE;
 		raw->info.xtrct.idx = params->es_cnt;
 
@@ -909,7 +900,7 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 			else
 				idx = params->es_cnt;
 
-			params->es[idx].prot_id = ICE_PROT_PAY;
+			params->es[idx].prot_id = raw->info.xtrct.prot_id;
 			params->es[idx].off = off;
 			params->es_cnt++;
 			off += ICE_FLOW_FV_EXTRACT_SZ;
drivers/net/ice/base/ice_flow.h +1 -1
index 4686274af..d7b10ccc3 100644
@@ -282,8 +282,8 @@ struct ice_flow_fld_info {
 };
 
 struct ice_flow_seg_fld_raw {
-	int off;	/* Offset from the start of the segment */
 	struct ice_flow_fld_info info;
+	u16 off;	/* Offset from the start of the segment */
 };
 
 struct ice_flow_seg_info {
Signature · 1 line
2.13.6
author
#6 lore raw

PATCH 6/12 net/ice/base: enable clearing of the HW tables

In reply to Qi Zhang

Enable the code to clear the HW tables.

---
 drivers/net/ice/base/ice_flex_pipe.c | 55 ++++++++++++++++++++++++++++++++++++
 drivers/net/ice/base/ice_flex_pipe.h |  1 +
 2 files changed, 56 insertions(+)
drivers/net/ice/base/ice_flex_pipe.c +55 -0
index e8d4bbee4..28ac3aa75 100644
@@ -3618,6 +3618,61 @@ static void ice_init_flow_profs(struct ice_hw *hw, u8 blk_idx)
 }
 
 /**
+ * ice_clear_hw_tbls - clear HW tables and flow profiles
+ * @hw: pointer to the hardware structure
+ */
+void ice_clear_hw_tbls(struct ice_hw *hw)
+{
+	u8 i;
+
+	for (i = 0; i < ICE_BLK_COUNT; i++) {
+		struct ice_prof_redir *prof_redir = &hw->blk[i].prof_redir;
+		struct ice_prof_tcam *prof = &hw->blk[i].prof;
+		struct ice_xlt1 *xlt1 = &hw->blk[i].xlt1;
+		struct ice_xlt2 *xlt2 = &hw->blk[i].xlt2;
+		struct ice_es *es = &hw->blk[i].es;
+
+		if (hw->blk[i].is_list_init) {
+			ice_free_prof_map(hw, i);
+			ice_free_flow_profs(hw, i);
+		}
+
+		ice_free_vsig_tbl(hw, (enum ice_block)i);
+
+		ice_memset(xlt1->ptypes, 0, xlt1->count * sizeof(*xlt1->ptypes),
+			   ICE_NONDMA_MEM);
+		ice_memset(xlt1->ptg_tbl, 0,
+			   ICE_MAX_PTGS * sizeof(*xlt1->ptg_tbl),
+			   ICE_NONDMA_MEM);
+		ice_memset(xlt1->t, 0, xlt1->count * sizeof(*xlt1->t),
+			   ICE_NONDMA_MEM);
+
+		ice_memset(xlt2->vsis, 0, xlt2->count * sizeof(*xlt2->vsis),
+			   ICE_NONDMA_MEM);
+		ice_memset(xlt2->vsig_tbl, 0,
+			   xlt2->count * sizeof(*xlt2->vsig_tbl),
+			   ICE_NONDMA_MEM);
+		ice_memset(xlt2->t, 0, xlt2->count * sizeof(*xlt2->t),
+			   ICE_NONDMA_MEM);
+
+		ice_memset(prof->t, 0, prof->count * sizeof(*prof->t),
+			   ICE_NONDMA_MEM);
+		ice_memset(prof_redir->t, 0,
+			   prof_redir->count * sizeof(*prof_redir->t),
+			   ICE_NONDMA_MEM);
+
+		ice_memset(es->t, 0, es->count * sizeof(*es->t),
+			   ICE_NONDMA_MEM);
+		ice_memset(es->ref_count, 0, es->count * sizeof(*es->ref_count),
+			   ICE_NONDMA_MEM);
+		ice_memset(es->written, 0, es->count * sizeof(*es->written),
+			   ICE_NONDMA_MEM);
+		ice_memset(es->mask_ena, 0, es->count * sizeof(*es->mask_ena),
+			   ICE_NONDMA_MEM);
+	}
+}
+
+/**
  * ice_init_hw_tbls - init hardware table memory
  * @hw: pointer to the hardware structure
  */
drivers/net/ice/base/ice_flex_pipe.h +1 -0
index ee606af15..fa72e386d 100644
@@ -71,6 +71,7 @@ ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf, u32 len);
 enum ice_status ice_init_hw_tbls(struct ice_hw *hw);
 void ice_free_seg(struct ice_hw *hw);
 void ice_fill_blk_tbls(struct ice_hw *hw);
+void ice_clear_hw_tbls(struct ice_hw *hw);
 void ice_free_hw_tbls(struct ice_hw *hw);
 enum ice_status
 ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id);
Signature · 1 line
2.13.6
author
#7 lore raw

PATCH 7/12 net/ice/base: fix loop limit

In reply to Qi Zhang

In ice_prot_type_to_id routine, correct the loop limit check to use ARRAY_SIZE instead of looking for the array element to have a specific value.

Fixes fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe")
---
 drivers/net/ice/base/ice_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ice/base/ice_switch.c +1 -1
index 3ed84ca01..b2945a9e2 100644
@@ -4880,7 +4880,7 @@ static bool ice_prot_type_to_id(enum ice_protocol_type type, u16 *id)
 {
 	u16 i;
 
-	for (i = 0; ice_prot_id_tbl[i].type != ICE_PROTOCOL_LAST; i++)
+	for (i = 0; i < ARRAY_SIZE(ice_prot_id_tbl); i++)
 		if (ice_prot_id_tbl[i].type == type) {
 			*id = ice_prot_id_tbl[i].protocol_id;
 			return true;
Signature · 1 line
2.13.6
author
#8 lore raw

PATCH 8/12 net/ice/base: increase PF reset wait timeout

In reply to Qi Zhang

Increase the maximum time that the driver will wait for a PF reset from 200 milliseconds to 300 milliseconds, to account for possibility of a slightly longer than expected PF reset.

Fixes 453d087ccaff ("net/ice/base: add common functions")
---
 drivers/net/ice/base/ice_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ice/base/ice_common.c +1 -1
index bb763913a..f3b10a65d 100644
@@ -9,7 +9,7 @@
 #include "ice_flow.h"
 #include "ice_switch.h"
 
-#define ICE_PF_RESET_WAIT_COUNT	200
+#define ICE_PF_RESET_WAIT_COUNT	300
 
 /**
  * ice_set_mac_type - Sets MAC type
Signature · 1 line
2.13.6
author
#9 lore raw

PATCH 9/12 net/ice/base: change fdir desc preparation

In reply to Qi Zhang

Change internal implemenatation of how FD filter programming desc is prepared. This is to minimize the amount of code needed to prep the FD filter programming desc (avoid memcpy, etc...) and just use predefined shifts and mask. This type of change are needed to expedite FD setup during data path (ADQ uses this codepath during initial flow setup) and it will also be useful when adding side-band flow-director filter.

---
 drivers/net/ice/base/ice_fdir.c | 92 ++++++++++++++++++++++++-----------------
 1 file changed, 55 insertions(+), 37 deletions(-)
drivers/net/ice/base/ice_fdir.c +55 -37
index 37b388169..87fa0afba 100644
@@ -352,35 +352,6 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 
 #define ICE_FDIR_NUM_PKT ARRAY_SIZE(ice_fdir_pkt)
 
-/* Flow Direcotr (FD) filter program descriptor Context */
-static const struct ice_ctx_ele ice_fd_fltr_desc_ctx_info[] = {
-					   /* Field		Width	LSB */
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, qindex,		11,	0),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, comp_q,		1,	11),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, comp_report,	2,	12),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fd_space,		2,	14),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, cnt_index,		13,	16),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, cnt_ena,		2,	29),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, evict_ena,		1,	31),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, toq,		3,	32),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, toq_prio,		3,	35),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, dpu_recipe,		2,	38),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, drop,		1,	40),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, flex_prio,		3,	41),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, flex_mdid,		4,	44),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, flex_val,		16,	48),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, dtype,		4,	64),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, pcmd,		1,	68),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, desc_prof_prio,	3,	69),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, desc_prof,		6,	72),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fd_vsi,		10,	78),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, swap,		1,	88),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fdid_prio,		3,	89),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fdid_mdid,		4,	92),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fdid,		32,	96),
-	{ 0 }
-};
-
 /**
  * ice_set_dflt_val_fd_desc
  * @fd_fltr_ctx: pointer to fd filter descriptor
@@ -455,19 +426,66 @@ ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,
 
 /**
  * ice_set_fd_desc_val
- * @fd_fltr_ctx: pointer to fd filter descriptor context
+ * @ctx: pointer to fd filter descriptor context
  * @fdir_desc: populated with fd filter descriptor values
  */
 void
-ice_set_fd_desc_val(struct ice_fd_fltr_desc_ctx *fd_fltr_ctx,
+ice_set_fd_desc_val(struct ice_fd_fltr_desc_ctx *ctx,
 		    struct ice_fltr_desc *fdir_desc)
 {
-	u64 ctx_buf[2] = { 0 };
-
-	ice_set_ctx((u8 *)fd_fltr_ctx, (u8 *)ctx_buf,
-		    ice_fd_fltr_desc_ctx_info);
-	fdir_desc->qidx_compq_space_stat = CPU_TO_LE64(ctx_buf[0]);
-	fdir_desc->dtype_cmd_vsi_fdid = CPU_TO_LE64(ctx_buf[1]);
+	u64 qword;
+
+	/* prep QW0 of FD filter programming desc */
+	qword = ((u64)ctx->qindex << ICE_FXD_FLTR_QW0_QINDEX_S) &
+		ICE_FXD_FLTR_QW0_QINDEX_M;
+	qword |= ((u64)ctx->comp_q << ICE_FXD_FLTR_QW0_COMP_Q_S) &
+		 ICE_FXD_FLTR_QW0_COMP_Q_M;
+	qword |= ((u64)ctx->comp_report << ICE_FXD_FLTR_QW0_COMP_REPORT_S) &
+		 ICE_FXD_FLTR_QW0_COMP_REPORT_M;
+	qword |= ((u64)ctx->fd_space << ICE_FXD_FLTR_QW0_FD_SPACE_S) &
+		 ICE_FXD_FLTR_QW0_FD_SPACE_M;
+	qword |= ((u64)ctx->cnt_index << ICE_FXD_FLTR_QW0_STAT_CNT_S) &
+		 ICE_FXD_FLTR_QW0_STAT_CNT_M;
+	qword |= ((u64)ctx->cnt_ena << ICE_FXD_FLTR_QW0_STAT_ENA_S) &
+		 ICE_FXD_FLTR_QW0_STAT_ENA_M;
+	qword |= ((u64)ctx->evict_ena << ICE_FXD_FLTR_QW0_EVICT_ENA_S) &
+		 ICE_FXD_FLTR_QW0_EVICT_ENA_M;
+	qword |= ((u64)ctx->toq << ICE_FXD_FLTR_QW0_TO_Q_S) &
+		 ICE_FXD_FLTR_QW0_TO_Q_M;
+	qword |= ((u64)ctx->toq_prio << ICE_FXD_FLTR_QW0_TO_Q_PRI_S) &
+		 ICE_FXD_FLTR_QW0_TO_Q_PRI_M;
+	qword |= ((u64)ctx->dpu_recipe << ICE_FXD_FLTR_QW0_DPU_RECIPE_S) &
+		 ICE_FXD_FLTR_QW0_DPU_RECIPE_M;
+	qword |= ((u64)ctx->drop << ICE_FXD_FLTR_QW0_DROP_S) &
+		 ICE_FXD_FLTR_QW0_DROP_M;
+	qword |= ((u64)ctx->flex_prio << ICE_FXD_FLTR_QW0_FLEX_PRI_S) &
+		 ICE_FXD_FLTR_QW0_FLEX_PRI_M;
+	qword |= ((u64)ctx->flex_mdid << ICE_FXD_FLTR_QW0_FLEX_MDID_S) &
+		 ICE_FXD_FLTR_QW0_FLEX_MDID_M;
+	qword |= ((u64)ctx->flex_val << ICE_FXD_FLTR_QW0_FLEX_VAL_S) &
+		 ICE_FXD_FLTR_QW0_FLEX_VAL_M;
+	fdir_desc->qidx_compq_space_stat = CPU_TO_LE64(qword);
+
+	/* prep QW1 of FD filter programming desc */
+	qword = ((u64)ctx->dtype << ICE_FXD_FLTR_QW1_DTYPE_S) &
+		ICE_FXD_FLTR_QW1_DTYPE_M;
+	qword |= ((u64)ctx->pcmd << ICE_FXD_FLTR_QW1_PCMD_S) &
+		 ICE_FXD_FLTR_QW1_PCMD_M;
+	qword |= ((u64)ctx->desc_prof_prio << ICE_FXD_FLTR_QW1_PROF_PRI_S) &
+		 ICE_FXD_FLTR_QW1_PROF_PRI_M;
+	qword |= ((u64)ctx->desc_prof << ICE_FXD_FLTR_QW1_PROF_S) &
+		 ICE_FXD_FLTR_QW1_PROF_M;
+	qword |= ((u64)ctx->fd_vsi << ICE_FXD_FLTR_QW1_FD_VSI_S) &
+		 ICE_FXD_FLTR_QW1_FD_VSI_M;
+	qword |= ((u64)ctx->swap << ICE_FXD_FLTR_QW1_SWAP_S) &
+		 ICE_FXD_FLTR_QW1_SWAP_M;
+	qword |= ((u64)ctx->fdid_prio << ICE_FXD_FLTR_QW1_FDID_PRI_S) &
+		 ICE_FXD_FLTR_QW1_FDID_PRI_M;
+	qword |= ((u64)ctx->fdid_mdid << ICE_FXD_FLTR_QW1_FDID_MDID_S) &
+		 ICE_FXD_FLTR_QW1_FDID_MDID_M;
+	qword |= ((u64)ctx->fdid << ICE_FXD_FLTR_QW1_FDID_S) &
+		 ICE_FXD_FLTR_QW1_FDID_M;
+	fdir_desc->dtype_cmd_vsi_fdid = CPU_TO_LE64(qword);
 }
 
 /**
Signature · 1 line
2.13.6
author
#10 lore raw

PATCH 10/12 net/ice/base: support add MAC rules on specific port

In reply to Qi Zhang

ice_add_mac_rule allow user to add rule to port based on hw->port_info->lport number. Function in some case should allow user to add filter rule on different port, write another function which implemented that behaviour. The same situation is which removing mac function.

Add new api function which allow user to choose port on which rule going to be added. Leave add mac rule function that always add rule on hw->port_info->lport to avoid changes in components which don't need to choose different port. Also add function to remove rule from specific port.

Alloc more switch_info structs to track separately rules for each port. Choose switch_info struct basing on logic port number because in fw added rules are connected with port.

---
 drivers/net/ice/base/ice_common.c |   2 +-
 drivers/net/ice/base/ice_switch.c | 269 +++++++++++++++++++++++++-------------
 drivers/net/ice/base/ice_switch.h |   3 +-
 3 files changed, 180 insertions(+), 94 deletions(-)
drivers/net/ice/base/ice_common.c +1 -1
index f3b10a65d..99ff821ac 100644
@@ -463,7 +463,7 @@ static enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
 
 	INIT_LIST_HEAD(&sw->vsi_list_map_head);
 
-	return ice_init_def_sw_recp(hw);
+	return ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
 }
 
 /**
drivers/net/ice/base/ice_switch.c +177 -92

721 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +2 -1
index 61083738a..598e9c939 100644
@@ -444,7 +444,8 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 
 enum ice_status ice_replay_all_fltr(struct ice_hw *hw);
 
-enum ice_status ice_init_def_sw_recp(struct ice_hw *hw);
+enum ice_status
+ice_init_def_sw_recp(struct ice_hw *hw, struct ice_sw_recipe **recp_list);
 u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle);
 bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle);
 
Signature · 1 line
2.13.6
author
#11 lore raw

PATCH 11/12 net/ice: support 1/10G device IDs

In reply to Qi Zhang

Add support for 1/10G devices.

---
 drivers/net/ice/base/ice_devids.h | 4 ++++
 drivers/net/ice/ice_ethdev.c      | 2 ++
 2 files changed, 6 insertions(+)
drivers/net/ice/base/ice_devids.h +4 -0
index 348d1907a..46ffdee2d 100644
@@ -24,5 +24,9 @@
 #define ICE_DEV_ID_C822N_QSFP		0x1891
 /* Intel(R) Ethernet Connection C822N for SFP */
 #define ICE_DEV_ID_C822N_SFP		0x1892
+/* Intel(R) Ethernet Connection C822N/X557-AT 10GBASE-T */
+#define ICE_DEV_ID_C822N_10G_BASE_T	0x1893
+/* Intel(R) Ethernet Connection C822N 1GbE */
+#define ICE_DEV_ID_C822N_SGMII		0x1894
 
 #endif /* _ICE_DEVIDS_H_ */
drivers/net/ice/ice_ethdev.c +2 -0
index de189daba..5c5feae2a 100644
@@ -163,6 +163,8 @@ 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_C822N_10G_BASE_T) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C822N_SGMII) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
Signature · 1 line
2.13.6
author
#12 lore raw

PATCH 12/12 net/ice/base: minor code clean

In reply to Qi Zhang

Couple minor code clean include:
1. Improve debug message format.
2. Add missing macro and comment.
3. Remove unnecessary compile options.

---
 drivers/net/ice/base/ice_adminq_cmd.h | 1 +
 drivers/net/ice/base/ice_common.c     | 2 +-
 drivers/net/ice/base/ice_flex_pipe.c  | 8 +++++---
 drivers/net/ice/base/ice_type.h       | 4 ----
 4 files changed, 7 insertions(+), 8 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +1 -0
index e6a1350ba..9a79c7645 100644
@@ -1688,6 +1688,7 @@ struct ice_aqc_nvm {
 #define ICE_AQC_NVM_ACTIV_SEL_NVM	BIT(3) /* Write Activate/SR Dump only */
 #define ICE_AQC_NVM_ACTIV_SEL_OROM	BIT(4)
 #define ICE_AQC_NVM_ACTIV_SEL_NETLIST	BIT(5)
+#define ICE_AQC_NVM_SPECIAL_UPDATE	BIT(6)
 #define ICE_AQC_NVM_ACTIV_SEL_MASK	MAKEMASK(0x7, 3)
 #define ICE_AQC_NVM_FLASH_ONLY		BIT(7)
 	__le16 module_typeid;
drivers/net/ice/base/ice_common.c +1 -1
index 99ff821ac..8c2e59918 100644
@@ -593,7 +593,7 @@ void ice_print_rollback_msg(struct ice_hw *hw)
 	SNPRINTF(nvm_str, sizeof(nvm_str), "%x.%02x 0x%x %d.%d.%d", ver_hi,
 		 ver_lo, hw->nvm.eetrack, oem_ver, oem_build, oem_patch);
 	ice_warn(hw,
-		 "Firmware rollback mode detected. Current version is NVM: %s, FW: %d.%d. Device may exhibit limited functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware rollback mode",
+		 "Firmware rollback mode detected. Current version is NVM: %s, FW: %d.%d. Device may exhibit limited functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware rollback mode\n",
 		 nvm_str, hw->fw_maj_ver, hw->fw_min_ver);
 }
 
drivers/net/ice/base/ice_flex_pipe.c +5 -3
index 28ac3aa75..1598efd67 100644
@@ -3069,7 +3069,8 @@ ice_free_prof_mask(struct ice_hw *hw, enum ice_block blk, u16 mask_idx)
 	hw->blk[blk].masks.masks[mask_idx].idx = 0;
 
 	/* update mask as unused entry */
-	ice_debug(hw, ICE_DBG_PKG, "Free mask, blk %d, mask %d", blk, mask_idx);
+	ice_debug(hw, ICE_DBG_PKG, "Free mask, blk %d, mask %d\n", blk,
+		  mask_idx);
 	ice_write_prof_mask_reg(hw, blk, mask_idx, 0, 0);
 
 exit_ice_free_prof_mask:
@@ -4173,7 +4174,7 @@ ice_upd_prof_hw(struct ice_hw *hw, enum ice_block blk,
 	/* update package */
 	status = ice_update_pkg(hw, ice_pkg_buf(b), 1);
 	if (status == ICE_ERR_AQ_ERROR)
-		ice_debug(hw, ICE_DBG_INIT, "Unable to update HW profile.");
+		ice_debug(hw, ICE_DBG_INIT, "Unable to update HW profile\n");
 
 error_tmp:
 	ice_pkg_buf_free(hw, b);
@@ -5227,7 +5228,7 @@ ice_adj_prof_priorities(struct ice_hw *hw, enum ice_block blk, u16 vsig,
  * @blk: hardware block
  * @vsig: the VSIG to which this profile is to be added
  * @hdl: the profile handle indicating the profile to add
- * @rev: true to reverse the additions to the list
+ * @rev: true to add entries to the end of the list
  * @chg: the change list
  */
 static enum ice_status
@@ -5379,6 +5380,7 @@ ice_create_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl,
  * @blk: hardware block
  * @vsi: the initial VSI that will be in VSIG
  * @lst: the list of profile that will be added to the VSIG
+ * @new_vsig: return of new vsig
  * @chg: the change list
  */
 static enum ice_status
drivers/net/ice/base/ice_type.h +0 -4
index a8e4229a1..9773a549f 100644
@@ -14,9 +14,7 @@
 
 #define BITS_PER_BYTE	8
 
-#ifndef _FORCE_
 #define _FORCE_
-#endif
 
 #define ICE_BYTES_PER_WORD	2
 #define ICE_BYTES_PER_DWORD	4
@@ -130,9 +128,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)
 #define ICE_DBG_USER		BIT_ULL(31)
 #define ICE_DBG_ALL		0xFFFFFFFFFFFFFFFFULL
 
-#ifndef __ALWAYS_UNUSED
 #define __ALWAYS_UNUSED
-#endif
 
 #define IS_ETHER_ADDR_EQUAL(addr1, addr2) \
 	(((bool)((((u16 *)(addr1))[0] == ((u16 *)(addr2))[0]))) && \
Signature · 1 line
2.13.6
Acked-by Qiming Yang on the v1 series
#13 lore raw
In reply to Qi Zhang
Quoted 45 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Thursday, December 5, 2019 8:39 PM
To: Yang, Qiming <[email protected]>
Cc: Ye, Xiaolong <[email protected]>; [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH 00/12] base code update

Main changes:
1. add support for MAC rules on specific port 2. support MAC/VLAN with TCP/UDP in switch rule 3. support 1/10G device 4. couple bug fix and code clean.

Qi Zhang (12):
net/ice/base: whitelist register for NVM access net/ice/base: support MAC/VLAN with TCP/UDP in switch net/ice/base: do not wait for PE unit to load net/ice/base: cleanup format of static const declarations net/ice/base: flexbytes should match on header data net/ice/base: enable clearing of the HW tables net/ice/base: fix loop limit
net/ice/base: increase PF reset wait timeout net/ice/base: change fdir desc preparation net/ice/base: support add MAC rules on specific port net/ice: support 1/10G device IDs
net/ice/base: minor code clean

 drivers/net/ice/base/ice_adminq_cmd.h |   1 +
 drivers/net/ice/base/ice_common.c     |  26 +-
 drivers/net/ice/base/ice_devids.h     |   4 +
 drivers/net/ice/base/ice_fdir.c       |  92 +++---
 drivers/net/ice/base/ice_flex_pipe.c  |  63 ++++-
 drivers/net/ice/base/ice_flex_pipe.h  |   1 +
 drivers/net/ice/base/ice_flow.c       |  17 +-
 drivers/net/ice/base/ice_flow.h       |   2 +-
 drivers/net/ice/base/ice_nvm.c        |  10 +-
 drivers/net/ice/base/ice_switch.c     | 517 +++++++++++++++++++++++++------
---
 drivers/net/ice/base/ice_switch.h     |   3 +-
 drivers/net/ice/base/ice_type.h       |   4 -
 drivers/net/ice/ice_ethdev.c          |   2 +
 13 files changed, 534 insertions(+), 208 deletions(-)
Quoted 2 lines

--
2.13.6

Can delete the unnecessary space line in patch 03/12.

author
#14 lore raw

v2 cover base code update

In reply to Qi Zhang

Main changes:
1. add support for MAC rules on specific port
2. support MAC/VLAN with TCP/UDP in switch rule
3. support 1/10G device
4. couple bug fix and code clean.

v2:
- rebase to next-net-intel.
- remove unnecessary empty line in patch 03/12

Qi Zhang (12):
net/ice/base: whitelist register for NVM access net/ice/base: support MAC/VLAN with TCP/UDP in switch net/ice/base: do not wait for PE unit to load net/ice/base: cleanup format of static const declarations net/ice/base: flexbytes should match on header data net/ice/base: enable clearing of the HW tables net/ice/base: fix loop limit
net/ice/base: increase PF reset wait timeout net/ice/base: change fdir desc preparation net/ice/base: support add MAC rules on specific port net/ice: support 1/10G device IDs
net/ice/base: minor code clean

 drivers/net/ice/base/ice_adminq_cmd.h |   1 +
 drivers/net/ice/base/ice_common.c     |  25 +-
 drivers/net/ice/base/ice_devids.h     |   4 +
 drivers/net/ice/base/ice_fdir.c       |  92 +++---
 drivers/net/ice/base/ice_flex_pipe.c  |  63 ++++-
 drivers/net/ice/base/ice_flex_pipe.h  |   1 +
 drivers/net/ice/base/ice_flow.c       |  17 +-
 drivers/net/ice/base/ice_flow.h       |   2 +-
 drivers/net/ice/base/ice_nvm.c        |  10 +-
 drivers/net/ice/base/ice_switch.c     | 517 +++++++++++++++++++++++++---------
 drivers/net/ice/base/ice_switch.h     |   3 +-
 drivers/net/ice/base/ice_type.h       |   4 -
 drivers/net/ice/ice_ethdev.c          |   2 +
 13 files changed, 533 insertions(+), 208 deletions(-)
Signature · 1 line
2.13.6
author
#15 lore raw

PATCH v2 1/12 net/ice/base: whitelist register for NVM access

Allow tools to access register offset 0xB8188 (GLGEN_RSTAT) for NVMUpdate operations. This is a read-only register, so risk of other issues stemming from this change is low. Even so, update the write command to prevent and reject any commands which attempt to write to this register, just like we do for GL_HICR_EN.

---
 drivers/net/ice/base/ice_nvm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_nvm.c +8 -2
index 1dbfc2dcc..2d92524f2 100644
@@ -504,6 +504,7 @@ ice_validate_nvm_rw_reg(struct ice_nvm_access_cmd *cmd)
 	case GL_FWSTS:
 	case GL_MNG_FWSM:
 	case GLGEN_CSR_DEBUG_C:
+	case GLGEN_RSTAT:
 	case GLPCI_LBARCTRL:
 	case GLNVM_GENS:
 	case GLNVM_FLA:
@@ -579,9 +580,14 @@ ice_nvm_access_write(struct ice_hw *hw, struct ice_nvm_access_cmd *cmd,
 	if (status)
 		return status;
 
-	/* The HICR_EN register is read-only */
-	if (cmd->offset == GL_HICR_EN)
+	/* Reject requests to write to read-only registers */
+	switch (cmd->offset) {
+	case GL_HICR_EN:
+	case GLGEN_RSTAT:
 		return ICE_ERR_OUT_OF_RANGE;
+	default:
+		break;
+	}
 
 	ice_debug(hw, ICE_DBG_NVM,
 		  "NVM access: writing register %08x with value %08x\n",
Signature · 1 line
2.13.6
author
#16 lore raw

PATCH v2 2/12 net/ice/base: support MAC/VLAN with TCP/UDP in switch

In reply to Qi Zhang

Add a feature to allow user to add switch filter using input like MAC + VLAN (C-tag only) + L4 (TCP/UDP) port. API "ice_add_adv_rule" is extended to handle this filter type.

---
 drivers/net/ice/base/ice_switch.c | 206 ++++++++++++++++++++++++++++++++++----
 1 file changed, 188 insertions(+), 18 deletions(-)
drivers/net/ice/base/ice_switch.c +188 -18
index afa4fe30d..f8f5fde3c 100644
@@ -251,8 +251,8 @@ u8 dummy_udp_tun_udp_packet[] = {
 	0x00, 0x08, 0x00, 0x00,
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = {
+/* offset info for MAC + IPv4 + UDP dummy packet */
+static const struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -260,8 +260,8 @@ struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_udp_packet[] = {
+/* Dummy packet for MAC + IPv4 + UDP */
+static const u8 dummy_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -280,8 +280,40 @@ dummy_udp_packet[] = {
 	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = {
+/* offset info for MAC + VLAN + IPv4 + UDP dummy packet */
+static const struct ice_dummy_pkt_offsets dummy_vlan_udp_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_VLAN_OFOS,	14 },
+	{ ICE_IPV4_OFOS,	18 },
+	{ ICE_UDP_ILOS,		38 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* C-tag (801.1Q), IPv4:UDP dummy packet */
+static const u8 dummy_vlan_udp_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x81, 0x00,		/* ICE_ETYPE_OL 12 */
+
+	0x00, 0x00, 0x08, 0x00, /* ICE_VLAN_OFOS 14 */
+
+	0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_OFOS 18 */
+	0x00, 0x01, 0x00, 0x00,
+	0x00, 0x11, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 38 */
+	0x00, 0x08, 0x00, 0x00,
+
+	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
+};
+
+/* offset info for MAC + IPv4 + TCP dummy packet */
+static const struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -289,8 +321,8 @@ struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_tcp_packet[] = {
+/* Dummy packet for MAC + IPv4 + TCP */
+static const u8 dummy_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -312,8 +344,42 @@ dummy_tcp_packet[] = {
 	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_tcp_ipv6_packet_offsets[] = {
+/* offset info for MAC + VLAN (C-tag, 802.1Q) + IPv4 + TCP dummy packet */
+static const struct ice_dummy_pkt_offsets dummy_vlan_tcp_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_VLAN_OFOS,	14 },
+	{ ICE_IPV4_OFOS,	18 },
+	{ ICE_TCP_IL,		38 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* C-tag (801.1Q), IPv4:TCP dummy packet */
+static const u8 dummy_vlan_tcp_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x81, 0x00,		/* ICE_ETYPE_OL 12 */
+
+	0x00, 0x00, 0x08, 0x00, /* ICE_VLAN_OFOS 14 */
+
+	0x45, 0x00, 0x00, 0x28, /* ICE_IPV4_OFOS 18 */
+	0x00, 0x01, 0x00, 0x00,
+	0x00, 0x06, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 38 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x50, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_tcp_ipv6_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV6_OFOS,	14 },
@@ -349,8 +415,49 @@ dummy_tcp_ipv6_packet[] = {
 	0x00, 0x00, /* 2 bytes for 4 byte alignment */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_ipv6_packet_offsets[] = {
+/* C-tag (802.1Q): IPv6 + TCP */
+static const struct ice_dummy_pkt_offsets
+dummy_vlan_tcp_ipv6_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_VLAN_OFOS,	14 },
+	{ ICE_IPV6_OFOS,	18 },
+	{ ICE_TCP_IL,		58 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* C-tag (802.1Q), IPv6 + TCP dummy packet */
+static const u8 dummy_vlan_tcp_ipv6_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x81, 0x00,		/* ICE_ETYPE_OL 12 */
+
+	0x00, 0x00, 0x86, 0xDD, /* ICE_VLAN_OFOS 14 */
+
+	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 18 */
+	0x00, 0x14, 0x06, 0x00, /* Next header is TCP */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 58 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x50, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, /* 2 bytes for 4 byte alignment */
+};
+
+/* IPv6 + UDP */
+static const struct ice_dummy_pkt_offsets dummy_udp_ipv6_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV6_OFOS,	14 },
@@ -383,8 +490,45 @@ dummy_udp_ipv6_packet[] = {
 	0x00, 0x00, /* 2 bytes for 4 byte alignment */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_gtp_packet_offsets[] = {
+/* C-tag (802.1Q): IPv6 + UDP */
+static const struct ice_dummy_pkt_offsets
+dummy_vlan_udp_ipv6_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_VLAN_OFOS,	14 },
+	{ ICE_IPV6_OFOS,	18 },
+	{ ICE_UDP_ILOS,		58 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* C-tag (802.1Q), IPv6 + UDP dummy packet */
+static const u8 dummy_vlan_udp_ipv6_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x81, 0x00,		/* ICE_ETYPE_OL 12 */
+
+	0x00, 0x00, 0x86, 0xDD, /* ICE_VLAN_OFOS 14 */
+
+	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 18 */
+	0x00, 0x08, 0x11, 0x00, /* Next header UDP */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 58 */
+	0x00, 0x08, 0x00, 0x00,
+
+	0x00, 0x00, /* 2 bytes for 4 byte alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_udp_gtp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_IPV4_OFOS,	14 },
 	{ ICE_UDP_OF,		34 },
@@ -5643,7 +5787,7 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		      u16 *pkt_len,
 		      const struct ice_dummy_pkt_offsets **offsets)
 {
-	bool tcp = false, udp = false, ipv6 = false;
+	bool tcp = false, udp = false, ipv6 = false, vlan = false;
 	u16 i;
 
 	if (tun_type == ICE_SW_TUN_GTP) {
@@ -5665,6 +5809,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 			tcp = true;
 		else if (lkups[i].type == ICE_IPV6_OFOS)
 			ipv6 = true;
+		else if (lkups[i].type == ICE_VLAN_OFOS)
+			vlan = true;
 	}
 
 	if (tun_type == ICE_ALL_TUNNELS) {
@@ -5704,25 +5850,49 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 	}
 
 	if (udp && !ipv6) {
+		if (vlan) {
+			*pkt = dummy_vlan_udp_packet;
+			*pkt_len = sizeof(dummy_vlan_udp_packet);
+			*offsets = dummy_vlan_udp_packet_offsets;
+			return;
+		}
 		*pkt = dummy_udp_packet;
 		*pkt_len = sizeof(dummy_udp_packet);
 		*offsets = dummy_udp_packet_offsets;
 		return;
 	} else if (udp && ipv6) {
+		if (vlan) {
+			*pkt = dummy_vlan_udp_ipv6_packet;
+			*pkt_len = sizeof(dummy_vlan_udp_ipv6_packet);
+			*offsets = dummy_vlan_udp_ipv6_packet_offsets;
+			return;
+		}
 		*pkt = dummy_udp_ipv6_packet;
 		*pkt_len = sizeof(dummy_udp_ipv6_packet);
 		*offsets = dummy_udp_ipv6_packet_offsets;
 		return;
 	} else if ((tcp && ipv6) || ipv6) {
+		if (vlan) {
+			*pkt = dummy_vlan_tcp_ipv6_packet;
+			*pkt_len = sizeof(dummy_vlan_tcp_ipv6_packet);
+			*offsets = dummy_vlan_tcp_ipv6_packet_offsets;
+			return;
+		}
 		*pkt = dummy_tcp_ipv6_packet;
 		*pkt_len = sizeof(dummy_tcp_ipv6_packet);
 		*offsets = dummy_tcp_ipv6_packet_offsets;
 		return;
 	}
 
-	*pkt = dummy_tcp_packet;
-	*pkt_len = sizeof(dummy_tcp_packet);
-	*offsets = dummy_tcp_packet_offsets;
+	if (vlan) {
+		*pkt = dummy_vlan_tcp_packet;
+		*pkt_len = sizeof(dummy_vlan_tcp_packet);
+		*offsets = dummy_vlan_tcp_packet_offsets;
+	} else {
+		*pkt = dummy_tcp_packet;
+		*pkt_len = sizeof(dummy_tcp_packet);
+		*offsets = dummy_tcp_packet_offsets;
+	}
 }
 
 /**
Signature · 1 line
2.13.6
Acked-by Qiming Yang on v2 2/12
#17 lore raw

Re: [dpdk-dev] [PATCH v2 02/12] net/ice/base: support MAC/VLAN with TCP/UDP in switch

ACK

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Sunday, January 5, 2020 7:39 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Ye, Xiaolong <[email protected]>; Zhang, Qi Z <[email protected]>; Patil, Kiran <[email protected]>; Stillwell Jr, Paul M <[email protected]>
Subject: [PATCH v2 02/12] net/ice/base: support MAC/VLAN with TCP/UDP in switch

Add a feature to allow user to add switch filter using input like MAC + VLAN (C-tag only) + L4 (TCP/UDP) port. API "ice_add_adv_rule" is extended to handle this filter type.

---
 drivers/net/ice/base/ice_switch.c | 206 ++++++++++++++++++++++++++++++++++----
 1 file changed, 188 insertions(+), 18 deletions(-)
drivers/net/ice/base/ice_switch.c +77 -10
index afa4fe30d..f8f5fde3c 100644
@@ -251,8 +251,8 @@ u8 dummy_udp_tun_udp_packet[] = {
 	0x00, 0x08, 0x00, 0x00,
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = {
+/* offset info for MAC + IPv4 + UDP dummy packet */ static const struct 
+ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -260,8 +260,8 @@ struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_udp_packet[] = {
+/* Dummy packet for MAC + IPv4 + UDP */ static const u8 
+dummy_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -280,8 +280,40 @@ dummy_udp_packet[] = {
 	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = {
+/* offset info for MAC + VLAN + IPv4 + UDP dummy packet */ static const 
+struct ice_dummy_pkt_offsets dummy_vlan_udp_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_VLAN_OFOS,	14 },
+	{ ICE_IPV4_OFOS,	18 },
+	{ ICE_UDP_ILOS,		38 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* C-tag (801.1Q), IPv4:UDP dummy packet */ static const u8 
+dummy_vlan_udp_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x81, 0x00,		/* ICE_ETYPE_OL 12 */
+
+	0x00, 0x00, 0x08, 0x00, /* ICE_VLAN_OFOS 14 */
+
+	0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_OFOS 18 */
+	0x00, 0x01, 0x00, 0x00,
+	0x00, 0x11, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 38 */
+	0x00, 0x08, 0x00, 0x00,
+
+	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
+};
+
+/* offset info for MAC + IPv4 + TCP dummy packet */ static const struct 
+ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -289,8 +321,8 @@ struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_tcp_packet[] = {
+/* Dummy packet for MAC + IPv4 + TCP */ static const u8 
+dummy_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -312,8 +344,42 @@ dummy_tcp_packet[] = {
 	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_tcp_ipv6_packet_offsets[] = {
+/* offset info for MAC + VLAN (C-tag, 802.1Q) + IPv4 + TCP dummy packet 
+*/ static const struct ice_dummy_pkt_offsets dummy_vlan_tcp_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_VLAN_OFOS,	14 },
+	{ ICE_IPV4_OFOS,	18 },
+	{ ICE_TCP_IL,		38 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* C-tag (801.1Q), IPv4:TCP dummy packet */ static const u8 
+dummy_vlan_tcp_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x81, 0x00,		/* ICE_ETYPE_OL 12 */
+
+	0x00, 0x00, 0x08, 0x00, /* ICE_VLAN_OFOS 14 */
+
+	0x45, 0x00, 0x00, 0x28, /* ICE_IPV4_OFOS 18 */
+	0x00, 0x01, 0x00, 0x00,
+	0x00, 0x06, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 38 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x50, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
+};
+
+static const struct ice_dummy_pkt_offsets 
+dummy_tcp_ipv6_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },

{ ICE_IPV6_OFOS, 14 },
@@ -349,8 +415,49 @@ dummy_tcp_ipv6_packet[] = {
0x00, 0x00, /* 2 bytes for 4 byte alignment */ };

-static const
-struct ice_dummy_pkt_offsets dummy_udp_ipv6_packet_offsets[] = { +/* C-tag (802.1Q): IPv6 + TCP */
+static const struct ice_dummy_pkt_offsets +dummy_vlan_tcp_ipv6_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_ETYPE_OL, 12 },
+ { ICE_VLAN_OFOS, 14 },
+ { ICE_IPV6_OFOS, 18 },
+ { ICE_TCP_IL, 58 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+/* C-tag (802.1Q), IPv6 + TCP dummy packet */ static const u8 +dummy_vlan_tcp_ipv6_packet[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x81, 0x00, /* ICE_ETYPE_OL 12 */
+
+ 0x00, 0x00, 0x86, 0xDD, /* ICE_VLAN_OFOS 14 */
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 18 */
+ 0x00, 0x14, 0x06, 0x00, /* Next header is TCP */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 58 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x50, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, /* 2 bytes for 4 byte alignment */ };
+
+/* IPv6 + UDP */
+static const struct ice_dummy_pkt_offsets +dummy_udp_ipv6_packet_offsets[] = {
{ ICE_MAC_OFOS, 0 },
{ ICE_ETYPE_OL, 12 },
{ ICE_IPV6_OFOS, 14 },
@@ -383,8 +490,45 @@ dummy_udp_ipv6_packet[] = {
0x00, 0x00, /* 2 bytes for 4 byte alignment */ };

-static const
-struct ice_dummy_pkt_offsets dummy_udp_gtp_packet_offsets[] = {
+/* C-tag (802.1Q): IPv6 + UDP */
+static const struct ice_dummy_pkt_offsets +dummy_vlan_udp_ipv6_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_ETYPE_OL, 12 },
+ { ICE_VLAN_OFOS, 14 },
+ { ICE_IPV6_OFOS, 18 },
+ { ICE_UDP_ILOS, 58 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+/* C-tag (802.1Q), IPv6 + UDP dummy packet */ static const u8 +dummy_vlan_udp_ipv6_packet[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x81, 0x00, /* ICE_ETYPE_OL 12 */
+
+ 0x00, 0x00, 0x86, 0xDD, /* ICE_VLAN_OFOS 14 */
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 18 */
+ 0x00, 0x08, 0x11, 0x00, /* Next header UDP */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 58 */
+ 0x00, 0x08, 0x00, 0x00,
+
+ 0x00, 0x00, /* 2 bytes for 4 byte alignment */ };
+
+static const struct ice_dummy_pkt_offsets
+dummy_udp_gtp_packet_offsets[] = {
{ ICE_MAC_OFOS, 0 },
{ ICE_IPV4_OFOS, 14 },
{ ICE_UDP_OF, 34 },
@@ -5643,7 +5787,7 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
u16 *pkt_len,
const struct ice_dummy_pkt_offsets **offsets) {
- bool tcp = false, udp = false, ipv6 = false;
+ bool tcp = false, udp = false, ipv6 = false, vlan = false;
u16 i;

if (tun_type == ICE_SW_TUN_GTP) {
@@ -5665,6 +5809,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
tcp = true;
else if (lkups[i].type == ICE_IPV6_OFOS)
ipv6 = true;
+ else if (lkups[i].type == ICE_VLAN_OFOS)
+ vlan = true;
}

if (tun_type == ICE_ALL_TUNNELS) {
@@ -5704,25 +5850,49 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
}

if (udp && !ipv6) {
+ if (vlan) {
+ *pkt = dummy_vlan_udp_packet;
+ *pkt_len = sizeof(dummy_vlan_udp_packet);
+ *offsets = dummy_vlan_udp_packet_offsets;
+ return;
+ }
*pkt = dummy_udp_packet; *pkt_len = sizeof(dummy_udp_packet); *offsets = dummy_udp_packet_offsets; return;
} else if (udp && ipv6) {
+ if (vlan) {
+ *pkt = dummy_vlan_udp_ipv6_packet;
+ *pkt_len = sizeof(dummy_vlan_udp_ipv6_packet);
+ *offsets = dummy_vlan_udp_ipv6_packet_offsets;
+ return;
+ }
*pkt = dummy_udp_ipv6_packet; *pkt_len = sizeof(dummy_udp_ipv6_packet); *offsets = dummy_udp_ipv6_packet_offsets; return;
} else if ((tcp && ipv6) || ipv6) {
+ if (vlan) {
+ *pkt = dummy_vlan_tcp_ipv6_packet;
+ *pkt_len = sizeof(dummy_vlan_tcp_ipv6_packet);
+ *offsets = dummy_vlan_tcp_ipv6_packet_offsets;
+ return;
+ }
*pkt = dummy_tcp_ipv6_packet; *pkt_len = sizeof(dummy_tcp_ipv6_packet); *offsets = dummy_tcp_ipv6_packet_offsets; return;
}

- *pkt = dummy_tcp_packet;
- *pkt_len = sizeof(dummy_tcp_packet);
- *offsets = dummy_tcp_packet_offsets;
+ if (vlan) {
+ *pkt = dummy_vlan_tcp_packet;
+ *pkt_len = sizeof(dummy_vlan_tcp_packet);
+ *offsets = dummy_vlan_tcp_packet_offsets;
+ } else {
+ *pkt = dummy_tcp_packet;
+ *pkt_len = sizeof(dummy_tcp_packet);
+ *offsets = dummy_tcp_packet_offsets;
+ }
}

/**
--
2.13.6

author
#18 lore raw

PATCH v2 3/12 net/ice/base: do not wait for PE unit to load

In reply to Qi Zhang

When RDMA is not enabled, when checking for completion of a CORER or GLOBR do not wait for the PE unit to be loaded (indicated by GLNVM_ULD register's PE_DONE bit being set) since that does not happen and will cause issues such as failing to initialize the device.

---
 drivers/net/ice/base/ice_common.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_common.c +12 -7
index 4ba3ab202..319b00f75 100644
@@ -645,7 +645,6 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
 
 	ice_clear_pxe_mode(hw);
 
-
 	status = ice_get_caps(hw);
 	if (status)
 		goto err_unroll_cqinit;
@@ -666,7 +665,6 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
 		goto err_unroll_alloc;
 
 	hw->evb_veb = true;
-
 	/* Query the allocated resources for Tx scheduler */
 	status = ice_sched_query_res_alloc(hw);
 	if (status) {
@@ -785,7 +783,7 @@ void ice_deinit_hw(struct ice_hw *hw)
  */
 enum ice_status ice_check_reset(struct ice_hw *hw)
 {
-	u32 cnt, reg = 0, grst_delay;
+	u32 cnt, reg = 0, grst_delay, uld_mask;
 
 	/* Poll for Device Active state in case a recent CORER, GLOBR,
 	 * or EMPR has occurred. The grst delay value is in 100ms units.
@@ -807,13 +805,20 @@ enum ice_status ice_check_reset(struct ice_hw *hw)
 		return ICE_ERR_RESET_FAILED;
 	}
 
-#define ICE_RESET_DONE_MASK	(GLNVM_ULD_CORER_DONE_M | \
-				 GLNVM_ULD_GLOBR_DONE_M)
+#define ICE_RESET_DONE_MASK	(GLNVM_ULD_PCIER_DONE_M |\
+				 GLNVM_ULD_PCIER_DONE_1_M |\
+				 GLNVM_ULD_CORER_DONE_M |\
+				 GLNVM_ULD_GLOBR_DONE_M |\
+				 GLNVM_ULD_POR_DONE_M |\
+				 GLNVM_ULD_POR_DONE_1_M |\
+				 GLNVM_ULD_PCIER_DONE_2_M)
+
+	uld_mask = ICE_RESET_DONE_MASK;
 
 	/* Device is Active; check Global Reset processes are done */
 	for (cnt = 0; cnt < ICE_PF_RESET_WAIT_COUNT; cnt++) {
-		reg = rd32(hw, GLNVM_ULD) & ICE_RESET_DONE_MASK;
-		if (reg == ICE_RESET_DONE_MASK) {
+		reg = rd32(hw, GLNVM_ULD) & uld_mask;
+		if (reg == uld_mask) {
 			ice_debug(hw, ICE_DBG_INIT,
 				  "Global reset processes done. %d\n", cnt);
 			break;
Signature · 1 line
2.13.6
author
#19 lore raw

PATCH v2 4/12 net/ice/base: cleanup format of static const declarations

In reply to Qi Zhang

Use a format consistent with the rest of the code.

---
 drivers/net/ice/base/ice_switch.c | 40 ++++++++++++++-------------------------
 1 file changed, 14 insertions(+), 26 deletions(-)
drivers/net/ice/base/ice_switch.c +14 -26
index f8f5fde3c..3ed84ca01 100644
@@ -57,8 +57,7 @@ struct ice_dummy_pkt_offsets {
 	u16 offset; /* ICE_PROTOCOL_LAST indicates end of list */
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_gre_tcp_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_gre_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -69,8 +68,7 @@ struct ice_dummy_pkt_offsets dummy_gre_tcp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const
-u8 dummy_gre_tcp_packet[] = {
+static const u8 dummy_gre_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,	/* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -104,8 +102,7 @@ u8 dummy_gre_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_gre_udp_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_gre_udp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -116,8 +113,7 @@ struct ice_dummy_pkt_offsets dummy_gre_udp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const
-u8 dummy_gre_udp_packet[] = {
+static const u8 dummy_gre_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,	/* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -148,8 +144,7 @@ u8 dummy_gre_udp_packet[] = {
 	0x00, 0x08, 0x00, 0x00,
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -163,8 +158,7 @@ struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const
-u8 dummy_udp_tun_tcp_packet[] = {
+static const u8 dummy_udp_tun_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,  /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -201,8 +195,7 @@ u8 dummy_udp_tun_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_udp_tun_udp_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_udp_tun_udp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
@@ -216,8 +209,7 @@ struct ice_dummy_pkt_offsets dummy_udp_tun_udp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const
-u8 dummy_udp_tun_udp_packet[] = {
+static const u8 dummy_udp_tun_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,  /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -387,8 +379,7 @@ static const struct ice_dummy_pkt_offsets dummy_tcp_ipv6_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_tcp_ipv6_packet[] = {
+static const u8 dummy_tcp_ipv6_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -465,8 +456,8 @@ static const struct ice_dummy_pkt_offsets dummy_udp_ipv6_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_udp_ipv6_packet[] = {
+/* IPv6 + UDP dummy packet */
+static const u8 dummy_udp_ipv6_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -536,8 +527,7 @@ static const struct ice_dummy_pkt_offsets dummy_udp_gtp_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_udp_gtp_packet[] = {
+static const u8 dummy_udp_gtp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
@@ -560,8 +550,7 @@ dummy_udp_gtp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
 	{ ICE_VLAN_OFOS,	14},
@@ -569,8 +558,7 @@ struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
-static const u8
-dummy_pppoe_packet[] = {
+static const u8 dummy_pppoe_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
Signature · 1 line
2.13.6
author
#20 lore raw

PATCH v2 5/12 net/ice/base: flexbytes should match on header data

In reply to Qi Zhang

Change the extraction sequence generated by flow director flexbytes to use package mac protocol. Without this change data in packet headers cannot be used for flexbyte matching. The old extraction for flex bytes started at the beginning of the payload which is after the header.

---
 drivers/net/ice/base/ice_flow.c | 17 ++++-------------
 drivers/net/ice/base/ice_flow.h |  2 +-
 2 files changed, 5 insertions(+), 14 deletions(-)
drivers/net/ice/base/ice_flow.c +4 -13
index 391df1b54..eaa7a3b96 100644
@@ -868,20 +868,11 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 
 		raw = &params->prof->segs[seg].raws[i];
 
-		/* Only support matching raw fields in the payload */
-		if (raw->off < hdrs_sz)
-			return ICE_ERR_PARAM;
-
-		/* Convert the segment-relative offset into payload-relative
-		 * offset.
-		 */
-		off = raw->off - hdrs_sz;
-
 		/* Storing extraction information */
-		raw->info.xtrct.prot_id = ICE_PROT_PAY;
-		raw->info.xtrct.off = (off / ICE_FLOW_FV_EXTRACT_SZ) *
+		raw->info.xtrct.prot_id = ICE_PROT_MAC_OF_OR_S;
+		raw->info.xtrct.off = (raw->off / ICE_FLOW_FV_EXTRACT_SZ) *
 			ICE_FLOW_FV_EXTRACT_SZ;
-		raw->info.xtrct.disp = (off % ICE_FLOW_FV_EXTRACT_SZ) *
+		raw->info.xtrct.disp = (raw->off % ICE_FLOW_FV_EXTRACT_SZ) *
 			BITS_PER_BYTE;
 		raw->info.xtrct.idx = params->es_cnt;
 
@@ -909,7 +900,7 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 			else
 				idx = params->es_cnt;
 
-			params->es[idx].prot_id = ICE_PROT_PAY;
+			params->es[idx].prot_id = raw->info.xtrct.prot_id;
 			params->es[idx].off = off;
 			params->es_cnt++;
 			off += ICE_FLOW_FV_EXTRACT_SZ;
drivers/net/ice/base/ice_flow.h +1 -1
index 4686274af..d7b10ccc3 100644
@@ -282,8 +282,8 @@ struct ice_flow_fld_info {
 };
 
 struct ice_flow_seg_fld_raw {
-	int off;	/* Offset from the start of the segment */
 	struct ice_flow_fld_info info;
+	u16 off;	/* Offset from the start of the segment */
 };
 
 struct ice_flow_seg_info {
Signature · 1 line
2.13.6
author
#21 lore raw

PATCH v2 6/12 net/ice/base: enable clearing of the HW tables

In reply to Qi Zhang

Enable the code to clear the HW tables.

---
 drivers/net/ice/base/ice_flex_pipe.c | 55 ++++++++++++++++++++++++++++++++++++
 drivers/net/ice/base/ice_flex_pipe.h |  1 +
 2 files changed, 56 insertions(+)
drivers/net/ice/base/ice_flex_pipe.c +55 -0
index e8d4bbee4..28ac3aa75 100644
@@ -3618,6 +3618,61 @@ static void ice_init_flow_profs(struct ice_hw *hw, u8 blk_idx)
 }
 
 /**
+ * ice_clear_hw_tbls - clear HW tables and flow profiles
+ * @hw: pointer to the hardware structure
+ */
+void ice_clear_hw_tbls(struct ice_hw *hw)
+{
+	u8 i;
+
+	for (i = 0; i < ICE_BLK_COUNT; i++) {
+		struct ice_prof_redir *prof_redir = &hw->blk[i].prof_redir;
+		struct ice_prof_tcam *prof = &hw->blk[i].prof;
+		struct ice_xlt1 *xlt1 = &hw->blk[i].xlt1;
+		struct ice_xlt2 *xlt2 = &hw->blk[i].xlt2;
+		struct ice_es *es = &hw->blk[i].es;
+
+		if (hw->blk[i].is_list_init) {
+			ice_free_prof_map(hw, i);
+			ice_free_flow_profs(hw, i);
+		}
+
+		ice_free_vsig_tbl(hw, (enum ice_block)i);
+
+		ice_memset(xlt1->ptypes, 0, xlt1->count * sizeof(*xlt1->ptypes),
+			   ICE_NONDMA_MEM);
+		ice_memset(xlt1->ptg_tbl, 0,
+			   ICE_MAX_PTGS * sizeof(*xlt1->ptg_tbl),
+			   ICE_NONDMA_MEM);
+		ice_memset(xlt1->t, 0, xlt1->count * sizeof(*xlt1->t),
+			   ICE_NONDMA_MEM);
+
+		ice_memset(xlt2->vsis, 0, xlt2->count * sizeof(*xlt2->vsis),
+			   ICE_NONDMA_MEM);
+		ice_memset(xlt2->vsig_tbl, 0,
+			   xlt2->count * sizeof(*xlt2->vsig_tbl),
+			   ICE_NONDMA_MEM);
+		ice_memset(xlt2->t, 0, xlt2->count * sizeof(*xlt2->t),
+			   ICE_NONDMA_MEM);
+
+		ice_memset(prof->t, 0, prof->count * sizeof(*prof->t),
+			   ICE_NONDMA_MEM);
+		ice_memset(prof_redir->t, 0,
+			   prof_redir->count * sizeof(*prof_redir->t),
+			   ICE_NONDMA_MEM);
+
+		ice_memset(es->t, 0, es->count * sizeof(*es->t),
+			   ICE_NONDMA_MEM);
+		ice_memset(es->ref_count, 0, es->count * sizeof(*es->ref_count),
+			   ICE_NONDMA_MEM);
+		ice_memset(es->written, 0, es->count * sizeof(*es->written),
+			   ICE_NONDMA_MEM);
+		ice_memset(es->mask_ena, 0, es->count * sizeof(*es->mask_ena),
+			   ICE_NONDMA_MEM);
+	}
+}
+
+/**
  * ice_init_hw_tbls - init hardware table memory
  * @hw: pointer to the hardware structure
  */
drivers/net/ice/base/ice_flex_pipe.h +1 -0
index ee606af15..fa72e386d 100644
@@ -71,6 +71,7 @@ ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf, u32 len);
 enum ice_status ice_init_hw_tbls(struct ice_hw *hw);
 void ice_free_seg(struct ice_hw *hw);
 void ice_fill_blk_tbls(struct ice_hw *hw);
+void ice_clear_hw_tbls(struct ice_hw *hw);
 void ice_free_hw_tbls(struct ice_hw *hw);
 enum ice_status
 ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id);
Signature · 1 line
2.13.6
author
#22 lore raw

PATCH v2 7/12 net/ice/base: fix loop limit

In reply to Qi Zhang

In ice_prot_type_to_id routine, correct the loop limit check to use ARRAY_SIZE instead of looking for the array element to have a specific value.

Fixes fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe")
---
 drivers/net/ice/base/ice_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ice/base/ice_switch.c +1 -1
index 3ed84ca01..b2945a9e2 100644
@@ -4880,7 +4880,7 @@ static bool ice_prot_type_to_id(enum ice_protocol_type type, u16 *id)
 {
 	u16 i;
 
-	for (i = 0; ice_prot_id_tbl[i].type != ICE_PROTOCOL_LAST; i++)
+	for (i = 0; i < ARRAY_SIZE(ice_prot_id_tbl); i++)
 		if (ice_prot_id_tbl[i].type == type) {
 			*id = ice_prot_id_tbl[i].protocol_id;
 			return true;
Signature · 1 line
2.13.6
author
#23 lore raw

PATCH v2 8/12 net/ice/base: increase PF reset wait timeout

In reply to Qi Zhang

Increase the maximum time that the driver will wait for a PF reset from 200 milliseconds to 300 milliseconds, to account for possibility of a slightly longer than expected PF reset.

Fixes 453d087ccaff ("net/ice/base: add common functions")
---
 drivers/net/ice/base/ice_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ice/base/ice_common.c +1 -1
index 319b00f75..2e756f542 100644
@@ -9,7 +9,7 @@
 #include "ice_flow.h"
 #include "ice_switch.h"
 
-#define ICE_PF_RESET_WAIT_COUNT	200
+#define ICE_PF_RESET_WAIT_COUNT	300
 
 /**
  * ice_set_mac_type - Sets MAC type
Signature · 1 line
2.13.6
author
#24 lore raw

PATCH v2 9/12 net/ice/base: change fdir desc preparation

In reply to Qi Zhang

Change internal implemenatation of how FD filter programming desc is prepared. This is to minimize the amount of code needed to prep the FD filter programming desc (avoid memcpy, etc...) and just use predefined shifts and mask. This type of change are needed to expedite FD setup during data path (ADQ uses this codepath during initial flow setup) and it will also be useful when adding side-band flow-director filter.

---
 drivers/net/ice/base/ice_fdir.c | 92 ++++++++++++++++++++++++-----------------
 1 file changed, 55 insertions(+), 37 deletions(-)
drivers/net/ice/base/ice_fdir.c +55 -37
index 37b388169..87fa0afba 100644
@@ -352,35 +352,6 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 
 #define ICE_FDIR_NUM_PKT ARRAY_SIZE(ice_fdir_pkt)
 
-/* Flow Direcotr (FD) filter program descriptor Context */
-static const struct ice_ctx_ele ice_fd_fltr_desc_ctx_info[] = {
-					   /* Field		Width	LSB */
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, qindex,		11,	0),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, comp_q,		1,	11),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, comp_report,	2,	12),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fd_space,		2,	14),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, cnt_index,		13,	16),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, cnt_ena,		2,	29),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, evict_ena,		1,	31),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, toq,		3,	32),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, toq_prio,		3,	35),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, dpu_recipe,		2,	38),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, drop,		1,	40),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, flex_prio,		3,	41),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, flex_mdid,		4,	44),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, flex_val,		16,	48),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, dtype,		4,	64),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, pcmd,		1,	68),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, desc_prof_prio,	3,	69),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, desc_prof,		6,	72),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fd_vsi,		10,	78),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, swap,		1,	88),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fdid_prio,		3,	89),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fdid_mdid,		4,	92),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fdid,		32,	96),
-	{ 0 }
-};
-
 /**
  * ice_set_dflt_val_fd_desc
  * @fd_fltr_ctx: pointer to fd filter descriptor
@@ -455,19 +426,66 @@ ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,
 
 /**
  * ice_set_fd_desc_val
- * @fd_fltr_ctx: pointer to fd filter descriptor context
+ * @ctx: pointer to fd filter descriptor context
  * @fdir_desc: populated with fd filter descriptor values
  */
 void
-ice_set_fd_desc_val(struct ice_fd_fltr_desc_ctx *fd_fltr_ctx,
+ice_set_fd_desc_val(struct ice_fd_fltr_desc_ctx *ctx,
 		    struct ice_fltr_desc *fdir_desc)
 {
-	u64 ctx_buf[2] = { 0 };
-
-	ice_set_ctx((u8 *)fd_fltr_ctx, (u8 *)ctx_buf,
-		    ice_fd_fltr_desc_ctx_info);
-	fdir_desc->qidx_compq_space_stat = CPU_TO_LE64(ctx_buf[0]);
-	fdir_desc->dtype_cmd_vsi_fdid = CPU_TO_LE64(ctx_buf[1]);
+	u64 qword;
+
+	/* prep QW0 of FD filter programming desc */
+	qword = ((u64)ctx->qindex << ICE_FXD_FLTR_QW0_QINDEX_S) &
+		ICE_FXD_FLTR_QW0_QINDEX_M;
+	qword |= ((u64)ctx->comp_q << ICE_FXD_FLTR_QW0_COMP_Q_S) &
+		 ICE_FXD_FLTR_QW0_COMP_Q_M;
+	qword |= ((u64)ctx->comp_report << ICE_FXD_FLTR_QW0_COMP_REPORT_S) &
+		 ICE_FXD_FLTR_QW0_COMP_REPORT_M;
+	qword |= ((u64)ctx->fd_space << ICE_FXD_FLTR_QW0_FD_SPACE_S) &
+		 ICE_FXD_FLTR_QW0_FD_SPACE_M;
+	qword |= ((u64)ctx->cnt_index << ICE_FXD_FLTR_QW0_STAT_CNT_S) &
+		 ICE_FXD_FLTR_QW0_STAT_CNT_M;
+	qword |= ((u64)ctx->cnt_ena << ICE_FXD_FLTR_QW0_STAT_ENA_S) &
+		 ICE_FXD_FLTR_QW0_STAT_ENA_M;
+	qword |= ((u64)ctx->evict_ena << ICE_FXD_FLTR_QW0_EVICT_ENA_S) &
+		 ICE_FXD_FLTR_QW0_EVICT_ENA_M;
+	qword |= ((u64)ctx->toq << ICE_FXD_FLTR_QW0_TO_Q_S) &
+		 ICE_FXD_FLTR_QW0_TO_Q_M;
+	qword |= ((u64)ctx->toq_prio << ICE_FXD_FLTR_QW0_TO_Q_PRI_S) &
+		 ICE_FXD_FLTR_QW0_TO_Q_PRI_M;
+	qword |= ((u64)ctx->dpu_recipe << ICE_FXD_FLTR_QW0_DPU_RECIPE_S) &
+		 ICE_FXD_FLTR_QW0_DPU_RECIPE_M;
+	qword |= ((u64)ctx->drop << ICE_FXD_FLTR_QW0_DROP_S) &
+		 ICE_FXD_FLTR_QW0_DROP_M;
+	qword |= ((u64)ctx->flex_prio << ICE_FXD_FLTR_QW0_FLEX_PRI_S) &
+		 ICE_FXD_FLTR_QW0_FLEX_PRI_M;
+	qword |= ((u64)ctx->flex_mdid << ICE_FXD_FLTR_QW0_FLEX_MDID_S) &
+		 ICE_FXD_FLTR_QW0_FLEX_MDID_M;
+	qword |= ((u64)ctx->flex_val << ICE_FXD_FLTR_QW0_FLEX_VAL_S) &
+		 ICE_FXD_FLTR_QW0_FLEX_VAL_M;
+	fdir_desc->qidx_compq_space_stat = CPU_TO_LE64(qword);
+
+	/* prep QW1 of FD filter programming desc */
+	qword = ((u64)ctx->dtype << ICE_FXD_FLTR_QW1_DTYPE_S) &
+		ICE_FXD_FLTR_QW1_DTYPE_M;
+	qword |= ((u64)ctx->pcmd << ICE_FXD_FLTR_QW1_PCMD_S) &
+		 ICE_FXD_FLTR_QW1_PCMD_M;
+	qword |= ((u64)ctx->desc_prof_prio << ICE_FXD_FLTR_QW1_PROF_PRI_S) &
+		 ICE_FXD_FLTR_QW1_PROF_PRI_M;
+	qword |= ((u64)ctx->desc_prof << ICE_FXD_FLTR_QW1_PROF_S) &
+		 ICE_FXD_FLTR_QW1_PROF_M;
+	qword |= ((u64)ctx->fd_vsi << ICE_FXD_FLTR_QW1_FD_VSI_S) &
+		 ICE_FXD_FLTR_QW1_FD_VSI_M;
+	qword |= ((u64)ctx->swap << ICE_FXD_FLTR_QW1_SWAP_S) &
+		 ICE_FXD_FLTR_QW1_SWAP_M;
+	qword |= ((u64)ctx->fdid_prio << ICE_FXD_FLTR_QW1_FDID_PRI_S) &
+		 ICE_FXD_FLTR_QW1_FDID_PRI_M;
+	qword |= ((u64)ctx->fdid_mdid << ICE_FXD_FLTR_QW1_FDID_MDID_S) &
+		 ICE_FXD_FLTR_QW1_FDID_MDID_M;
+	qword |= ((u64)ctx->fdid << ICE_FXD_FLTR_QW1_FDID_S) &
+		 ICE_FXD_FLTR_QW1_FDID_M;
+	fdir_desc->dtype_cmd_vsi_fdid = CPU_TO_LE64(qword);
 }
 
 /**
Signature · 1 line
2.13.6
Acked-by Qiming Yang on v2 9/12
#25 lore raw

Re: [dpdk-dev] [PATCH v2 09/12] net/ice/base: change fdir desc preparation

ACK

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Sunday, January 5, 2020 7:39 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Ye, Xiaolong <[email protected]>; Zhang, Qi Z <[email protected]>; Patil, Kiran <[email protected]>; Stillwell Jr, Paul M <[email protected]>
Subject: [PATCH v2 09/12] net/ice/base: change fdir desc preparation

Change internal implemenatation of how FD filter programming desc is prepared. This is to minimize the amount of code needed to prep the FD filter programming desc (avoid memcpy, etc...) and just use predefined shifts and mask. This type of change are needed to expedite FD setup during data path (ADQ uses this codepath during initial flow setup) and it will also be useful when adding side-band flow-director filter.

---
 drivers/net/ice/base/ice_fdir.c | 92 ++++++++++++++++++++++++-----------------
 1 file changed, 55 insertions(+), 37 deletions(-)
drivers/net/ice/base/ice_fdir.c +0 -28
@@ -352,35 +352,6 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 
 #define ICE_FDIR_NUM_PKT ARRAY_SIZE(ice_fdir_pkt)
 
-/* Flow Direcotr (FD) filter program descriptor Context */ -static const struct ice_ctx_ele ice_fd_fltr_desc_ctx_info[] = {
-					   /* Field		Width	LSB */
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, qindex,		11,	0),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, comp_q,		1,	11),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, comp_report,	2,	12),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fd_space,		2,	14),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, cnt_index,		13,	16),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, cnt_ena,		2,	29),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, evict_ena,		1,	31),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, toq,		3,	32),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, toq_prio,		3,	35),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, dpu_recipe,		2,	38),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, drop,		1,	40),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, flex_prio,		3,	41),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, flex_mdid,		4,	44),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, flex_val,		16,	48),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, dtype,		4,	64),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, pcmd,		1,	68),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, desc_prof_prio,	3,	69),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, desc_prof,		6,	72),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fd_vsi,		10,	78),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, swap,		1,	88),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fdid_prio,		3,	89),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fdid_mdid,		4,	92),
-	ICE_CTX_STORE(ice_fd_fltr_desc_ctx, fdid,		32,	96),
-	{ 0 }
-};
-
 /**
  * ice_set_dflt_val_fd_desc
  * @fd_fltr_ctx: pointer to fd filter descriptor @@ -455,19 +426,66 @@ ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,

/**
* ice_set_fd_desc_val
- * @fd_fltr_ctx: pointer to fd filter descriptor context
+ * @ctx: pointer to fd filter descriptor context
* @fdir_desc: populated with fd filter descriptor values */
void
-ice_set_fd_desc_val(struct ice_fd_fltr_desc_ctx *fd_fltr_ctx, +ice_set_fd_desc_val(struct ice_fd_fltr_desc_ctx *ctx,
struct ice_fltr_desc *fdir_desc)
{
- u64 ctx_buf[2] = { 0 };
-
- ice_set_ctx((u8 *)fd_fltr_ctx, (u8 *)ctx_buf,
- ice_fd_fltr_desc_ctx_info);
- fdir_desc->qidx_compq_space_stat = CPU_TO_LE64(ctx_buf[0]);
- fdir_desc->dtype_cmd_vsi_fdid = CPU_TO_LE64(ctx_buf[1]);
+ u64 qword;
+
+ /* prep QW0 of FD filter programming desc */
+ qword = ((u64)ctx->qindex << ICE_FXD_FLTR_QW0_QINDEX_S) &
+ ICE_FXD_FLTR_QW0_QINDEX_M;
+ qword |= ((u64)ctx->comp_q << ICE_FXD_FLTR_QW0_COMP_Q_S) &
+ ICE_FXD_FLTR_QW0_COMP_Q_M;
+ qword |= ((u64)ctx->comp_report << ICE_FXD_FLTR_QW0_COMP_REPORT_S) &
+ ICE_FXD_FLTR_QW0_COMP_REPORT_M;
+ qword |= ((u64)ctx->fd_space << ICE_FXD_FLTR_QW0_FD_SPACE_S) &
+ ICE_FXD_FLTR_QW0_FD_SPACE_M;
+ qword |= ((u64)ctx->cnt_index << ICE_FXD_FLTR_QW0_STAT_CNT_S) &
+ ICE_FXD_FLTR_QW0_STAT_CNT_M;
+ qword |= ((u64)ctx->cnt_ena << ICE_FXD_FLTR_QW0_STAT_ENA_S) &
+ ICE_FXD_FLTR_QW0_STAT_ENA_M;
+ qword |= ((u64)ctx->evict_ena << ICE_FXD_FLTR_QW0_EVICT_ENA_S) &
+ ICE_FXD_FLTR_QW0_EVICT_ENA_M;
+ qword |= ((u64)ctx->toq << ICE_FXD_FLTR_QW0_TO_Q_S) &
+ ICE_FXD_FLTR_QW0_TO_Q_M;
+ qword |= ((u64)ctx->toq_prio << ICE_FXD_FLTR_QW0_TO_Q_PRI_S) &
+ ICE_FXD_FLTR_QW0_TO_Q_PRI_M;
+ qword |= ((u64)ctx->dpu_recipe << ICE_FXD_FLTR_QW0_DPU_RECIPE_S) &
+ ICE_FXD_FLTR_QW0_DPU_RECIPE_M;
+ qword |= ((u64)ctx->drop << ICE_FXD_FLTR_QW0_DROP_S) &
+ ICE_FXD_FLTR_QW0_DROP_M;
+ qword |= ((u64)ctx->flex_prio << ICE_FXD_FLTR_QW0_FLEX_PRI_S) &
+ ICE_FXD_FLTR_QW0_FLEX_PRI_M;
+ qword |= ((u64)ctx->flex_mdid << ICE_FXD_FLTR_QW0_FLEX_MDID_S) &
+ ICE_FXD_FLTR_QW0_FLEX_MDID_M;
+ qword |= ((u64)ctx->flex_val << ICE_FXD_FLTR_QW0_FLEX_VAL_S) &
+ ICE_FXD_FLTR_QW0_FLEX_VAL_M;
+ fdir_desc->qidx_compq_space_stat = CPU_TO_LE64(qword);
+
+ /* prep QW1 of FD filter programming desc */
+ qword = ((u64)ctx->dtype << ICE_FXD_FLTR_QW1_DTYPE_S) &
+ ICE_FXD_FLTR_QW1_DTYPE_M;
+ qword |= ((u64)ctx->pcmd << ICE_FXD_FLTR_QW1_PCMD_S) &
+ ICE_FXD_FLTR_QW1_PCMD_M;
+ qword |= ((u64)ctx->desc_prof_prio << ICE_FXD_FLTR_QW1_PROF_PRI_S) &
+ ICE_FXD_FLTR_QW1_PROF_PRI_M;
+ qword |= ((u64)ctx->desc_prof << ICE_FXD_FLTR_QW1_PROF_S) &
+ ICE_FXD_FLTR_QW1_PROF_M;
+ qword |= ((u64)ctx->fd_vsi << ICE_FXD_FLTR_QW1_FD_VSI_S) &
+ ICE_FXD_FLTR_QW1_FD_VSI_M;
+ qword |= ((u64)ctx->swap << ICE_FXD_FLTR_QW1_SWAP_S) &
+ ICE_FXD_FLTR_QW1_SWAP_M;
+ qword |= ((u64)ctx->fdid_prio << ICE_FXD_FLTR_QW1_FDID_PRI_S) &
+ ICE_FXD_FLTR_QW1_FDID_PRI_M;
+ qword |= ((u64)ctx->fdid_mdid << ICE_FXD_FLTR_QW1_FDID_MDID_S) &
+ ICE_FXD_FLTR_QW1_FDID_MDID_M;
+ qword |= ((u64)ctx->fdid << ICE_FXD_FLTR_QW1_FDID_S) &
+ ICE_FXD_FLTR_QW1_FDID_M;
+ fdir_desc->dtype_cmd_vsi_fdid = CPU_TO_LE64(qword);
}

/**
--
2.13.6

author
#26 lore raw

PATCH v2 10/12 net/ice/base: support add MAC rules on specific port

In reply to Qi Zhang

ice_add_mac_rule allow user to add rule to port based on hw->port_info->lport number. Function in some case should allow user to add filter rule on different port, write another function which implemented that behaviour. The same situation is which removing mac function.

Add new api function which allow user to choose port on which rule going to be added. Leave add mac rule function that always add rule on hw->port_info->lport to avoid changes in components which don't need to choose different port. Also add function to remove rule from specific port.

Alloc more switch_info structs to track separately rules for each port. Choose switch_info struct basing on logic port number because in fw added rules are connected with port.

---
 drivers/net/ice/base/ice_common.c |   2 +-
 drivers/net/ice/base/ice_switch.c | 269 +++++++++++++++++++++++++-------------
 drivers/net/ice/base/ice_switch.h |   3 +-
 3 files changed, 180 insertions(+), 94 deletions(-)
drivers/net/ice/base/ice_common.c +1 -1
index 2e756f542..22b2e316d 100644
@@ -462,7 +462,7 @@ static enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
 
 	INIT_LIST_HEAD(&sw->vsi_list_map_head);
 
-	return ice_init_def_sw_recp(hw);
+	return ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
 }
 
 /**
drivers/net/ice/base/ice_switch.c +177 -92

721 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +2 -1
index 61083738a..598e9c939 100644
@@ -444,7 +444,8 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 
 enum ice_status ice_replay_all_fltr(struct ice_hw *hw);
 
-enum ice_status ice_init_def_sw_recp(struct ice_hw *hw);
+enum ice_status
+ice_init_def_sw_recp(struct ice_hw *hw, struct ice_sw_recipe **recp_list);
 u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle);
 bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle);
 
Signature · 1 line
2.13.6
author
#27 lore raw

PATCH v2 11/12 net/ice: support 1/10G device IDs

In reply to Qi Zhang

Add support for 1/10G devices.

---
 drivers/net/ice/base/ice_devids.h | 4 ++++
 drivers/net/ice/ice_ethdev.c      | 2 ++
 2 files changed, 6 insertions(+)
drivers/net/ice/base/ice_devids.h +4 -0
index 348d1907a..46ffdee2d 100644
@@ -24,5 +24,9 @@
 #define ICE_DEV_ID_C822N_QSFP		0x1891
 /* Intel(R) Ethernet Connection C822N for SFP */
 #define ICE_DEV_ID_C822N_SFP		0x1892
+/* Intel(R) Ethernet Connection C822N/X557-AT 10GBASE-T */
+#define ICE_DEV_ID_C822N_10G_BASE_T	0x1893
+/* Intel(R) Ethernet Connection C822N 1GbE */
+#define ICE_DEV_ID_C822N_SGMII		0x1894
 
 #endif /* _ICE_DEVIDS_H_ */
drivers/net/ice/ice_ethdev.c +2 -0
index cf99fc358..88cd90660 100644
@@ -166,6 +166,8 @@ static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C822N_BACKPLANE) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C822N_QSFP) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C822N_SFP) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C822N_10G_BASE_T) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C822N_SGMII) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
Signature · 1 line
2.13.6
author
#28 lore raw

PATCH v2 12/12 net/ice/base: minor code clean

In reply to Qi Zhang

Couple minor code clean include:
1. Improve debug message format.
2. Add missing macro and comment.
3. Remove unnecessary compile options.

---
 drivers/net/ice/base/ice_adminq_cmd.h | 1 +
 drivers/net/ice/base/ice_common.c     | 2 +-
 drivers/net/ice/base/ice_flex_pipe.c  | 8 +++++---
 drivers/net/ice/base/ice_type.h       | 4 ----
 4 files changed, 7 insertions(+), 8 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +1 -0
index e6a1350ba..9a79c7645 100644
@@ -1688,6 +1688,7 @@ struct ice_aqc_nvm {
 #define ICE_AQC_NVM_ACTIV_SEL_NVM	BIT(3) /* Write Activate/SR Dump only */
 #define ICE_AQC_NVM_ACTIV_SEL_OROM	BIT(4)
 #define ICE_AQC_NVM_ACTIV_SEL_NETLIST	BIT(5)
+#define ICE_AQC_NVM_SPECIAL_UPDATE	BIT(6)
 #define ICE_AQC_NVM_ACTIV_SEL_MASK	MAKEMASK(0x7, 3)
 #define ICE_AQC_NVM_FLASH_ONLY		BIT(7)
 	__le16 module_typeid;
drivers/net/ice/base/ice_common.c +1 -1
index 22b2e316d..786e99d21 100644
@@ -592,7 +592,7 @@ void ice_print_rollback_msg(struct ice_hw *hw)
 	SNPRINTF(nvm_str, sizeof(nvm_str), "%x.%02x 0x%x %d.%d.%d", ver_hi,
 		 ver_lo, hw->nvm.eetrack, oem_ver, oem_build, oem_patch);
 	ice_warn(hw,
-		 "Firmware rollback mode detected. Current version is NVM: %s, FW: %d.%d. Device may exhibit limited functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware rollback mode",
+		 "Firmware rollback mode detected. Current version is NVM: %s, FW: %d.%d. Device may exhibit limited functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware rollback mode\n",
 		 nvm_str, hw->fw_maj_ver, hw->fw_min_ver);
 }
 
drivers/net/ice/base/ice_flex_pipe.c +5 -3
index 28ac3aa75..1598efd67 100644
@@ -3069,7 +3069,8 @@ ice_free_prof_mask(struct ice_hw *hw, enum ice_block blk, u16 mask_idx)
 	hw->blk[blk].masks.masks[mask_idx].idx = 0;
 
 	/* update mask as unused entry */
-	ice_debug(hw, ICE_DBG_PKG, "Free mask, blk %d, mask %d", blk, mask_idx);
+	ice_debug(hw, ICE_DBG_PKG, "Free mask, blk %d, mask %d\n", blk,
+		  mask_idx);
 	ice_write_prof_mask_reg(hw, blk, mask_idx, 0, 0);
 
 exit_ice_free_prof_mask:
@@ -4173,7 +4174,7 @@ ice_upd_prof_hw(struct ice_hw *hw, enum ice_block blk,
 	/* update package */
 	status = ice_update_pkg(hw, ice_pkg_buf(b), 1);
 	if (status == ICE_ERR_AQ_ERROR)
-		ice_debug(hw, ICE_DBG_INIT, "Unable to update HW profile.");
+		ice_debug(hw, ICE_DBG_INIT, "Unable to update HW profile\n");
 
 error_tmp:
 	ice_pkg_buf_free(hw, b);
@@ -5227,7 +5228,7 @@ ice_adj_prof_priorities(struct ice_hw *hw, enum ice_block blk, u16 vsig,
  * @blk: hardware block
  * @vsig: the VSIG to which this profile is to be added
  * @hdl: the profile handle indicating the profile to add
- * @rev: true to reverse the additions to the list
+ * @rev: true to add entries to the end of the list
  * @chg: the change list
  */
 static enum ice_status
@@ -5379,6 +5380,7 @@ ice_create_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl,
  * @blk: hardware block
  * @vsi: the initial VSI that will be in VSIG
  * @lst: the list of profile that will be added to the VSIG
+ * @new_vsig: return of new vsig
  * @chg: the change list
  */
 static enum ice_status
drivers/net/ice/base/ice_type.h +0 -4
index a8e4229a1..9773a549f 100644
@@ -14,9 +14,7 @@
 
 #define BITS_PER_BYTE	8
 
-#ifndef _FORCE_
 #define _FORCE_
-#endif
 
 #define ICE_BYTES_PER_WORD	2
 #define ICE_BYTES_PER_DWORD	4
@@ -130,9 +128,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)
 #define ICE_DBG_USER		BIT_ULL(31)
 #define ICE_DBG_ALL		0xFFFFFFFFFFFFFFFFULL
 
-#ifndef __ALWAYS_UNUSED
 #define __ALWAYS_UNUSED
-#endif
 
 #define IS_ETHER_ADDR_EQUAL(addr1, addr2) \
 	(((bool)((((u16 *)(addr1))[0] == ((u16 *)(addr2))[0]))) && \
Signature · 1 line
2.13.6
Applied
#29 lore raw
In reply to Qi Zhang
Quoted 24 lines · Qi Zhang

Main changes:
1. add support for MAC rules on specific port
2. support MAC/VLAN with TCP/UDP in switch rule
3. support 1/10G device
4. couple bug fix and code clean.

v2:
- rebase to next-net-intel.
- remove unnecessary empty line in patch 03/12

Qi Zhang (12):
net/ice/base: whitelist register for NVM access net/ice/base: support MAC/VLAN with TCP/UDP in switch net/ice/base: do not wait for PE unit to load net/ice/base: cleanup format of static const declarations net/ice/base: flexbytes should match on header data net/ice/base: enable clearing of the HW tables net/ice/base: fix loop limit
net/ice/base: increase PF reset wait timeout net/ice/base: change fdir desc preparation net/ice/base: support add MAC rules on specific port net/ice: support 1/10G device IDs
net/ice/base: minor code clean

Quoted 18 lines
drivers/net/ice/base/ice_adminq_cmd.h |   1 +
drivers/net/ice/base/ice_common.c     |  25 +-
drivers/net/ice/base/ice_devids.h     |   4 +
drivers/net/ice/base/ice_fdir.c       |  92 +++---
drivers/net/ice/base/ice_flex_pipe.c  |  63 ++++-
drivers/net/ice/base/ice_flex_pipe.h  |   1 +
drivers/net/ice/base/ice_flow.c       |  17 +-
drivers/net/ice/base/ice_flow.h       |   2 +-
drivers/net/ice/base/ice_nvm.c        |  10 +-
drivers/net/ice/base/ice_switch.c     | 517 +++++++++++++++++++++++++---------
drivers/net/ice/base/ice_switch.h     |   3 +-
drivers/net/ice/base/ice_type.h       |   4 -
drivers/net/ice/ice_ethdev.c          |   2 +
13 files changed, 533 insertions(+), 208 deletions(-)
Signature · 1 line
2.13.6

Applied to dpdk-next-net-intel, Thanks.