[dpdk-dev,RFC,2/2] librte_ether: add new fields to rte_eth_dev_info struct

Message ID 1460627077-8207-3-git-send-email-reshma.pattan@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Pattan, Reshma April 14, 2016, 9:44 a.m. UTC
  New fields nb_rx_queues and nb_tx_queues are added to
rte_eth_dev_info structure.
Changes to API rte_eth_dev_info_get() are done to update
these new fields to rte_eth_dev_info object.

Signed-off-by:reshma Pattan<reshma.pattan@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 2 ++
 lib/librte_ether/rte_ethdev.h | 3 +++
 2 files changed, 5 insertions(+)
  

Comments

John McNamara April 15, 2016, 9:42 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Reshma Pattan
> Sent: Thursday, April 14, 2016 10:45 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [RFC 2/2] librte_ether: add new fields to
> rte_eth_dev_info struct
> 
> New fields nb_rx_queues and nb_tx_queues are added to rte_eth_dev_info
> structure.
> Changes to API rte_eth_dev_info_get() are done to update these new fields
> to rte_eth_dev_info object.
> 
> Signed-off-by:reshma Pattan<reshma.pattan@intel.com>

Acked-by: John McNamara <john.mcnamara@intel.com>
  
Thomas Monjalon April 15, 2016, 10:36 a.m. UTC | #2
2016-04-14 10:44, Reshma Pattan:
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -908,6 +908,9 @@ struct rte_eth_dev_info {
>  	struct rte_eth_desc_lim rx_desc_lim;  /**< RX descriptors limits */
>  	struct rte_eth_desc_lim tx_desc_lim;  /**< TX descriptors limits */
>  	uint32_t speed_capa;  /**< Supported speeds bitmap (ETH_LINK_SPEED_). */
> +	/** number of queues configured by software*/
> +	uint16_t nb_rx_queues; /**< Number of RX queues. */
> +	uint16_t nb_tx_queues; /**< Number of TX queues. */
>  };

I think the ethdev design is strange for these structures.
struct rte_eth_dev is internal to be used inside the ethdev API
or by the drivers.
It contains struct rte_eth_dev_data which can be of interest for
the application, except the dev_private part (which could be
directly in struct rte_eth_dev).

So the global question is: how to share the device data with the
application?
Instead of giving a pointer or a copy of struct rte_eth_dev_data,
we have some different accessors:
	- rte_eth_dev_info_get() with a specific struct rte_eth_dev_info
which gathers a lot of info, not only from struct rte_eth_dev_data
	- rte_eth_macaddr_get()
	- rte_eth_dev_socket_id()
	- rte_eth_link_get() which is more than an accessor

I think having some specialized accessors is good.
But the rte_eth_dev_info_get() looks like to be a big request
without precise goal and going to break ABI really often.
There are some queues informations, some (not so precise)
offload capabilities, some steering (RSS/VMDq) informations,
the default configuration of some Intel NIC thresholds,
the speed capabilities, etc.

Shouldn't we try to streamline this API?
  
Ananyev, Konstantin April 15, 2016, 11:32 a.m. UTC | #3
Hi everyone,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Friday, April 15, 2016 11:36 AM
> To: Pattan, Reshma
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC 2/2] librte_ether: add new fields to rte_eth_dev_info struct
> 
> 2016-04-14 10:44, Reshma Pattan:
> > --- a/lib/librte_ether/rte_ethdev.h
> > +++ b/lib/librte_ether/rte_ethdev.h
> > @@ -908,6 +908,9 @@ struct rte_eth_dev_info {
> >  	struct rte_eth_desc_lim rx_desc_lim;  /**< RX descriptors limits */
> >  	struct rte_eth_desc_lim tx_desc_lim;  /**< TX descriptors limits */
> >  	uint32_t speed_capa;  /**< Supported speeds bitmap (ETH_LINK_SPEED_). */
> > +	/** number of queues configured by software*/
> > +	uint16_t nb_rx_queues; /**< Number of RX queues. */
> > +	uint16_t nb_tx_queues; /**< Number of TX queues. */
> >  };
> 
> I think the ethdev design is strange for these structures.
> struct rte_eth_dev is internal to be used inside the ethdev API
> or by the drivers.
> It contains struct rte_eth_dev_data which can be of interest for
> the application, except the dev_private part (which could be
> directly in struct rte_eth_dev).
> 
> So the global question is: how to share the device data with the
> application?
> Instead of giving a pointer or a copy of struct rte_eth_dev_data,
> we have some different accessors:
> 	- rte_eth_dev_info_get() with a specific struct rte_eth_dev_info
> which gathers a lot of info, not only from struct rte_eth_dev_data
> 	- rte_eth_macaddr_get()
> 	- rte_eth_dev_socket_id()
> 	- rte_eth_link_get() which is more than an accessor
> 
> I think having some specialized accessors is good.
> But the rte_eth_dev_info_get() looks like to be a big request
> without precise goal and going to break ABI really often.
> There are some queues informations, some (not so precise)
> offload capabilities, some steering (RSS/VMDq) informations,
> the default configuration of some Intel NIC thresholds,
> the speed capabilities, etc.
> 
> Shouldn't we try to streamline this API?

I think in general it is a good idea  to split dev_info into some smaller sub-pieces.
But introduce a new API just for these 2 fields seems like an overkill to me.
My vote would be to allow nb_rx/tx_queues into dev_info,
If we'll decide to split dev_info - I think it needs to be a subject for a separate   
patch/discussion.
Konstantin
  

Patch

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a31018e..032c6bf 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1661,6 +1661,8 @@  rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 	dev_info->pci_dev = dev->pci_dev;
 	dev_info->driver_name = dev->data->drv_name;
+	dev_info->nb_tx_queues = dev->data->nb_tx_queues;
+	dev_info->nb_rx_queues = dev->data->nb_rx_queues;
 }
 
 int
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 022733e..e8e370d 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -908,6 +908,9 @@  struct rte_eth_dev_info {
 	struct rte_eth_desc_lim rx_desc_lim;  /**< RX descriptors limits */
 	struct rte_eth_desc_lim tx_desc_lim;  /**< TX descriptors limits */
 	uint32_t speed_capa;  /**< Supported speeds bitmap (ETH_LINK_SPEED_). */
+	/** number of queues configured by software*/
+	uint16_t nb_rx_queues; /**< Number of RX queues. */
+	uint16_t nb_tx_queues; /**< Number of TX queues. */
 };
 
 /**