From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E559B6CD8 for ; Wed, 14 Nov 2018 13:25:25 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2018 04:25:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,232,1539673200"; d="scan'208";a="96220163" Received: from silpixa00383879.ir.intel.com (HELO silpixa00383879.ger.corp.intel.com) ([10.237.223.127]) by FMSMGA003.fm.intel.com with ESMTP; 14 Nov 2018 04:25:23 -0800 From: Radu Nicolau To: dev@dpdk.org Cc: declan.doherty@intel.com, chas3@att.com, Radu Nicolau Date: Wed, 14 Nov 2018 12:19:09 +0000 Message-Id: <1542197949-15992-1-git-send-email-radu.nicolau@intel.com> X-Mailer: git-send-email 2.7.5 Subject: [dpdk-dev] [PATCH] examples/bond: wait for slaves to become active 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: , X-List-Received-Date: Wed, 14 Nov 2018 12:25:26 -0000 Do not start the packet processing threads until all configured slaves become active. Signed-off-by: Radu Nicolau --- 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; -- 2.7.5