From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A2A46A04B7; Wed, 14 Oct 2020 12:43:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 869051C02A; Wed, 14 Oct 2020 12:42:05 +0200 (CEST) Received: from nat-hk.nvidia.com (nat-hk.nvidia.com [203.18.50.4]) by dpdk.org (Postfix) with ESMTP id A00EA1BEB7 for ; Wed, 14 Oct 2020 12:42:02 +0200 (CEST) Received: from HKMAIL104.nvidia.com (Not Verified[10.18.92.9]) by nat-hk.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Wed, 14 Oct 2020 18:42:01 +0800 Received: from HKMAIL102.nvidia.com (10.18.16.11) by HKMAIL104.nvidia.com (10.18.16.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 14 Oct 2020 10:42:00 +0000 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.106) by HKMAIL102.nvidia.com (10.18.16.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 14 Oct 2020 10:42:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XhaxXvRykhnksUMLgZFcYUxhnAh1VnfR6ILAKNzr9vYU9pek2o1KqzLzustsXYIXvQ65VN85NOSnkq07FNZnmAJHP2AAMW5SoATy1Et4d8ZP7ntD0pCDjqa7EWmJV9ZOS26aHnFWppHyf4e5UP4Q+kTJDKFYoXBsJOLwOnQpIIcCYzxbJ9uLum76a2I9vZNgvoaZrNxk5/VKipLm8tVwrVUhx8UYnuzrsVTln4lqHpHrgXJMLU+T44kFSejlN8pFDsvAsrZPHS74PGPAgyrcRhEaEgj1gWrh9dmsIo9thGtkpvBIcRtCo1yFDA0xoNKpjRQq9/jN42foU/RE382qJQ== 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:X-MS-Exchange-SenderADCheck; bh=Kx6KFfblLPBCeJdMkaZwa32vl8vE/QwljTfQS4Bu+Rk=; b=Ux56KJwwHWSPKHrF61VSNuOoH9c0TfFB4YQZFi6j1fZwP4mXLvK2XWeaFrdPEiiTZYvJtFJMZlTh+bpIbmXuleXSw9h7pMV+33Nnr3PlSZl1sUivH4ERspThLqZVAh2AUeYt+AVmPXlbhXcB7vIDoUvpMrkH0O0K9QfwlRxMFk5ERUXvIsHLdC94lYeSwu3ixlepNWyIo5v3nI+2Bpoky6QPpOjjfamZoZ46bggRC340yIbzqTt+eGPAfLdbfwefQFzrTnvmTIc25RPsiQSc/htA1Gh3TpKlrC6hFe9V0sKuzNngZA5Z9DDDqZpcG1Sxg8GHECBgEAEWaHsEiSZ8tQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none Received: from MWHPR12MB1743.namprd12.prod.outlook.com (2603:10b6:300:113::8) by MW3PR12MB4362.namprd12.prod.outlook.com (2603:10b6:303:5d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.21; Wed, 14 Oct 2020 10:41:57 +0000 Received: from MWHPR12MB1743.namprd12.prod.outlook.com ([fe80::59df:5b11:7957:cfc]) by MWHPR12MB1743.namprd12.prod.outlook.com ([fe80::59df:5b11:7957:cfc%6]) with mapi id 15.20.3477.020; Wed, 14 Oct 2020 10:41:57 +0000 From: Suanming Mou To: NBU-Contact-Thomas Monjalon CC: Ori Kam , Ferruh Yigit , "Andrew Rybchenko" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v4 2/2] ethdev: make rte_flow API thread safe Thread-Index: AQHWohOeeXG8Z63XKEGp8vappvD6camW6BhQ Date: Wed, 14 Oct 2020 10:41:57 +0000 Message-ID: References: <1601194817-208834-1-git-send-email-suanmingm@nvidia.com> <1602206243-157603-1-git-send-email-suanmingm@nvidia.com> <1602206243-157603-3-git-send-email-suanmingm@nvidia.com> <2778778.5oPTP038Qd@thomas> In-Reply-To: <2778778.5oPTP038Qd@thomas> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [60.176.163.235] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ab3c3d03-9d11-4dc6-8bff-08d8702dc65a x-ms-traffictypediagnostic: MW3PR12MB4362: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AYrr2Hye+lheyKYgykBcuQue8Zsi/X7ZKczP24/7tLAlFDX0agYff6CO/ykq9pmgVZw8uLVUWg3pyXtifHRK5+ODRxNU8+xLP2q96kKYNX0svLd9g6BOZ7YTgsZapRdC7MMOcm2pX6Sqm2i7LJXmOJxH/mC57G8ddRRtSd/+9LBM/Wp6wSxaqGO60oS/OJEcfZqwN5Wq/HQ4YJuHUBSfXyEv3yRvK3n7TvoPlqnqY+NyYwexHhTpvesHvnnUz1IuEFoUQ3ceREcE9n8N9TGFXWM64pj8b7GImmiHU8gWu3KrKjBpIVhOjuaQ7Swj+vvzK2faF1qygt9V5Dn1TVVCvw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR12MB1743.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(39860400002)(346002)(136003)(396003)(33656002)(66946007)(26005)(55016002)(8936002)(6916009)(186003)(71200400001)(6506007)(54906003)(7696005)(316002)(9686003)(53546011)(8676002)(86362001)(52536014)(66556008)(66446008)(66476007)(5660300002)(64756008)(76116006)(4326008)(2906002)(478600001)(83380400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: 5pO5qcsnjqSh62idlenfmwm/bOpm3gal2yq8nqTqG78K/urF5V0LdOfmFWo7be6zKt9dMBSPJmVI0R7vmTjFGVJL4eRfkCP/FRqkDRG2J/zYPoO1NcVkLoPWmBgTTjDhn+5vQAFdCXnjzYFWVRbaUVk91TQ27hkNJ3EG/lfl/OsyBnukpcBsTgmg1s9skqA9bgrNaEPHoyx+US307qOYHHJQ5sPQ8vNA29rkw0fjCQjV9t3Sk51X7lA5001LJ7hbovTLvHk8F4dNl+iIToGO071WdkjDh+uvBUIlN4/8Kp9YNUwOjmn42WCVpZKkEn4dVa87PBKTVDSKiRCoscdjzuGznV3SRP0OfcL0t2lsXwiacqhW8ocuhdNBoxGRL2Xuq4V/yCKuIHE/8p8Gsw3xsbWf0+BhZ/cdqEZo3alIRk8C4IKQuG/8YEGuF5SPkGrsH3NlPjULUsxs4w2JwILQm7OCKuMdXekaaAdViSIcTfsCdy6iYMXVTkEMZdIuh3sXAp2L0H/gJsWtg8M212FZ26hRX2HWFB4ywp0Ugl9eu29RRIxQ/xVMzke1gGeEGyfNPEUvazauXeRUidVYcIN9XcvHlJoLQsTvlrwNrAAYRI/JtcGVADUgwIU983272hEujHsMhPBlaTCzecIX+gFszQ== 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: MWHPR12MB1743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab3c3d03-9d11-4dc6-8bff-08d8702dc65a X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2020 10:41:57.4678 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0Ogyy6SynSEiMwvUV6u34dHdnBs/FvebDvenLRGw5HGjRzyfkwyHUCqNoRzlzJDVn/7MTQ0le88EsqfiVGLDBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4362 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1602672121; bh=Kx6KFfblLPBCeJdMkaZwa32vl8vE/QwljTfQS4Bu+Rk=; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To: CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References: In-Reply-To:Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:authentication-results:x-originating-ip: x-ms-publictraffictype:x-ms-office365-filtering-correlation-id: x-ms-traffictypediagnostic:x-ld-processed: x-ms-exchange-transport-forked:x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers:x-ms-exchange-senderadcheck: x-microsoft-antispam:x-microsoft-antispam-message-info: x-forefront-antispam-report:x-ms-exchange-antispam-messagedata: Content-Type:Content-Transfer-Encoding:MIME-Version: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; b=g7Xx5S+NhfEbwD65T9/aIuN/+lNk9oewin2D+FBJKwcQv7zMvZsD4XIXcFK1S8GLz 0HrxQ4apYphB3LgOtKoDrNN0zm9YSvgvKxn+NTWAMY9WlaVisyUBLQNXzDvvaRiNrB IMD3UQx2g228LWgyqtziJnN1j4c77E00EztIiFpWIPlMT+SBjvldtSVqs3oqa63Txo oMWLXngN6V6NwmystqkPpNWfBbrT6CXw03W9xhWfhYxX8oBigbr1d1Lq4lMm/84iYh eTFqPVcD9KsXT2UhCIq+kbC2mjkdv3pUXDO2qqXkwqUe5oXtZhl+MNfxkmqb1kQFvq pp6IDp/1CH8Qg== Subject: Re: [dpdk-dev] [PATCH v4 2/2] ethdev: make rte_flow API thread safe 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Thomas, Thanks, will update the next version when Windows mutex macro solution is c= onfirmed. BR, SuanmingMou > -----Original Message----- > From: Thomas Monjalon > Sent: Wednesday, October 14, 2020 6:19 PM > To: Suanming Mou > Cc: Ori Kam ; Ferruh Yigit ; An= drew > Rybchenko ; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v4 2/2] ethdev: make rte_flow API thread s= afe >=20 > 09/10/2020 03:17, Suanming Mou: > > --- a/doc/guides/prog_guide/rte_flow.rst > > +++ b/doc/guides/prog_guide/rte_flow.rst > > +If PMD interfaces do not support re-entrancy/multi-thread safety, > > +rte_flow >=20 > "API" should be inserted here to make clear which layer we talk about. >=20 > > +level functions will do it by mutex per port. The application can > > +test the >=20 > "do it" is too vague. I suggest "protect threads". >=20 > > +dev_flags with RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE in struct > > +rte_eth_dev_data >=20 > The application access it through dev_info. >=20 > > +to know if the rte_flow thread-safe works under rte_flow level or PMD = level. >=20 > Again insert "API": rte_flow API level >=20 > This sentence can be confusing. Better to say explicitly that if > RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE is set, it means the protection at API > level is disabled. >=20 > > +Please note that the mutex only protects rte_flow level functions, > > +other control path functions are not in scope. >=20 > Please find a complete rewording with sentences split after punctuation: >=20 > If PMD interfaces do not support re-entrancy/multi-thread safety, the rte= _flow > API functions will protect threads by mutex per port. > The application can check whether ``RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE`` > is set in ``dev_flags``, meaning the PMD is thread-safe regarding rte_flo= w, so the > API level protection is disabled. > Please note that this API-level mutex protects only rte_flow functions, o= ther > control path functions are not in scope. >=20 >=20 > [...] > > --- a/doc/guides/rel_notes/release_20_11.rst > > +++ b/doc/guides/rel_notes/release_20_11.rst > > @@ -109,6 +109,12 @@ New Features > > * Extern objects and functions can be plugged into the pipeline. > > * Transaction-oriented table updates. > > > > +* **Added thread safe support to rte_flow functions.** > > + > > + Added ``RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE`` device flag to indicate > > + if PMD support thread safe operations. If PMD doesn't set the flag, > > + rte_flow level functions will protect the flow operations with mutex. > > + >=20 > Should be sorted before drivers with other ethdev features if any. >=20 > [...] > > --- a/lib/librte_ethdev/rte_ethdev.h > > +++ b/lib/librte_ethdev/rte_ethdev.h > > +/** Device PMD supports thread safety flow operation */ >=20 > "Device" is useless > safety -> safe (adjective before "flow operation") >=20 > It becomes: > /** PMD supports thread-safe flow operations */ >=20 > > +#define RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE 0x0001 >=20 > OK for the name of the flag. >=20 > [...] > > --- a/lib/librte_ethdev/rte_ethdev_core.h > > +++ b/lib/librte_ethdev/rte_ethdev_core.h > > @@ -180,6 +183,7 @@ struct rte_eth_dev_data { > > * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags. > > */ > > > > + pthread_mutex_t fts_mutex; /**< rte flow ops thread safety mutex. */ >=20 > "ts" or "safety" is redundant for a mutex. > I suggest "flow_ops_mutex" as a name. >=20 >=20