From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 1A6E5CE7 for ; Mon, 8 Dec 2014 15:46:11 +0100 (CET) Received: from rrcs-70-62-112-196.midsouth.biz.rr.com ([70.62.112.196] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1XxzZQ-0000t4-FH; Mon, 08 Dec 2014 09:46:00 -0500 Date: Mon, 8 Dec 2014 09:45:45 -0500 From: Neil Horman To: Daniel Mrzyglod Message-ID: <20141208144545.GD3237@localhost.localdomain> References: <1404818184-29388-1-git-send-email-danielx.t.mrzyglod@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1404818184-29388-1-git-send-email-danielx.t.mrzyglod@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: dev@dpdk.org Subject: Re: [dpdk-dev] 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: Mon, 08 Dec 2014 14:46:11 -0000 On Tue, Jul 08, 2014 at 12:16:24PM +0100, Daniel Mrzyglod wrote: > Signed-off-by: Daniel Mrzyglod > > --- > examples/l3fwd-vf/main.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c > index 2ca5c21..57852d0 100644 > --- 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]={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 = qconf->tx_queue_id; > m_table = (struct rte_mbuf **)qconf->tx_mbufs[port].m_table; > > + rte_spinlock_lock(&spinlock_conf[port]) ; > ret = rte_eth_tx_burst(port, queueid, m_table, n); > + rte_spinlock_unlock(&spinlock_conf[port]); > + > if (unlikely(ret < n)) { > do { > rte_pktmbuf_free(m_table[ret]); Acked-by: Neil Horman Though, that said, doesn't it seem to anyone else like serialization of enqueue to a port should be the responsibility of the library, not the application? Neil