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 8673AA0C41; Fri, 24 Sep 2021 20:07:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F53441305; Fri, 24 Sep 2021 20:07:51 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id B783D412F8; Fri, 24 Sep 2021 20:07:48 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10117"; a="287801963" X-IronPort-AV: E=Sophos;i="5.85,320,1624345200"; d="scan'208";a="287801963" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2021 11:07:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,320,1624345200"; d="scan'208";a="654108488" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga005.jf.intel.com with ESMTP; 24 Sep 2021 11:07:47 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 24 Sep 2021 11:07:47 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 24 Sep 2021 11:07:46 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Fri, 24 Sep 2021 11:07:46 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.48) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Fri, 24 Sep 2021 11:07:46 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WYlE1TCW1a5NYX0jrzJE8Oi1Wj4yLVA8SYZpNGnRcKEshsCYehWw+yiMVWJYxl41pJ+6FUzZjyZw3oIW12Fvh7FyS0i6Fo+/UDth8SC+Sd9IeK/5mLAyx8MR1C32YcHR30bQ/5qHcRgTxolwj/BZ9iDknO4v3WHsPDhX+lq/BenclaNrIus2YMJMvwc84hJwlgQ54J1fBKRZRK7xqKaohYzFlgdVfvK40otCQi/fS/LsbSmmoMo2V3G6rXDKhL1duKpgy3mB7azeWvdHSozy5YUKH4cu+y1M9HDKCnzCAhFiZPfutzCaLyYSJ/X/nPrhBZFGRaEQY3zMlbqNcgZ0bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1H6rtkUOws2PLBqS4skDR7+NMrKqZdxxqRZNifvHadY=; b=MitC9T0MvDi/1H/35Nyglpmm9xW57GzhYPGOMlw1eRLV+1VkhusU+eevnSPuYHwl3NJnAVl+L/meVny1rZGxTO+jmdwnRnr+yd4tHRwVaXxgcmxc69GGU5rtUdV3GlNiMDNzTTfiY4M++A3YbOGFq5/+74929XuMo4i2J0BetEcGxp67pJSMxgL0GjqdAigQXK/YEvcWXOP6DW/kzw6OGYqa8yGCnwJNWtxbBSTLp2d7aJXBw5osyuluLhxS67VQMNLB5GpTwA46b5cjQqxlKozzStaJmjMWABBXYG0XPVdqik9GcOoVVvvoS/JxY+3I1Y74J/K6WiZ9XEQ0YbYifg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1H6rtkUOws2PLBqS4skDR7+NMrKqZdxxqRZNifvHadY=; b=W3h87AEXni1z/c2RdfS5eU/9mjrXFo4ePzqPaiwKxcSXv9zb5SvoMopPyo/JrqGquWRmSdvx7DK50D8dPCPz+Z5XhSqV7lxji4TBlcRy07PcFAAUpPjV3QolcsaEl83RGjAzOmiYpWgmE8qSGjucdvQFUnAMIKJ33pjIGhx4D/E= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM6PR11MB3228.namprd11.prod.outlook.com (2603:10b6:5:5a::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.18; Fri, 24 Sep 2021 18:07:45 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd%4]) with mapi id 15.20.4544.018; Fri, 24 Sep 2021 18:07:45 +0000 From: "Ananyev, Konstantin" To: Feifei Wang , "Yigit, Ferruh" CC: "dev@dpdk.org" , "nd@arm.com" , "stable@dpdk.org" , Ruifeng Wang Thread-Topic: [RFC PATCH v2 4/5] lib/bpf: use wait event scheme for Rx/Tx iteration Thread-Index: AQHXsGGzpEe3/d4nqEyYPt7mtKNipauze/Mw Date: Fri, 24 Sep 2021 18:07:45 +0000 Message-ID: References: <20210902053253.3017858-1-feifei.wang2@arm.com> <20210923095902.301762-1-feifei.wang2@arm.com> <20210923095902.301762-5-feifei.wang2@arm.com> In-Reply-To: <20210923095902.301762-5-feifei.wang2@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 70e115f7-65f7-43db-3555-08d97f8635f1 x-ms-traffictypediagnostic: DM6PR11MB3228: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: sRK420UF0ztLWCnIp2mlqWdLeCz0o1h94OUKBi1IdmbJVVF3elcNxcClXMPCAiU8yBtkjQdoJe9idWBGcohpoqLvuXDgneEXCQ99tJB0zABRxodPYE8PErajuNEvXnmMaA/Y60VJxWIFE4GtIn/NktUMAxe/8TtmhQ6NN5XYSOhRtO4wLmM0cSJR1FNGphlsNf3yENKqWYWo+Fildf7uhTUp1IowzSaas6uDGPNT8FBWCymUuswxtaQZpWRt4G2vHC+8jwUZUHPlpFiSIRpBtQgfc88ezRSGmmzimIxPeXqfo6bt8TgL1OpyRI85vNGI45MQvVANdnouzRM9eVwjPn5Uu+JZnD+6Qn5tAtoLuxDw3oDR6d0UqBHNc9H/lBvHRUzaGH3iUcy+r9bpaVbiFxLGqPWSzBNK9iHu2dxyeUKn/ReIORXYLoXVwPNb8lvxewZXoGfz665XSrbMD59IsFYc+lKHSO8U6eCPR95bl/MfEB1D4yWmYcS06MpHvWDStwGgl2EEcgdSb/gu6zSgfIY6KWMtWLAsMIZdamfl2gDmlNW0JRGMKXlxKSjqpSs1SWTX+qtxRxjcjQNu6A5BZdOPDFE/bOGS1sUUCRVQxHQSjjLALqklBTYnUqD/kFJrl3SIHExRkH+hv+8eBPI+xdZmsTzfbcO80mM+7w0q1cy0TN6H6V0UmIQ20XrRBXuWRqtCh2RlM2Z4DoWNlotUNg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(2906002)(66556008)(52536014)(38100700002)(186003)(4326008)(66476007)(8936002)(66446008)(54906003)(38070700005)(9686003)(5660300002)(64756008)(8676002)(316002)(76116006)(110136005)(26005)(71200400001)(83380400001)(86362001)(55236004)(55016002)(6506007)(122000001)(6636002)(33656002)(66946007)(508600001)(7696005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?th+AMAyL8S6ZTZorIPpwKDLFGnbFSkd4yiCzWpkBmiXb9LlIqxG0a+Nj3M3g?= =?us-ascii?Q?lfs+Dd9IiIQqO8ptRC4dQF3fUb/HZNPk92b5SGybm9m2ue1EhoY0DvSLa9as?= =?us-ascii?Q?P3h+IEnsC6gQ/0XJzh1vowhY+2L2osik3EaPl0/vjXFswJHCLOCbTmHpxLpm?= =?us-ascii?Q?V7/I8VzSvsSaIXQ9x5xOro/BcIzutTaf8luGztiWxbfabXkttoK9nQUSg4wF?= =?us-ascii?Q?oOm77FITTGmmq3NAyemMaGiUocbPoYz6Iq7L2sFCfwny57PKtkyP34oe3Qoh?= =?us-ascii?Q?Kcsca5IY7I5Qt7k72UVD05RYlmYckND/sNQSxo6l4T0n+AhOfFOwHDJKB/X5?= =?us-ascii?Q?52JBy6QHu5HSqH9MtfxvmJnmioHQL39BMMSfDmY6O8APsFl00t5hk7wJ5251?= =?us-ascii?Q?5L2QUYxZYIRfZAKooIiw5NYZy9q6yCXJ0ZBPmUTQLjFB90gndB+u1+Gir4qz?= =?us-ascii?Q?+SAZ67D3RFQ/ZXmE+EcRFc/1Y6ZduUu3sjBiHgzM8cEoThF70Bp+gWV0+fwe?= =?us-ascii?Q?WgLsvmAbmGeVwmtdk1XWgVCqgNQ4CHifWEmuZOV+al2A3FoiWjsnyE/Tmrvs?= =?us-ascii?Q?iDgdKYOp8K/hDtVtLBrD0etN8opay1SdBbvwAMbwSExFYZPHB+xVviZ8psUI?= =?us-ascii?Q?MMGVAkvsgJ1Yi01m1RPjv9ZhIsJvmP4AD087dtqCbyR5+orw+Qvlmz95fQ+8?= =?us-ascii?Q?HU2IH6TmTEfPFM6X9/JJYArbLTm2RsugW4WPu/+4bZOrsi13Q+8+GqcRxuYg?= =?us-ascii?Q?0EwwR2tRlY15KmxkB2WK5cP0Ob1ZRxc5AnuX+zxS7kbNHaL6z66Ygd7dhjul?= =?us-ascii?Q?rJ0wwxPNFJuEfRZndGhO3jQxPrVppiOuH95KCZp3FQ5V1X1gg3aEOQu3eNFs?= =?us-ascii?Q?3Dm9JOYZs6U4qG+vfZseIp4BTcwsLeCqaXXpAocCl5UA+NvENvTl2NW77+k4?= =?us-ascii?Q?Sb6sSL6iZokA+79sNu1c9pECvwVde67zFAXPLO9n++QyxLRY+gLcR1bVTQPT?= =?us-ascii?Q?6GQCn+Pvx44c0H5I84Cr0DBqH35jrMBa3G+KSWAmo0lTz9CDiQ8pCdjP7u5A?= =?us-ascii?Q?tMpaIVVzAFLZExeBhLlU1C8/588gKhUcWd5a1v4uV4A5ot7FVtN5axMlDk1q?= =?us-ascii?Q?R/94wCPXH67xi2jH8zP41VNTuByFL9WLPwBNipc5VCdTmroZoR5ZMfzu0zFx?= =?us-ascii?Q?+Cnk9ljQ6/FRqEgU08P7fXy99onPH5BiFXpf/XkpSvHOec6PgsKKVJOEyx6M?= =?us-ascii?Q?JlrhKA3Woq9Zz87kTnCtFAt5p55Xpcp8NBiH408TWTR22wpL5fBmEhEQWyL/?= =?us-ascii?Q?/pND5fk8e+PzqP6VnipLMnmz?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70e115f7-65f7-43db-3555-08d97f8635f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2021 18:07:45.5732 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WmYy9BpEA0T4OKSmemXgbmWR5fVoqHMu3jkhMwfZIvx9/KY6NRHHvTIluUuzEjM52umkLrvI4qlALbPzz4JycGMVoqOXAf05KE5A072v5nc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3228 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [RFC PATCH v2 4/5] lib/bpf: use wait event scheme for Rx/Tx iteration 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" >=20 > First, fix the bug that keyword const of func arg should be after "*". I believe there is no bug here. > This is because const before "*" means the value of "cbi" should not be > changed.=20 Exactly, it says that the function itself will not change the value of "cbi= ". It just waits for the value to be changed by someone else. So please keep parameter list intact. > But we should monitor that cbi->use changed and then we can > jump out of loop. >=20 > Second, instead of polling for cbi->use to be updated, use > wait event scheme. >=20 > Fixes: a93ff62a8938 ("bpf: introduce basic Rx/Tx filters") > Cc: konstantin.ananyev@intel.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang > --- > lib/bpf/bpf_pkt.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) >=20 > diff --git a/lib/bpf/bpf_pkt.c b/lib/bpf/bpf_pkt.c > index 6e8248f0d6..08ed8ff68c 100644 > --- a/lib/bpf/bpf_pkt.c > +++ b/lib/bpf/bpf_pkt.c > @@ -111,9 +111,9 @@ bpf_eth_cbi_unuse(struct bpf_eth_cbi *cbi) > * Waits till datapath finished using given callback. > */ > static void > -bpf_eth_cbi_wait(const struct bpf_eth_cbi *cbi) > +bpf_eth_cbi_wait(struct bpf_eth_cbi *const cbi) > { > - uint32_t nuse, puse; > + uint32_t puse; >=20 > /* make sure all previous loads and stores are completed */ > rte_smp_mb(); > @@ -122,11 +122,8 @@ bpf_eth_cbi_wait(const struct bpf_eth_cbi *cbi) >=20 > /* in use, busy wait till current RX/TX iteration is finished */ > if ((puse & BPF_ETH_CBI_INUSE) !=3D 0) { > - do { > - rte_pause(); > - rte_compiler_barrier(); > - nuse =3D cbi->use; > - } while (nuse =3D=3D puse); > + rte_compiler_barrier(); > + rte_wait_event_32(&cbi->use, UINT_MAX, puse, =3D=3D, __ATOMIC_RELAXED)= ; > } > } >=20 > -- > 2.25.1