From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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: , X-List-Received-Date: Mon, 08 Oct 2018 18:02:17 -0000 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 flo= w") Cc: Ori Kam Signed-off-by: Yongseok Koh --- 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_a= ction *action, struct priv *priv =3D dev->data->dev_private; const struct rte_flow_action_queue *queue =3D action->conf; =20 - 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_act= ion *action, const struct rte_flow_action_rss *rss =3D action->conf; unsigned int i; =20 - 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) =20 +#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_d= v.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; } =20 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; } =20 diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flo= w_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; } =20 --=20 2.11.0