From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E038737B1 for ; Sun, 12 Jun 2016 19:11:36 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 12 Jun 2016 10:11:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,462,1459839600"; d="scan'208";a="826563607" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 12 Jun 2016 10:11:34 -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 u5CHBXLB019939; Sun, 12 Jun 2016 18:11:33 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u5CHBXIT010159; Sun, 12 Jun 2016 18:11:33 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id u5CHBXvx010155; Sun, 12 Jun 2016 18:11:33 +0100 From: Bernard Iremonger To: dev@dpdk.org Cc: declan.doherty@intel.com, konstantin.ananyev@intel.com, Bernard Iremonger Date: Sun, 12 Jun 2016 18:11:26 +0100 Message-Id: <1465751489-10111-2-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1465751489-10111-1-git-send-email-bernard.iremonger@intel.com> References: <1464280727-25752-2-git-send-email-bernard.iremonger@intel.com> <1465751489-10111-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v3 1/4] bonding: add spinlock to rx and tx queues 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: Sun, 12 Jun 2016 17:11:37 -0000 At present it is possible to add and remove slave devices from the bonding device while traffic is running. This can result in segmentation faults occurring in the rx and tx burst functions. To resolve this issue spinlocks have been added to the rx and tx queues. Now when a slave is added or removed the rx and tx queue spinlocks must be held. Fixes: 2efb58cbab6e ("bond: new link bonding library") Signed-off-by: Bernard Iremonger Acked-by: Konstantin Ananyev --- 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(-) 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 */ -- 2.6.3