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 E9F234298A; Wed, 19 Apr 2023 16:47:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 294B942B8E; Wed, 19 Apr 2023 16:47:36 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2056.outbound.protection.outlook.com [40.107.220.56]) by mails.dpdk.org (Postfix) with ESMTP id 2DBE040A79 for ; Wed, 19 Apr 2023 16:47:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SaflGG64al/EDpEtv3ntAVeWYk4KHOeTXt7fhBzCaB7X+ktaH6qy2T5H5NL6NcWbVS9g50IAB6ASk4olIhtGXtNiapVjeLi7flG3wh+02c0gJfEMz/1sNHS3yoyaqp2wEgvQ09eETlo3ZO7D01+hFRtk0/XCaNexkbEgrz1RJaI8UaVjmeh8k1Pn0YNxmyjuSXdhH8ajoxb9jVs/pHqojsDG6RKdXclaSoOuZy8oFoOnQODKHD/lKlE94x9Bst+Pablc6FcEhabNcUqy5lnQGUx8gPmR1Qv6wi0/sJPt3z9ucEMisS9ANY9HZ6YgFAiN8BRDS18Tb4+gOGeJARQnXg== 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=fKGkqWMo4OjryK8NGUFUb6aApN93g9sJTQLsukUJdS0=; b=LbHz0JVdGArAXQqmAkhjQiba2d9d3+A2P944G074iQp7BUDtYRwr6hu6tFaFuU3Ogul5cSuGm7XA7BOTI0k4BWSSCTLvpH0Z7xNWBuwlK3DtV04Fovjhg4LUgYleGaMiiQjVcItjVDrYiIeaOE4BTmsd+jin4XvDl0fpit2/fj1OhUmthajlHMYC7LH7OJIjGlYJflOZScFQNgdh/8TvZZoxOQTmEEWc0GHt6Mg7NamdOCS5apcBG/n14Otc3zvTIbNOM+wRGQTukiU3BVEwwEYh47yTCUjGb7EK+WBAyzUQHoZdJFVJGCKVCuqJmBIEYp7X73kj6PUbjMQJQg1Atg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fKGkqWMo4OjryK8NGUFUb6aApN93g9sJTQLsukUJdS0=; b=eZ3ZBhOP+vZbrIjqpjcJ5ZIdGUwalFVcrkNmN/4o2HgeaOszlAjuNyCGoWqtzivOwdAC2d7a9jCamBjyz0KQ553dJcdJqeBVmPgiVRsAcbXRTmHTciDbKXlhne7oFh5g1A7fRUXvJx9sm87fTIB74BzPBwQXBEvmNCKWtDPFH2Q= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by MW4PR12MB7357.namprd12.prod.outlook.com (2603:10b6:303:219::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Wed, 19 Apr 2023 14:47:32 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::5e2c:c0ed:88a6:a4c7]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::5e2c:c0ed:88a6:a4c7%7]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 14:47:32 +0000 Message-ID: <4cff56ab-e6b7-e378-151f-b0a821ec6a4a@amd.com> Date: Wed, 19 Apr 2023 15:46:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US To: Feifei Wang , Thomas Monjalon , Andrew Rybchenko Cc: dev@dpdk.org, konstantin.v.ananyev@yandex.ru, mb@smartsharesystems.com, nd@arm.com, Honnappa Nagarahalli , Ruifeng Wang References: <20211224164613.32569-1-feifei.wang2@arm.com> <20230330062939.1206267-1-feifei.wang2@arm.com> <20230330062939.1206267-2-feifei.wang2@arm.com> From: Ferruh Yigit Subject: Re: [PATCH v5 1/3] ethdev: add API for buffer recycle mode In-Reply-To: <20230330062939.1206267-2-feifei.wang2@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0068.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::19) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|MW4PR12MB7357:EE_ X-MS-Office365-Filtering-Correlation-Id: ef2ea244-f983-4966-545a-08db40e500d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ra31GBOPsMqP2lzJcxYMx/USXG4ElooBtyjC7lWkaIwh0ahjmFUr+2RWn90ELE5zi5ccIYMufqDOb1iiEeqSwqq709O34jF/TDahPeGU2o+hPtCljAyVWpyXnDlbHV3Hm1B39yRlLoCr9bs9tUJwYbNeoADcZeQ7wQKLEGPTP3kVBGfCT1s4ktKjA+lm5nYjukmrPbu+vsj+3mJPSy7tIY1IkWF8khCvY4PpWU2ZbEvrEqVMpg6VfTxv21FBQTreVGjRdS22oEm5KnPHsPw3z2E7vSnBw5vMYmUW3xCtE3cSfwgvysaGaeR1MEu0UYFyJMTMMAkNGxbul8b21+tc7oL16eIS73WT2fJYkvGKIx+ecDeDLR3Jb6SnTHx3IMoqyAXxV86uv32L3ZzBwjvxpSsS7E8lmmsRPe65h6etij7gAlF9TVO3/el29lKXG9oru0BjA8K3UwbP3kJjwy3BsQ4Qzl6/24RX59kNogAQrq0WBpvqvEKAzEk88B9/AT0yVirX2rIRa/pnHUsWDUZXFtwiLmRC3aZMruqvZrehH8GqiVd3EiwM5h5pTZkb9JvBlLGUnwg4/C1A+hdKAoxk4CBl+V3M/oDMEWpuJFPuQkRJ1YLFR63+oQ9fAUVpIVnaclY+k/f0xVvwV5rc+ITrJA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(346002)(376002)(396003)(366004)(451199021)(8936002)(38100700002)(36756003)(8676002)(44832011)(2906002)(86362001)(31696002)(5660300002)(478600001)(6486002)(6666004)(54906003)(110136005)(31686004)(186003)(2616005)(6506007)(53546011)(66946007)(66476007)(6512007)(26005)(316002)(83380400001)(66556008)(41300700001)(4326008)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OEYweWxKVUt3U2dhaUZEc0dsd05ZMDhSQnk1R3Fpc1NHVG1BZnRFb21Vdmo5?= =?utf-8?B?RVZZeTFpWE8vYzgwVytxMEUySTB3ZHpidXhsUC9uTzBySXhXQUZlSjNST1pX?= =?utf-8?B?MVNCNWNGVEZZZmFKcFpMQjZyRnFEeXRjaFQvS0NqRDJZeWVidkVVZW1vSkVr?= =?utf-8?B?aXgrTVYvV1hvaXRwWHhnaHFmci9saFhnd1NsQ0pCRjh1YXVESlVIY2NQbjJj?= =?utf-8?B?d2NMZUhPOGd6SnFBOFhReWY5ci8ycVNrN09QMkZaVkhlM3FMZWJ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kErNGJ4WXJjRWRZbks5?= =?utf-8?Q?Q5+GbGttEwXdCe9F+y8jOmSK6?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef2ea244-f983-4966-545a-08db40e500d8 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 14:47:31.1109 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qSwWTm1Fipz1juiVJBzz5eCegx4ZmGREYD8Jc90OqNGLK+lxCqahLBqFjEZaQUth X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7357 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 On 3/30/2023 7:29 AM, Feifei Wang wrote: > There are 4 upper APIs for buffer recycle mode: > 1. 'rte_eth_rx_queue_buf_recycle_info_get' > This is to retrieve buffer ring information about given ports's Rx > queue in buffer recycle mode. And due to this, buffer recycle can > be no longer limited to the same driver in Rx and Tx. > > 2. 'rte_eth_dev_buf_recycle' > Users can call this API to enable buffer recycle mode in data path. > There are 2 internal APIs in it, which is separately for Rx and TX. > Overall, can we have a namespace in the functions related to the buffer recycle, to clarify API usage, something like (just putting as sample to clarify my point): rte_eth_recycle_buf rte_eth_recycle_tx_buf_stash rte_eth_recycle_rx_descriptors_refill rte_eth_recycle_rx_queue_info_get > 3. 'rte_eth_tx_buf_stash' > Internal API for buffer recycle mode. This is to stash Tx used > buffers into Rx buffer ring. > This API is to move/recycle descriptors from Tx queue to Rx queue, but name on its own, 'rte_eth_tx_buf_stash', reads like we are stashing something to Tx queue. What do you think, can naming be improved? > 4. 'rte_eth_rx_descriptors_refill' > Internal API for buffer recycle mode. This is to refill Rx > descriptors. > > Above all APIs are just implemented at the upper level. > For different APIs, we need to define specific functions separately. > > Suggested-by: Honnappa Nagarahalli > Suggested-by: Ruifeng Wang > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang > Reviewed-by: Honnappa Nagarahalli <...> > > +int > +rte_eth_rx_queue_buf_recycle_info_get(uint16_t port_id, uint16_t queue_id, > + struct rte_eth_rxq_buf_recycle_info *rxq_buf_recycle_info) > +{ > + struct rte_eth_dev *dev; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + dev = &rte_eth_devices[port_id]; > + > + if (queue_id >= dev->data->nb_rx_queues) { > + RTE_ETHDEV_LOG(ERR, "Invalid Rx queue_id=%u\n", queue_id); > + return -EINVAL; > + } > + > + RTE_ASSERT(rxq_buf_recycle_info != NULL); > + This is slow path API, I think better to validate parameter and return an error instead of assert(). <...> > --- 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); > + Since there is only single API exposed to the application, is it really required to have two dev_ops, why not have a single one?