DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Thomas Monjalon <thomas@monjalon.net>,
	Andrew Rybchenko <arybchenko@solarflare.com>,
	 "Wei Hu (Xavier)" <xavier.huwei@huawei.com>,
	dpdk-dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] ethdev: check if queues are allocated before getting info
Date: Thu, 1 Oct 2020 12:40:32 -0700	[thread overview]
Message-ID: <CACZ4nhvMUZb+8=8QpE5s9OwcLXey4rwTpncxudRrEytnNj_asQ@mail.gmail.com> (raw)
In-Reply-To: <20201001181402.28327-1-ferruh.yigit@intel.com>

On Thu, Oct 1, 2020 at 11:14 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> A crash is detected when '--txpkts=#' parameter provided to the testpmd,
> this is because queue information is requested before queues have been
> allocated.
>
> Adding check to queue info APIs
> ('rte_eth_rx_queue_info_get()' & 'rte_eth_tx_queue_info_get')
> to protect against similar cases.
>
> Fixes: ba2fb4f022fc ("ethdev: check if queue setup when getting queue info")
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

> ---
>  lib/librte_ethdev/rte_ethdev.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 0f56541fbc..9805184633 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -4688,7 +4688,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
>                 return -EINVAL;
>         }
>
> -       if (dev->data->rx_queues[queue_id] == NULL) {
> +       if (dev->data->rx_queues == NULL ||
> +                       dev->data->rx_queues[queue_id] == NULL) {
>                 RTE_ETHDEV_LOG(ERR,
>                                "Rx queue %"PRIu16" of device with port_id=%"
>                                PRIu16" has not been setup\n",
> @@ -4727,7 +4728,8 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
>                 return -EINVAL;
>         }
>
> -       if (dev->data->tx_queues[queue_id] == NULL) {
> +       if (dev->data->tx_queues == NULL ||
> +                       dev->data->tx_queues[queue_id] == NULL) {
>                 RTE_ETHDEV_LOG(ERR,
>                                "Tx queue %"PRIu16" of device with port_id=%"
>                                PRIu16" has not been setup\n",
> --
> 2.26.2
>

  reply	other threads:[~2020-10-01 19:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 18:14 Ferruh Yigit
2020-10-01 19:40 ` Ajit Khaparde [this message]
2020-10-05 15:13   ` 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='CACZ4nhvMUZb+8=8QpE5s9OwcLXey4rwTpncxudRrEytnNj_asQ@mail.gmail.com' \
    --to=ajit.khaparde@broadcom.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=thomas@monjalon.net \
    --cc=xavier.huwei@huawei.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).