From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH 5/8] bond: active slaves with no primary Date: Fri, 4 Dec 2015 09:14:17 -0800 Message-ID: <1449249260-15165-6-git-send-email-stephen@networkplumber.org> References: <1449249260-15165-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org, Eric Kinzie To: declan.doherty@intel.com Return-path: Received: from mail-pf0-f170.google.com (mail-pf0-f170.google.com [209.85.192.170]) by dpdk.org (Postfix) with ESMTP id CBD9291B3 for ; Fri, 4 Dec 2015 18:14:16 +0100 (CET) Received: by pfbg73 with SMTP id g73so29638611pfb.1 for ; Fri, 04 Dec 2015 09:14:16 -0800 (PST) In-Reply-To: <1449249260-15165-1-git-send-email-stephen@networkplumber.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Eric Kinzie If the link state of a slave is "up" when added, it is added to the list of active slaves but, even if it is the only slave, is not selected as the primary interface. Generally, handling of link state interrupts selects an interface to be primary, but only if the active count is zero. This change avoids the situation where there are active slaves but no primary. Signed-off-by: Eric Kinzie Signed-off-by: Stephen Hemminger --- drivers/net/bonding/rte_eth_bond_api.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 8a000c8..630a461 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -427,8 +427,13 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id) if (bonded_eth_dev->data->dev_started) { rte_eth_link_get_nowait(slave_port_id, &link_props); - if (link_props.link_status == 1) + if (link_props.link_status == 1) { + if (internals->active_slave_count == 0 && + !internals->user_defined_primary_port) + bond_ethdev_primary_set(internals, + slave_port_id); activate_slave(bonded_eth_dev, slave_port_id); + } } return 0; -- 2.1.4