From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A319643B45; Mon, 19 Feb 2024 04:00:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F0B44067C; Mon, 19 Feb 2024 04:00:13 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2088.outbound.protection.outlook.com [40.107.94.88]) by mails.dpdk.org (Postfix) with ESMTP id ED27A4067C for ; Mon, 19 Feb 2024 04:00:10 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lqELGSh4U0Gr1vM1TOpUVKflEBAp/+TvovoMdH6OStLyIfIxc6z1StomiB6mGE5z7vUIVeR3qnY+FDM615kJ+QvyPgUpILE1eRKiJw9P2c/o+eVjhMb5G7AwJMGqWswpqErZUOAVft91obC5wxa0LLAQWMrS/EoS5Q3qUQ9SpM48bhzIf/pVrTmWf/P4HHJEyg3SZiv1pPLYAYXZEvCCuVe2RmmA9Ft0C6NwyL8/KDC0nC5h4lf3GNEUtDw91yhYCLbD2u4xRlD02oBB1naQZQ3BruGGGAJShEA+2UZ5f+q67vfs0OiWwjwbGsl/8h79p3vTH+TsoOZo+ELti0iqfg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KFCU0tSDYweUrYqCLQnm4E/AcWeGD/NVHwgBOzSiieM=; b=R1aFP0W44XY9ZLWt12fEjrzfEFhSUnQkbz8U7IeQpChMdl1DN8GRYYuwXq8tlmp9SrZN/NSKEjcaW9fPNTl/hR/Vk8Rf6GWTZYrH/qJTW25tjXalEFwJl+FVi1km3F6W+wX7qsCi1MiLwOgej5Z2HQoh1Wd/QKja5WydV2P+3V2sw4YoIb7xxJDXCIkmbBeGj6NDoigj+Te2idTW5UDaVZfGe3PCsug1qkhRnVHioRnOyMdvVs1zMQtplm6E5Hppf75rrswgtqy98+tVCqEmSybhccDGrdE7YiWZWBj6luAY2DNzDuUMaYci0AJ4jDzIVyg5cfTJi8SjyeS80+HKqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KFCU0tSDYweUrYqCLQnm4E/AcWeGD/NVHwgBOzSiieM=; b=gnX4rzs69vLXIlU7etPD5oO/0ViehA6eQenUBBCZMAIy5P4Kw603s4i8+hKkiIQwQYmaBcN0Mlzpy0d/73NjN+yT1/QErMuhja+cIBP8M0edFByxBZ4xr7yOjd6QEapHzrpeMni0tPtnJLWyI+R3iJgBSl+xtsj1jx5fWZVFvE8iyPKFzE/kKcTyKJU94+/dg0je3KnbeFR0nVQ25iY4frlEdH1NJ+clZApXS7vxsz6PhywZZd2ca9MxEXLIJSNxwxnamCki4isxDrSdJBdl1P/aZBjNpMDE9OkUgY4NX04MjjCk/M3pVhPW6Uh+ENbZZeko9aG8GpbTO1xnh0Gh3Q== Received: from CO6PR12MB5396.namprd12.prod.outlook.com (2603:10b6:303:139::8) by BN9PR12MB5339.namprd12.prod.outlook.com (2603:10b6:408:104::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.19; Mon, 19 Feb 2024 03:00:08 +0000 Received: from CO6PR12MB5396.namprd12.prod.outlook.com ([fe80::32de:b509:fcd0:ee34]) by CO6PR12MB5396.namprd12.prod.outlook.com ([fe80::32de:b509:fcd0:ee34%2]) with mapi id 15.20.7316.016; Mon, 19 Feb 2024 03:00:08 +0000 From: Suanming Mou To: Michael Baum , "dev@dpdk.org" CC: Matan Azrad , Dariusz Sosnowski , Raslan Darawsheh , Slava Ovsiienko , Ori Kam Subject: RE: [PATCH v5 2/3] net/mlx5: add support to compare random value Thread-Topic: [PATCH v5 2/3] net/mlx5: add support to compare random value Thread-Index: AQHaXxe8BP7l08cxPE255q5o2Vy61LERAUTw Date: Mon, 19 Feb 2024 03:00:08 +0000 Message-ID: References: <20240207161414.1583125-1-michaelba@nvidia.com> <20240214073015.2060103-1-michaelba@nvidia.com> <20240214073015.2060103-3-michaelba@nvidia.com> In-Reply-To: <20240214073015.2060103-3-michaelba@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO6PR12MB5396:EE_|BN9PR12MB5339:EE_ x-ms-office365-filtering-correlation-id: 8b91f813-c6ec-42ba-50ae-08dc30f6e185 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: C7DJ22zESi9ntBO6bB7xH5nF75I70xqZenfHymWDcBrDi6iZG4ogXrKNmc9JHRpqpjnGvoqRzq/s1a7R/KJ9rPOLB/MERnDbYrYl3FjLL6o/ycgE1UZAMSzE5bp4Xwp9NqdF2LPTM8DKXXfkuwt3aCU6aWSejrQwFrDZURSn05mfbIku7kgwyg3xGL0AwlGayezxGKpF+tuLz7gcsrXxbMonbkWoyLK2PKjOOq6NQGLmFpNfjV+Mky636eB2n7jSWgr+4FzkCVIz/LmetO6mDHCROfRFN7cW6vnrEZEZeQUeiXcsZK9d/7C8Dpp8FevWsDUYo6z7gB4jDWFZ4+9tTHTWwC6xUEUQEBlrS+b5OuJNrKzIZNP26sQnyIbuRdAzCCyQrEgZbCrDQdcEsYoso9duSl9mTAB0czVzkIi1GITVxZdUHeF6DQcYy+KnYlYIRY3vfM8X4oPSoPZyyDb2odXLinmILbgWN87tushg2Bf6xg3Yewi+Cb4EMJy4uBW/jV/0BMkoW6SciRGVJzRSSYnKrPW5QL29oEk5eIQud2JadIJi0SiuAjl/qaaw9uX1FG/QqRoGOYjvP6dmpKeE51rxvZnZy2soCY6TpE7YnpYvKX9vAGoELBoyYis5FJ+0 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR12MB5396.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(396003)(136003)(39860400002)(346002)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(66476007)(5660300002)(66446008)(4326008)(64756008)(76116006)(2906002)(66946007)(52536014)(66556008)(55016003)(8936002)(122000001)(86362001)(38100700002)(33656002)(38070700009)(83380400001)(8676002)(110136005)(71200400001)(316002)(26005)(9686003)(7696005)(478600001)(41300700001)(54906003)(6506007)(53546011)(107886003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Y1xtWcacJ1EAT/FbtEvAyVThVys9+HiiLn4LZ4P5Jn3AG3bTB5SaedfcCBga?= =?us-ascii?Q?xb28OcYah5UJ3qGRlRBayVgSxVIopOEKF8KyPFSFRCpKHwDOcIR4f9Xbvaqe?= =?us-ascii?Q?/88oej//Tp5BdVp4ZvP4Bp+tksBwZlYNEb4uW0wmk8qhin0SoXCjeDGTCx1/?= =?us-ascii?Q?mtSET3wZ8rns70FHtedqRpxbzw/NGVllm0xPQJ2FJ1sUv6tE8kKNGMPskb/W?= =?us-ascii?Q?eNaG4UkdX5IDo/O9INRW3aUDNiPohrVkaI3UR5wY8LCC94g+RNJe91j8g9Cn?= =?us-ascii?Q?PJeZ0JgSz+NwB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ascii?Q?kedohUqdngq5i3z01XP7iONvgLEB+vPvBRaQ4TwsD09syeI9qGLSRBicCe29?= =?us-ascii?Q?Z4tAdQrpIvCf7lIIaP8qtKWJR4mHgrYgPgv0ZY8PTe40IFrl507LnwyO715F?= =?us-ascii?Q?xmI7R1mKenWOI8G3+kutK4HQeDm+tUm8eCdaZbePDZcZZVyFNkJcV2GYCYi8?= =?us-ascii?Q?P4Ef43UitKlKmsl7XvSt2/KplpNabt/aYcZxGkxGkjkooUH/RyZD+mstb0Ao?= =?us-ascii?Q?68kvM08fugQsQhGagI4QD+SJljMeSKtguRtsubXXLj1zP070Z5w4qpzspmaS?= =?us-ascii?Q?hYBe5axgXaRCOrY6HtNoXA8yaIthNAcYQ9QpeMTB+9vSy7tuwD1UuqvRPf/C?= =?us-ascii?Q?h7F+CI+F5wTVVCqRGObm5oc537K2RsH35FmUo61e?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR12MB5396.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b91f813-c6ec-42ba-50ae-08dc30f6e185 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Feb 2024 03:00:08.3010 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nq/4gUV5+ZKbgtpFBkNVwOr1WY4L52VH9IEfYjbOfhUng9AIG9f4cTea79cw+rYAdaPHi1MAmnJnuBxKdx0mTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5339 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: Michael Baum > Sent: Wednesday, February 14, 2024 3:30 PM > To: dev@dpdk.org > Cc: Matan Azrad ; Dariusz Sosnowski > ; Raslan Darawsheh ; Slava > Ovsiienko ; Ori Kam ; Suanming > Mou > Subject: [PATCH v5 2/3] net/mlx5: add support to compare random value >=20 > Add support to use "RTE_FLOW_ITEM_TYPE_COMPARE" with > "RTE_FLOW_FIELD_RAMDOM" as an argument. > The random field is supported only when base is an immediate value, rando= m > field cannot be compared with enother field. >=20 > Signed-off-by: Michael Baum Acked-by: Suanming Mou > --- > doc/guides/nics/mlx5.rst | 9 ++++- > drivers/net/mlx5/mlx5_flow_hw.c | 70 ++++++++++++++++++++++++--------- > 2 files changed, 59 insertions(+), 20 deletions(-) >=20 > diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index > fa013b03bb..43ef8a99dc 100644 > --- a/doc/guides/nics/mlx5.rst > +++ b/doc/guides/nics/mlx5.rst > @@ -820,8 +820,13 @@ Limitations >=20 > - Only supported in HW steering(``dv_flow_en`` =3D 2) mode. > - Only single flow is supported to the flow table. > - - Only 32-bit comparison is supported. > - - Only match with compare result between packet fields is supported. > + - Only single item is supported per pattern template. > + - Only 32-bit comparison is supported or 16-bits for random field. > + - Only supported for ``RTE_FLOW_FIELD_META``, ``RTE_FLOW_FIELD_TAG``, > + ``RTE_FLOW_FIELD_RANDOM`` and ``RTE_FLOW_FIELD_VALUE``. > + - The field type ``RTE_FLOW_FIELD_VALUE`` must be the base (``b``) fie= ld. > + - The field type ``RTE_FLOW_FIELD_RANDOM`` can only be compared with > + ``RTE_FLOW_FIELD_VALUE``. >=20 >=20 > Statistics > diff --git a/drivers/net/mlx5/mlx5_flow_hw.c > b/drivers/net/mlx5/mlx5_flow_hw.c index 3af5e1f160..b5741f0817 100644 > --- a/drivers/net/mlx5/mlx5_flow_hw.c > +++ b/drivers/net/mlx5/mlx5_flow_hw.c > @@ -6717,18 +6717,55 @@ flow_hw_prepend_item(const struct rte_flow_item > *items, > return copied_items; > } >=20 > -static inline bool > -flow_hw_item_compare_field_supported(enum rte_flow_field_id field) > +static int > +flow_hw_item_compare_field_validate(enum rte_flow_field_id arg_field, > + enum rte_flow_field_id base_field, > + struct rte_flow_error *error) > { > - switch (field) { > + switch (arg_field) { > + case RTE_FLOW_FIELD_TAG: > + case RTE_FLOW_FIELD_META: > + break; > + case RTE_FLOW_FIELD_RANDOM: > + if (base_field =3D=3D RTE_FLOW_FIELD_VALUE) > + return 0; > + return rte_flow_error_set(error, EINVAL, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, > + "compare random is supported only > with immediate value"); > + default: > + return rte_flow_error_set(error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, > + "compare item argument field is not > supported"); > + } > + switch (base_field) { > case RTE_FLOW_FIELD_TAG: > case RTE_FLOW_FIELD_META: > case RTE_FLOW_FIELD_VALUE: > - return true; > + break; > + default: > + return rte_flow_error_set(error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, > + "compare item base field is not > supported"); > + } > + return 0; > +} > + > +static inline uint32_t > +flow_hw_item_compare_width_supported(enum rte_flow_field_id field) { > + switch (field) { > + case RTE_FLOW_FIELD_TAG: > + case RTE_FLOW_FIELD_META: > + return 32; > + case RTE_FLOW_FIELD_RANDOM: > + return 16; > default: > break; > } > - return false; > + return 0; > } >=20 > static int > @@ -6737,6 +6774,7 @@ flow_hw_validate_item_compare(const struct > rte_flow_item *item, { > const struct rte_flow_item_compare *comp_m =3D item->mask; > const struct rte_flow_item_compare *comp_v =3D item->spec; > + int ret; >=20 > if (unlikely(!comp_m)) > return rte_flow_error_set(error, EINVAL, @@ -6748,19 +6786,13 > @@ flow_hw_validate_item_compare(const struct rte_flow_item *item, > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, > "compare item only support full mask"); > - if (!flow_hw_item_compare_field_supported(comp_m->a.field) || > - !flow_hw_item_compare_field_supported(comp_m->b.field)) > - return rte_flow_error_set(error, ENOTSUP, > - RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > - NULL, > - "compare item field not support"); > - if (comp_m->a.field =3D=3D RTE_FLOW_FIELD_VALUE && > - comp_m->b.field =3D=3D RTE_FLOW_FIELD_VALUE) > - return rte_flow_error_set(error, EINVAL, > - RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > - NULL, > - "compare between value is not valid"); > + ret =3D flow_hw_item_compare_field_validate(comp_m->a.field, > + comp_m->b.field, error); > + if (ret < 0) > + return ret; > if (comp_v) { > + uint32_t width; > + > if (comp_v->operation !=3D comp_m->operation || > comp_v->a.field !=3D comp_m->a.field || > comp_v->b.field !=3D comp_m->b.field) @@ -6768,7 +6800,9 > @@ flow_hw_validate_item_compare(const struct rte_flow_item *item, >=20 > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, > "compare item spec/mask not > matching"); > - if ((comp_v->width & comp_m->width) !=3D 32) > + width =3D flow_hw_item_compare_width_supported(comp_v- > >a.field); > + MLX5_ASSERT(width > 0); > + if ((comp_v->width & comp_m->width) !=3D width) > return rte_flow_error_set(error, EINVAL, >=20 > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, > -- > 2.25.1