From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D544BA0487 for ; Thu, 4 Jul 2019 03:45:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DA704235; Thu, 4 Jul 2019 03:45:31 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 00359235; Thu, 4 Jul 2019 03:45:29 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2019 18:45:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,449,1557212400"; d="scan'208";a="362814304" Received: from dipei-st-npg.sh.intel.com ([10.67.110.220]) by fmsmga005.fm.intel.com with ESMTP; 03 Jul 2019 18:45:21 -0700 From: Andy Pei 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 Date: Thu, 4 Jul 2019 09:38:39 +0800 Message-Id: <1562204319-15833-1-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1561108988-217617-1-git-send-email-andy.pei@intel.com> References: <1561108988-217617-1-git-send-email-andy.pei@intel.com> Subject: [dpdk-dev] [PATCH v4] net/i40e: fix core dumped when setting txq or rxq to 0 in VF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Testpmd would stuck and result in core dump when user specifies an invalid VF queue number, for example when setting txq or rxq to 0. When txq or rxq is set to 0, pointer of pointer rxq or txq in function i40evf_configure_vsi_queues is NULL. The usage of txq[i] or rxq[0] is valid. 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 --- v4: * use "txq ? txq[i] : txq" to avoid some duplicate. * a more specific description of the issue in the commit message. v3: * no need to use a new line for each parameter when call envoke a function. A new line comes when the current line is more than 80 characters. v2: * modify commit meaasage so one line contains not more than 72 characters. * delete unnecessary parentheses around 'queue_id < nb_txq' * delete unnecessary parentheses around 'queue_id < nb_rxq' 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index d922a84..5be32b0 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 = @@ -623,10 +623,11 @@ struct rte_i40evf_xstats_name_off { 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]); + vc_vqci->vsi_id, i, dev->data->nb_tx_queues, + txq ? txq[i] : NULL); 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]); + vf->max_pkt_len, rxq ? rxq[i] : NULL); } memset(&args, 0, sizeof(args)); args.ops = VIRTCHNL_OP_CONFIG_VSI_QUEUES; -- 1.8.3.1