DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: "Morten Brørup" <mb@smartsharesystems.com>,
	skori@marvell.com,
	"Shepard Siegel" <shepard.siegel@atomicrules.com>,
	"Ed Czeck" <ed.czeck@atomicrules.com>,
	"John Miller" <john.miller@atomicrules.com>,
	"Igor Russkikh" <irusskikh@marvell.com>,
	"Ajit Khaparde" <ajit.khaparde@broadcom.com>,
	"Somnath Kotur" <somnath.kotur@broadcom.com>,
	"Nithin Dabilpuram" <ndabilpuram@marvell.com>,
	"Kiran Kumar K" <kirankumark@marvell.com>,
	"Satha Rao" <skoteshwar@marvell.com>,
	"Harman Kalra" <hkalra@marvell.com>,
	"Hemant Agrawal" <hemant.agrawal@nxp.com>,
	"Sachin Saxena" <sachin.saxena@nxp.com>,
	"John Daley" <johndale@cisco.com>,
	"Hyong Youb Kim" <hyonkim@cisco.com>,
	"Jie Hai" <haijie1@huawei.com>,
	"Ian Stokes" <ian.stokes@intel.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>,
	"Vladimir Medvedkin" <vladimir.medvedkin@intel.com>,
	"Anatoly Burakov" <anatoly.burakov@intel.com>,
	"Dariusz Sosnowski" <dsosnowski@nvidia.com>,
	"Viacheslav Ovsiienko" <viacheslavo@nvidia.com>,
	"Bing Zhao" <bingz@nvidia.com>, "Ori Kam" <orika@nvidia.com>,
	"Suanming Mou" <suanmingm@nvidia.com>,
	"Matan Azrad" <matan@nvidia.com>,
	"Long Li" <longli@microsoft.com>, "Wei Hu" <weh@microsoft.com>,
	"Chaoyong He" <chaoyong.he@corigine.com>,
	"Jiawen Wu" <jiawenwu@trustnetic.com>,
	"Jerin Jacob" <jerinj@marvell.com>,
	"Maciej Czekaj" <mczekaj@marvell.com>,
	"Jian Wang" <jianwang@trustnetic.com>,
	"Maxime Coquelin" <maxime.coquelin@redhat.com>,
	"Chenbo Xia" <chenbox@nvidia.com>,
	"Jochen Behrens" <jochen.behrens@broadcom.com>,
	"Thomas Monjalon" <thomas@monjalon.net>,
	"Ferruh Yigit" <ferruh.yigit@amd.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH v2 1/2] ethdev: remove unnecessary type conversion
Date: Sat, 26 Jul 2025 11:44:47 +0300	[thread overview]
Message-ID: <48140af2-6d63-466e-9c54-22f241b86246@oktetlabs.ru> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9FC46@smartserver.smartshare.dk>

On 5/12/25 19:04, Morten Brørup wrote:
>> From: Sunil Kumar Kori <skori@marvell.com>
>> Sent: Monday, 12 May 2025 17.07
>>
>> As rte_eth_rx_queue_count() returns signed value to represent
>> the error cases but internally invoked callback is returning
>> unsigned value. Hence unnecessary type conversion is done.
>>
>> To avoid this typecasting from signed to unsigned, fixed
>> return type of callback functions.
>>
>> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
> 
> Note for other reviewers:
> The tx_queue_count callback already returns int, and doesn't need to be updated.
> 
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> 
>> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
>> index ea7f8c4a1a..b3031ab9e6 100644
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> @@ -6401,7 +6401,7 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t
>> queue_id)
>>
>>   	if (p->rx_queue_count == NULL)
>>   		return -ENOTSUP;
>> -	return (int)p->rx_queue_count(qd);
>> +	return p->rx_queue_count(qd);
>>   }
>>
>>   /**@{@name Rx hardware descriptor states
>> diff --git a/lib/ethdev/rte_ethdev_core.h
>> b/lib/ethdev/rte_ethdev_core.h
>> index e55fb42996..4ffae4921a 100644
>> --- a/lib/ethdev/rte_ethdev_core.h
>> +++ b/lib/ethdev/rte_ethdev_core.h
>> @@ -45,7 +45,7 @@ typedef uint16_t (*eth_tx_prep_t)(void *txq,
>>
>>
>>   /** @internal Get number of used descriptors on a receive queue. */
>> -typedef uint32_t (*eth_rx_queue_count_t)(void *rxq);
>> +typedef int (*eth_rx_queue_count_t)(void *rxq);
>>
>>   /** @internal Check the status of a Rx descriptor */
>>   typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
>> --
>> 2.43.0
> 
> For the ethdev library changes:
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> 

IMHO API consistency vs Tx is more important here. Moreover, since it
helps to avoid weird type casts in the next patch, it proves that it is
a step in a right direction. Basically I see no point to keep the
difference in return value of ethdev API and driver callback, it does
not add value. If driver callback always successful it can simply always
return non-negative values - that's it.

Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

  reply	other threads:[~2025-07-26  8:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 18:11 [PATCH] ethdev: remove callback checks from fast path skori
2025-04-29 23:55 ` Stephen Hemminger
2025-04-29 23:59 ` Stephen Hemminger
2025-04-30  7:26 ` Morten Brørup
2025-05-12 15:07 ` [PATCH v2 1/2] ethdev: remove unnecessary type conversion skori
2025-05-12 15:07   ` [PATCH v2 2/2] ethdev: remove callback checks from fast path skori
2025-05-12 16:12     ` Morten Brørup
2025-05-28  9:35     ` Morten Brørup
2025-06-10  5:11       ` Sunil Kumar Kori
2025-06-16  8:36         ` Sunil Kumar Kori
2025-06-16 14:30           ` Morten Brørup
2025-07-26  9:09             ` Andrew Rybchenko
2025-07-26  9:15     ` Andrew Rybchenko
2025-05-12 16:04   ` [PATCH v2 1/2] ethdev: remove unnecessary type conversion Morten Brørup
2025-07-26  8:44     ` Andrew Rybchenko [this message]
2025-05-27 15:07   ` Stephen Hemminger
2025-05-27 16:24     ` Morten Brørup
2025-05-28  8:17       ` Konstantin Ananyev
2025-05-28  8:23         ` Konstantin Ananyev
2025-05-28  8:48           ` Morten Brørup
2025-05-28  9:14             ` Konstantin Ananyev
2025-05-28  9:39               ` Morten Brørup
2025-05-26 12:30 ` [EXTERNAL] [PATCH] ethdev: remove callback checks from fast path Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48140af2-6d63-466e-9c54-22f241b86246@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=ajit.khaparde@broadcom.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bingz@nvidia.com \
    --cc=bruce.richardson@intel.com \
    --cc=chaoyong.he@corigine.com \
    --cc=chenbox@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=ed.czeck@atomicrules.com \
    --cc=ferruh.yigit@amd.com \
    --cc=haijie1@huawei.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=hkalra@marvell.com \
    --cc=hyonkim@cisco.com \
    --cc=ian.stokes@intel.com \
    --cc=irusskikh@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=jianwang@trustnetic.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=jochen.behrens@broadcom.com \
    --cc=john.miller@atomicrules.com \
    --cc=johndale@cisco.com \
    --cc=kirankumark@marvell.com \
    --cc=longli@microsoft.com \
    --cc=matan@nvidia.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mb@smartsharesystems.com \
    --cc=mczekaj@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=orika@nvidia.com \
    --cc=sachin.saxena@nxp.com \
    --cc=shepard.siegel@atomicrules.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    --cc=vladimir.medvedkin@intel.com \
    --cc=weh@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).