examples/bond: fix initialization error

Message ID 1542127564-25901-1-git-send-email-radu.nicolau@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series examples/bond: fix initialization error |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Radu Nicolau Nov. 13, 2018, 4:46 p.m. UTC
  Queue setup will fail if called before adding slaves.

Fixes: 7a0665940fa8 ("net/bonding: inherit descriptor limits from slaves")
Cc: stable@dpdk.org

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 examples/bond/main.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
  

Comments

Chas Williams Nov. 27, 2018, 6:57 p.m. UTC | #1
On 11/13/2018 11:46 AM, Radu Nicolau wrote:
> Queue setup will fail if called before adding slaves.
> 
> Fixes: 7a0665940fa8 ("net/bonding: inherit descriptor limits from slaves")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>

Acked-by: Chas Williams <chas3@att.com>

> ---
>   examples/bond/main.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/examples/bond/main.c b/examples/bond/main.c
> index b282e68..65f3c39 100644
> --- a/examples/bond/main.c
> +++ b/examples/bond/main.c
> @@ -243,6 +243,13 @@ bond_port_init(struct rte_mempool *mbuf_pool)
>   		rte_exit(EXIT_FAILURE, "port %u: rte_eth_dev_adjust_nb_rx_tx_desc "
>   				"failed (res=%d)\n", BOND_PORT, retval);
>   
> +	for (i = 0; i < slaves_count; i++) {
> +		if (rte_eth_bond_slave_add(BOND_PORT, slaves[i]) == -1)
> +			rte_exit(-1, "Oooops! adding slave (%u) to bond (%u) failed!\n",
> +					slaves[i], BOND_PORT);
> +
> +	}
> +
>   	/* RX setup */
>   	rxq_conf = dev_info.default_rxconf;
>   	rxq_conf.offloads = local_port_conf.rxmode.offloads;
> @@ -263,13 +270,6 @@ bond_port_init(struct rte_mempool *mbuf_pool)
>   		rte_exit(retval, "port %u: TX queue 0 setup failed (res=%d)",
>   				BOND_PORT, retval);
>   
> -	for (i = 0; i < slaves_count; i++) {
> -		if (rte_eth_bond_slave_add(BOND_PORT, slaves[i]) == -1)
> -			rte_exit(-1, "Oooops! adding slave (%u) to bond (%u) failed!\n",
> -					slaves[i], BOND_PORT);
> -
> -	}
> -
>   	retval  = rte_eth_dev_start(BOND_PORT);
>   	if (retval < 0)
>   		rte_exit(retval, "Start port %d failed (res=%d)", BOND_PORT, retval);
>
  
Ferruh Yigit Nov. 28, 2018, 10:38 a.m. UTC | #2
On 11/27/2018 6:57 PM, Chas Williams wrote:
> 
> 
> On 11/13/2018 11:46 AM, Radu Nicolau wrote:
>> Queue setup will fail if called before adding slaves.
>>
>> Fixes: 7a0665940fa8 ("net/bonding: inherit descriptor limits from slaves")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> 
> Acked-by: Chas Williams <chas3@att.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/examples/bond/main.c b/examples/bond/main.c
index b282e68..65f3c39 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -243,6 +243,13 @@  bond_port_init(struct rte_mempool *mbuf_pool)
 		rte_exit(EXIT_FAILURE, "port %u: rte_eth_dev_adjust_nb_rx_tx_desc "
 				"failed (res=%d)\n", BOND_PORT, retval);
 
+	for (i = 0; i < slaves_count; i++) {
+		if (rte_eth_bond_slave_add(BOND_PORT, slaves[i]) == -1)
+			rte_exit(-1, "Oooops! adding slave (%u) to bond (%u) failed!\n",
+					slaves[i], BOND_PORT);
+
+	}
+
 	/* RX setup */
 	rxq_conf = dev_info.default_rxconf;
 	rxq_conf.offloads = local_port_conf.rxmode.offloads;
@@ -263,13 +270,6 @@  bond_port_init(struct rte_mempool *mbuf_pool)
 		rte_exit(retval, "port %u: TX queue 0 setup failed (res=%d)",
 				BOND_PORT, retval);
 
-	for (i = 0; i < slaves_count; i++) {
-		if (rte_eth_bond_slave_add(BOND_PORT, slaves[i]) == -1)
-			rte_exit(-1, "Oooops! adding slave (%u) to bond (%u) failed!\n",
-					slaves[i], BOND_PORT);
-
-	}
-
 	retval  = rte_eth_dev_start(BOND_PORT);
 	if (retval < 0)
 		rte_exit(retval, "Start port %d failed (res=%d)", BOND_PORT, retval);