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 585BE438F2; Thu, 18 Jan 2024 12:21:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C78DB40DF5; Thu, 18 Jan 2024 12:21:53 +0100 (CET) Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by mails.dpdk.org (Postfix) with ESMTP id 88202402B5 for ; Thu, 18 Jan 2024 12:21:52 +0100 (CET) Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-429fc7a1eacso26074691cf.2 for ; Thu, 18 Jan 2024 03:21:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705576912; x=1706181712; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pLa3cC711GMZnYpCosCeeqeOKPOq9j8PXXCB/REAR3E=; b=WrPDrp3S/JqCgMgl3Gubq+JIkiLfo9PIgkcxnsn6CmegsMJsVzE1FoZihBU+wqv8GU 4I8+QxCU9kiPhJ83vhwy/7C4wrcvZUPep5UvGwElbBlZH8SAuL3V7xqY/2aTisGVXFLk Rb/6vGkzLlzzThizk+rJFzGfk6yUJPMFM1+ziNDi+ydr+aglZQncSlygHoUXH6kVJBsj v8LE1mSMXGe2tbBbLiD+nnlqEHBfTwPYdvYRJ2150wubtJx1PSqtOW8KjlVtrwZK0hLQ j3uBGbhT9y2u8xMlkIe88nD+A7RgmyguFkeZI4eE+EjXqH2KtibTB9srdR4gFXXUss77 1sDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705576912; x=1706181712; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pLa3cC711GMZnYpCosCeeqeOKPOq9j8PXXCB/REAR3E=; b=BftSx36ztH/p9pP5tQ9TMN26vAjsRcLiLfDJdVh1WoYVSo01uPJ/EyTpD/xQeuBq5L 33PTawDWJVE61fFvuMLAapI4Vv66j0npgvrvxQuQRew7a++XlS7m59bHOcbqpa92hQOe kW3fbieJM2jaUVyMjz7EOXdYaCJgFhMtMczPxl+rCQAoIrJcf5Blad+q5nbCjFcdfgm6 WhWHpSU+kez4UbjISskaQ2E/y3t2v4IVSMSCBP4yFNbQIVqZsJ9xF0C7vjIB2DNkfXmg EgvZKguIJT2WTskwEdLYbBOK+QXOC2iAuedlUJlNnxqoAuRQifZN51bJONQNZA2NcWms 0QhA== X-Gm-Message-State: AOJu0Yx16LJkFEQAepQ8gwYe+HHkQUOIAN0EI9C04lHq93b5JbYJqIFd iGipebEiC7uosuSxpLMnS8DcT6cYr98vHJdJVutCmklh0phLHRTSAFjcV2VbtUaWBaJOJoqSHP7 RANsY5julipZxbIWXP5EgylQhxaE= X-Google-Smtp-Source: AGHT+IEw3vYnutPsiBomsggYBbATGz4jM9+QrEvxOGmdCDUhmDbTveAqyYWo7a0zN+GOiMqVfSmsBZbQNB3kVXZdmTQ= X-Received: by 2002:a05:622a:388:b0:42a:752:ae67 with SMTP id j8-20020a05622a038800b0042a0752ae67mr772759qtx.1.1705576911808; Thu, 18 Jan 2024 03:21:51 -0800 (PST) MIME-Version: 1.0 References: <20231219172948.3909749-1-jerinj@marvell.com> <20240111151745.3800170-1-jerinj@marvell.com> <2f45bf93d17a4ea688fdc23bf6f50027@huawei.com> In-Reply-To: From: Jerin Jacob Date: Thu, 18 Jan 2024 16:51:24 +0530 Message-ID: Subject: Re: [dpdk-dev] [v1] ethdev: support Tx queue used count To: Konstantin Ananyev Cc: "jerinj@marvell.com" , "dev@dpdk.org" , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , "ferruh.yigit@xilinx.com" , "ajit.khaparde@broadcom.com" , "aboyer@pensando.io" , "beilei.xing@intel.com" , "bruce.richardson@intel.com" , "chas3@att.com" , "chenbo.xia@intel.com" , "ciara.loftus@intel.com" , "dsinghrawat@marvell.com" , "ed.czeck@atomicrules.com" , "evgenys@amazon.com" , "grive@u256.net" , "g.singh@nxp.com" , "haiyue.wang@intel.com" , "hkalra@marvell.com" , "heinrich.kuhn@corigine.com" , "hemant.agrawal@nxp.com" , "hyonkim@cisco.com" , "igorch@amazon.com" , "irusskikh@marvell.com" , "jgrajcia@cisco.com" , "jasvinder.singh@intel.com" , "jianwang@trustnetic.com" , "jiawenwu@trustnetic.com" , "jingjing.wu@intel.com" , "johndale@cisco.com" , "john.miller@atomicrules.com" , "linville@tuxdriver.com" , "keith.wiles@intel.com" , "kirankumark@marvell.com" , "lironh@marvell.com" , "longli@microsoft.com" , "mw@semihalf.com" , "spinler@cesnet.cz" , "matan@nvidia.com" , "matt.peters@windriver.com" , "maxime.coquelin@redhat.com" , "mk@semihalf.com" , "humin (Q)" , "pnalla@marvell.com" , "ndabilpuram@marvell.com" , "qiming.yang@intel.com" , "qi.z.zhang@intel.com" , "radhac@marvell.com" , "rahul.lakkireddy@chelsio.com" , "rmody@marvell.com" , "rosen.xu@intel.com" , "sachin.saxena@oss.nxp.com" , "skoteshwar@marvell.com" , "shshaikh@marvell.com" , "shaibran@amazon.com" , "shepard.siegel@atomicrules.com" , "asomalap@amd.com" , "somnath.kotur@broadcom.com" , "sthemmin@microsoft.com" , "steven.webster@windriver.com" , "skori@marvell.com" , "mtetsuyah@gmail.com" , "vburru@marvell.com" , "viacheslavo@nvidia.com" , "xiao.w.wang@intel.com" , "Wangxiaoyun (Cloud)" , "Zhuangyuzeng (Yisen)" , "yongwang@vmware.com" , "Xuanziyang (William)" , "cristian.dumitrescu@intel.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Thu, Jan 18, 2024 at 3:47=E2=80=AFPM Konstantin Ananyev wrote: > > > Hi Jerin, Hi Konstantin, > > > > > Introduce a new API to retrieve the number of used descriptors > > > > in a Tx queue. Applications can leverage this API in the fast path = to > > > > inspect the Tx queue occupancy and take appropriate actions based o= n the > > > > available free descriptors. > > > > > > > > A notable use case could be implementing Random Early Discard (RED) > > > > in software based on Tx queue occupancy. > > > > > > > > Signed-off-by: Jerin Jacob > > > > > > @@ -6803,6 +6803,80 @@ rte_eth_recycle_mbufs(uint16_t rx_port_id, u= int16_t rx_queue_id, > > > > __rte_experimental > > > > int rte_eth_buffer_split_get_supported_hdr_ptypes(uint16_t port_id= , uint32_t *ptypes, int num); > > > > > > > > +/** > > > > + * @warning > > > > + * @b EXPERIMENTAL: this API may change, or be removed, without pr= ior notice > > > > + * > > > > + * Get the number of used descriptors of a Tx queue > > > > + * > > > > + * This function retrieves the number of used descriptors of a tra= nsmit queue. > > > > + * Applications can use this API in the fast path to inspect Tx qu= eue occupancy and take > > > > + * appropriate actions based on the available free descriptors. > > > > + * An example action could be implementing the Random Early Discar= d (RED). > > > > > > Sorry, I probably misunderstood your previous mails, but wouldn't it = be more convenient > > > for user to have rte_eth_tx_queue_free_count(...) as fast-op, and > > > have rte_eth_tx_queue_count(...) { queue_txd_num - rte_eth_tx_queue_= free_count(...);} > > > as a slow-path function in rte_ethdev.c? > > > > The general feedback is to align with the Rx queue API, specifically > > rte_eth_rx_queue_count, > > and it's noted that there is no equivalent rte_eth_rx_queue_free_count. > > > > Given that the free count can be obtained by subtracting the used > > count from queue_txd_num, > > it is considered that either approach is acceptable. > > > > The application configures queue_txd_num with tx_queue_setup(), and > > the application can store that value in its structure. > > This would enable fast-path usage for both base cases (whether the > > application needs information about free or used descriptors) > > with just one API(rte_eth_tx_queue_count()) > > Right now I don't use these functions, but if I think what most people ar= e interested in: > - how many packets you can receive immediately (rx_queue_count) > - how many packets you can transmit immediately (tx_queue_free_count) Yes. That's why initially I kept the free version. It seems like other prominent use cases for _used_ version is for QoS to enable something like in positive logic, if < 98% % used then action Tail drop else if < 60% used then action RED > Sure, I understand that user can store txd_num somewhere and then do sub= traction himself. > Though it means more effort for the user, and the only reason for that, a= s I can see, > is to have RX and TX function naming symmetric. > Which seems much less improtant to me comparing to user convenience. > Anyway, as I stated above, I don't use these functions right now, > so if the majority of users are happy with current approach, I would not = insist :) No strong opinion for me either. Looks like majority users like used versio= n. Let's go with. I am open for changing to free version, if the majority of users like that. > Konstantin >