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 E47C5A0487 for ; Sun, 30 Jun 2019 02:04:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 49E5B4C6C; Sun, 30 Jun 2019 02:04:38 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id D4CA637AF; Sun, 30 Jun 2019 02:04:35 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jun 2019 17:04:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,433,1557212400"; d="scan'208";a="314492078" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga004.jf.intel.com with ESMTP; 29 Jun 2019 17:04:33 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 29 Jun 2019 17:04:33 -0700 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.232]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.60]) with mapi id 14.03.0439.000; Sun, 30 Jun 2019 08:04:31 +0800 From: "Zhang, Qi Z" To: "Pei, Andy" , "dev@dpdk.org" CC: "Zhang, Helin" , "stable@dpdk.org" , "Zhang, Roy Fan" , "Wu, Jingjing" , "Xing, Beilei" , "Yigit, Ferruh" , "Xu, Rosen" , "Ye, Xiaolong" Thread-Topic: [PATCH v3] net/i40e: fix core dumped when setting txq or rxq to 0 in VF Thread-Index: AQHVKBPb+gQTNPLneEqI+b6YPJaJeKazXKKQ Date: Sun, 30 Jun 2019 00:04:31 +0000 Message-ID: <039ED4275CED7440929022BC67E7061153D5C65B@SHSMSX105.ccr.corp.intel.com> References: <1561105585-216465-1-git-send-email-andy.pei@intel.com> <1561108988-217617-1-git-send-email-andy.pei@intel.com> In-Reply-To: <1561108988-217617-1-git-send-email-andy.pei@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDE4YTIyNjktMzczYi00MDE1LWFhYTYtOTkxM2QzOWYwMDBiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiR2w0ZHdXQTlwVUx1YncrZTk3VCszd25rVWxoTlJ4am1QTU84WWlcL0FKS25oc09DWGYydmJKcXBwTlpnekZcL0xjIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3] 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" Hi Andy: > -----Original Message----- > From: Pei, Andy > Sent: Friday, June 21, 2019 5:23 PM > To: dev@dpdk.org > Cc: Pei, Andy ; Zhang, Helin ; > stable@dpdk.org; Zhang, Roy Fan ; Zhang, Qi Z > ; Wu, Jingjing ; Xing, Beile= i > ; Yigit, Ferruh ; Xu, Rose= n > ; Ye, Xiaolong > Subject: [PATCH v3] net/i40e: fix core dumped when setting txq or rxq to = 0 in > VF >=20 > Testpmd would stuck and result in core dump when user specifies an invali= d > VF queue number. This patch fixes this issue. Is that the case, dev_start will core dump due to violate memory access if = rxq or txq number is 0? It's better to have a more specific description of the issue.. >=20 > Fixes: d6b19729093e ("i40evf: support configurable crc stripping") > Cc: helin.zhang@intel.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Andy Pei > --- > 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. >=20 > 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' >=20 > 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 >=20 > drivers/net/i40e/i40e_ethdev_vf.c | 25 ++++++++++++++++++------- > 1 file changed, 18 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c > b/drivers/net/i40e/i40e_ethdev_vf.c > index 63dbe14..41097fd 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 =3D vsi_id; > txq_info->queue_id =3D queue_id; > - if (queue_id < nb_txq) { > + if (queue_id < nb_txq && txq) { > txq_info->ring_len =3D txq->nb_tx_desc; > txq_info->dma_ring_addr =3D txq->tx_ring_phys_addr; > } > @@ -590,7 +590,7 @@ struct rte_i40evf_xstats_name_off { > rxq_info->vsi_id =3D vsi_id; > rxq_info->queue_id =3D queue_id; > rxq_info->max_pkt_size =3D max_pkt_size; > - if (queue_id < nb_rxq) { > + if (queue_id < nb_rxq && rxq) { > rxq_info->ring_len =3D rxq->nb_rx_desc; > rxq_info->dma_ring_addr =3D rxq->rx_ring_phys_addr; > rxq_info->databuffer_size =3D > @@ -622,11 +622,22 @@ struct rte_i40evf_xstats_name_off { > vc_vqci->num_queue_pairs =3D nb_qp; >=20 > for (i =3D 0, vc_qpi =3D 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]); Seems, we can simply to !txq?txq:txq[i] to avoid some duplicate, right? > + 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 =3D VIRTCHNL_OP_CONFIG_VSI_QUEUES; > -- > 1.8.3.1