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 23CE942850; Thu, 30 Mar 2023 11:31:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B0CA7410D3; Thu, 30 Mar 2023 11:31:51 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2050.outbound.protection.outlook.com [40.107.105.50]) by mails.dpdk.org (Postfix) with ESMTP id 99C7B40E25 for ; Thu, 30 Mar 2023 11:31:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KFkeNWaloLfm/FFUtgIxcGLSCx3AksyF3NqOoW9+oyY=; b=BzG3UY9wUC5cwMgY24PpUdL4PGjYm/5HkMOsl1U7SXv/GabD3da3nmcx9+g0JwMk1NTvw/9P6He8th8RAAr3SQybus6nVK4WKF77qHib3P5jdwGfj/7w9oCPbt/so9qOTM2SBPLUpS/uD5DotOjocaB1f5iAuG+tf62spJu/6Jg= Received: from DU2PR04CA0047.eurprd04.prod.outlook.com (2603:10a6:10:234::22) by GV2PR08MB9399.eurprd08.prod.outlook.com (2603:10a6:150:df::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.21; Thu, 30 Mar 2023 09:31:47 +0000 Received: from DBAEUR03FT036.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:234:cafe::3c) by DU2PR04CA0047.outlook.office365.com (2603:10a6:10:234::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.21 via Frontend Transport; Thu, 30 Mar 2023 09:31:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT036.mail.protection.outlook.com (100.127.142.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.22 via Frontend Transport; Thu, 30 Mar 2023 09:31:46 +0000 Received: ("Tessian outbound 99a3040377ca:v136"); Thu, 30 Mar 2023 09:31:46 +0000 X-CR-MTA-TID: 64aa7808 Received: from 883b2235e3c8.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C15554B3-E487-4E11-A052-889D3667A746.1; Thu, 30 Mar 2023 09:31:40 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 883b2235e3c8.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Mar 2023 09:31:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R8PNqJ8ZvIxHsZChfoLQVhlg2DuOgiTZXOm9s5V3+paDyCWoAG7al6Ew9mGlTu2Ebk6gHQ4iYBTWEMKCqzuYpO8NxXwLBBgY1SLxGliBMNSKckTD7kngEGCdXFcNnmyFRCwMRbBBbwxO2JaoBa4A8z5OxFOSVr1LPG50nXc2DNkZTJ2oap5nvDCc8Lr0XyfNUFuwXxOalFDtNWcHHUyINZC/y1felDEYlWdt9UiWNFrJKXnAg3xxyV8Ei5VOzwdRTniQFuWGXeF1scwXSRX577Z7Ao5YvYSJgyHfxbd6BMVDWE367U18J3D5d5obFzcyDu9nNUBLtPX81GHwK4TxLA== 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=KFkeNWaloLfm/FFUtgIxcGLSCx3AksyF3NqOoW9+oyY=; b=f2q86iFCcM7ISYyNUDlRYL6bu2NJdIIyZDSoYf+DCC8XQHkVc9uXRISoUSB8aKQQTwGWwlM4NKbRY18nISBMLupIO4aOI/Geb6IidGki5bv6keeHLvCT45nF9PY1DdhjtZwEbYNktChMk3iNwwZewrxuiel3QSRjt2oq6owKo8tRx75HbpjWPW0QcVSqzL/sKrchBppqXre6bQkM1xfzt1yrZgpllRHLV2dX99ai6liVXQAAL7e1gCJ13pExMAz7ULrriqyeTav1TIXniD3m64XJ70JcSuu9rhOwvE1o0XBlgFEVlxbQJRwIVvwWqRReqBwDZ1Vpq2ZOlxAKJHeD0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KFkeNWaloLfm/FFUtgIxcGLSCx3AksyF3NqOoW9+oyY=; b=BzG3UY9wUC5cwMgY24PpUdL4PGjYm/5HkMOsl1U7SXv/GabD3da3nmcx9+g0JwMk1NTvw/9P6He8th8RAAr3SQybus6nVK4WKF77qHib3P5jdwGfj/7w9oCPbt/so9qOTM2SBPLUpS/uD5DotOjocaB1f5iAuG+tf62spJu/6Jg= Received: from AS8PR08MB7718.eurprd08.prod.outlook.com (2603:10a6:20b:50a::22) by DB3PR08MB9112.eurprd08.prod.outlook.com (2603:10a6:10:43c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.33; Thu, 30 Mar 2023 09:31:31 +0000 Received: from AS8PR08MB7718.eurprd08.prod.outlook.com ([fe80::95ea:4c82:b97f:5ff6]) by AS8PR08MB7718.eurprd08.prod.outlook.com ([fe80::95ea:4c82:b97f:5ff6%3]) with mapi id 15.20.6222.035; Thu, 30 Mar 2023 09:31:29 +0000 From: Feifei Wang To: =?iso-8859-1?Q?Morten_Br=F8rup?= , "thomas@monjalon.net" , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" , "konstantin.v.ananyev@yandex.ru" , nd , Honnappa Nagarahalli , Ruifeng Wang , nd Subject: RE: [PATCH v5 1/3] ethdev: add API for buffer recycle mode Thread-Topic: [PATCH v5 1/3] ethdev: add API for buffer recycle mode Thread-Index: AQHZYtEPO3yD/9FA0E+nLV0H3CV5M68S6kqAgAAXoRA= Date: Thu, 30 Mar 2023 09:31:29 +0000 Message-ID: References: <20211224164613.32569-1-feifei.wang2@arm.com> <20230330062939.1206267-1-feifei.wang2@arm.com> <20230330062939.1206267-2-feifei.wang2@arm.com> <98CBD80474FA8B44BF855DF32C47DC35D8781F@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D8781F@smartserver.smartshare.dk> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 886388BFDDA6754C9B36EFA13888A18F.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: AS8PR08MB7718:EE_|DB3PR08MB9112:EE_|DBAEUR03FT036:EE_|GV2PR08MB9399:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ff83286-932b-4447-624e-08db31019524 x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: /ws1LlmGjWovGFNrnp4ZtCZY7ABTwN7DDj33o3714a5JIh9E09AG+ET5WcBtzEwGid5sSUaBjh9MT4GwcROk/gU0AARBM81tnuEo25hW1NUnSKy1QpR/yCUjp5qVIaIbYSzca/bumEdAWrU+M6XKMrO2CjdzC8ibqNxVrvqARluMIyWrQgHVhxy9RdfIGQlJ1MKKcf4B+LErALBTJYv+mrdxs9FfGW8PLO0O/5pCuJK4V1URQrLGMuHJT4AoZ3BshVv1ImgbkHRLmRVSelOP0+nMNTA4HyQiNyErPqDw3xyzMIAQpb7yqj5jTt8vk6xRHnaU4OKsuic4v6cwp/fnFZeIRoM8eoXn3tID13vN0pnI0mYxbiKX4rgTYPDLMgPumPIm5ECoMDIJZquTj7LvYI5gh0MrrMvRXBuDNJiQnHebsJXhWlQPn8POB+eggURpFvlOJGy0ux1aBm4QEy97DL+vo1Y52RtNlLQb1FvJ5UY6bmHb/IyMA9Uml3hJRdD5n40GcikBFSVUGvQcSHkKIGN1a6HLhMNkKbqeit3aij8tQEgOfPd/C9S05ZkMWAPMB2n2tOSSy9oDVJ7KHJ0kOX5EWh+z1ZSabBuYqmhrvv0BYH5/ihpTK3wB5SpUc1EOhEUdSdafnSUp+Rq5ZzBHCg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7718.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(396003)(376002)(39860400002)(366004)(136003)(451199021)(5660300002)(122000001)(316002)(52536014)(38100700002)(8936002)(54906003)(110136005)(41300700001)(86362001)(4326008)(64756008)(66446008)(8676002)(66476007)(76116006)(66556008)(30864003)(71200400001)(66946007)(2906002)(83380400001)(38070700005)(7696005)(9686003)(55016003)(26005)(66574015)(6506007)(186003)(33656002)(53546011)(478600001)(23180200003); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR08MB9112 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4ba5196b-a376-4f08-6669-08db31018ac4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fEB9pCb3MryfyQ27Rs7LBqzlB12lSxb0I3mKqTkDgj+0E7F0GfR+lTCEektAqsbsTALs86F5bq5HBNOLPnKwOtFquVN2Rg7Me8400q600B6Z8B/43Sdk03wueXqVI7WM2Egel+mYq8aewkgRnWOBwnyaWal/GSmkTlwrQux9uochcwQM2vgays6orj02GbKpUBrjgRRgCh9q+F3O8hEdNyHpOB/Cn56X/E3m5KhfrFszlSpO95/W3sfXigBbo1502nQt05vhXmwUeXgwPj9P6ID73MgOj41/Qh2N8wm0BEpSXX1P2sRyN0qXjxmF30PPwO/v01SKca6Cg6sGgzrIAZESfgyCP3jjr2AaZvXso5ZuvWVMcSjIk81MAHTwTlIQK5VJaCcrgxoLDiRLqSP3+pYUV0ijQzJkkpWLZXs9P7ZrxR977/q4o+KQd7cXzDqi8Sn7iquJxdZyo89WuVeZqC5fCKCrE3hV8gLJpb0U8lQ6VntdAggAAhGjGjPYdg7JwDnBIrUHt1LJSXy0ru0CG6t315foYRTlC+8zqO7NzzBCJk2V6JGBsySH273JD9A2h+Y+RdpY5tGOiX1L6B9C/UClGMW013G/T6GNgBbIaVYITKH6nlCLJuz4hjUWp3xjs456Gpwsb60PK+/barVL5r+RB17CuM4kU93uN+yEmgj6MITpxN7kRdNjXM5tkOfkeVeBlm2nXKg5nXzLzOjagP5gu9t/mU+u4dv/pcUWUwg= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(376002)(396003)(346002)(451199021)(36840700001)(40470700004)(46966006)(82310400005)(81166007)(356005)(186003)(40460700003)(70586007)(40480700001)(70206006)(33656002)(316002)(2906002)(30864003)(7696005)(110136005)(54906003)(478600001)(9686003)(66574015)(47076005)(82740400003)(83380400001)(4326008)(26005)(336012)(53546011)(6506007)(86362001)(55016003)(41300700001)(8676002)(36860700001)(8936002)(5660300002)(52536014)(23180200003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 09:31:46.9818 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ff83286-932b-4447-624e-08db31019524 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB9399 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: Morten Br=F8rup > Sent: Thursday, March 30, 2023 3:19 PM > To: Feifei Wang ; thomas@monjalon.net; Ferruh > Yigit ; Andrew Rybchenko > > Cc: dev@dpdk.org; konstantin.v.ananyev@yandex.ru; nd ; > Honnappa Nagarahalli ; Ruifeng Wang > > Subject: RE: [PATCH v5 1/3] ethdev: add API for buffer recycle mode >=20 > > From: Feifei Wang [mailto:feifei.wang2@arm.com] > > Sent: Thursday, 30 March 2023 08.30 > > >=20 > [...] >=20 > > +/** > > + * @internal > > + * Rx routine for rte_eth_dev_buf_recycle(). > > + * Refill Rx descriptors in buffer recycle mode. > > + * > > + * @note > > + * This API can only be called by rte_eth_dev_buf_recycle(). > > + * Before calling this API, rte_eth_tx_buf_stash() should be > > + * called to stash Tx used buffers into Rx buffer ring. > > + * > > + * When this functionality is not implemented in the driver, the > > +return > > + * buffer number is 0. > > + * > > + * @param port_id > > + * The port identifier of the Ethernet device. > > + * @param queue_id > > + * The index of the receive queue. > > + * The value must be in the range [0, nb_rx_queue - 1] previously > supplied > > + * to rte_eth_dev_configure(). > > + *@param nb > > + * The number of Rx descriptors to be refilled. > > + * @return > > + * The number Rx descriptors correct to be refilled. > > + * - ENODEV: bad port or queue (only if compiled with debug). >=20 > If you want errors reported by the return value, the function return type > cannot be uint16_t. Agree. Actually, in the code path, if errors happen, the function will retu= rn 0. For this description line, I refer to 'rte_eth_tx_prepare' notes. Maybe we = should delete this line. >=20 > > + */ > > +static inline uint16_t rte_eth_rx_descriptors_refill(uint16_t port_id, > > + uint16_t queue_id, uint16_t nb) > > +{ > > + struct rte_eth_fp_ops *p; > > + void *qd; > > + > > +#ifdef RTE_ETHDEV_DEBUG_RX > > + if (port_id >=3D RTE_MAX_ETHPORTS || > > + queue_id >=3D RTE_MAX_QUEUES_PER_PORT) { > > + RTE_ETHDEV_LOG(ERR, > > + "Invalid port_id=3D%u or queue_id=3D%u\n", > > + port_id, queue_id); > > + rte_errno =3D ENODEV; > > + return 0; >=20 > If p->rx_descriptors_refill() is likely to return 0, this function should= not use 0 > as return value to indicate errors. However, refer to dpdk code style in ethdev, most of API write like this. For example, 'rte_eth_rx/tx_burst', 'rte_eth_tx_prep'.=20 I'm also confused what's return type for this due to I want to indicate errors and show the processed buffer number. >=20 > > + } > > +#endif > > + > > + p =3D &rte_eth_fp_ops[port_id]; > > + qd =3D p->rxq.data[queue_id]; > > + > > +#ifdef RTE_ETHDEV_DEBUG_RX > > + if (!rte_eth_dev_is_valid_port(port_id)) { > > + RTE_ETHDEV_LOG(ERR, "Invalid Rx port_id=3D%u\n", port_id); > > + rte_errno =3D ENODEV; > > + return 0; > > + > > + if (qd =3D=3D NULL) { > > + RTE_ETHDEV_LOG(ERR, "Invalid Rx queue_id=3D%u for > port_id=3D%u\n", > > + queue_id, port_id); > > + rte_errno =3D ENODEV; > > + return 0; > > + } > > +#endif > > + > > + if (p->rx_descriptors_refill =3D=3D NULL) > > + return 0; > > + > > + return p->rx_descriptors_refill(qd, nb); } > > + > > /**@{@name Rx hardware descriptor states > > * @see rte_eth_rx_descriptor_status > > */ > > @@ -6483,6 +6597,122 @@ rte_eth_tx_buffer(uint16_t port_id, uint16_t > queue_id, > > return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); } > > > > +/** > > + * @internal > > + * Tx routine for rte_eth_dev_buf_recycle(). > > + * Stash Tx used buffers into Rx buffer ring in buffer recycle mode. > > + * > > + * @note > > + * This API can only be called by rte_eth_dev_buf_recycle(). > > + * After calling this API, rte_eth_rx_descriptors_refill() should be > > + * called to refill Rx ring descriptors. > > + * > > + * When this functionality is not implemented in the driver, the > > +return > > + * buffer number is 0. > > + * > > + * @param port_id > > + * The port identifier of the Ethernet device. > > + * @param queue_id > > + * The index of the transmit queue. > > + * The value must be in the range [0, nb_tx_queue - 1] previously > supplied > > + * to rte_eth_dev_configure(). > > + * @param rxq_buf_recycle_info > > + * A pointer to a structure of Rx queue buffer ring information in b= uffer > > + * recycle mode. > > + * > > + * @return > > + * The number buffers correct to be filled in the Rx buffer ring. > > + * - ENODEV: bad port or queue (only if compiled with debug). >=20 > If you want errors reported by the return value, the function return type > cannot be uint16_t. >=20 > > + */ > > +static inline uint16_t rte_eth_tx_buf_stash(uint16_t port_id, > > +uint16_t > > queue_id, > > + struct rte_eth_rxq_buf_recycle_info *rxq_buf_recycle_info) > { > > + struct rte_eth_fp_ops *p; > > + void *qd; > > + > > +#ifdef RTE_ETHDEV_DEBUG_TX > > + if (port_id >=3D RTE_MAX_ETHPORTS || > > + queue_id >=3D RTE_MAX_QUEUES_PER_PORT) { > > + RTE_ETHDEV_LOG(ERR, > > + "Invalid port_id=3D%u or queue_id=3D%u\n", > > + port_id, queue_id); > > + rte_errno =3D ENODEV; > > + return 0; >=20 > If p->tx_buf_stash() is likely to return 0, this function should not use = 0 as > return value to indicate errors. >=20 > > + } > > +#endif > > + > > + p =3D &rte_eth_fp_ops[port_id]; > > + qd =3D p->txq.data[queue_id]; > > + > > +#ifdef RTE_ETHDEV_DEBUG_TX > > + if (!rte_eth_dev_is_valid_port(port_id)) { > > + RTE_ETHDEV_LOG(ERR, "Invalid Tx port_id=3D%u\n", port_id); > > + rte_errno =3D ENODEV; > > + return 0; > > + > > + if (qd =3D=3D NULL) { > > + RTE_ETHDEV_LOG(ERR, "Invalid Tx queue_id=3D%u for > port_id=3D%u\n", > > + queue_id, port_id); > > + rte_erno =3D ENODEV; > > + return 0; > > + } > > +#endif > > + > > + if (p->tx_buf_stash =3D=3D NULL) > > + return 0; > > + > > + return p->tx_buf_stash(qd, rxq_buf_recycle_info); } > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change, or be removed, without prior > > +notice > > + * > > + * Buffer recycle mode can let Tx queue directly put used buffers > > +into Rx > > buffer > > + * ring. This avoids freeing buffers into mempool and allocating > > + buffers from > > + * mempool. >=20 > This function description generally describes the buffer recycle mode. >=20 > Please update it to describe what this specific function does. Ack. >=20 > > + * > > + * @param rx_port_id > > + * Port identifying the receive side. > > + * @param rx_queue_id > > + * The index of the receive queue identifying the receive side. > > + * The value must be in the range [0, nb_rx_queue - 1] previously > supplied > > + * to rte_eth_dev_configure(). > > + * @param tx_port_id > > + * Port identifying the transmit side. > > + * @param tx_queue_id > > + * The index of the transmit queue identifying the transmit side. > > + * The value must be in the range [0, nb_tx_queue - 1] previously > supplied > > + * to rte_eth_dev_configure(). > > + * @param rxq_recycle_info > > + * A pointer to a structure of type *rte_eth_txq_rearm_data* to be f= illed. > > + * @return > > + * - (0) on success or no recycling buffer. >=20 > Why not return the return value of rte_eth_rx_descriptors_refill() instea= d of > 0 on success? (This is a question, not a suggestion.) >=20 > Or, if rxq_buf_recycle_info must be valid, the function return type could= be > void instead of int. >=20 In some time, users may forget to allocate the room for ' rxq_buf_recycle_i= nfo ' and call 'rte_rxq_buf_recycle_info_get' API. Thus, I think we need to check= with this. Furthermore, the return value of this API should return success or not. > > + * - (-EINVAL) rxq_recycle_info is NULL. > > + */ > > +__rte_experimental > > +static inline int > > +rte_eth_dev_buf_recycle(uint16_t rx_port_id, uint16_t rx_queue_id, > > + uint16_t tx_port_id, uint16_t tx_queue_id, > > + struct rte_eth_rxq_buf_recycle_info *rxq_buf_recycle_info) > { > > + /* The number of recycling buffers. */ > > + uint16_t nb_buf; > > + > > + if (!rxq_buf_recycle_info) > > + return -EINVAL; >=20 > This is a fast path function. In which situation is this function called = with > rxq_buf_recycle_info =3D=3D NULL? >=20 > If this function can genuinely be called with rxq_buf_recycle_info =3D=3D= NULL, > you should test for (rxq_buf_recycle_info =3D=3D NULL), not (! > rxq_buf_recycle_info). Otherwise, I think > RTE_ASSERT(rxq_buf_recycle_info !=3D NULL) is more appropriate. Agree. We should use ' RTE_ASSERT(rxq_buf_recycle_info !=3D NULL)'. >=20 > > + > > + /* Stash Tx used buffers into Rx buffer ring */ > > + nb_buf =3D rte_eth_tx_buf_stash(tx_port_id, tx_queue_id, > > + rxq_buf_recycle_info); > > + /* If there are recycling buffers, refill Rx queue descriptors. */ > > + if (nb_buf) > > + rte_eth_rx_descriptors_refill(rx_port_id, rx_queue_id, > > + nb_buf); > > + > > + return 0; > > +} > > + > > /** > > * @warning > > * @b EXPERIMENTAL: this API may change without prior notice diff > > --git a/lib/ethdev/rte_ethdev_core.h b/lib/ethdev/rte_ethdev_core.h > > index dcf8adab92..a138fd4dbc 100644 > > --- a/lib/ethdev/rte_ethdev_core.h > > +++ b/lib/ethdev/rte_ethdev_core.h > > @@ -56,6 +56,13 @@ typedef int (*eth_rx_descriptor_status_t)(void > > *rxq, uint16_t offset); > > /** @internal Check the status of a Tx descriptor */ typedef int > > (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset); > > > > +/** @internal Stash Tx used buffers into RX ring in buffer recycle > > +mode */ typedef uint16_t (*eth_tx_buf_stash_t)(void *txq, > > + struct rte_eth_rxq_buf_recycle_info *rxq_buf_recycle_info); > > + > > +/** @internal Refill Rx descriptors in buffer recycle mode */ typedef > > +uint16_t (*eth_rx_descriptors_refill_t)(void *rxq, uint16_t nb); >=20 > Please add proper function descriptions for the two callbacks above. Ack. >=20 > > + > > /** > > * @internal > > * Structure used to hold opaque pointers to internal ethdev Rx/Tx @@ > > -90,9 +97,11 @@ struct rte_eth_fp_ops { > > eth_rx_queue_count_t rx_queue_count; > > /** Check the status of a Rx descriptor. */ > > eth_rx_descriptor_status_t rx_descriptor_status; > > + /** Refill Rx descriptors in buffer recycle mode */ > > + eth_rx_descriptors_refill_t rx_descriptors_refill; > > /** Rx queues data. */ > > struct rte_ethdev_qdata rxq; > > - uintptr_t reserved1[3]; > > + uintptr_t reserved1[4]; >=20 > You added a function pointer above, so to keep the structure alignment, y= ou > must remove one here, not add one: >=20 > - uintptr_t reserved1[3]; > + uintptr_t reserved1[2]; >=20 Ack. > > /**@}*/ > > > > /**@{*/ > > @@ -106,9 +115,11 @@ struct rte_eth_fp_ops { > > eth_tx_prep_t tx_pkt_prepare; > > /** Check the status of a Tx descriptor. */ > > eth_tx_descriptor_status_t tx_descriptor_status; > > + /** Stash Tx used buffers into RX ring in buffer recycle mode */ > > + eth_tx_buf_stash_t tx_buf_stash; > > /** Tx queues data. */ > > struct rte_ethdev_qdata txq; > > - uintptr_t reserved2[3]; > > + uintptr_t reserved2[4]; >=20 > You added a function pointer above, so to keep the structure alignment, y= ou > must remove one here, not add one: >=20 > - uintptr_t reserved1[3]; > + uintptr_t reserved1[2]; >=20 Ack. > > /**@}*/ > > > > } __rte_cache_aligned;