From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0059.outbound.protection.outlook.com [104.47.0.59]) by dpdk.org (Postfix) with ESMTP id B2C2F10A3 for ; Thu, 1 Nov 2018 10:13:12 +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=8Wzp387IGX1wYrnqgmU3ymuzb1uz2KQkjQaByRxHxqQ=; b=Dh8BSE5HdLuYiiNFEdtDPmYukKvTFBocxWoj0OwH41BSgUf+iG6RnFR7nJfJVrtaqs1n0jlazYpZ+xigiCRNnSxHQ7WuSosoZMpKqUOHFQi2T7CyGjG2AUKx5erdfoi3R7lAEDTqA5c4bKapJ95mnUKqj5cYzpByXXzS9YJgTJ4= Received: from VI1PR05MB4224.eurprd05.prod.outlook.com (52.133.12.13) by VI1PR05MB4110.eurprd05.prod.outlook.com (10.171.182.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.26; Thu, 1 Nov 2018 09:13:11 +0000 Received: from VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::345d:803:9e2:679c]) by VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::345d:803:9e2:679c%4]) with mapi id 15.20.1294.024; Thu, 1 Nov 2018 09:13:10 +0000 From: Dekel Peled To: Shahaf Shuler , 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/lDNuHXvfU8UW20p9644+RWaU5da4AgAEuimA= Date: Thu, 1 Nov 2018 09:13:10 +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: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR05MB4110; 6:/+ty/0i17E9lhJ/p18YZ8xzurFiUVj2leWNe6Ln6qjD42Q6ywc2rNghwvepEoNn/Pb6ISPDNR4/qD9MckQ6o8S2/aHGH2j4JqbkfsZtrMxAujX3wzOEuBxTx6EAp9CYoNQbj2TPpQ4KBOOfPLz1k2RE51GUyiUrBdh6pJkhjm7S0WYCBkLHfL+mBvOjWXW2pMuF2v5vwCZxt7qfA9Zu3dWTjCAKF1nmKo9ASqNHI427KeLi6cVWEs2QncQ0kVnUKDpIx+2/DgfBS0PA7FFznDhxJ2KNZleMpnWPHuQllaVuw5uyEPKAdKTCxXBkRA7Y3rsLfbUlZSbwYlYIKhvJxIVvW/sDzlvuiRpGmPiAEf+yqt+Z2/dV5SRl26u8Z4dzgrOmczlDP3AzcNKhuFZMT5oH9koU55IfcN7b1xnJMwNWfhkUoa4mpfkCLjm46p0JWYSbKIrVRGEY2VkRfERZNkg==; 5:jA7liYI51oKkiUMgmvSXasAlKx01BUgsMyRFM+1alKONy7TKPx08DAoHdznfCgHvWpmS6OGLJ6FuxWz0srnzORsvwkqUgddZdGgG9JqIKAGC9JmjZavoNJ9IRiR70VfLLHU66M9zNJteThMGOMnSamjz1gqDZDrBX7nlAv/mx3E=; 7:iutzgUbhlx1pYXkWhlhpESeh6UGwYORtugk++Rw3v2UHgVx9YvzQIT9GndOydyF/idJTDZDrz/TJ3sETht3/U2+rcIqD6jdSXr0Rfdp3HVBD3gsbBDCesIWjXxhnCj6aGn9Jxlr00QTCEtABBYsGAA== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: b5226dea-0811-4bf1-073c-08d63fda3ede 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:VI1PR05MB4110; x-ms-traffictypediagnostic: VI1PR05MB4110: authentication-results: spf=none (sender IP is ) smtp.mailfrom=dekelp@mellanox.com; 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)(5005006)(8121501046)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:VI1PR05MB4110; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4110; x-forefront-prvs: 0843C17679 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(396003)(376002)(366004)(39860400002)(136003)(13464003)(189003)(199004)(316002)(6116002)(68736007)(3846002)(2900100001)(110136005)(6246003)(97736004)(7696005)(8936002)(76176011)(54906003)(6636002)(26005)(81166006)(81156014)(99286004)(305945005)(74316002)(14454004)(2906002)(229853002)(53546011)(6506007)(7736002)(66066001)(102836004)(14444005)(256004)(11346002)(6436002)(55016002)(106356001)(9686003)(105586002)(53936002)(5250100002)(186003)(86362001)(107886003)(33656002)(476003)(478600001)(486006)(5660300001)(25786009)(4326008)(71190400001)(446003)(71200400001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4110; H:VI1PR05MB4224.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: KW4cb5FTnF+mj2p3In/hLQ3YeBDhIGJRPYsqSyl4SkW0Gl3Olup27ucNHwWOWDLvp9YwFcGMSCOJiwrT8vN9A5hD794FXupJBGxHIGhOqN1NGT5E4wMAZpn0B7t2ChYufsquKPiWDQSLb8NSsQbKeDH6JNqrT0EAb3Bqrczvhz7XhsuXUQQZMVcoMCdRBgvlHilF1U2QS8sbmH6uQ3gS9C9pIkIWZdqc8upMEcCiCAvYN8r86YJOiwFd9QGsd8q+CvhWX6ms16wZcQZj5FPLb7iP1YxbZrGJ3qL3mdmP1qpD9ak2JwxnMbeOSycL6+8Nw0ckcuYulKF1Tfl6exYVlU+8DzNG6BtHx/ZVoIFAVyc= 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: b5226dea-0811-4bf1-073c-08d63fda3ede X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Nov 2018 09:13:10.8881 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4110 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: Thu, 01 Nov 2018 09:13:13 -0000 Thanks, PSB. > -----Original Message----- > From: Shahaf Shuler > Sent: Wednesday, October 31, 2018 5:10 PM > To: Dekel Peled ; Yongseok Koh > > Cc: dev@dpdk.org; Ori Kam > Subject: RE: [dpdk-dev] [PATCH v7 4/7] net/mlx5: add NVGRE encap action t= o > Direct Verbs >=20 > 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 > > > > This patch implements the nvgre encap action in DV flow for MLX5 PMD. > > > > 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(-) > > > > 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) > > > > #define MLX5_FLOW_FATE_ACTIONS \ > > (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | > > MLX5_FLOW_ACTION_RSS) > > > > +#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 > > > > 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, >=20 > Same comment like in the VXLAN-GPE. It is not the ip next proto you need = to > check it is the GRE protocol. Will change. >=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; > > > > - 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