[dpdk-dev] [PATCH] examples/bond: wait for slaves to become active

Ferruh Yigit ferruh.yigit at intel.com
Wed Nov 28 12:08:28 CET 2018


On 11/14/2018 12:19 PM, Radu Nicolau wrote:
> Do not start the packet processing threads until all configured
> slaves become active.

Hi Radu,

What happens if packet processing threads started before all slaves active? Exit
app, error, crash?

So can we say this patch is fixing packet forwarding? (fix in title?)

And do we know what break it, why this was not required previously but required
now? (Fixes line ?)

Thanks,
ferruh

> 
> Signed-off-by: Radu Nicolau <radu.nicolau at intel.com>
> ---
>  examples/bond/main.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/examples/bond/main.c b/examples/bond/main.c
> index b282e68..6623cae 100644
> --- a/examples/bond/main.c
> +++ b/examples/bond/main.c
> @@ -220,6 +220,7 @@ bond_port_init(struct rte_mempool *mbuf_pool)
>  	struct rte_eth_rxconf rxq_conf;
>  	struct rte_eth_txconf txq_conf;
>  	struct rte_eth_conf local_port_conf = port_conf;
> +	uint16_t wait_counter = 20;
>  
>  	retval = rte_eth_bond_create("net_bonding0", BONDING_MODE_ALB,
>  			0 /*SOCKET_ID_ANY*/);
> @@ -274,6 +275,20 @@ bond_port_init(struct rte_mempool *mbuf_pool)
>  	if (retval < 0)
>  		rte_exit(retval, "Start port %d failed (res=%d)", BOND_PORT, retval);
>  
> +	printf("Waiting for slaves to become active...");
> +	while (wait_counter) {
> +		uint16_t act_slaves[16] = {0};
> +		if (rte_eth_bond_active_slaves_get(BOND_PORT, act_slaves, 16) ==
> +				slaves_count) {
> +			printf("\n");
> +			break;
> +		}
> +		sleep(1);
> +		printf("...");
> +		if (--wait_counter == 0)
> +			rte_exit(-1, "\nFailed to activate slaves\n");
> +	}
> +
>  	rte_eth_promiscuous_enable(BOND_PORT);
>  
>  	struct ether_addr addr;
> 



More information about the dev mailing list