From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C37A541CEC; Mon, 20 Feb 2023 14:45:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D67E4304A; Mon, 20 Feb 2023 14:45:47 +0100 (CET) Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) by mails.dpdk.org (Postfix) with ESMTP id 8459140395 for ; Mon, 20 Feb 2023 14:45:46 +0100 (CET) Received: by mail-vs1-f48.google.com with SMTP id df34so2657099vsb.6 for ; Mon, 20 Feb 2023 05:45:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1676900745; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=MWezySO1t6AuXsEE4EPG9ip0UqcXb27c9zXxpNkbtK8=; b=lgWIqO72nIZmdOFlEqsH/wb0l/jlb2ghM/JBgvXo59NfxweEUTg1h/bcLHeetPOCHj 2OSpP6rTPA4bUsWL5N3E2f0GiqA2SNmwU9BUE6hzNeSJAHa5VwF5IBaEbt/qYhexxTvO 0VZuxcYpSSkIHq1vaUdSrs8iHlJF158tNpClUMF9PMO6TIVuZzYdVXJOX0nNYz/Lxh+z wxuWc7eUTSeoAxt0NKy31FvkhfajY8liLnX4AiSD43CspmEExwfWSEqHuWBD2NsA5V7d 4XuhCurNjcMnRr2Nr3G/7j5ztX1dLwAPQ5lF6FrCAC8gmRVIN0yTfjh6/LkB4HohH+7D hLKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1676900745; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MWezySO1t6AuXsEE4EPG9ip0UqcXb27c9zXxpNkbtK8=; b=HVzr3uh36hUIXw6EmuDt6Ughuw/WWAPd49YTfmnjm8CN19jgNvRibasO8MZ97mv0Rz 0uwaFTA5yt+BvE2HGRZ7Cd9X/sGzapKyI2tGDRfkjg9Y3cFCznnkj8167Yh5/pgsa371 bnCDe2/1PIaJJG4982agkfZCDYSZRFufCdj3KPDMnSxpDzRkmNHQrwBIZbM/ScAGvf1K qFkgNayaMGQY7sa/kE7NcUO/wa1NtfEQdAqUEFd3BWHABPwyQfkgaNgDwAvosjnOOvee t/v8s8+yZpTJ3IqiqAhIuhd0Nabb80ge+NSQwAMY9fZ/YC5+1b3DY0h/6eT+S+0lSOwr yAeQ== X-Gm-Message-State: AO0yUKVygVHPb3/adX756lQpsa1MQIyposX1A0uGBB3/w2QcVzcFrmoi 5jFUkGjE1TDA9XEJdsLOs7iqQvDTi6nVdgtgpPs= X-Google-Smtp-Source: AK7set/e4KCwOAKexK1gEmGzHv6jBlZ2cWNGMBGZgGLV0bRj+urQh5ID0m5kOOa8pBbgX10Dd3Vzyg/aWEVL/UQvXyE= X-Received: by 2002:a05:6102:38d4:b0:3f0:89e1:7c80 with SMTP id k20-20020a05610238d400b003f089e17c80mr267598vst.72.1676900745458; Mon, 20 Feb 2023 05:45:45 -0800 (PST) MIME-Version: 1.0 References: <20221117050926.136974-1-zhirun.yan@intel.com> <20221117050926.136974-4-zhirun.yan@intel.com> In-Reply-To: <20221117050926.136974-4-zhirun.yan@intel.com> From: Jerin Jacob Date: Mon, 20 Feb 2023 19:15:19 +0530 Message-ID: Subject: Re: [PATCH v1 03/13] graph: add macro to walk on graph circular buffer To: Zhirun Yan Cc: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com, cunming.liang@intel.com, haiyue.wang@intel.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Nov 17, 2022 at 10:40 AM Zhirun Yan wrote: > > It is common to walk on graph circular buffer and use macro to make > it reusable for other worker models. > > Signed-off-by: Haiyue Wang > Signed-off-by: Cunming Liang > Signed-off-by: Zhirun Yan > --- > lib/graph/rte_graph_model_rtc.h | 23 ++--------------------- > lib/graph/rte_graph_worker_common.h | 23 +++++++++++++++++++++++ > 2 files changed, 25 insertions(+), 21 deletions(-) > +/** > + * Macro to walk on the source node(s) ((cir_start - head) -> cir_start) > + * and then on the pending streams > + * (cir_start -> (cir_start + mask) -> cir_start) > + * in a circular buffer fashion. > + * > + * +-----+ <= cir_start - head [number of source nodes] > + * | | > + * | ... | <= source nodes > + * | | > + * +-----+ <= cir_start [head = 0] [tail = 0] > + * | | > + * | ... | <= pending streams > + * | | > + * +-----+ <= cir_start + mask > + */ > +#define rte_graph_walk_node(graph, head, node) \ > + for ((node) = RTE_PTR_ADD((graph), (graph)->cir_start[(int32_t)(head)]); \ > + likely((head) != (graph)->tail); \ > + (head)++, \ > + (node) = RTE_PTR_ADD((graph), (graph)->cir_start[(int32_t)(head)]), \ This is an additional assignment compare to original while() based version. Right? No need to generalize with performance impact. > + (head) = likely((int32_t)(head) > 0) ? (head) & (graph)->cir_mask : (head)) > + > /** > * @internal > * > -- > 2.25.1 >