From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id B3615E72 for ; Mon, 21 Dec 2015 13:02:06 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 21 Dec 2015 04:01:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,459,1444719600"; d="scan'208";a="875919196" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga002.jf.intel.com with ESMTP; 21 Dec 2015 04:01:48 -0800 Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by IRSMSX103.ger.corp.intel.com (163.33.3.157) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 21 Dec 2015 12:01:46 +0000 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.203]) by irsmsx155.ger.corp.intel.com ([169.254.14.190]) with mapi id 14.03.0248.002; Mon, 21 Dec 2015 12:01:46 +0000 From: "Ananyev, Konstantin" To: "Iremonger, Bernard" , "Qiu, Michael" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] librte_ether: fix crashes in rte_ethdev functions. Thread-Index: AQHRO86Ax5XSTuaEhEWlzKc5lJd9UZ7VUSAAgAAFwhA= Date: Mon, 21 Dec 2015 12:01:46 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836AD7438@irsmsx105.ger.corp.intel.com> References: <1450373016-16356-1-git-send-email-bernard.iremonger@intel.com> <533710CFB86FA344BFBF2D6802E6028622EFB065@SHSMSX101.ccr.corp.intel.com> <8CEF83825BEC744B83065625E567D7C219F9120C@IRSMSX108.ger.corp.intel.com> In-Reply-To: <8CEF83825BEC744B83065625E567D7C219F9120C@IRSMSX108.ger.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] librte_ether: fix crashes in rte_ethdev functions. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2015 12:02:07 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger, Bernard > Sent: Monday, December 21, 2015 11:40 AM > To: Qiu, Michael; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_ether: fix crashes in rte_ethdev f= unctions. >=20 > Hi Michael, >=20 > > -----Original Message----- > > From: Qiu, Michael > > Sent: Monday, December 21, 2015 9:03 AM > > To: Iremonger, Bernard ; dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] librte_ether: fix crashes in rte_ethdev > > functions. > > > > On 2015/12/18 1:24, Bernard Iremonger wrote: > > > The nb_rx_queues and nb_tx_queues are initialised before the tx_queue > > > and rx_queue arrays are allocated. The arrays are allocated when the > > > ethdev port is started. > > > > > > If any of the following functions are called before the ethdev port i= s > > > started there is a segmentation fault: > > > > > > rte_eth_stats_get > > > rte_eth_stats_reset > > > rte_eth_xstats_get > > > rte_eth_xstats_reset > > > > > > Fixes: af75078fece3 ("first public release") > > > Fixes: ce757f5c9a4d ("ethdev: new method to retrieve extended > > > statistics") > > > Fixes: d4fef8b0d5e5 ("ethdev: expose generic and driver specific stat= s > > > in xstats") > > > Signed-off-by: Bernard Iremonger > > > --- > > > lib/librte_ether/rte_ethdev.c | 16 ++++++++++++---- > > > 1 file changed, 12 insertions(+), 4 deletions(-) > > > > > > diff --git a/lib/librte_ether/rte_ethdev.c > > > b/lib/librte_ether/rte_ethdev.c index ed971b4..a0ee84d 100644 > > > --- a/lib/librte_ether/rte_ethdev.c > > > +++ b/lib/librte_ether/rte_ethdev.c > > > @@ -1441,7 +1441,10 @@ rte_eth_stats_get(uint8_t port_id, struct > > rte_eth_stats *stats) > > > memset(stats, 0, sizeof(*stats)); > > > > > > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, - > > ENOTSUP); > > > - (*dev->dev_ops->stats_get)(dev, stats); > > > + > > > + if (dev->data->dev_started) > > > + (*dev->dev_ops->stats_get)(dev, stats); > > > + So why it would be no possible now to get statistics on the stopped device? Konstantin > > > > My question is should we mark an error or a warning here and return an > > error so that the caller knows what happens? > > > > Thanks, > > Michael >=20 > >=20 > In other cases in rte_ethdev.c where there is a check on "dev->data->dev_= started" there is a RTE_PMD_DEBUG_TRACE() line. I will > add a RTE_PMD_DEBUG_TRACE() line. > The rte_eth_stats_reset() and rte_eth_xstats_reset() functions return voi= d. > Not sure if an error is required for the rte_eth_stats_get() and rte_eth_= xstats_get() functions as the stats information returned is all > zero's at present. >=20 > Regards, >=20 > Bernard.