From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10049.outbound.protection.outlook.com [40.107.1.49]) by dpdk.org (Postfix) with ESMTP id 7E71E1BB2F for ; Wed, 4 Jul 2018 02:12:18 +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=Je/SnS9qkcyQJb4Dp22ezGFt7IEkH0UdGwPMtEdv6rU=; b=NIyovat9UMYzjTEqQhR+0rbfnArvvHy2Mp/4TTFin4rtsPIX/Cp8WKzRMNODBtWDUZRMqTS5ZOFnEdkURlugS8posv8SxasJfz8bdkcpljyDF3zJVCIsohT+kkTQCucM/qm36SknCXNLK6KWSNxZ8CAQ3/u+JAj93Fd125nbD/s= Received: from yongseok-MBP.local (209.116.155.178) by AM5PR0501MB2036.eurprd05.prod.outlook.com (2603:10a6:203:1a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.23; Wed, 4 Jul 2018 00:12:15 +0000 Date: Tue, 3 Jul 2018 17:12:03 -0700 From: Yongseok Koh To: Nelio Laranjeiro Cc: dev@dpdk.org, Adrien Mazarguil Message-ID: <20180704001202.GF41721@yongseok-MBP.local> References: <7693b4973a8e683972895820d6db36aa7b12a404.1530111623.git.nelio.laranjeiro@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7693b4973a8e683972895820d6db36aa7b12a404.1530111623.git.nelio.laranjeiro@6wind.com> User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: BN6PR1001CA0012.namprd10.prod.outlook.com (2603:10b6:405:28::25) To AM5PR0501MB2036.eurprd05.prod.outlook.com (2603:10a6:203:1a::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5f270e0-a599-415f-957a-08d5e142cd0d 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:AM5PR0501MB2036; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2036; 3:UmIW0wHE7mPcj3JR+1Glqx38c1A31VL0K+yZ9v70qvBfr7KFk3cnCfVmnosdOVRh+ojbl7GPawnNP9u8w0fPH3Umkwlv09uu/++Fcr4qlz4XoJfgRdR7USHU50dqtStwBvDqzEtIW8f+L44U/TtffYBx4goExd1ejt8PuR0n/GU1gwfwmhn23AcqjTQDZLPfYmpFbB/6r7lFiUebocc/0wkMSsS2m0uHlN+N2VUrtlDRPPSfLMPOqA0NU51IPvbP; 25:Gp13ZBsufM0DKJhMbpTp6Ez8n1vM1MtyB+x7yZJWXx61pIDxpQ7fFcnxuHBaV5pwgGrUMFjMmu1hXlwgaTxJnURDQlFeTmTWLmvFlpJtV8gctvPQjnM7TYHqXVdyG+xd44dxFsI9H5PsH5+nVxUd653ACo1X+5+mhj1mp9x2GFFyOquMUMvBwvT3OzvQ329Q4l3Ut5Owe/ZEnRaje/S+walhocPxY21bPlEbEubRD2KxxJH5l/OA/7KGort61t2/Q1WS9uPQXgvkLC3FMhf2NBAPuwbp97qktOR+6XXYXakmtR5bThq50FQAZxnxS5Ioph6KLGpTLx5JWMSgZ+l6PQ==; 31:4ChHOvsWmu8zNx/C5d7rQVbPTnvIEOtnd4AMM2+Yk+7H7GUvWTiE/Ud/XHcRS5TSOcepNqHNArQr1mYOt4qYffyzMQdjGxt5JyG4aQO9lR+xA68CsFc2JzvYr0M+0wJ73zjr6jZWrSd7B1xLh+2fkd30ZTVARsN3GqjDqPs4E8RVSPDzroXm+4PfjLNgnEasuVPHmuCu5cPBgR6ASmgpPoufG5BsuUYGdYe3h/riN+o= X-MS-TrafficTypeDiagnostic: AM5PR0501MB2036: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2036; 20:TahjZO2bIZ1CkrX/RBzdygEak1ygTz6axGoXoLE3tnywx0cpHMIxhp9QJP1P7zExyaLCWfnVyB5do4HO0dZKLudA8dZBNn+k6b0dovwcBwn+9nf8QbdKFdp9fSeVnMjCcX4zxsyW+xhpSPBT3tuZ1r9/s8h73LaX5ovHUnRZ02nMPHlK3HeTGHXW169J0pDy1ap9rYrT+YLLMlJlrK9CyJrGGx9lCjz040Y8M8aAahKajP+ZnD1F1jwag/DvEVX7zxz7t1uHwUJft9iKPIJx3J6FcnkDU274ZyLnK22Zdmslbh2dw189vlK3oDv8wJBN5/N/8s07r8vVCSIV+GJK85ODuE9LfAL+WvU0D5w/s8LJtTB7tHpryIuX6Mkh7YOyXtNyf6NgrieKg0DNOkvOPcmFxFPsN7TOSCT/7CueU2cVCpASRZXbFuhcQ/Pxo6LlU+4B1MsNAQsa8pz5P0X5gA7iSDKITf9XpqeWY1Vj4FMDw4GSZSih04+0SGKaxkl3; 4:yv6vlL57JXqNRdShSgFtEShrEKBl50LnMEDzy10/4jmyodbTSNUKWmfbw8M5Z6OQTcvNeivhWuCOHIdIu2jrq0YZE0Q4PWscwlNRKSP8y/hT5QYzMpH1eUoJiq472xs1qHIQIQGokmMnivMeU72A2rxK/5uHkG9tk9mhn/AKbsD4GJJYEoRDGntL2Jt8HnmkN+HZeGtqEaI/fvQqQud/p0F4faebac6eGa1BuiLK/Dp4WIz5kX1D5cREUOCNMil58c+wRiX6YdypPAwdXV69/w== 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)(10201501046)(3231280)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM5PR0501MB2036; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0501MB2036; X-Forefront-PRVS: 0723A02764 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(366004)(136003)(346002)(376002)(189003)(199004)(86362001)(2906002)(52116002)(6246003)(105586002)(53936002)(229853002)(55016002)(9686003)(25786009)(81166006)(956004)(8936002)(106356001)(4326008)(8676002)(50466002)(7736002)(98436002)(486006)(11346002)(446003)(476003)(81156014)(97736004)(5660300001)(23726003)(186003)(6666003)(33896004)(6116002)(47776003)(1076002)(66066001)(305945005)(33656002)(58126008)(26005)(3846002)(6506007)(76176011)(575784001)(478600001)(16526019)(386003)(7696005)(316002)(68736007)(14444005)(6916009)(16586007)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0501MB2036; H:yongseok-MBP.local; 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-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0501MB2036; 23:zsDWY41zjSY22gcXqNAosPZuFZCgQLa24l9CXOH?= =?us-ascii?Q?UiYTiMbjfmlmCCP7MzdaICngRZmxAx9vHj53SQOFKiQypwlQk2a9o4A3zPDm?= =?us-ascii?Q?Nb0IAAnOSDPO6n6I53T8310I4i9DQau+nFBStfte63FxlfMyyLT/fvDWlCjG?= =?us-ascii?Q?GYVotZFeSo9QHowwoZ3uTgXOyUhc/PlNUNwTZVUF/irYIGlo/DeUEBvzl9Kp?= =?us-ascii?Q?BdQgDks6kdj3+slKB1tTBsFmHX9HdNgi5vvPHVj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McaSjmmokzPrSQ4CK5lwZzAlI5yG9vtLLCI+OEFU7DoN7Q==; 5:yIITeTp9f1GAWuVh4A38o3cCfYiK67D1yqSBi4+AAM5kZ1YsSIV8kKPsKpSPMCdzOJjqgcT38yGN0pVXYVh7V2cyzNMO5fHZVkDwNZst4p8R+zjM/P9OeM7WjCpPyXPVolFg8IPe/4wvFxQu+hqX8qly6eYpW3hZ9H0oGZUMh+w=; 24:sEq/X24IESnJByJACrMW0BnbzwuiT4+BiE+j8+Yt5bEYRrbmCrbJzOwyog7D+7kUyVpdTFIgNgdSL1uPncjiyQCjtDCrYbwjdg728demU+4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2036; 7:YhDkjragOs46KIlXuvp7N5gXfc45sMI855LwmgDrFG0YGn7HxK8jD1PiN7E0OrHPf2ig9EjJkdtM49SzvWKu6Upp+tMVc5JsL9d0YZxsU8JFzNiWHcg/CLa62pPH96nlhJAVzdwunbV6GM98O2DgQeISlJj9YSencx6M94c57fesHYSVsHu7jhL4gnUZEQ/mI1LfpYOAupBt4wn/F5mD6178t7eWZcsxw0oG5aLGZC9XBiljzlmUwRicLdVWTfzN X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 00:12:15.9127 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5f270e0-a599-415f-957a-08d5e142cd0d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0501MB2036 Subject: Re: [dpdk-dev] [PATCH v2 08/20] net/mlx5: add flow IPv4 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: Wed, 04 Jul 2018 00:12:18 -0000 On Wed, Jun 27, 2018 at 05:07:40PM +0200, Nelio Laranjeiro wrote: > Signed-off-by: Nelio Laranjeiro > --- > drivers/net/mlx5/mlx5_flow.c | 83 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 83 insertions(+) > > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 6a576ddd9..8e7a0bb5a 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -540,6 +540,86 @@ mlx5_flow_item_vlan(const struct rte_flow_item *item, struct rte_flow *flow, > return size; > } > > +/** > + * Validate IPv4 layer and possibly create the Verbs specification. Instead of 'possibly', please describe what it does in details like I asked for the previous patch: net/mlx5: support flow Ethernet item among with drop action Thanks, Yongseok > + * > + * @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_ipv4(const struct rte_flow_item *item, struct rte_flow *flow, > + const size_t flow_size, struct rte_flow_error *error) > +{ > + const struct rte_flow_item_ipv4 *spec = item->spec; > + const struct rte_flow_item_ipv4 *mask = item->mask; > + const struct rte_flow_item_ipv4 nic_mask = { > + .hdr = { > + .src_addr = RTE_BE32(0xffffffff), > + .dst_addr = RTE_BE32(0xffffffff), > + .type_of_service = 0xff, > + .next_proto_id = 0xff, > + }, > + }; > + unsigned int size = sizeof(struct ibv_flow_spec_ipv4_ext); > + struct ibv_flow_spec_ipv4_ext ipv4 = { > + .type = IBV_FLOW_SPEC_IPV4_EXT, > + .size = size, > + }; > + int ret; > + > + if (flow->layers & MLX5_FLOW_LAYER_OUTER_L3) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, > + "multiple L3 layers not supported"); > + else if (flow->layers & MLX5_FLOW_LAYER_OUTER_L4) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, > + "L3 cannot follow an L4 layer."); > + if (!mask) > + mask = &rte_flow_item_ipv4_mask; > + ret = mlx5_flow_item_validate(item, (const uint8_t *)mask, > + (const uint8_t *)&nic_mask, > + sizeof(struct rte_flow_item_ipv4), error); > + if (ret < 0) > + return ret; > + flow->layers |= MLX5_FLOW_LAYER_OUTER_L3_IPV4; > + if (size > flow_size) > + return size; > + if (spec) { > + ipv4.val = (struct ibv_flow_ipv4_ext_filter){ > + .src_ip = spec->hdr.src_addr, > + .dst_ip = spec->hdr.dst_addr, > + .proto = spec->hdr.next_proto_id, > + .tos = spec->hdr.type_of_service, > + }; > + ipv4.mask = (struct ibv_flow_ipv4_ext_filter){ > + .src_ip = mask->hdr.src_addr, > + .dst_ip = mask->hdr.dst_addr, > + .proto = mask->hdr.next_proto_id, > + .tos = mask->hdr.type_of_service, > + }; > + /* Remove unwanted bits from values. */ > + ipv4.val.src_ip &= ipv4.mask.src_ip; > + ipv4.val.dst_ip &= ipv4.mask.dst_ip; > + ipv4.val.proto &= ipv4.mask.proto; > + ipv4.val.tos &= ipv4.mask.tos; > + } > + mlx5_flow_spec_verbs_add(flow, &ipv4, size); > + return size; > +} > + > /** > * Validate items provided by the user. > * > @@ -576,6 +656,9 @@ mlx5_flow_items(const struct rte_flow_item items[], > case RTE_FLOW_ITEM_TYPE_VLAN: > ret = mlx5_flow_item_vlan(items, flow, remain, error); > break; > + case RTE_FLOW_ITEM_TYPE_IPV4: > + ret = mlx5_flow_item_ipv4(items, flow, remain, error); > + break; > default: > return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ITEM, > -- > 2.18.0 >