DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style
@ 2020-05-14  9:29 Xiaoyun wang
  2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 1/4] net/hinic: the queues resource free problem fixes Xiaoyun wang
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Xiaoyun wang @ 2020-05-14  9:29 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	shahar.belkar, yin.yinshi, david.yangxiaoliang, zhaohui8,
	zhengjingzhou, Xiaoyun wang

This patch adds tx_queues and rx_queues non-null judgment before 
free tx or rx resources, because some app may set tx_queues or 
rx_queues to be null before call free resource interfaces, which 
may cause a segfault, adds pkt_len member update for dst_mbuf
when copy a mbuf to a new dst_mbuf, code style format rectification,
and adjusts the legality judgment order of RSS RETA table.

--
v1:
  - the queues resource free problem fixes
  - the pkt len updates of mbuf fixes
  - code style modification
  - optimize RSS RETA table updates

Xiaoyun wang (4):
  net/hinic: the queues resource free problem fixes
  net/hinic: the pkt len updates of mbuf fixes
  net/hinic: code style modification
  net/hinic: optimize RSS RETA table updates

 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     | 44 +++++++++++++++-----------------
 drivers/net/hinic/hinic_pmd_ethdev.h     | 12 +++++----
 drivers/net/hinic/hinic_pmd_rx.c         |  3 ++-
 drivers/net/hinic/hinic_pmd_tx.c         |  5 +++-
 7 files changed, 36 insertions(+), 33 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v1 1/4] net/hinic: the queues resource free problem fixes
  2020-05-14  9:29 [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Xiaoyun wang
@ 2020-05-14  9:29 ` Xiaoyun wang
  2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 2/4] net/hinic: the pkt len updates of mbuf fixes Xiaoyun wang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Xiaoyun wang @ 2020-05-14  9:29 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	shahar.belkar, yin.yinshi, david.yangxiaoliang, zhaohui8,
	zhengjingzhou, Xiaoyun wang, stable

Adds tx_queues and rx_queues non-null judgment before free tx or
rx resources, because some app may set tx_queues or rx_queues to
be null before call free resource interfaces, which may cause
a segfault.

Fixes: 64727024d2fd ("net/hinic: add device initialization")

Cc: stable@dpdk.org
Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/hinic_pmd_rx.c | 3 ++-
 drivers/net/hinic/hinic_pmd_tx.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hinic/hinic_pmd_rx.c b/drivers/net/hinic/hinic_pmd_rx.c
index 4ca74f0..a49769a 100644
--- a/drivers/net/hinic/hinic_pmd_rx.c
+++ b/drivers/net/hinic/hinic_pmd_rx.c
@@ -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;
diff --git a/drivers/net/hinic/hinic_pmd_tx.c b/drivers/net/hinic/hinic_pmd_tx.c
index 258f2c1..996e0b2 100644
--- a/drivers/net/hinic/hinic_pmd_tx.c
+++ b/drivers/net/hinic/hinic_pmd_tx.c
@@ -1217,7 +1217,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;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v1 2/4] net/hinic: the pkt len updates of mbuf fixes
  2020-05-14  9:29 [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Xiaoyun wang
  2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 1/4] net/hinic: the queues resource free problem fixes Xiaoyun wang
@ 2020-05-14  9:29 ` Xiaoyun wang
  2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 3/4] net/hinic: code style modification Xiaoyun wang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Xiaoyun wang @ 2020-05-14  9:29 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	shahar.belkar, yin.yinshi, david.yangxiaoliang, zhaohui8,
	zhengjingzhou, Xiaoyun wang, stable

When copy a mbuf to a new dst_mbuf, the pkt_len member of
dst_mbuf needs to be updated.

Fixes: 076221c8fe1d ("net/hinic: add Rx/Tx")

Cc: stable@dpdk.org
Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/hinic_pmd_tx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/hinic/hinic_pmd_tx.c b/drivers/net/hinic/hinic_pmd_tx.c
index 996e0b2..bd39f93 100644
--- a/drivers/net/hinic/hinic_pmd_tx.c
+++ b/drivers/net/hinic/hinic_pmd_tx.c
@@ -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;
 }
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v1 3/4] net/hinic: code style modification
  2020-05-14  9:29 [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Xiaoyun wang
  2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 1/4] net/hinic: the queues resource free problem fixes Xiaoyun wang
  2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 2/4] net/hinic: the pkt len updates of mbuf fixes Xiaoyun wang
@ 2020-05-14  9:29 ` Xiaoyun wang
  2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 4/4] net/hinic: optimize RSS RETA table updates Xiaoyun wang
  2020-05-14 16:44 ` [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Xiaoyun wang @ 2020-05-14  9:29 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	shahar.belkar, yin.yinshi, david.yangxiaoliang, zhaohui8,
	zhengjingzhou, Xiaoyun wang

The patch modifies the comments of structures or functions, and adds
space for comments, removes extra empty lines and adjusts the
print level for VF branches in one sdk interface.

Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 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     | 28 +++++++++++++---------------
 drivers/net/hinic/hinic_pmd_ethdev.h     | 12 +++++++-----
 5 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/net/hinic/base/hinic_pmd_cmdq.h b/drivers/net/hinic/base/hinic_pmd_cmdq.h
index 4ce0a4c..0d5e380 100644
--- a/drivers/net/hinic/base/hinic_pmd_cmdq.h
+++ b/drivers/net/hinic/base/hinic_pmd_cmdq.h
@@ -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
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index 63fba0d..4578b68 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -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 to set attr5");
 		return;
 	}
 
diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c
index 60c4e14..7f7e11d 100644
--- a/drivers/net/hinic/base/hinic_pmd_nicio.c
+++ b/drivers/net/hinic/base/hinic_pmd_nicio.c
@@ -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;
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 073afa4..8634fe8 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -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 wqe page */
 	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",
@@ -2035,12 +2035,12 @@ static int hinic_rss_conf_get(struct rte_eth_dev *dev,
 }
 
 /**
- * DPDK callback to update the RETA indirection table.
+ * DPDK callback to update the RSS redirection table.
  *
  * @param dev
  *   Pointer to Ethernet device structure.
  * @param reta_conf
- *   Pointer to RETA configuration structure array.
+ *   Pointer to RSS reta configuration data.
  * @param reta_size
  *   Size of the RETA table.
  *
@@ -2102,14 +2102,13 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev,
 	return HINIC_ERROR;
 }
 
-
 /**
- * DPDK callback to get the RETA indirection table.
+ * DPDK callback to get the RSS indirection table.
  *
  * @param dev
  *   Pointer to Ethernet device structure.
  * @param reta_conf
- *   Pointer to RETA configuration structure array.
+ *   Pointer to RSS reta configuration data.
  * @param reta_size
  *   Size of the RETA table.
  *
@@ -2309,8 +2308,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++;
 	}
 
@@ -2321,13 +2319,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
  *
@@ -2492,19 +2490,19 @@ static int hinic_set_mc_addr_list(struct rte_eth_dev *dev,
 }
 
 /**
- * DPDK callback to manage filter operations
+ * DPDK callback to manage filter control operations
  *
  * @param dev
  *   Pointer to Ethernet device structure.
  * @param filter_type
- *   Filter type.
+ *   Filter type, which just supports generic type.
  * @param filter_op
- *   Operation to perform.
+ *   Filter operation to perform.
  * @param arg
  *   Pointer to operation-specific structure.
  *
  * @return
- *   0 on success, negative errno value on failure.
+ *   0 on success, negative error value otherwise.
  */
 static int hinic_dev_filter_ctrl(struct rte_eth_dev *dev,
 		     enum rte_filter_type filter_type,
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h
index 1cb389d..64b2c81 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.h
+++ b/drivers/net/hinic/hinic_pmd_ethdev.h
@@ -53,11 +53,13 @@ struct hinic_5tuple_filter_info {
 	 * used when more than one filter matches.
 	 */
 	uint8_t priority;
-	uint8_t dst_ip_mask:1, /* if mask is 1b, do not compare dst ip. */
-		src_ip_mask:1, /* if mask is 1b, do not compare src ip. */
-		dst_port_mask:1, /* if mask is 1b, do not compare dst port. */
-		src_port_mask:1, /* if mask is 1b, do not compare src port. */
-		proto_mask:1; /* if mask is 1b, do not compare protocol. */
+
+	/* if mask is 1b, do not compare the response bit domain */
+	uint8_t dst_ip_mask:1,
+		src_ip_mask:1,
+		dst_port_mask:1,
+		src_port_mask:1,
+		proto_mask:1;
 };
 
 /* 5tuple filter structure */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v1 4/4] net/hinic: optimize RSS RETA table updates
  2020-05-14  9:29 [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Xiaoyun wang
                   ` (2 preceding siblings ...)
  2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 3/4] net/hinic: code style modification Xiaoyun wang
@ 2020-05-14  9:29 ` Xiaoyun wang
  2020-05-14 16:44 ` [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Xiaoyun wang @ 2020-05-14  9:29 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	shahar.belkar, yin.yinshi, david.yangxiaoliang, zhaohui8,
	zhengjingzhou, Xiaoyun wang

Before updating RSS indirection table, firstly determine whether
rq num in RETA table is legal, if it is invalid(such as exceeding
the maximum rxq num), driver will not update hw indirection
table and return fail.

Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/hinic_pmd_ethdev.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 8634fe8..2f0f33a 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -2075,16 +2075,16 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev,
 	for (i = 0; i < reta_size; i++) {
 		idx = i / RTE_RETA_GROUP_SIZE;
 		shift = i % RTE_RETA_GROUP_SIZE;
-		if (reta_conf[idx].mask & (1ULL << shift))
-			indirtbl[i] = reta_conf[idx].reta[shift];
-	}
 
-	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);
-			goto disable_rss;
+		if (reta_conf[idx].reta[shift] >= nic_dev->num_rq) {
+			PMD_DRV_LOG(ERR, "Invalid reta entry, indirtbl[%d]: %d "
+				"exceeds the maximum rxq num: %d", i,
+				reta_conf[idx].reta[shift], nic_dev->num_rq);
+			return -EINVAL;
 		}
+
+		if (reta_conf[idx].mask & (1ULL << shift))
+			indirtbl[i] = reta_conf[idx].reta[shift];
 	}
 
 	err = hinic_rss_set_indir_tbl(nic_dev->hwdev, tmpl_idx, indirtbl);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style
  2020-05-14  9:29 [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Xiaoyun wang
                   ` (3 preceding siblings ...)
  2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 4/4] net/hinic: optimize RSS RETA table updates Xiaoyun wang
@ 2020-05-14 16:44 ` Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2020-05-14 16:44 UTC (permalink / raw)
  To: Xiaoyun wang, dev
  Cc: bluca, luoxianjun, luoxingyu, zhouguoyang, shahar.belkar,
	yin.yinshi, david.yangxiaoliang, zhaohui8, zhengjingzhou

On 5/14/2020 10:29 AM, Xiaoyun wang wrote:
> This patch adds tx_queues and rx_queues non-null judgment before 
> free tx or rx resources, because some app may set tx_queues or 
> rx_queues to be null before call free resource interfaces, which 
> may cause a segfault, adds pkt_len member update for dst_mbuf
> when copy a mbuf to a new dst_mbuf, code style format rectification,
> and adjusts the legality judgment order of RSS RETA table.
> 
> --
> v1:
>   - the queues resource free problem fixes
>   - the pkt len updates of mbuf fixes
>   - code style modification
>   - optimize RSS RETA table updates
> 
> Xiaoyun wang (4):
>   net/hinic: the queues resource free problem fixes
>   net/hinic: the pkt len updates of mbuf fixes
>   net/hinic: code style modification
>   net/hinic: optimize RSS RETA table updates

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-14 16:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14  9:29 [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Xiaoyun wang
2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 1/4] net/hinic: the queues resource free problem fixes Xiaoyun wang
2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 2/4] net/hinic: the pkt len updates of mbuf fixes Xiaoyun wang
2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 3/4] net/hinic: code style modification Xiaoyun wang
2020-05-14  9:29 ` [dpdk-dev] [PATCH v1 4/4] net/hinic: optimize RSS RETA table updates Xiaoyun wang
2020-05-14 16:44 ` [dpdk-dev] [PATCH v1 0/4] fixes for queue resource free and code style Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).