[dpdk-dev,v2,1/6] bonding: add spinlock to rx and tx queues

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

Commit Message

Iremonger, Bernard 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     | 4 ++++
 drivers/net/bonding/rte_eth_bond_private.h | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)
  

Comments

Ananyev, Konstantin June 10, 2016, 6:12 p.m. UTC | #1
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
>  drivers/net/bonding/rte_eth_bond_pmd.c     | 4 ++++
>  drivers/net/bonding/rte_eth_bond_private.h | 4 +++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
  
Iremonger, Bernard June 12, 2016, 5:11 p.m. UTC | #2
Add spinlock to bonding rx and tx queues.
Take spinlock in rx and tx burst functions.
Take all spinlocks in slave add and remove functions.
With spinlocks in place remove memcpy of slaves.

Changes in v3:
Rebase to latest master.
Drop patches 4 and 5 from v2 patchset.
Update commit messages on patches.

Changes in v2:
Replace patch 1.
Add patch 2 and reorder patches.
Add spinlock to bonding rx and tx queues.
Take all spinlocks in slave add and remove functions.
Replace readlocks with spinlocks.

Bernard Iremonger (4):
  bonding: add spinlock to rx and tx queues
  bonding: grab queue spinlocks in slave add and remove
  bonding: take queue spinlock in rx/tx burst functions
  bonding: remove memcpy from burst functions

 drivers/net/bonding/rte_eth_bond_api.c     |  52 +++++++-
 drivers/net/bonding/rte_eth_bond_pmd.c     | 189 ++++++++++++++++++-----------
 drivers/net/bonding/rte_eth_bond_private.h |   4 +-
 3 files changed, 167 insertions(+), 78 deletions(-)
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 129f04b..2e624bb 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1676,6 +1676,8 @@  bond_ethdev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 	if (bd_rx_q == NULL)
 		return -1;
 
+	rte_spinlock_init(&bd_rx_q->lock);
+
 	bd_rx_q->queue_id = rx_queue_id;
 	bd_rx_q->dev_private = dev->data->dev_private;
 
@@ -1701,6 +1703,8 @@  bond_ethdev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 	if (bd_tx_q == NULL)
 		return -1;
 
+	rte_spinlock_init(&bd_tx_q->lock);
+
 	bd_tx_q->queue_id = tx_queue_id;
 	bd_tx_q->dev_private = dev->data->dev_private;
 
diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h
index 8312397..b6abcba 100644
--- a/drivers/net/bonding/rte_eth_bond_private.h
+++ b/drivers/net/bonding/rte_eth_bond_private.h
@@ -1,7 +1,7 @@ 
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -76,6 +76,7 @@  struct bond_rx_queue {
 	/**< Copy of RX configuration structure for queue */
 	struct rte_mempool *mb_pool;
 	/**< Reference to mbuf pool to use for RX queue */
+	rte_spinlock_t lock;
 };
 
 struct bond_tx_queue {
@@ -87,6 +88,7 @@  struct bond_tx_queue {
 	/**< Number of TX descriptors available for the queue */
 	struct rte_eth_txconf tx_conf;
 	/**< Copy of TX configuration structure for queue */
+	rte_spinlock_t lock;
 };
 
 /** Bonded slave devices structure */