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 CEED143A37; Tue, 6 Feb 2024 13:26:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 57FEF4025E; Tue, 6 Feb 2024 13:26:54 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2061.outbound.protection.outlook.com [40.107.94.61]) by mails.dpdk.org (Postfix) with ESMTP id 8CFEF4021E for ; Tue, 6 Feb 2024 13:26:53 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e+6Y2AmFXLglwq9eqYva5hlFESw1Ug7XyF6FN4ht6DloiBVGrU61i9/MD/v+FuYEaM+QYNdjLb88CMDEGMZKc7IcRP7nU8jSHecv6hmq3xMqoMJcNEd+6BE3FbgAHtG9dF/fe2X/UJUMqf4/sSJev/r7nzfM7z3XH3TpuARzU4BU7aJ03kRn5nk1u5OFpEyRdmw/EhX5XgVb5We1GmthIJS9f64S2ovGsvxN2/8pAyWD10wuLQK0WO9EDPCUqHSVS8bZwTkkSa4LnUnnCnbCymc8WAUzptJhiwq5RqQhlbsOA1tQW6D0VZv8UpEFI7gCPPq9UPFcdsX+TrCftPuFow== 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=Ie1OKpqpOvy9WcixblVexgwxE31sNFE8TwWWe09T/1s=; b=cdrsRX0wzw9bvaeXQf6lX672yitHCyqSeGGfIumqUn3eNoxAiVt13OhWYrPP2OCii7IURv7Zhk4dgdV/bovO0g5jXiVxcyhskcnPCp2gj3gYH6eJC3zZNr4ZFnmRbLoEzT/2XtD32XPU+V8erS9zj54LebwBShmKhWPczNmeteV56ZvPBUnlU8Q5od6aMiB/BQJBASBokS4Crwji2LHDASOtkUG/7gV7SQB6t59nfbbi0sGTvNJPEqHRH/36zo5mFTnUzbh6zE/mfSP9bbF1QHTl3tFWjwPk4qNgOGPjB62dklJXcUomssOKajvY+yQUYY5tvegSImWMm8kfcP/dLg== 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=Ie1OKpqpOvy9WcixblVexgwxE31sNFE8TwWWe09T/1s=; b=RmiCs+DOhM3q+ReVuqF8yci45uOywKERM0rgIbK9WLI2gtCvNcGhkd8swj/WzpxxWnACkRt3t0YtKtri4tg1BX7QowJgpYt08cTMOrNjamrE08KyA5oGAr8ESWkU6HsWBosdKdMjD5TaNUE9OyAklnUVjdy+Xt9EdFXA11+0LRrRvoiZrREGJZEiem3FEhI9Ta5+L9g3yvtNmGSmonSfkp9LpglfEoepYL1ZudJER7+8UkmzNapVY2LDloil0oACqcsXTcJzN+lUpT769eqMOFQyBh/19V1xMyoUmCzAJnKJTvNAMWPX/iUSabZNqOCjT0ORcyYiW1jrPApTtMR1EA== Received: from IA1PR12MB8311.namprd12.prod.outlook.com (2603:10b6:208:3fa::12) by SN7PR12MB7372.namprd12.prod.outlook.com (2603:10b6:806:29b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.17; Tue, 6 Feb 2024 12:26:46 +0000 Received: from IA1PR12MB8311.namprd12.prod.outlook.com ([fe80::708b:e498:d9c4:94]) by IA1PR12MB8311.namprd12.prod.outlook.com ([fe80::708b:e498:d9c4:94%4]) with mapi id 15.20.7270.016; Tue, 6 Feb 2024 12:26:45 +0000 From: Dariusz Sosnowski To: Gregory Etelson , "dev@dpdk.org" CC: Maayan Kashani , Slava Ovsiienko , Ori Kam , Suanming Mou , Matan Azrad Subject: RE: [PATCH 2/2] net/mlx5: improve pattern template validation Thread-Topic: [PATCH 2/2] net/mlx5: improve pattern template validation Thread-Index: AQHaVel7XOyv0pSyX0e8FeX3GxIakrD9OL/Q Date: Tue, 6 Feb 2024 12:26:45 +0000 Message-ID: References: <20240202150617.328603-1-getelson@nvidia.com> <20240202150617.328603-3-getelson@nvidia.com> In-Reply-To: <20240202150617.328603-3-getelson@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: IA1PR12MB8311:EE_|SN7PR12MB7372:EE_ x-ms-office365-filtering-correlation-id: 968b49fb-f7d0-45ad-e245-08dc270ee21c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OTVpNtF02hxH3XMPTiOs6xG/DUFab2+7a5RDGc/OF++zRX9GD3CnVeIwdWvp9iWP0aUEVwglXeuCs0FEZqRfWwBxFovloy8l3Lkf7PJrjNvfg/XnYLrr2BXhFH4hEDt8uMaO87gyr15ci5mtQVqxg7/z/3FyFG4xoD7EKy1qiSWhtAvcehTCYvY12stHQvoNNU/dMRmkII9NQQT8TlnURD1KygJqLPPMl4UW13ZXG2GlqQOnAHuYz89pwhDYyg2QVmbICUZdYDI+yQKA5tetIl0TqXOzBR8/i7khprMpa1pUUAWW3TdbWTRZWZaZ0dk9BO2nhXaGxwPkAwjlR+FExTnkV1iQi+j+WaXZYtJTB0j+GIYFvf1DsL4vfTc86AL36PhOxalC3dY7eWzNMjtyD5FPpNMUegjlfx+RyVY18rtpP5d1zQnjBzJFmQlfGFp8RidEHKgv+xSQg3CTvomQ8ZDsFaTTMQRWWFqwJRprcssUUwgO3WaJVcGSrUwKYWvECT6AMg3D3tpaE1eDQz+ruckceuXIHZyDRK8B6AJimQ809r8pG3iPr/42WDAl30ODCY4E3BKco4vs7Ryj8kgpCP07ARxSOL+1B0shNVa7B3LEljzxIDvCVxQLiucafugs x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:IA1PR12MB8311.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(64100799003)(1800799012)(186009)(316002)(122000001)(41300700001)(86362001)(2906002)(66476007)(110136005)(5660300002)(38100700002)(26005)(66556008)(66446008)(9686003)(76116006)(64756008)(54906003)(53546011)(55236004)(71200400001)(478600001)(7696005)(52536014)(38070700009)(6506007)(33656002)(107886003)(8676002)(8936002)(4326008)(83380400001)(66946007)(55016003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?OlDtPcWva0wvbGp40a1odzvqK1BWsap68Hc3JfVeBFOVVp03WMHHjdUXS8tm?= =?us-ascii?Q?IWddXRFx2VJn5aGP9zXGTquNPG2oVXVUHqUo5msbPW/fndJo0iiClxRtU0MS?= =?us-ascii?Q?4wa8jL2e7PfvEgXOuZzLBnZPBf0HiyUgKhVMJWds4o1ZLEWdp1QJItZ7kBcf?= =?us-ascii?Q?xVXzCVva0u1YTMXYTL9zHIeaagnqKE1xNIGALtShnLWMK6xQm3doOuXMc7AU?= =?us-ascii?Q?MHF5tOHUerEICO5yvZbmopo/nz5gpBf46xWjnT4kCbt87mOYy06u6Qg4ZRiu?= =?us-ascii?Q?n1agqYBBjWkDRVSx6JNrJ/BYgRC02RLM66iJhrLacZTBrjcZOvzc/giYdE9c?= =?us-ascii?Q?wboH3liAcpg4No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KL7+?= =?us-ascii?Q?OxqAhbMT10vrF2DgXxixSnj7V/kB/tE4sj1IdZA+981XHH/MENIrivbm+Tbm?= =?us-ascii?Q?on2fIjWa+uxwIxIQzAE/oN0xRL29pC4MjKkZOPRih7WRTtr21XoDoceMGlAC?= =?us-ascii?Q?Ep2tDP0RN9hdxHwYzTdRfz2u1wp1oAc00bP0Dg/zSwhshXGBGNodWHQGKlVp?= =?us-ascii?Q?BghMrzHcT1GXI7XUTcXvYyZAviWndPoVw2a2Uq9xGlEhGTAwCzVyN/v5knOh?= =?us-ascii?Q?zz+VKn/180VS3gQ+Q7Zkn56+APX8ptoaJxN4T1smwWg3VrGZOluq0HiYR6Og?= =?us-ascii?Q?/ruFVMhlWHpk59DuSXsFECYjzivcoG4JJo6BEu9D?= 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: IA1PR12MB8311.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 968b49fb-f7d0-45ad-e245-08dc270ee21c X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Feb 2024 12:26:45.5894 (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: 21HGG4f6Me92Q6hIcDswzFOk/bVudynUnP+WNeDQ5jbPh1mZ7H32bfdZvLC+Opd2VIIbH0qF6Om+0wazj6AFpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7372 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 Hi Gregory, > -----Original Message----- > From: Gregory Etelson > Sent: Friday, February 2, 2024 16:06 > To: dev@dpdk.org > Cc: Gregory Etelson ; Maayan Kashani > ; Dariusz Sosnowski ; > Slava Ovsiienko ; Ori Kam ; > Suanming Mou ; Matan Azrad > > Subject: [PATCH 2/2] net/mlx5: improve pattern template validation >=20 > Current PMD implementation validates pattern templates that will always b= e > rejected during table template creation. >=20 > The patch adds basic HWS verifications to pattern validation to ensure th= at the > pattern can be used in table template. >=20 > PMD updates `rte_errno` if pattern template validation failed: >=20 > E2BIG - pattern too big for PMD > ENOTSUP - pattern not supported by PMD > ENOMEM - PMD allocation failure >=20 > Signed-off-by: Gregory Etelson > > [snip] > > --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c > index da873ae2e2..443aa5fcf0 100644 > --- a/drivers/net/mlx5/mlx5_flow_hw.c > +++ b/drivers/net/mlx5/mlx5_flow_hw.c > @@ -6840,6 +6840,46 @@ flow_hw_pattern_has_sq_match(const struct > rte_flow_item *items) > return false; > } >=20 > +static int > +pattern_template_validate(struct rte_eth_dev *dev, > + struct rte_flow_pattern_template *pt[], uint32_t > pt_num) { > + uint32_t group =3D 0; > + struct rte_flow_error error; > + struct rte_flow_template_table_attr tbl_attr =3D { > + .nb_flows =3D 64, > + .insertion_type =3D > RTE_FLOW_TABLE_INSERTION_TYPE_PATTERN, > + .hash_func =3D RTE_FLOW_TABLE_HASH_FUNC_DEFAULT, > + .flow_attr =3D { > + .ingress =3D pt[0]->attr.ingress, > + .egress =3D pt[0]->attr.egress, > + .transfer =3D pt[0]->attr.transfer > + } > + }; > + struct mlx5_priv *priv =3D dev->data->dev_private; > + struct rte_flow_actions_template *action_template; > + > + if (pt[0]->attr.ingress) > + action_template =3D priv- > >action_template_drop[MLX5DR_TABLE_TYPE_NIC_RX]; > + else if (pt[0]->attr.egress) > + action_template =3D priv- > >action_template_drop[MLX5DR_TABLE_TYPE_NIC_TX]; > + else if (pt[0]->attr.transfer) > + action_template =3D priv- > >action_template_drop[MLX5DR_TABLE_TYPE_FDB]; > + else > + return EINVAL; > + do { > + struct rte_flow_template_table *tmpl_tbl; > + > + tbl_attr.flow_attr.group =3D group; > + tmpl_tbl =3D flow_hw_template_table_create(dev, &tbl_attr, pt, pt_num, flow_hw_table_create() should be called here. If E-Switch is enabled, flow_hw_template_table_create() will perform intern= al group translation for FDB and TX domain, so group 0 will be untested. > + &action_template, 1, > NULL); > + if (!tmpl_tbl) > + return rte_errno; > + flow_hw_table_destroy(dev, tmpl_tbl, &error); I don't think that passing error struct is needed here, since this error is= not propagated up. > [snip] > > @@ -9184,6 +9235,66 @@ flow_hw_compare_config(const struct > mlx5_flow_hw_attr *hw_attr, > return true; > } >=20 > +/* > + * No need to explicitly release drop action templates on port stop. > + * Drop action templates release with other action templates during > + * mlx5_dev_close -> flow_hw_resource_release -> > +flow_hw_actions_template_destroy */ static void > +action_template_drop_release(struct rte_eth_dev *dev) { > + int i; > + struct mlx5_priv *priv =3D dev->data->dev_private; > + > + for (i =3D 0; i < MLX5DR_TABLE_TYPE_MAX; i++) { > + if (!priv->action_template_drop[i]) > + continue; > + flow_hw_actions_template_destroy(dev, > + priv- > >action_template_drop[i], > + NULL); > + } I'd suggest adding zeroing action_template_drop array entries here. In case of failure inside rte_flow_configure(), rollback code called on err= or must reset the affected fields in private data to allow safe call to rte_flow_co= nfigure() again. > [snip] > > @@ -9621,10 +9735,7 @@ flow_hw_resource_release(struct rte_eth_dev > *dev) > flow_hw_flush_all_ctrl_flows(dev); > flow_hw_cleanup_tx_repr_tagging(dev); > flow_hw_cleanup_ctrl_rx_tables(dev); > - while (!LIST_EMPTY(&priv->flow_hw_grp)) { > - grp =3D LIST_FIRST(&priv->flow_hw_grp); > - flow_hw_group_unset_miss_group(dev, grp, NULL); > - } > + action_template_drop_release(dev); Why is the miss actions cleanup code removed? It does not seem related to t= he patch. Best regards, Dariusz Sosnowski