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 627ACA04BA; Thu, 1 Oct 2020 21:40:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AC3141D5B9; Thu, 1 Oct 2020 21:40:51 +0200 (CEST) Received: from mail-oi1-f195.google.com (mail-oi1-f195.google.com [209.85.167.195]) by dpdk.org (Postfix) with ESMTP id 9F5991D57F for ; Thu, 1 Oct 2020 21:40:50 +0200 (CEST) Received: by mail-oi1-f195.google.com with SMTP id z26so6861175oih.12 for ; Thu, 01 Oct 2020 12:40:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nl8GDae/7/4qjP6vRQmfBf2LzGsJPW5vuWS59vA1JPo=; b=VrY9wTCFv6n4wU9bO7T4JnlamJThY0aFylUZbTnkAgG9cvSp2Cg0ohSFgBNZG/NidW P5pZdhU1LVimLbNy8K3gYop4E+Xb7/F5sG7gQ18VAGbGIR9tnifZS3sjzzST0BecgSuA wFcqueNVGSTEmYzLraWS/sBLMZ0mD5xDQFDpU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nl8GDae/7/4qjP6vRQmfBf2LzGsJPW5vuWS59vA1JPo=; b=NwMTJeLg1bC4vMnHA9WH+3UgDam46ni8WZcuiRcncsKASfzAII3VH+7ElKYscoP7tV Ap0XAf7tY/WB2L/5022HjAZgXviF6DkIk+f0Z4j5zerdrf5kaj5Ai2O6cw4jTxUHvHbB wcbprWsOGFofyw1yQnXhp9vEWJWPOfPBMjYjwvTSyTkSDcPQubd61Jz5B4jqEyDe68lN dqQ3R1sTa+tMzSKs2aGpVmtUB4JZv6wSpw+IQtmL475X6x5YdphwMT2xGtR6scbUpSIT JoGsI0DM1J/1gnnm5qxC74QcaBgytFCO3Q01aJXeZqsUsm0+GM56N45h90krEZ/yL+5i 2kcQ== X-Gm-Message-State: AOAM533/Goln2zs8GOkW/3tWlRxFIJWMQfL0hDS7SEuEMPzP7WVyw35t 2adBBaEsFfOSL99k9FFr3eIQ+m/i4fq6Ke/eIzbrSw== X-Google-Smtp-Source: ABdhPJymvUm5iyyp0HTsJgNK5mqc6vgv33ptykYJ3fxPBQXlpWWRRSuRmEoFmy6lht/gYT0m2qULLpcTBhXh/A0SFD8= X-Received: by 2002:a05:6808:5ca:: with SMTP id d10mr1008296oij.27.1601581248722; Thu, 01 Oct 2020 12:40:48 -0700 (PDT) MIME-Version: 1.0 References: <20201001181402.28327-1-ferruh.yigit@intel.com> In-Reply-To: <20201001181402.28327-1-ferruh.yigit@intel.com> From: Ajit Khaparde Date: Thu, 1 Oct 2020 12:40:32 -0700 Message-ID: To: Ferruh Yigit Cc: Thomas Monjalon , Andrew Rybchenko , "Wei Hu (Xavier)" , dpdk-dev Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] ethdev: check if queues are allocated before getting info 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" On Thu, Oct 1, 2020 at 11:14 AM Ferruh Yigit 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 Reviewed-by: Ajit Khaparde > --- > 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 >