From patchwork Mon Oct 8 18:02:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongseok Koh X-Patchwork-Id: 46290 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 40CDA1B426; Mon, 8 Oct 2018 20:02:13 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00061.outbound.protection.outlook.com [40.107.0.61]) by dpdk.org (Postfix) with ESMTP id 8D3E11B3F5 for ; Mon, 8 Oct 2018 20:02:11 +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=vpn/fWAYfkZy9C4+vozs47V9mDOpNN16T2QsZbCe6vM=; b=oCmHQSNIwN2LrAw6tcn71mfqpoOMNb5RZfUtiJdAaaVIkn0LWksQ4ufdIFSGksvXB+fPxgZvwlR0STeSGg8kT7jBQbTgUFAA+IsjHfyePGKTZvKUCNrjemX5jGgR51K3PYEuxG2kHumirDwZb0eBKFghmEglbeUOGQVungGDmLU= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4074.eurprd05.prod.outlook.com (52.134.72.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.22; Mon, 8 Oct 2018 18:02:10 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1207.024; Mon, 8 Oct 2018 18:02:10 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh , Ori Kam Thread-Topic: [PATCH 1/7] net/mlx5: fix wrong flow action macro usage Thread-Index: AQHUXzEIqAkNL04+1UqcScsq6jzJCA== Date: Mon, 8 Oct 2018 18:02:09 +0000 Message-ID: <20181008180150.39273-2-yskoh@mellanox.com> References: <20181008180150.39273-1-yskoh@mellanox.com> In-Reply-To: <20181008180150.39273-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0016.namprd02.prod.outlook.com (2603:10b6:a02:ee::29) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB4074; 6:FhGmwVz9onK9jmY5f9OAi4QZGDJMbcI1/xY4CEu+zE8nAG2IQlNbgxEat6xxgL8MCEgfBtkehwPRjTm1KQFg4C6fmLf8e/wsT5R5xjdeDcZZLskDSGrNXqunwybADhhP+hiOYiOgcuZVbmoTjLpsc5IgYheKbSCv6iELfX/LSnzZ0/ixvKDcnEruk91qv1OxS8cKd3pbEjRFUHD84Xisbt16Gu8hIUle+0Rvxun5PcgnYo+qf5DjKdkdTBmZ+qFtybTfIIqus73RebyF5yC7zyuWmQNTdFLJuEi1Pr3xxIqbQhd7skesQRbgya9jTs6QtSFA/eglFJx5sjrgGsPLEyv/T78flC2OjMkAVzCA7GmuKzKfULyu7jDxlFoprXzFOJJJMth6XH5JI7kcSjWVflMjamlNTNwt5eK6ui7ucTE5sAvLLDP/6gqFSoUTz58pNibrsbXwLVFjfLqPYTPvIQ==; 5:nSZtaNLyrYfVi4tcXtC9GRMD4MQAkXxc94EqscQ7cFf10xN7PF76hEy25nm3PnMuKy5+OYxjFPW2TDYtQLJiAyj4MJlMHPu6o1lPqW0OV/IuTqMDIRQuHWFy46eJPkH51XggBVrRyOtUOOnVPtP1VcSj0yhBDGGSP7w1LdFlqqE=; 7:nEdLvW+IulvDsBiy9W91kU5RYp+an5bGbU4tzxUuHsBC+oSkcx4SZyRarRi0G1BUhnHR6PBwYuRjHj9vDZ33RhLFQ/P3UV4PMgP/0rU1SxpEqjbXNvqE110GjN2mxkzeLsDy7fNbnN11FL8ogkgCCixk0qzEfjmP9thHjiKTfYqjHSD7gXb2vNlODgIf015GVADa1iQ+nF4luRqX+S2LT74aWuQbo5OYvF9S1ovNhqdXSXr/35Pi23EpT1eQesyv x-ms-office365-filtering-correlation-id: fced7f61-e54e-4630-f4eb-08d62d482ab9 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:DB3PR0502MB4074; x-ms-traffictypediagnostic: DB3PR0502MB4074: 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)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:DB3PR0502MB4074; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB4074; x-forefront-prvs: 081904387B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(396003)(136003)(366004)(199004)(189003)(37006003)(53936002)(54906003)(71190400001)(14454004)(4326008)(26005)(97736004)(86362001)(5660300001)(71200400001)(66066001)(6512007)(186003)(446003)(316002)(6436002)(478600001)(25786009)(102836004)(476003)(8936002)(11346002)(81156014)(106356001)(6862004)(7736002)(8676002)(305945005)(81166006)(6486002)(256004)(486006)(2900100001)(2616005)(36756003)(105586002)(1076002)(6116002)(386003)(5250100002)(2906002)(3846002)(76176011)(6506007)(52116002)(68736007)(6636002)(99286004)(107886003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4074; H:DB3PR0502MB3980.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: PrEzUs59VX1H5CyRpOPGn/Lsmzsq1WCdOZjZ7/t1QElWvoI5kPIo1NIn5SOwgIDzfv0c4ZQEmLifJ/EbSYenXa1zqfC1NhB0Pk5tfFEKOMCHl4BEHGeTrRviGeWQEAuWM/jfSftOtf0S7Ddv5TaRULK/I0V3FKkeCg0y9SplvayeAW9oufB4Caogyb3YNZ75NQ5TfIe196tABQEkihRDJ9b9XGXVrF8frfMwjSfu+qmkCtJnYps/iLh9OcB1OqHJyojkxhE1JELf8LbAetzC+zWZqNC7XjJsZwlOZYBQdy7cTHx8Omq8p8btZmZqbaB+4hBAAlGs7Ra7cNu6DiBBgiFrc0ndPKXtJpMtPdQn3F8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: fced7f61-e54e-4630-f4eb-08d62d482ab9 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2018 18:02:10.0181 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4074 Subject: [dpdk-dev] [PATCH 1/7] net/mlx5: fix wrong flow action macro usage 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" Fixes: 5c83c536783c ("net/mlx5: add Direct Verbs final functions") Cc: Ori Kam Signed-off-by: Yongseok Koh Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow.h | 10 ---------- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index a91f9911d..79d4a2619 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -65,16 +65,6 @@ (MLX5_FLOW_LAYER_INNER_L2 | MLX5_FLOW_LAYER_INNER_L3 | \ MLX5_FLOW_LAYER_INNER_L4) -/* Actions that modify the fate of matching traffic. */ -#define MLX5_FLOW_FATE_DROP (1u << 0) -#define MLX5_FLOW_FATE_QUEUE (1u << 1) -#define MLX5_FLOW_FATE_RSS (1u << 2) - -/* Modify a packet. */ -#define MLX5_FLOW_MOD_FLAG (1u << 0) -#define MLX5_FLOW_MOD_MARK (1u << 1) -#define MLX5_FLOW_MOD_COUNT (1u << 2) - /* Actions */ #define MLX5_ACTION_DROP (1u << 0) #define MLX5_ACTION_QUEUE (1u << 1) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 7d325320a..5678dc35f 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1251,7 +1251,7 @@ flow_dv_apply(struct rte_eth_dev *dev, struct rte_flow *flow, LIST_FOREACH(dev_flow, &flow->dev_flows, next) { struct mlx5_flow_dv *dv = &dev_flow->dv; if (dv->hrxq) { - if (flow->actions & MLX5_FLOW_FATE_DROP) + if (flow->actions & MLX5_ACTION_DROP) mlx5_hrxq_drop_release(dev); else mlx5_hrxq_release(dev, dv->hrxq); From patchwork Mon Oct 8 18:02:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongseok Koh X-Patchwork-Id: 46291 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 59F601B42D; Mon, 8 Oct 2018 20:02:15 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70049.outbound.protection.outlook.com [40.107.7.49]) by dpdk.org (Postfix) with ESMTP id 34DAF1B415 for ; Mon, 8 Oct 2018 20:02:13 +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=6YqfpIWGCD+QigHzYxhAMBtuagyyUgZNU1lGuMmH91w=; b=p/zbkUjyG/ob5I8tZpe6DVBABoq4Yxasydn/PaeNTdGYSjLuIxKUimulPYQP1xonVznLPkjWyQsq8rIYQFhFz1Ksf+sPPx/0rXxJE1DQ2GVhsawE1jSfhk1MglZZWG9/r7mQR4/Uv6lpWV5I6BRkgCo9Dew/SPibkCIuhdNAQ+o= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3979.eurprd05.prod.outlook.com (52.134.67.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.26; Mon, 8 Oct 2018 18:02:11 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1207.024; Mon, 8 Oct 2018 18:02:11 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh , Ori Kam Thread-Topic: [PATCH 2/7] net/mlx5: use standard IP protocol numbers Thread-Index: AQHUXzEJR83Qll3tLU+We+/PYI6wxw== Date: Mon, 8 Oct 2018 18:02:11 +0000 Message-ID: <20181008180150.39273-3-yskoh@mellanox.com> References: <20181008180150.39273-1-yskoh@mellanox.com> In-Reply-To: <20181008180150.39273-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0016.namprd02.prod.outlook.com (2603:10b6:a02:ee::29) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3979; 6:QdkYVFZwrr6MRGZFSVMRZTg7vumV40ZiRSqLkmMCgvllr++bIaSeIdAKsa8+LXDSgy29ludEFJSs9iZqYbpx8YJYwuFh9zdvv+QgfV8ZdpDlxc1fYfKac0NnEEhAUD0iySl0mqqOV9Mpbr5Yt8CgcgfPUd+8VK9gkXVnXOGwK6jKGoqepyAqoHH6ihruddor4sFNBVRErv6P7lnMEiVzX1ds10zCWW0gWcJBPQKEA/2wmxmhd1VE0vH11HFpkyRawQKB+w9nBRoVA5BdZoFeoJe2qqPzbTRJjbH87IfmPCLtDNSaHvWxdZhRKTKhOxNTxJZNooOpDcOrFnHSPe/HEhh3FeicTvZpMvJmWhP9QyV0KSz7SbG8MopMUUhVZ2G00HEwKXbksH2AE533EGllaFyLlggqEsrurKlufIX9mgFMaU3vvM/eOOiXnRhJmVnDUUdO7T4Seq/o2h+R1xnaNw==; 5:xZZzmkdlkNCal0tgS6Bp7babRe+qSj5kR/yg7caRYiWKJDKpNyu2m0lZaJhE6sN0HERSyPXAZvIn5JmbWkC+7wXtLbDfUtCRo43oDDJohrE/cBWyvb6gTD5VTMWHYGZE15ECaGX8Q+qq/knp5Nu06/j0DJc1RG2WWTOCcMQf1dY=; 7:mK+8070kMduZG19qYyvcjOvvvgUxyWaGmus+JmyOS/D2+ywxQO2VfaeELrPVfMwCgjtaY2dQmoDN9evtLbn4dLDATZhe7OIpl/LamoYUbl/kf87OL4jTcPqTyoUhKV37YXhZ8tF9Gl5s9BO6mGcPjETuzvenYOXirOH9g4NGciHPGEAx3nXMMIgetXdaWQwU6/253qROrnNs/ABfIKztOrgUNzVhoVLSlmiP1hoJtfJFk+Tf6YIY9a+OAUmmm7h0 x-ms-office365-filtering-correlation-id: 70d7d19b-7a92-4e56-2d7e-08d62d482b87 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:DB3PR0502MB3979; x-ms-traffictypediagnostic: DB3PR0502MB3979: 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)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:DB3PR0502MB3979; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3979; x-forefront-prvs: 081904387B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(396003)(366004)(189003)(199004)(8676002)(2616005)(11346002)(8936002)(476003)(66066001)(446003)(99286004)(14454004)(71200400001)(105586002)(71190400001)(54906003)(97736004)(316002)(2900100001)(305945005)(106356001)(486006)(186003)(26005)(68736007)(76176011)(81166006)(86362001)(52116002)(5250100002)(81156014)(25786009)(7736002)(36756003)(5660300001)(6116002)(1076002)(256004)(3846002)(14444005)(37006003)(4326008)(6862004)(6506007)(478600001)(386003)(102836004)(53936002)(6512007)(6436002)(6636002)(2906002)(107886003)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3979; H:DB3PR0502MB3980.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: WWEGv1vzzY/aMJH3GWpnzTH+QUWqy1iBRJ/bQHgdxfvWQ2EbhTqUI5vY4kwezXbVPHoBHQz/Jg07D2/mcdnKi1l5G8H8z/tH+i60mwlvhAcyzn0lHtpfiCVU/I5FUMNNDpPl9chpUQluSmSAYJcGMYkN1WEO6mairTHLmStHYASTHLn1w/SSAqiO8VvY0kxTPHAjWFDk3G4VwxPy6mDZa/+cjfgz/KnLHRYAHm2h5iv4Zd71+KMJjyr79EEir0geq3Q5Q5Y62QPimRhOSiecyRguxDVyukdSpUT6iBzzL1ezO77qjslEEyvOZZWjEwuEsCRaCGyDd5XOLZUHTfV1+x4ZHzeuC7nnLyyz5Y6nEtw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70d7d19b-7a92-4e56-2d7e-08d62d482b87 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2018 18:02:11.6202 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3979 Subject: [dpdk-dev] [PATCH 2/7] net/mlx5: use standard IP protocol numbers 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" Fixes: 0f8775dd8f1c ("net/mlx5: add support for multiple flow drivers") Cc: Ori Kam Signed-off-by: Yongseok Koh Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow.c | 9 +++++---- drivers/net/mlx5/mlx5_flow.h | 9 ++++----- drivers/net/mlx5/mlx5_flow_verbs.c | 7 ++++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 8007bf10f..ef5e4684f 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -3,6 +3,7 @@ * Copyright 2016 Mellanox Technologies, Ltd */ +#include #include #include #include @@ -1188,7 +1189,7 @@ mlx5_flow_validate_item_udp(const struct rte_flow_item *item, const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL); int ret; - if (target_protocol != 0xff && target_protocol != MLX5_IP_PROTOCOL_UDP) + if (target_protocol != 0xff && target_protocol != IPPROTO_UDP) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "protocol filtering not compatible" @@ -1239,7 +1240,7 @@ mlx5_flow_validate_item_tcp(const struct rte_flow_item *item, const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL); int ret; - if (target_protocol != 0xff && target_protocol != MLX5_IP_PROTOCOL_TCP) + if (target_protocol != 0xff && target_protocol != IPPROTO_TCP) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "protocol filtering not compatible" @@ -1459,7 +1460,7 @@ mlx5_flow_validate_item_gre(const struct rte_flow_item *item, const struct rte_flow_item_gre *mask = item->mask; int ret; - if (target_protocol != 0xff && target_protocol != MLX5_IP_PROTOCOL_GRE) + if (target_protocol != 0xff && target_protocol != IPPROTO_GRE) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "protocol filtering not compatible" @@ -1516,7 +1517,7 @@ mlx5_flow_validate_item_mpls(const struct rte_flow_item *item __rte_unused, const struct rte_flow_item_mpls *mask = item->mask; int ret; - if (target_protocol != 0xff && target_protocol != MLX5_IP_PROTOCOL_MPLS) + if (target_protocol != 0xff && target_protocol != IPPROTO_MPLS) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "protocol filtering not compatible" diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 79d4a2619..1ac871b3a 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -5,6 +5,7 @@ #ifndef RTE_PMD_MLX5_FLOW_H_ #define RTE_PMD_MLX5_FLOW_H_ +#include #include #include #include @@ -78,11 +79,9 @@ #define MLX5_ACTION_OF_SET_VLAN_VID (1u << 9) #define MLX5_ACTION_OF_SET_VLAN_PCP (1u << 10) -/* possible L3 layers protocols filtering. */ -#define MLX5_IP_PROTOCOL_TCP 6 -#define MLX5_IP_PROTOCOL_UDP 17 -#define MLX5_IP_PROTOCOL_GRE 47 -#define MLX5_IP_PROTOCOL_MPLS 147 +#ifndef IPPROTO_MPLS +#define IPPROTO_MPLS 137 +#endif /* Internent Protocol versions. */ #define MLX5_VXLAN 4789 diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 05ab5fdad..076bb39e6 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -2,6 +2,7 @@ * Copyright 2018 Mellanox Technologies, Ltd */ +#include #include #include #include @@ -683,11 +684,11 @@ flow_verbs_translate_item_gre(const struct rte_flow_item *item __rte_unused, if (*item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV4) flow_verbs_item_gre_ip_protocol_update(verbs->attr, IBV_FLOW_SPEC_IPV4_EXT, - MLX5_IP_PROTOCOL_GRE); + IPPROTO_GRE); else flow_verbs_item_gre_ip_protocol_update(verbs->attr, IBV_FLOW_SPEC_IPV6, - MLX5_IP_PROTOCOL_GRE); + IPPROTO_GRE); flow_verbs_spec_add(dev_flow, &tunnel, size); verbs->attr->priority = MLX5_PRIORITY_MAP_L2; *item_flags |= MLX5_FLOW_LAYER_GRE; @@ -1091,7 +1092,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, if (ret < 0) return ret; if (next_protocol != 0xff && - next_protocol != MLX5_IP_PROTOCOL_MPLS) + next_protocol != IPPROTO_MPLS) return rte_flow_error_set (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, items, From patchwork Mon Oct 8 18:02:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongseok Koh X-Patchwork-Id: 46292 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3367A1B436; Mon, 8 Oct 2018 20:02:18 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70079.outbound.protection.outlook.com [40.107.7.79]) by dpdk.org (Postfix) with ESMTP id 809D71B42F for ; Mon, 8 Oct 2018 20:02:15 +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=afUpcsEN7UCYZUlpOE9WUOIquTBQ0+wZGOb7lluIQ0I=; b=kNz9tANxvxkt5SDlsJBxyj0ec7mtovj0F7mv55iixgeEHtp+uDiUvEOikKrEo5rbn+ju4CQbKaXtGE7SEJtZzZzFTqZkGocn0WN5gtqcEft/tzGb49Ds09pnKif0cYPLLnq4go78qVOzOo1uRbt9BjOUrigrZ+qrIBaXxAgJMrI= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3979.eurprd05.prod.outlook.com (52.134.67.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.26; Mon, 8 Oct 2018 18:02:13 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1207.024; Mon, 8 Oct 2018 18:02:13 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh , Ori Kam Thread-Topic: [PATCH 3/7] net/mlx5: rename flow macros Thread-Index: AQHUXzEKUvcEWtYrx0+ccOADEfvbsg== Date: Mon, 8 Oct 2018 18:02:13 +0000 Message-ID: <20181008180150.39273-4-yskoh@mellanox.com> References: <20181008180150.39273-1-yskoh@mellanox.com> In-Reply-To: <20181008180150.39273-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0016.namprd02.prod.outlook.com (2603:10b6:a02:ee::29) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3979; 6:ocWIfNZ1IPy9DJeSap3Lq9kQGILe5iSfW22d2farsXSG6Fo3+x2Wf651PGmKTv24nuWcSEyHGc1LJdxfA9nriQy62ecvk1BF5FCuhZTYPalBS1LmoDh8z9w65LE2et+B2Xr7ITKodm2aZRJTzrBR7qP7ypTMjV3HQjjGRJ35hxlDxXi8B1IjH5jieuHXLCT/XIB8kLWoe8r0U1cHxMShWlyupZeq+Pvbsl8zZGahnI6VVsQmuIqcvyMpnkMr1xj6XM5C3EcOXXO27btItOl30h4MZxYgGm7ylPfHAUzFnLo2GkzX/s1CDz+bmkiCm2abKgZQop0kPlvOXWohPCfeKuy4xwjsQ0oLDweTnXgGnB0dGJZOvMb+XUEygTCrLJ7mj6tekNjW6i5Vb5cQqXazJP+NbNsMKLfYYZQ/VpO6c543bBaFFVxizyVrJdBxA7igN8IYNx3IqK3mguVEFoEvkw==; 5:QD/N2QLj08tt/4lqMFSryjxO6LxckYe4y52RF1JtNiFd1H0BaNxKJRHJgnr/td/Rj4wuZ9vKOVV7xXHkZ7YQLeLLpcZkNM1aF3wJnd/Qeeh5fCIo5etToldWsqQNfkEZp0GdwD//ddH9hzeNUl8IfyP7Hd7Ce3CwrTzChtxqHRY=; 7:myf7OdW9pv0S/YO59CqUfoIn8F7lyDoINM6u4BpYroaQnRSNqTJn51WE7sOH3pb+/yAnejzBJBzRmJT/R7RPdPUo1OLU26+caSuLNQKccqUPunBXJ/pCbUE+zK6LgIKkqQaVL+07xFYKXOvmMemudaj4mf+pmr5cMm4m56GduAsvd375c9cgNi6m8X55rUM42lOBDZ1PyR8pEEoS2yPNvU/LcZSJZVn9/SlTr4qglSuizlnrckNaakeRHzbYlvdY x-ms-office365-filtering-correlation-id: 628b46bd-61c2-4d2f-55f5-08d62d482c7b 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:DB3PR0502MB3979; x-ms-traffictypediagnostic: DB3PR0502MB3979: 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)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:DB3PR0502MB3979; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3979; x-forefront-prvs: 081904387B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(396003)(366004)(51234002)(189003)(199004)(8676002)(2616005)(11346002)(8936002)(476003)(4744004)(66066001)(446003)(99286004)(14454004)(71200400001)(105586002)(71190400001)(54906003)(97736004)(316002)(2900100001)(305945005)(106356001)(486006)(186003)(26005)(68736007)(76176011)(81166006)(86362001)(52116002)(5250100002)(81156014)(25786009)(7736002)(36756003)(5660300001)(6116002)(1076002)(53946003)(256004)(3846002)(14444005)(37006003)(4326008)(6862004)(6506007)(478600001)(386003)(102836004)(53936002)(6512007)(6436002)(6636002)(2906002)(107886003)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3979; H:DB3PR0502MB3980.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: Z3O3DWczVGZur9GDpOSCk5XIFnoBQNoRlYhnEM9YHgO7XWZNTT2z7HvuHBUG/9nyCkRPnuy6XMCdu9usOzHVTLHte6ONAaEave28TyP1QV8rN9mesfXYo2QkkGVN+Ss3DCNoqlHt12TebjA5nZ2plQ7Yn9yNc+CIqbidtBeSAbgF61DkfjjKS0Zy5XVDjkIr7gTokzZVJrxC5EW4/ApDJCjRsyoEpPEp7F//U8M8lshMt8B22Gm+5nud4r4UrTOpOb9TzdToQMlvicNxPvSXuOGp2Z8FW8C5ZFuIIinobZIKaMyarNF8DA0Q1seqbDfGXfW9C5GDpYWqs6EEOoS0xNwcaOO9k9rwlZFqha42GPA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 628b46bd-61c2-4d2f-55f5-08d62d482c7b X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2018 18:02:13.1632 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3979 Subject: [dpdk-dev] [PATCH 3/7] net/mlx5: rename flow macros 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" MLX5_ACTION_* -> MLX5_FLOW_ACTION_* MLX5_VXLAN* -> MLX5_UDP_PORT_VXLAN* Fixes: 0f8775dd8f1c ("net/mlx5: add support for multiple flow drivers") Fixes: edcdef4e5fe4 ("net/mlx5: add Linux TC flower driver for E-Switch flow") Cc: Ori Kam Signed-off-by: Yongseok Koh Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow.c | 31 +++++++++++++++------------ drivers/net/mlx5/mlx5_flow.h | 28 ++++++++++++------------ drivers/net/mlx5/mlx5_flow_dv.c | 24 ++++++++++----------- drivers/net/mlx5/mlx5_flow_tcf.c | 26 +++++++++++----------- drivers/net/mlx5/mlx5_flow_verbs.c | 44 +++++++++++++++++++------------------- 5 files changed, 78 insertions(+), 75 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index ef5e4684f..69afd4625 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -537,7 +537,7 @@ mlx5_flow_rxq_flags_set(struct rte_eth_dev *dev, struct rte_flow *flow) { struct priv *priv = dev->data->dev_private; const int mark = !!(flow->actions & - (MLX5_ACTION_FLAG | MLX5_ACTION_MARK)); + (MLX5_FLOW_ACTION_FLAG | MLX5_FLOW_ACTION_MARK)); const int tunnel = !!(flow->layers & MLX5_FLOW_LAYER_TUNNEL); unsigned int i; @@ -581,7 +581,7 @@ mlx5_flow_rxq_flags_trim(struct rte_eth_dev *dev, struct rte_flow *flow) { struct priv *priv = dev->data->dev_private; const int mark = !!(flow->actions & - (MLX5_ACTION_FLAG | MLX5_ACTION_MARK)); + (MLX5_FLOW_ACTION_FLAG | MLX5_FLOW_ACTION_MARK)); const int tunnel = !!(flow->layers & MLX5_FLOW_LAYER_TUNNEL); unsigned int i; @@ -656,15 +656,15 @@ mlx5_flow_validate_action_flag(uint64_t action_flags, struct rte_flow_error *error) { - if (action_flags & MLX5_ACTION_DROP) + if (action_flags & MLX5_FLOW_ACTION_DROP) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't drop and flag in same flow"); - if (action_flags & MLX5_ACTION_MARK) + if (action_flags & MLX5_FLOW_ACTION_MARK) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't mark and flag in same flow"); - if (action_flags & MLX5_ACTION_FLAG) + if (action_flags & MLX5_FLOW_ACTION_FLAG) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 flag" @@ -703,15 +703,15 @@ mlx5_flow_validate_action_mark(const struct rte_flow_action *action, &mark->id, "mark id must in 0 <= id < " RTE_STR(MLX5_FLOW_MARK_MAX)); - if (action_flags & MLX5_ACTION_DROP) + if (action_flags & MLX5_FLOW_ACTION_DROP) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't drop and mark in same flow"); - if (action_flags & MLX5_ACTION_FLAG) + if (action_flags & MLX5_FLOW_ACTION_FLAG) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't flag and mark in same flow"); - if (action_flags & MLX5_ACTION_MARK) + if (action_flags & MLX5_FLOW_ACTION_MARK) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 flag actions in same" @@ -734,16 +734,17 @@ int mlx5_flow_validate_action_drop(uint64_t action_flags, struct rte_flow_error *error) { - if (action_flags & MLX5_ACTION_FLAG) + if (action_flags & MLX5_FLOW_ACTION_FLAG) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't drop and flag in same flow"); - if (action_flags & MLX5_ACTION_MARK) + if (action_flags & MLX5_FLOW_ACTION_MARK) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't drop and mark in same flow"); if (action_flags & - (MLX5_ACTION_DROP | MLX5_ACTION_QUEUE | MLX5_ACTION_RSS)) + (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | + MLX5_FLOW_ACTION_RSS)) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 fate actions in" @@ -776,7 +777,8 @@ mlx5_flow_validate_action_queue(const struct rte_flow_action *action, const struct rte_flow_action_queue *queue = action->conf; if (action_flags & - (MLX5_ACTION_DROP | MLX5_ACTION_QUEUE | MLX5_ACTION_RSS)) + (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | + MLX5_FLOW_ACTION_RSS)) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 fate actions in" @@ -820,7 +822,8 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action, unsigned int i; if (action_flags & - (MLX5_ACTION_DROP | MLX5_ACTION_QUEUE | MLX5_ACTION_RSS)) + (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | + MLX5_FLOW_ACTION_RSS)) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 fate actions" @@ -2304,7 +2307,7 @@ mlx5_flow_query_count(struct rte_flow *flow __rte_unused, struct rte_flow_error *error) { #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT - if (flow->actions & MLX5_ACTION_COUNT) { + if (flow->actions & MLX5_FLOW_ACTION_COUNT) { struct rte_flow_query_count *qc = data; uint64_t counters[2] = {0, 0}; struct ibv_query_counter_set_attr query_cs_attr = { diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 1ac871b3a..309e4d4f2 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -67,25 +67,25 @@ MLX5_FLOW_LAYER_INNER_L4) /* Actions */ -#define MLX5_ACTION_DROP (1u << 0) -#define MLX5_ACTION_QUEUE (1u << 1) -#define MLX5_ACTION_RSS (1u << 2) -#define MLX5_ACTION_FLAG (1u << 3) -#define MLX5_ACTION_MARK (1u << 4) -#define MLX5_ACTION_COUNT (1u << 5) -#define MLX5_ACTION_PORT_ID (1u << 6) -#define MLX5_ACTION_OF_POP_VLAN (1u << 7) -#define MLX5_ACTION_OF_PUSH_VLAN (1u << 8) -#define MLX5_ACTION_OF_SET_VLAN_VID (1u << 9) -#define MLX5_ACTION_OF_SET_VLAN_PCP (1u << 10) +#define MLX5_FLOW_ACTION_DROP (1u << 0) +#define MLX5_FLOW_ACTION_QUEUE (1u << 1) +#define MLX5_FLOW_ACTION_RSS (1u << 2) +#define MLX5_FLOW_ACTION_FLAG (1u << 3) +#define MLX5_FLOW_ACTION_MARK (1u << 4) +#define MLX5_FLOW_ACTION_COUNT (1u << 5) +#define MLX5_FLOW_ACTION_PORT_ID (1u << 6) +#define MLX5_FLOW_ACTION_OF_POP_VLAN (1u << 7) +#define MLX5_FLOW_ACTION_OF_PUSH_VLAN (1u << 8) +#define MLX5_FLOW_ACTION_OF_SET_VLAN_VID (1u << 9) +#define MLX5_FLOW_ACTION_OF_SET_VLAN_PCP (1u << 10) #ifndef IPPROTO_MPLS #define IPPROTO_MPLS 137 #endif -/* Internent Protocol versions. */ -#define MLX5_VXLAN 4789 -#define MLX5_VXLAN_GPE 4790 +/* UDP port numbers for VxLAN. */ +#define MLX5_UDP_PORT_VXLAN 4789 +#define MLX5_UDP_PORT_VXLAN_GPE 4790 /* Priority reserved for default flows. */ #define MLX5_FLOW_PRIO_RSVD ((uint32_t)-1) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 5678dc35f..e6c84d444 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -236,7 +236,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_FLAG; + action_flags |= MLX5_FLOW_ACTION_FLAG; ++actions_n; break; case RTE_FLOW_ACTION_TYPE_MARK: @@ -245,7 +245,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_MARK; + action_flags |= MLX5_FLOW_ACTION_MARK; ++actions_n; break; case RTE_FLOW_ACTION_TYPE_DROP: @@ -253,7 +253,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_DROP; + action_flags |= MLX5_FLOW_ACTION_DROP; ++actions_n; break; case RTE_FLOW_ACTION_TYPE_QUEUE: @@ -262,7 +262,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_QUEUE; + action_flags |= MLX5_FLOW_ACTION_QUEUE; ++actions_n; break; case RTE_FLOW_ACTION_TYPE_RSS: @@ -271,14 +271,14 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_RSS; + action_flags |= MLX5_FLOW_ACTION_RSS; ++actions_n; break; case RTE_FLOW_ACTION_TYPE_COUNT: ret = mlx5_flow_validate_action_count(dev, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_COUNT; + action_flags |= MLX5_FLOW_ACTION_COUNT; ++actions_n; break; default: @@ -838,8 +838,8 @@ flow_dv_translate_item_vxlan(void *matcher, void *key, outer_headers); headers_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers); } - dport = item->type == RTE_FLOW_ITEM_TYPE_VXLAN ? MLX5_VXLAN : - MLX5_VXLAN_GPE; + dport = item->type == RTE_FLOW_ITEM_TYPE_VXLAN ? + MLX5_UDP_PORT_VXLAN : MLX5_UDP_PORT_VXLAN_GPE; if (!MLX5_GET16(fte_match_set_lyr_2_4, headers_v, udp_dport)) { MLX5_SET(fte_match_set_lyr_2_4, headers_m, udp_dport, 0xFFFF); MLX5_SET(fte_match_set_lyr_2_4, headers_v, udp_dport, dport); @@ -978,7 +978,7 @@ flow_dv_create_action(const struct rte_flow_action *action, break; case RTE_FLOW_ACTION_TYPE_DROP: dev_flow->dv.actions[actions_n].type = MLX5DV_FLOW_ACTION_DROP; - flow->actions |= MLX5_ACTION_DROP; + flow->actions |= MLX5_FLOW_ACTION_DROP; break; case RTE_FLOW_ACTION_TYPE_QUEUE: queue = action->conf; @@ -1195,7 +1195,7 @@ flow_dv_apply(struct rte_eth_dev *dev, struct rte_flow *flow, LIST_FOREACH(dev_flow, &flow->dev_flows, next) { dv = &dev_flow->dv; n = dv->actions_n; - if (flow->actions & MLX5_ACTION_DROP) { + if (flow->actions & MLX5_FLOW_ACTION_DROP) { dv->hrxq = mlx5_hrxq_drop_new(dev); if (!dv->hrxq) { rte_flow_error_set @@ -1251,7 +1251,7 @@ flow_dv_apply(struct rte_eth_dev *dev, struct rte_flow *flow, LIST_FOREACH(dev_flow, &flow->dev_flows, next) { struct mlx5_flow_dv *dv = &dev_flow->dv; if (dv->hrxq) { - if (flow->actions & MLX5_ACTION_DROP) + if (flow->actions & MLX5_FLOW_ACTION_DROP) mlx5_hrxq_drop_release(dev); else mlx5_hrxq_release(dev, dv->hrxq); @@ -1318,7 +1318,7 @@ flow_dv_remove(struct rte_eth_dev *dev, struct rte_flow *flow) dv->flow = NULL; } if (dv->hrxq) { - if (flow->actions & MLX5_ACTION_DROP) + if (flow->actions & MLX5_FLOW_ACTION_DROP) mlx5_hrxq_drop_release(dev); else mlx5_hrxq_release(dev, dv->hrxq); diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 14376188e..c87046365 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -225,7 +225,7 @@ struct flow_tcf_ptoi { unsigned int ifindex; /**< Network interface index. */ }; -#define MLX5_TCF_FATE_ACTIONS (MLX5_ACTION_DROP | MLX5_ACTION_PORT_ID) +#define MLX5_TCF_FATE_ACTIONS (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID) /** * Retrieve mask for pattern item. @@ -668,7 +668,7 @@ flow_tcf_validate(struct rte_eth_dev *dev, conf.port_id, "missing data to convert port ID to" " ifindex"); - action_flags |= MLX5_ACTION_PORT_ID; + action_flags |= MLX5_FLOW_ACTION_PORT_ID; break; case RTE_FLOW_ACTION_TYPE_DROP: if (action_flags & MLX5_TCF_FATE_ACTIONS) @@ -676,19 +676,19 @@ flow_tcf_validate(struct rte_eth_dev *dev, (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, actions, "can't have multiple fate actions"); - action_flags |= MLX5_ACTION_DROP; + action_flags |= MLX5_FLOW_ACTION_DROP; break; case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN: - action_flags |= MLX5_ACTION_OF_POP_VLAN; + action_flags |= MLX5_FLOW_ACTION_OF_POP_VLAN; break; case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: - action_flags |= MLX5_ACTION_OF_PUSH_VLAN; + action_flags |= MLX5_FLOW_ACTION_OF_PUSH_VLAN; break; case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: - action_flags |= MLX5_ACTION_OF_SET_VLAN_VID; + action_flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_VID; break; case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: - action_flags |= MLX5_ACTION_OF_SET_VLAN_PCP; + action_flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_PCP; break; default: return rte_flow_error_set(error, ENOTSUP, @@ -809,26 +809,26 @@ flow_tcf_get_actions_and_size(const struct rte_flow_action actions[], SZ_NLATTR_STRZ_OF("mirred") + SZ_NLATTR_NEST + /* TCA_ACT_OPTIONS. */ SZ_NLATTR_TYPE_OF(struct tc_mirred); - flags |= MLX5_ACTION_PORT_ID; + flags |= MLX5_FLOW_ACTION_PORT_ID; break; case RTE_FLOW_ACTION_TYPE_DROP: size += SZ_NLATTR_NEST + /* na_act_index. */ SZ_NLATTR_STRZ_OF("gact") + SZ_NLATTR_NEST + /* TCA_ACT_OPTIONS. */ SZ_NLATTR_TYPE_OF(struct tc_gact); - flags |= MLX5_ACTION_DROP; + flags |= MLX5_FLOW_ACTION_DROP; break; case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN: - flags |= MLX5_ACTION_OF_POP_VLAN; + flags |= MLX5_FLOW_ACTION_OF_POP_VLAN; goto action_of_vlan; case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: - flags |= MLX5_ACTION_OF_PUSH_VLAN; + flags |= MLX5_FLOW_ACTION_OF_PUSH_VLAN; goto action_of_vlan; case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: - flags |= MLX5_ACTION_OF_SET_VLAN_VID; + flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_VID; goto action_of_vlan; case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: - flags |= MLX5_ACTION_OF_SET_VLAN_PCP; + flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_PCP; goto action_of_vlan; action_of_vlan: size += SZ_NLATTR_NEST + /* na_act_index. */ diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 076bb39e6..0ecbc8121 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -755,7 +755,7 @@ flow_verbs_translate_action_drop(uint64_t *action_flags, }; flow_verbs_spec_add(dev_flow, &drop, size); - *action_flags |= MLX5_ACTION_DROP; + *action_flags |= MLX5_FLOW_ACTION_DROP; } /** @@ -781,7 +781,7 @@ flow_verbs_translate_action_queue(const struct rte_flow_action *action, if (flow->queue) (*flow->queue)[0] = queue->index; flow->rss.queue_num = 1; - *action_flags |= MLX5_ACTION_QUEUE; + *action_flags |= MLX5_FLOW_ACTION_QUEUE; } /** @@ -811,7 +811,7 @@ flow_verbs_translate_action_rss(const struct rte_flow_action *action, memcpy(flow->key, rss->key, MLX5_RSS_HASH_KEY_LEN); flow->rss.types = rss->types; flow->rss.level = rss->level; - *action_flags |= MLX5_ACTION_RSS; + *action_flags |= MLX5_FLOW_ACTION_RSS; } /** @@ -838,7 +838,7 @@ flow_verbs_translate_action_flag .size = size, .tag_id = mlx5_flow_mark_set(MLX5_FLOW_MARK_DEFAULT), }; - *action_flags |= MLX5_ACTION_MARK; + *action_flags |= MLX5_FLOW_ACTION_MARK; flow_verbs_spec_add(dev_flow, &tag, size); } @@ -898,14 +898,14 @@ flow_verbs_translate_action_mark(const struct rte_flow_action *action, }; struct mlx5_flow_verbs *verbs = &dev_flow->verbs; - if (*action_flags & MLX5_ACTION_FLAG) { + if (*action_flags & MLX5_FLOW_ACTION_FLAG) { flow_verbs_mark_update(verbs, mark->id); size = 0; } else { tag.tag_id = mlx5_flow_mark_set(mark->id); flow_verbs_spec_add(dev_flow, &tag, size); } - *action_flags |= MLX5_ACTION_MARK; + *action_flags |= MLX5_FLOW_ACTION_MARK; } /** @@ -954,7 +954,7 @@ flow_verbs_translate_action_count(struct rte_eth_dev *dev, "cannot get counter" " context."); } - *action_flags |= MLX5_ACTION_COUNT; + *action_flags |= MLX5_FLOW_ACTION_COUNT; #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT counter.counter_set_handle = flow->counter->cs->handle; flow_verbs_spec_add(dev_flow, &counter, size); @@ -1116,7 +1116,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_FLAG; + action_flags |= MLX5_FLOW_ACTION_FLAG; break; case RTE_FLOW_ACTION_TYPE_MARK: ret = mlx5_flow_validate_action_mark(actions, @@ -1124,14 +1124,14 @@ flow_verbs_validate(struct rte_eth_dev *dev, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_MARK; + action_flags |= MLX5_FLOW_ACTION_MARK; break; case RTE_FLOW_ACTION_TYPE_DROP: ret = mlx5_flow_validate_action_drop(action_flags, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_DROP; + action_flags |= MLX5_FLOW_ACTION_DROP; break; case RTE_FLOW_ACTION_TYPE_QUEUE: ret = mlx5_flow_validate_action_queue(actions, @@ -1139,7 +1139,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_QUEUE; + action_flags |= MLX5_FLOW_ACTION_QUEUE; break; case RTE_FLOW_ACTION_TYPE_RSS: ret = mlx5_flow_validate_action_rss(actions, @@ -1147,13 +1147,13 @@ flow_verbs_validate(struct rte_eth_dev *dev, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_RSS; + action_flags |= MLX5_FLOW_ACTION_RSS; break; case RTE_FLOW_ACTION_TYPE_COUNT: ret = mlx5_flow_validate_action_count(dev, error); if (ret < 0) return ret; - action_flags |= MLX5_ACTION_COUNT; + action_flags |= MLX5_FLOW_ACTION_COUNT; break; default: return rte_flow_error_set(error, ENOTSUP, @@ -1191,27 +1191,27 @@ flow_verbs_get_actions_and_size(const struct rte_flow_action actions[], break; case RTE_FLOW_ACTION_TYPE_FLAG: size += sizeof(struct ibv_flow_spec_action_tag); - detected_actions |= MLX5_ACTION_FLAG; + detected_actions |= MLX5_FLOW_ACTION_FLAG; break; case RTE_FLOW_ACTION_TYPE_MARK: size += sizeof(struct ibv_flow_spec_action_tag); - detected_actions |= MLX5_ACTION_MARK; + detected_actions |= MLX5_FLOW_ACTION_MARK; break; case RTE_FLOW_ACTION_TYPE_DROP: size += sizeof(struct ibv_flow_spec_action_drop); - detected_actions |= MLX5_ACTION_DROP; + detected_actions |= MLX5_FLOW_ACTION_DROP; break; case RTE_FLOW_ACTION_TYPE_QUEUE: - detected_actions |= MLX5_ACTION_QUEUE; + detected_actions |= MLX5_FLOW_ACTION_QUEUE; break; case RTE_FLOW_ACTION_TYPE_RSS: - detected_actions |= MLX5_ACTION_RSS; + detected_actions |= MLX5_FLOW_ACTION_RSS; break; case RTE_FLOW_ACTION_TYPE_COUNT: #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT size += sizeof(struct ibv_flow_spec_counter_action); #endif - detected_actions |= MLX5_ACTION_COUNT; + detected_actions |= MLX5_FLOW_ACTION_COUNT; break; default: break; @@ -1519,7 +1519,7 @@ flow_verbs_remove(struct rte_eth_dev *dev, struct rte_flow *flow) verbs->flow = NULL; } if (verbs->hrxq) { - if (flow->actions & MLX5_ACTION_DROP) + if (flow->actions & MLX5_FLOW_ACTION_DROP) mlx5_hrxq_drop_release(dev); else mlx5_hrxq_release(dev, verbs->hrxq); @@ -1578,7 +1578,7 @@ flow_verbs_apply(struct rte_eth_dev *dev, struct rte_flow *flow, LIST_FOREACH(dev_flow, &flow->dev_flows, next) { verbs = &dev_flow->verbs; - if (flow->actions & MLX5_ACTION_DROP) { + if (flow->actions & MLX5_FLOW_ACTION_DROP) { verbs->hrxq = mlx5_hrxq_drop_new(dev); if (!verbs->hrxq) { rte_flow_error_set @@ -1628,7 +1628,7 @@ flow_verbs_apply(struct rte_eth_dev *dev, struct rte_flow *flow, LIST_FOREACH(dev_flow, &flow->dev_flows, next) { verbs = &dev_flow->verbs; if (verbs->hrxq) { - if (flow->actions & MLX5_ACTION_DROP) + if (flow->actions & MLX5_FLOW_ACTION_DROP) mlx5_hrxq_drop_release(dev); else mlx5_hrxq_release(dev, verbs->hrxq); From patchwork Mon Oct 8 18:02:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongseok Koh X-Patchwork-Id: 46293 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 34F3D1B43C; Mon, 8 Oct 2018 20:02:20 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70079.outbound.protection.outlook.com [40.107.7.79]) by dpdk.org (Postfix) with ESMTP id E261F1B431 for ; Mon, 8 Oct 2018 20:02:15 +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=wVyuygalAxEVtht91lBAskK5RL2tnABe+zzrFi9QKrg=; b=ZorUaxKiRqyw7D1OWAiLy5tl01PtU2cFBWGYd8BNlnuIPBWawLSbzvnvKMW03+Ri+RdMsHu/QokhdGLK4aboE9JQq2bcnUPLtTuxoSWxoZHQpNFTvx9b/0fZP1TFgGQXV+z5RmBd1YMxdhi2ETW1UjKKZ6AsFOw3uxWtsDfIH4E= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3979.eurprd05.prod.outlook.com (52.134.67.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.26; Mon, 8 Oct 2018 18:02:15 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1207.024; Mon, 8 Oct 2018 18:02:15 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh , Ori Kam Thread-Topic: [PATCH 4/7] net/mlx5: fix validation of VLAN ID in flow spec Thread-Index: AQHUXzEL1bGd4/vOG0mTbV6nxicwmw== Date: Mon, 8 Oct 2018 18:02:14 +0000 Message-ID: <20181008180150.39273-5-yskoh@mellanox.com> References: <20181008180150.39273-1-yskoh@mellanox.com> In-Reply-To: <20181008180150.39273-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0016.namprd02.prod.outlook.com (2603:10b6:a02:ee::29) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3979; 6:5HaSKK2ol/53d1slgKCwXded8K8CcbROVXOSGA/Vl6cQxgi1BdZ99U0JSEMsm0jeVxAL0okzhnWsebxYZyqoox118oMRYKrF3pO8YpfSdAOQHLUWMYl+yZ+ISrruSFzJqfJK/GdNMC+pA7qnFl8h/yPTMeQz/8B3nSVtxw76JQqhh3ub3rw2+Miz3RRFVy7iJVtDFqNGTjHjdDFAudoh+KZqRcKh2GZvL6NEWTO3lDlDRtBpJOjPNkmH0WB+JthFUoNJcBw1WjNlMRZa42SNJ2AYqEHR64yvRh7Be8McJDxC4OKONc0/0FmpkIe3RRWq7Z9qXIX1nqKtt7ZTZXpqbsKMqkszp9cfOwC1FFD9n8kB6dyrPhXKYgNXoxw0uYYxWisIIgRYnRX0I8uiCJLRPMZjl0kb4Zi/Of011XnHjE/+j1M04jqUfAfwstynJuDi8wLaP08pEnwzEnk+1mcYEw==; 5:sV12425gW/xtlpeMiFElkNFQ+ZWW4UQ4oUW9jq+pP2nGkiou1B1xYEHzEANDBHOkFCfrQTA70UEL//Qv0r93oeHJKfBnLWaZGcQJ0Sxp//Li75FsjpYkif5+RvPJSiLKBmov4tB0zJrZF24EYJ0uI+FJkQ9F14gdOuHh1JXK1zQ=; 7:qrDKHQerF6WxMh3fXyqwF+JzRv/8EHTAM4UYiXgjXFu6yoc7JIy1PIHnzdOgdmKP5VsyWyZ4WrPYHgrYIP9q4g8K9b+aAAztQA9vROebjDWkVr93XfVmPv7rehFYv13NhXuqAYPGMz7gruzn9Gs87nwNIgo04v0OoipndVYD25CxPfIrW8F/poDH+FBlGrXq1XCix+VlSp6Fw0FMzWSgZw6IexUvxYiPmYL8qxMY2u7pt9auqz0jbzF/fMvA2T4C x-ms-office365-filtering-correlation-id: 1d9b538d-9e9f-4c9e-dfd1-08d62d482d65 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:DB3PR0502MB3979; x-ms-traffictypediagnostic: DB3PR0502MB3979: 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)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:DB3PR0502MB3979; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3979; x-forefront-prvs: 081904387B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(396003)(366004)(189003)(199004)(8676002)(2616005)(11346002)(8936002)(476003)(66066001)(446003)(99286004)(14454004)(71200400001)(105586002)(71190400001)(54906003)(97736004)(316002)(2900100001)(305945005)(106356001)(486006)(186003)(26005)(68736007)(76176011)(81166006)(86362001)(52116002)(575784001)(5250100002)(81156014)(25786009)(7736002)(36756003)(5660300001)(6116002)(1076002)(256004)(3846002)(14444005)(37006003)(4326008)(6862004)(6506007)(478600001)(386003)(102836004)(53936002)(6512007)(6436002)(6636002)(2906002)(107886003)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3979; H:DB3PR0502MB3980.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: CHvv5Ki3V91Xj0XlHBFtVMm5sthPthRbPXF7hbZDOZkxTMocykS05+6ohFuU2icDucTvOmR84pG5buXPDAdBnU0VVIU47gDCuL1uoM/iCa+H4Pejq4rlJI471pgbhPMTAVVXdCs8Z3jexX/i6JpEt0JgO04vQFh4ihgt6bO1gXYNLkGxFTMp5yP3DnVkPd/jZpL9ti2n6pcVWVv+v5VWYB4ScoFV16VI3BG1IMEl7zNRmcQLYhIcFEQi5835xU3/CGIFurasE2HIZsfEKA+RJ7nNV8vIcUmTQEdnL7GtlCe/c7miozqcnpU/cH91bWkoImjqffTdRbcJCEgJcN/xLLcYjLmncJIB+isdodtwZ+E= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d9b538d-9e9f-4c9e-dfd1-08d62d482d65 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2018 18:02:14.9055 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3979 Subject: [dpdk-dev] [PATCH 4/7] net/mlx5: fix validation of VLAN ID in flow spec 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" This can cause crash by null pointer reference. Fixes: 4f07e13d6af5 ("net/mlx5: split flow validation to dedicated function") Cc: Ori Kam Signed-off-by: Yongseok Koh Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 69afd4625..c497cacce 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1012,6 +1012,7 @@ mlx5_flow_validate_item_vlan(const struct rte_flow_item *item, .tci = RTE_BE16(0x0fff), .inner_type = RTE_BE16(0xffff), }; + uint16_t vlan_tag = 0; const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL); int ret; const uint32_t l34m = tunnel ? (MLX5_FLOW_LAYER_INNER_L3 | @@ -1037,11 +1038,15 @@ mlx5_flow_validate_item_vlan(const struct rte_flow_item *item, error); if (ret) return ret; + if (spec) { + vlan_tag = spec->tci; + vlan_tag &= mask->tci; + } /* * From verbs perspective an empty VLAN is equivalent * to a packet without VLAN layer. */ - if (!spec->tci) + if (!vlan_tag) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, item->spec, From patchwork Mon Oct 8 18:02:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongseok Koh X-Patchwork-Id: 46294 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B6BE1B441; Mon, 8 Oct 2018 20:02:22 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70044.outbound.protection.outlook.com [40.107.7.44]) by dpdk.org (Postfix) with ESMTP id 845561B432 for ; Mon, 8 Oct 2018 20:02:17 +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=WeYZ5zXdOPBZ+sw+cIZdnPzJlkKyo9TwBmvqSIakhv4=; b=lhdmzPJxM7Lhb1mgyhMTj9FjExR7YKE2EYJqw+AiJvHGysvn2UET0j41sRhvAWbtXR7lxtrvPfCeIu9CPSfyGEQ51RxjVT5U8jwYzO64H2/6SJLQmnCXU1AtgKZN2kmI5pJXXxp5XMubWOwBmRgaiXiKL1jIuF1tt0He2hzKosY= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3979.eurprd05.prod.outlook.com (52.134.67.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.26; Mon, 8 Oct 2018 18:02:16 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1207.024; Mon, 8 Oct 2018 18:02:16 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh , Ori Kam Thread-Topic: [PATCH 5/7] net/mlx5: fix flow validation for no fate action Thread-Index: AQHUXzEM8infCsBmYUeClCiUReVwzw== Date: Mon, 8 Oct 2018 18:02:16 +0000 Message-ID: <20181008180150.39273-6-yskoh@mellanox.com> References: <20181008180150.39273-1-yskoh@mellanox.com> In-Reply-To: <20181008180150.39273-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0016.namprd02.prod.outlook.com (2603:10b6:a02:ee::29) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3979; 6:ElFwuNdx5S2qYX+IN+NsPWJPYs3JtV3vnpes6gWGcPd6ofBnOdR2tZRlPeDDketgoCTjYR15vqeBEAm5DFXoVvW01DIkiz1m/7yW1zsYsl+lHNHmrl8KVWZ8cS0NWwaAokpnyhHe0K8Di/7hJ8olI6CIwKOP7iNu8/4m7byMy8OwYA1mD2mtoOAsZRWFvyH7yJ8XuLayiOMUeTZbA6JFGaRaEQQ1OqAVwc6ld/U5fLMvmxpaJnDQD4GJCm4GPceoFcs50VxztgoICj4/k1ddzca6HvdgccuIsKFp6MCvPTcy0pGFrrOPuciJ8P9qzrYjlbD5FaNFbe1WXJbgfgJI89zo9oXgyfn7wnt2kh9cwiWIIixIgFYTQmCpllk1gW7IdfNV35HHyYafoS3FZ+MIwU5lwbG28JR18GhG7LJq33+Njcshdg4Qk8+7oYB3y52hDSMu0VIt9NgRvSc5nm+rNA==; 5:kPrIftEJEAqwofbEB0qccx6E3D1CyHMSEqrxUQFmIYjbpqPNZqbmJNi/e6jPExL7iBYL1j/Z3ZXawaBNOUTjkDQVXHGAceXgT2WbcbVO2oc7EnN5tqR//WaVDa8I6lZk1L5s6LNSyQgX2XxL6jD4REq+j576cZ6y/MTH4tfowmk=; 7:s1NIVBQR33VnJ8GK4xsVDL11C75kiYoCwQlZzjEL2Z5u0MYzWljN+uRbpI9uDqBIUB/voLvet0qPTdpWVWlr++939LMMxFQPEqZurMINs9dDG/LGY8MXYol4HHyXVZhNiJLH+EideD8dnAR8zo4dQh/HeLjaXUZpugbBnVlCGE56wgSmkeMCcf1kiG6K3umpzefqMLHYbedr6hbFBZcXh1GMXhudJw13jCtpV4A53iYhUTut+I8fvL/XZT7wp1Wu x-ms-office365-filtering-correlation-id: d3401de6-022d-425a-a190-08d62d482e70 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:DB3PR0502MB3979; x-ms-traffictypediagnostic: DB3PR0502MB3979: 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)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:DB3PR0502MB3979; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3979; x-forefront-prvs: 081904387B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(396003)(366004)(189003)(199004)(8676002)(2616005)(11346002)(8936002)(476003)(66066001)(446003)(99286004)(14454004)(71200400001)(105586002)(71190400001)(54906003)(97736004)(316002)(2900100001)(305945005)(106356001)(486006)(186003)(26005)(68736007)(76176011)(81166006)(86362001)(52116002)(5250100002)(81156014)(25786009)(7736002)(36756003)(5660300001)(6116002)(1076002)(256004)(3846002)(14444005)(37006003)(4326008)(6862004)(6506007)(478600001)(386003)(102836004)(53936002)(6512007)(6436002)(6636002)(2906002)(107886003)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3979; H:DB3PR0502MB3980.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: AZKZyBRr+hnYgP+dnIrWodo9XW3VwgTEbETGeWcFYjbUT828JqkvuF6xO9jyKm3iftBY9qFJCXzeeIVQyzwqID7erh8H7lm81GGwZ9hKH65iGcSKCaecg4AeKXjUC8Ml2MudY71DecduoGo5HD29lt3MeUoesh8DNykPtplsw2rIkPhJ09Dny8ic2CqTnTIkgyV/lek0IA9bpIfGp172tz45niTzDqCUBgwZxkxvPqkHvW6m9E0mrKnLpCY2Lfumd7wLTsQ3UO5XwOc3ZvWvBuGehiYMZ4AouchRlgqPIBtinBFMo6ldojtzh/k43+fD44mpE67waJ2TrQSk+rneAAFnDw6j2pmW4o0JKmmlIWY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3401de6-022d-425a-a190-08d62d482e70 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2018 18:02:16.3915 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3979 Subject: [dpdk-dev] [PATCH 5/7] net/mlx5: fix flow validation for no fate action 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" Fixes: 4f07e13d6af5 ("net/mlx5: split flow validation to dedicated function") Fixes: f7adfffa3de1 ("net/mlx5: add Direct Verbs validation function") Fixes: edcdef4e5fe4 ("net/mlx5: add Linux TC flower driver for E-Switch flow") Cc: Ori Kam Signed-off-by: Yongseok Koh Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow.c | 12 +++--------- drivers/net/mlx5/mlx5_flow.h | 3 +++ drivers/net/mlx5/mlx5_flow_dv.c | 4 ++++ drivers/net/mlx5/mlx5_flow_tcf.c | 4 ++++ drivers/net/mlx5/mlx5_flow_verbs.c | 4 ++++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index c497cacce..30aa95f14 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -742,9 +742,7 @@ mlx5_flow_validate_action_drop(uint64_t action_flags, return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't drop and mark in same flow"); - if (action_flags & - (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | - MLX5_FLOW_ACTION_RSS)) + if (action_flags & MLX5_FLOW_FATE_ACTIONS) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 fate actions in" @@ -776,9 +774,7 @@ mlx5_flow_validate_action_queue(const struct rte_flow_action *action, struct priv *priv = dev->data->dev_private; const struct rte_flow_action_queue *queue = action->conf; - if (action_flags & - (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | - MLX5_FLOW_ACTION_RSS)) + if (action_flags & MLX5_FLOW_FATE_ACTIONS) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 fate actions in" @@ -821,9 +817,7 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action, const struct rte_flow_action_rss *rss = action->conf; unsigned int i; - if (action_flags & - (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | - MLX5_FLOW_ACTION_RSS)) + if (action_flags & MLX5_FLOW_FATE_ACTIONS) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 fate actions" diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 309e4d4f2..12de841e8 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -79,6 +79,9 @@ #define MLX5_FLOW_ACTION_OF_SET_VLAN_VID (1u << 9) #define MLX5_FLOW_ACTION_OF_SET_VLAN_PCP (1u << 10) +#define MLX5_FLOW_FATE_ACTIONS \ + (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | MLX5_FLOW_ACTION_RSS) + #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 e6c84d444..2fb1d9ee7 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -288,6 +288,10 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, "action not supported"); } } + if (!(action_flags & MLX5_FLOW_FATE_ACTIONS)) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "no fate action is found"); return 0; } diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index c87046365..4c660d72b 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -697,6 +697,10 @@ flow_tcf_validate(struct rte_eth_dev *dev, "action not supported"); } } + if (!(action_flags & MLX5_TCF_FATE_ACTIONS)) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "no fate action is found"); return 0; } diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 0ecbc8121..3df467214 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -1162,6 +1162,10 @@ flow_verbs_validate(struct rte_eth_dev *dev, "action not supported"); } } + if (!(action_flags & MLX5_FLOW_FATE_ACTIONS)) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "no fate action is found"); return 0; } From patchwork Mon Oct 8 18:02:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongseok Koh X-Patchwork-Id: 46295 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5A7491B44C; Mon, 8 Oct 2018 20:02:25 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by dpdk.org (Postfix) with ESMTP id BA0691B439 for ; Mon, 8 Oct 2018 20:02: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=nM6Tg7zs42q0OFUduJgjUekU5FbJJ9UEDJtTiW49iSo=; b=MXBF6obFDKLAOeW/qXDOKAHgPpHLUFdDMk1q5sedm7bJCwfn0giN2wrunXODudJhl1Rou4ePFUNSdSIqAhbEIAuQoXRLdkcVBKqbIcHCdHtIX+MKLA5XjO58ualPxmHg1OALb2w1wanh84Z4++ybph3qtpnTFWb4ogWNmRZCTw0= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3979.eurprd05.prod.outlook.com (52.134.67.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.26; Mon, 8 Oct 2018 18:02:17 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1207.024; Mon, 8 Oct 2018 18:02:17 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh Thread-Topic: [PATCH 6/7] net/mlx5: add missing VLAN action constraints Thread-Index: AQHUXzEM2/YhtvssukqKWuftQuFGZg== Date: Mon, 8 Oct 2018 18:02:17 +0000 Message-ID: <20181008180150.39273-7-yskoh@mellanox.com> References: <20181008180150.39273-1-yskoh@mellanox.com> In-Reply-To: <20181008180150.39273-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0016.namprd02.prod.outlook.com (2603:10b6:a02:ee::29) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3979; 6:t41RkmNasMqdGTJkvws1KMJzTKVg7E0HuyMHqNNXeiTkMJ44IzA0nfuLtFjvBbWIRkOGyLVlmkp3DpfESmcF1gnsWptavy6OHz1+oUw4MBtYjRTfQLXHVFILu28FDEqfdLxVM7z//A5deQD2xMBs8Ue8xICrjY4ractCapsyipnqg0G95A8DU1QdZpsURZMOoBDQn53gOV5U/31Z3fm8WLhCQWaE0QdtKSF+t7h2h00phD8QkwHrJOS0me5g2z+G4Df0KSS/6LwWTPWdQiEw+35npMhUwrMtWTCFzpZ1RDlpJ2lo+F9iPbbb+OlKig6RM+KoE261vDzt2sSCDcuVSxVpNfcE+53RU0wpigQzAk8WPh5+IkrsfmL13LddOBJPwL3N0GqCOj8AS+XmtlwNzqxV+JZdyu1km8SuZlJwvfOVrwqsSc9w/psAMRsA0HOIt41Wo0nI+ss6U9gzsTXFBA==; 5:bdGQNu1ZjlDx/3G2Y9irAzeX/qT8LE1Btbo+1LlPyjnWiD69iF4w1/kA2XSExIGar9iRPmU32J17gS1J75Rj3Rg1Cx1bAo8u65WbLsDnM2XNcXgdYIT2GPnAco9JjCCZdTGhZmCKErDfnK7wJY1cPQ9e3nrgXNqpk0YOB1eSbNo=; 7:H3dcGE7TDXp0F+h0tta14vsiTlLEVc9iEuyUBT3pIw6P+KNADPEIyYhFlgEcf3K4h1xAOkChew7ohe+s3gElSAcNM5vv3sz0eg3DszppPrjZizGm2b8mwhJURlgO9qkQvDfl6XARij4VdD03kSwroRQwLztfu6+2jZVuyTylN16FM9BCe1y9yQVK8efRW1oz6kzHK/yzPypnwm31oqZ/XvC4Fw6ZtKLWKS7P2fBKFd9MYWWZlEsaFKxhToe8RdLi x-ms-office365-filtering-correlation-id: 7d2eea98-1383-4ab8-3000-08d62d482f3a 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:DB3PR0502MB3979; x-ms-traffictypediagnostic: DB3PR0502MB3979: 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)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:DB3PR0502MB3979; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3979; x-forefront-prvs: 081904387B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(396003)(366004)(189003)(199004)(8676002)(2616005)(11346002)(8936002)(476003)(66066001)(446003)(99286004)(14454004)(71200400001)(105586002)(71190400001)(54906003)(97736004)(316002)(2900100001)(305945005)(106356001)(486006)(186003)(26005)(68736007)(76176011)(81166006)(86362001)(52116002)(5250100002)(81156014)(25786009)(7736002)(36756003)(5660300001)(6116002)(1076002)(256004)(3846002)(14444005)(37006003)(4326008)(6862004)(6506007)(478600001)(386003)(102836004)(53936002)(6512007)(6436002)(6636002)(2906002)(107886003)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3979; H:DB3PR0502MB3980.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: 2r9r/A2hW3jUWteozSigEdeppbwkJwrrz2MRuctRn26Ksjhxy7eTPdHHbzusnOWjDm5DTB4dkb5U+cJhTB5gTAMBESL0RN6ELM59cUu3a8M8JVD0ruJg+Nc2773KaoJN5dWcxxRIOn8uyQHo8Tn6ONaxaQVUnu5917yycCsj5RiOv4EE6CREvfACTbpCzhxuL6x69lDMwawCGBx5d+qLDNURXUbmTwn2NnDMzHgkgDFh54yz1sX/XZ8kC1n8VKsXascYZZRnn2AKe254HOP/mSGebayAQ9mAXImZ6S70hvd5rdUQDdHTGvhXGIUpQ/a/gcRfnyyLNxXVOTNsrtVniuaWLAjDyyOFzOHoB2fTqeQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d2eea98-1383-4ab8-3000-08d62d482f3a X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2018 18:02:17.6144 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3979 Subject: [dpdk-dev] [PATCH 6/7] net/mlx5: add missing VLAN action constraints 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" 1) VLAN modify isn't supported by driver. 2) FW syndrome (0xA9C090): set_flow_table_entry: push vlan action fte in fdb can ONLY be forward to the uplink. 3) FW syndrome (0x294609): set_flow_table_entry: modify/pop/push actions in fdb flow table are supported only while forwarding to vport. Signed-off-by: Yongseok Koh --- drivers/net/mlx5/mlx5_flow_tcf.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 4c660d72b..0406e84f6 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -226,6 +226,9 @@ struct flow_tcf_ptoi { }; #define MLX5_TCF_FATE_ACTIONS (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID) +#define MLX5_TCF_VLAN_ACTIONS \ + (MLX5_FLOW_ACTION_OF_POP_VLAN | MLX5_FLOW_ACTION_OF_PUSH_VLAN | \ + MLX5_FLOW_ACTION_OF_SET_VLAN_VID | MLX5_FLOW_ACTION_OF_SET_VLAN_PCP) /** * Retrieve mask for pattern item. @@ -436,6 +439,7 @@ flow_tcf_validate(struct rte_eth_dev *dev, uint8_t next_protocol = -1; unsigned int tcm_ifindex = 0; struct flow_tcf_ptoi ptoi[PTOI_TABLE_SZ_MAX(dev)]; + struct rte_eth_dev *port_id_dev = NULL; bool in_port_id_set; int ret; @@ -669,6 +673,7 @@ flow_tcf_validate(struct rte_eth_dev *dev, "missing data to convert port ID to" " ifindex"); action_flags |= MLX5_FLOW_ACTION_PORT_ID; + port_id_dev = &rte_eth_devices[conf.port_id->id]; break; case RTE_FLOW_ACTION_TYPE_DROP: if (action_flags & MLX5_TCF_FATE_ACTIONS) @@ -685,9 +690,21 @@ flow_tcf_validate(struct rte_eth_dev *dev, action_flags |= MLX5_FLOW_ACTION_OF_PUSH_VLAN; break; case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: + if (!(action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN)) + return rte_flow_error_set + (error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "vlan modify is not supported," + " set action must follow push action"); action_flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_VID; break; case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: + if (!(action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN)) + return rte_flow_error_set + (error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "vlan modify is not supported," + " set action must follow push action"); action_flags |= MLX5_FLOW_ACTION_OF_SET_VLAN_PCP; break; default: @@ -697,6 +714,29 @@ flow_tcf_validate(struct rte_eth_dev *dev, "action not supported"); } } + /* + * FW syndrome (0xA9C090): + * set_flow_table_entry: push vlan action fte in fdb can ONLY be + * forward to the uplink. + */ + if ((action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN) && + (action_flags & MLX5_FLOW_ACTION_PORT_ID) && + ((struct priv *)port_id_dev->data->dev_private)->representor) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "vlan push can only be applied" + " when forwarding to uplink port"); + /* + * FW syndrome (0x294609): + * set_flow_table_entry: modify/pop/push actions in fdb flow table + * are supported only while forwarding to vport. + */ + if ((action_flags & MLX5_TCF_VLAN_ACTIONS) && + !(action_flags & MLX5_FLOW_ACTION_PORT_ID)) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "vlan actions are supported" + " only with port_id action"); if (!(action_flags & MLX5_TCF_FATE_ACTIONS)) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, actions, From patchwork Mon Oct 8 18:02:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongseok Koh X-Patchwork-Id: 46296 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6622D1B452; Mon, 8 Oct 2018 20:02:27 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70048.outbound.protection.outlook.com [40.107.7.48]) by dpdk.org (Postfix) with ESMTP id 6DD341B43E for ; Mon, 8 Oct 2018 20:02:20 +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=Qqbe+25eRokTzP8xUCFgmfXdHJOI68rrySLMzr2hXH8=; b=YL9/9nGvG7HJzZEUulnIIpg95A01X69agDG033Z9UMblnus6br1odqchb6T82x+E0iwG2nNp144/TmaI0iaHxqvIfJfbYJWbqb2+psW7tL4N0jjDs4TakerBVdz9cYhJMdUz0zjnxACCdquBSQNtMukDiHyZjOzCs/2S2Qdxs7Y= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3979.eurprd05.prod.outlook.com (52.134.67.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.26; Mon, 8 Oct 2018 18:02:19 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1207.024; Mon, 8 Oct 2018 18:02:19 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh , Ori Kam Thread-Topic: [PATCH 7/7] net/mlx5: fix errno values for flow engine Thread-Index: AQHUXzENNdMZ8oXg90uWPGaOeP92Dg== Date: Mon, 8 Oct 2018 18:02:19 +0000 Message-ID: <20181008180150.39273-8-yskoh@mellanox.com> References: <20181008180150.39273-1-yskoh@mellanox.com> In-Reply-To: <20181008180150.39273-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0016.namprd02.prod.outlook.com (2603:10b6:a02:ee::29) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3979; 6:3aXhqjWVPFpafTvKS/yy90WCPjep6xofVKx0mcGoNWhPcmbNLG7IbyOixBON9DHxmNys0CEyVjrS9pyim6r6F/PONvbkG2oM41hJFdVnwaMVM2uLx1hQghoC71YB+xAnvXjeg9/sYdxqpphMGCdaVlHFn4PRGfmiejcxbf8DSp/aKAAqPM/y4dR01NZ7s6oeS2yjkL2IAUBVjvkq0d5DzGWvjcYe34s5zgzy+PFaVfrMN49DefHizVu8ymO+SqqWoyhrMpW0WSTc/IbN6HrGaB+W0zEDOyz6w+YViUt3P6DK9kxEjcBKX5MM1BE5dpatB9MNjnwUjQRS8d1aDHpaJmshgqtfc0HG2dxG+J1s8+3/FAftmZ76DFsIAE/ecy/fbmsqacOHiT1t/hOgoLg+IbrQftppyFsX2dLPU2I7e51kGx2bRGi2xwKJpmO6S7Xal6llubLBYL4bY+NDlF09Fw==; 5:UkGpcreDut38aoovloxrmi0s3sFVc4E7WYckA2cjgt51WfKLl91aIhM0pwpqKgw10ZfSO8NP/I7/tlMgMLcRVnfjypFo+1cPv8mtZXc3FmUq4RcDvsWxXeDVP3/QqdW+6buvq1EJi3nSUDKktob5dt1dgjxzUdmX1yhXna6E1kk=; 7:1GXR7Qdbr/vYVkhVB7sg1SIcL3H+fEnSH9NMS4bOnbBGrpwbxNQKHA7D+/QyzOMMmyYq8QZu9cUZxLbD1utfdDk3j9cnGmc3MOWbd/GTvdu+nmaUoArg5Jw/jypOr4nQ+zA7wtJ8FaVoOga5+vRKQRl+GUCRnphHYjtDNXCQd9wWMHRWVOfpj/xwdwplYSArtl2sEPNOHyYv6N/SBFnAJaX7PQtr+NNOeZp2AFtEL1M7c9rrlCVPX8YStmg9DvRb x-ms-office365-filtering-correlation-id: c8ffac86-22a6-4acf-e7cf-08d62d48300c 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:DB3PR0502MB3979; x-ms-traffictypediagnostic: DB3PR0502MB3979: 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)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:DB3PR0502MB3979; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3979; x-forefront-prvs: 081904387B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(396003)(366004)(189003)(199004)(8676002)(2616005)(11346002)(8936002)(476003)(4744004)(66066001)(446003)(99286004)(14454004)(71200400001)(105586002)(71190400001)(54906003)(97736004)(316002)(2900100001)(305945005)(106356001)(486006)(186003)(26005)(68736007)(76176011)(81166006)(86362001)(52116002)(5250100002)(81156014)(25786009)(7736002)(36756003)(5660300001)(6116002)(1076002)(256004)(3846002)(14444005)(37006003)(4326008)(6862004)(6506007)(478600001)(386003)(102836004)(53936002)(6512007)(6436002)(966005)(6636002)(6306002)(2906002)(107886003)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3979; H:DB3PR0502MB3980.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: VoSRsFNliL4BaTeFC4kPyHmK0UuMRt9qHJ6opoKVn33nG1As0KeQ8aigclrer0suC6u3OL3tGXWxTcOhz+MlRzW6UCCbkYfydRYtN/cuRO14PmgwkbKkEsCgqrE7DtS56tSRVH4RNA1ZzjCGpStpcQUk2e9xagOPYa2+xZu++FP7uKkSDKRBEAAalTXqbSkTjZ4DDj5QnB0ZTrRl9cizBpzISmeQ9rVm042LZPnh/yPyiN7il1UrxntDSooKkypwgyegVKc2asolJyu3UhtCjNw6QDTm6DJa+KyhGhbQMviFzVW3+EKw0fFpm278DH8ig9VFm/0g2aXrPcQn0v9iiStCgXkYU7WeL3Hd+HjruzE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8ffac86-22a6-4acf-e7cf-08d62d48300c X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2018 18:02:19.1854 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3979 Subject: [dpdk-dev] [PATCH 7/7] net/mlx5: fix errno values for flow engine 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" Fixes: 4f07e13d6af5 ("net/mlx5: split flow validation to dedicated function") Fixes: f7adfffa3de1 ("net/mlx5: add Direct Verbs validation function") Fixes: edcdef4e5fe4 ("net/mlx5: add Linux TC flower driver for E-Switch flow") Cc: orika@mellanox.com Signed-off-by: Yongseok Koh Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow.c | 70 +++++++++++++++++++------------------- drivers/net/mlx5/mlx5_flow_dv.c | 2 +- drivers/net/mlx5/mlx5_flow_tcf.c | 8 ++--- drivers/net/mlx5/mlx5_flow_verbs.c | 4 +-- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 30aa95f14..ed60c40f9 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -452,10 +452,10 @@ mlx5_flow_item_acceptable(const struct rte_flow_item *item, } ret = memcmp(spec, last, size); if (ret != 0) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, - "range is not supported"); + "range is not valid"); } return 0; } @@ -657,15 +657,15 @@ mlx5_flow_validate_action_flag(uint64_t action_flags, { if (action_flags & MLX5_FLOW_ACTION_DROP) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't drop and flag in same flow"); if (action_flags & MLX5_FLOW_ACTION_MARK) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't mark and flag in same flow"); if (action_flags & MLX5_FLOW_ACTION_FLAG) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 flag" " actions in same flow"); @@ -704,17 +704,17 @@ mlx5_flow_validate_action_mark(const struct rte_flow_action *action, "mark id must in 0 <= id < " RTE_STR(MLX5_FLOW_MARK_MAX)); if (action_flags & MLX5_FLOW_ACTION_DROP) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't drop and mark in same flow"); if (action_flags & MLX5_FLOW_ACTION_FLAG) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't flag and mark in same flow"); if (action_flags & MLX5_FLOW_ACTION_MARK) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, - "can't have 2 flag actions in same" + "can't have 2 mark actions in same" " flow"); return 0; } @@ -735,15 +735,15 @@ mlx5_flow_validate_action_drop(uint64_t action_flags, struct rte_flow_error *error) { if (action_flags & MLX5_FLOW_ACTION_FLAG) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't drop and flag in same flow"); if (action_flags & MLX5_FLOW_ACTION_MARK) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't drop and mark in same flow"); if (action_flags & MLX5_FLOW_FATE_ACTIONS) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 fate actions in" " same flow"); @@ -775,7 +775,7 @@ mlx5_flow_validate_action_queue(const struct rte_flow_action *action, const struct rte_flow_action_queue *queue = action->conf; if (action_flags & MLX5_FLOW_FATE_ACTIONS) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 fate actions in" " same flow"); @@ -818,7 +818,7 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action, unsigned int i; if (action_flags & MLX5_FLOW_FATE_ACTIONS) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "can't have 2 fate actions" " in same flow"); @@ -931,7 +931,7 @@ mlx5_flow_validate_attributes(struct rte_eth_dev *dev, RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, NULL, "transfer is not supported"); if (!attributes->ingress) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, NULL, "ingress attribute is mandatory"); @@ -1017,11 +1017,11 @@ mlx5_flow_validate_item_vlan(const struct rte_flow_item *item, MLX5_FLOW_LAYER_OUTER_VLAN; if (item_flags & vlanm) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "VLAN layer already configured"); else if ((item_flags & l34m) != 0) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "L2 layer cannot follow L3/L4 layer"); if (!mask) @@ -1085,7 +1085,7 @@ mlx5_flow_validate_item_ipv4(const struct rte_flow_item *item, "multiple L3 layers not supported"); else if (item_flags & (tunnel ? MLX5_FLOW_LAYER_INNER_L4 : MLX5_FLOW_LAYER_OUTER_L4)) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "L3 cannot follow an L4 layer."); if (!mask) @@ -1141,7 +1141,7 @@ mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item, "multiple L3 layers not supported"); else if (item_flags & (tunnel ? MLX5_FLOW_LAYER_INNER_L4 : MLX5_FLOW_LAYER_OUTER_L4)) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "L3 cannot follow an L4 layer."); /* @@ -1192,18 +1192,18 @@ mlx5_flow_validate_item_udp(const struct rte_flow_item *item, int ret; if (target_protocol != 0xff && target_protocol != IPPROTO_UDP) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "protocol filtering not compatible" " with UDP layer"); if (!(item_flags & (tunnel ? MLX5_FLOW_LAYER_INNER_L3 : MLX5_FLOW_LAYER_OUTER_L3))) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "L3 is mandatory to filter on L4"); if (item_flags & (tunnel ? MLX5_FLOW_LAYER_INNER_L4 : MLX5_FLOW_LAYER_OUTER_L4)) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "L4 layer is already present"); if (!mask) @@ -1243,18 +1243,18 @@ mlx5_flow_validate_item_tcp(const struct rte_flow_item *item, int ret; if (target_protocol != 0xff && target_protocol != IPPROTO_TCP) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "protocol filtering not compatible" " with TCP layer"); if (!(item_flags & (tunnel ? MLX5_FLOW_LAYER_INNER_L3 : MLX5_FLOW_LAYER_OUTER_L3))) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "L3 is mandatory to filter on L4"); if (item_flags & (tunnel ? MLX5_FLOW_LAYER_INNER_L4 : MLX5_FLOW_LAYER_OUTER_L4)) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "L4 layer is already present"); if (!mask) @@ -1307,7 +1307,7 @@ mlx5_flow_validate_item_vxlan(const struct rte_flow_item *item, * https://tools.ietf.org/html/rfc7348 */ if (!(item_flags & MLX5_FLOW_LAYER_OUTER_L4_UDP)) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "no outer UDP layer found"); if (!mask) @@ -1335,11 +1335,11 @@ mlx5_flow_validate_item_vxlan(const struct rte_flow_item *item, * currently refused. */ if (!vlan_id) - return rte_flow_error_set(error, EINVAL, + return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "VXLAN vni cannot be 0"); if (!(item_flags & MLX5_FLOW_LAYER_OUTER)) - return rte_flow_error_set(error, EINVAL, + return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "VXLAN tunnel must be fully defined"); return 0; @@ -1393,7 +1393,7 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item, * https://tools.ietf.org/html/rfc7348 */ if (!(item_flags & MLX5_FLOW_LAYER_OUTER_L4_UDP)) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "no outer UDP layer found"); if (!mask) @@ -1407,7 +1407,7 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item, return ret; if (spec) { if (spec->protocol) - return rte_flow_error_set(error, EINVAL, + return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "VxLAN-GPE protocol" @@ -1426,11 +1426,11 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item, * is currently refused. */ if (!vlan_id) - return rte_flow_error_set(error, EINVAL, + return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "VXLAN-GPE vni cannot be 0"); if (!(item_flags & MLX5_FLOW_LAYER_OUTER)) - return rte_flow_error_set(error, EINVAL, + return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "VXLAN-GPE tunnel must be fully" " defined"); @@ -1463,7 +1463,7 @@ mlx5_flow_validate_item_gre(const struct rte_flow_item *item, int ret; if (target_protocol != 0xff && target_protocol != IPPROTO_GRE) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "protocol filtering not compatible" " with this GRE layer"); @@ -1520,7 +1520,7 @@ mlx5_flow_validate_item_mpls(const struct rte_flow_item *item __rte_unused, int ret; if (target_protocol != 0xff && target_protocol != IPPROTO_MPLS) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "protocol filtering not compatible" " with MPLS layer"); @@ -2336,7 +2336,7 @@ mlx5_flow_query_count(struct rte_flow *flow __rte_unused, } return 0; } - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "flow does not have counter"); diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 2fb1d9ee7..3bb462ceb 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -79,7 +79,7 @@ flow_dv_validate_attributes(struct rte_eth_dev *dev, NULL, "transfer is not supported"); if (!attributes->ingress) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, NULL, "ingress attribute is mandatory"); diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 0406e84f6..91f6ef678 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -291,7 +291,7 @@ flow_tcf_item_mask(const struct rte_flow_item *item, const void *mask_default, if (item->last && (((const uint8_t *)item->spec)[i] & mask[i]) != (((const uint8_t *)item->last)[i] & mask[i])) { - rte_flow_error_set(error, ENOTSUP, + rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_LAST, item->last, "range between \"spec\" and \"last\"" @@ -383,7 +383,7 @@ flow_tcf_validate_attributes(const struct rte_flow_attr *attr, attr, "lowest priority level is 0xfffe"); if (!attr->ingress) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, attr, "only ingress is supported"); if (attr->egress) @@ -655,7 +655,7 @@ flow_tcf_validate(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_PORT_ID: if (action_flags & MLX5_TCF_FATE_ACTIONS) return rte_flow_error_set - (error, ENOTSUP, + (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, actions, "can't have multiple fate actions"); conf.port_id = actions->conf; @@ -678,7 +678,7 @@ flow_tcf_validate(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_DROP: if (action_flags & MLX5_TCF_FATE_ACTIONS) return rte_flow_error_set - (error, ENOTSUP, + (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, actions, "can't have multiple fate actions"); action_flags |= MLX5_FLOW_ACTION_DROP; diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 3df467214..696447674 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -948,7 +948,7 @@ flow_verbs_translate_action_count(struct rte_eth_dev *dev, flow->counter = flow_verbs_counter_new(dev, count->shared, count->id); if (!flow->counter) - return rte_flow_error_set(error, ENOTSUP, + return rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_ACTION, action, "cannot get counter" @@ -1094,7 +1094,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, if (next_protocol != 0xff && next_protocol != IPPROTO_MPLS) return rte_flow_error_set - (error, ENOTSUP, + (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, items, "protocol filtering not compatible" " with MPLS layer");