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 742DEA0562; Mon, 30 Mar 2020 10:02:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4A9C91C02D; Mon, 30 Mar 2020 10:02:53 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 681701BFD4 for ; Mon, 30 Mar 2020 10:02:51 +0200 (CEST) IronPort-SDR: IuhICTsLmLMl8ePpKZGMzdXeRHyxP39PQUuq60MQ3mefGP7kuWjVCT4qXuGnjTEkty7nAgR5+c vHPuRjUvlfcw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2020 01:02:50 -0700 IronPort-SDR: oNrGm8MsyLd9v049s8H1/e/dlVx9Q7PI5RsrRfEufeRxgZD4kqvRv8OuPWgh+ZXnERhrQWx9zk z0ZN+aKLOA1g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,323,1580803200"; d="scan'208";a="248626293" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 30 Mar 2020 01:02:50 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 30 Mar 2020 01:02:50 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 30 Mar 2020 01:02:49 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.56) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 30 Mar 2020 01:02:49 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F15Llh9NEy4wpeLeVtw8/A9hIKcp5syVdzHDxUQ7UK83Zg/nqDGPdK45JBCUK2+6Da79eFFl/Tv7TG0OPrY1ZujmO4aiJ+SxOMkDHNh0fe0oieGF3tSf/JvTYSG3Kr/n13Eu+14TROLTp8ZPTYR9VRqKC00BQ7m64l+KVMeFwNf9VXc3UBLrIIHx+TXLmFlx1reEi87ECYg1UFT+bGXqt0VunE78e0cecRlrj6LIb7CgYlZfg9Or8LhEXxOUR2BLuX4tWRJVdLWOiopk9/T0YvsbbUO3EsuURHcNjZcHZSoEbUj56aMAQbSltAwDLJPjkga1uvVhb0G+SlyRHHi/sg== 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=4TTqY/TNpxve3E5AVmDpXGI9AWkwc81pAMo1QKQNZ74=; b=l+RudhFn4SydO96wLiDyZ0cS162v7nr6oojlGwhFVkNtZkNS4qZIGLYNyyeapYXhEl/6SpAumBuI3O6Pd8Llqbr/ClKGBnFNJDIUCNBVm0QvhX87aNiUtCu7JG7L7eZgKHNyOE+shOmWtB7cK+d79npiX9eK6xUN2NWDa4ya380OcNvelthXuHH4kHMSfd1df0PPZuegYl8cQcS7Vl/roxQaCLFsdXrBWLuMC9fSVrdXm9yyY0TvZEO3iIMdn/wcCv8JVbC0cFq/wlTxuE60uhKAQ7X9VFpheqXODaDhdXagy8g+8vp+G/U1umcRN3Y1ncWLROBAUT0wPnrubqvZcw== 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=4TTqY/TNpxve3E5AVmDpXGI9AWkwc81pAMo1QKQNZ74=; b=pHn6seSOHt8+ckvqcXD2Ji3ZaM3XdFnnlF6MNcTKkqO5qZkeoPPY9butoVBQv094LkXCFsu27ql/AsyvzfAUstXiXEGW8bnhOgVVkPlPDjGieKsDMH/rDKHw9j8xJG8L/tPXYXk3AG9ME2uYdxDUdwEfBL1i5+Y2N8g3rc+006I= Received: from MN2PR11MB3582.namprd11.prod.outlook.com (2603:10b6:208:ec::28) by MN2PR11MB4192.namprd11.prod.outlook.com (2603:10b6:208:13f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Mon, 30 Mar 2020 08:02:48 +0000 Received: from MN2PR11MB3582.namprd11.prod.outlook.com ([fe80::f091:55f5:2e58:8b26]) by MN2PR11MB3582.namprd11.prod.outlook.com ([fe80::f091:55f5:2e58:8b26%6]) with mapi id 15.20.2856.019; Mon, 30 Mar 2020 08:02:48 +0000 From: "Yang, Qiming" To: "Xing, Beilei" , "dev@dpdk.org" , "Wang, Haiyue" , "Zhang, Qi Z" Thread-Topic: [PATCH] net/ice: support flow ops thread safe Thread-Index: AQHWBmeMckoPdums0kSLjJ5VDQuskKhgxjNw Date: Mon, 30 Mar 2020 08:02:47 +0000 Message-ID: References: <1585586570-9956-1-git-send-email-beilei.xing@intel.com> In-Reply-To: <1585586570-9956-1-git-send-email-beilei.xing@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=qiming.yang@intel.com; x-originating-ip: [192.102.204.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 22439d0c-c60b-4b54-3f3f-08d7d480bc98 x-ms-traffictypediagnostic: MN2PR11MB4192: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 0358535363 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB3582.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10019020)(376002)(366004)(136003)(39860400002)(396003)(346002)(6506007)(9686003)(7696005)(5660300002)(53546011)(71200400001)(8676002)(33656002)(478600001)(110136005)(186003)(55016002)(26005)(64756008)(8936002)(66476007)(66556008)(316002)(6636002)(76116006)(52536014)(66446008)(86362001)(81166006)(2906002)(81156014)(66946007); DIR:OUT; SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: YRWIz65wqPzq+dl7eGS8CfTf+GkNYenhP/xUqFyrK36YnOS26sRe6RWAU4DDWfyzMPWeTnKQHMfSeNLJYUZt6qxPhM+r7Uh+D18y0E1Xwp4IIdRIGD5Utuvq7MrIGSCtS8p9MWu870S/Xrj8RGakLMO4kAcjo2wpez6QrI46CYYoGywF+eBOnt27Zvbz0oLspGXqEvwkKk/y7FBrXR34cgoI1J7pkSaPOTQ27CN+RGZ5VdFXHlccpJo2dj6/j7nWFcAY6r3rugtaNsgjSqnoNE+pYIGy/4MOsi53+AhsXOqEQOC0vYC4Gc/dyIgQ7oRRrSrAsx19WAdk6EYFVblKxNU4veplfQIkzUmgDcdAb3w9ygCTU6hepr25LNldsMdSW3IUdngo/bXMGu4N8vq44CpbznXuIYY4VwoWpY2LT8MMloX2CSOewDs/+muMHN4y x-ms-exchange-antispam-messagedata: MxYHVYAN7+Cz8q3wC5tBgFsWX+Eq7QUIqVRAMzduc8vAPQYOlNYdZGDKeK4Lh++RmscobzGzFapiCUojErhhOnWeGDL7JXiIFXoIuDWApaieE7UNS4mgMgBvGZr9aFMZxU0yEAkKO8YisAxZGYTxrQ== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 22439d0c-c60b-4b54-3f3f-08d7d480bc98 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Mar 2020 08:02:47.9352 (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: W1H0g2/jjnfY0SjLGm+OH3Y1SLoQ1/SKwQtrBMkCxLY0Er8NsqfSwMeshyBEx+pB2ycxH13XzKEMPywP3OFm9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4192 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] net/ice: support flow ops 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" > -----Original Message----- > From: Xing, Beilei > Sent: Tuesday, March 31, 2020 00:43 > To: dev@dpdk.org; Wang, Haiyue ; Yang, Qiming > ; Zhang, Qi Z > Subject: [PATCH] net/ice: support flow ops thread safe >=20 > For DCF, flow ops may be executed in different threads, so an thread safe > option for generic flow APIs is needed. >=20 > Signed-off-by: Beilei Xing > Signed-off-by: Qi Zhang > --- > drivers/net/ice/ice_ethdev.h | 1 + > drivers/net/ice/ice_generic_flow.c | 35 +++++++++++++++++++++++++++- > ------- > 2 files changed, 28 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h > index 7b94a3c..f88f9dd 100644 > --- a/drivers/net/ice/ice_ethdev.h > +++ b/drivers/net/ice/ice_ethdev.h > @@ -384,6 +384,7 @@ struct ice_pf { > bool offset_loaded; > bool adapter_stopped; > struct ice_flow_list flow_list; > + rte_spinlock_t flow_ops_lock; > struct ice_parser_list rss_parser_list; > struct ice_parser_list perm_parser_list; > struct ice_parser_list dist_parser_list; diff --git > a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c > index 823ff0e..c042079 100644 > --- a/drivers/net/ice/ice_generic_flow.c > +++ b/drivers/net/ice/ice_generic_flow.c > @@ -1395,6 +1395,7 @@ ice_flow_init(struct ice_adapter *ad) > TAILQ_INIT(&pf->rss_parser_list); > TAILQ_INIT(&pf->perm_parser_list); > TAILQ_INIT(&pf->dist_parser_list); > + rte_spinlock_init(&pf->flow_ops_lock); >=20 > TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) { > if (engine->init =3D=3D NULL) { > @@ -1862,19 +1863,24 @@ ice_flow_create(struct rte_eth_dev *dev, > return flow; > } >=20 > + rte_spinlock_lock(&pf->flow_ops_lock); > + > ret =3D ice_flow_process_filter(dev, flow, attr, pattern, actions, > &engine, ice_parse_engine_create, error); > - if (ret < 0) > - goto free_flow; > + if (ret < 0) { > + PMD_DRV_LOG(ERR, "Failed to create flow"); > + rte_free(flow); > + flow =3D NULL; > + goto out; > + } > + > flow->engine =3D engine; > TAILQ_INSERT_TAIL(&pf->flow_list, flow, node); > PMD_DRV_LOG(INFO, "Succeeded to create (%d) flow", engine- > >type); > - return flow; >=20 > -free_flow: > - PMD_DRV_LOG(ERR, "Failed to create flow"); > - rte_free(flow); > - return NULL; > +out: > + rte_spinlock_unlock(&pf->flow_ops_lock); > + return flow; > } >=20 > static int > @@ -1894,8 +1900,9 @@ ice_flow_destroy(struct rte_eth_dev *dev, > return -rte_errno; > } >=20 > - ret =3D flow->engine->destroy(ad, flow, error); > + rte_spinlock_lock(&pf->flow_ops_lock); >=20 > + ret =3D flow->engine->destroy(ad, flow, error); > if (!ret) { > TAILQ_REMOVE(&pf->flow_list, flow, node); > rte_free(flow); > @@ -1903,6 +1910,8 @@ ice_flow_destroy(struct rte_eth_dev *dev, > PMD_DRV_LOG(ERR, "Failed to destroy flow"); > } >=20 > + rte_spinlock_unlock(&pf->flow_ops_lock); > + > return ret; > } >=20 > @@ -1937,6 +1946,7 @@ ice_flow_query(struct rte_eth_dev *dev, > struct ice_adapter *ad =3D > ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); > struct rte_flow_query_count *count =3D data; > + struct ice_pf *pf =3D &ad->pf; >=20 > if (!flow || !flow->engine || !flow->engine->query_count) { > rte_flow_error_set(error, EINVAL, > @@ -1945,6 +1955,8 @@ ice_flow_query(struct rte_eth_dev *dev, > return -rte_errno; > } >=20 > + rte_spinlock_lock(&pf->flow_ops_lock); > + > for (; actions->type !=3D RTE_FLOW_ACTION_TYPE_END; actions++) { > switch (actions->type) { > case RTE_FLOW_ACTION_TYPE_VOID: > @@ -1959,6 +1971,9 @@ ice_flow_query(struct rte_eth_dev *dev, > "action not supported"); > } > } > + > + rte_spinlock_unlock(&pf->flow_ops_lock); > + > return ret; > } >=20 > @@ -1971,6 +1986,8 @@ ice_flow_redirect(struct ice_adapter *ad, > void *temp; > int ret; >=20 > + rte_spinlock_lock(&pf->flow_ops_lock); > + > TAILQ_FOREACH_SAFE(p_flow, &pf->flow_list, node, temp) { > if (!p_flow->engine->redirect) > continue; > @@ -1981,5 +1998,7 @@ ice_flow_redirect(struct ice_adapter *ad, > } > } >=20 > + rte_spinlock_unlock(&pf->flow_ops_lock); > + > return 0; > } > -- > 2.7.4 Acked-by: Qiming Yang