DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: add a missing sanity check for nb_tx_desc during txq setup
@ 2015-11-20 10:26 Rahul Lakkireddy
  2015-11-20 10:38 ` Ananyev, Konstantin
  0 siblings, 1 reply; 3+ messages in thread
From: Rahul Lakkireddy @ 2015-11-20 10:26 UTC (permalink / raw)
  To: dev; +Cc: Felix Marti, Kumar Sanghvi, Nirranjan Kirubaharan

Add a sanity check for number of tx descriptors requested during tx
queue setup.  Return -EINVAL if the number requested does not meet
the tx descriptor requirements of the device.

Fixes: 80a1deb4c77a ("ethdev: add API to retrieve queue information")

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 lib/librte_ether/rte_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index b19ac9a..dfd6c0b 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1342,6 +1342,18 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
 
 	rte_eth_dev_info_get(port_id, &dev_info);
 
+	if (nb_tx_desc > dev_info.tx_desc_lim.nb_max ||
+	    nb_tx_desc < dev_info.tx_desc_lim.nb_min ||
+	    nb_tx_desc % dev_info.tx_desc_lim.nb_align != 0) {
+		PMD_DEBUG_TRACE("Invalid value for nb_tx_desc(=%hu), "
+				"should be: <= %hu, = %hu, and a product of %hu\n",
+				nb_tx_desc,
+				dev_info.tx_desc_lim.nb_max,
+				dev_info.tx_desc_lim.nb_min,
+				dev_info.tx_desc_lim.nb_align);
+		return -EINVAL;
+	}
+
 	if (tx_conf == NULL)
 		tx_conf = &dev_info.default_txconf;
 
-- 
2.5.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: add a missing sanity check for nb_tx_desc during txq setup
  2015-11-20 10:26 [dpdk-dev] [PATCH] ethdev: add a missing sanity check for nb_tx_desc during txq setup Rahul Lakkireddy
@ 2015-11-20 10:38 ` Ananyev, Konstantin
  2015-11-23 22:38   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Ananyev, Konstantin @ 2015-11-20 10:38 UTC (permalink / raw)
  To: Rahul Lakkireddy, dev; +Cc: Kumar Sanghvi, Felix Marti, Nirranjan Kirubaharan



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Rahul Lakkireddy
> Sent: Friday, November 20, 2015 10:27 AM
> To: dev@dpdk.org
> Cc: Felix Marti; Kumar Sanghvi; Nirranjan Kirubaharan
> Subject: [dpdk-dev] [PATCH] ethdev: add a missing sanity check for nb_tx_desc during txq setup
> 
> Add a sanity check for number of tx descriptors requested during tx
> queue setup.  Return -EINVAL if the number requested does not meet
> the tx descriptor requirements of the device.
> 
> Fixes: 80a1deb4c77a ("ethdev: add API to retrieve queue information")
> 
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
> ---

 Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Thanks for catching it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: add a missing sanity check for nb_tx_desc during txq setup
  2015-11-20 10:38 ` Ananyev, Konstantin
@ 2015-11-23 22:38   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-11-23 22:38 UTC (permalink / raw)
  To: Rahul Lakkireddy, Kumar Sanghvi; +Cc: dev, Felix Marti, Nirranjan Kirubaharan

> > Add a sanity check for number of tx descriptors requested during tx
> > queue setup.  Return -EINVAL if the number requested does not meet
> > the tx descriptor requirements of the device.
> > 
> > Fixes: 80a1deb4c77a ("ethdev: add API to retrieve queue information")
> > 
> > Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> > Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
> > ---
> 
>  Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> Thanks for catching it.

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-23 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20 10:26 [dpdk-dev] [PATCH] ethdev: add a missing sanity check for nb_tx_desc during txq setup Rahul Lakkireddy
2015-11-20 10:38 ` Ananyev, Konstantin
2015-11-23 22:38   ` Thomas Monjalon

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).