Message ID | 1413975345-24326-2-git-send-email-bruce.richardson@intel.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 6F2797E9D; Wed, 22 Oct 2014 12:47:58 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id F0B5E7E7B for <dev@dpdk.org>; Wed, 22 Oct 2014 12:47:56 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 22 Oct 2014 03:56:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,768,1406617200"; d="scan'208";a="618444666" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 22 Oct 2014 03:55:53 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s9MAtkiX021894; Wed, 22 Oct 2014 11:55:46 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s9MAtkvh024369; Wed, 22 Oct 2014 11:55:46 +0100 Received: (from bricha3@localhost) by sivswdev02.ir.intel.com with id s9MAtkwr024365; Wed, 22 Oct 2014 11:55:46 +0100 From: Bruce Richardson <bruce.richardson@intel.com> To: dev@dpdk.org Date: Wed, 22 Oct 2014 11:55:44 +0100 Message-Id: <1413975345-24326-2-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1413975345-24326-1-git-send-email-bruce.richardson@intel.com> References: <1413975345-24326-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 1/2] ixgbe: remove static qualifier for thread safety X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Bruce Richardson
Oct. 22, 2014, 10:55 a.m. UTC
Remove the "static" prefix to the template mbuf variable in
ixgbe_rxq_vec_setup function. This will then allow different
threads to initialize different RX queues at the same time,
without one overwriting the other's data.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi, in this code, pointer of local variable (mb_def) is returned by your changes. mb_def should be static for each thread. 2014-10-22 19:55 GMT+09:00 Bruce Richardson <bruce.richardson@intel.com>: > Remove the "static" prefix to the template mbuf variable in > ixgbe_rxq_vec_setup function. This will then allow different > threads to initialize different RX queues at the same time, > without one overwriting the other's data. > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> > --- > lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c > index a0d3d78..e813e43 100644 > --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c > +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c > @@ -730,7 +730,7 @@ static struct ixgbe_txq_ops vec_txq_ops = { > int > ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq) > { > - static struct rte_mbuf mb_def = { > + struct rte_mbuf mb_def = { > .nb_segs = 1, > .data_off = RTE_PKTMBUF_HEADROOM, > #ifdef RTE_MBUF_REFCNT > -- > 1.9.3 >
On Thu, Oct 23, 2014 at 08:43:39AM +0900, Masaru Oki wrote: > Hi, > > in this code, pointer of local variable (mb_def) is returned by your changes. > mb_def should be static for each thread. Actually, no. A copy is made of 8 bytes of the mb_def variable and stored as an mbuf initializer inside the rxq structure. No use of the memory occupied by mb_def is made outside of the function, so the value does not need to be static. /Bruce > > 2014-10-22 19:55 GMT+09:00 Bruce Richardson <bruce.richardson@intel.com>: > > Remove the "static" prefix to the template mbuf variable in > > ixgbe_rxq_vec_setup function. This will then allow different > > threads to initialize different RX queues at the same time, > > without one overwriting the other's data. > > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> > > --- > > lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c > > index a0d3d78..e813e43 100644 > > --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c > > +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c > > @@ -730,7 +730,7 @@ static struct ixgbe_txq_ops vec_txq_ops = { > > int > > ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq) > > { > > - static struct rte_mbuf mb_def = { > > + struct rte_mbuf mb_def = { > > .nb_segs = 1, > > .data_off = RTE_PKTMBUF_HEADROOM, > > #ifdef RTE_MBUF_REFCNT > > -- > > 1.9.3 > >
Oh, sorry, you are right. I had missed first * for copy. thank you. 2014-10-24 19:34 GMT+09:00 Bruce Richardson <bruce.richardson@intel.com>: > On Thu, Oct 23, 2014 at 08:43:39AM +0900, Masaru Oki wrote: >> Hi, >> >> in this code, pointer of local variable (mb_def) is returned by your changes. >> mb_def should be static for each thread. > > Actually, no. A copy is made of 8 bytes of the mb_def variable and stored as > an mbuf initializer inside the rxq structure. No use of the memory occupied > by mb_def is made outside of the function, so the value does not need to be > static. > > /Bruce >> >> 2014-10-22 19:55 GMT+09:00 Bruce Richardson <bruce.richardson@intel.com>: >> > Remove the "static" prefix to the template mbuf variable in >> > ixgbe_rxq_vec_setup function. This will then allow different >> > threads to initialize different RX queues at the same time, >> > without one overwriting the other's data. >> > >> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> >> > --- >> > lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c >> > index a0d3d78..e813e43 100644 >> > --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c >> > +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c >> > @@ -730,7 +730,7 @@ static struct ixgbe_txq_ops vec_txq_ops = { >> > int >> > ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq) >> > { >> > - static struct rte_mbuf mb_def = { >> > + struct rte_mbuf mb_def = { >> > .nb_segs = 1, >> > .data_off = RTE_PKTMBUF_HEADROOM, >> > #ifdef RTE_MBUF_REFCNT >> > -- >> > 1.9.3 >> >
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c index a0d3d78..e813e43 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c @@ -730,7 +730,7 @@ static struct ixgbe_txq_ops vec_txq_ops = { int ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq) { - static struct rte_mbuf mb_def = { + struct rte_mbuf mb_def = { .nb_segs = 1, .data_off = RTE_PKTMBUF_HEADROOM, #ifdef RTE_MBUF_REFCNT