From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Iremonger, Bernard" <bernard.iremonger@intel.com>,
"Qiu, Michael" <michael.qiu@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] librte_ether: fix crashes in rte_ethdev functions.
Date: Mon, 21 Dec 2015 12:01:46 +0000 [thread overview]
Message-ID: <2601191342CEEE43887BDE71AB97725836AD7438@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <8CEF83825BEC744B83065625E567D7C219F9120C@IRSMSX108.ger.corp.intel.com>
> -----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 functions.
>
> Hi Michael,
>
> > -----Original Message-----
> > From: Qiu, Michael
> > Sent: Monday, December 21, 2015 9:03 AM
> > To: Iremonger, Bernard <bernard.iremonger@intel.com>; 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 is
> > > 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 stats
> > > in xstats")
> > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > > ---
> > > 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
>
> <snip>
>
> 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 void.
> 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.
>
> Regards,
>
> Bernard.
next prev parent reply other threads:[~2015-12-21 12:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-17 17:23 Bernard Iremonger
2015-12-21 9:03 ` Qiu, Michael
2015-12-21 11:40 ` Iremonger, Bernard
2015-12-21 12:01 ` Ananyev, Konstantin [this message]
2015-12-21 15:01 ` Iremonger, Bernard
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=2601191342CEEE43887BDE71AB97725836AD7438@irsmsx105.ger.corp.intel.com \
--to=konstantin.ananyev@intel.com \
--cc=bernard.iremonger@intel.com \
--cc=dev@dpdk.org \
--cc=michael.qiu@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).