From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] Added Spinlock to l3fwd-vf example to prevent race conditioning Date: Wed, 23 Jul 2014 10:33:03 +0200 Message-ID: <1409471.9EROF7RsSj@xps13> References: <1404818184-29388-1-git-send-email-danielx.t.mrzyglod@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev-VfR2kkLFssw@public.gmane.org To: Daniel Mrzyglod Return-path: In-Reply-To: <1404818184-29388-1-git-send-email-danielx.t.mrzyglod-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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]={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]); >