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 080D9A0562; Sun, 29 Mar 2020 16:06:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C52F01AFF; Sun, 29 Mar 2020 16:06:46 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20070.outbound.protection.outlook.com [40.107.2.70]) by dpdk.org (Postfix) with ESMTP id 8FCE3F3E; Sun, 29 Mar 2020 16:06:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FFahTq5ydN6+6RNkm77Vya+qZvP5K19uNXzmZwpkZ4Bwhi6yRf9oECq/cixoIywVPxy7wKN3LUcH2HFU9MKl9SvOUSY6n2ptvOs0cLmWqdVLb71/6rjbOui+YyrU6UapyMbdY66yv6hD0Y1qrkN4Ccbea6P8047V38RQjWeYg42otrmK+WXl1iJkl/Uil/0EQY91cTOm7stbaaPeioOwQ15HuYzFfwkTOUb//EMEV/LMsFukUWfi2H5UkrZXpdVJ/ug2S0qLupb0lHEVfqPlQo/RunmLm1aFFccvYIL8kIbjTuTPq2p3n9nON6lhLa2GnOLkJUlNvpRRXgGUFCF7Pg== 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=iTIKE36JKyvZ0b+ak4SbAyBIbcWibLxy7OWyJKwxSWc=; b=KUpVTNW8hHGH4s14BN1VVbwEB1JAd/NL973ppyKU/JuqcNsH9y1eVAmBW/7CDTp+0AbAGow+k5PJTlowjd9xTzLHQl82nQzwBSTgiPG0Y+hTGTLOMHhyHtpG8yrZW/pjo0xmGjFw6ISO4WpT7EFZpHyCuIeXG8XjY9+4F9PpbRlodl9eb2scjIWqT56Jgb8H+l6hdGLu/RkpbW+kz/0sZxPQ3fYg8ibBKnsxB/dECtPCRia4lvklGXUZeZ2148A93UNU8Hvn8MNp38hSTHoW309gv/o6yfXVDYScWWLMzWzLU891T/++oF1pm5hIdvmFK8GzEeFob5swdu41GFrH1A== 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=iTIKE36JKyvZ0b+ak4SbAyBIbcWibLxy7OWyJKwxSWc=; b=i+FxZwUQtdUlEGHkCoawBUqcapgjamlLTWc+t5l5gBlJ+xovp7L+pU+M8Jg+mk/tyN2ltfSVV6dhlFsls7+QdgU9Jntidn1i+m4bLWKzBuNqc0gO9kGex/YSgfORZvVLrzhpkAPUvoEmPVxEeZTpza/3I6ZlJBUei8WO6cYVEmc= Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (10.186.174.145) by AM0PR05MB4546.eurprd05.prod.outlook.com (52.133.55.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.19; Sun, 29 Mar 2020 14:06:43 +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 14:06:42 +0000 From: Raslan Darawsheh To: Wisam Monther , Ori Kam , Matan Azrad , "dev@dpdk.org" CC: Slava Ovsiienko , "stable@dpdk.org" Thread-Topic: [PATCH v2] net/mlx5: fix zero value validation for metadata Thread-Index: AQHWA1hzf25RG3H7+UWaWSqgyO9Ugqhfn8gQ Date: Sun, 29 Mar 2020 14:06:42 +0000 Message-ID: References: <20200319090237.15639-1-wisamm@mellanox.com> <20200326102200.15281-1-wisamm@mellanox.com> In-Reply-To: <20200326102200.15281-1-wisamm@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.229.130] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: afeab418-fe34-45c9-e6e8-08d7d3ea68be x-ms-traffictypediagnostic: AM0PR05MB4546:|AM0PR05MB4546: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1751; 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)(136003)(376002)(396003)(366004)(346002)(39860400002)(33656002)(53546011)(450100002)(186003)(55016002)(81166006)(4326008)(9686003)(8936002)(26005)(8676002)(81156014)(54906003)(86362001)(478600001)(316002)(66946007)(71200400001)(6506007)(66556008)(7696005)(64756008)(66446008)(76116006)(5660300002)(110136005)(66476007)(52536014)(2906002); 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: doIGP27Rn6/J+lH4kxzdgorXma2LHvmrTLj6acdhHVx6As8ijVJmExEuzPl7ly/URKNWxy0EA9fOdBceAZLaOeZqpCSX95txw7/b2EHJi4oU08cPBopNpEsBLCzeGaQmk2yi62eGJgjC2Pl4oXccmH/aMME6nWfcYLHnFqwfY7aWQl62DPz4j8JkSjaRiNcOz34ocYDgvehguMI5QWpYTTvtYP94DmVyMRRxN8o7BZb3SsSgjYMQye3tJJiMz+/SKA33TZBRInVFnJX4Zh9GvJ5SR1heET4GQbswISUzv+4kjF7x7mIDw6h9AuirKqwPm5avSh9Cun6kCewnpHSn4X7h0TPW/Nh1xUwJnQMruhpIjZYkLh9x1xxtCKLHHx7PFj9b9frVCw7mf1yS33JFi9/pfXWq8ro8C/UyHe+RsQ2/h3Yvzh6elcHlqSzBGg78 x-ms-exchange-antispam-messagedata: xLk1nMAIutxU/U7FRl708hFXBkkGh1XBCUcmDuY1oAjoVFirNaPfhoxzSo+npuzb6Epiogxg1UdOT1+IrdaGvfENaOX9wZL3qYxNhbkeCVB8a9EDY55rLX/8u/WbwewdpNsNcI9nOZMkrFwhiqyVhw== 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: afeab418-fe34-45c9-e6e8-08d7d3ea68be X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2020 14:06:42.7880 (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: tag1j8bU0CXopfxM2cJVr3TZT0TlLtR/pDzRdEgy7Oou1SOuFIZELmaNDhxeBXP6kZjO6w6uaZI15DHZcoxLgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4546 Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: fix zero value validation for metadata 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: Wisam Monther > Sent: Thursday, March 26, 2020 12:22 PM > To: Ori Kam ; Matan Azrad ; > dev@dpdk.org > Cc: Raslan Darawsheh ; Slava Ovsiienko > ; stable@dpdk.org > Subject: [PATCH v2] net/mlx5: fix zero value validation for metadata >=20 > MARK and META items are interrelated with datapath - > they might move from/to the applications in mbuf. >=20 > zero value for these items has the special meaning - > it means "no metadata are provided", not zero values > are treated by applications and PMD as valid ones. >=20 > Moreover in the flow engine domain the value zero is > acceptable to match and set, and we should allow to > specify zero values as rte_flow parameters for the > META and MARK items and actions. In the same time > zero mask has no meaning and and should be rejected > on validation stage. >=20 > Fixes: fcc8d2f716fd ("net/mlx5: extend flow metadata support") > Fixes: e554b672aa05 ("net/mlx5: support flow tag") > Fixes: 55deee1715f0 ("net/mlx5: extend flow mark support") > Cc: viacheslavo@mellanox.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Wisam Jaddo > --- > Changes in v2 > - Fix commit message > - Fix documentation > - Remove extra line > - Always check for zero mask > --- > --- > doc/guides/nics/mlx5.rst | 12 ++++++++++++ > drivers/net/mlx5/mlx5_flow_dv.c | 19 +++++++++++++++---- > 2 files changed, 27 insertions(+), 4 deletions(-) >=20 > diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst > index e8f9984df0..e13c07d9ab 100644 > --- a/doc/guides/nics/mlx5.rst > +++ b/doc/guides/nics/mlx5.rst > @@ -1275,6 +1275,18 @@ Supported hardware offloads > | | | ConnectX-5 | | ConnectX-5 | > +-----------------------+-----------------+-----------------+ >=20 > +Notes for metadata > +------------------ > +MARK and META items are interrelated with datapath - they might move > from/to > +the applications in mbuf fields. Hence, zero value for these items has t= he > +special meaning - it means "no metadata are provided", not zero values a= re > +treated by applications and PMD as valid ones. > + > +Moreover in the flow engine domain the value zero is acceptable to match > and > +set, and we should allow to specify zero values as rte_flow parameters f= or > the > +META and MARK items and actions. In the same time zero mask has no > meaning and > +should be rejected on validation stage. > + > Notes for testpmd > ----------------- >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c > index 809833b7ee..da4a925404 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -1406,6 +1406,11 @@ flow_dv_validate_item_mark(struct rte_eth_dev > *dev, > "mark id exceeds the limit"); > if (!mask) > mask =3D &nic_mask; > + if (!mask->id) > + return rte_flow_error_set(error, EINVAL, > + > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL, > + "mask cannot be zero"); > + > ret =3D mlx5_flow_item_acceptable(item, (const uint8_t *)mask, > (const uint8_t *)&nic_mask, > sizeof(struct rte_flow_item_mark), > @@ -1451,10 +1456,6 @@ flow_dv_validate_item_meta(struct rte_eth_dev > *dev __rte_unused, >=20 > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, > item->spec, > "data cannot be empty"); > - if (!spec->data) > - return rte_flow_error_set(error, EINVAL, > - > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL, > - "data cannot be zero"); > if (config->dv_xmeta_en !=3D MLX5_XMETA_MODE_LEGACY) { > if (!mlx5_flow_ext_mreg_supported(dev)) > return rte_flow_error_set(error, ENOTSUP, > @@ -1474,6 +1475,11 @@ flow_dv_validate_item_meta(struct rte_eth_dev > *dev __rte_unused, > } > if (!mask) > mask =3D &rte_flow_item_meta_mask; > + if (!mask->data) > + return rte_flow_error_set(error, EINVAL, > + > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL, > + "mask cannot be zero"); > + > ret =3D mlx5_flow_item_acceptable(item, (const uint8_t *)mask, > (const uint8_t *)&nic_mask, > sizeof(struct rte_flow_item_meta), > @@ -1522,6 +1528,11 @@ flow_dv_validate_item_tag(struct rte_eth_dev > *dev, > "data cannot be empty"); > if (!mask) > mask =3D &rte_flow_item_tag_mask; > + if (!mask->data) > + return rte_flow_error_set(error, EINVAL, > + > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL, > + "mask cannot be zero"); > + > ret =3D mlx5_flow_item_acceptable(item, (const uint8_t *)mask, > (const uint8_t *)&nic_mask, > sizeof(struct rte_flow_item_tag), > -- > 2.17.1 Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh