From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id BB8333794 for ; Thu, 5 May 2016 17:39:22 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 05 May 2016 08:38:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,582,1455004800"; d="scan'208";a="799610088" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 05 May 2016 08:38:56 -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 u45FF9fE016519; Thu, 5 May 2016 16:15:09 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u45FF9Ia010074; Thu, 5 May 2016 16:15:09 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id u45FF9DW010070; Thu, 5 May 2016 16:15:09 +0100 From: Bernard Iremonger To: dev@dpdk.org Cc: declan.doherty@intel.com, Bernard Iremonger Date: Thu, 5 May 2016 16:14:59 +0100 Message-Id: <1462461300-9962-5-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 4/5] bonding: add read/write lock to stop 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:39:23 -0000 Signed-off-by: Bernard Iremonger --- drivers/net/bonding/rte_eth_bond_pmd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index c33a860..6e1cc10 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1623,6 +1623,7 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) bond_mode_8023ad_stop(eth_dev); + rte_rwlock_read_lock(&internals->rwlock); /* Discard all messages to/from mode 4 state machines */ for (i = 0; i < internals->active_slave_count; i++) { port = &mode_8023ad_ports[internals->active_slaves[i]]; @@ -1635,15 +1636,20 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) while (rte_ring_dequeue(port->tx_ring, &pkt) != -ENOENT) rte_pktmbuf_free(pkt); } + rte_rwlock_read_unlock(&internals->rwlock); } if (internals->mode == BONDING_MODE_TLB || internals->mode == BONDING_MODE_ALB) { bond_tlb_disable(internals); + + rte_rwlock_read_lock(&internals->rwlock); for (i = 0; i < internals->active_slave_count; i++) tlb_last_obytets[internals->active_slaves[i]] = 0; + rte_rwlock_read_unlock(&internals->rwlock); } + rte_rwlock_write_lock(&internals->rwlock); internals->active_slave_count = 0; internals->link_status_polling_enabled = 0; for (i = 0; i < internals->slave_count; i++) @@ -1651,6 +1657,7 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) eth_dev->data->dev_link.link_status = ETH_LINK_DOWN; eth_dev->data->dev_started = 0; + rte_rwlock_write_unlock(&internals->rwlock); } void -- 2.6.3