From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id A21D24CB5 for ; Thu, 27 Dec 2018 15:47:38 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Dec 2018 06:47:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,405,1539673200"; d="scan'208";a="262553871" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga004.jf.intel.com with ESMTP; 27 Dec 2018 06:47:36 -0800 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 27 Dec 2018 06:47:36 -0800 Received: from fmsmsx117.amr.corp.intel.com ([169.254.3.209]) by FMSMSX112.amr.corp.intel.com ([169.254.5.67]) with mapi id 14.03.0415.000; Thu, 27 Dec 2018 06:47:36 -0800 From: "Wiles, Keith" To: Olivier Matz CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 3/3] ring:add ring walk routine Thread-Index: AQHUlWSqiEPONyruAEaKhVyazapkD6WS8emAgABPngA= Date: Thu, 27 Dec 2018 14:47:35 +0000 Message-ID: References: <20181216172721.91042-1-keith.wiles@intel.com> <20181216172721.91042-3-keith.wiles@intel.com> <20181227100237.6ich3lvy4ydqtkxq@platinum> In-Reply-To: <20181227100237.6ich3lvy4ydqtkxq@platinum> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.104.98] Content-Type: text/plain; charset="us-ascii" Content-ID: <67BCD2B35A63D6448D922AB32DB4BCF7@intel.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 3/3] ring:add ring walk routine X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Dec 2018 14:47:39 -0000 > On Dec 27, 2018, at 4:02 AM, Olivier Matz wrote: >=20 > Hi, >=20 > On Sun, Dec 16, 2018 at 11:27:21AM -0600, Keith Wiles wrote: >> Add a ring walk routine for debugging and DFS. >>=20 >> Signed-off-by: Keith Wiles >> --- >> V3 >> Fix checkpatch warnings adding a commit message. >> Must be using a different checkpatch then on my Ubuntu 18.04 system=20 >> V2 >> Fix checkpatch warnings. >>=20 >> lib/librte_ring/rte_ring.c | 20 ++++++++++++++++++++ >> lib/librte_ring/rte_ring.h | 14 ++++++++++++++ >> lib/librte_ring/rte_ring_version.map | 7 +++++++ >> 3 files changed, 41 insertions(+) >>=20 >> diff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c >> index d215acecc..fb5819e4b 100644 >> --- a/lib/librte_ring/rte_ring.c >> +++ b/lib/librte_ring/rte_ring.c >> @@ -280,3 +280,23 @@ rte_ring_lookup(const char *name) >>=20 >> return r; >> } >> + >> +void >> +rte_ring_walk(void (*func)(struct rte_ring *r, void *arg), void *arg) >> +{ >> + const struct rte_tailq_entry *te; >> + struct rte_ring_list *ring_list; >> + >> + if (!func) >> + return; >> + >> + ring_list =3D RTE_TAILQ_CAST(rte_ring_tailq.head, rte_ring_list); >> + >> + rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK); >> + >> + TAILQ_FOREACH(te, ring_list, next) { >> + func((struct rte_ring *) te->data, arg); >> + } >> + >> + rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK); >> +} >=20 > In mempool, a FOREACH_SAFE() macro is using starting from this commit: > cae54ac47ced ("mempool: fix unsafe removal from list by callback") >=20 > Maybe the same should be done for the ring. I am not removing or modifying the ring tailq list here and I have the lock= already, why do I need to use _SAFE macro? >=20 >=20 >> diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h >> index af5444a9f..b9391a655 100644 >> --- a/lib/librte_ring/rte_ring.h >> +++ b/lib/librte_ring/rte_ring.h >> @@ -769,6 +769,20 @@ rte_ring_get_capacity(const struct rte_ring *r) >> */ >> void rte_ring_list_dump(FILE *f); >>=20 >> +/** >> + * Walk the list of ring entries and call the function provided >> + * >> + * @param func >> + * The function to call for each ring entry using the following proto= type >> + * void (*func)(struct rte_ring *r, void *arg) >> + * @param arg >> + * argument for the call to function >> + * @return >> + * None. >> + */ >=20 > I don't think we need to duplicate the prototype in the comment. Please > add the dots at the end of the sentences, and remove @return. >=20 >=20 > Thanks, > Olivier Regards, Keith