From patchwork Fri Oct 20 15:49:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Kulasek X-Patchwork-Id: 30651 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 A2CA61B25E; Fri, 20 Oct 2017 17:50:57 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id B82E41B258 for ; Fri, 20 Oct 2017 17:50:55 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP; 20 Oct 2017 08:50:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.43,405,1503385200"; d="scan'208"; a="1208094153" Received: from unknown (HELO Sent) ([10.103.103.214]) by fmsmga001.fm.intel.com with SMTP; 20 Oct 2017 08:50:52 -0700 Received: by Sent (sSMTP sendmail emulation); Fri, 20 Oct 2017 17:49:48 +0200 From: Tomasz Kulasek To: dev@dpdk.org Cc: declan.doherty@intel.com Date: Fri, 20 Oct 2017 17:49:26 +0200 Message-Id: <20171020154926.13452-1-tomaszx.kulasek@intel.com> X-Mailer: git-send-email 2.12.3 Subject: [dpdk-dev] [PATCH] net/bonding: fix check slaves link properties 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" Result of slaves link properties validation is not used when new slave is added. This patch uses the value of link_properties_valid() to determinate if slave can be used in the bonding. If function fails, error is returned preventing to add slave with invalid link properties. Coverity issue: 158661 Fixes: deba8a2f8b0b ("net/bonding: fix link properties management") Cc: declan.doherty@intel.com Signed-off-by: Tomasz Kulasek Reviewed-by: Ferruh Yigit --- drivers/net/bonding/rte_eth_bond_api.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index de1d9e0..ecda494 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -302,8 +302,13 @@ internals->tx_offload_capa &= dev_info.tx_offload_capa; internals->flow_type_rss_offloads &= dev_info.flow_type_rss_offloads; - link_properties_valid(bonded_eth_dev, - &slave_eth_dev->data->dev_link); + 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