Skip to contentSkip to conversation

optimization and bugfix for hns3 PMD

PATCH In review Min Hu (Connor) 3 participants 31 messages Apr 26, 2021 – May 4, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover optimization and bugfix for hns3 PMD

This patch set contains one patch for performance optimization, this is: 'net/hns3: improve IO path data cache usage'. The others are bugfixes for hns3 PMD.

Chengwen Feng (6):
net/hns3: delete some unused capabilities
net/hns3: modify write reg opt API impl
net/hns3: use RTE DIM instead of ARRAY SIZE
net/hns3: improve IO path data cache usage
net/hns3: log fdir configuration
net/hns3: fix vector Rx burst default value

 drivers/net/hns3/hns3_cmd.c    |  11 +---
 drivers/net/hns3/hns3_cmd.h    |  15 +++--
 drivers/net/hns3/hns3_ethdev.h |  43 +++++++-------
 drivers/net/hns3/hns3_fdir.c   |  13 +++++
 drivers/net/hns3/hns3_flow.c   |  18 +++---
 drivers/net/hns3/hns3_intr.c   |   4 +-
 drivers/net/hns3/hns3_rxtx.h   | 128 ++++++++++++++++++++++++-----------------
 7 files changed, 129 insertions(+), 103 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/6 net/hns3: delete some unused capabilities

From: Chengwen Feng <[email protected]>

This patch deletes some unused capabilities, include:
1. Delete some unused firmware capabilities definition.
2. Delete some unused driver capabilities definition.

---
 drivers/net/hns3/hns3_cmd.c    |  7 -------
 drivers/net/hns3/hns3_cmd.h    | 15 +++++++--------
 drivers/net/hns3/hns3_ethdev.h | 29 ++++++++++++++---------------
 3 files changed, 21 insertions(+), 30 deletions(-)
drivers/net/hns3/hns3_cmd.c +0 -7
index 62dfc19..4651d5b 100644
@@ -423,11 +423,8 @@ hns3_get_caps_name(uint32_t caps_id)
 		enum HNS3_CAPS_BITS caps;
 		const char *name;
 	} dev_caps[] = {
-		{ HNS3_CAPS_UDP_GSO_B,         "udp_gso"         },
-		{ HNS3_CAPS_ATR_B,             "atr"             },
 		{ HNS3_CAPS_FD_QUEUE_REGION_B, "fd_queue_region" },
 		{ HNS3_CAPS_PTP_B,             "ptp"             },
-		{ HNS3_CAPS_INT_QL_B,          "int_ql"          },
 		{ HNS3_CAPS_SIMPLE_BD_B,       "simple_bd"       },
 		{ HNS3_CAPS_TX_PUSH_B,         "tx_push"         },
 		{ HNS3_CAPS_PHY_IMP_B,         "phy_imp"         },
@@ -436,8 +433,6 @@ hns3_get_caps_name(uint32_t caps_id)
 		{ HNS3_CAPS_STASH_B,           "stash"           },
 		{ HNS3_CAPS_UDP_TUNNEL_CSUM_B, "udp_tunnel_csum" },
 		{ HNS3_CAPS_RAS_IMP_B,         "ras_imp"         },
-		{ HNS3_CAPS_FEC_B,             "fec"             },
-		{ HNS3_CAPS_PAUSE_B,           "pause"           },
 		{ HNS3_CAPS_RXD_ADV_LAYOUT_B,  "rxd_adv_layout"  }
 	};
 	uint32_t i;
@@ -484,8 +479,6 @@ hns3_parse_capability(struct hns3_hw *hw,
 {
 	uint32_t caps = rte_le_to_cpu_32(cmd->caps[0]);
 
-	if (hns3_get_bit(caps, HNS3_CAPS_UDP_GSO_B))
-		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_UDP_GSO_B, 1);
 	if (hns3_get_bit(caps, HNS3_CAPS_FD_QUEUE_REGION_B))
 		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B,
 			     1);
drivers/net/hns3/hns3_cmd.h +7 -8
index bf1772d..984f2a9 100644
@@ -306,12 +306,13 @@ struct hns3_rx_priv_buff_cmd {
 #define HNS3_FW_VERSION_BYTE0_M		GENMASK(7, 0)
 
 enum HNS3_CAPS_BITS {
-	HNS3_CAPS_UDP_GSO_B,
-	HNS3_CAPS_ATR_B,
-	HNS3_CAPS_FD_QUEUE_REGION_B,
+	/*
+	 * The following capability index definitions must be the same as those
+	 * of the firmware.
+	 */
+	HNS3_CAPS_FD_QUEUE_REGION_B = 2,
 	HNS3_CAPS_PTP_B,
-	HNS3_CAPS_INT_QL_B,
-	HNS3_CAPS_SIMPLE_BD_B,
+	HNS3_CAPS_SIMPLE_BD_B = 5,
 	HNS3_CAPS_TX_PUSH_B,
 	HNS3_CAPS_PHY_IMP_B,
 	HNS3_CAPS_TQP_TXRX_INDEP_B,
@@ -319,9 +320,7 @@ enum HNS3_CAPS_BITS {
 	HNS3_CAPS_STASH_B,
 	HNS3_CAPS_UDP_TUNNEL_CSUM_B,
 	HNS3_CAPS_RAS_IMP_B,
-	HNS3_CAPS_FEC_B,
-	HNS3_CAPS_PAUSE_B,
-	HNS3_CAPS_RXD_ADV_LAYOUT_B,
+	HNS3_CAPS_RXD_ADV_LAYOUT_B = 15,
 };
 
 enum HNS3_API_CAP_BITS {
drivers/net/hns3/hns3_ethdev.h +14 -15
index d27c725..de17878 100644
@@ -855,17 +855,20 @@ enum {
 
 #define HNS3_DEVARG_DEV_CAPS_MASK	"dev_caps_mask"
 
-#define HNS3_DEV_SUPPORT_DCB_B			0x0
-#define HNS3_DEV_SUPPORT_COPPER_B		0x1
-#define HNS3_DEV_SUPPORT_UDP_GSO_B		0x2
-#define HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B	0x3
-#define HNS3_DEV_SUPPORT_PTP_B			0x4
-#define HNS3_DEV_SUPPORT_TX_PUSH_B		0x5
-#define HNS3_DEV_SUPPORT_INDEP_TXRX_B		0x6
-#define HNS3_DEV_SUPPORT_STASH_B		0x7
-#define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B	0x9
-#define HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B	0xA
-#define HNS3_DEV_SUPPORT_RAS_IMP_B		0xB
+enum {
+	HNS3_DEV_SUPPORT_DCB_B,
+	HNS3_DEV_SUPPORT_COPPER_B,
+	HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B,
+	HNS3_DEV_SUPPORT_PTP_B,
+	HNS3_DEV_SUPPORT_TX_PUSH_B,
+	HNS3_DEV_SUPPORT_INDEP_TXRX_B,
+	HNS3_DEV_SUPPORT_STASH_B,
+	HNS3_DEV_SUPPORT_SIMPLE_BD_B,
+	HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B,
+	HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B,
+	HNS3_DEV_SUPPORT_RAS_IMP_B,
+	HNS3_DEV_SUPPORT_TM_B,
+};
 
 #define hns3_dev_dcb_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B)
@@ -874,10 +877,6 @@ enum {
 #define hns3_dev_copper_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_COPPER_B)
 
-/* Support UDP GSO offload */
-#define hns3_dev_udp_gso_supported(hw) \
-	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_UDP_GSO_B)
-
 /* Support the queue region action rule of flow directory */
 #define hns3_dev_fd_queue_region_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B)
Signature · 1 line
2.7.4
#2 lore raw

Re: [dpdk-dev] [PATCH 1/6] net/hns3: delete some unused capabilities

Quoted 8 lines · Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch deletes some unused capabilities, include:
1. Delete some unused firmware capabilities definition.
2. Delete some unused driver capabilities definition.

<...>

Quoted 23 lines
drivers/net/hns3/hns3_ethdev.h +4 -11
index d27c725..de17878 100644
@@ -855,17 +855,20 @@ enum {
 
 #define HNS3_DEVARG_DEV_CAPS_MASK	"dev_caps_mask"
 
-#define HNS3_DEV_SUPPORT_DCB_B			0x0
-#define HNS3_DEV_SUPPORT_COPPER_B		0x1
-#define HNS3_DEV_SUPPORT_UDP_GSO_B		0x2
-#define HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B	0x3
-#define HNS3_DEV_SUPPORT_PTP_B			0x4
-#define HNS3_DEV_SUPPORT_TX_PUSH_B		0x5
-#define HNS3_DEV_SUPPORT_INDEP_TXRX_B		0x6
-#define HNS3_DEV_SUPPORT_STASH_B		0x7
-#define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B	0x9
-#define HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B	0xA
-#define HNS3_DEV_SUPPORT_RAS_IMP_B		0xB
+enum {
+	HNS3_DEV_SUPPORT_DCB_B,
+	HNS3_DEV_SUPPORT_COPPER_B,
+	HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B,

drivers/net/hns3/hns3_ethdev.h enum { · line 871

Quoted 10 lines
drivers/net/hns3/hns3_ethdev.h +10 -0
+	HNS3_DEV_SUPPORT_PTP_B,
+	HNS3_DEV_SUPPORT_TX_PUSH_B,
+	HNS3_DEV_SUPPORT_INDEP_TXRX_B,
+	HNS3_DEV_SUPPORT_STASH_B,
+	HNS3_DEV_SUPPORT_SIMPLE_BD_B,
+	HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B,
+	HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B,
+	HNS3_DEV_SUPPORT_RAS_IMP_B,
+	HNS3_DEV_SUPPORT_TM_B,
+};

This cause some values to be changed, because of added/removed items, is this expected?
If so can you please mention from this value change in the commit log, to clarify.

#3 lore raw

Re: [dpdk-dev] [PATCH 1/6] net/hns3: delete some unused capabilities

From:Ferruh Yigit <[email protected]>
To:humin (Q) <[email protected]>;dev <[email protected]> Date:2021-04-27 21:37:59
Subject:Re: [dpdk-dev] [PATCH 1/6] net/hns3: delete some unused capabilities

Quoted 8 lines · Min Hu (Connor)

From: Chengwen Feng < [email protected]<mailto:[email protected]>>

This patch deletes some unused capabilities, include:
1. Delete some unused firmware capabilities definition.
2. Delete some unused driver capabilities definition.

<...>

Quoted 23 lines
drivers/net/hns3/hns3_ethdev.h +4 -11
index d27c725..de17878 100644
@@ -855,17 +855,20 @@ enum {
 
 #define HNS3_DEVARG_DEV_CAPS_MASK    "dev_caps_mask"
 
-#define HNS3_DEV_SUPPORT_DCB_B                       0x0
-#define HNS3_DEV_SUPPORT_COPPER_B            0x1
-#define HNS3_DEV_SUPPORT_UDP_GSO_B           0x2
-#define HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B   0x3
-#define HNS3_DEV_SUPPORT_PTP_B                       0x4
-#define HNS3_DEV_SUPPORT_TX_PUSH_B           0x5
-#define HNS3_DEV_SUPPORT_INDEP_TXRX_B                0x6
-#define HNS3_DEV_SUPPORT_STASH_B             0x7
-#define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B    0x9
-#define HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B   0xA
-#define HNS3_DEV_SUPPORT_RAS_IMP_B           0xB
+enum {
+     HNS3_DEV_SUPPORT_DCB_B,
+     HNS3_DEV_SUPPORT_COPPER_B,
+     HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B,

drivers/net/hns3/hns3_ethdev.h enum { · line 871

Quoted 10 lines
drivers/net/hns3/hns3_ethdev.h +10 -0
+     HNS3_DEV_SUPPORT_PTP_B,
+     HNS3_DEV_SUPPORT_TX_PUSH_B,
+     HNS3_DEV_SUPPORT_INDEP_TXRX_B,
+     HNS3_DEV_SUPPORT_STASH_B,
+     HNS3_DEV_SUPPORT_SIMPLE_BD_B,
+     HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B,
+     HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B,
+     HNS3_DEV_SUPPORT_RAS_IMP_B,
+     HNS3_DEV_SUPPORT_TM_B,
+};

This cause some values to be changed, because of added/removed items, is this expected?
If so can you please mention from this value change in the commit log, to clarify.

these values are used only in driver, so the order could adjust. the commit log memtion it brifely, which is:

2. Delete some unused driver capabilities definition

thanks

#4 lore raw

Re: [dpdk-dev] [PATCH 1/6] net/hns3: delete some unused capabilities

In reply to Ferruh Yigit
Quoted 57 lines · Fengchengwen

*From:*Ferruh Yigit <[email protected]>
*To:*humin (Q) <[email protected]>;dev <[email protected]> *Date:*2021-04-27 21:37:59
*Subject:*Re: [dpdk-dev] [PATCH 1/6] net/hns3: delete some unused capabilities

Quoted 8 lines · Min Hu (Connor)

From: Chengwen Feng < [email protected] <mailto:[email protected]>>

This patch deletes some unused capabilities, include:
1. Delete some unused firmware capabilities definition.
2. Delete some unused driver capabilities definition.

Signed-off-by Chengwen Feng < [email protected] <mailto:[email protected]>>
Signed-off-by Min Hu (Connor) < [email protected] <mailto:[email protected]>>

<...>

Quoted 23 lines
drivers/net/hns3/hns3_ethdev.h +4 -11
index d27c725..de17878 100644 
@@ -855,17 +855,20 @@ enum { 
 
 #define HNS3_DEVARG_DEV_CAPS_MASK    "dev_caps_mask" 
 
-#define HNS3_DEV_SUPPORT_DCB_B                       0x0 
-#define HNS3_DEV_SUPPORT_COPPER_B            0x1 
-#define HNS3_DEV_SUPPORT_UDP_GSO_B           0x2 
-#define HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B   0x3 
-#define HNS3_DEV_SUPPORT_PTP_B                       0x4 
-#define HNS3_DEV_SUPPORT_TX_PUSH_B           0x5 
-#define HNS3_DEV_SUPPORT_INDEP_TXRX_B                0x6 
-#define HNS3_DEV_SUPPORT_STASH_B             0x7 
-#define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B    0x9 
-#define HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B   0xA 
-#define HNS3_DEV_SUPPORT_RAS_IMP_B           0xB 
+enum { 
+     HNS3_DEV_SUPPORT_DCB_B, 
+     HNS3_DEV_SUPPORT_COPPER_B, 
+     HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B, 

drivers/net/hns3/hns3_ethdev.h enum { · line 871

Quoted 10 lines
drivers/net/hns3/hns3_ethdev.h +10 -0
+     HNS3_DEV_SUPPORT_PTP_B, 
+     HNS3_DEV_SUPPORT_TX_PUSH_B, 
+     HNS3_DEV_SUPPORT_INDEP_TXRX_B, 
+     HNS3_DEV_SUPPORT_STASH_B, 
+     HNS3_DEV_SUPPORT_SIMPLE_BD_B, 
+     HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, 
+     HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, 
+     HNS3_DEV_SUPPORT_RAS_IMP_B, 
+     HNS3_DEV_SUPPORT_TM_B, 
+}; 

This cause some values to be changed, because of added/removed items, is this expected?
If so can you please mention from this value change in the commit log, to clarify.

Quoted 5 lines

these values are used only in driver, so the order could adjust. the commit log memtion it brifely, which is:

2. Delete some unused driver capabilities definition

I am not talking about deletion of unused macros,

Please mention that value of some of the macros have been changed and this is known and won't cause a problem.

#5 lore raw

PATCH 2/6 net/hns3: modify write reg opt API impl

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch modifies hns3_write_reg_opt() API implementation because the rte_write32() already uses rte_io_wmb().

---
 drivers/net/hns3/hns3_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/hns3/hns3_ethdev.h +4 -4
index de17878..68541df 100644
@@ -983,13 +983,13 @@ static inline void hns3_write_reg(void *base, uint32_t reg, uint32_t value)
 }
 
 /*
- * The optimized function for writing registers used in the '.rx_pkt_burst' and
- * '.tx_pkt_burst' ops implementation function.
+ * The optimized function for writing registers reduces one address addition
+ * calculation, it was used in the '.rx_pkt_burst' and '.tx_pkt_burst' ops
+ * implementation function.
  */
 static inline void hns3_write_reg_opt(volatile void *addr, uint32_t value)
 {
-	rte_io_wmb();
-	rte_write32_relaxed(rte_cpu_to_le_32(value), addr);
+	rte_write32(rte_cpu_to_le_32(value), addr);
 }
 
 static inline uint32_t hns3_read_reg(void *base, uint32_t reg)
Signature · 1 line
2.7.4
#6 lore raw

PATCH 3/6 net/hns3: use RTE DIM instead of ARRAY SIZE

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch uses RTE_DIM() instead of ARRAY_SIZE().

---
 drivers/net/hns3/hns3_cmd.c    |  4 ++--
 drivers/net/hns3/hns3_ethdev.h |  2 --
 drivers/net/hns3/hns3_flow.c   | 18 +++++++++---------
 drivers/net/hns3/hns3_intr.c   |  4 ++--
 4 files changed, 13 insertions(+), 15 deletions(-)
drivers/net/hns3/hns3_cmd.c +2 -2
index 4651d5b..2eec895 100644
@@ -245,7 +245,7 @@ hns3_is_special_opcode(uint16_t opcode)
 				  HNS3_OPC_QUERY_ALL_ERR_INFO,};
 	uint32_t i;
 
-	for (i = 0; i < ARRAY_SIZE(spec_opcode); i++)
+	for (i = 0; i < RTE_DIM(spec_opcode); i++)
 		if (spec_opcode[i] == opcode)
 			return true;
 
@@ -276,7 +276,7 @@ hns3_cmd_convert_err_code(uint16_t desc_ret)
 
 	uint32_t i;
 
-	for (i = 0; i < ARRAY_SIZE(hns3_cmdq_status); i++)
+	for (i = 0; i < RTE_DIM(hns3_cmdq_status); i++)
 		if (hns3_cmdq_status[i].imp_errcode == desc_ret)
 			return hns3_cmdq_status[i].linux_errcode;
 
drivers/net/hns3/hns3_ethdev.h +0 -2
index 68541df..258e26d 100644
@@ -1004,8 +1004,6 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg)
 #define hns3_read_dev(a, reg) \
 	hns3_read_reg((a)->io_base, (reg))
 
-#define ARRAY_SIZE(x) RTE_DIM(x)
-
 #define NEXT_ITEM_OF_ACTION(act, actions, index)                        \
 	do {								\
 		act = (actions) + (index);				\
drivers/net/hns3/hns3_flow.c +9 -9
index 4511a49..49d6568 100644
@@ -1054,37 +1054,37 @@ hns3_parse_normal(const struct rte_flow_item *item, struct hns3_fdir_rule *rule,
 	case RTE_FLOW_ITEM_TYPE_ETH:
 		ret = hns3_parse_eth(item, rule, error);
 		step_mngr->items = L2_next_items;
-		step_mngr->count = ARRAY_SIZE(L2_next_items);
+		step_mngr->count = RTE_DIM(L2_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_VLAN:
 		ret = hns3_parse_vlan(item, rule, error);
 		step_mngr->items = L2_next_items;
-		step_mngr->count = ARRAY_SIZE(L2_next_items);
+		step_mngr->count = RTE_DIM(L2_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV4:
 		ret = hns3_parse_ipv4(item, rule, error);
 		step_mngr->items = L3_next_items;
-		step_mngr->count = ARRAY_SIZE(L3_next_items);
+		step_mngr->count = RTE_DIM(L3_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV6:
 		ret = hns3_parse_ipv6(item, rule, error);
 		step_mngr->items = L3_next_items;
-		step_mngr->count = ARRAY_SIZE(L3_next_items);
+		step_mngr->count = RTE_DIM(L3_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_TCP:
 		ret = hns3_parse_tcp(item, rule, error);
 		step_mngr->items = L4_next_items;
-		step_mngr->count = ARRAY_SIZE(L4_next_items);
+		step_mngr->count = RTE_DIM(L4_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_UDP:
 		ret = hns3_parse_udp(item, rule, error);
 		step_mngr->items = L4_next_items;
-		step_mngr->count = ARRAY_SIZE(L4_next_items);
+		step_mngr->count = RTE_DIM(L4_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_SCTP:
 		ret = hns3_parse_sctp(item, rule, error);
 		step_mngr->items = L4_next_items;
-		step_mngr->count = ARRAY_SIZE(L4_next_items);
+		step_mngr->count = RTE_DIM(L4_next_items);
 		break;
 	default:
 		return rte_flow_error_set(error, ENOTSUP,
@@ -1188,7 +1188,7 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev,
 					  "Fdir not supported in VF");
 
 	step_mngr.items = first_items;
-	step_mngr.count = ARRAY_SIZE(first_items);
+	step_mngr.count = RTE_DIM(first_items);
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		if (item->type == RTE_FLOW_ITEM_TYPE_VOID)
 			continue;
@@ -1202,7 +1202,7 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev,
 			if (ret)
 				return ret;
 			step_mngr.items = tunnel_next_items;
-			step_mngr.count = ARRAY_SIZE(tunnel_next_items);
+			step_mngr.count = RTE_DIM(tunnel_next_items);
 		} else {
 			ret = hns3_parse_normal(item, rule, &step_mngr, error);
 			if (ret)
drivers/net/hns3/hns3_intr.c +2 -2
index cc7d7c6..3155d7f 100644
@@ -2206,8 +2206,8 @@ hns3_handle_type_reg_error_data(struct hns3_hw *hw,
 	type_id = err_info->type_id & HNS3_ERR_TYPE_MASK;
 	is_ras = err_info->type_id >> HNS3_ERR_TYPE_IS_RAS_OFFSET;
 
-	total_module = ARRAY_SIZE(hns3_hw_module_name);
-	total_type = ARRAY_SIZE(hns3_hw_error_type);
+	total_module = RTE_DIM(hns3_hw_module_name);
+	total_type = RTE_DIM(hns3_hw_error_type);
 
 	hns3_err(hw, "total_module:%u, total_type:%u",
 		 total_module, total_type);
Signature · 1 line
2.7.4
#7 lore raw

PATCH 4/6 net/hns3: improve IO path data cache usage

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch improves data cache usage by:
1. Rearrange the rxq frequency accessed fields in the IO path to the first 128B.
2. Rearrange the txq frequency accessed fields in the IO path to the first 64B.
3. Make sure ptype table align cacheline size which is 128B instead of min cacheline size which is 64B because the L1/L2 is 64B and L3 is 128B on Kunpeng ARM platform.

The performance gains are 1.5% in 64B packet macfwd scenarios.

---
 drivers/net/hns3/hns3_ethdev.h |   4 +-
 drivers/net/hns3/hns3_rxtx.h   | 126 ++++++++++++++++++++++++-----------------
 2 files changed, 77 insertions(+), 53 deletions(-)
drivers/net/hns3/hns3_ethdev.h +2 -2
index 258e26d..5f860ee 100644
@@ -735,7 +735,7 @@ struct hns3_ptype_table {
 	 * descriptor, it functions only when firmware report the capability of
 	 * HNS3_CAPS_RXD_ADV_LAYOUT_B and driver enabled it.
 	 */
-	uint32_t ptype[HNS3_PTYPE_NUM] __rte_cache_min_aligned;
+	uint32_t ptype[HNS3_PTYPE_NUM] __rte_cache_aligned;
 };
 
 #define HNS3_FIXED_MAX_TQP_NUM_MODE		0
@@ -839,7 +839,7 @@ struct hns3_adapter {
 
 	uint64_t dev_caps_mask;
 
-	struct hns3_ptype_table ptype_tbl __rte_cache_min_aligned;
+	struct hns3_ptype_table ptype_tbl __rte_cache_aligned;
 };
 
 enum {
drivers/net/hns3/hns3_rxtx.h +75 -51

199 lines not on this page · raw message

Signature · 1 line
2.7.4
#8 lore raw

PATCH 5/6 net/hns3: log fdir configuration

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

The rte flow interface does not support the API of the capability set. Therefore, fdir configuration logs are added to facilitate debugging.

---
 drivers/net/hns3/hns3_fdir.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/net/hns3/hns3_fdir.c +13 -0
index 87c1aef..8b14219 100644
@@ -336,6 +336,8 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 	    BIT(INNER_IP_PROTO) | BIT(INNER_IP_TOS) |
 	    BIT(INNER_SRC_IP) | BIT(INNER_DST_IP) |
 	    BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT);
+	hns3_info(hw, "fdir tuple: inner<vlan_tag1 eth_type ip_src ip_dst "
+		  "ip_proto ip_tos l4_src_port l4_dst_port>");
 
 	/* If use max 400bit key, we can support tuples for ether type */
 	if (pf->fdir.fd_cfg.max_key_length == MAX_KEY_LENGTH) {
@@ -345,6 +347,9 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 		    BIT(OUTER_DST_PORT) | BIT(INNER_VLAN_TAG2) |
 		    BIT(OUTER_TUN_VNI) | BIT(OUTER_TUN_FLOW_ID) |
 		    BIT(OUTER_ETH_TYPE) | BIT(OUTER_IP_PROTO);
+		hns3_info(hw, "fdir tuple more: inner<dst_mac src_mac "
+			  "vlan_tag2 sctp_tag> outer<eth_type ip_proto "
+			  "l4_src_port l4_dst_port tun_vni tun_flow_id>");
 	}
 
 	/* roce_type is used to filter roce frames
@@ -352,6 +357,7 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 	 */
 	key_cfg->meta_data_active = BIT(DST_VPORT) | BIT(TUNNEL_PACKET) |
 	    BIT(VLAN_NUMBER);
+	hns3_info(hw, "fdir meta data: dst_vport tunnel_packet vlan_number");
 
 	ret = hns3_get_fd_allocation(hw,
 				     &pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1],
@@ -361,6 +367,13 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 	if (ret)
 		return ret;
 
+	hns3_info(hw, "fdir: stage1<rules-%u counters-%u> stage2<rules-%u "
+		  "counters=%u>",
+		  pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1],
+		  pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_1],
+		  pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_2],
+		  pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_2]);
+
 	return hns3_set_fd_key_config(hns);
 }
 
Signature · 1 line
2.7.4
#9 lore raw

Re: [dpdk-dev] [PATCH 5/6] net/hns3: log fdir configuration

Quoted 17 lines · Min Hu (Connor)

From: Chengwen Feng <[email protected]>

The rte flow interface does not support the API of the capability set. Therefore, fdir configuration logs are added to facilitate debugging.

---
 drivers/net/hns3/hns3_fdir.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/net/hns3/hns3_fdir.c +0 -0
index 87c1aef..8b14219 100644

drivers/net/hns3/hns3_fdir.c int hns3_init_fd_config(struct hns3_adapter *hns) · line 340

Quoted 5 lines
drivers/net/hns3/hns3_fdir.c +2 -0
@@ -336,6 +336,8 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 	    BIT(INNER_IP_PROTO) | BIT(INNER_IP_TOS) |
 	    BIT(INNER_SRC_IP) | BIT(INNER_DST_IP) |
 	    BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT);
+	hns3_info(hw, "fdir tuple: inner<vlan_tag1 eth_type ip_src ip_dst "
+		  "ip_proto ip_tos l4_src_port l4_dst_port>");

If the messages are for debugging, what do you think about add them as 'hns3_dbg'? Isn't info level too verbose for debugging?

#10 lore raw

Re: [dpdk-dev] [PATCH 5/6] net/hns3: log fdir configuration

From:Ferruh Yigit <[email protected]>
To:humin (Q) <[email protected]>;dev <[email protected]> Date:2021-04-27 21:39:45
Subject:Re: [dpdk-dev] [PATCH 5/6] net/hns3: log fdir configuration

Quoted 17 lines · Min Hu (Connor)

From: Chengwen Feng < [email protected]<mailto:[email protected]>>

The rte flow interface does not support the API of the capability set. Therefore, fdir configuration logs are added to facilitate debugging.

---
drivers/net/hns3/hns3_fdir.c | 13 +++++++++++++

1 file changed, 13 insertions(+)
drivers/net/hns3/hns3_fdir.c +0 -0
index 87c1aef..8b14219 100644

drivers/net/hns3/hns3_fdir.c int hns3_init_fd_config(struct hns3_adapter *hns) · line 340

Quoted 5 lines
drivers/net/hns3/hns3_fdir.c +2 -0
@@ -336,6 +336,8 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
           BIT(INNER_IP_PROTO) | BIT(INNER_IP_TOS) |
           BIT(INNER_SRC_IP) | BIT(INNER_DST_IP) |
           BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT);
+     hns3_info(hw, "fdir tuple: inner<vlan_tag1 eth_type ip_src ip_dst "
+               "ip_proto ip_tos l4_src_port l4_dst_port>");

If the messages are for debugging, what do you think about add them as 'hns3_dbg'? Isn't info level too verbose for debugging?

yes, it was used for debugging and log analyzing, we use hns3_info because the default level may not debug in product scenario. we use verbose readable log because it's useful for reading.

thanks

BTW: sorry for this reply format because using phone.

#11 lore raw

Re: [dpdk-dev] [PATCH 5/6] net/hns3: log fdir configuration

In reply to Ferruh Yigit
Quoted 38 lines · Fengchengwen

*From:*Ferruh Yigit <[email protected]>
*To:*humin (Q) <[email protected]>;dev <[email protected]> *Date:*2021-04-27 21:39:45
*Subject:*Re: [dpdk-dev] [PATCH 5/6] net/hns3: log fdir configuration

Quoted 17 lines · Min Hu (Connor)

From: Chengwen Feng < [email protected] <mailto:[email protected]>>

The rte flow interface does not support the API of the capability set. Therefore, fdir configuration logs are added to facilitate debugging.

Signed-off-by Chengwen Feng < [email protected] <mailto:[email protected]>>
Signed-off-by Min Hu (Connor) < [email protected] <mailto:[email protected]>>

---
drivers/net/hns3/hns3_fdir.c | 13 +++++++++++++

1 file changed, 13 insertions(+) 
drivers/net/hns3/hns3_fdir.c +0 -0
index 87c1aef..8b14219 100644 
@@ -336,6 +336,8 @@ int hns3_init_fd_config(struct hns3_adapter *hns) 
Quoted 5 lines

           BIT(INNER_IP_PROTO) | BIT(INNER_IP_TOS) | BIT(INNER_SRC_IP) | BIT(INNER_DST_IP) | BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT);
+     hns3_info(hw, "fdir tuple: inner<vlan_tag1 eth_type ip_src ip_dst "
+               "ip_proto ip_tos l4_src_port l4_dst_port>");

If the messages are for debugging, what do you think about add them as 'hns3_dbg'? Isn't info level too verbose for debugging?

Quoted 4 lines

yes, it was used for debugging and log analyzing, we use hns3_info because the default level may not debug in product scenario.
we use verbose readable log because it's useful for reading.

It is possible to dynamically change the log level and get debug logs when needed, I think this is better than enable it by default.

Quoted 4 lines

thanks

BTW: sorry for this reply format because using phone.

#12 lore raw

Re: [dpdk-dev] [PATCH 5/6] net/hns3: log fdir configuration

From:Ferruh Yigit <[email protected]>
To:Fengchengwen <[email protected]>;humin (Q) <[email protected]>;dev <[email protected]> Date:2021-04-27 22:26:09
Subject:Re: [dpdk-dev] [PATCH 5/6] net/hns3: log fdir configuration

Quoted 38 lines · Fengchengwen

*From:*Ferruh Yigit < [email protected]<mailto:[email protected]>>
*To:*humin (Q) < [email protected]<mailto:[email protected]>>;dev < [email protected]<mailto:[email protected]>> *Date:*2021-04-27 21:39:45
*Subject:*Re: [dpdk-dev] [PATCH 5/6] net/hns3: log fdir configuration

Quoted 17 lines · Min Hu (Connor)

From: Chengwen Feng < [email protected]<mailto:[email protected]> < mailto:[email protected]>>

The rte flow interface does not support the API of the capability set. Therefore, fdir configuration logs are added to facilitate debugging.

---
drivers/net/hns3/hns3_fdir.c | 13 +++++++++++++

1 file changed, 13 insertions(+)
drivers/net/hns3/hns3_fdir.c +0 -0
index 87c1aef..8b14219 100644

drivers/net/hns3/hns3_fdir.c int hns3_init_fd_config(struct hns3_adapter *hns) · line 340

Quoted 5 lines
drivers/net/hns3/hns3_fdir.c +2 -0
@@ -336,6 +336,8 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
           BIT(INNER_IP_PROTO) | BIT(INNER_IP_TOS) |
           BIT(INNER_SRC_IP) | BIT(INNER_DST_IP) |
           BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT);
+     hns3_info(hw, "fdir tuple: inner<vlan_tag1 eth_type ip_src ip_dst "
+               "ip_proto ip_tos l4_src_port l4_dst_port>");

If the messages are for debugging, what do you think about add them as 'hns3_dbg'? Isn't info level too verbose for debugging?

Quoted 4 lines

yes, it was used for debugging and log analyzing, we use hns3_info because the default level may not debug in product scenario.
we use verbose readable log because it's useful for reading.

It is possible to dynamically change the log level and get debug logs when needed, I think this is better than enable it by default.

OK, will fix in v2, thanks

Quoted 4 lines

thanks

BTW: sorry for this reply format because using phone.

#13 lore raw

PATCH 6/6 net/hns3: fix vector Rx burst default value

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

Currently, driver uses the macro HNS3_DEFAULT_RX_BURST whose value is 32 to limit the vector Rx burst size, as a result, the burst size user configure can't exceed 32.

This patch fixes this problem by defining the macro HNS3_DEFAULT_RX_BURST as 64.

Fixes a3d4f4d291d7 ("net/hns3: support NEON Rx")
---
 drivers/net/hns3/hns3_rxtx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_rxtx.h +1 -1
index 1e2e994..ba24e00 100644
@@ -20,7 +20,7 @@
 #define HNS3_DEFAULT_TX_RS_THRESH	32
 #define HNS3_TX_FAST_FREE_AHEAD		64
 
-#define HNS3_DEFAULT_RX_BURST		32
+#define HNS3_DEFAULT_RX_BURST		64
 #if (HNS3_DEFAULT_RX_BURST > 64)
 #error "PMD HNS3: HNS3_DEFAULT_RX_BURST must <= 64\n"
 #endif
Signature · 1 line
2.7.4
#14 lore raw

Re: [dpdk-dev] [PATCH 6/6] net/hns3: fix vector Rx burst default value

Quoted 23 lines · Min Hu (Connor)

From: Chengwen Feng <[email protected]>

Currently, driver uses the macro HNS3_DEFAULT_RX_BURST whose value is 32 to limit the vector Rx burst size, as a result, the burst size user configure can't exceed 32.

This patch fixes this problem by defining the macro HNS3_DEFAULT_RX_BURST as 64.

Fixes a3d4f4d291d7 ("net/hns3: support NEON Rx")
---
 drivers/net/hns3/hns3_rxtx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_rxtx.h +0 -0
index 1e2e994..ba24e00 100644

drivers/net/hns3/hns3_rxtx.h line 23

Quoted 5 lines
drivers/net/hns3/hns3_rxtx.h +1 -1
@@ -20,7 +20,7 @@
 #define HNS3_DEFAULT_TX_RS_THRESH	32
 #define HNS3_TX_FAST_FREE_AHEAD		64
 
-#define HNS3_DEFAULT_RX_BURST		32
+#define HNS3_DEFAULT_RX_BURST		64

It seems in the vector Rx path, the number of receive packets are limited silently to 'HNS3_DEFAULT_RX_BURST' independent from what user requested/configured.

There can be driver/HW limitations to 'HNS3_DEFAULT_RX_BURST' that is OK, but instead of limiting user request, what do you think about Rx in the 'HNS3_DEFAULT_RX_BURST' blocks until user request justified?

I mean something like following implementation:
https://git.dpdk.org/dpdk/commit/?id=d96394ea263c

#15 lore raw

Re: [dpdk-dev] [PATCH 6/6] net/hns3: fix vector Rx burst default value

From:Ferruh Yigit <[email protected]>
To:humin (Q) <[email protected]>;dev <[email protected]> Date:2021-04-27 21:47:08
Subject:Re: [dpdk-dev] [PATCH 6/6] net/hns3: fix vector Rx burst default value

Quoted 23 lines · Min Hu (Connor)

From: Chengwen Feng < [email protected]<mailto:[email protected]>>

Currently, driver uses the macro HNS3_DEFAULT_RX_BURST whose value is 32 to limit the vector Rx burst size, as a result, the burst size user configure can't exceed 32.

This patch fixes this problem by defining the macro HNS3_DEFAULT_RX_BURST as 64.

Fixes a3d4f4d291d7 ("net/hns3: support NEON Rx")

---
drivers/net/hns3/hns3_rxtx.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hns3/hns3_rxtx.h +0 -0
index 1e2e994..ba24e00 100644

drivers/net/hns3/hns3_rxtx.h line 23

Quoted 5 lines
drivers/net/hns3/hns3_rxtx.h +1 -1
@@ -20,7 +20,7 @@
 #define HNS3_DEFAULT_TX_RS_THRESH    32
 #define HNS3_TX_FAST_FREE_AHEAD              64
 
-#define HNS3_DEFAULT_RX_BURST                32
+#define HNS3_DEFAULT_RX_BURST                64

It seems in the vector Rx path, the number of receive packets are limited silently to 'HNS3_DEFAULT_RX_BURST' independent from what user requested/configured.

There can be driver/HW limitations to 'HNS3_DEFAULT_RX_BURST' that is OK, but instead of limiting user request, what do you think about Rx in the 'HNS3_DEFAULT_RX_BURST' blocks until user request justified?

I mean something like following implementation:
https://git.dpdk.org/dpdk/commit/?id=d96394ea263c

sound good, will fix in v2, thanks

#16 lore raw

v2 cover optimization and bugfix for hns3 PMD

In reply to Min Hu (Connor)

This patch set contains one patch for performance optimization, this is: 'net/hns3: improve IO path data cache usage'. The others are bugfixes for hns3 PMD.

Chengwen Feng (6):
net/hns3: delete some unused capabilities
net/hns3: modify write reg opt API impl
net/hns3: use RTE DIM instead of ARRAY SIZE
net/hns3: improve IO path data cache usage
net/hns3: log fdir configuration
net/hns3: fix vector Rx burst can't exceed 32
---
v2:
* fixed commit info.
* changed hns3_info to hns3_dbg.
* deleted tx push, simple bd capa.

 drivers/net/hns3/hns3_cmd.c          |  15 +---
 drivers/net/hns3/hns3_cmd.h          |  17 ++---
 drivers/net/hns3/hns3_ethdev.h       |  43 +++++-------
 drivers/net/hns3/hns3_fdir.c         |  13 ++++
 drivers/net/hns3/hns3_flow.c         |  18 ++---
 drivers/net/hns3/hns3_intr.c         |   4 +-
 drivers/net/hns3/hns3_rxtx.h         | 128 +++++++++++++++++++++--------------
 drivers/net/hns3/hns3_rxtx_vec.c     |  41 ++++++++---
 drivers/net/hns3/hns3_rxtx_vec_sve.c |  37 ++++++++--
 9 files changed, 190 insertions(+), 126 deletions(-)
Signature · 1 line
2.7.4
#17 lore raw

PATCH v2 1/6 net/hns3: delete some unused capabilities

From: Chengwen Feng <[email protected]>

This patch deletes some unused capabilities, include:
1. Delete some unused firmware capabilities definition, which are:
UDP_GSO, ATR, INT_QL, SIMPLE_BD, TX_PUSH, FEC and PAUSE.
2. Delete some unused driver capabilities definition, which are:
UDP_GSO, TX_PUSH.
3. Also redefine HNS3_DEV_SUPPORT_* as enum type, and change some of the values. Note: the HNS3_DEV_SUPPORT_* values is used only inside the driver, so it's safe to change the values.

---
 drivers/net/hns3/hns3_cmd.c    | 11 -----------
 drivers/net/hns3/hns3_cmd.h    | 17 +++++++----------
 drivers/net/hns3/hns3_ethdev.h | 29 +++++++++++------------------
 3 files changed, 18 insertions(+), 39 deletions(-)
drivers/net/hns3/hns3_cmd.c +0 -11
index 62dfc19..6331380 100644
@@ -423,21 +423,14 @@ hns3_get_caps_name(uint32_t caps_id)
 		enum HNS3_CAPS_BITS caps;
 		const char *name;
 	} dev_caps[] = {
-		{ HNS3_CAPS_UDP_GSO_B,         "udp_gso"         },
-		{ HNS3_CAPS_ATR_B,             "atr"             },
 		{ HNS3_CAPS_FD_QUEUE_REGION_B, "fd_queue_region" },
 		{ HNS3_CAPS_PTP_B,             "ptp"             },
-		{ HNS3_CAPS_INT_QL_B,          "int_ql"          },
-		{ HNS3_CAPS_SIMPLE_BD_B,       "simple_bd"       },
-		{ HNS3_CAPS_TX_PUSH_B,         "tx_push"         },
 		{ HNS3_CAPS_PHY_IMP_B,         "phy_imp"         },
 		{ HNS3_CAPS_TQP_TXRX_INDEP_B,  "tqp_txrx_indep"  },
 		{ HNS3_CAPS_HW_PAD_B,          "hw_pad"          },
 		{ HNS3_CAPS_STASH_B,           "stash"           },
 		{ HNS3_CAPS_UDP_TUNNEL_CSUM_B, "udp_tunnel_csum" },
 		{ HNS3_CAPS_RAS_IMP_B,         "ras_imp"         },
-		{ HNS3_CAPS_FEC_B,             "fec"             },
-		{ HNS3_CAPS_PAUSE_B,           "pause"           },
 		{ HNS3_CAPS_RXD_ADV_LAYOUT_B,  "rxd_adv_layout"  }
 	};
 	uint32_t i;
@@ -484,8 +477,6 @@ hns3_parse_capability(struct hns3_hw *hw,
 {
 	uint32_t caps = rte_le_to_cpu_32(cmd->caps[0]);
 
-	if (hns3_get_bit(caps, HNS3_CAPS_UDP_GSO_B))
-		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_UDP_GSO_B, 1);
 	if (hns3_get_bit(caps, HNS3_CAPS_FD_QUEUE_REGION_B))
 		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B,
 			     1);
@@ -502,8 +493,6 @@ hns3_parse_capability(struct hns3_hw *hw,
 			hns3_warn(hw, "ignore PTP capability due to lack of "
 				  "rxd advanced layout capability.");
 	}
-	if (hns3_get_bit(caps, HNS3_CAPS_TX_PUSH_B))
-		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_TX_PUSH_B, 1);
 	if (hns3_get_bit(caps, HNS3_CAPS_PHY_IMP_B))
 		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 1);
 	if (hns3_get_bit(caps, HNS3_CAPS_TQP_TXRX_INDEP_B))
drivers/net/hns3/hns3_cmd.h +7 -10
index bf1772d..944e3d6 100644
@@ -306,22 +306,19 @@ struct hns3_rx_priv_buff_cmd {
 #define HNS3_FW_VERSION_BYTE0_M		GENMASK(7, 0)
 
 enum HNS3_CAPS_BITS {
-	HNS3_CAPS_UDP_GSO_B,
-	HNS3_CAPS_ATR_B,
-	HNS3_CAPS_FD_QUEUE_REGION_B,
+	/*
+	 * The following capability index definitions must be the same as those
+	 * of the firmware.
+	 */
+	HNS3_CAPS_FD_QUEUE_REGION_B = 2,
 	HNS3_CAPS_PTP_B,
-	HNS3_CAPS_INT_QL_B,
-	HNS3_CAPS_SIMPLE_BD_B,
-	HNS3_CAPS_TX_PUSH_B,
-	HNS3_CAPS_PHY_IMP_B,
+	HNS3_CAPS_PHY_IMP_B = 7,
 	HNS3_CAPS_TQP_TXRX_INDEP_B,
 	HNS3_CAPS_HW_PAD_B,
 	HNS3_CAPS_STASH_B,
 	HNS3_CAPS_UDP_TUNNEL_CSUM_B,
 	HNS3_CAPS_RAS_IMP_B,
-	HNS3_CAPS_FEC_B,
-	HNS3_CAPS_PAUSE_B,
-	HNS3_CAPS_RXD_ADV_LAYOUT_B,
+	HNS3_CAPS_RXD_ADV_LAYOUT_B = 15,
 };
 
 enum HNS3_API_CAP_BITS {
drivers/net/hns3/hns3_ethdev.h +11 -18
index d27c725..bedbffd 100644
@@ -855,17 +855,17 @@ enum {
 
 #define HNS3_DEVARG_DEV_CAPS_MASK	"dev_caps_mask"
 
-#define HNS3_DEV_SUPPORT_DCB_B			0x0
-#define HNS3_DEV_SUPPORT_COPPER_B		0x1
-#define HNS3_DEV_SUPPORT_UDP_GSO_B		0x2
-#define HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B	0x3
-#define HNS3_DEV_SUPPORT_PTP_B			0x4
-#define HNS3_DEV_SUPPORT_TX_PUSH_B		0x5
-#define HNS3_DEV_SUPPORT_INDEP_TXRX_B		0x6
-#define HNS3_DEV_SUPPORT_STASH_B		0x7
-#define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B	0x9
-#define HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B	0xA
-#define HNS3_DEV_SUPPORT_RAS_IMP_B		0xB
+enum {
+	HNS3_DEV_SUPPORT_DCB_B,
+	HNS3_DEV_SUPPORT_COPPER_B,
+	HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B,
+	HNS3_DEV_SUPPORT_PTP_B,
+	HNS3_DEV_SUPPORT_INDEP_TXRX_B,
+	HNS3_DEV_SUPPORT_STASH_B,
+	HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B,
+	HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B,
+	HNS3_DEV_SUPPORT_RAS_IMP_B,
+};
 
 #define hns3_dev_dcb_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B)
@@ -874,10 +874,6 @@ enum {
 #define hns3_dev_copper_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_COPPER_B)
 
-/* Support UDP GSO offload */
-#define hns3_dev_udp_gso_supported(hw) \
-	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_UDP_GSO_B)
-
 /* Support the queue region action rule of flow directory */
 #define hns3_dev_fd_queue_region_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B)
@@ -886,9 +882,6 @@ enum {
 #define hns3_dev_ptp_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_PTP_B)
 
-#define hns3_dev_tx_push_supported(hw) \
-	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TX_PUSH_B)
-
 /* Support to Independently enable/disable/reset Tx or Rx queues */
 #define hns3_dev_indep_txrx_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_INDEP_TXRX_B)
Signature · 1 line
2.7.4
#18 lore raw

PATCH v2 2/6 net/hns3: modify write reg opt API impl

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch modifies hns3_write_reg_opt() API implementation because the rte_write32() already uses rte_io_wmb().

---
 drivers/net/hns3/hns3_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/hns3/hns3_ethdev.h +4 -4
index bedbffd..666ef71 100644
@@ -977,13 +977,13 @@ static inline void hns3_write_reg(void *base, uint32_t reg, uint32_t value)
 }
 
 /*
- * The optimized function for writing registers used in the '.rx_pkt_burst' and
- * '.tx_pkt_burst' ops implementation function.
+ * The optimized function for writing registers reduces one address addition
+ * calculation, it was used in the '.rx_pkt_burst' and '.tx_pkt_burst' ops
+ * implementation function.
  */
 static inline void hns3_write_reg_opt(volatile void *addr, uint32_t value)
 {
-	rte_io_wmb();
-	rte_write32_relaxed(rte_cpu_to_le_32(value), addr);
+	rte_write32(rte_cpu_to_le_32(value), addr);
 }
 
 static inline uint32_t hns3_read_reg(void *base, uint32_t reg)
Signature · 1 line
2.7.4
#19 lore raw

PATCH v2 3/6 net/hns3: use RTE DIM instead of ARRAY SIZE

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch uses RTE_DIM() instead of ARRAY_SIZE().

---
 drivers/net/hns3/hns3_cmd.c    |  4 ++--
 drivers/net/hns3/hns3_ethdev.h |  2 --
 drivers/net/hns3/hns3_flow.c   | 18 +++++++++---------
 drivers/net/hns3/hns3_intr.c   |  4 ++--
 4 files changed, 13 insertions(+), 15 deletions(-)
drivers/net/hns3/hns3_cmd.c +2 -2
index 6331380..e224a95 100644
@@ -245,7 +245,7 @@ hns3_is_special_opcode(uint16_t opcode)
 				  HNS3_OPC_QUERY_ALL_ERR_INFO,};
 	uint32_t i;
 
-	for (i = 0; i < ARRAY_SIZE(spec_opcode); i++)
+	for (i = 0; i < RTE_DIM(spec_opcode); i++)
 		if (spec_opcode[i] == opcode)
 			return true;
 
@@ -276,7 +276,7 @@ hns3_cmd_convert_err_code(uint16_t desc_ret)
 
 	uint32_t i;
 
-	for (i = 0; i < ARRAY_SIZE(hns3_cmdq_status); i++)
+	for (i = 0; i < RTE_DIM(hns3_cmdq_status); i++)
 		if (hns3_cmdq_status[i].imp_errcode == desc_ret)
 			return hns3_cmdq_status[i].linux_errcode;
 
drivers/net/hns3/hns3_ethdev.h +0 -2
index 666ef71..48f5307 100644
@@ -998,8 +998,6 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg)
 #define hns3_read_dev(a, reg) \
 	hns3_read_reg((a)->io_base, (reg))
 
-#define ARRAY_SIZE(x) RTE_DIM(x)
-
 #define NEXT_ITEM_OF_ACTION(act, actions, index)                        \
 	do {								\
 		act = (actions) + (index);				\
drivers/net/hns3/hns3_flow.c +9 -9
index 4511a49..49d6568 100644
@@ -1054,37 +1054,37 @@ hns3_parse_normal(const struct rte_flow_item *item, struct hns3_fdir_rule *rule,
 	case RTE_FLOW_ITEM_TYPE_ETH:
 		ret = hns3_parse_eth(item, rule, error);
 		step_mngr->items = L2_next_items;
-		step_mngr->count = ARRAY_SIZE(L2_next_items);
+		step_mngr->count = RTE_DIM(L2_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_VLAN:
 		ret = hns3_parse_vlan(item, rule, error);
 		step_mngr->items = L2_next_items;
-		step_mngr->count = ARRAY_SIZE(L2_next_items);
+		step_mngr->count = RTE_DIM(L2_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV4:
 		ret = hns3_parse_ipv4(item, rule, error);
 		step_mngr->items = L3_next_items;
-		step_mngr->count = ARRAY_SIZE(L3_next_items);
+		step_mngr->count = RTE_DIM(L3_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV6:
 		ret = hns3_parse_ipv6(item, rule, error);
 		step_mngr->items = L3_next_items;
-		step_mngr->count = ARRAY_SIZE(L3_next_items);
+		step_mngr->count = RTE_DIM(L3_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_TCP:
 		ret = hns3_parse_tcp(item, rule, error);
 		step_mngr->items = L4_next_items;
-		step_mngr->count = ARRAY_SIZE(L4_next_items);
+		step_mngr->count = RTE_DIM(L4_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_UDP:
 		ret = hns3_parse_udp(item, rule, error);
 		step_mngr->items = L4_next_items;
-		step_mngr->count = ARRAY_SIZE(L4_next_items);
+		step_mngr->count = RTE_DIM(L4_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_SCTP:
 		ret = hns3_parse_sctp(item, rule, error);
 		step_mngr->items = L4_next_items;
-		step_mngr->count = ARRAY_SIZE(L4_next_items);
+		step_mngr->count = RTE_DIM(L4_next_items);
 		break;
 	default:
 		return rte_flow_error_set(error, ENOTSUP,
@@ -1188,7 +1188,7 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev,
 					  "Fdir not supported in VF");
 
 	step_mngr.items = first_items;
-	step_mngr.count = ARRAY_SIZE(first_items);
+	step_mngr.count = RTE_DIM(first_items);
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		if (item->type == RTE_FLOW_ITEM_TYPE_VOID)
 			continue;
@@ -1202,7 +1202,7 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev,
 			if (ret)
 				return ret;
 			step_mngr.items = tunnel_next_items;
-			step_mngr.count = ARRAY_SIZE(tunnel_next_items);
+			step_mngr.count = RTE_DIM(tunnel_next_items);
 		} else {
 			ret = hns3_parse_normal(item, rule, &step_mngr, error);
 			if (ret)
drivers/net/hns3/hns3_intr.c +2 -2
index cc7d7c6..3155d7f 100644
@@ -2206,8 +2206,8 @@ hns3_handle_type_reg_error_data(struct hns3_hw *hw,
 	type_id = err_info->type_id & HNS3_ERR_TYPE_MASK;
 	is_ras = err_info->type_id >> HNS3_ERR_TYPE_IS_RAS_OFFSET;
 
-	total_module = ARRAY_SIZE(hns3_hw_module_name);
-	total_type = ARRAY_SIZE(hns3_hw_error_type);
+	total_module = RTE_DIM(hns3_hw_module_name);
+	total_type = RTE_DIM(hns3_hw_error_type);
 
 	hns3_err(hw, "total_module:%u, total_type:%u",
 		 total_module, total_type);
Signature · 1 line
2.7.4
#20 lore raw

PATCH v2 4/6 net/hns3: improve IO path data cache usage

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch improves data cache usage by:
1. Rearrange the rxq frequency accessed fields in the IO path to the first 128B.
2. Rearrange the txq frequency accessed fields in the IO path to the first 64B.
3. Make sure ptype table align cacheline size which is 128B instead of min cacheline size which is 64B because the L1/L2 is 64B and L3 is 128B on Kunpeng ARM platform.

The performance gains are 1.5% in 64B packet macfwd scenarios.

---
 drivers/net/hns3/hns3_ethdev.h |   4 +-
 drivers/net/hns3/hns3_rxtx.h   | 126 ++++++++++++++++++++++++-----------------
 2 files changed, 77 insertions(+), 53 deletions(-)
drivers/net/hns3/hns3_ethdev.h +2 -2
index 48f5307..cee78f4 100644
@@ -735,7 +735,7 @@ struct hns3_ptype_table {
 	 * descriptor, it functions only when firmware report the capability of
 	 * HNS3_CAPS_RXD_ADV_LAYOUT_B and driver enabled it.
 	 */
-	uint32_t ptype[HNS3_PTYPE_NUM] __rte_cache_min_aligned;
+	uint32_t ptype[HNS3_PTYPE_NUM] __rte_cache_aligned;
 };
 
 #define HNS3_FIXED_MAX_TQP_NUM_MODE		0
@@ -839,7 +839,7 @@ struct hns3_adapter {
 
 	uint64_t dev_caps_mask;
 
-	struct hns3_ptype_table ptype_tbl __rte_cache_min_aligned;
+	struct hns3_ptype_table ptype_tbl __rte_cache_aligned;
 };
 
 enum {
drivers/net/hns3/hns3_rxtx.h +75 -51

199 lines not on this page · raw message

Signature · 1 line
2.7.4
#21 lore raw

PATCH v2 5/6 net/hns3: log FDIR configuration

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

The rte flow interface does not support the API of the capability set. Therefore, fdir configuration logs are added to facilitate debugging.

---
 drivers/net/hns3/hns3_fdir.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/net/hns3/hns3_fdir.c +13 -0
index 87c1aef..0ef0938 100644
@@ -336,6 +336,8 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 	    BIT(INNER_IP_PROTO) | BIT(INNER_IP_TOS) |
 	    BIT(INNER_SRC_IP) | BIT(INNER_DST_IP) |
 	    BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT);
+	hns3_dbg(hw, "fdir tuple: inner<vlan_tag1 eth_type ip_src ip_dst "
+		  "ip_proto ip_tos l4_src_port l4_dst_port>");
 
 	/* If use max 400bit key, we can support tuples for ether type */
 	if (pf->fdir.fd_cfg.max_key_length == MAX_KEY_LENGTH) {
@@ -345,6 +347,9 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 		    BIT(OUTER_DST_PORT) | BIT(INNER_VLAN_TAG2) |
 		    BIT(OUTER_TUN_VNI) | BIT(OUTER_TUN_FLOW_ID) |
 		    BIT(OUTER_ETH_TYPE) | BIT(OUTER_IP_PROTO);
+		hns3_dbg(hw, "fdir tuple more: inner<dst_mac src_mac "
+			  "vlan_tag2 sctp_tag> outer<eth_type ip_proto "
+			  "l4_src_port l4_dst_port tun_vni tun_flow_id>");
 	}
 
 	/* roce_type is used to filter roce frames
@@ -352,6 +357,7 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 	 */
 	key_cfg->meta_data_active = BIT(DST_VPORT) | BIT(TUNNEL_PACKET) |
 	    BIT(VLAN_NUMBER);
+	hns3_dbg(hw, "fdir meta data: dst_vport tunnel_packet vlan_number");
 
 	ret = hns3_get_fd_allocation(hw,
 				     &pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1],
@@ -361,6 +367,13 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 	if (ret)
 		return ret;
 
+	hns3_dbg(hw, "fdir: stage1<rules-%u counters-%u> stage2<rules-%u "
+		  "counters=%u>",
+		  pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1],
+		  pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_1],
+		  pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_2],
+		  pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_2]);
+
 	return hns3_set_fd_key_config(hns);
 }
 
Signature · 1 line
2.7.4
#22 lore raw

PATCH v2 6/6 net/hns3: fix vector Rx burst can't exceed 32

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

Currently, driver uses the macro HNS3_DEFAULT_RX_BURST whose value is 32 to limit the vector Rx burst size, as a result, the burst size can't exceed 32.

This patch fixes this problem by support big burst size. Also adjust HNS3_DEFAULT_RX_BURST to 64 as it performs better than 32.

Fixes a3d4f4d291d7 ("net/hns3: support NEON Rx")
Fixes 952ebacce4f2 ("net/hns3: support SVE Rx")
---
 drivers/net/hns3/hns3_rxtx.h         |  2 +-
 drivers/net/hns3/hns3_rxtx_vec.c     | 41 +++++++++++++++++++++++++++++-------
 drivers/net/hns3/hns3_rxtx_vec_sve.c | 37 ++++++++++++++++++++++++++------
 3 files changed, 65 insertions(+), 15 deletions(-)
drivers/net/hns3/hns3_rxtx.h +1 -1
index 1e2e994..ba24e00 100644
@@ -20,7 +20,7 @@
 #define HNS3_DEFAULT_TX_RS_THRESH	32
 #define HNS3_TX_FAST_FREE_AHEAD		64
 
-#define HNS3_DEFAULT_RX_BURST		32
+#define HNS3_DEFAULT_RX_BURST		64
 #if (HNS3_DEFAULT_RX_BURST > 64)
 #error "PMD HNS3: HNS3_DEFAULT_RX_BURST must <= 64\n"
 #endif
drivers/net/hns3/hns3_rxtx_vec.c +33 -8

57 lines not on this page · raw message

drivers/net/hns3/hns3_rxtx_vec_sve.c +31 -6
index ef6c875..44e5293 100644
@@ -292,12 +292,11 @@ hns3_recv_pkts_vec_sve(void *__restrict rx_queue,
 {
 	struct hns3_rx_queue *rxq = rx_queue;
 	struct hns3_desc *rxdp = &rxq->rx_ring[rxq->next_to_use];
-	uint64_t bd_err_mask;  /* bit mask indicate whick pkts is error */
+	uint64_t pkt_err_mask;  /* bit mask indicate whick pkts is error */
 	uint16_t nb_rx;
 
 	rte_prefetch_non_temporal(rxdp);
 
-	nb_pkts = RTE_MIN(nb_pkts, HNS3_DEFAULT_RX_BURST);
 	nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, HNS3_SVE_DEFAULT_DESCS_PER_LOOP);
 
 	if (rxq->rx_rearm_nb > HNS3_DEFAULT_RXQ_REARM_THRESH)
@@ -309,10 +308,36 @@ hns3_recv_pkts_vec_sve(void *__restrict rx_queue,
 
 	hns3_rx_prefetch_mbuf_sve(&rxq->sw_ring[rxq->next_to_use]);
 
-	bd_err_mask = 0;
-	nb_rx = hns3_recv_burst_vec_sve(rxq, rx_pkts, nb_pkts, &bd_err_mask);
-	if (unlikely(bd_err_mask))
-		nb_rx = hns3_rx_reassemble_pkts(rx_pkts, nb_rx, bd_err_mask);
+	if (likely(nb_pkts <= HNS3_DEFAULT_RX_BURST)) {
+		pkt_err_mask = 0;
+		nb_rx = hns3_recv_burst_vec_sve(rxq, rx_pkts, nb_pkts,
+						&pkt_err_mask);
+		if (unlikely(pkt_err_mask > 0))
+			nb_rx = hns3_rx_reassemble_pkts(rx_pkts, nb_rx,
+							pkt_err_mask);
+		return nb_rx;
+	}
+
+	nb_rx = 0;
+	while (nb_pkts > 0) {
+		uint16_t ret, n;
+
+		n = RTE_MIN(nb_pkts, HNS3_DEFAULT_RX_BURST);
+		pkt_err_mask = 0;
+		ret = hns3_recv_burst_vec_sve(rxq, &rx_pkts[nb_rx], n,
+					      &pkt_err_mask);
+		nb_pkts -= ret;
+		if (unlikely(pkt_err_mask > 0))
+			nb_rx += hns3_rx_reassemble_pkts(&rx_pkts[nb_rx], ret,
+							 pkt_err_mask);
+		else
+			nb_rx += ret;
+		if (ret < n)
+			break;
+
+		if (rxq->rx_rearm_nb > HNS3_DEFAULT_RXQ_REARM_THRESH)
+			hns3_rxq_rearm_mbuf_sve(rxq);
+	}
 
 	return nb_rx;
 }
Signature · 1 line
2.7.4
#23 lore raw

v3 cover optimization and bugfix for hns3 PMD

In reply to Min Hu (Connor)

This patch set contains one patch for performance optimization, this is: 'net/hns3: improve IO path data cache usage'. The others are bugfixes for hns3 PMD.

Chengwen Feng (6):
net/hns3: delete some unused capabilities net/hns3: modify write reg opt API impl net/hns3: use RTE DIM instead of ARRAY SIZE net/hns3: improve IO path data cache usage net/hns3: log FDIR configuration
net/hns3: fix vector Rx burst can't exceed 32
---
v3:
* put the packet judgment error into the subfunction.

v2:
* fixed commit info.
* changed hns3_info to hns3_dbg.
* deleted tx push, simple bd capa.

 drivers/net/hns3/hns3_cmd.c          |  15 +---
 drivers/net/hns3/hns3_cmd.h          |  17 ++---
 drivers/net/hns3/hns3_ethdev.h       |  43 +++++-------
 drivers/net/hns3/hns3_fdir.c         |  13 ++++
 drivers/net/hns3/hns3_flow.c         |  18 ++---
 drivers/net/hns3/hns3_intr.c         |   4 +-
 drivers/net/hns3/hns3_rxtx.h         | 128 +++++++++++++++++++++--------------
 drivers/net/hns3/hns3_rxtx_vec.c     |  36 +++++++---
 drivers/net/hns3/hns3_rxtx_vec.h     |   3 +
 drivers/net/hns3/hns3_rxtx_vec_sve.c |  32 +++++++--
 10 files changed, 183 insertions(+), 126 deletions(-)
Signature · 1 line
2.7.4
#24 lore raw

PATCH v3 1/6 net/hns3: delete some unused capabilities

From: Chengwen Feng <[email protected]>

This patch deletes some unused capabilities, include:
1. Delete some unused firmware capabilities definition, which are:
UDP_GSO, ATR, INT_QL, SIMPLE_BD, TX_PUSH, FEC and PAUSE.
2. Delete some unused driver capabilities definition, which are:
UDP_GSO, TX_PUSH.
3. Also redefine HNS3_DEV_SUPPORT_* as enum type, and change some of the values. Note: the HNS3_DEV_SUPPORT_* values is used only inside the driver, so it's safe to change the values.

---
 drivers/net/hns3/hns3_cmd.c    | 11 -----------
 drivers/net/hns3/hns3_cmd.h    | 17 +++++++----------
 drivers/net/hns3/hns3_ethdev.h | 29 +++++++++++------------------
 3 files changed, 18 insertions(+), 39 deletions(-)
drivers/net/hns3/hns3_cmd.c +0 -11
index 5beb3d9..8ebe5e5 100644
@@ -419,21 +419,14 @@ hns3_get_caps_name(uint32_t caps_id)
 		enum HNS3_CAPS_BITS caps;
 		const char *name;
 	} dev_caps[] = {
-		{ HNS3_CAPS_UDP_GSO_B,         "udp_gso"         },
-		{ HNS3_CAPS_ATR_B,             "atr"             },
 		{ HNS3_CAPS_FD_QUEUE_REGION_B, "fd_queue_region" },
 		{ HNS3_CAPS_PTP_B,             "ptp"             },
-		{ HNS3_CAPS_INT_QL_B,          "int_ql"          },
-		{ HNS3_CAPS_SIMPLE_BD_B,       "simple_bd"       },
-		{ HNS3_CAPS_TX_PUSH_B,         "tx_push"         },
 		{ HNS3_CAPS_PHY_IMP_B,         "phy_imp"         },
 		{ HNS3_CAPS_TQP_TXRX_INDEP_B,  "tqp_txrx_indep"  },
 		{ HNS3_CAPS_HW_PAD_B,          "hw_pad"          },
 		{ HNS3_CAPS_STASH_B,           "stash"           },
 		{ HNS3_CAPS_UDP_TUNNEL_CSUM_B, "udp_tunnel_csum" },
 		{ HNS3_CAPS_RAS_IMP_B,         "ras_imp"         },
-		{ HNS3_CAPS_FEC_B,             "fec"             },
-		{ HNS3_CAPS_PAUSE_B,           "pause"           },
 		{ HNS3_CAPS_RXD_ADV_LAYOUT_B,  "rxd_adv_layout"  }
 	};
 	uint32_t i;
@@ -480,8 +473,6 @@ hns3_parse_capability(struct hns3_hw *hw,
 {
 	uint32_t caps = rte_le_to_cpu_32(cmd->caps[0]);
 
-	if (hns3_get_bit(caps, HNS3_CAPS_UDP_GSO_B))
-		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_UDP_GSO_B, 1);
 	if (hns3_get_bit(caps, HNS3_CAPS_FD_QUEUE_REGION_B))
 		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B,
 			     1);
@@ -498,8 +489,6 @@ hns3_parse_capability(struct hns3_hw *hw,
 			hns3_warn(hw, "ignore PTP capability due to lack of "
 				  "rxd advanced layout capability.");
 	}
-	if (hns3_get_bit(caps, HNS3_CAPS_TX_PUSH_B))
-		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_TX_PUSH_B, 1);
 	if (hns3_get_bit(caps, HNS3_CAPS_PHY_IMP_B))
 		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 1);
 	if (hns3_get_bit(caps, HNS3_CAPS_TQP_TXRX_INDEP_B))
drivers/net/hns3/hns3_cmd.h +7 -10
index bf1772d..944e3d6 100644
@@ -306,22 +306,19 @@ struct hns3_rx_priv_buff_cmd {
 #define HNS3_FW_VERSION_BYTE0_M		GENMASK(7, 0)
 
 enum HNS3_CAPS_BITS {
-	HNS3_CAPS_UDP_GSO_B,
-	HNS3_CAPS_ATR_B,
-	HNS3_CAPS_FD_QUEUE_REGION_B,
+	/*
+	 * The following capability index definitions must be the same as those
+	 * of the firmware.
+	 */
+	HNS3_CAPS_FD_QUEUE_REGION_B = 2,
 	HNS3_CAPS_PTP_B,
-	HNS3_CAPS_INT_QL_B,
-	HNS3_CAPS_SIMPLE_BD_B,
-	HNS3_CAPS_TX_PUSH_B,
-	HNS3_CAPS_PHY_IMP_B,
+	HNS3_CAPS_PHY_IMP_B = 7,
 	HNS3_CAPS_TQP_TXRX_INDEP_B,
 	HNS3_CAPS_HW_PAD_B,
 	HNS3_CAPS_STASH_B,
 	HNS3_CAPS_UDP_TUNNEL_CSUM_B,
 	HNS3_CAPS_RAS_IMP_B,
-	HNS3_CAPS_FEC_B,
-	HNS3_CAPS_PAUSE_B,
-	HNS3_CAPS_RXD_ADV_LAYOUT_B,
+	HNS3_CAPS_RXD_ADV_LAYOUT_B = 15,
 };
 
 enum HNS3_API_CAP_BITS {
drivers/net/hns3/hns3_ethdev.h +11 -18
index b2dacb9..608fd0c 100644
@@ -858,17 +858,17 @@ enum {
 
 #define HNS3_DEVARG_DEV_CAPS_MASK	"dev_caps_mask"
 
-#define HNS3_DEV_SUPPORT_DCB_B			0x0
-#define HNS3_DEV_SUPPORT_COPPER_B		0x1
-#define HNS3_DEV_SUPPORT_UDP_GSO_B		0x2
-#define HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B	0x3
-#define HNS3_DEV_SUPPORT_PTP_B			0x4
-#define HNS3_DEV_SUPPORT_TX_PUSH_B		0x5
-#define HNS3_DEV_SUPPORT_INDEP_TXRX_B		0x6
-#define HNS3_DEV_SUPPORT_STASH_B		0x7
-#define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B	0x9
-#define HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B	0xA
-#define HNS3_DEV_SUPPORT_RAS_IMP_B		0xB
+enum {
+	HNS3_DEV_SUPPORT_DCB_B,
+	HNS3_DEV_SUPPORT_COPPER_B,
+	HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B,
+	HNS3_DEV_SUPPORT_PTP_B,
+	HNS3_DEV_SUPPORT_INDEP_TXRX_B,
+	HNS3_DEV_SUPPORT_STASH_B,
+	HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B,
+	HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B,
+	HNS3_DEV_SUPPORT_RAS_IMP_B,
+};
 
 #define hns3_dev_dcb_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B)
@@ -877,10 +877,6 @@ enum {
 #define hns3_dev_copper_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_COPPER_B)
 
-/* Support UDP GSO offload */
-#define hns3_dev_udp_gso_supported(hw) \
-	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_UDP_GSO_B)
-
 /* Support the queue region action rule of flow directory */
 #define hns3_dev_fd_queue_region_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B)
@@ -889,9 +885,6 @@ enum {
 #define hns3_dev_ptp_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_PTP_B)
 
-#define hns3_dev_tx_push_supported(hw) \
-	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TX_PUSH_B)
-
 /* Support to Independently enable/disable/reset Tx or Rx queues */
 #define hns3_dev_indep_txrx_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_INDEP_TXRX_B)
Signature · 1 line
2.7.4
#25 lore raw

PATCH v3 2/6 net/hns3: modify write reg opt API impl

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch modifies hns3_write_reg_opt() API implementation because the rte_write32() already uses rte_io_wmb().

---
 drivers/net/hns3/hns3_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/hns3/hns3_ethdev.h +4 -4
index 608fd0c..23f3722 100644
@@ -980,13 +980,13 @@ static inline void hns3_write_reg(void *base, uint32_t reg, uint32_t value)
 }
 
 /*
- * The optimized function for writing registers used in the '.rx_pkt_burst' and
- * '.tx_pkt_burst' ops implementation function.
+ * The optimized function for writing registers reduces one address addition
+ * calculation, it was used in the '.rx_pkt_burst' and '.tx_pkt_burst' ops
+ * implementation function.
  */
 static inline void hns3_write_reg_opt(volatile void *addr, uint32_t value)
 {
-	rte_io_wmb();
-	rte_write32_relaxed(rte_cpu_to_le_32(value), addr);
+	rte_write32(rte_cpu_to_le_32(value), addr);
 }
 
 static inline uint32_t hns3_read_reg(void *base, uint32_t reg)
Signature · 1 line
2.7.4
#26 lore raw

PATCH v3 3/6 net/hns3: use RTE DIM instead of ARRAY SIZE

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch uses RTE_DIM() instead of ARRAY_SIZE().

---
 drivers/net/hns3/hns3_cmd.c    |  4 ++--
 drivers/net/hns3/hns3_ethdev.h |  2 --
 drivers/net/hns3/hns3_flow.c   | 18 +++++++++---------
 drivers/net/hns3/hns3_intr.c   |  4 ++--
 4 files changed, 13 insertions(+), 15 deletions(-)
drivers/net/hns3/hns3_cmd.c +2 -2
index 8ebe5e5..44a4e28 100644
@@ -241,7 +241,7 @@ hns3_is_special_opcode(uint16_t opcode)
 				  HNS3_OPC_QUERY_ALL_ERR_INFO,};
 	uint32_t i;
 
-	for (i = 0; i < ARRAY_SIZE(spec_opcode); i++)
+	for (i = 0; i < RTE_DIM(spec_opcode); i++)
 		if (spec_opcode[i] == opcode)
 			return true;
 
@@ -272,7 +272,7 @@ hns3_cmd_convert_err_code(uint16_t desc_ret)
 
 	uint32_t i;
 
-	for (i = 0; i < ARRAY_SIZE(hns3_cmdq_status); i++)
+	for (i = 0; i < RTE_DIM(hns3_cmdq_status); i++)
 		if (hns3_cmdq_status[i].imp_errcode == desc_ret)
 			return hns3_cmdq_status[i].linux_errcode;
 
drivers/net/hns3/hns3_ethdev.h +0 -2
index 23f3722..a6622a6 100644
@@ -1001,8 +1001,6 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg)
 #define hns3_read_dev(a, reg) \
 	hns3_read_reg((a)->io_base, (reg))
 
-#define ARRAY_SIZE(x) RTE_DIM(x)
-
 #define NEXT_ITEM_OF_ACTION(act, actions, index)                        \
 	do {								\
 		act = (actions) + (index);				\
drivers/net/hns3/hns3_flow.c +9 -9
index 4511a49..49d6568 100644
@@ -1054,37 +1054,37 @@ hns3_parse_normal(const struct rte_flow_item *item, struct hns3_fdir_rule *rule,
 	case RTE_FLOW_ITEM_TYPE_ETH:
 		ret = hns3_parse_eth(item, rule, error);
 		step_mngr->items = L2_next_items;
-		step_mngr->count = ARRAY_SIZE(L2_next_items);
+		step_mngr->count = RTE_DIM(L2_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_VLAN:
 		ret = hns3_parse_vlan(item, rule, error);
 		step_mngr->items = L2_next_items;
-		step_mngr->count = ARRAY_SIZE(L2_next_items);
+		step_mngr->count = RTE_DIM(L2_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV4:
 		ret = hns3_parse_ipv4(item, rule, error);
 		step_mngr->items = L3_next_items;
-		step_mngr->count = ARRAY_SIZE(L3_next_items);
+		step_mngr->count = RTE_DIM(L3_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV6:
 		ret = hns3_parse_ipv6(item, rule, error);
 		step_mngr->items = L3_next_items;
-		step_mngr->count = ARRAY_SIZE(L3_next_items);
+		step_mngr->count = RTE_DIM(L3_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_TCP:
 		ret = hns3_parse_tcp(item, rule, error);
 		step_mngr->items = L4_next_items;
-		step_mngr->count = ARRAY_SIZE(L4_next_items);
+		step_mngr->count = RTE_DIM(L4_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_UDP:
 		ret = hns3_parse_udp(item, rule, error);
 		step_mngr->items = L4_next_items;
-		step_mngr->count = ARRAY_SIZE(L4_next_items);
+		step_mngr->count = RTE_DIM(L4_next_items);
 		break;
 	case RTE_FLOW_ITEM_TYPE_SCTP:
 		ret = hns3_parse_sctp(item, rule, error);
 		step_mngr->items = L4_next_items;
-		step_mngr->count = ARRAY_SIZE(L4_next_items);
+		step_mngr->count = RTE_DIM(L4_next_items);
 		break;
 	default:
 		return rte_flow_error_set(error, ENOTSUP,
@@ -1188,7 +1188,7 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev,
 					  "Fdir not supported in VF");
 
 	step_mngr.items = first_items;
-	step_mngr.count = ARRAY_SIZE(first_items);
+	step_mngr.count = RTE_DIM(first_items);
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		if (item->type == RTE_FLOW_ITEM_TYPE_VOID)
 			continue;
@@ -1202,7 +1202,7 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev,
 			if (ret)
 				return ret;
 			step_mngr.items = tunnel_next_items;
-			step_mngr.count = ARRAY_SIZE(tunnel_next_items);
+			step_mngr.count = RTE_DIM(tunnel_next_items);
 		} else {
 			ret = hns3_parse_normal(item, rule, &step_mngr, error);
 			if (ret)
drivers/net/hns3/hns3_intr.c +2 -2
index ba6a044..b743b41 100644
@@ -2206,8 +2206,8 @@ hns3_handle_type_reg_error_data(struct hns3_hw *hw,
 	type_id = err_info->type_id & HNS3_ERR_TYPE_MASK;
 	is_ras = err_info->type_id >> HNS3_ERR_TYPE_IS_RAS_OFFSET;
 
-	total_module = ARRAY_SIZE(hns3_hw_module_name);
-	total_type = ARRAY_SIZE(hns3_hw_error_type);
+	total_module = RTE_DIM(hns3_hw_module_name);
+	total_type = RTE_DIM(hns3_hw_error_type);
 
 	hns3_err(hw, "total_module:%u, total_type:%u",
 		 total_module, total_type);
Signature · 1 line
2.7.4
#27 lore raw

PATCH v3 4/6 net/hns3: improve IO path data cache usage

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

This patch improves data cache usage by:
1. Rearrange the rxq frequency accessed fields in the IO path to the first 128B.
2. Rearrange the txq frequency accessed fields in the IO path to the first 64B.
3. Make sure ptype table align cacheline size which is 128B instead of min cacheline size which is 64B because the L1/L2 is 64B and L3 is 128B on Kunpeng ARM platform.

The performance gains are 1.5% in 64B packet macfwd scenarios.

---
 drivers/net/hns3/hns3_ethdev.h |   4 +-
 drivers/net/hns3/hns3_rxtx.h   | 126 ++++++++++++++++++++++++-----------------
 2 files changed, 77 insertions(+), 53 deletions(-)
drivers/net/hns3/hns3_ethdev.h +2 -2
index a6622a6..133b484 100644
@@ -738,7 +738,7 @@ struct hns3_ptype_table {
 	 * descriptor, it functions only when firmware report the capability of
 	 * HNS3_CAPS_RXD_ADV_LAYOUT_B and driver enabled it.
 	 */
-	uint32_t ptype[HNS3_PTYPE_NUM] __rte_cache_min_aligned;
+	uint32_t ptype[HNS3_PTYPE_NUM] __rte_cache_aligned;
 };
 
 #define HNS3_FIXED_MAX_TQP_NUM_MODE		0
@@ -842,7 +842,7 @@ struct hns3_adapter {
 
 	uint64_t dev_caps_mask;
 
-	struct hns3_ptype_table ptype_tbl __rte_cache_min_aligned;
+	struct hns3_ptype_table ptype_tbl __rte_cache_aligned;
 };
 
 enum {
drivers/net/hns3/hns3_rxtx.h +75 -51

199 lines not on this page · raw message

Signature · 1 line
2.7.4
#28 lore raw

PATCH v3 5/6 net/hns3: log FDIR configuration

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

The rte flow interface does not support the API of the capability set. Therefore, fdir configuration logs are added to facilitate debugging.

---
 drivers/net/hns3/hns3_fdir.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/net/hns3/hns3_fdir.c +13 -0
index 87c1aef..0ef0938 100644
@@ -336,6 +336,8 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 	    BIT(INNER_IP_PROTO) | BIT(INNER_IP_TOS) |
 	    BIT(INNER_SRC_IP) | BIT(INNER_DST_IP) |
 	    BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT);
+	hns3_dbg(hw, "fdir tuple: inner<vlan_tag1 eth_type ip_src ip_dst "
+		  "ip_proto ip_tos l4_src_port l4_dst_port>");
 
 	/* If use max 400bit key, we can support tuples for ether type */
 	if (pf->fdir.fd_cfg.max_key_length == MAX_KEY_LENGTH) {
@@ -345,6 +347,9 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 		    BIT(OUTER_DST_PORT) | BIT(INNER_VLAN_TAG2) |
 		    BIT(OUTER_TUN_VNI) | BIT(OUTER_TUN_FLOW_ID) |
 		    BIT(OUTER_ETH_TYPE) | BIT(OUTER_IP_PROTO);
+		hns3_dbg(hw, "fdir tuple more: inner<dst_mac src_mac "
+			  "vlan_tag2 sctp_tag> outer<eth_type ip_proto "
+			  "l4_src_port l4_dst_port tun_vni tun_flow_id>");
 	}
 
 	/* roce_type is used to filter roce frames
@@ -352,6 +357,7 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 	 */
 	key_cfg->meta_data_active = BIT(DST_VPORT) | BIT(TUNNEL_PACKET) |
 	    BIT(VLAN_NUMBER);
+	hns3_dbg(hw, "fdir meta data: dst_vport tunnel_packet vlan_number");
 
 	ret = hns3_get_fd_allocation(hw,
 				     &pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1],
@@ -361,6 +367,13 @@ int hns3_init_fd_config(struct hns3_adapter *hns)
 	if (ret)
 		return ret;
 
+	hns3_dbg(hw, "fdir: stage1<rules-%u counters-%u> stage2<rules-%u "
+		  "counters=%u>",
+		  pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1],
+		  pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_1],
+		  pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_2],
+		  pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_2]);
+
 	return hns3_set_fd_key_config(hns);
 }
 
Signature · 1 line
2.7.4
#29 lore raw

PATCH v3 6/6 net/hns3: fix vector Rx burst can't exceed 32

In reply to Min Hu (Connor)

From: Chengwen Feng <[email protected]>

Currently, driver uses the macro HNS3_DEFAULT_RX_BURST whose value is 32 to limit the vector Rx burst size, as a result, the burst size can't exceed 32.

This patch fixes this problem by support big burst size. Also adjust HNS3_DEFAULT_RX_BURST to 64 as it performs better than 32.

Fixes a3d4f4d291d7 ("net/hns3: support NEON Rx")
Fixes 952ebacce4f2 ("net/hns3: support SVE Rx")
---
 drivers/net/hns3/hns3_rxtx.h         |  2 +-
 drivers/net/hns3/hns3_rxtx_vec.c     | 36 ++++++++++++++++++++++++++++--------
 drivers/net/hns3/hns3_rxtx_vec.h     |  3 +++
 drivers/net/hns3/hns3_rxtx_vec_sve.c | 32 ++++++++++++++++++++++++++------
 4 files changed, 58 insertions(+), 15 deletions(-)
drivers/net/hns3/hns3_rxtx.h +1 -1
index 1e2e994..ba24e00 100644
@@ -20,7 +20,7 @@
 #define HNS3_DEFAULT_TX_RS_THRESH	32
 #define HNS3_TX_FAST_FREE_AHEAD		64
 
-#define HNS3_DEFAULT_RX_BURST		32
+#define HNS3_DEFAULT_RX_BURST		64
 #if (HNS3_DEFAULT_RX_BURST > 64)
 #error "PMD HNS3: HNS3_DEFAULT_RX_BURST must <= 64\n"
 #endif
drivers/net/hns3/hns3_rxtx_vec.c +28 -8
index dc1e1ae..cc8b970 100644
@@ -108,14 +108,13 @@ hns3_recv_pkts_vec(void *__restrict rx_queue,
 {
 	struct hns3_rx_queue *rxq = rx_queue;
 	struct hns3_desc *rxdp = &rxq->rx_ring[rxq->next_to_use];
-	uint64_t bd_err_mask;  /* bit mask indicate whick pkts is error */
+	uint64_t pkt_err_mask;  /* bit mask indicate whick pkts is error */
 	uint16_t nb_rx;
 
-	nb_pkts = RTE_MIN(nb_pkts, HNS3_DEFAULT_RX_BURST);
-	nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, HNS3_DEFAULT_DESCS_PER_LOOP);
-
 	rte_prefetch_non_temporal(rxdp);
 
+	nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, HNS3_DEFAULT_DESCS_PER_LOOP);
+
 	if (rxq->rx_rearm_nb > HNS3_DEFAULT_RXQ_REARM_THRESH)
 		hns3_rxq_rearm_mbuf(rxq);
 
@@ -128,10 +127,31 @@ hns3_recv_pkts_vec(void *__restrict rx_queue,
 	rte_prefetch0(rxq->sw_ring[rxq->next_to_use + 2].mbuf);
 	rte_prefetch0(rxq->sw_ring[rxq->next_to_use + 3].mbuf);
 
-	bd_err_mask = 0;
-	nb_rx = hns3_recv_burst_vec(rxq, rx_pkts, nb_pkts, &bd_err_mask);
-	if (unlikely(bd_err_mask))
-		nb_rx = hns3_rx_reassemble_pkts(rx_pkts, nb_rx, bd_err_mask);
+	if (likely(nb_pkts <= HNS3_DEFAULT_RX_BURST)) {
+		pkt_err_mask = 0;
+		nb_rx = hns3_recv_burst_vec(rxq, rx_pkts, nb_pkts,
+					    &pkt_err_mask);
+		nb_rx = hns3_rx_reassemble_pkts(rx_pkts, nb_rx, pkt_err_mask);
+		return nb_rx;
+	}
+
+	nb_rx = 0;
+	while (nb_pkts > 0) {
+		uint16_t ret, n;
+
+		n = RTE_MIN(nb_pkts, HNS3_DEFAULT_RX_BURST);
+		pkt_err_mask = 0;
+		ret = hns3_recv_burst_vec(rxq, &rx_pkts[nb_rx], n,
+					  &pkt_err_mask);
+		nb_pkts -= ret;
+		nb_rx += hns3_rx_reassemble_pkts(&rx_pkts[nb_rx], ret,
+						 pkt_err_mask);
+		if (ret < n)
+			break;
+
+		if (rxq->rx_rearm_nb > HNS3_DEFAULT_RXQ_REARM_THRESH)
+			hns3_rxq_rearm_mbuf(rxq);
+	}
 
 	return nb_rx;
 }
drivers/net/hns3/hns3_rxtx_vec.h +3 -0
index 2baf085..67c75e4 100644
@@ -71,6 +71,9 @@ hns3_rx_reassemble_pkts(struct rte_mbuf **rx_pkts,
 	uint16_t count, i;
 	uint64_t mask;
 
+	if (likely(pkt_err_mask == 0))
+		return nb_pkts;
+
 	count = 0;
 	for (i = 0; i < nb_pkts; i++) {
 		mask = ((uint64_t)1u) << i;
drivers/net/hns3/hns3_rxtx_vec_sve.c +26 -6
index ef6c875..bf7f704 100644
@@ -292,12 +292,11 @@ hns3_recv_pkts_vec_sve(void *__restrict rx_queue,
 {
 	struct hns3_rx_queue *rxq = rx_queue;
 	struct hns3_desc *rxdp = &rxq->rx_ring[rxq->next_to_use];
-	uint64_t bd_err_mask;  /* bit mask indicate whick pkts is error */
+	uint64_t pkt_err_mask;  /* bit mask indicate whick pkts is error */
 	uint16_t nb_rx;
 
 	rte_prefetch_non_temporal(rxdp);
 
-	nb_pkts = RTE_MIN(nb_pkts, HNS3_DEFAULT_RX_BURST);
 	nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, HNS3_SVE_DEFAULT_DESCS_PER_LOOP);
 
 	if (rxq->rx_rearm_nb > HNS3_DEFAULT_RXQ_REARM_THRESH)
@@ -309,10 +308,31 @@ hns3_recv_pkts_vec_sve(void *__restrict rx_queue,
 
 	hns3_rx_prefetch_mbuf_sve(&rxq->sw_ring[rxq->next_to_use]);
 
-	bd_err_mask = 0;
-	nb_rx = hns3_recv_burst_vec_sve(rxq, rx_pkts, nb_pkts, &bd_err_mask);
-	if (unlikely(bd_err_mask))
-		nb_rx = hns3_rx_reassemble_pkts(rx_pkts, nb_rx, bd_err_mask);
+	if (likely(nb_pkts <= HNS3_DEFAULT_RX_BURST)) {
+		pkt_err_mask = 0;
+		nb_rx = hns3_recv_burst_vec_sve(rxq, rx_pkts, nb_pkts,
+						&pkt_err_mask);
+		nb_rx = hns3_rx_reassemble_pkts(rx_pkts, nb_rx, pkt_err_mask);
+		return nb_rx;
+	}
+
+	nb_rx = 0;
+	while (nb_pkts > 0) {
+		uint16_t ret, n;
+
+		n = RTE_MIN(nb_pkts, HNS3_DEFAULT_RX_BURST);
+		pkt_err_mask = 0;
+		ret = hns3_recv_burst_vec_sve(rxq, &rx_pkts[nb_rx], n,
+					      &pkt_err_mask);
+		nb_pkts -= ret;
+		nb_rx += hns3_rx_reassemble_pkts(&rx_pkts[nb_rx], ret,
+						 pkt_err_mask);
+		if (ret < n)
+			break;
+
+		if (rxq->rx_rearm_nb > HNS3_DEFAULT_RXQ_REARM_THRESH)
+			hns3_rxq_rearm_mbuf_sve(rxq);
+	}
 
 	return nb_rx;
 }
Signature · 1 line
2.7.4
#30 lore raw
In reply to Min Hu (Connor)
Quoted 11 lines · Min Hu (Connor)

This patch set contains one patch for performance optimization, this is: 'net/hns3: improve IO path data cache usage'. The others are bugfixes for hns3 PMD.

Chengwen Feng (6):
net/hns3: delete some unused capabilities
net/hns3: modify write reg opt API impl
net/hns3: use RTE DIM instead of ARRAY SIZE
net/hns3: improve IO path data cache usage
net/hns3: log FDIR configuration
net/hns3: fix vector Rx burst can't exceed 32

Series applied to dpdk-next-net/main, thanks.