From patchwork Fri Dec 4 17:14:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 9356 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id C36AD91C9; Fri, 4 Dec 2015 18:14:19 +0100 (CET) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fuV/lZnAXUvhWCOsZDU/BJjcisJ1uLCY9tMiqAhW5CM=; b=XsRIPjZSCIUtYEyLSSlmVccs1tVlUlM9GpR8eJJYD6DTOuqKMQSez1Jbxtl2evMs9J hPmtDKPQug8hNz+G/S0YEg1X5eBQdiTHmOTDPkugT2en6EJ/AdXlT3bIGJVbmpIoOtr0 g1GosgMZnYiPLVUSDNix/F8t1GS9dgs9AiYThQb5NalGEuKJahgfPWsm76q6Q/X3Epsf fHfkiA+yImtSBV/oYyaS/2F+khjJV+oJpbSYGmH4+7k6z7B9ptvFd2HQRG3lp7hcC8bs RCudWy+YVjJzP2WcAl6w3ifVBB08042SZGeqeTih4XqXgc+6eXgeUWL+m7Is49+hUGnk AgXw== 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=fuV/lZnAXUvhWCOsZDU/BJjcisJ1uLCY9tMiqAhW5CM=; b=TzELKa313KhMgKPKrOzV0dJ/p7ieO8kyHIg6tExz+dyFgN7FX+o/pkFGhuVdvR8nkH 2FUaYM5WYNTbOtmWUw9N3XcoZ8VmNWJnmg8F4u5aZv3QK65G9gc7ixaYpJYqlf38G8kA eZ8p2h1lxi0agFQzjDukkYojdLSuILko2P/+LZYhdeOU5sXwPTCam1jGsAbwjHrVEj8o 78wfEZBn8am571Wk/2ZtZt1RktcQk8nweZRK0OFMvsXo2+or4K3RDczYxwX2mgJLGZUe oK9ce0PWp9g7yB/qrtGhV/qqZB+jak08afgGgxqWEDnyCP1i312SqRv76vf0YwdtKSvL eRQg== X-Gm-Message-State: ALoCoQktpS42Rgbg+PMckvyuEt/TfC4f3HpZAGUAr4QBtyoz+eWPoYMbXm3/530OylbNC2UDRwMF X-Received: by 10.98.10.83 with SMTP id s80mr22927487pfi.79.1449249256259; Fri, 04 Dec 2015 09:14:16 -0800 (PST) Received: from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id 134sm18291003pfa.30.2015.12.04.09.14.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Dec 2015 09:14:15 -0800 (PST) From: Stephen Hemminger To: declan.doherty@intel.com Date: Fri, 4 Dec 2015 09:14:17 -0800 Message-Id: <1449249260-15165-6-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449249260-15165-1-git-send-email-stephen@networkplumber.org> References: <1449249260-15165-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org, Eric Kinzie Subject: [dpdk-dev] [PATCH 5/8] 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: , 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 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;