From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 548997F0C for ; Wed, 12 Nov 2014 00:08:29 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 11 Nov 2014 15:16:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,362,1413270000"; d="scan'208";a="635351615" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by orsmga002.jf.intel.com with ESMTP; 11 Nov 2014 15:18:18 -0800 Received: from pgsmsx102.gar.corp.intel.com (10.221.44.80) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 12 Nov 2014 07:18:18 +0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX102.gar.corp.intel.com (10.221.44.80) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 12 Nov 2014 07:18:17 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.130]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.3]) with mapi id 14.03.0195.001; Wed, 12 Nov 2014 07:18:16 +0800 From: "Xie, Huawei" To: Thomas Monjalon , "Mrzyglod, DanielX T" Thread-Topic: [dpdk-dev] [PATCH] Added Spinlock to l3fwd-vf example to prevent race conditioning Thread-Index: AQHP/gLjFgZBwaRPsEatGnS4uvD5FJxcDIZg Date: Tue, 11 Nov 2014 23:18:15 +0000 Message-ID: References: <1404818184-29388-1-git-send-email-danielx.t.mrzyglod@intel.com> <1409471.9EROF7RsSj@xps13> <1800110.lhpGsJ8ic2@xps13> In-Reply-To: <1800110.lhpGsJ8ic2@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] Added Spinlock to l3fwd-vf example to prevent race conditioning 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: Tue, 11 Nov 2014 23:08:30 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon > Sent: Tuesday, November 11, 2014 3:57 PM > To: Mrzyglod, DanielX T > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] Added Spinlock to l3fwd-vf example to pre= vent > race conditioning >=20 > Hi Daniel, >=20 > This old patch is probably good but I'd like you explain it please. > Reviewers are also welcome. >=20 > Thanks > -- > Thomas >=20 > 2014-07-23 10:33, Thomas Monjalon: > > Hi Daniel, > > > > Some explanations are missing here. > > > > > Signed-off-by: Daniel Mrzyglod > > > > > > --- a/examples/l3fwd-vf/main.c > > > +++ b/examples/l3fwd-vf/main.c > > > @@ -54,6 +54,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -328,7 +329,7 @@ struct lcore_conf { > > > } __rte_cache_aligned; > > > > > > static struct lcore_conf lcore_conf[RTE_MAX_LCORE]; > > > - > > > +static rte_spinlock_t > spinlock_conf[RTE_MAX_ETHPORTS]=3D{RTE_SPINLOCK_INITIALIZER}; > > > /* Send burst of packets on an output interface */ > > > static inline int > > > send_burst(struct lcore_conf *qconf, uint16_t n, uint8_t port) > > > @@ -340,7 +341,10 @@ send_burst(struct lcore_conf *qconf, uint16_t n, > uint8_t port) > > > queueid =3D qconf->tx_queue_id; > > > m_table =3D (struct rte_mbuf **)qconf->tx_mbufs[port].m_table; > > > > > > + rte_spinlock_lock(&spinlock_conf[port]) ; > > > ret =3D rte_eth_tx_burst(port, queueid, m_table, n); > > > + rte_spinlock_unlock(&spinlock_conf[port]); It might not be good choice for here, but how about we also provide spin_tr= ylock as alternative API? > > > + > > > if (unlikely(ret < n)) { > > > do { > > > rte_pktmbuf_free(m_table[ret]); > > >