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 551CEA04B5; Wed, 30 Sep 2020 12:56:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 946C51D668; Wed, 30 Sep 2020 12:56:18 +0200 (CEST) Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by dpdk.org (Postfix) with ESMTP id 253F31D621 for ; Wed, 30 Sep 2020 12:56:16 +0200 (CEST) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Wed, 30 Sep 2020 03:55:24 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 30 Sep 2020 10:56:08 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.106) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 30 Sep 2020 10:56:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dOcmaunm69QbJC1GE7N6keuUOZMQ9upn89ncsTkdt9rajxHPQLybsnowT5m4f99JqMpqoAdLTGCmEQLSWbf9HlVajU6p8JTTvUTaXCMJ+PsgsHRw6taoCEUAVLMiF9uJrjY+DijRTs0TTjKWiPMck0V9yDj3o8IoLIauETDyGppZimIk8v/uwY4AW+lWFiDApwdRM2EEQccT48772JFQCuFoDLAGh30EmLs70S5CQA2vn1FD8AaSqeDUUsrIoCmxlNhRQ/6M2XrngDBigUlS/99rxHyVvJqcvwbIMMK4rymzaclTISIdXseVSppZPB98KipUmvIoD+1uR5RrlNrDog== 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=LtgJoOZ86vrB6jO4I/Et+McIKfLa3apAu6SVOxCc3RE=; b=ATahoFVeWnKz1ZYFdOqwmC25r9kAoSdN6/Rqe5QQvwUP9KNvlij8dHFrmYNnhPMqN9zcoVZOD+HSU2dBLCAIjMxvgnPor6q8lNCNGMoEuPvj9DWbnYZnQ/bD9kOd401aUBA3r+Z+fN1KOOKWN5lLap966medA9BeocXUnGvR5wlOjsS48jdxV3T6lx1yF3vZz7ofx4IeIxfbMB/QCFNdLimLcY28L4xf6y6gWjfBD0KALNHb/S9M0NS+eYKRj10AucJxki4bY4je7CdF86PTmXlhdUjDs8+/cRCGSoK3ju6UsbsbEFsCUUafy5HLW/sSrkWGIQpLSxpc60pWMr0y9g== 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 MN2PR12MB4286.namprd12.prod.outlook.com (2603:10b6:208:199::22) by MN2PR12MB4568.namprd12.prod.outlook.com (2603:10b6:208:260::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.32; Wed, 30 Sep 2020 10:56:06 +0000 Received: from MN2PR12MB4286.namprd12.prod.outlook.com ([fe80::61fd:a36e:cf4f:2d3f]) by MN2PR12MB4286.namprd12.prod.outlook.com ([fe80::61fd:a36e:cf4f:2d3f%8]) with mapi id 15.20.3433.035; Wed, 30 Sep 2020 10:56:06 +0000 From: Ori Kam To: Suanming Mou , Ori Kam , "John McNamara" , Marko Kovacevic , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , NBU-Contact-Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" Thread-Topic: [PATCH 2/2] ethdev: make rte flow API thread safe Thread-Index: AQHWlKcemW+kbmEp5EWpnvoOeBTw96mA+j5w Date: Wed, 30 Sep 2020 10:56:06 +0000 Message-ID: References: <1601194817-208834-1-git-send-email-suanmingm@nvidia.com> <1601194817-208834-3-git-send-email-suanmingm@nvidia.com> In-Reply-To: <1601194817-208834-3-git-send-email-suanmingm@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [147.236.152.129] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 16563c7b-a184-48af-fbd6-08d8652f6e9d x-ms-traffictypediagnostic: MN2PR12MB4568: 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:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5XMPDiGD+t2amEE3Y4VA2QgACIALW5AZwejWJ4Q3JMuTwlrraow9/kvqUIoiN29g9mZlkvdK5APBv7Nqc4J5S6o4SDqABeImEaD6rHDhghJ61dW4x1o0e8+bK38VmzHdjUZX3YVNfySXeihUu55fkN3h7DCD1O0Mc2P01RTAjZ+FuBSQQUa99j8+773/qeG/QwWxGK/EwiXCiUZ7GKdlcZV1hK2t8OLGadUrZbSkuSfTuHhbQtDjcvN34QfpciIYxKV6dOt6WMGuvTyKtr197pEDcu3QzBwdPv4rEbOs2hj+yEGF8LHtlQbJSuSmC9t6zC0U4yNl0n0YS9ottCWGrX+7Cc3ACB4jjLGu2Wa0wXgUWANhb9RxEo2XgJoFW2gS x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR12MB4286.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(39860400002)(366004)(136003)(396003)(83380400001)(186003)(5660300002)(52536014)(30864003)(478600001)(9686003)(316002)(2906002)(8936002)(7696005)(33656002)(110136005)(66476007)(66556008)(64756008)(66446008)(66946007)(86362001)(26005)(71200400001)(8676002)(4326008)(76116006)(55016002)(6506007)(921003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: 2xm50d+g68MacF4udcxpQBXOSyfEk4vZff8mdWaJDGGvh42vuEeYqHa3uoRkqtFwMIl3hFaenGPloGDac+PvU/cAPCTmNliCflKTpUoxfYkspkTfLpTYmsi8arMEEDua138hLOz7Wc8GysHd5ohMAMag40EZ2RGhGPpjaVfO6WJkQGKCCsZIdNxXhmh3aY6WCykXjwKoqaBcPo8x8BaxCSrehwGbPiAOuBdX3oCM5/I1CqjRkm158NLzsGYI4ytGzZKEoVlTpN91eY3i0bSA3NwkINgifrVOWiw8MTVN8fOSWMYq40Nh22H9+ifXKVpcX97KEC0x9Xa24fMcant8IC7tj9LJ9wfjsc+oBaH1PkzRIdXTKz5Or674eFs6eqtmWT6e7yh+8MQ+gzsmeR3lrANaEfU9gmfxmp6i2Xk6Cg59X+B8pIZqWADwlr4J5HMgG24M71CeEjaN7XLrJ6x7ozMj7DAs4RWuD72M/3DknpdfcE4Q8u5HShhgIhnZK206Y2Sztqdu5WvSWCD/I3LJixzMi/mLLM3UUmM+1SXoFRHCRX7Yk/Lu1+nEcfaNjnTH5adrIhX4V2u+KVn+AtbMdzBotzGisUxwNtM8rZ0ri1aCVM11CoZ4RFJkUj1LZ6csGoX6cHrUgM5QHghmOxib4w== 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: MN2PR12MB4286.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16563c7b-a184-48af-fbd6-08d8652f6e9d X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Sep 2020 10:56:06.4012 (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: FUhyQNmCdzORGk+COObwc6myfZ9GPkfJc+OQv7w8EqqJPWHDQXsmBFcQCa5cLqZGEiqXf4iiBaCr/QdMwbY5rQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4568 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1601463324; bh=LtgJoOZ86vrB6jO4I/Et+McIKfLa3apAu6SVOxCc3RE=; 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=EnpZK9zHQk+V6ZeDwmXj0NiIze5WQLh6KW3XXbzBU5rnzLqBfcD3R7MgHz5ets2w9 6kcUw3Vgmb632FHyKpt91rbO5goayzDSRXF33bVK4k+qpU/YWrG05AC23vgmqY1EKB rjImMQtRIBTkUDQ2zFZSTvUEDOjWJmoLzFQOPxYfaSS0s3Fhb2fyvVIDr1eCXIhXi6 orQOQH1283mFULt4MuxGD/9M8bCtYgdipFC6jZQ3VK8aMnesIuD+l8OAN/AbmYTM2u m1sr33SULA3Ag+ctCYwh7yTD2rUsB+uDRHwyoP5S55fPamJZbwLoTvSlHHweS7rX7o xHkMM0/AGNoJA== Subject: Re: [dpdk-dev] [PATCH 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 Suanming, Small comments, PSB, Best, Ori > -----Original Message----- > From: Suanming Mou > Sent: Sunday, September 27, 2020 11:20 AM > Cc: dev@dpdk.org > Subject: [PATCH 2/2] ethdev: make rte flow API thread safe >=20 > Currently, the rte flow functions are not defined as thread safety. For a given port. (between ports they are thread safe) > DPDK applications either call the functions in single thread or add > locks around the functions for the critical section. >=20 > For PMDs support the flow operations thread safe natively, the > redundant protection in application hurts the performance of the > rte flow operation functions. >=20 > And the restriction of thread safety not guaranteed for the rte > flow functions also limits the applications' expectation. >=20 > This feature is going to change the rte flow functions to be thread > safety. As different PMDs have different flow operations, some may Safety =3D> safe I think this is true also to other places in this patch. > support thread safety already and others may not. For PMDs don't > support flow thread safe operation, a new lock is defined in ethdev > in order to protects thread unsafe PMDs from rte flow level. >=20 > A new RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE device flag is added to > determine whether the PMD supports thread safe flow operation or not. > For PMDs support thread safe flow operations, set the > RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE flag, rte flow level functions will > skip the thread safe helper lock for these PMDs. Again the rte flow > level thread safe lock only works when PMD operation functions are > not thread safety. safe >=20 > For the PMDs which don't want the default mutex lock, just set the > flag in the PMD, and add the perfer type of lock in the PMD. Then > the default mutex lock is easily replaced by the PMD level lock. >=20 > The change has no effect on the current DPDK applications. No change > is required for the current DPDK applications. If no lock contention > with the added rte flow level mutex, the mutex only does the atomic > increasing in pthread_mutex_lock() and decreasing in > pthread_mutex_unlock(). No futex() syscall will be involved. >=20 > Signed-off-by: Suanming Mou > --- > doc/guides/prog_guide/rte_flow.rst | 7 ++-- > drivers/net/mlx5/linux/mlx5_os.c | 2 + > lib/librte_ethdev/rte_ethdev.c | 2 + > lib/librte_ethdev/rte_ethdev.h | 2 + > lib/librte_ethdev/rte_ethdev_core.h | 4 ++ > lib/librte_ethdev/rte_flow.c | 84 ++++++++++++++++++++++++++++---= ------ > 6 files changed, 78 insertions(+), 23 deletions(-) >=20 > diff --git a/doc/guides/prog_guide/rte_flow.rst > b/doc/guides/prog_guide/rte_flow.rst > index 119b128..6f7997a 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -3046,10 +3046,6 @@ Caveats > - API operations are synchronous and blocking (``EAGAIN`` cannot be > returned). >=20 > -- There is no provision for re-entrancy/multi-thread safety, although no= thing > - should prevent different devices from being configured at the same > - time. PMDs may protect their control path functions accordingly. > - > - Stopping the data path (TX/RX) should not be necessary when managing f= low > rules. If this cannot be achieved naturally or with workarounds (such = as > temporarily replacing the burst function pointers), an appropriate err= or > @@ -3101,6 +3097,9 @@ This interface additionally defines the following > helper function: > - ``rte_flow_ops_get()``: get generic flow operations structure from a > port. >=20 > +If PMD interfaces do not support re-entrancy/multi-thread safety, rte fl= ow > +level functions will do it by mutex. > + I think you should add which flag the app should test to see if the PMD support thread safe. > More will be added over time. >=20 > Device compatibility > diff --git a/drivers/net/mlx5/linux/mlx5_os.c > b/drivers/net/mlx5/linux/mlx5_os.c > index 2a4beb0..daefb7d 100644 > --- a/drivers/net/mlx5/linux/mlx5_os.c > +++ b/drivers/net/mlx5/linux/mlx5_os.c > @@ -1351,6 +1351,8 @@ > goto error; > } > } > + if (priv->config.dv_flow_en) > + eth_dev->data->dev_flags =3D > RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE; > return eth_dev; I don't think this code is relevant for this patch. I also think you are missing the | when assigning the value. > error: > if (priv) { > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index dfe5c1b..d6fd17e 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -500,6 +500,7 @@ struct rte_eth_dev * > strlcpy(eth_dev->data->name, name, sizeof(eth_dev->data->name)); > eth_dev->data->port_id =3D port_id; > eth_dev->data->mtu =3D RTE_ETHER_MTU; > + pthread_mutex_init(ð_dev->data->fts_mutex, NULL); >=20 > unlock: > rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock); > @@ -562,6 +563,7 @@ struct rte_eth_dev * > rte_free(eth_dev->data->mac_addrs); > rte_free(eth_dev->data->hash_mac_addrs); > rte_free(eth_dev->data->dev_private); > + pthread_mutex_destroy(ð_dev->data->fts_mutex); > memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data)); > } >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethde= v.h > index 645a186..61bd09f 100644 > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > @@ -1669,6 +1669,8 @@ struct rte_eth_dev_owner { > #define RTE_ETH_DEV_REPRESENTOR 0x0010 > /** Device does not support MAC change after started */ > #define RTE_ETH_DEV_NOLIVE_MAC_ADDR 0x0020 > +/** Device PMD supports thread safety flow operation */ > +#define RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE 0x0040 >=20 > /** > * Iterates over valid ethdev ports owned by a specific owner. > diff --git a/lib/librte_ethdev/rte_ethdev_core.h > b/lib/librte_ethdev/rte_ethdev_core.h > index fd3bf92..89df65a 100644 > --- a/lib/librte_ethdev/rte_ethdev_core.h > +++ b/lib/librte_ethdev/rte_ethdev_core.h > @@ -5,6 +5,9 @@ > #ifndef _RTE_ETHDEV_CORE_H_ > #define _RTE_ETHDEV_CORE_H_ >=20 > +#include > +#include > + > /** > * @file > * > @@ -180,6 +183,7 @@ struct rte_eth_dev_data { > * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags. > */ >=20 > + pthread_mutex_t fts_mutex; /**< rte flow ops thread safety mutex. */ > uint64_t reserved_64s[4]; /**< Reserved for future fields */ > void *reserved_ptrs[4]; /**< Reserved for future fields */ > } __rte_cache_aligned; > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index f8fdd68..ca80b12 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -207,6 +207,20 @@ struct rte_flow_desc_data { > return -rte_errno; > } >=20 > +static void > +flow_lock(struct rte_eth_dev *dev) > +{ > + if (!(dev->data->dev_flags & > RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE)) > + pthread_mutex_lock(&dev->data->fts_mutex); > +} Why not inline function? Also I don't think you should check the PMD support in this function when this function is called it should lock. > + > +static void > +flow_unlock(struct rte_eth_dev *dev) > +{ > + if (!(dev->data->dev_flags & > RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE)) > + pthread_mutex_unlock(&dev->data->fts_mutex); > +} Same comments as above. > + > static int > flow_err(uint16_t port_id, int ret, struct rte_flow_error *error) > { > @@ -346,12 +360,16 @@ struct rte_flow_desc_data { > { > const struct rte_flow_ops *ops =3D rte_flow_ops_get(port_id, error); > struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > + int ret; >=20 > if (unlikely(!ops)) > return -rte_errno; > - if (likely(!!ops->validate)) > - return flow_err(port_id, ops->validate(dev, attr, pattern, > - actions, error), error); > + if (likely(!!ops->validate)) { > + flow_lock(dev); > + ret =3D ops->validate(dev, attr, pattern, actions, error); > + flow_unlock(dev); > + return flow_err(port_id, ret, error); > + } > return rte_flow_error_set(error, ENOSYS, > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, rte_strerror(ENOSYS)); > @@ -372,7 +390,9 @@ struct rte_flow * > if (unlikely(!ops)) > return NULL; > if (likely(!!ops->create)) { > + flow_lock(dev); > flow =3D ops->create(dev, attr, pattern, actions, error); > + flow_unlock(dev); > if (flow =3D=3D NULL) > flow_err(port_id, -rte_errno, error); > return flow; > @@ -390,12 +410,16 @@ struct rte_flow * > { > struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > const struct rte_flow_ops *ops =3D rte_flow_ops_get(port_id, error); > + int ret; >=20 > if (unlikely(!ops)) > return -rte_errno; > - if (likely(!!ops->destroy)) > - return flow_err(port_id, ops->destroy(dev, flow, error), > - error); > + if (likely(!!ops->destroy)) { > + flow_lock(dev); > + ret =3D ops->destroy(dev, flow, error); > + flow_unlock(dev); > + return flow_err(port_id, ret, error); > + } > return rte_flow_error_set(error, ENOSYS, > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, rte_strerror(ENOSYS)); > @@ -408,11 +432,16 @@ struct rte_flow * > { > struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > const struct rte_flow_ops *ops =3D rte_flow_ops_get(port_id, error); > + int ret; >=20 > if (unlikely(!ops)) > return -rte_errno; > - if (likely(!!ops->flush)) > - return flow_err(port_id, ops->flush(dev, error), error); > + if (likely(!!ops->flush)) { > + flow_lock(dev); > + ret =3D ops->flush(dev, error); > + flow_unlock(dev); > + return flow_err(port_id, ret, error); > + } > return rte_flow_error_set(error, ENOSYS, > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, rte_strerror(ENOSYS)); > @@ -428,12 +457,16 @@ struct rte_flow * > { > struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > const struct rte_flow_ops *ops =3D rte_flow_ops_get(port_id, error); > + int ret; >=20 > if (!ops) > return -rte_errno; > - if (likely(!!ops->query)) > - return flow_err(port_id, ops->query(dev, flow, action, data, > - error), error); > + if (likely(!!ops->query)) { > + flow_lock(dev); > + ret =3D ops->query(dev, flow, action, data, error); > + flow_unlock(dev); > + return flow_err(port_id, ret, error); > + } > return rte_flow_error_set(error, ENOSYS, > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, rte_strerror(ENOSYS)); > @@ -447,11 +480,16 @@ struct rte_flow * > { > struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > const struct rte_flow_ops *ops =3D rte_flow_ops_get(port_id, error); > + int ret; >=20 > if (!ops) > return -rte_errno; > - if (likely(!!ops->isolate)) > - return flow_err(port_id, ops->isolate(dev, set, error), error); > + if (likely(!!ops->isolate)) { > + flow_lock(dev); > + ret =3D ops->isolate(dev, set, error); > + flow_unlock(dev); > + return flow_err(port_id, ret, error); > + } > return rte_flow_error_set(error, ENOSYS, > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, rte_strerror(ENOSYS)); > @@ -1224,12 +1262,16 @@ enum rte_flow_conv_item_spec_type { > { > struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > const struct rte_flow_ops *ops =3D rte_flow_ops_get(port_id, error); > + int ret; >=20 > if (unlikely(!ops)) > return -rte_errno; > - if (likely(!!ops->dev_dump)) > - return flow_err(port_id, ops->dev_dump(dev, file, error), > - error); > + if (likely(!!ops->dev_dump)) { > + flow_lock(dev); > + ret =3D ops->dev_dump(dev, file, error); > + flow_unlock(dev); > + return flow_err(port_id, ret, error); > + } > return rte_flow_error_set(error, ENOSYS, > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, rte_strerror(ENOSYS)); > @@ -1241,12 +1283,16 @@ enum rte_flow_conv_item_spec_type { > { > struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > const struct rte_flow_ops *ops =3D rte_flow_ops_get(port_id, error); > + int ret; >=20 > if (unlikely(!ops)) > return -rte_errno; > - if (likely(!!ops->get_aged_flows)) > - return flow_err(port_id, ops->get_aged_flows(dev, contexts, > - nb_contexts, error), error); > + if (likely(!!ops->get_aged_flows)) { > + flow_lock(dev); > + ret =3D ops->get_aged_flows(dev, contexts, nb_contexts, error); > + flow_unlock(dev); > + return flow_err(port_id, ret, error); > + } > return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, rte_strerror(ENOTSUP)); > -- > 1.8.3.1