From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by dpdk.org (Postfix) with ESMTP id B4EF5AD7E for ; Tue, 1 Mar 2016 18:32:27 +0100 (CET) Received: by mail-pf0-f193.google.com with SMTP id 184so5501569pff.1 for ; Tue, 01 Mar 2016 09:32:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1h75ViO7QLdOtuQfk6Yrb1sxoXkXCT6nBhNBOh0UP6A=; b=oLS9sSCFnJ+WW74K9Qw8P4YrGZEaDWCFONQbVoRVY806dG4utmTgpBEgemHSQfIRMz LgFOerIBCV9e4eDs7OzlQOHF4KI9LMCxG7Rds5Nr+6K8D5HoOQE+8LAc//Vdk7HhDI2P AFdMfPIS7opRe3F90ZQGV5iWh3Zu1csZ1rsjTVzsehoLoHHonnZ3G36tRJvY2/PwXu4b mIPKbC1tal4dGVb8yZd43yaG3XFivZDFgKW8Ef1X25+KIiCbelEezeRDmfghvfhYOATo /iVYNw5Dw/v+I/9FQtagOXIuRFZdi7BkLUWVvA1ijXXaKwoU4U8lepgtpd/i5cqk9uiD tJlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1h75ViO7QLdOtuQfk6Yrb1sxoXkXCT6nBhNBOh0UP6A=; b=Dw2UwJoKUivxhEuy2BvvnLALHFmEBqBx8QK6yvlYePhtVRn9B7sM+3jmwLHiUAWvOx KD2sGbTR2eTbKF/Yk+y6Cp7//GtWAzAwNqVmxw8EBjqcW9l3eqi47GhJsCw0UPVvkQEa s6ACByh6xZTqPihRn3UJ5Ab3Lo1aOpkSmgq1dx7FRwibPBF7KEA/axB2F1ecR1bihYrY pAQ70v88tUHAs8Ss1n14k91o4OmR/Esgdm5utMMuhOQTYtyhjpISML3j5h+DA5mTzuMF Y2HqTrLBh1JOJRX8nA3Er/6R2F/DjzVgDsW5JtJUsyanNsh46TknwRIk8tytOJkb66Ka JuCg== X-Gm-Message-State: AD7BkJI+XodGSvA4PSdoCWDbSagYl8yQYJPzoNuutrIgNPBZguDEPE9NpbqeZCY+EIwbxw== X-Received: by 10.98.16.85 with SMTP id y82mr31736238pfi.90.1456853547173; Tue, 01 Mar 2016 09:32:27 -0800 (PST) Received: from buildhost2.vyatta.com. ([144.49.132.22]) by smtp.gmail.com with ESMTPSA id y27sm46938069pfi.82.2016.03.01.09.32.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Mar 2016 09:32:25 -0800 (PST) From: Eric Kinzie To: dev@dpdk.org Date: Tue, 1 Mar 2016 09:32:01 -0800 Message-Id: <1456853522-4864-4-git-send-email-ehkinzie@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1456853522-4864-1-git-send-email-ehkinzie@gmail.com> References: <8CEF83825BEC744B83065625E567D7C219FB4852@IRSMSX108.ger.corp.intel.com> <1456853522-4864-1-git-send-email-ehkinzie@gmail.com> Cc: Eric Kinzie Subject: [dpdk-dev] [PATCH V3 3/4] bond: active slaves with no primary X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2016 17:32:28 -0000 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. Fixes: 2efb58cbab6e ("bond: new link bonding library") Signed-off-by: Eric Kinzie Signed-off-by: Stephen Hemminger Acked-by: Declan Doherty --- 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