[v2,1/2] ethdev: remove unnecessary type conversion
Checks
Commit Message
From: Sunil Kumar Kori <skori@marvell.com>
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>
---
drivers/net/ark/ark_ethdev_rx.c | 2 +-
drivers/net/ark/ark_ethdev_rx.h | 2 +-
drivers/net/atlantic/atl_ethdev.h | 2 +-
drivers/net/atlantic/atl_rxtx.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 2 +-
drivers/net/cnxk/cnxk_ethdev.h | 2 +-
drivers/net/cnxk/cnxk_ethdev_ops.c | 2 +-
drivers/net/dpaa/dpaa_ethdev.c | 2 +-
drivers/net/dpaa2/dpaa2_ethdev.c | 2 +-
drivers/net/enic/enic_ethdev.c | 2 +-
drivers/net/hns3/hns3_rxtx.c | 2 +-
drivers/net/hns3/hns3_rxtx.h | 2 +-
drivers/net/intel/e1000/e1000_ethdev.h | 4 ++--
drivers/net/intel/e1000/em_rxtx.c | 2 +-
drivers/net/intel/e1000/igb_rxtx.c | 2 +-
drivers/net/intel/e1000/igc_txrx.c | 2 +-
drivers/net/intel/e1000/igc_txrx.h | 2 +-
drivers/net/intel/fm10k/fm10k.h | 2 +-
drivers/net/intel/fm10k/fm10k_rxtx.c | 2 +-
drivers/net/intel/i40e/i40e_rxtx.c | 2 +-
drivers/net/intel/i40e/i40e_rxtx.h | 2 +-
drivers/net/intel/iavf/iavf_rxtx.c | 2 +-
drivers/net/intel/iavf/iavf_rxtx.h | 2 +-
drivers/net/intel/ice/ice_rxtx.c | 2 +-
drivers/net/intel/ice/ice_rxtx.h | 2 +-
drivers/net/intel/ixgbe/ixgbe_ethdev.h | 2 +-
drivers/net/intel/ixgbe/ixgbe_rxtx.c | 2 +-
drivers/net/mlx5/mlx5_rx.c | 4 ++--
drivers/net/mlx5/mlx5_rx.h | 2 +-
drivers/net/netvsc/hn_rxtx.c | 2 +-
drivers/net/netvsc/hn_var.h | 2 +-
drivers/net/nfp/nfp_rxtx.c | 2 +-
drivers/net/nfp/nfp_rxtx.h | 2 +-
drivers/net/ngbe/ngbe_ethdev.h | 2 +-
drivers/net/ngbe/ngbe_rxtx.c | 2 +-
drivers/net/sfc/sfc_ethdev.c | 2 +-
drivers/net/thunderx/nicvf_rxtx.c | 2 +-
drivers/net/thunderx/nicvf_rxtx.h | 2 +-
drivers/net/txgbe/txgbe_ethdev.h | 2 +-
drivers/net/txgbe/txgbe_rxtx.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +-
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
lib/ethdev/rte_ethdev.h | 2 +-
lib/ethdev/rte_ethdev_core.h | 2 +-
45 files changed, 47 insertions(+), 47 deletions(-)
Comments
> 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>
On Mon, 12 May 2025 20:37:19 +0530
<skori@marvell.com> wrote:
> /**@{@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);
This gets reported as ABI breakage. The change will have to wait until next LTS (25.11)
[C] 'rte_eth_fp_ops rte_eth_fp_ops[32]' was changed at rte_ethdev.c:47:1:
type of variable changed:
array element type 'struct rte_eth_fp_ops' changed:
type size hasn't changed
1 data member change:
type of 'eth_rx_queue_count_t rx_queue_count' changed:
underlying type 'uint32_t (*)(void*)' changed:
in pointed to type 'function type uint32_t (void*)':
return type changed:
entity changed from 'typedef uint32_t' to 'int'
type size hasn't changed
type size hasn't changed
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Tuesday, 27 May 2025 17.07
>
> On Mon, 12 May 2025 20:37:19 +0530
> <skori@marvell.com> wrote:
>
> > /**@{@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);
>
>
> This gets reported as ABI breakage. The change will have to wait until
> next LTS (25.11)
The return type was weird (wrong) to begin with.
When used, it gets cast to int:
https://elixir.bootlin.com/dpdk/v25.03/source/lib/ethdev/rte_ethdev.h#L6404
You are right that it formally changes the ABI, and we should go through the LTS motions.
But, for this change, I'd favor an exception.
PS: As a consequence of this change, a patch to update the return type of the callback in all the ethdev drivers should be provided.
>
>
> [C] 'rte_eth_fp_ops rte_eth_fp_ops[32]' was changed at
> rte_ethdev.c:47:1:
> type of variable changed:
> array element type 'struct rte_eth_fp_ops' changed:
> type size hasn't changed
> 1 data member change:
> type of 'eth_rx_queue_count_t rx_queue_count' changed:
> underlying type 'uint32_t (*)(void*)' changed:
> in pointed to type 'function type uint32_t (void*)':
> return type changed:
> entity changed from 'typedef uint32_t' to 'int'
> type size hasn't changed
> type size hasn't changed
>
> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Tuesday, 27 May 2025 17.07
> >
> > On Mon, 12 May 2025 20:37:19 +0530
> > <skori@marvell.com> wrote:
> >
> > > /**@{@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);
> >
> >
> > This gets reported as ABI breakage. The change will have to wait until
> > next LTS (25.11)
>
> The return type was weird (wrong) to begin with.
> When used, it gets cast to int:
> https://elixir.bootlin.com/dpdk/v25.03/source/lib/ethdev/rte_ethdev.h#L6404
Personally, I don't see anything strange here.
devops rx_queue_count() supposed to return uint, because it should never failed for
valid queue.
While rte_eth_rx_queue_count() itself can fail - wrong port/queue id, etc.
>
> You are right that it formally changes the ABI, and we should go through the LTS motions.
> But, for this change, I'd favor an exception.
Again, from my opinion, there is nothing that urgent/important why such changes (if needed)
can't wait till next LTS.
For now, we can simply do type conversion explicitly at rte_eth_rx_queue_count().
> PS: As a consequence of this change, a patch to update the return type of the callback in all the ethdev drivers should be provided.
>
> >
> >
> > [C] 'rte_eth_fp_ops rte_eth_fp_ops[32]' was changed at
> > rte_ethdev.c:47:1:
> > type of variable changed:
> > array element type 'struct rte_eth_fp_ops' changed:
> > type size hasn't changed
> > 1 data member change:
> > type of 'eth_rx_queue_count_t rx_queue_count' changed:
> > underlying type 'uint32_t (*)(void*)' changed:
> > in pointed to type 'function type uint32_t (void*)':
> > return type changed:
> > entity changed from 'typedef uint32_t' to 'int'
> > type size hasn't changed
> > type size hasn't changed
> >
> > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > > Sent: Tuesday, 27 May 2025 17.07
> > >
> > > On Mon, 12 May 2025 20:37:19 +0530
> > > <skori@marvell.com> wrote:
> > >
> > > > /**@{@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);
> > >
> > >
> > > This gets reported as ABI breakage. The change will have to wait until
> > > next LTS (25.11)
> >
> > The return type was weird (wrong) to begin with.
> > When used, it gets cast to int:
> > https://elixir.bootlin.com/dpdk/v25.03/source/lib/ethdev/rte_ethdev.h#L6404
>
> Personally, I don't see anything strange here.
> devops rx_queue_count() supposed to return uint, because it should never failed for
> valid queue.
> While rte_eth_rx_queue_count() itself can fail - wrong port/queue id, etc.
BTW, rx_queue_setup() accepts only uint16_t for number of rx descritoirs:
int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
uint16_t nb_rx_desc, unsigned int socket_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
shouldn't dev->rx_queue_count() then also return uitn16_t (for consistency)?
> >
> > You are right that it formally changes the ABI, and we should go through the LTS motions.
> > But, for this change, I'd favor an exception.
>
> Again, from my opinion, there is nothing that urgent/important why such changes (if needed)
> can't wait till next LTS.
> For now, we can simply do type conversion explicitly at rte_eth_rx_queue_count().
>
> > PS: As a consequence of this change, a patch to update the return type of the callback in all the ethdev drivers should be provided.
> >
> > >
> > >
> > > [C] 'rte_eth_fp_ops rte_eth_fp_ops[32]' was changed at
> > > rte_ethdev.c:47:1:
> > > type of variable changed:
> > > array element type 'struct rte_eth_fp_ops' changed:
> > > type size hasn't changed
> > > 1 data member change:
> > > type of 'eth_rx_queue_count_t rx_queue_count' changed:
> > > underlying type 'uint32_t (*)(void*)' changed:
> > > in pointed to type 'function type uint32_t (void*)':
> > > return type changed:
> > > entity changed from 'typedef uint32_t' to 'int'
> > > type size hasn't changed
> > > type size hasn't changed
> From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
> Sent: Wednesday, 28 May 2025 10.24
>
> > >
> > > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > > > Sent: Tuesday, 27 May 2025 17.07
> > > >
> > > > On Mon, 12 May 2025 20:37:19 +0530
> > > > <skori@marvell.com> wrote:
> > > >
> > > > > /**@{@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);
> > > >
> > > >
> > > > This gets reported as ABI breakage. The change will have to wait
> until
> > > > next LTS (25.11)
> > >
> > > The return type was weird (wrong) to begin with.
> > > When used, it gets cast to int:
> > >
> https://elixir.bootlin.com/dpdk/v25.03/source/lib/ethdev/rte_ethdev.h#L
> 6404
> >
> > Personally, I don't see anything strange here.
> > devops rx_queue_count() supposed to return uint, because it should
> never failed for
> > valid queue.
The main thing wrong is inconsistency with its sibling API for TX queue count:
/** @internal Get number of used descriptors on a receive queue. */
typedef uint32_t (*eth_rx_queue_count_t)(void *rxq);
/** @internal Get number of used descriptors on a transmit queue. */
typedef int (*eth_tx_queue_count_t)(void *txq);
> > While rte_eth_rx_queue_count() itself can fail - wrong port/queue id,
> etc.
>
> BTW, rx_queue_setup() accepts only uint16_t for number of rx
> descritoirs:
> int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
> uint16_t nb_rx_desc, unsigned int socket_id,
> const struct rte_eth_rxconf *rx_conf,
> struct rte_mempool *mb_pool);
>
> shouldn't dev->rx_queue_count() then also return uitn16_t (for
> consistency)?
If neither the RX or TX queue count callbacks can fail, then yes, both APIs could be updated to return uint16_t.
But it would be more future proof to allow these callbacks to fail, even on a valid queue.
The public APIs rte_eth_rx/tx_queue_count() can fail, so passing on failures from the callbacks would not be a change of the public API. (Assuming no new error codes are allowed.)
And the "future" already arrived:
The return type must be int (or have the same size as int), for the performance patch [1] replacing the ops->callback==NULL check with dummy callbacks returning -ENOTSUP.
[1]: https://inbox.dpdk.org/dev/20250512150732.65743-2-skori@marvell.com/
>
> > >
> > > You are right that it formally changes the ABI, and we should go
> through the LTS motions.
> > > But, for this change, I'd favor an exception.
> >
> > Again, from my opinion, there is nothing that urgent/important why
> such changes (if needed)
> > can't wait till next LTS.
> > For now, we can simply do type conversion explicitly at
> rte_eth_rx_queue_count().
OK. No objections from me. Just trying to accelerate some cleanup work.
> >
> > > PS: As a consequence of this change, a patch to update the return
> type of the callback in all the ethdev drivers should be provided.
> > >
> > > >
> > > >
> > > > [C] 'rte_eth_fp_ops rte_eth_fp_ops[32]' was changed at
> > > > rte_ethdev.c:47:1:
> > > > type of variable changed:
> > > > array element type 'struct rte_eth_fp_ops' changed:
> > > > type size hasn't changed
> > > > 1 data member change:
> > > > type of 'eth_rx_queue_count_t rx_queue_count' changed:
> > > > underlying type 'uint32_t (*)(void*)' changed:
> > > > in pointed to type 'function type uint32_t
> (void*)':
> > > > return type changed:
> > > > entity changed from 'typedef uint32_t' to 'int'
> > > > type size hasn't changed
> > > > type size hasn't changed
>
> > From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
> > Sent: Wednesday, 28 May 2025 10.24
> >
> > > >
> > > > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > > > > Sent: Tuesday, 27 May 2025 17.07
> > > > >
> > > > > On Mon, 12 May 2025 20:37:19 +0530
> > > > > <skori@marvell.com> wrote:
> > > > >
> > > > > > /**@{@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);
> > > > >
> > > > >
> > > > > This gets reported as ABI breakage. The change will have to wait
> > until
> > > > > next LTS (25.11)
> > > >
> > > > The return type was weird (wrong) to begin with.
> > > > When used, it gets cast to int:
> > > >
> > https://elixir.bootlin.com/dpdk/v25.03/source/lib/ethdev/rte_ethdev.h#L
> > 6404
> > >
> > > Personally, I don't see anything strange here.
> > > devops rx_queue_count() supposed to return uint, because it should
> > never failed for
> > > valid queue.
>
> The main thing wrong is inconsistency with its sibling API for TX queue count:
> /** @internal Get number of used descriptors on a receive queue. */
> typedef uint32_t (*eth_rx_queue_count_t)(void *rxq);
> /** @internal Get number of used descriptors on a transmit queue. */
> typedef int (*eth_tx_queue_count_t)(void *txq);
>
> > > While rte_eth_rx_queue_count() itself can fail - wrong port/queue id,
> > etc.
> >
> > BTW, rx_queue_setup() accepts only uint16_t for number of rx
> > descritoirs:
> > int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
> > uint16_t nb_rx_desc, unsigned int socket_id,
> > const struct rte_eth_rxconf *rx_conf,
> > struct rte_mempool *mb_pool);
> >
> > shouldn't dev->rx_queue_count() then also return uitn16_t (for
> > consistency)?
>
> If neither the RX or TX queue count callbacks can fail, then yes, both APIs could be updated to return uint16_t.
> But it would be more future proof to allow these callbacks to fail, even on a valid queue.
> The public APIs rte_eth_rx/tx_queue_count() can fail, so passing on failures from the callbacks would not be a change of the public
> API. (Assuming no new error codes are allowed.)
>
> And the "future" already arrived:
> The return type must be int (or have the same size as int), for the performance patch [1] replacing the ops->callback==NULL check
> with dummy callbacks returning -ENOTSUP.
>
> [1]: https://inbox.dpdk.org/dev/20250512150732.65743-2-skori@marvell.com/
So what we are saving with that patch: one cmp and one un-taken branch:
@@ -6399,8 +6399,6 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
return -EINVAL;
#endif
- if (p->rx_queue_count == NULL)
- return -ENOTSUP;
return p->rx_queue_count(qd);
}
I wonder is how realistic (and measurable) is the gain?
>
> >
> > > >
> > > > You are right that it formally changes the ABI, and we should go
> > through the LTS motions.
> > > > But, for this change, I'd favor an exception.
> > >
> > > Again, from my opinion, there is nothing that urgent/important why
> > such changes (if needed)
> > > can't wait till next LTS.
> > > For now, we can simply do type conversion explicitly at
> > rte_eth_rx_queue_count().
>
> OK. No objections from me. Just trying to accelerate some cleanup work.
>
> > >
> > > > PS: As a consequence of this change, a patch to update the return
> > type of the callback in all the ethdev drivers should be provided.
> > > >
> > > > >
> > > > >
> > > > > [C] 'rte_eth_fp_ops rte_eth_fp_ops[32]' was changed at
> > > > > rte_ethdev.c:47:1:
> > > > > type of variable changed:
> > > > > array element type 'struct rte_eth_fp_ops' changed:
> > > > > type size hasn't changed
> > > > > 1 data member change:
> > > > > type of 'eth_rx_queue_count_t rx_queue_count' changed:
> > > > > underlying type 'uint32_t (*)(void*)' changed:
> > > > > in pointed to type 'function type uint32_t
> > (void*)':
> > > > > return type changed:
> > > > > entity changed from 'typedef uint32_t' to 'int'
> > > > > type size hasn't changed
> > > > > type size hasn't changed
> From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
> Sent: Wednesday, 28 May 2025 11.14
>
> >
> > > From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
> > > Sent: Wednesday, 28 May 2025 10.24
> > >
> > > > >
> > > > > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > > > > > Sent: Tuesday, 27 May 2025 17.07
> > > > > >
> > > > > > On Mon, 12 May 2025 20:37:19 +0530
> > > > > > <skori@marvell.com> wrote:
> > > > > >
> > > > > > > /**@{@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);
> > > > > >
> > > > > >
> > > > > > This gets reported as ABI breakage. The change will have to
> wait
> > > until
> > > > > > next LTS (25.11)
> > > > >
> > > > > The return type was weird (wrong) to begin with.
> > > > > When used, it gets cast to int:
> > > > >
> > >
> https://elixir.bootlin.com/dpdk/v25.03/source/lib/ethdev/rte_ethdev.h#L
> > > 6404
> > > >
> > > > Personally, I don't see anything strange here.
> > > > devops rx_queue_count() supposed to return uint, because it
> should
> > > never failed for
> > > > valid queue.
> >
> > The main thing wrong is inconsistency with its sibling API for TX
> queue count:
> > /** @internal Get number of used descriptors on a receive queue. */
> > typedef uint32_t (*eth_rx_queue_count_t)(void *rxq);
> > /** @internal Get number of used descriptors on a transmit queue. */
> > typedef int (*eth_tx_queue_count_t)(void *txq);
> >
> > > > While rte_eth_rx_queue_count() itself can fail - wrong port/queue
> id,
> > > etc.
> > >
> > > BTW, rx_queue_setup() accepts only uint16_t for number of rx
> > > descritoirs:
> > > int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
> > > uint16_t nb_rx_desc, unsigned int socket_id,
> > > const struct rte_eth_rxconf *rx_conf,
> > > struct rte_mempool *mb_pool);
> > >
> > > shouldn't dev->rx_queue_count() then also return uitn16_t (for
> > > consistency)?
> >
> > If neither the RX or TX queue count callbacks can fail, then yes,
> both APIs could be updated to return uint16_t.
> > But it would be more future proof to allow these callbacks to fail,
> even on a valid queue.
> > The public APIs rte_eth_rx/tx_queue_count() can fail, so passing on
> failures from the callbacks would not be a change of the public
> > API. (Assuming no new error codes are allowed.)
> >
> > And the "future" already arrived:
> > The return type must be int (or have the same size as int), for the
> performance patch [1] replacing the ops->callback==NULL check
> > with dummy callbacks returning -ENOTSUP.
> >
> > [1]: https://inbox.dpdk.org/dev/20250512150732.65743-2-
> skori@marvell.com/
>
> So what we are saving with that patch: one cmp and one un-taken branch:
> @@ -6399,8 +6399,6 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t
> queue_id)
> return -EINVAL;
> #endif
>
> - if (p->rx_queue_count == NULL)
> - return -ENOTSUP;
> return p->rx_queue_count(qd);
> }
>
> I wonder is how realistic (and measurable) is the gain?
Moving the performance discussion to the other thread [2].
[2]: https://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35E9FC9E@smartserver.smartshare.dk/
>
> >
> > >
> > > > >
> > > > > You are right that it formally changes the ABI, and we should
> go
> > > through the LTS motions.
> > > > > But, for this change, I'd favor an exception.
> > > >
> > > > Again, from my opinion, there is nothing that urgent/important
> why
> > > such changes (if needed)
> > > > can't wait till next LTS.
> > > > For now, we can simply do type conversion explicitly at
> > > rte_eth_rx_queue_count().
> >
> > OK. No objections from me. Just trying to accelerate some cleanup
> work.
> >
> > > >
> > > > > PS: As a consequence of this change, a patch to update the
> return
> > > type of the callback in all the ethdev drivers should be provided.
> > > > >
> > > > > >
> > > > > >
> > > > > > [C] 'rte_eth_fp_ops rte_eth_fp_ops[32]' was changed at
> > > > > > rte_ethdev.c:47:1:
> > > > > > type of variable changed:
> > > > > > array element type 'struct rte_eth_fp_ops' changed:
> > > > > > type size hasn't changed
> > > > > > 1 data member change:
> > > > > > type of 'eth_rx_queue_count_t rx_queue_count'
> changed:
> > > > > > underlying type 'uint32_t (*)(void*)' changed:
> > > > > > in pointed to type 'function type uint32_t
> > > (void*)':
> > > > > > return type changed:
> > > > > > entity changed from 'typedef uint32_t' to
> 'int'
> > > > > > type size hasn't changed
> > > > > > type size hasn't changed
@@ -396,7 +396,7 @@ eth_ark_rx_queue_drain(struct ark_rx_queue *queue)
}
}
-uint32_t
+int
eth_ark_dev_rx_queue_count(void *rx_queue)
{
struct ark_rx_queue *queue;
@@ -17,7 +17,7 @@ int eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
unsigned int socket_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mp);
-uint32_t eth_ark_dev_rx_queue_count(void *rx_queue);
+int eth_ark_dev_rx_queue_count(void *rx_queue);
int eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t queue_id);
int eth_ark_rx_start_queue(struct rte_eth_dev *dev, uint16_t queue_id);
uint16_t eth_ark_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -66,7 +66,7 @@ int atl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf);
-uint32_t atl_rx_queue_count(void *rx_queue);
+int atl_rx_queue_count(void *rx_queue);
int atl_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int atl_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
@@ -688,7 +688,7 @@ atl_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
/* Return Rx queue avail count */
-uint32_t
+int
atl_rx_queue_count(void *rx_queue)
{
struct atl_rx_queue *rxq;
@@ -3407,7 +3407,7 @@ bnxt_dev_led_off_op(struct rte_eth_dev *dev)
return bnxt_hwrm_port_led_cfg(bp, false);
}
-static uint32_t
+static int
bnxt_rx_queue_count_op(void *rx_queue)
{
struct bnxt *bp;
@@ -705,7 +705,7 @@ void cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
/* Queue status */
int cnxk_nix_rx_descriptor_status(void *rxq, uint16_t offset);
int cnxk_nix_tx_descriptor_status(void *txq, uint16_t offset);
-uint32_t cnxk_nix_rx_queue_count(void *rxq);
+int cnxk_nix_rx_queue_count(void *rxq);
/* Lookup configuration */
const uint32_t *cnxk_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev,
@@ -870,7 +870,7 @@ cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
memcpy(&qinfo->conf, &txq_sp->qconf.conf.tx, sizeof(qinfo->conf));
}
-uint32_t
+int
cnxk_nix_rx_queue_count(void *rxq)
{
struct cnxk_eth_rxq_sp *rxq_sp = cnxk_eth_rxq_to_sp(rxq);
@@ -1414,7 +1414,7 @@ int dpaa_eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
return 0;
}
-static uint32_t
+static int
dpaa_dev_rx_queue_count(void *rx_queue)
{
struct qman_fq *rxq = rx_queue;
@@ -1047,7 +1047,7 @@ dpaa2_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t rx_queue_id)
}
}
-static uint32_t
+static int
dpaa2_dev_rx_queue_count(void *rx_queue)
{
int32_t ret;
@@ -258,7 +258,7 @@ static void enicpmd_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
enic_free_rq(rxq);
}
-static uint32_t enicpmd_dev_rx_queue_count(void *rx_queue)
+static int enicpmd_dev_rx_queue_count(void *rx_queue)
{
struct enic *enic;
struct vnic_rq *sop_rq;
@@ -4745,7 +4745,7 @@ hns3_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
return RTE_ETH_TX_DESC_DONE;
}
-uint32_t
+int
hns3_rx_queue_count(void *rx_queue)
{
/*
@@ -745,7 +745,7 @@ int hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
int hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
unsigned int socket_id,
const struct rte_eth_txconf *conf);
-uint32_t hns3_rx_queue_count(void *rx_queue);
+int hns3_rx_queue_count(void *rx_queue);
int hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
int hns3_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
int hns3_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
@@ -414,7 +414,7 @@ int eth_igb_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
-uint32_t eth_igb_rx_queue_count(void *rx_queue);
+int eth_igb_rx_queue_count(void *rx_queue);
int eth_igb_rx_descriptor_status(void *rx_queue, uint16_t offset);
int eth_igb_tx_descriptor_status(void *tx_queue, uint16_t offset);
@@ -488,7 +488,7 @@ int eth_em_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
-uint32_t eth_em_rx_queue_count(void *rx_queue);
+int eth_em_rx_queue_count(void *rx_queue);
int eth_em_rx_descriptor_status(void *rx_queue, uint16_t offset);
int eth_em_tx_descriptor_status(void *tx_queue, uint16_t offset);
@@ -1489,7 +1489,7 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
-uint32_t
+int
eth_em_rx_queue_count(void *rx_queue)
{
#define EM_RXQ_SCAN_INTERVAL 4
@@ -1792,7 +1792,7 @@ eth_igb_rx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
-uint32_t
+int
eth_igb_rx_queue_count(void *rx_queue)
{
#define IGB_RXQ_SCAN_INTERVAL 4
@@ -667,7 +667,7 @@ void eth_igc_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
igc_rx_queue_release(dev->data->rx_queues[qid]);
}
-uint32_t eth_igc_rx_queue_count(void *rx_queue)
+int eth_igc_rx_queue_count(void *rx_queue)
{
/**
* Check the DD bit of a rx descriptor of each 4 in a group,
@@ -141,7 +141,7 @@ int eth_igc_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
-uint32_t eth_igc_rx_queue_count(void *rx_queue);
+int eth_igc_rx_queue_count(void *rx_queue);
int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset);
@@ -321,7 +321,7 @@ uint16_t fm10k_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
-uint32_t
+int
fm10k_dev_rx_queue_count(void *rx_queue);
int
@@ -364,7 +364,7 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
return nb_rcv;
}
-uint32_t
+int
fm10k_dev_rx_queue_count(void *rx_queue)
{
#define FM10K_RXQ_SCAN_INTERVAL 4
@@ -2255,7 +2255,7 @@ i40e_rx_queue_release(void *rxq)
rte_free(q);
}
-uint32_t
+int
i40e_dev_rx_queue_count(void *rx_queue)
{
#define I40E_RXQ_SCAN_INTERVAL 4
@@ -183,7 +183,7 @@ int i40e_tx_done_cleanup(void *txq, uint32_t free_cnt);
int i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq);
void i40e_rx_queue_release_mbufs(struct i40e_rx_queue *rxq);
-uint32_t i40e_dev_rx_queue_count(void *rx_queue);
+int i40e_dev_rx_queue_count(void *rx_queue);
int i40e_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int i40e_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
@@ -4318,7 +4318,7 @@ iavf_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
}
/* Get the number of used descriptors of a rx queue */
-uint32_t
+int
iavf_dev_rxq_count(void *rx_queue)
{
#define IAVF_RXQ_SCAN_INTERVAL 4
@@ -641,7 +641,7 @@ void iavf_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
void iavf_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_txq_info *qinfo);
-uint32_t iavf_dev_rxq_count(void *rx_queue);
+int iavf_dev_rxq_count(void *rx_queue);
int iavf_dev_rx_desc_status(void *rx_queue, uint16_t offset);
int iavf_dev_tx_desc_status(void *tx_queue, uint16_t offset);
@@ -1581,7 +1581,7 @@ ice_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
}
-uint32_t
+int
ice_rx_queue_count(void *rx_queue)
{
#define ICE_RXQ_SCAN_INTERVAL 4
@@ -235,7 +235,7 @@ uint16_t ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
void ice_set_tx_function_flag(struct rte_eth_dev *dev,
struct ci_tx_queue *txq);
void ice_set_tx_function(struct rte_eth_dev *dev);
-uint32_t ice_rx_queue_count(void *rx_queue);
+int ice_rx_queue_count(void *rx_queue);
void ice_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
void ice_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
@@ -601,7 +601,7 @@ int ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf);
-uint32_t ixgbe_dev_rx_queue_count(void *rx_queue);
+int ixgbe_dev_rx_queue_count(void *rx_queue);
int ixgbe_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int ixgbe_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
@@ -3346,7 +3346,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
-uint32_t
+int
ixgbe_dev_rx_queue_count(void *rx_queue)
{
#define IXGBE_RXQ_SCAN_INTERVAL 4
@@ -73,7 +73,7 @@ mlx5_lro_update_hdr(uint8_t *__rte_restrict padd,
* @return
* The number of used Rx descriptor.
*/
-static uint32_t
+static int
rx_queue_count(struct mlx5_rxq_data *rxq)
{
struct rxq_zip *zip = &rxq->zip;
@@ -259,7 +259,7 @@ mlx5_rx_burst_mode_get(struct rte_eth_dev *dev,
* The number of used rx descriptor.
* -EINVAL if the queue is invalid
*/
-uint32_t
+int
mlx5_rx_queue_count(void *rx_queue)
{
struct mlx5_rxq_data *rxq = rx_queue;
@@ -312,7 +312,7 @@ void mlx5_mprq_buf_free(struct mlx5_mprq_buf *buf);
uint16_t mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts,
uint16_t pkts_n);
int mlx5_rx_descriptor_status(void *rx_queue, uint16_t offset);
-uint32_t mlx5_rx_queue_count(void *rx_queue);
+int mlx5_rx_queue_count(void *rx_queue);
void mlx5_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
int mlx5_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
@@ -1056,7 +1056,7 @@ hn_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
* Get the number of used descriptor in a rx queue
* For this device that means how many packets are pending in the ring.
*/
-uint32_t
+int
hn_dev_rx_queue_count(void *rx_queue)
{
struct hn_rx_queue *rxq = rx_queue;
@@ -224,7 +224,7 @@ int hn_dev_rx_queue_setup(struct rte_eth_dev *dev,
void hn_dev_rx_queue_info(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
void hn_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
-uint32_t hn_dev_rx_queue_count(void *rx_queue);
+int hn_dev_rx_queue_count(void *rx_queue);
int hn_dev_rx_queue_status(void *rxq, uint16_t offset);
void hn_dev_free_queues(struct rte_eth_dev *dev);
@@ -199,7 +199,7 @@ nfp_net_rx_freelist_setup(struct rte_eth_dev *dev)
return 0;
}
-uint32_t
+int
nfp_net_rx_queue_count(void *rx_queue)
{
uint32_t idx;
@@ -220,7 +220,7 @@ nfp_net_mbuf_alloc_failed(struct nfp_net_rxq *rxq)
void nfp_net_rx_cksum(struct nfp_net_rxq *rxq, struct nfp_net_rx_desc *rxd,
struct rte_mbuf *mb);
int nfp_net_rx_freelist_setup(struct rte_eth_dev *dev);
-uint32_t nfp_net_rx_queue_count(void *rx_queue);
+int nfp_net_rx_queue_count(void *rx_queue);
uint16_t nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
void nfp_net_rx_queue_release(struct rte_eth_dev *dev, uint16_t queue_idx);
@@ -204,7 +204,7 @@ int ngbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf);
-uint32_t ngbe_dev_rx_queue_count(void *rx_queue);
+int ngbe_dev_rx_queue_count(void *rx_queue);
int ngbe_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int ngbe_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
@@ -2442,7 +2442,7 @@ ngbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
-uint32_t
+int
ngbe_dev_rx_queue_count(void *rx_queue)
{
#define NGBE_RXQ_SCAN_INTERVAL 4
@@ -1357,7 +1357,7 @@ sfc_tx_queue_info_get(struct rte_eth_dev *dev, uint16_t ethdev_qid,
* The function is used by the secondary process as well. It must not
* use any process-local pointers from the adapter data.
*/
-static uint32_t
+static int
sfc_rx_queue_count(void *rx_queue)
{
struct sfc_dp_rxq *dp_rxq = rx_queue;
@@ -649,7 +649,7 @@ nicvf_recv_pkts_multiseg_cksum_vlan_strip(void *rx_queue,
NICVF_RX_OFFLOAD_CKSUM | NICVF_RX_OFFLOAD_VLAN_STRIP);
}
-uint32_t
+int
nicvf_dev_rx_queue_count(void *rx_queue)
{
struct nicvf_rxq *rxq;
@@ -83,7 +83,7 @@ nicvf_mbuff_init_mseg_update(struct rte_mbuf *pkt, const uint64_t mbuf_init,
*(uint64_t *)(&pkt->rearm_data) = init.value;
}
-uint32_t nicvf_dev_rx_queue_count(void *rx_queue);
+int nicvf_dev_rx_queue_count(void *rx_queue);
uint32_t nicvf_dev_rbdr_refill(struct rte_eth_dev *dev, uint16_t queue_idx);
uint16_t nicvf_recv_pkts_no_offload(void *rxq, struct rte_mbuf **rx_pkts,
@@ -451,7 +451,7 @@ int txgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf);
-uint32_t txgbe_dev_rx_queue_count(void *rx_queue);
+int txgbe_dev_rx_queue_count(void *rx_queue);
int txgbe_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int txgbe_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
@@ -2873,7 +2873,7 @@ txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
-uint32_t
+int
txgbe_dev_rx_queue_count(void *rx_queue)
{
#define TXGBE_RXQ_SCAN_INTERVAL 4
@@ -1407,7 +1407,7 @@ eth_link_update(struct rte_eth_dev *dev __rte_unused,
return 0;
}
-static uint32_t
+static int
eth_rx_queue_count(void *rx_queue)
{
struct vhost_queue *vq;
@@ -212,7 +212,7 @@ int vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
-uint32_t vmxnet3_dev_rx_queue_count(void *rx_queue);
+int vmxnet3_dev_rx_queue_count(void *rx_queue);
int vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id,
@@ -1055,7 +1055,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
return nb_rx;
}
-uint32_t
+int
vmxnet3_dev_rx_queue_count(void *rx_queue)
{
const vmxnet3_rx_queue_t *rxq;
@@ -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
@@ -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);