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 01810A0351; Sun, 9 Jan 2022 12:16:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 889C44114A; Sun, 9 Jan 2022 12:16:53 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id CD3F540042 for ; Sun, 9 Jan 2022 12:16:51 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 209AnZnW031934; Sun, 9 Jan 2022 03:16:48 -0800 Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2105.outbound.protection.outlook.com [104.47.55.105]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3dfb0p9yfb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Jan 2022 03:16:48 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FlJK3Rkh3KJrUGdnbSQ1qVt4zn2qvJsu+G4vEd54rhMkaW1WX4kFZYPDGcarAy6XidM8ockD9OQ6Vf252qFi7hQKKsI5uBtpYXqU8n26B5S049K4CzYm8HT8lVQzxL2Ib9HPthi8Lir/PVKeRK2M/oHQG4+5CHffUVQV/9TukkNjvs0ep0YN9m9FENyC+bXeRC/rdBMUNajiuVreD911USAyUt+iLMgNbchb5N0IiY9mi+yU43zTnfUPEtf65aWR2/j7qJzJIQKIYT/cbM+yNvqkQ1cp6OZQqY8mO1yKH6FVoWo0kcKm+K7jri2h1bBU4cnLWzpittb1ENKhj7RF1Q== 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=+O8mLEFWiz92bGLxHDkS+9sF4BdllhaZNzuop+tHSVI=; b=XXECoIr+j0iIcL8gRrbMKw6EiSaKN8Rka6zBAMsYCq+TMUyJiNpuOdVJktcIw67m4JIGjhnTdclJeiYeh0RwSbApWIafovsl9LsSg4tqavCzF47pxlZyt0BcUSvh4gpv7B8Nn3DWqvSiw1i/8E9lJMXqT+WR4s2VFverxBL7jxZVz53cdQaNTelMvGKe3Fuhc6W5h+HDdaWLWB36BmrPTr5zC51+YvztAHHeidvoq9u82Mu2w/5E92iMQq1ndWyBDbO6fUe0iXMwP72l42CeZKyBOZu2xA46px1Y+JcZPfrrMgOgf9ZOFXk/f7DYrMImvnP+2fTxaJwd7ywjfIQRsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+O8mLEFWiz92bGLxHDkS+9sF4BdllhaZNzuop+tHSVI=; b=edaJwK/EO6GprUHy8AZQt90CyUY4PZjzveLzPDAxVLeCnk8lWqp5ZXbNK2+2G19gWqrDFwFoJt3uFbz28/gxnlWn1Zi28whua7mNLnVJ+f3F3oSTWu0/5p+TXmiJkw48xk5bP8Mky87kEMlnTI2Cre6yOffT4QrNY4AXEtslhuw= Received: from CO6PR18MB3860.namprd18.prod.outlook.com (2603:10b6:5:34d::12) by MW2PR18MB2315.namprd18.prod.outlook.com (2603:10b6:907:9::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.7; Sun, 9 Jan 2022 11:16:45 +0000 Received: from CO6PR18MB3860.namprd18.prod.outlook.com ([fe80::e1bd:4390:f689:3a41]) by CO6PR18MB3860.namprd18.prod.outlook.com ([fe80::e1bd:4390:f689:3a41%7]) with mapi id 15.20.4867.011; Sun, 9 Jan 2022 11:16:45 +0000 From: Sunil Kumar Kori To: Sunil Kumar Kori , Ray Kinsella , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" , Jerin Jacob Kollanukkaran Subject: RE: [PATCH v1 1/2] ethdev: support queue-based priority flow control Thread-Topic: [PATCH v1 1/2] ethdev: support queue-based priority flow control Thread-Index: AQHYBUfr95YzKOJZ7Ua0ZYqhAjv/QqxaiUcA Date: Sun, 9 Jan 2022 11:16:45 +0000 Message-ID: References: <20211204172458.1904300-1-jerinj@marvell.com> <20220109105851.734687-1-skori@marvell.com> In-Reply-To: <20220109105851.734687-1-skori@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6fee8a8f-e8e6-49d1-808f-08d9d3618579 x-ms-traffictypediagnostic: MW2PR18MB2315:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ln7ALgQyZBrUirNXVvxxe3UgiqVdHs7RtQUI5LJjQECIcY4nPgyQuTKnmKBye8ZHlH3ZiowPPP1pzgsyaI1Tkgd3s12QwJWcNfMZ3fLgXYWvrQLlBidI0aEa+FzetKCybWKmU4rLBbD4O+cyCfpRTbB5MbWIIsrzOoPMS3fN4JUnmtXlOX90mMo5b84szXxO92sbieldxp5tvOUReGQ+WUgZiYcxvM9ZTLiV4/Q8fTv+E3giIlkk/juVxIm76emFe8+GyXZRa+ZUCqKPXrSxc0R082nN/gS+oIPtfB4HfL8MGKt9/rnnsQw4q0I2sTTXfC7muSR8Ypr0c2ZmYAu7SR4DNZCkjGGo5ttdwZmupiZY+FhGTCKaIxYWZGX19kV+TEI10p2sAI06+rcQpmUDhE7w8Dz2nHvEatSQ6S3rVMn1YaK5MrW0+xgyOEnNiA1DXBGhiVmDT6UQkq3zv7x8xKAcm2YLyCTscUcXSi/schrvVvp5wnhljHKdmHB/yCdMhzWBoKU7kQMSzyRZSY//AAb8lKayT+PGcbChHwuJWs2NcszMh1YoiEIVWnlKFYglKSLAapKV9LCJci7EnIjRU6tegyPODfAjDZwib+5uIsIkc5ZeahMd/Imp439FaKmjCZMlsoU969+6AV7JuRZucD2Ick/nAwrLQzWOg5d2umaZ9Zpx+bEMx/GRuanMMDbuKr4h8U+zpUzPbKxcQUd307XRcyiLYhmNGWmTCEl8JJmYKQI2J02jYpKsQlideVGg7IJHNrsMKOtEMtgF7N2c99r6kV01slJPKPxZKZDlYu+ebOJtiMSOU4Qqtst6AJqC x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB3860.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(76116006)(2906002)(54906003)(83380400001)(71200400001)(66946007)(6506007)(186003)(316002)(30864003)(86362001)(508600001)(52536014)(110136005)(7696005)(8676002)(8936002)(38070700005)(66476007)(26005)(122000001)(38100700002)(66446008)(64756008)(66556008)(966005)(55016003)(4326008)(107886003)(5660300002)(9686003)(33656002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?nS0zAx6Ml5FqGmpzInvxgojz8a0zb/bLWrIvXHGQ6moaj6Wre/XHtpPt0j34?= =?us-ascii?Q?k9+1bcOKr+qO3pLOySBUXp73ybEpoJ0gTVxqM5YQxcH1b6DD9iDfnH59Ry91?= =?us-ascii?Q?0g8517ySzUgIfRo/FDtHF17ojm31q7s5pV8KotrGwOfPiDzhrFYJOIQmuDtQ?= =?us-ascii?Q?GU/pX4a13ybmDVcs90XbyDA7PyIf04CU/3IIP81OseVarhCQ82/SyGs9Entg?= =?us-ascii?Q?whTULKtCRZhMyiTYG6M/X1EeBGSextRSZOtgtLAUFbJ04xB+Fi9UmUxMh993?= =?us-ascii?Q?vWCD1U30P1YjCqbpiMq3FMRCdS4TCYjwDUa6RjfENhd18Dke87fyoPuHqivW?= =?us-ascii?Q?Nq1AmU1NSoZJTjEK2gOPqZiwbE8RXRpGYhErMSNVq7byK/Hsw1WNOydIIGv/?= =?us-ascii?Q?9lV/+YfgqRZcSP4lwgmLDTwYC0VKcYIK7brVm/PWOIk8rYnsEFvwxdUzkYh+?= =?us-ascii?Q?l1tPUEESZ/uDPkKYdzcPThG7RX+g3FjMQNP8aMTflxn5Yqtd2SEBpCaX/U+l?= =?us-ascii?Q?tmfRjFVpmDMFcsgudktOSMxL8b826p/VxkvRndgbM6nWXgkfpISIAjsXJDcM?= =?us-ascii?Q?hAvhY08RfTa2XhTG3YrRFrmJzg6Ne6gjkRp/9nTGoGz3jPIHLGHjlKMRyAzz?= =?us-ascii?Q?vdai3beoMnTxzd0CnPpXdC737KQ8OWuUijiiC37nMOlOZ6BSbvdM78xuatoQ?= =?us-ascii?Q?3WwJdG/rvVXcnI7EFkYSR6g0WYBnsz4G1VHDLTMEU7LZhTNGVdg9oEyM4JrS?= =?us-ascii?Q?ubWm7GodEhssfi9sYrfOpD9tZw1at0O8yNpEFmBKcVrnIZ3RubV6HMkuNyxS?= =?us-ascii?Q?aB2oPBR0P0A2KR+UwBKSvXbQLiXPBLTxldKrK8UJE008/Yec9jVijiDNXf41?= =?us-ascii?Q?H8oahhPeVCoNZiW9zJlGbAQg9Saqx2WicfAxFAVs2+1RDe7CrXN0Np2jdRit?= =?us-ascii?Q?ePpaZa0K/orexFcm6k65+63HukxHu5/av14VV7xa1wZ+phGLFva8SiyApTGj?= =?us-ascii?Q?GPwoxBoLo0WQ+UEmNw5dWqcSK7fiuTqXCHCd8Hx6S4uw9YoEnoLjqM8MpMN4?= =?us-ascii?Q?ios9e6hbAFdU2yT4rH3jLIKEN5GaXa2/ZZvtCFUaEgxO0FrjO/7WioCGsiXL?= =?us-ascii?Q?DIY7LtbHciThWOBK7ejkoQFeQuWwTwfNW6zuVRdBU9PCGlkmU9MbM99lC5Hx?= =?us-ascii?Q?9Hwnvszx1v3NN0VTr82t3T9AMuif4CoG/DEuIWJ6cXu8a8/kcGL68oFAjRJP?= =?us-ascii?Q?YgRUVsV7waOg25aoPv/1WxZnQIRTLWLGMdddLUanRf17CI5wPw4qi+Rwvvr1?= =?us-ascii?Q?yJFHAeujT4H2JQotdM8eaQYqPIRj1UFKsozy3ZBBxydiGqDFjqOoO/aCd3r5?= =?us-ascii?Q?rN1FuRVg/adCEaOjl2LavjcFX9dwMG5O0QMSBMi9tmGUkkxwbrLbmWtLg78q?= =?us-ascii?Q?qChJYIU+Q5dQ6LcSFfRgszKMAfWHCLjrt7LH0sXzJ/rzQYzGgHSOQ4/MHqA1?= =?us-ascii?Q?bStjB6im/X3qBTXhxC54g15SEHfCm3mQCIydYmEABHvx48nHVtulgUh03htR?= =?us-ascii?Q?SriYsZg2ilOzEaxmCOrAHIpQliCNbSKZrv1ib2/6o6fnLeZgc3xVixOVK0g5?= =?us-ascii?Q?Vg=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR18MB3860.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6fee8a8f-e8e6-49d1-808f-08d9d3618579 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jan 2022 11:16:45.3319 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WWQK4ghwMK2ub1mvQ8DSJHTUeMzS6mbr/HqNzFZwsXwRfVo8HuXNggqu1YcuUVud3d/hMYrXGSBzH+2AMF6Jkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR18MB2315 X-Proofpoint-ORIG-GUID: iDtm0Oy52Wr5bxBCARlGkFikEkN3mq_2 X-Proofpoint-GUID: iDtm0Oy52Wr5bxBCARlGkFikEkN3mq_2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-09_04,2022-01-07_01,2021-12-02_01 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 As per discussion with Jerin against the RFC http://patches.dpdk.org/projec= t/dpdk/patch/20211204172458.1904300-1-jerinj@marvell.com/, following change= set adds queue based PFC configuration.=20 Also corresponding implementation for the API is available at http://patche= s.dpdk.org/project/dpdk/patch/20220109111130.751933-2-skori@marvell.com/ fo= r Marvell platforms.=20 Regards Sunil Kumar Kori >-----Original Message----- >From: skori@marvell.com >Sent: Sunday, January 9, 2022 4:29 PM >To: Ray Kinsella ; Thomas Monjalon >; Ferruh Yigit ; Andrew >Rybchenko >Cc: dev@dpdk.org; Sunil Kumar Kori ; Jerin Jacob >Kollanukkaran >Subject: [PATCH v1 1/2] ethdev: support queue-based priority flow control > >From: Sunil Kumar Kori > >Based on device support and use-case need, there are two different ways to >enable PFC. The first case is the port level PFC configuration, in this ca= se, >rte_eth_dev_priority_flow_ctrl_set() API shall be used to configure the PF= C, >and PFC frames will be generated using based on VLAN TC value. > >The second case is the queue level PFC configuration, in this case, Any pa= cket >field content can be used to steer the packet to the specific queue using >rte_flow or RSS and then use >rte_eth_dev_priority_flow_ctrl_queue_set() to set the TC mapping on each >queue. Based on congestion selected on the specific queue, configured TC >shall be used to generate PFC frames. > >Operation of these modes are mutually exclusive, when driver sets non zero >value for rte_eth_dev_info::pfc_queue_tc_max, >application must use queue level PFC configuration via >rte_eth_dev_priority_flow_ctrl_queue_set() API instead of port level PFC >configuration via rte_eth_dev_priority_flow_ctrl_set() API to realize PFC >configuration. > >This patch enables the configuration for second case a.k.a queue based PFC >also updates rte_eth_dev_priority_flow_ctrl_set() >implmentaion to adheher to rte_eth_dev_info::pfc_queue_tc_max >handling. > >Also updated libabigail.abignore to ignore the update to reserved fields i= n >rte_eth_dev_info. > >Signed-off-by: Jerin Jacob >Signed-off-by: Sunil Kumar Kori >--- >v1: > - Added queue based PFC config API instead port based > > devtools/libabigail.abignore | 5 ++ > doc/guides/nics/features.rst | 5 +- > doc/guides/rel_notes/release_22_03.rst | 3 + > lib/ethdev/ethdev_driver.h | 6 +- > lib/ethdev/rte_ethdev.c | 109 +++++++++++++++++++++++++ > lib/ethdev/rte_ethdev.h | 83 ++++++++++++++++++- > lib/ethdev/version.map | 3 + > 7 files changed, 208 insertions(+), 6 deletions(-) > >diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore i= ndex >4b676f317d..1d29e60c06 100644 >--- a/devtools/libabigail.abignore >+++ b/devtools/libabigail.abignore >@@ -11,3 +11,8 @@ > ; Ignore generated PMD information strings [suppress_variable] > name_regexp =3D _pmd_info$ >+ >+; Ignore fields inserted in place of reserved fields of >+rte_eth_dev_info [suppress_type] >+ name =3D rte_eth_dev_info >+ has_data_member_inserted_between =3D {offset_after(switch_info), >+end} >diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst i= ndex >27be2d2576..277a784f4e 100644 >--- a/doc/guides/nics/features.rst >+++ b/doc/guides/nics/features.rst >@@ -379,9 +379,10 @@ Flow control > Supports configuring link flow control. > > * **[implements] eth_dev_ops**: ``flow_ctrl_get``, ``flow_ctrl_set``, >- ``priority_flow_ctrl_set``. >+ ``priority_flow_ctrl_set``, ``priority_flow_ctrl_queue_set``. > * **[related] API**: ``rte_eth_dev_flow_ctrl_get()``, >``rte_eth_dev_flow_ctrl_set()``, >- ``rte_eth_dev_priority_flow_ctrl_set()``. >+ ``rte_eth_dev_priority_flow_ctrl_set()``, >``rte_eth_dev_priority_flow_ctrl_queue_set()``. >+* **[provides] rte_eth_dev_info**: ``pfc_queue_tc_max``. > > > .. _nic_features_rate_limitation: >diff --git a/doc/guides/rel_notes/release_22_03.rst >b/doc/guides/rel_notes/release_22_03.rst >index 6d99d1eaa9..b75c0356e6 100644 >--- a/doc/guides/rel_notes/release_22_03.rst >+++ b/doc/guides/rel_notes/release_22_03.rst >@@ -55,6 +55,9 @@ New Features > Also, make sure to start the actual text at the margin. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D > >+* **Added an API to enable queue based priority flow ctrl(PFC).** >+ >+ A new API, ``rte_eth_dev_priority_flow_ctrl_queue_set()``, was added. > > Removed Items > ------------- >diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index >d95605a355..e0bbfe89d7 100644 >--- a/lib/ethdev/ethdev_driver.h >+++ b/lib/ethdev/ethdev_driver.h >@@ -532,6 +532,9 @@ typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev= , > /** @internal Setup priority flow control parameter on an Ethernet device= . */ >typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev, > struct rte_eth_pfc_conf *pfc_conf); >+/** @internal Queue setup for priority flow control parameter on an >+Ethernet device. */ typedef int (*priority_flow_ctrl_queue_set_t)(struct >rte_eth_dev *dev, >+ struct rte_eth_pfc_queue_conf >*pfc_queue_conf); > > /** @internal Update RSS redirection table on an Ethernet device. */ typ= edef >int (*reta_update_t)(struct rte_eth_dev *dev, @@ -1080,7 +1083,8 @@ struct >eth_dev_ops { > flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control */ > /** Setup priority flow control */ > priority_flow_ctrl_set_t priority_flow_ctrl_set; >- >+ /** Priority flow control queue setup */ >+ priority_flow_ctrl_queue_set_t priority_flow_ctrl_queue_set; > /** Set Unicast Table Array */ > eth_uc_hash_table_set_t uc_hash_table_set; > /** Set Unicast hash bitmap */ >diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index >a1d475a292..6def057720 100644 >--- a/lib/ethdev/rte_ethdev.c >+++ b/lib/ethdev/rte_ethdev.c >@@ -3998,7 +3998,9 @@ int > rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id, > struct rte_eth_pfc_conf *pfc_conf) { >+ struct rte_eth_dev_info dev_info; > struct rte_eth_dev *dev; >+ int ret; > > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > dev =3D &rte_eth_devices[port_id]; >@@ -4010,6 +4012,17 @@ rte_eth_dev_priority_flow_ctrl_set(uint16_t >port_id, > return -EINVAL; > } > >+ ret =3D rte_eth_dev_info_get(port_id, &dev_info); >+ if (ret !=3D 0) >+ return ret; >+ >+ if (dev_info.pfc_queue_tc_max !=3D 0) { >+ RTE_ETHDEV_LOG(ERR, >+ "Ethdev port %u driver does not support port level PFC >config\n", >+ port_id); >+ return -ENOTSUP; >+ } >+ > if (pfc_conf->priority > (RTE_ETH_DCB_NUM_USER_PRIORITIES - 1)) { > RTE_ETHDEV_LOG(ERR, "Invalid priority, only 0-7 allowed\n"); > return -EINVAL; >@@ -4022,6 +4035,102 @@ rte_eth_dev_priority_flow_ctrl_set(uint16_t >port_id, > return -ENOTSUP; > } > >+static inline int >+validate_rx_pause_config(struct rte_eth_dev_info *dev_info, >+ struct rte_eth_pfc_queue_conf *pfc_queue_conf) { >+ if ((pfc_queue_conf->mode =3D=3D RTE_ETH_FC_RX_PAUSE) || >+ (pfc_queue_conf->mode =3D=3D RTE_ETH_FC_FULL)) { >+ if (pfc_queue_conf->rx_pause.tx_qid >=3D dev_info- >>nb_tx_queues) { >+ RTE_ETHDEV_LOG(ERR, "Tx queue not in range for Rx >pause" >+ " (requested: %d configured: %d)\n", >+ pfc_queue_conf->rx_pause.tx_qid, >+ dev_info->nb_tx_queues); >+ return -EINVAL; >+ } >+ >+ if (pfc_queue_conf->rx_pause.tc >=3D dev_info- >>pfc_queue_tc_max) { >+ RTE_ETHDEV_LOG(ERR, "TC not in range for Rx pause" >+ " (requested: %d max: %d)\n", >+ pfc_queue_conf->rx_pause.tc, >+ dev_info->pfc_queue_tc_max); >+ return -EINVAL; >+ } >+ } >+ >+ return 0; >+} >+ >+static inline int >+validate_tx_pause_config(struct rte_eth_dev_info *dev_info, >+ struct rte_eth_pfc_queue_conf *pfc_queue_conf) { >+ if ((pfc_queue_conf->mode =3D=3D RTE_ETH_FC_TX_PAUSE) || >+ (pfc_queue_conf->mode =3D=3D RTE_ETH_FC_FULL)) { >+ if (pfc_queue_conf->tx_pause.rx_qid >=3D dev_info- >>nb_rx_queues) { >+ RTE_ETHDEV_LOG(ERR, "Rx queue not in range for Tx >pause" >+ "(requested: %d configured: %d)\n", >+ pfc_queue_conf->tx_pause.rx_qid, >+ dev_info->nb_rx_queues); >+ return -EINVAL; >+ } >+ >+ if (pfc_queue_conf->tx_pause.tc >=3D dev_info- >>pfc_queue_tc_max) { >+ RTE_ETHDEV_LOG(ERR, "TC not in range for Tx pause" >+ "(requested: %d max: %d)\n", >+ pfc_queue_conf->tx_pause.tc, >+ dev_info->pfc_queue_tc_max); >+ return -EINVAL; >+ } >+ } >+ >+ return 0; >+} >+ >+int >+rte_eth_dev_priority_flow_ctrl_queue_set( >+ uint16_t port_id, struct rte_eth_pfc_queue_conf *pfc_queue_conf) { >+ struct rte_eth_dev_info dev_info; >+ struct rte_eth_dev *dev; >+ int ret; >+ >+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >+ dev =3D &rte_eth_devices[port_id]; >+ >+ if (pfc_queue_conf =3D=3D NULL) { >+ RTE_ETHDEV_LOG(ERR, "PFC parameters are NULL for port >(%u)\n", >+ port_id); >+ return -EINVAL; >+ } >+ >+ ret =3D rte_eth_dev_info_get(port_id, &dev_info); >+ if (ret !=3D 0) >+ return ret; >+ >+ if (dev_info.pfc_queue_tc_max =3D=3D 0) { >+ RTE_ETHDEV_LOG(ERR, >+ "Ethdev port %u does not support PFC TC values\n", >+ port_id); >+ return -ENOTSUP; >+ } >+ >+ ret =3D validate_rx_pause_config(&dev_info, pfc_queue_conf); >+ if (ret !=3D 0) >+ return ret; >+ >+ ret =3D validate_tx_pause_config(&dev_info, pfc_queue_conf); >+ if (ret !=3D 0) >+ return ret; >+ >+ >+ if (*dev->dev_ops->priority_flow_ctrl_queue_set) >+ return eth_err(port_id, >+ (*dev->dev_ops->priority_flow_ctrl_queue_set)( >+ dev, pfc_queue_conf)); >+ return -ENOTSUP; >+} >+ > static int > eth_check_reta_mask(struct rte_eth_rss_reta_entry64 *reta_conf, > uint16_t reta_size) >diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index >fa299c8ad7..d13b6df3b9 100644 >--- a/lib/ethdev/rte_ethdev.h >+++ b/lib/ethdev/rte_ethdev.h >@@ -1395,6 +1395,28 @@ struct rte_eth_pfc_conf { > uint8_t priority; /**< VLAN User Priority. */ > }; > >+/** >+ * @warning >+ * @b EXPERIMENTAL: this API may change, or be removed, without prior >+notice >+ * >+ * A structure used to configure Ethernet priority flow control >+parameter for >+ * ethdev queues. >+ */ >+struct rte_eth_pfc_queue_conf { >+ enum rte_eth_fc_mode mode; /**< Link flow control mode */ >+ >+ struct { >+ uint16_t tx_qid; >+ uint8_t tc; /**< Traffic class as per PFC (802.1Qbb) spec */ >+ } rx_pause; /* Valid when (mode =3D=3D FC_RX_PAUSE || mode =3D=3D >FC_FULL) */ >+ >+ struct { >+ uint16_t pause_time; /**< Pause quota in the Pause frame */ >+ uint16_t rx_qid; >+ uint8_t tc; /**< Traffic class as per PFC (802.1Qbb) spec */ >+ } tx_pause; /* Valid when (mode =3D=3D FC_TX_PAUSE || mode =3D=3D >FC_FULL) */ >+}; >+ > /** > * Tunnel type for device-specific classifier configuration. > * @see rte_eth_udp_tunnel >@@ -1841,8 +1863,30 @@ struct rte_eth_dev_info { > * embedded managed interconnect/switch. > */ > struct rte_eth_switch_info switch_info; >- >- uint64_t reserved_64s[2]; /**< Reserved for future fields */ >+ /** >+ * Maximum supported traffic class as per PFC (802.1Qbb) >specification. >+ * >+ * Based on device support and use-case need, there are two different >+ * ways to enable PFC. The first case is the port level PFC >+ * configuration, in this case, rte_eth_dev_priority_flow_ctrl_set() >+ * API shall be used to configure the PFC, and PFC frames will be >+ * generated using based on VLAN TC value. >+ * The second case is the queue level PFC configuration, in this case, >+ * Any packet field content can be used to steer the packet to the >+ * specific queue using rte_flow or RSS and then use >+ * rte_eth_dev_priority_flow_ctrl_queue_set() to set the TC mapping >+ * on each queue. Based on congestion selected on the specific queue, >+ * configured TC shall be used to generate PFC frames. >+ * >+ * When set to non zero value, application must use queue level >+ * PFC configuration via rte_eth_dev_priority_flow_ctrl_queue_set() >API >+ * instead of port level PFC configuration via >+ * rte_eth_dev_priority_flow_ctrl_set() API to realize >+ * PFC configuration. >+ */ >+ uint8_t pfc_queue_tc_max; >+ uint8_t reserved_8s[7]; >+ uint64_t reserved_64s[1]; /**< Reserved for future fields */ > void *reserved_ptrs[2]; /**< Reserved for future fields */ > }; > >@@ -4109,6 +4153,9 @@ int rte_eth_dev_flow_ctrl_set(uint16_t port_id, > * Configure the Ethernet priority flow control under DCB environment > * for Ethernet device. > * >+ * @see struct rte_eth_dev_info::pfc_queue_tc_max priority >+ * flow control usage models. >+ * > * @param port_id > * The port identifier of the Ethernet device. > * @param pfc_conf >@@ -4119,10 +4166,40 @@ int rte_eth_dev_flow_ctrl_set(uint16_t port_id, > * - (-ENODEV) if *port_id* invalid. > * - (-EINVAL) if bad parameter > * - (-EIO) if flow control setup failure or device is removed. >+ * > */ > int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id, >- struct rte_eth_pfc_conf *pfc_conf); >+ struct rte_eth_pfc_conf *pfc_conf); > >+/** >+ * @warning >+ * @b EXPERIMENTAL: this API may change without prior notice. >+ * >+ * Configure the Ethernet priority flow control for a given queue >+ * for Ethernet device. >+ * >+ * @see struct rte_eth_dev_info::pfc_queue_tc_max priority flow control >+ * usage models. >+ * >+ * @note When an ethdev port switches to PFC mode, the unconfigured >+ * queues shall be configured by the driver with default values such as >+ * lower priority value for TC etc. >+ * >+ * @param port_id >+ * The port identifier of the Ethernet device. >+ * @param pfc_queue_conf >+ * The pointer to the structure of the priority flow control parameters >+ * for the queue. >+ * @return >+ * - (0) if successful. >+ * - (-ENOTSUP) if hardware doesn't support priority flow control mode. >+ * - (-ENODEV) if *port_id* invalid. >+ * - (-EINVAL) if bad parameter >+ * - (-EIO) if flow control setup queue failure >+ */ >+__rte_experimental >+int rte_eth_dev_priority_flow_ctrl_queue_set(uint16_t port_id, >+ struct rte_eth_pfc_queue_conf >*pfc_queue_conf); > /** > * Add a MAC address to the set used for filtering incoming packets. > * >diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index >c2fb0669a4..8f361ec15a 100644 >--- a/lib/ethdev/version.map >+++ b/lib/ethdev/version.map >@@ -256,6 +256,9 @@ EXPERIMENTAL { > rte_flow_flex_item_create; > rte_flow_flex_item_release; > rte_flow_pick_transfer_proxy; >+ >+ # added in 22.03 >+ rte_eth_dev_priority_flow_ctrl_queue_set; > }; > > INTERNAL { >-- >2.25.1