From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0F3CB5A30 for ; Thu, 5 May 2016 17:38:51 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 05 May 2016 08:38:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,582,1455004800"; d="scan'208";a="799610024" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 05 May 2016 08:38:50 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u45FFCSn016527; Thu, 5 May 2016 16:15:12 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u45FFB5F010081; Thu, 5 May 2016 16:15:11 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id u45FFBDn010077; Thu, 5 May 2016 16:15:11 +0100 From: Bernard Iremonger To: dev@dpdk.org Cc: declan.doherty@intel.com, Bernard Iremonger Date: Thu, 5 May 2016 16:15:00 +0100 Message-Id: <1462461300-9962-6-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1462461300-9962-1-git-send-email-bernard.iremonger@intel.com> References: <1462461300-9962-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH 5/5] bonding: add read/write lock to the link_update function 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: Thu, 05 May 2016 15:38:52 -0000 Signed-off-by: Bernard Iremonger --- drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 6e1cc10..fff6654 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1819,9 +1819,11 @@ bond_ethdev_link_update(struct rte_eth_dev *bonded_eth_dev, { struct bond_dev_private *internals = bonded_eth_dev->data->dev_private; + rte_rwlock_read_lock(&internals->rwlock); if (!bonded_eth_dev->data->dev_started || internals->active_slave_count == 0) { bonded_eth_dev->data->dev_link.link_status = ETH_LINK_DOWN; + rte_rwlock_read_unlock(&internals->rwlock); return 0; } else { struct rte_eth_dev *slave_eth_dev; @@ -1840,7 +1842,7 @@ bond_ethdev_link_update(struct rte_eth_dev *bonded_eth_dev, bonded_eth_dev->data->dev_link.link_status = link_up; } - + rte_rwlock_read_unlock(&internals->rwlock); return 0; } -- 2.6.3