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 B62E4A0588; Sun, 29 Mar 2020 12:53:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 56BA61AFF; Sun, 29 Mar 2020 12:53:04 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2073.outbound.protection.outlook.com [40.107.21.73]) by dpdk.org (Postfix) with ESMTP id 2DCA7F3E; Sun, 29 Mar 2020 12:53:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GLn0dRdPkzCZ6LLMFRkEm/+8NC2ht0nKBqMzuXEy3G6cNlCSpybEo2QkLsFc8D8pv2lhzSNEU4OgewKQJUiecFjvXuQjBdFdfcF5PXlTMZRhTHEc5d+HMWDp24mB13Dk/pIvGFHMFYnIFw4l0Vjd1ZbRsH5InASszmOQau2nvS+rgP7T2sNIgOpNeN8JDsUtuaKrd28svpCcf5tgIhIHu/0DOcyn0EhvigQB7OH3uXR6hUEWAnaPnI8q4diU4LXRhp56Pt01c2d4mJjh8NpBs6CfRqSjXsABpnvTNSaMkrMc+u9kyRE08KuQkBPb7GHauMjnAjknI3bRQ30sSoKZ5w== 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=s4NOygoHKJ2LMYH/fMPRYN5F31EpuSAKAgVJzbvnP7w=; b=M1YkeqE6iLYlCfgbrRcxhiJEd4fPzY1dsiEteu2meNniacvF0iJwtojgk3VddwJ8PkzP+yBl/GOzMR06GVWf0tD+5Du/lbEgvWVaAFKA6JgQJS9ae/k+ITG19fAdj+tMOHXnPd5FlMrzfws0JvAuZT830zr4BMHn0r6Vl9yWCe1owNOFNc+GLWE/V+RebXR6dUSZO9e8kkFCLwbdH57LtaFMkw4RvOKMFVGH9+iZielE7SdSfNqVWsq+uSE5kl8ofOqk6BhEt7BlqvSWcMsqFIkpOGNfTJnPr7+wjEZwCrknw9VzCurRgrPvPBOHL4n8Ebk1gVwwygG26VgKpwNlMA== 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=s4NOygoHKJ2LMYH/fMPRYN5F31EpuSAKAgVJzbvnP7w=; b=cE7q4vEOfwSL3bE03gR1WS4bxkZNhOEF+3Z5qJs77wlrO2wMNjlIdIRtVNZYp4TZGhpZaQyUZrvrgyNcXL7kSGN4Q1AW0Xj9xlt1FxqArX/cEQdOLFC6JDh8HZz6+QReVNb103dj7oxo1gjRgoT9jomMH67m9kyeuCslrXt6N/8= Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (10.186.174.145) by AM0PR05MB5969.eurprd05.prod.outlook.com (20.178.203.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Sun, 29 Mar 2020 10:53:02 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::adbd:45ca:54:bba9]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::adbd:45ca:54:bba9%7]) with mapi id 15.20.2856.019; Sun, 29 Mar 2020 10:53:02 +0000 From: Raslan Darawsheh To: Dekel Peled , Matan Azrad , Slava Ovsiienko CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] net/mlx5: update VLAN and encap actions validation Thread-Index: AQHWAdv6XIeHCEcnT0Sm+UkkugD8pahfbJ+A Date: Sun, 29 Mar 2020 10:53:02 +0000 Message-ID: References: In-Reply-To: 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=rasland@mellanox.com; x-originating-ip: [188.161.229.130] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 314d74b3-0dd1-469b-f9fd-08d7d3cf5a41 x-ms-traffictypediagnostic: AM0PR05MB5969:|AM0PR05MB5969: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 035748864E x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6707.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(366004)(396003)(136003)(346002)(39860400002)(376002)(8676002)(478600001)(6636002)(450100002)(6506007)(81156014)(81166006)(71200400001)(7696005)(86362001)(9686003)(4326008)(53546011)(5660300002)(52536014)(66946007)(66446008)(64756008)(66556008)(66476007)(76116006)(110136005)(55016002)(316002)(15650500001)(26005)(2906002)(54906003)(186003)(33656002)(8936002); DIR:OUT; SFP:1101; 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: Z7u9rWNUYoEb+j3eRm3bhzCbQmSABywUqNIVbxmBJunM3dwEXTLx5PqNBdKiGGUjly0xOUr3zKFOnp+DIPokaYPu/sTUwM5MGkbW10UFL4Ea/qZfmkAKYkOpgiwqyoh9tcwXIYT45Ni9pwNxgFVqaXNkV/4I5UYaQBR3IykkhcvJnWg/JbWol+0Dpl4OjUmun9UnnGBtuLBUIttQ15PP4O01cb3S9cR2wtTf4LmFiOoIOyTdNbYN4XloPhMpTY98XT/7lSekMzGcs2qIn6XA0NV/W0ZovjceXQJf/QSeG0YkNlZKB3esd3G10ULIRCszjq+kRirSpcgVZRg0tNpGDyqLPBxG0LQfPrFqGFYnpd4PX805mRaXDA5vG4Ctx37sBD7bREDGefOJWJlJNxAlTWZeZkqBKKSw6nAjhs/5lUihnnkSrUkt71QuUxNT7jY0 x-ms-exchange-antispam-messagedata: KGIAHxC8z5q6od0BhpqS8YAw6LheQGPiEL52oss5TqMM+EB6o+901BbJLjyWqeQtUEg1aC2TmyZFMUBmFpO6JWRqpVyySYgb7GF+mtnxltMckGKD6y+s4Q8yrlGSP7YrJBPVj5enbRq0Mt6ewZiKew== 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: 314d74b3-0dd1-469b-f9fd-08d7d3cf5a41 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2020 10:53:02.0954 (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: M7sw73TLaiz1pvcx1NxiDzNFKXoJjloORalmiiUs7ss3iNt1SKlyP+dMaTxcEuqyujNwpYeR+rc3KClrRIlA1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5969 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: update VLAN and encap actions validation 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" Hi, > -----Original Message----- > From: Dekel Peled > Sent: Tuesday, March 24, 2020 2:58 PM > To: Matan Azrad ; Slava Ovsiienko > ; Raslan Darawsheh > Cc: dev@dpdk.org; stable@dpdk.org > Subject: [PATCH] net/mlx5: update VLAN and encap actions validation >=20 > Flow rule in NIC table on VF representor should not contain VLAN pop > or push actions, and encap or decap actions. Using these actions in > NIC table on VF representor is not a valid use case. > This patch updates the various validation functions to reject such > rules. >=20 > Cc: stable@dpdk.org >=20 > Signed-off-by: Dekel Peled > Acked-by: Jack Min > --- > drivers/net/mlx5/mlx5_flow_dv.c | 82 > +++++++++++++++++++++++++++++++++-------- > 1 file changed, 67 insertions(+), 15 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c > index 2090631..7fe61c2 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -1698,7 +1698,7 @@ struct field_modify_info modify_tcp[] =3D { > const struct rte_flow_attr *attr, > struct rte_flow_error *error) > { > - struct mlx5_priv *priv =3D dev->data->dev_private; > + const struct mlx5_priv *priv =3D dev->data->dev_private; >=20 > (void)action; > (void)attr; > @@ -1729,6 +1729,11 @@ struct field_modify_info modify_tcp[] =3D { > RTE_FLOW_ERROR_TYPE_ACTION, > action, > "wrong action order, port_id should > " > "be after pop VLAN action"); > + if (!attr->transfer && priv->representor) > + return rte_flow_error_set(error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > + "pop vlan action for VF representor " > + "not supported on NIC table"); > return 0; > } >=20 > @@ -1792,6 +1797,8 @@ struct field_modify_info modify_tcp[] =3D { > /** > * Validate the push VLAN action. > * > + * @param[in] dev > + * Pointer to the rte_eth_dev structure. > * @param[in] action_flags > * Holds the actions detected until now. > * @param[in] item_flags > @@ -1807,13 +1814,15 @@ struct field_modify_info modify_tcp[] =3D { > * 0 on success, a negative errno value otherwise and rte_errno is set= . > */ > static int > -flow_dv_validate_action_push_vlan(uint64_t action_flags, > +flow_dv_validate_action_push_vlan(struct rte_eth_dev *dev, > + uint64_t action_flags, > uint64_t item_flags __rte_unused, > const struct rte_flow_action *action, > const struct rte_flow_attr *attr, > struct rte_flow_error *error) > { > const struct rte_flow_action_of_push_vlan *push_vlan =3D action- > >conf; > + const struct mlx5_priv *priv =3D dev->data->dev_private; >=20 > if (!attr->transfer && attr->ingress) > return rte_flow_error_set(error, ENOTSUP, > @@ -1836,6 +1845,11 @@ struct field_modify_info modify_tcp[] =3D { > RTE_FLOW_ERROR_TYPE_ACTION, > action, > "wrong action order, port_id should > " > "be after push VLAN"); > + if (!attr->transfer && priv->representor) > + return rte_flow_error_set(error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > + "push vlan action for VF representor > " > + "not supported on NIC table"); > (void)attr; > return 0; > } > @@ -2201,10 +2215,14 @@ struct field_modify_info modify_tcp[] =3D { > /** > * Validate the L2 encap action. > * > + * @param[in] dev > + * Pointer to the rte_eth_dev structure. > * @param[in] action_flags > * Holds the actions detected until now. > * @param[in] action > * Pointer to the action structure. > + * @param[in] attr > + * Pointer to flow attributes. > * @param[out] error > * Pointer to error structure. > * > @@ -2212,10 +2230,14 @@ struct field_modify_info modify_tcp[] =3D { > * 0 on success, a negative errno value otherwise and rte_errno is set= . > */ > static int > -flow_dv_validate_action_l2_encap(uint64_t action_flags, > +flow_dv_validate_action_l2_encap(struct rte_eth_dev *dev, > + uint64_t action_flags, > const struct rte_flow_action *action, > + const struct rte_flow_attr *attr, > struct rte_flow_error *error) > { > + const struct mlx5_priv *priv =3D dev->data->dev_private; > + > if (!(action->conf)) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > action, > @@ -2225,12 +2247,19 @@ struct field_modify_info modify_tcp[] =3D { > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > "can only have a single encap action > " > "in a flow"); > + if (!attr->transfer && priv->representor) > + return rte_flow_error_set(error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > + "encap action for VF representor " > + "not supported on NIC table"); > return 0; > } >=20 > /** > * Validate a decap action. > * > + * @param[in] dev > + * Pointer to the rte_eth_dev structure. > * @param[in] action_flags > * Holds the actions detected until now. > * @param[in] attr > @@ -2242,10 +2271,13 @@ struct field_modify_info modify_tcp[] =3D { > * 0 on success, a negative errno value otherwise and rte_errno is set= . > */ > static int > -flow_dv_validate_action_decap(uint64_t action_flags, > - const struct rte_flow_attr *attr, > - struct rte_flow_error *error) > +flow_dv_validate_action_decap(struct rte_eth_dev *dev, > + uint64_t action_flags, > + const struct rte_flow_attr *attr, > + struct rte_flow_error *error) > { > + const struct mlx5_priv *priv =3D dev->data->dev_private; > + > if (action_flags & MLX5_FLOW_XCAP_ACTIONS) > return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > @@ -2264,6 +2296,11 @@ struct field_modify_info modify_tcp[] =3D { > NULL, > "decap action not supported for " > "egress"); > + if (!attr->transfer && priv->representor) > + return rte_flow_error_set(error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > + "decap action for VF representor " > + "not supported on NIC table"); > return 0; > } >=20 > @@ -2272,6 +2309,8 @@ struct field_modify_info modify_tcp[] =3D { > /** > * Validate the raw encap and decap actions. > * > + * @param[in] dev > + * Pointer to the rte_eth_dev structure. > * @param[in] decap > * Pointer to the decap action. > * @param[in] encap > @@ -2290,11 +2329,13 @@ struct field_modify_info modify_tcp[] =3D { > */ > static int > flow_dv_validate_action_raw_encap_decap > - (const struct rte_flow_action_raw_decap *decap, > + (struct rte_eth_dev *dev, > + const struct rte_flow_action_raw_decap *decap, > const struct rte_flow_action_raw_encap *encap, > const struct rte_flow_attr *attr, uint64_t *action_flags, > int *actions_n, struct rte_flow_error *error) > { > + const struct mlx5_priv *priv =3D dev->data->dev_private; > int ret; >=20 > if (encap && (!encap->size || !encap->data)) > @@ -2327,7 +2368,8 @@ struct field_modify_info modify_tcp[] =3D { > "encap combination"); > } > if (decap) { > - ret =3D flow_dv_validate_action_decap(*action_flags, attr, > error); > + ret =3D flow_dv_validate_action_decap(dev, *action_flags, > attr, > + error); > if (ret < 0) > return ret; > *action_flags |=3D MLX5_FLOW_ACTION_DECAP; > @@ -2344,6 +2386,12 @@ struct field_modify_info modify_tcp[] =3D { >=20 > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > "more than one encap > action"); > + if (!attr->transfer && priv->representor) > + return rte_flow_error_set > + (error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > + "encap action for VF representor " > + "not supported on NIC table"); > *action_flags |=3D MLX5_FLOW_ACTION_ENCAP; > ++(*actions_n); > } > @@ -4888,7 +4936,8 @@ struct field_modify_info modify_tcp[] =3D { > ++actions_n; > break; > case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: > - ret =3D > flow_dv_validate_action_push_vlan(action_flags, > + ret =3D flow_dv_validate_action_push_vlan(dev, > + action_flags, > item_flags, > actions, attr, > error); > @@ -4916,8 +4965,10 @@ struct field_modify_info modify_tcp[] =3D { > break; > case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: > case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: > - ret =3D > flow_dv_validate_action_l2_encap(action_flags, > - actions, error); > + ret =3D flow_dv_validate_action_l2_encap(dev, > + action_flags, > + actions, attr, > + error); > if (ret < 0) > return ret; > action_flags |=3D MLX5_FLOW_ACTION_ENCAP; > @@ -4925,8 +4976,8 @@ struct field_modify_info modify_tcp[] =3D { > break; > case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: > case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP: > - ret =3D flow_dv_validate_action_decap(action_flags, > attr, > - error); > + ret =3D flow_dv_validate_action_decap(dev, > action_flags, > + attr, error); > if (ret < 0) > return ret; > action_flags |=3D MLX5_FLOW_ACTION_DECAP; > @@ -4934,7 +4985,7 @@ struct field_modify_info modify_tcp[] =3D { > break; > case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: > ret =3D flow_dv_validate_action_raw_encap_decap > - (NULL, actions->conf, attr, &action_flags, > + (dev, NULL, actions->conf, attr, > &action_flags, > &actions_n, error); > if (ret < 0) > return ret; > @@ -4950,7 +5001,8 @@ struct field_modify_info modify_tcp[] =3D { > encap =3D actions->conf; > } > ret =3D flow_dv_validate_action_raw_encap_decap > - (decap ? decap : &empty_decap, > encap, > + (dev, > + decap ? decap : &empty_decap, > encap, > attr, &action_flags, &actions_n, > error); > if (ret < 0) > -- > 1.8.3.1 Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh