DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net:bonding: fix free_queues function when no queues exist
@ 2015-10-22 12:55 Yaacov Hazan
  2015-10-26  7:07 ` [dpdk-dev] [PATCH v2] " Yaacov Hazan
  0 siblings, 1 reply; 4+ messages in thread
From: Yaacov Hazan @ 2015-10-22 12:55 UTC (permalink / raw)
  To: dev; +Cc: Raslsn Darawsheh

From: Raslsn Darawsheh <rdarawsheh@asaltech.com>

In case of creating bond device without add any slaves and
quit from testpmd, application crashed since rx/tx queues
are NULL.

add checking of this paramters before trying to free.

Signed-off-by: Raslsn Darawsheh <rdarawsheh@asaltech.com>
Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 5cc6372..40b63d7 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1518,12 +1518,18 @@ bond_ethdev_free_queues(struct rte_eth_dev *dev)
 	uint8_t i;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		if (dev->data->rx_queues[i] == NULL)
+			continue;
+
 		rte_free(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = NULL;
 	}
 	dev->data->nb_rx_queues = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
+		if (dev->data->tx_queues[i] == NULL)
+			continue;
+
 		rte_free(dev->data->tx_queues[i]);
 		dev->data->tx_queues[i] = NULL;
 	}
-- 
1.9.1

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

* [dpdk-dev] [PATCH v2] net:bonding: fix free_queues function when no queues exist
  2015-10-22 12:55 [dpdk-dev] [PATCH] net:bonding: fix free_queues function when no queues exist Yaacov Hazan
@ 2015-10-26  7:07 ` Yaacov Hazan
  2015-10-29 16:25   ` Declan Doherty
  0 siblings, 1 reply; 4+ messages in thread
From: Yaacov Hazan @ 2015-10-26  7:07 UTC (permalink / raw)
  To: dev; +Cc: Yaacov Hazan, Raslsn Darawsheh

From: Raslsn Darawsheh <rdarawsheh@asaltech.com>

In case of creating bond device without add any slaves and
quit from testpmd, application crashed since rx/tx queues
are NULL.

add checking of this paramters before trying to free.

Signed-off-by: Raslsn Darawsheh <rdarawsheh@asaltech.com>
Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
---
in previous patch there was mismatch in the solution.
this patch is the correct fix for the described bug

 drivers/net/bonding/rte_eth_bond_pmd.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 5cc6372..383fdcf 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1517,17 +1517,21 @@ bond_ethdev_free_queues(struct rte_eth_dev *dev)
 {
 	uint8_t i;
 
-	for (i = 0; i < dev->data->nb_rx_queues; i++) {
-		rte_free(dev->data->rx_queues[i]);
-		dev->data->rx_queues[i] = NULL;
+	if (dev->data->rx_queues != NULL) {
+		for (i = 0; i < dev->data->nb_rx_queues; i++) {
+			rte_free(dev->data->rx_queues[i]);
+			dev->data->rx_queues[i] = NULL;
+		}
+		dev->data->nb_rx_queues = 0;
 	}
-	dev->data->nb_rx_queues = 0;
 
-	for (i = 0; i < dev->data->nb_tx_queues; i++) {
-		rte_free(dev->data->tx_queues[i]);
-		dev->data->tx_queues[i] = NULL;
+	if (dev->data->tx_queues != NULL) {
+		for (i = 0; i < dev->data->nb_tx_queues; i++) {
+			rte_free(dev->data->tx_queues[i]);
+			dev->data->tx_queues[i] = NULL;
+		}
+		dev->data->nb_tx_queues = 0;
 	}
-	dev->data->nb_tx_queues = 0;
 }
 
 void
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH v2] net:bonding: fix free_queues function when no queues exist
  2015-10-26  7:07 ` [dpdk-dev] [PATCH v2] " Yaacov Hazan
@ 2015-10-29 16:25   ` Declan Doherty
  2015-11-04 22:47     ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Declan Doherty @ 2015-10-29 16:25 UTC (permalink / raw)
  To: Yaacov Hazan, dev; +Cc: Raslsn Darawsheh

On 26/10/15 07:07, Yaacov Hazan wrote:
> From: Raslsn Darawsheh <rdarawsheh@asaltech.com>
>
> In case of creating bond device without add any slaves and
> quit from testpmd, application crashed since rx/tx queues
> are NULL.
>
> add checking of this paramters before trying to free.
>
> Signed-off-by: Raslsn Darawsheh <rdarawsheh@asaltech.com>
> Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
> ---
> in previous patch there was mismatch in the solution.
> this patch is the correct fix for the described bug
>
>   drivers/net/bonding/rte_eth_bond_pmd.c | 20 ++++++++++++--------
>   1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index 5cc6372..383fdcf 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -1517,17 +1517,21 @@ bond_ethdev_free_queues(struct rte_eth_dev *dev)
>   {
>   	uint8_t i;
>
> -	for (i = 0; i < dev->data->nb_rx_queues; i++) {
> -		rte_free(dev->data->rx_queues[i]);
> -		dev->data->rx_queues[i] = NULL;
> +	if (dev->data->rx_queues != NULL) {
> +		for (i = 0; i < dev->data->nb_rx_queues; i++) {
> +			rte_free(dev->data->rx_queues[i]);
> +			dev->data->rx_queues[i] = NULL;
> +		}
> +		dev->data->nb_rx_queues = 0;
>   	}
> -	dev->data->nb_rx_queues = 0;
>
> -	for (i = 0; i < dev->data->nb_tx_queues; i++) {
> -		rte_free(dev->data->tx_queues[i]);
> -		dev->data->tx_queues[i] = NULL;
> +	if (dev->data->tx_queues != NULL) {
> +		for (i = 0; i < dev->data->nb_tx_queues; i++) {
> +			rte_free(dev->data->tx_queues[i]);
> +			dev->data->tx_queues[i] = NULL;
> +		}
> +		dev->data->nb_tx_queues = 0;
>   	}
> -	dev->data->nb_tx_queues = 0;
>   }
>
>   void
>
Acked-by: Declan Doherty <declan.doherty@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] net:bonding: fix free_queues function when no queues exist
  2015-10-29 16:25   ` Declan Doherty
@ 2015-11-04 22:47     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2015-11-04 22:47 UTC (permalink / raw)
  To: Yaacov Hazan, Raslsn Darawsheh; +Cc: dev

> > In case of creating bond device without add any slaves and
> > quit from testpmd, application crashed since rx/tx queues
> > are NULL.
> >
> > add checking of this paramters before trying to free.
> >
> > Signed-off-by: Raslsn Darawsheh <rdarawsheh@asaltech.com>
> > Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
> 
> Acked-by: Declan Doherty <declan.doherty@intel.com>

Applied, thanks

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 12:55 [dpdk-dev] [PATCH] net:bonding: fix free_queues function when no queues exist Yaacov Hazan
2015-10-26  7:07 ` [dpdk-dev] [PATCH v2] " Yaacov Hazan
2015-10-29 16:25   ` Declan Doherty
2015-11-04 22:47     ` 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).