[dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue information

2015-07-22 Thread Thomas Monjalon
2015-07-22 17:00, Ananyev, Konstantin:
> From: Zhang, Helin
> > > -#ifdef __cplusplus
> > > -}
> > > -#endif
> > > -
> > >  /**
> > >   * Set the list of multicast addresses to filter on an Ethernet device.
> > >   *
> > > @@ -3882,4 +3952,9 @@ extern int
> > > rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
> > >   */
> > >  extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
> > > struct timespec *timestamp);
> > > +
> > > +#ifdef __cplusplus
> > > +}
> > > +#endif
> > This is fix for the issue introduced by new ieee1588. It must be added in 
> > R2.1 no matter
> > these patches can be applied or not.

Yes you're totally right Helin.
It's a fix and should be in a separate patch.
This feature is not planned in 2.1.


[dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue information

2015-07-22 Thread Ananyev, Konstantin


> -Original Message-
> From: Zhang, Helin
> Sent: Wednesday, July 22, 2015 5:51 PM
> To: Ananyev, Konstantin
> Cc: dev at dpdk.org
> Subject: RE: [dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX 
> queue information
> 
> 
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Konstantin Ananyev
> > Sent: Monday, July 20, 2015 5:19 AM
> > To: dev at dpdk.org
> > Subject: [dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX 
> > queue
> > information
> >
> > Add the ability for the upper layer to query RX/TX queue information.
> >
> > Add new structures:
> > struct rte_eth_rxq_info
> > struct rte_eth_txq_info
> >
> > new functions:
> > rte_eth_rx_queue_info_get
> > rte_eth_tx_queue_info_get
> >
> > into rte_etdev API.
> >
> > Left extra free space in the queue info structures, so extra fields could 
> > be added
> > later without ABI breakage.
> >
> > v2 changes:
> > - Add formal check for the qinfo input parameter.
> > - As suggested rename 'rx_qinfo/tx_qinfo' to 'rxq_info/txq_info'
> >
> > v3 changes:
> > - Updated rte_ether_version.map
> > - Merged with latest changes
> >
> > Signed-off-by: Konstantin Ananyev 
> > ---
> >  lib/librte_ether/rte_ethdev.c  | 54 +
> >  lib/librte_ether/rte_ethdev.h  | 87
> > +++---
> >  lib/librte_ether/rte_ether_version.map |  2 +
> >  3 files changed, 137 insertions(+), 6 deletions(-)
> >
> > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c 
> > index
> > 94104ce..a94c119 100644
> > --- a/lib/librte_ether/rte_ethdev.c
> > +++ b/lib/librte_ether/rte_ethdev.c
> > @@ -3341,6 +3341,60 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t
> > queue_id,  }
> >
> >  int
> > +rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> > +   struct rte_eth_rxq_info *qinfo)
> > +{
> > +   struct rte_eth_dev *dev;
> > +
> > +   if (qinfo == NULL)
> > +   return -EINVAL;
> > +
> > +   if (!rte_eth_dev_is_valid_port(port_id)) {
> > +   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> > +   return -EINVAL;
> > +   }
> > +
> > +   dev = _eth_devices[port_id];
> > +   if (queue_id >= dev->data->nb_rx_queues) {
> > +   PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
> > +   return -EINVAL;
> > +   }
> > +
> > +   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
> > +
> > +   memset(qinfo, 0, sizeof(*qinfo));
> > +   dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
> > +   return 0;
> > +}
> > +
> > +int
> > +rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> > +   struct rte_eth_txq_info *qinfo)
> > +{
> > +   struct rte_eth_dev *dev;
> > +
> > +   if (qinfo == NULL)
> > +   return -EINVAL;
> > +
> > +   if (!rte_eth_dev_is_valid_port(port_id)) {
> > +   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> > +   return -EINVAL;
> > +   }
> > +
> > +   dev = _eth_devices[port_id];
> > +   if (queue_id >= dev->data->nb_tx_queues) {
> > +   PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
> > +   return -EINVAL;
> > +   }
> > +
> > +   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
> > +
> > +   memset(qinfo, 0, sizeof(*qinfo));
> > +   dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
> > +   return 0;
> > +}
> > +
> > +int
> >  rte_eth_dev_set_mc_addr_list(uint8_t port_id,
> >  struct ether_addr *mc_addr_set,
> >  uint32_t nb_mc_addr)
> > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h 
> > index
> > c901a2c..0c6705e 100644
> > --- a/lib/librte_ether/rte_ethdev.h
> > +++ b/lib/librte_ether/rte_ethdev.h
> > @@ -960,6 +960,30 @@ struct rte_eth_xstats {
> > uint64_t value;
> >  };
> >
> > +/**
> > + * Ethernet device RX queue information strcuture.
> > + * Used to retieve information about configured queue.
> > + */
> > +struct rte_eth_rxq_info {
> > +   struct rte_mempool *mp; /**< mempool used by that queue. */
> > +   struct rte_eth_rxconf conf; /**< queue config parameters. *

[dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue information

2015-07-22 Thread Zhang, Helin


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Monday, July 20, 2015 5:19 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue
> information
> 
> Add the ability for the upper layer to query RX/TX queue information.
> 
> Add new structures:
> struct rte_eth_rxq_info
> struct rte_eth_txq_info
> 
> new functions:
> rte_eth_rx_queue_info_get
> rte_eth_tx_queue_info_get
> 
> into rte_etdev API.
> 
> Left extra free space in the queue info structures, so extra fields could be 
> added
> later without ABI breakage.
> 
> v2 changes:
> - Add formal check for the qinfo input parameter.
> - As suggested rename 'rx_qinfo/tx_qinfo' to 'rxq_info/txq_info'
> 
> v3 changes:
> - Updated rte_ether_version.map
> - Merged with latest changes
> 
> Signed-off-by: Konstantin Ananyev 
> ---
>  lib/librte_ether/rte_ethdev.c  | 54 +
>  lib/librte_ether/rte_ethdev.h  | 87
> +++---
>  lib/librte_ether/rte_ether_version.map |  2 +
>  3 files changed, 137 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c 
> index
> 94104ce..a94c119 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -3341,6 +3341,60 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t
> queue_id,  }
> 
>  int
> +rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> + struct rte_eth_rxq_info *qinfo)
> +{
> + struct rte_eth_dev *dev;
> +
> + if (qinfo == NULL)
> + return -EINVAL;
> +
> + if (!rte_eth_dev_is_valid_port(port_id)) {
> + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> + return -EINVAL;
> + }
> +
> + dev = _eth_devices[port_id];
> + if (queue_id >= dev->data->nb_rx_queues) {
> + PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
> + return -EINVAL;
> + }
> +
> + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
> +
> + memset(qinfo, 0, sizeof(*qinfo));
> + dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
> + return 0;
> +}
> +
> +int
> +rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> + struct rte_eth_txq_info *qinfo)
> +{
> + struct rte_eth_dev *dev;
> +
> + if (qinfo == NULL)
> + return -EINVAL;
> +
> + if (!rte_eth_dev_is_valid_port(port_id)) {
> + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> + return -EINVAL;
> + }
> +
> + dev = _eth_devices[port_id];
> + if (queue_id >= dev->data->nb_tx_queues) {
> + PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
> + return -EINVAL;
> + }
> +
> + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
> +
> + memset(qinfo, 0, sizeof(*qinfo));
> + dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
> + return 0;
> +}
> +
> +int
>  rte_eth_dev_set_mc_addr_list(uint8_t port_id,
>struct ether_addr *mc_addr_set,
>uint32_t nb_mc_addr)
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h 
> index
> c901a2c..0c6705e 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -960,6 +960,30 @@ struct rte_eth_xstats {
>   uint64_t value;
>  };
> 
> +/**
> + * Ethernet device RX queue information strcuture.
> + * Used to retieve information about configured queue.
> + */
> +struct rte_eth_rxq_info {
> + struct rte_mempool *mp; /**< mempool used by that queue. */
> + struct rte_eth_rxconf conf; /**< queue config parameters. */
> + uint8_t scattered_rx;   /**< scattered packets RX supported. */
> + uint16_t nb_desc;   /**< configured number of RXDs. */
> + uint16_t max_desc;  /**< max allowed number of RXDs. */
> + uint16_t min_desc;  /**< min allowed number of RXDs. */
> +} __rte_cache_aligned;
> +
> +/**
> + * Ethernet device TX queue information strcuture.
> + * Used to retieve information about configured queue.
> + */
> +struct rte_eth_txq_info {
> + struct rte_eth_txconf conf; /**< queue config parameters. */
> + uint16_t nb_desc;   /**< configured number of TXDs. */
> + uint16_t max_desc;  /**< max allowed number of TXDs. */
> + uint16_t min_desc;  /**<

[dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue information

2015-07-20 Thread Konstantin Ananyev
Add the ability for the upper layer to query RX/TX queue information.

Add new structures:
struct rte_eth_rxq_info
struct rte_eth_txq_info

new functions:
rte_eth_rx_queue_info_get
rte_eth_tx_queue_info_get

into rte_etdev API.

Left extra free space in the queue info structures,
so extra fields could be added later without ABI breakage.

v2 changes:
- Add formal check for the qinfo input parameter.
- As suggested rename 'rx_qinfo/tx_qinfo' to 'rxq_info/txq_info'

v3 changes:
- Updated rte_ether_version.map 
- Merged with latest changes

Signed-off-by: Konstantin Ananyev 
---
 lib/librte_ether/rte_ethdev.c  | 54 +
 lib/librte_ether/rte_ethdev.h  | 87 +++---
 lib/librte_ether/rte_ether_version.map |  2 +
 3 files changed, 137 insertions(+), 6 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 94104ce..a94c119 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3341,6 +3341,60 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t 
queue_id,
 }

 int
+rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+   struct rte_eth_rxq_info *qinfo)
+{
+   struct rte_eth_dev *dev;
+
+   if (qinfo == NULL)
+   return -EINVAL;
+
+   if (!rte_eth_dev_is_valid_port(port_id)) {
+   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+   return -EINVAL;
+   }
+
+   dev = _eth_devices[port_id];
+   if (queue_id >= dev->data->nb_rx_queues) {
+   PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
+   return -EINVAL;
+   }
+
+   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+
+   memset(qinfo, 0, sizeof(*qinfo));
+   dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
+   return 0;
+}
+
+int
+rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+   struct rte_eth_txq_info *qinfo)
+{
+   struct rte_eth_dev *dev;
+
+   if (qinfo == NULL)
+   return -EINVAL;
+
+   if (!rte_eth_dev_is_valid_port(port_id)) {
+   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+   return -EINVAL;
+   }
+
+   dev = _eth_devices[port_id];
+   if (queue_id >= dev->data->nb_tx_queues) {
+   PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
+   return -EINVAL;
+   }
+
+   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+
+   memset(qinfo, 0, sizeof(*qinfo));
+   dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
+   return 0;
+}
+
+int
 rte_eth_dev_set_mc_addr_list(uint8_t port_id,
 struct ether_addr *mc_addr_set,
 uint32_t nb_mc_addr)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index c901a2c..0c6705e 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -960,6 +960,30 @@ struct rte_eth_xstats {
uint64_t value;
 };

+/**
+ * Ethernet device RX queue information strcuture.
+ * Used to retieve information about configured queue.
+ */
+struct rte_eth_rxq_info {
+   struct rte_mempool *mp; /**< mempool used by that queue. */
+   struct rte_eth_rxconf conf; /**< queue config parameters. */
+   uint8_t scattered_rx;   /**< scattered packets RX supported. */
+   uint16_t nb_desc;   /**< configured number of RXDs. */
+   uint16_t max_desc;  /**< max allowed number of RXDs. */
+   uint16_t min_desc;  /**< min allowed number of RXDs. */
+} __rte_cache_aligned;
+
+/**
+ * Ethernet device TX queue information strcuture.
+ * Used to retieve information about configured queue.
+ */
+struct rte_eth_txq_info {
+   struct rte_eth_txconf conf; /**< queue config parameters. */
+   uint16_t nb_desc;   /**< configured number of TXDs. */
+   uint16_t max_desc;  /**< max allowed number of TXDs. */
+   uint16_t min_desc;  /**< min allowed number of TXDs. */
+} __rte_cache_aligned;
+
 struct rte_eth_dev;

 struct rte_eth_dev_callback;
@@ -1063,6 +1087,12 @@ typedef uint32_t (*eth_rx_queue_count_t)(struct 
rte_eth_dev *dev,
 typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
 /**< @internal Check DD bit of specific RX descriptor */

+typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
+   uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
+
+typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
+   uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
+
 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
 /**< @internal Set MTU. */

@@ -1451,9 +1481,13 @@ struct eth_dev_ops {
rss_hash_update_t rss_hash_update;
/** Get current RSS hash configuration. */
rss_hash_conf_get_t rss_hash_conf_get;
-   eth_filter_ctrl_t  filter_ctrl;  /**< common filter 
control*/
+