diff mbox

[dpdk-dev,v2,5/6] bonding: add spinlock to link update function

Message ID 1464280727-25752-6-git-send-email-bernard.iremonger@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Bruce Richardson
Headers show

Commit Message

Bernard Iremonger May 26, 2016, 4:38 p.m. UTC
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 55b37a5..474bfcc 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1853,9 +1853,11 @@  bond_ethdev_link_update(struct rte_eth_dev *bonded_eth_dev,
 {
 	struct bond_dev_private *internals = bonded_eth_dev->data->dev_private;
 
+	rte_spinlock_lock(&internals->lock);
 	if (!bonded_eth_dev->data->dev_started ||
 		internals->active_slave_count == 0) {
 		bonded_eth_dev->data->dev_link.link_status = ETH_LINK_DOWN;
+		rte_spinlock_unlock(&internals->lock);
 		return 0;
 	} else {
 		struct rte_eth_dev *slave_eth_dev;
@@ -1874,6 +1876,7 @@  bond_ethdev_link_update(struct rte_eth_dev *bonded_eth_dev,
 
 		bonded_eth_dev->data->dev_link.link_status = link_up;
 	}
+	rte_spinlock_unlock(&internals->lock);
 	return 0;
 }