DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andy Pei <andy.pei@intel.com>
To: dev@dpdk.org
Cc: andy.pei@intel.com, helin.zhang@intel.com, stable@dpdk.org,
	roy.fan.zhang@intel.com, qi.z.zhang@intel.com,
	jingjing.wu@intel.com, beilei.xing@intel.com,
	ferruh.yigit@intel.com, rosen.xu@intel.com,
	xiaolong.ye@intel.com
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix core dumped when setting txq or rxq to 0 in VF
Date: Fri, 21 Jun 2019 16:26:25 +0800	[thread overview]
Message-ID: <1561105585-216465-1-git-send-email-andy.pei@intel.com> (raw)
In-Reply-To: <1561091696-213124-1-git-send-email-andy.pei@intel.com>

Testpmd would stuck and result in core dump when user specifies an
invalid VF queue number. This patch fixes this issue.

Fixes: d6b19729093e ("i40evf: support configurable crc stripping")
Cc: helin.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
Cc: roy.fan.zhang@intel.com
Cc: qi.z.zhang@intel.com
Cc: jingjing.wu@intel.com
Cc: beilei.xing@intel.com
Cc: ferruh.yigit@intel.com
Cc: rosen.xu@intel.com
Cc: xiaolong.ye@intel.com

 drivers/net/i40e/i40e_ethdev_vf.c | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 63dbe14..35df59e 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -573,7 +573,7 @@ struct rte_i40evf_xstats_name_off {
 {
 	txq_info->vsi_id = vsi_id;
 	txq_info->queue_id = queue_id;
-	if (queue_id < nb_txq) {
+	if (queue_id < nb_txq && txq) {
 		txq_info->ring_len = txq->nb_tx_desc;
 		txq_info->dma_ring_addr = txq->tx_ring_phys_addr;
 	}
@@ -590,7 +590,7 @@ struct rte_i40evf_xstats_name_off {
 	rxq_info->vsi_id = vsi_id;
 	rxq_info->queue_id = queue_id;
 	rxq_info->max_pkt_size = max_pkt_size;
-	if (queue_id < nb_rxq) {
+	if (queue_id < nb_rxq && rxq) {
 		rxq_info->ring_len = rxq->nb_rx_desc;
 		rxq_info->dma_ring_addr = rxq->rx_ring_phys_addr;
 		rxq_info->databuffer_size =
@@ -622,11 +622,32 @@ struct rte_i40evf_xstats_name_off {
 	vc_vqci->num_queue_pairs = nb_qp;
 
 	for (i = 0, vc_qpi = vc_vqci->qpair; i < nb_qp; i++, vc_qpi++) {
-		i40evf_fill_virtchnl_vsi_txq_info(&vc_qpi->txq,
-			vc_vqci->vsi_id, i, dev->data->nb_tx_queues, txq[i]);
-		i40evf_fill_virtchnl_vsi_rxq_info(&vc_qpi->rxq,
-			vc_vqci->vsi_id, i, dev->data->nb_rx_queues,
-					vf->max_pkt_len, rxq[i]);
+		if (!txq)
+			i40evf_fill_virtchnl_vsi_txq_info(&vc_qpi->txq,
+							vc_vqci->vsi_id,
+							i,
+							dev->data->nb_tx_queues,
+							NULL);
+		else
+			i40evf_fill_virtchnl_vsi_txq_info(&vc_qpi->txq,
+							vc_vqci->vsi_id,
+							i,
+							dev->data->nb_tx_queues,
+							txq[i]);
+		if (!rxq)
+			i40evf_fill_virtchnl_vsi_rxq_info(&vc_qpi->rxq,
+							vc_vqci->vsi_id,
+							i,
+							dev->data->nb_rx_queues,
+							vf->max_pkt_len,
+							NULL);
+		else
+			i40evf_fill_virtchnl_vsi_rxq_info(&vc_qpi->rxq,
+							vc_vqci->vsi_id,
+							i,
+							dev->data->nb_rx_queues,
+							vf->max_pkt_len,
+							rxq[i]);
 	}
 	memset(&args, 0, sizeof(args));
 	args.ops = VIRTCHNL_OP_CONFIG_VSI_QUEUES;
-- 
1.8.3.1


  reply	other threads:[~2019-06-21  8:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21  4:34 [dpdk-dev] [PATCH] " Andy Pei
2019-06-21  8:26 ` Andy Pei [this message]
2019-06-21  9:23   ` [dpdk-dev] [PATCH v3] " Andy Pei
2019-06-30  0:04     ` Zhang, Qi Z
2019-07-04  1:38     ` [dpdk-dev] [PATCH v4] " Andy Pei
2019-07-04  6:17       ` Zhang, Qi Z
2019-07-04  6:20         ` Pei, Andy
2019-06-21 11:42 ` [dpdk-dev] [PATCH] " Ye Xiaolong
2019-06-21  8:17   ` Pei, Andy
2019-06-21  9:02   ` Pei, Andy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1561105585-216465-1-git-send-email-andy.pei@intel.com \
    --to=andy.pei@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=helin.zhang@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=rosen.xu@intel.com \
    --cc=roy.fan.zhang@intel.com \
    --cc=stable@dpdk.org \
    --cc=xiaolong.ye@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).