From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55370C433F5 for ; Fri, 29 Oct 2021 13:58:45 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id E121061100 for ; Fri, 29 Oct 2021 13:58:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E121061100 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 38ABB41136; Fri, 29 Oct 2021 15:58:44 +0200 (CEST) Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by mails.dpdk.org (Postfix) with ESMTP id 9A5F1410E1 for ; Fri, 29 Oct 2021 15:58:42 +0200 (CEST) Received: by mail-io1-f46.google.com with SMTP id v65so12638800ioe.5 for ; Fri, 29 Oct 2021 06:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Z5acLUMzKg+iLCJA/C1XvghpudaZCMbja22NIA5tkEM=; b=BPo+XllG5tE/ogKF0K0nWAoktX54qcHCzfTFhWaiNVw313hjf4Ag5MW+vmkfAI4S9I kBh6pnvtb/hBXQVAnywYRBDve6+yHmLdSw/D1Hd9gfan5uyV+d+fCtMGF9nHE0ai6Y2C NZZOvfIveOaIN4Y6Aq27pt3A0rGuZ2lh37GrK22mkhmmUPET9girvuRyACy02sPst6xt dbpnsySqpYjjup/QQflcb9iZs0KdGMNopuvvmHraxmknjdDf21PMSyDYjJxNC07RIlat MZEmcZSkdJz448YHbSLJZVvqDgsIj4iFjJVe4ReEX0Lrd4GoZtYY1+N+Q5WvtvxOB2FE fjYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Z5acLUMzKg+iLCJA/C1XvghpudaZCMbja22NIA5tkEM=; b=haejTODvGGGIc93C3uLhHgVPuIbuQqZHWIZc2RoKSxC/xd8MnA/3k4NIUslibTcYwc wJcccmZj+OQqIQXx/4RpqmmnyQyfYUOzt0kIuvpCcF+GNAgvADZAHGTIlsqHQryJeD+o Vn0/TsHP21/1fLPczg5v/qZQ1elDyEPsAjGtWm49v2upqrd1UkCBzxgJk9dXb7GfXopf J0kCtaPioKnN/Vdx3MACrYfpkDmRfiyhxgWcZSFOkbBBPosi4eY7e1A9ymy4tJOrjoNz Rf8zxeNq70NUQqqKz4xpuhJTDqpTbXH8jUvwfNlo0DXoeQ0+YU7EUjgo9Bn20cbsyBCH ydEQ== X-Gm-Message-State: AOAM530unj3tKGHr4tks5T2Y3KVnuX2GWmPifjHGKnhjBmPvPNuuwhWO Cbw2kLowqj3yXpX0PaelyJtEJtkygsa9X+HKFH0= X-Google-Smtp-Source: ABdhPJz8rBnRZoB3Se6eZTY1EnCJIT8KrgdHzydCvGwCSL51gSzSt1n5HkucHpM5dObFALVboHU8tw7wu+M9oX6OuTQ= X-Received: by 2002:a05:6602:2dd4:: with SMTP id l20mr8626648iow.151.1635515922012; Fri, 29 Oct 2021 06:58:42 -0700 (PDT) MIME-Version: 1.0 References: <20210902053253.3017858-1-feifei.wang2@arm.com> <20211029082021.945586-1-feifei.wang2@arm.com> <20211029082021.945586-6-feifei.wang2@arm.com> In-Reply-To: <20211029082021.945586-6-feifei.wang2@arm.com> From: Jerin Jacob Date: Fri, 29 Oct 2021 19:28:16 +0530 Message-ID: To: Feifei Wang Cc: David Hunt , dpdk-dev , nd , Stephen Hemminger , David Marchand , Thomas Monjalon , =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , "Ananyev, Konstantin" , Ruifeng Wang Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v8 5/5] lib/distributor: use wait event scheme 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 Sender: "dev" On Fri, Oct 29, 2021 at 1:50 PM Feifei Wang wrote: > > Instead of polling for bufptr64 to be updated, use > wait event for this case. > > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang With the change in the subject as distributor: ... Probably can be fixed in merge time. Acked-by: Jerin Jacob > --- > lib/distributor/rte_distributor_single.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/lib/distributor/rte_distributor_single.c b/lib/distributor/rte_distributor_single.c > index f4725b1d0b..d52b24a453 100644 > --- a/lib/distributor/rte_distributor_single.c > +++ b/lib/distributor/rte_distributor_single.c > @@ -33,9 +33,8 @@ rte_distributor_request_pkt_single(struct rte_distributor_single *d, > union rte_distributor_buffer_single *buf = &d->bufs[worker_id]; > int64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS) > | RTE_DISTRIB_GET_BUF; > - while (unlikely(__atomic_load_n(&buf->bufptr64, __ATOMIC_RELAXED) > - & RTE_DISTRIB_FLAGS_MASK)) > - rte_pause(); > + rte_wait_event(&buf->bufptr64, RTE_DISTRIB_FLAGS_MASK, > + !=, 0, __ATOMIC_RELAXED); > > /* Sync with distributor on GET_BUF flag. */ > __atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE); > @@ -74,9 +73,8 @@ rte_distributor_return_pkt_single(struct rte_distributor_single *d, > union rte_distributor_buffer_single *buf = &d->bufs[worker_id]; > uint64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS) > | RTE_DISTRIB_RETURN_BUF; > - while (unlikely(__atomic_load_n(&buf->bufptr64, __ATOMIC_RELAXED) > - & RTE_DISTRIB_FLAGS_MASK)) > - rte_pause(); > + rte_wait_event(&buf->bufptr64, RTE_DISTRIB_FLAGS_MASK, > + !=, 0, __ATOMIC_RELAXED); > > /* Sync with distributor on RETURN_BUF flag. */ > __atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE); > -- > 2.25.1 >