From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30064.outbound.protection.outlook.com [40.107.3.64]) by dpdk.org (Postfix) with ESMTP id 05D361B129 for ; Wed, 3 Apr 2019 12:16:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3ANti5lv4vIJuNLA62KT632qeJdQe8HFHSfm1RUnPnU=; b=K/tCJvPCtPTK+keFh2QygoL97UkD9e9XEO7KK1+8QBPkBBlv2fL6O+l14monJCBq6AfevqB1N+4+wqnS4Baz7z4zDfqFC9rAcFQzTU01Sxskysc+TEwc63JxFJkMktLtW+sOWXodCXv6v4HxtTj1VPeul5NWg1oi55gsm12M/VE= Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com (52.133.22.13) by AM6PR0502MB3733.eurprd05.prod.outlook.com (52.133.21.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.13; Wed, 3 Apr 2019 10:16:36 +0000 Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::5db8:12bc:aff3:5048]) by AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::5db8:12bc:aff3:5048%6]) with mapi id 15.20.1750.017; Wed, 3 Apr 2019 10:16:36 +0000 From: Shahaf Shuler To: Ori Kam , Matan Azrad , Yongseok Koh CC: "dev@dpdk.org" , Slava Ovsiienko Thread-Topic: [PATCH v2 3/3] net/mlx5: add jump action support for NIC Thread-Index: AQHU5YPntQcFCsreokuMZoD5k1R4waYqP3/Q Date: Wed, 3 Apr 2019 10:16:36 +0000 Message-ID: References: <1553096315-91832-1-git-send-email-orika@mellanox.com> <1553790741-69362-1-git-send-email-orika@mellanox.com> <1553790741-69362-4-git-send-email-orika@mellanox.com> In-Reply-To: <1553790741-69362-4-git-send-email-orika@mellanox.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=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e042b2ab-eb0b-494c-443f-08d6b81d746a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM6PR0502MB3733; x-ms-traffictypediagnostic: AM6PR0502MB3733: x-microsoft-antispam-prvs: x-forefront-prvs: 0996D1900D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(366004)(376002)(396003)(346002)(199004)(189003)(86362001)(229853002)(106356001)(105586002)(26005)(71190400001)(71200400001)(7696005)(4326008)(102836004)(53936002)(6436002)(107886003)(9686003)(6246003)(55016002)(99286004)(5660300002)(52536014)(186003)(66066001)(6116002)(3846002)(6506007)(76176011)(25786009)(486006)(446003)(11346002)(2906002)(256004)(110136005)(316002)(54906003)(476003)(33656002)(97736004)(14454004)(478600001)(8936002)(6636002)(7736002)(305945005)(74316002)(81166006)(8676002)(81156014)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3733; H:AM6PR0502MB3797.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: SwGTv+tZf2iAk8vNaIQ1EGPf3JYEF6PXoim1nvzI3/XLuG61V4EOI1WgrewRVH+FsS0qXgZ8qpGGp3r7M/cBMYwm/AEl+EPiPJtGwPPiN660KmDPgcJrm763JPMoLHBA5tjnA29CalbMrcg0NHWp9S5rIg+eW3d/sdHIrbyhbnuZ94pSm+mMKdXbleC8dycXkaIJRL8r8D7qokBKj5McNT18qho/HrzTMYy640Kwo+y0NeWtchPOO/m+pdEYHPtyVuv8/RWPGRRfA30yINxl+bwr2MiowzufrnlEzxYnp/vTHUEsFqo/CiETr32aRHE9o2uynq4bNbofPQMWiW26CooFzyKQt/vmlkrbAa46O4EZ72UsmCkPfhtE4i8NRUdHZGBer97BKI+YJWr973QI65cY4iAK2XgdpmYLa6iNQDs= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e042b2ab-eb0b-494c-443f-08d6b81d746a X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Apr 2019 10:16:36.5607 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3733 Subject: Re: [dpdk-dev] [PATCH v2 3/3] net/mlx5: add jump action support for NIC 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: , X-List-Received-Date: Wed, 03 Apr 2019 10:16:38 -0000 Thursday, March 28, 2019 6:33 PM, Ori Kam: > Subject: [PATCH v2 3/3] net/mlx5: add jump action support for NIC >=20 > When using Direct Rules we can add actions to jump between tables. > This is extra useful since rule insertion rate is much higher on other ta= bles > compared to table zero. >=20 > if no group is selected the rule is added to group 0. >=20 > Signed-off-by: Ori Kam > --- > drivers/net/mlx5/mlx5.h | 6 + > drivers/net/mlx5/mlx5_flow.h | 15 ++- > drivers/net/mlx5/mlx5_flow_dv.c | 278 > +++++++++++++++++++++++++++++++++++----- > drivers/net/mlx5/mlx5_glue.c | 13 ++ > drivers/net/mlx5/mlx5_glue.h | 1 + > 5 files changed, 282 insertions(+), 31 deletions(-) >=20 [...] > /** > * Register the flow matcher. > * > @@ -2784,6 +2952,9 @@ struct field_modify_info modify_tcp[] =3D { > .match_mask =3D (void *)&matcher->mask, > }; > struct mlx5_flow_tbl_resource *tbl =3D NULL; > +#ifndef HAVE_MLX5DV_DR > + struct mlx5_flow_tbl_resource tbl_tmp; #endif >=20 > /* Lookup from cache. */ > LIST_FOREACH(cache_matcher, &priv->matchers, next) { @@ - > 2805,33 +2976,24 @@ struct field_modify_info modify_tcp[] =3D { > return 0; > } > } > -#ifdef HAVE_MLX5DV_DR > - if (matcher->egress) { > - tbl =3D &priv->tx_tbl[matcher->group]; > - if (!tbl->obj) > - tbl->obj =3D mlx5_glue->dr_create_flow_tbl > - (priv->tx_ns, > - matcher->group * MLX5_GROUP_FACTOR); > - } else { > - tbl =3D &priv->rx_tbl[matcher->group]; > - if (!tbl->obj) > - tbl->obj =3D mlx5_glue->dr_create_flow_tbl > - (priv->rx_ns, > - matcher->group * MLX5_GROUP_FACTOR); > - } > - if (!tbl->obj) > - return rte_flow_error_set(error, ENOMEM, > - > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > - NULL, "cannot create table"); > - > - rte_atomic32_inc(&tbl->refcnt); > -#endif > /* Register new matcher. */ > cache_matcher =3D rte_calloc(__func__, 1, sizeof(*cache_matcher), > 0); > if (!cache_matcher) > return rte_flow_error_set(error, ENOMEM, >=20 > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > "cannot allocate matcher memory"); > +#ifdef HAVE_MLX5DV_DR > + tbl =3D flow_dv_tbl_resource_get(dev, matcher->group * > MLX5_GROUP_FACTOR, > + matcher->egress, error); > + if (!tbl) { > + rte_free(cache_matcher); > + return rte_flow_error_set(error, ENOMEM, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, "cannot create table"); > + } > +#else > + tbl =3D &tbl_tmp; > +#endif I suggest to have the HAVE_MLX5DV_DR inside the flow_dv_tbl_resource_get (r= eturn NULL if no DR support).=20 Then we can have a cleaner code of this function.=20 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id EC34DA0679 for ; Wed, 3 Apr 2019 12:16:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BCB171B12D; Wed, 3 Apr 2019 12:16:38 +0200 (CEST) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30064.outbound.protection.outlook.com [40.107.3.64]) by dpdk.org (Postfix) with ESMTP id 05D361B129 for ; Wed, 3 Apr 2019 12:16:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3ANti5lv4vIJuNLA62KT632qeJdQe8HFHSfm1RUnPnU=; b=K/tCJvPCtPTK+keFh2QygoL97UkD9e9XEO7KK1+8QBPkBBlv2fL6O+l14monJCBq6AfevqB1N+4+wqnS4Baz7z4zDfqFC9rAcFQzTU01Sxskysc+TEwc63JxFJkMktLtW+sOWXodCXv6v4HxtTj1VPeul5NWg1oi55gsm12M/VE= Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com (52.133.22.13) by AM6PR0502MB3733.eurprd05.prod.outlook.com (52.133.21.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.13; Wed, 3 Apr 2019 10:16:36 +0000 Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::5db8:12bc:aff3:5048]) by AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::5db8:12bc:aff3:5048%6]) with mapi id 15.20.1750.017; Wed, 3 Apr 2019 10:16:36 +0000 From: Shahaf Shuler To: Ori Kam , Matan Azrad , Yongseok Koh CC: "dev@dpdk.org" , Slava Ovsiienko Thread-Topic: [PATCH v2 3/3] net/mlx5: add jump action support for NIC Thread-Index: AQHU5YPntQcFCsreokuMZoD5k1R4waYqP3/Q Date: Wed, 3 Apr 2019 10:16:36 +0000 Message-ID: References: <1553096315-91832-1-git-send-email-orika@mellanox.com> <1553790741-69362-1-git-send-email-orika@mellanox.com> <1553790741-69362-4-git-send-email-orika@mellanox.com> In-Reply-To: <1553790741-69362-4-git-send-email-orika@mellanox.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=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e042b2ab-eb0b-494c-443f-08d6b81d746a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM6PR0502MB3733; x-ms-traffictypediagnostic: AM6PR0502MB3733: x-microsoft-antispam-prvs: x-forefront-prvs: 0996D1900D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(366004)(376002)(396003)(346002)(199004)(189003)(86362001)(229853002)(106356001)(105586002)(26005)(71190400001)(71200400001)(7696005)(4326008)(102836004)(53936002)(6436002)(107886003)(9686003)(6246003)(55016002)(99286004)(5660300002)(52536014)(186003)(66066001)(6116002)(3846002)(6506007)(76176011)(25786009)(486006)(446003)(11346002)(2906002)(256004)(110136005)(316002)(54906003)(476003)(33656002)(97736004)(14454004)(478600001)(8936002)(6636002)(7736002)(305945005)(74316002)(81166006)(8676002)(81156014)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3733; H:AM6PR0502MB3797.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: SwGTv+tZf2iAk8vNaIQ1EGPf3JYEF6PXoim1nvzI3/XLuG61V4EOI1WgrewRVH+FsS0qXgZ8qpGGp3r7M/cBMYwm/AEl+EPiPJtGwPPiN660KmDPgcJrm763JPMoLHBA5tjnA29CalbMrcg0NHWp9S5rIg+eW3d/sdHIrbyhbnuZ94pSm+mMKdXbleC8dycXkaIJRL8r8D7qokBKj5McNT18qho/HrzTMYy640Kwo+y0NeWtchPOO/m+pdEYHPtyVuv8/RWPGRRfA30yINxl+bwr2MiowzufrnlEzxYnp/vTHUEsFqo/CiETr32aRHE9o2uynq4bNbofPQMWiW26CooFzyKQt/vmlkrbAa46O4EZ72UsmCkPfhtE4i8NRUdHZGBer97BKI+YJWr973QI65cY4iAK2XgdpmYLa6iNQDs= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e042b2ab-eb0b-494c-443f-08d6b81d746a X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Apr 2019 10:16:36.5607 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3733 Subject: Re: [dpdk-dev] [PATCH v2 3/3] net/mlx5: add jump action support for NIC 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" Message-ID: <20190403101636.6w6btGHCtabAQCVVa7_ovn39Sllk6ldkxO0K1n7zqyU@z> Thursday, March 28, 2019 6:33 PM, Ori Kam: > Subject: [PATCH v2 3/3] net/mlx5: add jump action support for NIC >=20 > When using Direct Rules we can add actions to jump between tables. > This is extra useful since rule insertion rate is much higher on other ta= bles > compared to table zero. >=20 > if no group is selected the rule is added to group 0. >=20 > Signed-off-by: Ori Kam > --- > drivers/net/mlx5/mlx5.h | 6 + > drivers/net/mlx5/mlx5_flow.h | 15 ++- > drivers/net/mlx5/mlx5_flow_dv.c | 278 > +++++++++++++++++++++++++++++++++++----- > drivers/net/mlx5/mlx5_glue.c | 13 ++ > drivers/net/mlx5/mlx5_glue.h | 1 + > 5 files changed, 282 insertions(+), 31 deletions(-) >=20 [...] > /** > * Register the flow matcher. > * > @@ -2784,6 +2952,9 @@ struct field_modify_info modify_tcp[] =3D { > .match_mask =3D (void *)&matcher->mask, > }; > struct mlx5_flow_tbl_resource *tbl =3D NULL; > +#ifndef HAVE_MLX5DV_DR > + struct mlx5_flow_tbl_resource tbl_tmp; #endif >=20 > /* Lookup from cache. */ > LIST_FOREACH(cache_matcher, &priv->matchers, next) { @@ - > 2805,33 +2976,24 @@ struct field_modify_info modify_tcp[] =3D { > return 0; > } > } > -#ifdef HAVE_MLX5DV_DR > - if (matcher->egress) { > - tbl =3D &priv->tx_tbl[matcher->group]; > - if (!tbl->obj) > - tbl->obj =3D mlx5_glue->dr_create_flow_tbl > - (priv->tx_ns, > - matcher->group * MLX5_GROUP_FACTOR); > - } else { > - tbl =3D &priv->rx_tbl[matcher->group]; > - if (!tbl->obj) > - tbl->obj =3D mlx5_glue->dr_create_flow_tbl > - (priv->rx_ns, > - matcher->group * MLX5_GROUP_FACTOR); > - } > - if (!tbl->obj) > - return rte_flow_error_set(error, ENOMEM, > - > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > - NULL, "cannot create table"); > - > - rte_atomic32_inc(&tbl->refcnt); > -#endif > /* Register new matcher. */ > cache_matcher =3D rte_calloc(__func__, 1, sizeof(*cache_matcher), > 0); > if (!cache_matcher) > return rte_flow_error_set(error, ENOMEM, >=20 > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > "cannot allocate matcher memory"); > +#ifdef HAVE_MLX5DV_DR > + tbl =3D flow_dv_tbl_resource_get(dev, matcher->group * > MLX5_GROUP_FACTOR, > + matcher->egress, error); > + if (!tbl) { > + rte_free(cache_matcher); > + return rte_flow_error_set(error, ENOMEM, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, "cannot create table"); > + } > +#else > + tbl =3D &tbl_tmp; > +#endif I suggest to have the HAVE_MLX5DV_DR inside the flow_dv_tbl_resource_get (r= eturn NULL if no DR support).=20 Then we can have a cleaner code of this function.=20