From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10058.outbound.protection.outlook.com [40.107.1.58]) by dpdk.org (Postfix) with ESMTP id 918EB1B63D for ; Sat, 7 Jul 2018 02:11:59 +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=UuKjrZBlElqS/NPtSl00o+AklY3Fz5ecZIFofRDKzPk=; b=m877mN23njyuC8wrLe7+1aSP7we2P59LCKxzunkk7+YaEcjHvIfvbJkZz+7vOco0fM4j0andTjR+NFEK6P0e/n5Sw/eIve04fA2F6M2x9vl2OPloZcntlHhrnLHevVZgox1STEAvHA364ZAHv3QtfFdDV/Hn8lnpJvkwG78Y+v8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from yongseok-MBP.local (209.116.155.178) by HE1PR0501MB2042.eurprd05.prod.outlook.com (2603:10a6:3:35::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.25; Sat, 7 Jul 2018 00:11:53 +0000 Date: Fri, 6 Jul 2018 17:11:31 -0700 From: Yongseok Koh To: Nelio Laranjeiro Cc: dev@dpdk.org, Adrien Mazarguil Message-ID: <20180707001131.GD53779@yongseok-MBP.local> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: MWHPR19CA0094.namprd19.prod.outlook.com (2603:10b6:320:1f::32) To HE1PR0501MB2042.eurprd05.prod.outlook.com (2603:10a6:3:35::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dd20f3ed-77db-4f24-a261-08d5e39e3f04 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2042; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2042; 3:0dgHVrIuypTTb1MDtWSl99Y2MmKmPsDyxrdsS1v2GVWRl9BDZj2ng3+DweY70zqaTZ1zYD9dxxI9vGCR8hUeawB+5lQ6/a8YIqevhP/nLe+Aa6V2Vk7ECKO7rly5OHrdEYrB4ErHW9oi3Xvn2TWpeO5JmcXWTU9yHrdfQ+QuruI39A4Q0mHSmC/jrK6sbcNLbLoyA78sNgxIHzcUAhwX8XlKQryCZOpP26QaH3pskHUPWHHCyzcKJci8SzeFuvtB; 25:b5VMwBsq/NBQZz86kYLmDvw5nz9WWn4cfA2EOLF5WZf30pbbw9lQwIzmVFWj4zNgqko875hdF2Jt366o38FgbWhSaplZCFL5eGqryT6Qvo4UUxE6YubXkw62aUIf9rC48F0ob56D17VcNOl7gSMKC3bLdAMkTJ0usUJtflyUtFEI5IdeYpbKg11JBOwqzkz6rTRxZrCeNnwdV8SrAYSCRvv3np2vbG8Ga50pOB4WQEF5zcNEf4JV2mQFCur2hLsX5vzgeblWd1tikAvPDDGCvX0KYLi9+FUDP5VQHB7Aii1xQ/d9KyA3hczeC3mDhyb8qULO0DtHQh3HRbPQm1L+VQ==; 31:dt97rWVmLFLfKqvDqJmKzWsq6k9UhevJETTCZabGMctBQGc8Dle7YZs7Tdk2XJgvivtrtSOFj2j5HXamfVacv4Qxgti26Dk/jcpKkTAwydQdX+xlBaf6zFPjGFQzH4Wll29YJxzySpAMJle9Av//lK1eLIYp6YapjqzXt4eLaRLL1dc36CAWqyuW+Ji139VKWwWvNc/xoTkZAats4j+uvJGpWLXP4ayb9Q8bHu0xBCU= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2042: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2042; 20:7p0DCPEuTMT/7ow59/51MwvcqM/kK7SO6NYn+FNH9ym3ASjgfjM89Jp+0a4q/rQdipwzaF6LzWh15fKW1BHT8wAtC2dqMmaI3puhyIA7VYBUlLCgIcX6PxdXD3ISLugczQuZeaH10pbZJIw/KEiwONIqm/9rLMUNyyYMQ71UXTvd+D733cHpclyGAZl7lQsojOoYekvA+AtYMDf7kKlGIrmYjeza+xXe3yqECZfHNlO7cLU6/WLVOFVn/iOKYYRLnuUiXsbID2k5h05191Sbz//+vQmaFzDpZ/0moauNRCu9GovwyG72UQEVrCfE7fyJLrGRC3l4LNiGwgzD6WoGv/nAHS0gc8RwvMRvCF5dAZ2MYhgT+XVkIc6eod705np2V0+LjjEh9yuNTI161Xk00lxXOdi7Txr79juvyCmPuBYB90dwJXYUHNZ/4Y7daEJyj+bNc+cfsvXNgCuhiBxUd6TolCIgxoJvAJfyaKc0HVwn2GhytuR5U9XzuWOsRhqa; 4:tiNYSG7aHFnBang0zvqZKc1pSVlBx44Id42jYu8AYd1BUmyeTzierzyYyBBllEtUbr2WXzmyFfOyCwL01e8svlvqiX98zvv4J2SQXAIVofRU9CA3mamFL2tsigEPJ61pyibb30EHxNgVHF8LI6CVveygZj1rjQ54A00G3LI74rxCagPBfJvHFNW0g3sN5oO/UzIVOUa01kb+1lrE/3263LxROBuY5XMfG6DLgSdAIoMXeIxyPkkW1DxZGnji4QfzasawK5oVj0keXeECpc1WGg== 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)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:HE1PR0501MB2042; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2042; X-Forefront-PRVS: 0726B2D7A6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(136003)(396003)(366004)(39860400002)(376002)(346002)(199004)(189003)(105586002)(106356001)(446003)(86362001)(956004)(11346002)(486006)(476003)(305945005)(7736002)(2906002)(81166006)(81156014)(8936002)(8676002)(316002)(16586007)(58126008)(5660300001)(98436002)(6916009)(6666003)(33656002)(7696005)(52116002)(68736007)(6506007)(386003)(229853002)(76176011)(33896004)(4326008)(66066001)(14444005)(97736004)(16526019)(186003)(47776003)(55016002)(26005)(50466002)(53936002)(9686003)(6246003)(6116002)(478600001)(3846002)(25786009)(1076002)(23726003)(18370500001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2042; H:yongseok-MBP.local; 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-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2042; 23:QgJrD2+07zfcsxMwjtzyzohsla0tI4KuJUZQu4S?= =?us-ascii?Q?EF1qphx28IQ+79hibIPBJ2IU3eRFKAVRAH/IPUV/DL2FduiELXsCmpGGl0JV?= =?us-ascii?Q?6UvIDmjWxAnyQTpkHadfY2akI0eF0+JgY2rrJRK571FPrEGmQd7ym4MSGXnO?= =?us-ascii?Q?M1MB7FZ8xi+rsHI8moEYkozv98I7I+ZV8qHVwABMz95U1YP4OTEt/xTGpgpj?= =?us-ascii?Q?V/kcrCWFvXq9EhrOOAdgX7/g0zRGidXwcIDwkliCPRWUb/NAJhf+20ERpaTV?= =?us-ascii?Q?SF5oKk3eyl6MB/624AOaDz5UN0CHnzbWcuR/jsNzAJvJ8AeAIS4gbtIjjykm?= =?us-ascii?Q?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vFleX05XwvjUSg+uYf8a7qfS0muHsKH9SJ71yFlsBz5tA==; 5:m5Z86/PsuI/r0mF92jIaAFGQcLvhZ8R8bWrIWA7I9spfgFakjAbtchJqiiHymShJ/dJ6HjqTcCoBs/76ri+wsroGjq9CIffyqMC+m3zt5S2ya66Y5LyMOf9HmCxOOlJb570TMTjIEoo3E5YJ5vbeqtjfJmEnC3OjCQqZsA5RTYU=; 24:sdDYLNeQ6j6CYhrDYlkcndUWAwFI24aeHBQMN30dPeb8VgAbX833UtWURoAguiSAZNYNLPBUcZ5B4ofahZZQdv/dydVjJACiNUetPyYPq9s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2042; 7:cuV8NeQ19but+ygMN8/EgVhdThmoMt79FdX9az85vu9voRqrbIi3kaCyhd/LLmqnl2ZSl77HDgY0CQSZo3QKwn6JwWgW93ZJuKYGzjZjzA53F8hkborFsSYHzvBOmEvxUKbj1QaLOS7t+UchAVJJN41gBDA33HXI7Smj3rNZFDiBbxFjRMLm6lWtaxtPlZDBgyD9nX0lWiMaYhNcMMdMVzUODcaajOVZ2A/rg+eavYzKJyI/FbKKQPFrdwudsrQz X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2018 00:11:53.4350 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd20f3ed-77db-4f24-a261-08d5e39e3f04 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2042 Subject: Re: [dpdk-dev] [PATCH v2 19/20] net/mlx5: add flow MPLS item 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: Sat, 07 Jul 2018 00:11:59 -0000 On Wed, Jun 27, 2018 at 05:07:51PM +0200, Nelio Laranjeiro wrote: > Signed-off-by: Nelio Laranjeiro > --- > drivers/net/mlx5/mlx5_flow.c | 77 +++++++++++++++++++++++++++++++++++- > 1 file changed, 76 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 636aaabe8..7aa4e6ed5 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -55,6 +55,7 @@ extern const struct eth_dev_ops mlx5_dev_ops_isolate; > #define MLX5_FLOW_LAYER_VXLAN (1u << 12) > #define MLX5_FLOW_LAYER_VXLAN_GPE (1u << 13) > #define MLX5_FLOW_LAYER_GRE (1u << 14) > +#define MLX5_FLOW_LAYER_MPLS (1u << 15) > > /* Outer Masks. */ > #define MLX5_FLOW_LAYER_OUTER_L3 \ > @@ -68,7 +69,7 @@ extern const struct eth_dev_ops mlx5_dev_ops_isolate; > /* Tunnel masks. */ > #define MLX5_FLOW_LAYER_TUNNEL \ > (MLX5_FLOW_LAYER_VXLAN | MLX5_FLOW_LAYER_VXLAN_GPE | \ > - MLX5_FLOW_LAYER_GRE) > + MLX5_FLOW_LAYER_GRE | MLX5_FLOW_LAYER_MPLS) > > /* Inner Masks. */ > #define MLX5_FLOW_LAYER_INNER_L3 \ > @@ -1589,6 +1590,77 @@ mlx5_flow_item_gre(const struct rte_flow_item *item, > return size; > } > > +/** > + * Validate MPLS layer and possibly create the Verbs specification. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param item[in] > + * Item specification. > + * @param flow[in, out] > + * Pointer to flow structure. > + * @param flow_size[in] > + * Size in bytes of the available space for to store the flow information. > + * @param error > + * Pointer to error structure. > + * > + * @return > + * size in bytes necessary for the conversion, a negative errno value > + * otherwise and rte_errno is set. > + */ > +static int > +mlx5_flow_item_mpls(const struct rte_flow_item *item __rte_unused, > + struct rte_flow *flow __rte_unused, > + const size_t flow_size __rte_unused, > + struct rte_flow_error *error) > +{ > +#ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT > + const struct rte_flow_item_mpls *spec = item->spec; > + const struct rte_flow_item_mpls *mask = item->mask; > + unsigned int size = sizeof(struct ibv_flow_spec_mpls); > + struct ibv_flow_spec_mpls mpls = { > + .type = IBV_FLOW_SPEC_MPLS, > + .size = size, > + }; > + const uint32_t layers = mlx5_flow_layers(flow); > + int ret; > + > + if (layers & MLX5_FLOW_LAYER_TUNNEL) Just curious, no need to check flow->exapnd? > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, > + "a tunnel is already" > + " present"); > + if (!mask) > + mask = &rte_flow_item_mpls_mask; > + ret = mlx5_flow_item_validate > + (item, (const uint8_t *)mask, > + (const uint8_t *)&rte_flow_item_mpls_mask, > + sizeof(struct rte_flow_item_mpls), error); > + if (ret < 0) > + return ret; > + if (spec) { > + memcpy(&mpls.val.label, spec, sizeof(mpls.val.label)); > + memcpy(&mpls.mask.label, mask, sizeof(mpls.mask.label)); > + /* Remove unwanted bits from values. */ > + mpls.val.label &= mpls.mask.label; > + } > + if (size <= flow_size) Is it guaranteed flow->cur_verbs isn't null if size fits? Could be obvious but just want to make sure. > + mlx5_flow_spec_verbs_add(flow, &mpls, size); > + mlx5_flow_layers_update(flow, MLX5_FLOW_LAYER_MPLS); > + if (layers & MLX5_FLOW_LAYER_OUTER_L4_UDP) > + flow->ptype = RTE_PTYPE_TUNNEL_MPLS_IN_GRE | RTE_PTYPE_L4_UDP; > + else > + flow->ptype = RTE_PTYPE_TUNNEL_MPLS_IN_GRE; > + return size; > +#endif /* !HAVE_IBV_DEVICE_MPLS_SUPPORT */ > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, > + "MPLS is not supported by Verbs, please" > + " update."); > +} > + > /** > * Validate items provided by the user. > * > @@ -1650,6 +1722,9 @@ mlx5_flow_items(struct rte_eth_dev *dev, > case RTE_FLOW_ITEM_TYPE_GRE: > ret = mlx5_flow_item_gre(items, flow, remain, error); > break; #ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT > + case RTE_FLOW_ITEM_TYPE_MPLS: > + ret = mlx5_flow_item_mpls(items, flow, remain, error); > + break; #endif /* !HAVE_IBV_DEVICE_MPLS_SUPPORT */ How about this? > default: > return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ITEM, > -- > 2.18.0 >