From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 95FC4A0535; Thu, 23 Jan 2020 08:57:16 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6D5533253; Thu, 23 Jan 2020 08:57:16 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80077.outbound.protection.outlook.com [40.107.8.77]) by dpdk.org (Postfix) with ESMTP id 41BB92C6D for ; Thu, 23 Jan 2020 08:57:15 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gzpVEPTV6KfLasiEhy8Z79NErh/xnSofuGEW/+5F8nW6WuoRAGIKNo8k3Pt4moyUdAmAwvA0jQyxTfAKZA9xaF0/msl46b9n2hOiN4xeUX52JOtGeTnDMB+He0GEUP4Ktj5LikpdJLogEjry9Z9u+1+2vvTa8XSdJOJhu1kFNIZWoBzFuAU9vyRYCI+iteRA2cAcsn89egIyq87hFnKUIl6zodtwzeAgqe3HqEsDn61bR9QgGXJxLX5ZuG2d8NZHOyFX/e5GcFN6WlS3vM1Z1My7PGVjO52DiMzEJsPmpiFKgkv9ce/DMvzDz/5KHZTQqHOQZgwK23nV1dYDbDsiBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RVel3pb65ncYOmbVu3yDqM3y53Qa54NTP+2lZ8oZkGw=; b=ZcZUHhQDK/+N/kEW+VXFYaG1SUlZc1j0b0G7VsNWDz+v1l9aeKD0HEOjjqv6dHg+q+8c87JXB5osFldx+nQoJ+pTv6wu78+vN4ztx5icRTjcR9oSFkSkmh2gSAZjgbxa9fhjFw8HysEUjl3EdaSGLEYYZbDJz7AvUTXW4pqOwxW/otB0fD5RxMhGOFtobL3PVgXbD2DFrvcNR/jiV+60gKYU2kI5aXSXbDPjo0Bmu6uJ0IIohwd/Kyo/xPtLAyfxdwmhtESr9gtw08ERSEEPm9E4RBPSxBQsDUmSBbwTs2fqYaJJ3S+mwk5Mr3oYssiYNa+wjDKxjcuBHVza/bcmfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=RVel3pb65ncYOmbVu3yDqM3y53Qa54NTP+2lZ8oZkGw=; b=HgtMrn9LLICeAF/5gVnje6kH/mWwWczxAPYT7vvK0vvAY2d1WpGdQCJLte0r5+4C/qDxyrhpgoT8CNJbRfohiMRZyeleJxhoi1+Z+S9z3HwCU916pFsxqk2iuBIE28R01QrCB8vO3DTrCUzPkm1QmUdvaK1cUCNiCIL/x4/8XKg= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3491.eurprd05.prod.outlook.com (10.171.188.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.23; Thu, 23 Jan 2020 07:57:14 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::68eb:ad79:71f4:110f]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::68eb:ad79:71f4:110f%3]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 07:57:14 +0000 From: Slava Ovsiienko To: Dekel Peled , Matan Azrad CC: Raslan Darawsheh , Ori Kam , "dev@dpdk.org" Thread-Topic: [PATCH 05/11] net/mlx5: unify validation of drop action Thread-Index: AQHV0TB0tptyTo7PGUKMMlf4WiQ1l6f34wrg Date: Thu, 23 Jan 2020 07:57:14 +0000 Message-ID: References: <26679816cc524d1b5665fc79ba48b89b37d85dd7.1579703134.git.dekelp@mellanox.com> In-Reply-To: <26679816cc524d1b5665fc79ba48b89b37d85dd7.1579703134.git.dekelp@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-originating-ip: [95.164.10.10] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 0969e275-9cf4-45de-e023-08d79fd9dbf9 x-ms-traffictypediagnostic: AM4PR05MB3491:|AM4PR05MB3491: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(199004)(189003)(54906003)(110136005)(316002)(5660300002)(186003)(55016002)(26005)(81166006)(52536014)(81156014)(71200400001)(8676002)(8936002)(6636002)(53546011)(86362001)(33656002)(478600001)(6506007)(76116006)(2906002)(9686003)(66946007)(66556008)(66476007)(64756008)(66446008)(4326008)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3491; H:AM4PR05MB3265.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LNe+mQe1728NfR50ETlivgNAsbRUNLUrwLzeyQQ1pUg+hQ7qU478OGOfdn8rWTks7dkD99fwGGEfc+LTX5lPp/5SoNHInG4hhmcsGBXshcHnV3trsEI4ZERN7+1JZH4QRgvFp73jPp//aFgyFr7FAZJuPxzyZ9xWWpXO7F5/Gm5ycwMOV6zBKfRDTqxeYhH7vzrSJP4jGsAl231nmpmOXXxHTsc76am6R4CYtwSZ1OohdSuQeroQP8kiElZ8TRuE+/+QjgX0lA3fMHdiUXuNBu/Ukk3gainBA97E9z6aTAsdPk93PIaBRgQhXz1M5eSF0Nwz78s1fQL4W+4oWzJby1K9eLWMa4/0kGUGyqycilyAJk0HhYnzZzw5e677sU0AMNbyXPzYceFkJSi9rLYwCGpYemVzmL/sFrNYx0ey+rfo3Y9kyE2+KECih4tUqXVa Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0969e275-9cf4-45de-e023-08d79fd9dbf9 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 07:57:14.2011 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ISK/EBEE7CvM6fwqf2Ox7W3hm1ueW8XWgHN88ONgHkBPITw3UC4uxPqMMHC739qfzLC4O/rVtJbUJCDaJIQfEwy6X8ECvieSzjzsrFhLCNY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3491 Subject: Re: [dpdk-dev] [PATCH 05/11] net/mlx5: unify validation of drop 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" > -----Original Message----- > From: Dekel Peled > Sent: Wednesday, January 22, 2020 16:27 > To: Matan Azrad ; Slava Ovsiienko > > Cc: Raslan Darawsheh ; Ori Kam > ; dev@dpdk.org > Subject: [PATCH 05/11] net/mlx5: unify validation of drop action >=20 > According to PRM: "Drop action is mutually-exclusive with any other actio= n, > except for Count action". > In current code this limitaion is checked separately in validation functi= on of > each action. >=20 > This patch removes the discrete checks, and adds a single check common fo= r > all actions. >=20 > Signed-off-by: Dekel Peled > Acked-by: Ori Kam Acked-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_flow.c | 25 +------------------------ > drivers/net/mlx5/mlx5_flow_dv.c | 36 ++++++++++++--------------------= ---- > drivers/net/mlx5/mlx5_flow_verbs.c | 12 ++++++++++++ > 3 files changed, 25 insertions(+), 48 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 970123b..7738cb2 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -905,11 +905,6 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > const struct rte_flow_attr *attr, > struct rte_flow_error *error) { > - > - if (action_flags & MLX5_FLOW_ACTION_DROP) > - 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, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, @@ -961,10 +956,6 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > &mark->id, > "mark id must in 0 <=3D id < " > RTE_STR(MLX5_FLOW_MARK_MAX)); > - if (action_flags & MLX5_FLOW_ACTION_DROP) > - 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, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, @@ -996,24 +987,10 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > * 0 on success, a negative errno value otherwise and rte_errno is set= . > */ > int > -mlx5_flow_validate_action_drop(uint64_t action_flags, > +mlx5_flow_validate_action_drop(uint64_t action_flags __rte_unused, > const struct rte_flow_attr *attr, > struct rte_flow_error *error) { > - if (action_flags & MLX5_FLOW_ACTION_FLAG) > - 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, EINVAL, > - RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > - "can't drop and mark in same flow"); > - if (action_flags & (MLX5_FLOW_FATE_ACTIONS | > - MLX5_FLOW_FATE_ESWITCH_ACTIONS)) > - return rte_flow_error_set(error, EINVAL, > - RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > - "can't have 2 fate actions in" > - " same flow"); > if (attr->egress) > return rte_flow_error_set(error, ENOTSUP, >=20 > RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL, diff --git > a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index > 59ece01..b0d5688 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -1912,10 +1912,6 @@ struct field_modify_info modify_tcp[] =3D { > if (ret < 0) > return ret; > assert(ret > 0); > - if (action_flags & MLX5_FLOW_ACTION_DROP) > - 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, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, @@ -1985,10 +1981,6 @@ struct field_modify_info modify_tcp[] =3D { >=20 > RTE_FLOW_ERROR_TYPE_ACTION_CONF, > &mark->id, > "mark id exceeds the limit"); > - if (action_flags & MLX5_FLOW_ACTION_DROP) > - 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, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, @@ -2173,10 +2165,6 @@ struct field_modify_info modify_tcp[] =3D { > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > action, > "configuration cannot be null"); > - if (action_flags & MLX5_FLOW_ACTION_DROP) > - return rte_flow_error_set(error, EINVAL, > - RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > - "can't drop and encap in same > flow"); > if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS | > MLX5_FLOW_DECAP_ACTIONS)) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, @@ -2209,10 +2197,6 @@ struct field_modify_info modify_tcp[] =3D { > const struct rte_flow_attr *attr, > struct rte_flow_error *error) > { > - if (action_flags & MLX5_FLOW_ACTION_DROP) > - return rte_flow_error_set(error, EINVAL, > - RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > - "can't drop and decap in same > flow"); > if (action_flags & (MLX5_FLOW_ENCAP_ACTIONS | > MLX5_FLOW_DECAP_ACTIONS)) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, @@ -2259,10 +2243,6 @@ struct field_modify_info modify_tcp[] =3D { > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > action, > "configuration cannot be null"); > - if (action_flags & MLX5_FLOW_ACTION_DROP) > - return rte_flow_error_set(error, EINVAL, > - RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > - "can't drop and encap in same > flow"); > if (action_flags & MLX5_FLOW_ENCAP_ACTIONS) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, @@ -2306,10 +2286,6 @@ struct field_modify_info modify_tcp[] =3D { = { > const struct rte_flow_action_raw_decap *decap =3D action- > >conf; >=20 > - if (action_flags & MLX5_FLOW_ACTION_DROP) > - return rte_flow_error_set(error, EINVAL, > - RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > - "can't drop and decap in same > flow"); > if (action_flags & MLX5_FLOW_ENCAP_ACTIONS) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, @@ -5051,6 +5027,18 @@ struct field_modify_info modify_tcp[] =3D { > "action not supported"); > } > } > + /* > + * Validate the drop action mutual exclusion with other actions. > + * Drop action is mutually-exclusive with any other action, except for > + * Count action. > + */ > + if ((action_flags & MLX5_FLOW_ACTION_DROP) && > + (action_flags & ~(MLX5_FLOW_ACTION_DROP | > MLX5_FLOW_ACTION_COUNT))) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > + "Drop action is mutually-exclusive " > + "with any other action, except for " > + "Count action"); > /* Eswitch has few restrictions on using items and actions */ > if (attr->transfer) { > if (!mlx5_flow_ext_mreg_supported(dev) && diff --git > a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c > index c787c98..72fb1e4 100644 > --- a/drivers/net/mlx5/mlx5_flow_verbs.c > +++ b/drivers/net/mlx5/mlx5_flow_verbs.c > @@ -1255,6 +1255,18 @@ > "action not supported"); > } > } > + /* > + * Validate the drop action mutual exclusion with other actions. > + * Drop action is mutually-exclusive with any other action, except for > + * Count action. > + */ > + if ((action_flags & MLX5_FLOW_ACTION_DROP) && > + (action_flags & ~(MLX5_FLOW_ACTION_DROP | > MLX5_FLOW_ACTION_COUNT))) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > + "Drop action is mutually-exclusive " > + "with any other action, except for " > + "Count action"); > if (!(action_flags & MLX5_FLOW_FATE_ACTIONS)) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > actions, > -- > 1.8.3.1