From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00081.outbound.protection.outlook.com [40.107.0.81]) by dpdk.org (Postfix) with ESMTP id E3D852BAB for ; Wed, 31 Oct 2018 16:09:55 +0100 (CET) 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=Ekle0r5A1RTIB9swWtj62886Vs01NML5DfGsj9w9Euc=; b=xlZsBJuQMezE1DhL1oFQ8S4O2j7IAuIDmJDdpfDqvxbFXfAjqar7oxx4QmZQ5cvvqjGy9vMgkJjiHk99l+oosvoehsMi2s/wFyOJrvtGz4uRkzrjiGsLEZurcCAXfkoICszrvC8pSPxeCdR8Ly2DuUcHYSk1l5ICAFmXXvVE2aE= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4187.eurprd05.prod.outlook.com (52.134.107.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.25; Wed, 31 Oct 2018 15:09:54 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::80e:e6b:baf2:d973]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::80e:e6b:baf2:d973%3]) with mapi id 15.20.1273.027; Wed, 31 Oct 2018 15:09:54 +0000 From: Shahaf Shuler To: Dekel Peled , Yongseok Koh CC: "dev@dpdk.org" , Ori Kam Thread-Topic: [dpdk-dev] [PATCH v7 4/7] net/mlx5: add NVGRE encap action to Direct Verbs Thread-Index: AQHUcO/iN95dY5iIUkeXhiGQuCIrWKU5UP1w Date: Wed, 31 Oct 2018 15:09:54 +0000 Message-ID: References: <1540498108-18358-1-git-send-email-dekelp@mellanox.com> <1540969847-48919-5-git-send-email-dekelp@mellanox.com> In-Reply-To: <1540969847-48919-5-git-send-email-dekelp@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-microsoft-exchange-diagnostics: 1; DB7PR05MB4187; 6:uQKbBJKJ1WouJfPZE2ipypPeB1W3jDB7SfdZdArRBYchNIVvuJpzteH0Cx+QhNaUtRCAI9TqiLFGtZoi/I2ybo8DKEwmS3VTITiFGYpLch9XLNqE0HhLZ+4TS8ptCGnyvODCW5cBatgYrN1V2NiiJ58LkhvOwejpg1lvWBAj325aTKY8ql5IwXe8Ctcm5LRMEaRWQAgMYM6DydLcm/Npuuc2cAHtFgP+R2C9BSU2aP8+hJjSgIXKppDqEh58RNhdg+e9CAgVEhu5Y1P2w9XPcqO8aIqC/JondGJ8a7ykfEs6njc2bHQ4iOqx+CM5Lj3d+RPqM1A7rnQdbfGLwYFOdDwTaPZ5HWOnWsvzeqfwg1FU6BiwL5pmMXAEyiDiqR/S1eFbAczqI1P5sTQ/3472YFOeZyffe+uF/5PGutEip6MtK07ybY9D6nv4BVdBm8SJnC5QLBAEpCXVoxvIwUN9Mw==; 5:s9Hqj0gIuKlY453B2d7QRTSepdaBoxLX9vsVC1ZgjSYD707PVwbGP66YOb90KA1Vv5yfvWUBQqXsRGdzgl5jq7H8fBlQGZ+tAapDbeaSCGhR3t+oqR9Gzw2w0l1gjpaBCWNphfCf5FOvqCiz5pvNyuwuAbEMUYtPvvKQMr3d2Is=; 7:m90qR+ASvXzpVGnbG/lDDXI6HmHqRxj4nZzeFwaO/p+0vP0ivd/N+gFxsovoJkwbaKdZn4wuCpqxuvL7TvS6nWKMVaXSzhm9U20j4Tud6UiXaBE1tFnZ9JSzmBweBhrsI5TP5Okp0Z+69wZdRngAvQ== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: fc6862d9-125d-44bc-3c45-08d63f42ea3d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4187; x-ms-traffictypediagnostic: DB7PR05MB4187: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231382)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:DB7PR05MB4187; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4187; x-forefront-prvs: 084285FC5C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(136003)(396003)(366004)(39860400002)(199004)(189003)(476003)(86362001)(14454004)(478600001)(105586002)(102836004)(26005)(106356001)(186003)(6636002)(486006)(81156014)(81166006)(4326008)(2900100001)(110136005)(54906003)(25786009)(446003)(97736004)(14444005)(256004)(8936002)(11346002)(68736007)(66066001)(2906002)(316002)(6116002)(71200400001)(33656002)(5250100002)(5660300001)(55016002)(53936002)(6246003)(107886003)(99286004)(3846002)(71190400001)(9686003)(74316002)(305945005)(7736002)(76176011)(7696005)(6506007)(6436002)(229853002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4187; H:DB7PR05MB4426.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-microsoft-antispam-message-info: nAXN1bUWZMipWB4aRh3Zc+PqwDJO4TBVp3qs8rukLMRx+1jDBdHKxrGDXA0TKU7tONdn2P+fYtibeHwq0RfnGdbz+xZGYY5MQLwnWvfHR52UnXqS8rxp3yOC0iWMqpSuw3jfNKYLNt8BdcQjHg33gwdY1A7gL5a7rcIu33fDG9TG1F9UyZ0gT1uQQ2e9Q7joE1MILXsOOcR02D1v8v9uhXE9NhTAb+q6h04w5yTsXXQtKZ5OJzOpuZ689IRSXyIU/il7WYR3hQMAb604bL/gGIKCVpwn8vqNFYMaJATIuZ7SI8dti9mFQcjPtAk84EYQC73ZXDWIOGXJWYxkIcadSnQQkate2VJQPSZ0ouB5+JI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: fc6862d9-125d-44bc-3c45-08d63f42ea3d X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Oct 2018 15:09:54.8115 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4187 Subject: Re: [dpdk-dev] [PATCH v7 4/7] net/mlx5: add NVGRE encap action to Direct Verbs 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, 31 Oct 2018 15:09:56 -0000 Wednesday, October 31, 2018 9:11 AM, Dekel Peled: > Subject: [dpdk-dev] [PATCH v7 4/7] net/mlx5: add NVGRE encap action to > Direct Verbs >=20 > This patch implements the nvgre encap action in DV flow for MLX5 PMD. >=20 > Signed-off-by: Dekel Peled > --- > drivers/net/mlx5/mlx5_flow.h | 4 ++++ > drivers/net/mlx5/mlx5_flow_dv.c | 37 > ++++++++++++++++++++++++++++++++----- > 2 files changed, 36 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h > index 8955a12..c03a3af 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > @@ -94,10 +94,14 @@ > #define MLX5_FLOW_ACTION_SET_MAC_DST (1u << 21) #define > MLX5_FLOW_ACTION_VXLAN_ENCAP (1u << 22) #define > MLX5_FLOW_ACTION_VXLAN_DECAP (1u << 23) > +#define MLX5_FLOW_ACTION_NVGRE_ENCAP (1u << 24) >=20 > #define MLX5_FLOW_FATE_ACTIONS \ > (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | > MLX5_FLOW_ACTION_RSS) >=20 > +#define MLX5_FLOW_ENCAP_ACTIONS \ > + (MLX5_FLOW_ACTION_VXLAN_ENCAP | > MLX5_FLOW_ACTION_NVGRE_ENCAP) > + > #ifndef IPPROTO_MPLS > #define IPPROTO_MPLS 137 > #endif > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c index 7de65bb..7078397 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -126,7 +126,7 @@ > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > "can't drop and encap in same > flow"); > - if (action_flags & (MLX5_FLOW_ACTION_VXLAN_ENCAP | > + if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS | > MLX5_FLOW_ACTION_VXLAN_DECAP)) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, @@ -163,7 +163,7 @@ > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > "can't drop and decap in same > flow"); > - if (action_flags & (MLX5_FLOW_ACTION_VXLAN_ENCAP | > + if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS | > MLX5_FLOW_ACTION_VXLAN_DECAP)) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, @@ -376,6 +376,20 @@ > vxlan->vx_flags =3D >=20 > RTE_BE32(MLX5_VXLAN_GPE_FLAGS); > break; > + case RTE_FLOW_ITEM_TYPE_GRE: > + case RTE_FLOW_ITEM_TYPE_NVGRE: > + if (!ipv4 && !ipv6) > + return rte_flow_error_set(error, EINVAL, > + > RTE_FLOW_ERROR_TYPE_ACTION, > + (void *)item->type, > + "ip header not found"); > + if ((ipv4 && !ipv4->next_proto_id) || > + (ipv6 && !ipv6->proto)) > + return rte_flow_error_set(error, EINVAL, Same comment like in the VXLAN-GPE. It is not the ip next proto you need to= check it is the GRE protocol.=20 > + > RTE_FLOW_ERROR_TYPE_ACTION, > + (void *)item->type, > + "next protocol not found"); > + break; > case RTE_FLOW_ITEM_TYPE_VOID: > break; > default: > @@ -416,7 +430,11 @@ > size_t size =3D 0; > int convert_result =3D 0; >=20 > - encap_data =3D ((const struct rte_flow_action_vxlan_encap *) > + if (action->type =3D=3D RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP) > + encap_data =3D ((const struct rte_flow_action_vxlan_encap *) > + action->conf)->definition; > + else > + encap_data =3D ((const struct rte_flow_action_nvgre_encap *) > action->conf)->definition; > convert_result =3D flow_dv_convert_encap_data(encap_data, buf, > &size, error); > @@ -705,12 +723,17 @@ > ++actions_n; > break; > case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: > + case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: > ret =3D > flow_dv_validate_action_l2_encap(action_flags, > actions, attr, > error); > if (ret < 0) > return ret; > - action_flags |=3D > MLX5_FLOW_ACTION_VXLAN_ENCAP; > + action_flags |=3D actions->type =3D=3D > + > RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP ? > + > MLX5_FLOW_ACTION_VXLAN_ENCAP : > + > MLX5_FLOW_ACTION_NVGRE_ENCAP; > + > ++actions_n; > break; > case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: > @@ -1492,6 +1515,7 @@ > flow->actions |=3D MLX5_FLOW_ACTION_RSS; > break; > case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: > + case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: > dev_flow->dv.actions[actions_n].type =3D > MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION; > dev_flow->dv.actions[actions_n].action =3D @@ -1501,7 > +1525,10 @@ > return -rte_errno; > dev_flow->dv.encap_decap_verbs_action =3D > dev_flow->dv.actions[actions_n].action; > - flow->actions |=3D MLX5_FLOW_ACTION_VXLAN_ENCAP; > + flow->actions |=3D action->type =3D=3D > + RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP ? > + MLX5_FLOW_ACTION_VXLAN_ENCAP : > + MLX5_FLOW_ACTION_NVGRE_ENCAP; > actions_n++; > break; > case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: > -- > 1.8.3.1