Skip to contentSkip to conversation

Support ipv6 flow rules

PATCH In review Xiaoyun wang 2 participants 9 messages May 9, 2020 – May 11, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

v5 cover Support ipv6 flow rules

This patch adds jumbo frame offload flag, increases judgment whether Tx/Rx queues is non-null when free resources, and if card mode does not support nic, driver will be initialized failed, supports ipv6 flow director for BGP or ICMP packets.

--
v4->v5:
- increase Tx/Rx queues non-null judgment
- add jumbo frame offload flag
- increase judgment for support NIC or not
- support ipv6 flow rules

v3->v4:
- fix PF firmware hotactive problem
- optimize log style
- adds txq xstats members

v2->v3:
- fix FW hotactive problem
- optimize log style

v1->v2:
- Fix LRO problems
- Fix hotupdate firmware problem
- Optimize doorbell area initialization
- Remove 40GE Mezz card id
- Add Fdir filter type
- Optimize log files
- Support pause flow control

v1:
- Allocate IO memory with socketid

Xiaoyun wang (4):
net/hinic: increase Tx/Rx queues non-null judgment net/hinic: add jumbo frame offload flag net/hinic: increase judgment for support NIC or not net/hinic/base: support ipv6 flow rules

 drivers/net/hinic/base/hinic_pmd_cfg.c   |   3 +-
 drivers/net/hinic/base/hinic_pmd_cmdq.h  |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c  |   2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c |   1 -
 drivers/net/hinic/hinic_pmd_ethdev.c     |  32 +++--
 drivers/net/hinic/hinic_pmd_ethdev.h     |  57 ++++++++-
 drivers/net/hinic/hinic_pmd_flow.c       | 209 ++++++++++++++++++++++++++++---
 drivers/net/hinic/hinic_pmd_rx.c         |   3 +-
 drivers/net/hinic/hinic_pmd_tx.c         |   5 +-
 9 files changed, 281 insertions(+), 33 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v5 1/4 net/hinic: increase Tx/Rx queues non-null judgment

Increase tx_queues and rx_queues non-null judgment before free tx or rx resources, and modify some formate for logs.

Fixes 54faba2295bd ("net/hinic: adds Tx queue xstats members")
---
 drivers/net/hinic/base/hinic_pmd_cmdq.h  |  2 +-
 drivers/net/hinic/base/hinic_pmd_hwif.c  |  2 +-
 drivers/net/hinic/base/hinic_pmd_nicio.c |  1 -
 drivers/net/hinic/hinic_pmd_ethdev.c     | 13 ++++++-------
 drivers/net/hinic/hinic_pmd_rx.c         |  3 ++-
 drivers/net/hinic/hinic_pmd_tx.c         |  5 ++++-
 6 files changed, 14 insertions(+), 12 deletions(-)
drivers/net/hinic/base/hinic_pmd_cmdq.h +1 -1
index 4ce0a4c..0d5e380 100644
@@ -9,7 +9,7 @@
 
 #define HINIC_SCMD_DATA_LEN		16
 
-/* hiovs pmd use 64, kernel l2nic use 4096 */
+/* pmd driver uses 64, kernel l2nic use 4096 */
 #define	HINIC_CMDQ_DEPTH		64
 
 #define	HINIC_CMDQ_BUF_SIZE		2048U
drivers/net/hinic/base/hinic_pmd_hwif.c +1 -1
index 63fba0d..1839df0 100644
@@ -99,7 +99,7 @@ void hinic_set_pf_status(struct hinic_hwif *hwif, enum hinic_pf_status status)
 	u32 addr  = HINIC_CSR_FUNC_ATTR5_ADDR;
 
 	if (hwif->attr.func_type == TYPE_VF) {
-		PMD_DRV_LOG(ERR, "VF doesn't support set attr5");
+		PMD_DRV_LOG(INFO, "VF doesn't support set attr5");
 		return;
 	}
 
drivers/net/hinic/base/hinic_pmd_nicio.c +0 -1
index 60c4e14..7f7e11d 100644
@@ -369,7 +369,6 @@ static int init_rq_ctxts(struct hinic_nic_io *nic_io)
 					     HINIC_MOD_L2NIC,
 					     HINIC_UCODE_CMD_MDY_QUEUE_CONTEXT,
 					     cmd_buf, &out_param, 0);
-
 		if ((err) || out_param != 0) {
 			PMD_DRV_LOG(ERR, "Failed to set RQ ctxts");
 			err = -EFAULT;
drivers/net/hinic/hinic_pmd_ethdev.c +6 -7
index cfbca64..5fcff81 100644
@@ -354,7 +354,7 @@ static int hinic_dev_configure(struct rte_eth_dev *dev)
 		return err;
 	}
 
-	/*clear fdir filter flag in function table*/
+	/* clear fdir filter flag in function table */
 	hinic_free_fdir_filter(nic_dev);
 
 	return HINIC_OK;
@@ -440,7 +440,7 @@ static int hinic_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	}
 	nic_dev->rxqs[queue_idx] = rxq;
 
-	/* alloc rx sq hw wqepage*/
+	/* alloc rx sq hw wqepage */
 	rc = hinic_create_rq(hwdev, queue_idx, rq_depth, socket_id);
 	if (rc) {
 		PMD_DRV_LOG(ERR, "Create rxq[%d] failed, dev_name: %s, rq_depth: %d",
@@ -2070,7 +2070,7 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev,
 			indirtbl[i] = reta_conf[idx].reta[shift];
 	}
 
-	for (i = 0 ; i < reta_size; i++) {
+	for (i = 0; i < reta_size; i++) {
 		if (indirtbl[i] >= nic_dev->num_rq) {
 			PMD_DRV_LOG(ERR, "Invalid reta entry, index: %d, num_rq: %d",
 				    i, nic_dev->num_rq);
@@ -2300,8 +2300,7 @@ static int hinic_dev_xstats_get_names(struct rte_eth_dev *dev,
 	for (i = 0; i < HINIC_VPORT_XSTATS_NUM; i++) {
 		snprintf(xstats_names[count].name,
 			 sizeof(xstats_names[count].name),
-			 "%s",
-			 hinic_vport_stats_strings[i].name);
+			 "%s", hinic_vport_stats_strings[i].name);
 		count++;
 	}
 
@@ -2312,13 +2311,13 @@ static int hinic_dev_xstats_get_names(struct rte_eth_dev *dev,
 	for (i = 0; i < HINIC_PHYPORT_XSTATS_NUM; i++) {
 		snprintf(xstats_names[count].name,
 			 sizeof(xstats_names[count].name),
-			 "%s",
-			 hinic_phyport_stats_strings[i].name);
+			 "%s", hinic_phyport_stats_strings[i].name);
 		count++;
 	}
 
 	return count;
 }
+
 /**
  *  DPDK callback to set mac address
  *
drivers/net/hinic/hinic_pmd_rx.c +2 -1
index 4ca74f0..a49769a 100644
@@ -413,7 +413,8 @@ void hinic_free_all_rx_resources(struct rte_eth_dev *eth_dev)
 				HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
 
 	for (q_id = 0; q_id < nic_dev->num_rq; q_id++) {
-		eth_dev->data->rx_queues[q_id] = NULL;
+		if (eth_dev->data->rx_queues != NULL)
+			eth_dev->data->rx_queues[q_id] = NULL;
 
 		if (nic_dev->rxqs[q_id] == NULL)
 			continue;
drivers/net/hinic/hinic_pmd_tx.c +4 -1
index 258f2c1..bd39f93 100644
@@ -313,6 +313,8 @@ static inline struct rte_mbuf *hinic_copy_tx_mbuf(struct hinic_nic_dev *nic_dev,
 		mbuf = mbuf->next;
 	}
 
+	dst_mbuf->pkt_len = dst_mbuf->data_len;
+
 	return dst_mbuf;
 }
 
@@ -1217,7 +1219,8 @@ void hinic_free_all_tx_resources(struct rte_eth_dev *eth_dev)
 				HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
 
 	for (q_id = 0; q_id < nic_dev->num_sq; q_id++) {
-		eth_dev->data->tx_queues[q_id] = NULL;
+		if (eth_dev->data->tx_queues != NULL)
+			eth_dev->data->tx_queues[q_id] = NULL;
 
 		if (nic_dev->txqs[q_id] == NULL)
 			continue;
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [dpdk-dev] [PATCH v5 1/4] net/hinic: increase Tx/Rx queues non-null judgment

Quoted 2 lines · Xiaoyun wang

Increase tx_queues and rx_queues non-null judgment before free tx or rx resources, and modify some formate for logs.

The fix is small, but it is lost in the format/syntax changes, can you please seperate the fix.

Btw, fix is adding null check for pointer, does it case any crash if not fixed, if so better to mention it in the commit log, to set the priority right, instead of saying increse judgment which looks like optional change.

Quoted 2 lines
Fixes 54faba2295bd ("net/hinic: adds Tx queue xstats members")

Can you please double check the fixed commit, this looks unrelated. Why do you think this is the commit that creates the code that has been fixed in this patch?

Quoted 3 lines

<...>

drivers/net/hinic/hinic_pmd_tx.c static inline struct rte_mbuf *hinic_copy_tx_mbuf(struct hinic_nic_dev *nic_dev, · line 317

Quoted 6 lines
drivers/net/hinic/hinic_pmd_tx.c +2 -0
@@ -313,6 +313,8 @@ static inline struct rte_mbuf *hinic_copy_tx_mbuf(struct hinic_nic_dev *nic_dev,
 		mbuf = mbuf->next;
 	}
 
+	dst_mbuf->pkt_len = dst_mbuf->data_len;
+

This change is unrelated and not mentioned in the commit logs, can you please separate it to its own patch, so it can get the description it deserves.

#3 lore raw

PATCH v5 2/4 net/hinic: add jumbo frame offload flag

In reply to Xiaoyun wang

The patch adds DEV_RX_OFFLOAD_JUMBO_FRAME flag for jumbo when set mtu.

---
 drivers/net/hinic/hinic_pmd_ethdev.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +11 -2
index 5fcff81..85e7c3c 100644
@@ -1529,8 +1529,9 @@ static void hinic_deinit_mac_addr(struct rte_eth_dev *eth_dev)
 
 static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 {
-	int ret = 0;
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+	uint32_t frame_size;
+	int ret = 0;
 
 	PMD_DRV_LOG(INFO, "Set port mtu, port_id: %d, mtu: %d, max_pkt_len: %d",
 			dev->data->port_id, mtu, HINIC_MTU_TO_PKTLEN(mtu));
@@ -1548,7 +1549,15 @@ static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	}
 
 	/* update max frame size */
-	dev->data->dev_conf.rxmode.max_rx_pkt_len = HINIC_MTU_TO_PKTLEN(mtu);
+	frame_size = HINIC_MTU_TO_PKTLEN(mtu);
+	if (frame_size > RTE_ETHER_MAX_LEN)
+		dev->data->dev_conf.rxmode.offloads |=
+			DEV_RX_OFFLOAD_JUMBO_FRAME;
+	else
+		dev->data->dev_conf.rxmode.offloads &=
+			~DEV_RX_OFFLOAD_JUMBO_FRAME;
+
+	dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
 	nic_dev->mtu_size = mtu;
 
 	return ret;
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH v5 3/4 net/hinic: increase judgment for support NIC or not

In reply to Xiaoyun wang

If hardware mode for this card does not support nic, the network features for this card will not be supported and driver will be initialized failed.

---
 drivers/net/hinic/base/hinic_pmd_cfg.c | 3 ++-
 drivers/net/hinic/hinic_pmd_ethdev.c   | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/hinic/base/hinic_pmd_cfg.c +2 -1
index aa883e0..2d25dc9 100644
@@ -129,7 +129,7 @@ static void hinic_parse_pub_res_cap(struct service_cap *cap,
 		cap->max_rqs = dev_cap->nic_max_rq;
 	}
 
-	cap->chip_svc_type = CFG_SVC_NIC_BIT0;
+	cap->chip_svc_type = dev_cap->svc_cap_en;
 	cap->host_total_function = dev_cap->host_total_func;
 	cap->host_oq_id_mask_val = dev_cap->host_oq_id_mask_val;
 
@@ -140,6 +140,7 @@ static void hinic_parse_pub_res_cap(struct service_cap *cap,
 	PMD_DRV_LOG(INFO, "host_total_function: 0x%x, host_oq_id_mask_val: 0x%x, max_vf: 0x%x",
 		    cap->host_total_function, cap->host_oq_id_mask_val,
 		    cap->max_vf);
+	PMD_DRV_LOG(INFO, "chip_svc_type: 0x%x", cap->chip_svc_type);
 	PMD_DRV_LOG(INFO, "pf_num: 0x%x, pf_id_start: 0x%x, vf_num: 0x%x, vf_id_start: 0x%x",
 		    cap->pf_num, cap->pf_id_start,
 		    cap->vf_num, cap->vf_id_start);
drivers/net/hinic/hinic_pmd_ethdev.c +5 -1
index 85e7c3c..cea026a 100644
@@ -2811,8 +2811,12 @@ static int hinic_nic_dev_create(struct rte_eth_dev *eth_dev)
 	}
 
 	/* get nic capability */
-	if (!hinic_support_nic(nic_dev->hwdev, &nic_dev->nic_cap))
+	if (!hinic_support_nic(nic_dev->hwdev, &nic_dev->nic_cap)) {
+		PMD_DRV_LOG(ERR, "Hw doesn't support nic, dev_name: %s",
+			    eth_dev->data->name);
+		rc = -EINVAL;
 		goto nic_check_fail;
+	}
 
 	/* init root cla and function table */
 	rc = hinic_init_nicio(nic_dev->hwdev);
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH v5 4/4 net/hinic/base: support ipv6 flow rules

In reply to Xiaoyun wang

The patch supports ipv6 flow rules for BGP or ICMP packets.

---
 drivers/net/hinic/hinic_pmd_ethdev.h |  57 +++++++++-
 drivers/net/hinic/hinic_pmd_flow.c   | 209 ++++++++++++++++++++++++++++++++---
 2 files changed, 249 insertions(+), 17 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.h +55 -2
index 3322fb9..1cb389d 100644
@@ -99,6 +99,7 @@ struct hinic_hw_fdir_mask {
 	uint16_t tunnel_flag;
 	uint16_t tunnel_inner_src_port_mask;
 	uint16_t tunnel_inner_dst_port_mask;
+	uint16_t dst_ipv6_mask;
 };
 
 /* Flow Director attribute */
@@ -111,6 +112,7 @@ struct hinic_atr_input {
 	uint16_t tunnel_flag;
 	uint16_t tunnel_inner_src_port;
 	uint16_t tunnel_inner_dst_port;
+	uint8_t  dst_ipv6[16];
 };
 
 enum hinic_fdir_mode {
@@ -191,9 +193,60 @@ struct tag_tcam_key_mem {
 #endif
 };
 
+struct tag_tcam_key_ipv6_mem {
+#if (RTE_BYTE_ORDER == RTE_BIG_ENDIAN)
+		u32 rsvd0:16;
+		u32 ipv6_flag:1;
+		u32 protocol:7;
+		u32 function_id:8;
+
+		u32 dst_port:16;
+		u32 ipv6_key0:16;
+
+		u32 ipv6_key1:16;
+		u32 ipv6_key2:16;
+
+		u32 ipv6_key3:16;
+		u32 ipv6_key4:16;
+
+		u32 ipv6_key5:16;
+		u32 ipv6_key6:16;
+
+		u32 ipv6_key7:16;
+		u32 rsvd2:16;
+#else
+		u32 function_id:8;
+		u32 protocol:7;
+		u32 ipv6_flag:1;
+		u32 rsvd0:16;
+
+		u32 ipv6_key0:16;
+		u32 dst_port:16;
+
+		u32 ipv6_key2:16;
+		u32 ipv6_key1:16;
+
+		u32 ipv6_key4:16;
+		u32 ipv6_key3:16;
+
+		u32 ipv6_key6:16;
+		u32 ipv6_key5:16;
+
+		u32 rsvd2:16;
+		u32 ipv6_key7:16;
+#endif
+};
+
 struct tag_tcam_key {
-	struct tag_tcam_key_mem key_info;
-	struct tag_tcam_key_mem key_mask;
+	union {
+		struct tag_tcam_key_mem key_info;
+		struct tag_tcam_key_ipv6_mem key_info_ipv6;
+	};
+
+	union {
+		struct tag_tcam_key_mem key_mask;
+		struct tag_tcam_key_ipv6_mem key_mask_ipv6;
+	};
 };
 
 struct hinic_fdir_rule {
drivers/net/hinic/hinic_pmd_flow.c +194 -15

301 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#6 lore raw

Re: [dpdk-dev] [PATCH v5 4/4] net/hinic/base: support ipv6 flow rules

Quoted 8 lines · Xiaoyun wang

The patch supports ipv6 flow rules for BGP or ICMP packets.

---
 drivers/net/hinic/hinic_pmd_ethdev.h |  57 +++++++++-
 drivers/net/hinic/hinic_pmd_flow.c   | 209 ++++++++++++++++++++++++++++++++---
 2 files changed, 249 insertions(+), 17 deletions(-)

This patchset is not changing any 'base' file, will update the patch title as 'net/hinic: ..." while merging.

#7 lore raw
In reply to Xiaoyun wang
Quoted 31 lines · Xiaoyun wang

This patch adds jumbo frame offload flag, increases judgment whether Tx/Rx queues is non-null when free resources, and if card mode does not support nic, driver will be initialized failed, supports ipv6 flow director for BGP or ICMP packets.

--
v4->v5:
- increase Tx/Rx queues non-null judgment
- add jumbo frame offload flag
- increase judgment for support NIC or not
- support ipv6 flow rules

v3->v4:
- fix PF firmware hotactive problem
- optimize log style
- adds txq xstats members

v2->v3:
- fix FW hotactive problem
- optimize log style

v1->v2:
- Fix LRO problems
- Fix hotupdate firmware problem
- Optimize doorbell area initialization
- Remove 40GE Mezz card id
- Add Fdir filter type
- Optimize log files
- Support pause flow control

Quoted 9 lines

v1:
- Allocate IO memory with socketid

Xiaoyun wang (4):
net/hinic: increase Tx/Rx queues non-null judgment net/hinic: add jumbo frame offload flag net/hinic: increase judgment for support NIC or not net/hinic/base: support ipv6 flow rules

Hi Xiaoyun,

Some of above are separate patchsets, and previous ones already merged. I guess there is a confusion about versioning (vN) in patchsets.

The versioning is a new version of patchset if a new version required/requested. It is not incremental changes to a driver (or a component)

The previous patchset has been applied in v4, for this new patchset it should start from v1 again.

(Also previous v2 and v3 were different patchsets, and should reset the versioning ... )

#8 lore raw
Quoted 47 lines · Ferruh Yigit
Quoted 31 lines · Xiaoyun wang

This patch adds jumbo frame offload flag, increases judgment whether Tx/Rx queues is non-null when free resources, and if card mode does not support nic, driver will be initialized failed, supports ipv6 flow director for BGP or ICMP packets.

--
v4->v5:
- increase Tx/Rx queues non-null judgment
- add jumbo frame offload flag
- increase judgment for support NIC or not
- support ipv6 flow rules

v3->v4:
- fix PF firmware hotactive problem
- optimize log style
- adds txq xstats members

v2->v3:
- fix FW hotactive problem
- optimize log style

v1->v2:
- Fix LRO problems
- Fix hotupdate firmware problem
- Optimize doorbell area initialization
- Remove 40GE Mezz card id
- Add Fdir filter type
- Optimize log files
- Support pause flow control

Quoted 9 lines

v1:
- Allocate IO memory with socketid

Xiaoyun wang (4):
net/hinic: increase Tx/Rx queues non-null judgment net/hinic: add jumbo frame offload flag net/hinic: increase judgment for support NIC or not net/hinic/base: support ipv6 flow rules

Hi Xiaoyun,

Some of above are separate patchsets, and previous ones already merged. I guess there is a confusion about versioning (vN) in patchsets.

Quoted 9 lines

The versioning is a new version of patchset if a new version required/requested. It is not incremental changes to a driver (or a component)

The previous patchset has been applied in v4, for this new patchset it should start from v1 again.

(Also previous v2 and v3 were different patchsets, and should reset the versioning ... )

Hi Xiaoyun,

It looks patches in the set don't depend on each other, so I will get the set partially, except patch 1/4, to be able to include them into the -rc2 release. (Otherwise it may not be possible to merge flow API patch in -rc3 or later.)

Please send the patch 1/4 separately.

Except 1/4,
Series applied to dpdk-next-net/master, thanks.