From patchwork Fri Jun 1 10:05:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radu Nicolau X-Patchwork-Id: 40572 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 966A55323; Fri, 1 Jun 2018 12:11:21 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 621A54F9B for ; Fri, 1 Jun 2018 12:11:20 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jun 2018 03:11:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,465,1520924400"; d="scan'208";a="55718244" Received: from silpixa00383879.ir.intel.com (HELO silpixa00383879.ger.corp.intel.com) ([10.237.223.127]) by orsmga003.jf.intel.com with ESMTP; 01 Jun 2018 03:11:15 -0700 From: Radu Nicolau To: dev@dpdk.org Cc: declan.doherty@intel.com, ferruh.yigit@intel.com, 3chas3@gmail.com, Radu Nicolau Date: Fri, 1 Jun 2018 11:05:01 +0100 Message-Id: <1527847501-14713-1-git-send-email-radu.nicolau@intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1525867586-23328-1-git-send-email-radu.nicolau@intel.com> References: <1525867586-23328-1-git-send-email-radu.nicolau@intel.com> Subject: [dpdk-dev] [PATCH v4] net/bonding: fix slave add for mode 4 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Moved the link status validity check from the slave add to the slave activation step. Otherwise slave add will fail for mode 4 if the ports are all stopped but only one of them checked. Fixes: b77d21cc2364 ("ethdev: add link status get/set helper functions") Bugzilla ID: 52 Signed-off-by: Radu Nicolau --- v4: reworked patch v3: updated commit msg v2: add fix and Bugzilla references drivers/net/bonding/rte_eth_bond_api.c | 8 -------- drivers/net/bonding/rte_eth_bond_pmd.c | 9 ++++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index d558df8..853b23b 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -345,14 +345,6 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) internals->tx_queue_offload_capa &= dev_info.tx_queue_offload_capa; internals->flow_type_rss_offloads &= dev_info.flow_type_rss_offloads; - if (link_properties_valid(bonded_eth_dev, - &slave_eth_dev->data->dev_link) != 0) { - RTE_BOND_LOG(ERR, "Invalid link properties for slave %d" - " in bonding mode %d", slave_port_id, - internals->mode); - return -1; - } - /* RETA size is GCD of all slaves RETA sizes, so, if all sizes will be * the power of 2, the lower one is GCD */ diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 02d94b1..b84af43 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2679,7 +2679,14 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, mac_address_slaves_update(bonded_eth_dev); } - activate_slave(bonded_eth_dev, port_id); + /* check link state properties */ + if (link_properties_valid(bonded_eth_dev, &link)) { + activate_slave(bonded_eth_dev, port_id); + } else { + RTE_BOND_LOG(ERR, "Invalid link properties for slave %d" + " in bonding mode %d", port_id, + internals->mode); + } /* If user has defined the primary port then default to using it */ if (internals->user_defined_primary_port &&