DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>,
	 "andrew.rybchenko@oktetlabs.ru" <andrew.rybchenko@oktetlabs.ru>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	 "bingz@nvidia.com" <bingz@nvidia.com>,
	"Li, Xiaoyun" <xiaoyun.li@intel.com>
Subject: Re: [dpdk-dev] [PATCH] ethdev: warn only once for badly behaving applications
Date: Wed, 27 Oct 2021 09:23:29 +0200	[thread overview]
Message-ID: <CAJFAV8ye0WOktKQPg+4kYVkGspYo8X4792vGYr089rjm2L-a6A@mail.gmail.com> (raw)
In-Reply-To: <DM6PR11MB4491000951811C7416D95D389A849@DM6PR11MB4491.namprd11.prod.outlook.com>

On Tue, Oct 26, 2021 at 7:10 PM Ananyev, Konstantin
<konstantin.ananyev@intel.com> wrote:
> >  static uint16_t
> > -dummy_eth_rx_burst(__rte_unused void *rxq,
> > +dummy_eth_rx_burst(void *rxq,
> >               __rte_unused struct rte_mbuf **rx_pkts,
> >               __rte_unused uint16_t nb_pkts)
> >  {
> > -     RTE_ETHDEV_LOG(ERR, "rx_pkt_burst for not ready port\n");
> > +     struct dummy_queue *q = rxq;
> > +
>
> LGTM in general, just one thing:
> I think we'd better add extra check that rxq really points to dummy queues
> before de-referencing it.
> Something like:
>
> uintptr_t port_id;
> ....
> port_id =  q - dummy_queues;
> if (port_id < RTE_DIM(dummy_queues) && !q->rx_warn_once) {
>    ....
> }
>
> Same for tx.

Yep, will add.


>
> > +     if (!q->rx_warn_once) {
> > +             uint16_t port_id = q - dummy_queues;
> > +
> > +             RTE_ETHDEV_LOG(ERR, "lcore %u called rx_pkt_burst for not ready port %"PRIu16"\n",
> > +                     rte_lcore_id(), port_id);
> > +             rte_dump_stack();
> > +             q->rx_warn_once = true;
> > +     }
> >       rte_errno = ENOTSUP;
> >       return 0;
> >  }
> >
> >  static uint16_t
> > -dummy_eth_tx_burst(__rte_unused void *txq,
> > +dummy_eth_tx_burst(void *txq,
> >               __rte_unused struct rte_mbuf **tx_pkts,
> >               __rte_unused uint16_t nb_pkts)
> >  {
> > -     RTE_ETHDEV_LOG(ERR, "tx_pkt_burst for not ready port\n");
> > +     struct dummy_queue *q = txq;
> > +
> > +     if (!q->tx_warn_once) {
> > +             uint16_t port_id = q - dummy_queues;
> > +
> > +             RTE_ETHDEV_LOG(ERR, "lcore %u called tx_pkt_burst for not ready port %"PRIu16"\n",
> > +                     rte_lcore_id(), port_id);
> > +             rte_dump_stack();
> > +             q->tx_warn_once = true;
> > +     }
> >       rte_errno = ENOTSUP;
> >       return 0;
> >  }
> > @@ -199,14 +236,22 @@ void
> >  eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo)
> >  {
> >       static void *dummy_data[RTE_MAX_QUEUES_PER_PORT];
> > -     static const struct rte_eth_fp_ops dummy_ops = {
> > +     uint16_t port_id = fpo - rte_eth_fp_ops;
> > +
> > +     dummy_queues[port_id].rx_warn_once = false;
> > +     dummy_queues[port_id].tx_warn_once = false;
> > +     *fpo = (struct rte_eth_fp_ops) {
> >               .rx_pkt_burst = dummy_eth_rx_burst,
> >               .tx_pkt_burst = dummy_eth_tx_burst,
> > -             .rxq = {.data = dummy_data, .clbk = dummy_data,},
> > -             .txq = {.data = dummy_data, .clbk = dummy_data,},
> > +             .rxq = (struct rte_ethdev_qdata) {
>
> Here and for txq, do we need to explicitly specify type?
> Wouldn't:
> .rxq = {.data=..., .clbk=...,},
> be enough here?

Well, same question from Thomas.
It seems to work without it.


-- 
David Marchand


  reply	other threads:[~2021-10-27  7:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 14:58 David Marchand
2021-10-26 15:56 ` Thomas Monjalon
2021-10-27  7:20   ` David Marchand
2021-10-27  8:16     ` Olivier Matz
2021-10-27  8:42       ` David Marchand
2021-10-26 17:10 ` Ananyev, Konstantin
2021-10-27  7:23   ` David Marchand [this message]
2021-10-27 12:01 ` [dpdk-dev] [PATCH v2] ethdev: warn once for buggy applications David Marchand
2021-10-27 12:15   ` Ananyev, Konstantin
2021-10-27 12:46     ` Thomas Monjalon
2021-10-27 17:31       ` Ferruh Yigit

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=CAJFAV8ye0WOktKQPg+4kYVkGspYo8X4792vGYr089rjm2L-a6A@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=thomas@monjalon.net \
    --cc=xiaoyun.li@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).