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 0908BA0563; Wed, 15 Apr 2020 17:35:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DA58A1D97F; Wed, 15 Apr 2020 17:35:55 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70082.outbound.protection.outlook.com [40.107.7.82]) by dpdk.org (Postfix) with ESMTP id A45FE1D960; Wed, 15 Apr 2020 17:35:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ey8NiaURkMebHevhmvdxTYnSk8DRO/cQ4yOgCJ7HDKTAzZQb+akalmpND2IeBSXjfzn1IjJVgt1R1Ka4ZrsW9LfY/174gyUch41i00vlq0rQeGvZPnUXqXVg6C+u0084YZoU9orzSwcJgmHWXvurjaxZATRbZIpmd2JnWdnTqaGV0c40YdHqdjGhWNtzthth9EcXRs8R+kKyPE3uHvwvwbWmmFRb1l86vctZZq0ZMspmUwGNZ/so2s+oKi+YL5v+Es+LUWNjJIl/j7tPTwRVe2kibOalJ6N6O8dGGF02kcS1f3ZcIuvZrxEOR/Ow3ACr3Aa+tqKA56nQsTM4AS8GgQ== 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=e2ULkRAsy64sBga2bjMN/fsUWfYN0Q2efk6ulaKgJF0=; b=EOgWnWGBzokiMJDnjyiWK4nv0gEE/iq+blDB+koAkjgUKnsJI0TYFnAGUlc8+EniaUyMLrP1FlKDwg+QwyhozJontGRi3sNCmusiN2oz3sceNM5gzwyzUwIboGtaNwvLPa0N454e7jMlKV9evE/G8N48U1sB7XwFUwfyFUGwAVbsysJjiFUpI8pqRKyjX1SsqJpS0nGIaq1cHJfnl8X+XjwGULsilOodxt1MRE/MAFdxzYLKE+2/rRB1MpbJLZ5mkErU+LZGJMShG3A43XBgYgNcauoxnJ3RkM/+qTJSDxrUDph5d1nj/5NWyfvg0oFrogurNi0ZDD3QYA4F9BeGwg== 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=e2ULkRAsy64sBga2bjMN/fsUWfYN0Q2efk6ulaKgJF0=; b=oATq/+VeZmlONFoWCgg/8R936T0tF7vFG0vIoq/mQHywqwWLIDyCqvmzS3DdbixGEfy9AuKvZw4K+cdTKVa+XUrOZ42im/qrpJeywpfRZafopvhtOiqc3nhzpQVDL298lBlKQU5XOx+Gy2OwpF5wQXOLo3PDW9CLe/0HKfrqph0= Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) by AM0PR05MB4385.eurprd05.prod.outlook.com (2603:10a6:208:67::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.26; Wed, 15 Apr 2020 15:35:53 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::508:747b:cc12:5f6e]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::508:747b:cc12:5f6e%6]) with mapi id 15.20.2900.028; Wed, 15 Apr 2020 15:35:53 +0000 From: Raslan Darawsheh To: Jack Min , Matan Azrad , Shahaf Shuler , Slava Ovsiienko CC: "dev@dpdk.org" , "stable@dpdk.org" , Dekel Peled Thread-Topic: [PATCH v2] net/mlx5: fix validation of push VLAN without full mask Thread-Index: AQHWEUQ9beVcMeVGR0CCsKkx3N+GJ6h6VHzQ Date: Wed, 15 Apr 2020 15:35:53 +0000 Message-ID: References: <4ef0d421da0b37e001d1f646e1c53da85e015e80.1585817881.git.jackmin@mellanox.com> <6b98a5ca890b8732ec16a73c00b7090a080f3fd5.1586747317.git.jackmin@mellanox.com> In-Reply-To: <6b98a5ca890b8732ec16a73c00b7090a080f3fd5.1586747317.git.jackmin@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=rasland@mellanox.com; x-originating-ip: [188.161.230.106] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 12d9b796-1489-476b-ae9c-08d7e152af04 x-ms-traffictypediagnostic: AM0PR05MB4385:|AM0PR05MB4385: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:147; x-forefront-prvs: 0374433C81 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)(376002)(39860400002)(136003)(346002)(366004)(396003)(8936002)(86362001)(64756008)(7696005)(4326008)(55016002)(110136005)(450100002)(54906003)(9686003)(107886003)(33656002)(81156014)(8676002)(71200400001)(66476007)(76116006)(26005)(6636002)(186003)(52536014)(2906002)(478600001)(316002)(53546011)(5660300002)(6506007)(66946007)(66446008)(66556008); 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: yBlrUzHeip1ktcQb2hbLFeovSJ3M30DP/kmq/soE+frlDvjku0896ckJhvvskxMZ/b4ks3Qu8aLzdxxzz6bktELhabNqfvySbaCNQJvqR4rIzF6T8AnYlo2lfCfdiY49vJ6P6O5be5IA0POBteAgddbFWThvZhHh4i6u7cLBAkdejC9fXUjAnLwRuYBBC0ymUWz80GOTLoj3PXie5s6TKiMHWqyQRrujwoUP/5Qy0hMD/kd9f8RNfHvPrEADjZn8jF1ywuk0EUjqYH9Y0otymyuGEf5F6WTp59tbMn+mEWMXqE8M97Y06YYDCkTC0v4d7k5EY254kodcm6oliAaRiry5L4Vfqqe6ZZL+1e47DtlWp4MtPps08vWS808YyIcilBgLmOyscdYGUMuFeyNwye6qO1cJ3plSzA0cEJXOqk9wYMnM5QufxzviZC1oIEkW x-ms-exchange-antispam-messagedata: tTPrFjEnSrP8+VrtrTiTxq55ATjDbXYHfP1z0QSpIdBYpS8jHQnJ7knqngfyUZSU6gAaTz+whOMH9LXxYCM/uZSDS2aVnNZp4hqu2YgwBZ2mfxNm9QCW88bPlsmS0rtUFqgRvO3xf+gTCHN/vMjJbg== 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: 12d9b796-1489-476b-ae9c-08d7e152af04 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2020 15:35:53.5136 (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: KV0RyEFNYYtXK0ZojeJRdIjYqbHfiZVDAOS4LmLJwRgk5lyODS8ZSMRdU3dgwSxvbIVR1f31EgptYcfdf/sgJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4385 Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: fix validation of push VLAN without full mask 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: Xiaoyu Min > Sent: Monday, April 13, 2020 6:33 AM > To: Raslan Darawsheh ; Matan Azrad > ; Shahaf Shuler ; Slava > Ovsiienko > Cc: dev@dpdk.org; stable@dpdk.org; Dekel Peled > Subject: [PATCH v2] net/mlx5: fix validation of push VLAN without full ma= sk >=20 > Due the limitation of HW, when PMD create push VLAN action it needs to > know what exactly the value of VID/PCP. >=20 > PMD try to figure out them via: > - of_set_vlan_vid/pcp actions > - VLAN item in pattern > If none of above is provided, default value - zero is used. >=20 > However user will write rule like [1] which match on a range of VID and > without of_set_vlan_vid action and expect the VID will inherit from > original packet. This is not supported by HW currently. PMD will set VID > to default value - zero because it cannot figure out the exact value of V= ID > from VLAN item. >=20 > This is sort of misleading for some users. >=20 > In order to avoid this, PMD will spit out error for rule like [1] to > force user to provide explicit VID/PCP for new pushed VLAN headers. >=20 > Fixes: 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header") > Cc: stable@dpdk.org >=20 > [1]: testpmd> flow create 2 ingress transfer group 0 priority 3 pattern > eth / vlan vid spec 2859 vid prefix 4 / ipv4 / end > actcions of_push_vlan ethertype 0x88A8 / > of_set_vlan_pcp vlan_pcp 6 / port_id id 0 / end >=20 > Signed-off-by: Xiaoyu Min > Reviewed-by: Dekel Peled > Acked-by: Viacheslav Ovsiienko > --- > v2: > - rebased > - added Acked-by tag >=20 > drivers/net/mlx5/mlx5_flow_dv.c | 34 > +++++++++++++++++++++++++++++++-- > 1 file changed, 32 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c > index 18ea577f8c..b1d6bf6e6c 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -1829,7 +1829,7 @@ flow_dev_get_vlan_info_from_items(const struct > rte_flow_item *items, > static int > 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_item_vlan *vlan_m, > const struct rte_flow_action *action, > const struct rte_flow_attr *attr, > struct rte_flow_error *error) > @@ -1863,6 +1863,32 @@ flow_dv_validate_action_push_vlan(struct > rte_eth_dev *dev, >=20 > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > "push vlan action for VF representor > " > "not supported on NIC table"); > + if (vlan_m && > + (vlan_m->tci & MLX5DV_FLOW_VLAN_PCP_MASK_BE) && > + (vlan_m->tci & MLX5DV_FLOW_VLAN_PCP_MASK_BE) !=3D > + MLX5DV_FLOW_VLAN_PCP_MASK_BE && > + !(action_flags & MLX5_FLOW_ACTION_OF_SET_VLAN_PCP) && > + !(mlx5_flow_find_action > + (action + 1, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP))) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > action, > + "not full match mask on VLAN PCP > and " > + "there is no of_set_vlan_pcp action, > " > + "push VLAN action cannot figure out > " > + "PCP value"); > + if (vlan_m && > + (vlan_m->tci & MLX5DV_FLOW_VLAN_VID_MASK_BE) && > + (vlan_m->tci & MLX5DV_FLOW_VLAN_VID_MASK_BE) !=3D > + MLX5DV_FLOW_VLAN_VID_MASK_BE && > + !(action_flags & MLX5_FLOW_ACTION_OF_SET_VLAN_VID) && > + !(mlx5_flow_find_action > + (action + 1, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID))) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > action, > + "not full match mask on VLAN VID > and " > + "there is no of_set_vlan_vid action, > " > + "push VLAN action cannot figure out > " > + "VID value"); > (void)attr; > return 0; > } > @@ -4563,6 +4589,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const > struct rte_flow_attr *attr, > struct mlx5_priv *priv =3D dev->data->dev_private; > struct mlx5_dev_config *dev_conf =3D &priv->config; > uint16_t queue_index =3D 0xFFFF; > + const struct rte_flow_item_vlan *vlan_m =3D NULL; >=20 > if (items =3D=3D NULL) > return -1; > @@ -4620,6 +4647,9 @@ flow_dv_validate(struct rte_eth_dev *dev, const > struct rte_flow_attr *attr, > } else { > ether_type =3D 0; > } > + /* Store outer VLAN mask for of_push_vlan action. > */ > + if (!tunnel) > + vlan_m =3D items->mask; > break; > case RTE_FLOW_ITEM_TYPE_IPV4: > mlx5_flow_tunnel_ip_check(items, next_protocol, > @@ -4935,7 +4965,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const > struct rte_flow_attr *attr, > case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: > ret =3D flow_dv_validate_action_push_vlan(dev, > action_flags, > - item_flags, > + vlan_m, > actions, attr, > error); > if (ret < 0) > -- > 2.26.0 Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh