From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id CC4C1B67E for ; Tue, 17 Feb 2015 03:09:17 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 16 Feb 2015 18:03:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,591,1418112000"; d="scan'208";a="528414239" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 16 Feb 2015 18:00:44 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t1H29Dlt019932; Tue, 17 Feb 2015 10:09:13 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t1H299vZ028798; Tue, 17 Feb 2015 10:09:11 +0800 Received: (from cliang18@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t1H2989X028794; Tue, 17 Feb 2015 10:09:08 +0800 From: Cunming Liang To: dev@dpdk.org Date: Tue, 17 Feb 2015 10:08:14 +0800 Message-Id: <1424138896-28618-18-git-send-email-cunming.liang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1424138896-28618-1-git-send-email-cunming.liang@intel.com> References: <1423970145-31985-1-git-send-email-cunming.liang@intel.com> <1424138896-28618-1-git-send-email-cunming.liang@intel.com> Subject: [dpdk-dev] [PATCH v8 17/19] ring: add support to non-EAL thread 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, 17 Feb 2015 02:09:18 -0000 ring debug stat won't take care non-EAL thread. Signed-off-by: Cunming Liang --- v6 changes: rollback v5 changes v5 changes: check __lcore_id with LCORE_ID_ANY instead of RTE_MAX_LCORE lib/librte_ring/rte_ring.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index 7cd5f2d..39bacdd 100644 --- a/lib/librte_ring/rte_ring.h +++ b/lib/librte_ring/rte_ring.h @@ -188,10 +188,12 @@ struct rte_ring { * The number to add to the object-oriented statistics. */ #ifdef RTE_LIBRTE_RING_DEBUG -#define __RING_STAT_ADD(r, name, n) do { \ - unsigned __lcore_id = rte_lcore_id(); \ - r->stats[__lcore_id].name##_objs += n; \ - r->stats[__lcore_id].name##_bulk += 1; \ +#define __RING_STAT_ADD(r, name, n) do { \ + unsigned __lcore_id = rte_lcore_id(); \ + if (__lcore_id < RTE_MAX_LCORE) { \ + r->stats[__lcore_id].name##_objs += n; \ + r->stats[__lcore_id].name##_bulk += 1; \ + } \ } while(0) #else #define __RING_STAT_ADD(r, name, n) do {} while(0) -- 1.8.1.4