From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by dpdk.org (Postfix) with ESMTP id 459897F78 for ; Tue, 11 Nov 2014 23:46:56 +0100 (CET) Received: by mail-wi0-f180.google.com with SMTP id hi2so3131502wib.13 for ; Tue, 11 Nov 2014 14:56:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=hqffy30tW/VdXH9iKVnJ+b3GYadrs8f6/iBBUGue1lQ=; b=DooW1CTCwYBFXnyZR+yYjVM36liMr+ixW++6sK4HqhnlWgJrsPABCqCodCxRm9sCRK 0ak32sNHPNILsEc1z3ZYh0W6GU9J+UAyMJbGTqdtjjBWtkXf5lx+Dsw+YQqWw8d9UMKA m2sZ8YqVdIfHpvtkDV6SvRxDpe241m+r16bqj/2Grwo8tj9bY1rw1OrmVVzMutkHZc/H J/QJTa6ls8KT479MHE6Gbys71jnNgugDdBT1d4UJBzhvBSWm5hcZ56JFcvoy3saaIEqN gng9MQRgdVAuIAB8CywRL40SPiKxepWNQIyKymnImxJoVDbsgW2f/XRz0P26GbTE2teq rZqQ== X-Gm-Message-State: ALoCoQkbmnGZs2VGuwqD5iEwNGyrN9Zz9OhyZY7ekk41bj9RMlsFo5V6asX+VViMtVyWYKgOVhYS X-Received: by 10.194.8.73 with SMTP id p9mr58408416wja.87.1415746607877; Tue, 11 Nov 2014 14:56:47 -0800 (PST) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id kn5sm21534045wjb.48.2014.11.11.14.56.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Nov 2014 14:56:46 -0800 (PST) From: Thomas Monjalon To: Daniel Mrzyglod Date: Tue, 11 Nov 2014 23:56:30 +0100 Message-ID: <1800110.lhpGsJ8ic2@xps13> Organization: 6WIND User-Agent: KMail/4.14.2 (Linux/3.17.2-1-ARCH; KDE/4.14.2; x86_64; ; ) In-Reply-To: <1409471.9EROF7RsSj@xps13> References: <1404818184-29388-1-git-send-email-danielx.t.mrzyglod@intel.com> <1409471.9EROF7RsSj@xps13> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 22:46:56 -0000 Hi Daniel, This old patch is probably good but I'd like you explain it please. Reviewers are also welcome. Thanks -- Thomas 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]={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]); > >