dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
To: Daniel Mrzyglod
	<danielx.t.mrzyglod-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: dev-VfR2kkLFssw@public.gmane.org
Subject: Re: [PATCH] Added Spinlock to l3fwd-vf example to prevent race conditioning
Date: Wed, 23 Jul 2014 10:33:03 +0200	[thread overview]
Message-ID: <1409471.9EROF7RsSj@xps13> (raw)
In-Reply-To: <1404818184-29388-1-git-send-email-danielx.t.mrzyglod-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Hi Daniel,

Some explanations are missing here.

> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> --- a/examples/l3fwd-vf/main.c
> +++ b/examples/l3fwd-vf/main.c
> @@ -54,6 +54,7 @@
>  #include <rte_per_lcore.h>
>  #include <rte_launch.h>
>  #include <rte_atomic.h>
> +#include <rte_spinlock.h>
>  #include <rte_cycles.h>
>  #include <rte_prefetch.h>
>  #include <rte_lcore.h>
> @@ -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]);
> 

  parent reply	other threads:[~2014-07-23  8:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 11:16 [PATCH] Added Spinlock to l3fwd-vf example to prevent race conditioning Daniel Mrzyglod
     [not found] ` <1404818184-29388-1-git-send-email-danielx.t.mrzyglod-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-07-23  8:33   ` Thomas Monjalon [this message]
2014-11-11 22:56     ` Thomas Monjalon
2014-11-11 23:18       ` Xie, Huawei
2014-12-08 14:45   ` Neil Horman
     [not found]     ` <20141208144545.GD3237-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-12-10  8:18       ` Wodkowski, PawelX
     [not found]         ` <F6F2A6264E145F47A18AB6DF8E87425D12B6C944-kPTMFJFq+rFT4JjzTwqWc7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-12-10 14:47           ` Neil Horman
     [not found]             ` <20141210144745.GC17040-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-12-10 14:54               ` Bruce Richardson
2014-12-10 15:53                 ` Mrzyglod, DanielX T
2014-12-10 16:16                 ` Neil Horman
     [not found]                   ` <20141210161646.GE17040-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-12-10 23:38                     ` Stephen Hemminger
2014-12-11  0:34                       ` Neil Horman
2014-12-10 10:53       ` Thomas Monjalon
2014-12-11  1:08       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409471.9EROF7RsSj@xps13 \
    --to=thomas.monjalon-pdr9zngts4eavxtiumwx3w@public.gmane.org \
    --cc=danielx.t.mrzyglod-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).