From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id BED3E6896 for ; Wed, 23 Jul 2014 10:31:48 +0200 (CEST) Received: by mail-wg0-f49.google.com with SMTP id k14so788518wgh.8 for ; Wed, 23 Jul 2014 01:33:11 -0700 (PDT) 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=LFEMw0doEpQqKFBUM/AYEUXeF+Ad2195Quo8WOm/4M4=; b=hAsDB8V7fvqqi7VPnZi99BpQjWhx/gBdkFQ+aM02t34slWEdhzHdA5hbUpaFwGR8vF oATWPrjPxtxZBbX6INFo1frOhm0o0EcpGthsZD5kj+7KG0rAE7uu91ee0ERb4iiyxWqq N4VoE6naVq/lV0zsa4Zcn8NNbE9SAnShGzhhLk9YdPRRStgn980CQI8TFD/cvxRhQ4x3 r/HKvtY0mIRap7aWsyFaflYKfoEp+MBN85GAWBdAWTwhb0jj1xe8SB1REYJh/wf18uPu oRqyuJSZj5pxQa/c08XCm/JW75j3Y9gaTCC+QanELTdyVUOXK/WIY7FCx51qdEsjmN6O HJwQ== X-Gm-Message-State: ALoCoQnUBQs7UqiYuJiFgp1yWsjvx1xb03Nc8kmWYfhLz5XtqsqKFSRn0G88E36lh5oBAPKIJiDN X-Received: by 10.194.63.37 with SMTP id d5mr42447124wjs.92.1406104391376; Wed, 23 Jul 2014 01:33:11 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id gi15sm4230099wjc.20.2014.07.23.01.33.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jul 2014 01:33:10 -0700 (PDT) From: Thomas Monjalon To: Daniel Mrzyglod Date: Wed, 23 Jul 2014 10:33:03 +0200 Message-ID: <1409471.9EROF7RsSj@xps13> Organization: 6WIND User-Agent: KMail/4.13.2 (Linux/3.15.5-2-ARCH; KDE/4.13.2; x86_64; ; ) In-Reply-To: <1404818184-29388-1-git-send-email-danielx.t.mrzyglod@intel.com> References: <1404818184-29388-1-git-send-email-danielx.t.mrzyglod@intel.com> 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: Wed, 23 Jul 2014 08:31:48 -0000 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]); >