DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] lib/librte_ethdev: Error checking for stats mapping
@ 2018-07-10 15:26 Kiran Kumar
  2018-07-10 15:54 ` Andrew Rybchenko
  2018-07-11  8:41 ` [dpdk-dev] [PATCH v2] ethdev: check queue stats mapping input arguments Kiran Kumar
  0 siblings, 2 replies; 4+ messages in thread
From: Kiran Kumar @ 2018-07-10 15:26 UTC (permalink / raw)
  To: dev; +Cc: thomas, ferruh.yigit, arybchenko, Kiran Kumar

With current implementation, we are not checking for queue_id range
and stat_idx range in stats mapping function. This patch will add
check for queue_id and stat_idx range.

Fixes: 5de201df892 ("ethdev: add stats per queue")

Signed-off-by: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
---
 lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index a9977df..0849016 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2457,6 +2457,16 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
+
+	if (is_rx && (queue_id >= dev->data->nb_rx_queues))
+		return -EINVAL;
+
+	if (!is_rx && (queue_id >= dev->data->nb_tx_queues))
+		return -EINVAL;
+
+	if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
+		return -EINVAL;
+
 	return (*dev->dev_ops->queue_stats_mapping_set)
 			(dev, queue_id, stat_idx, is_rx);
 }
-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] lib/librte_ethdev: Error checking for stats mapping
  2018-07-10 15:26 [dpdk-dev] [PATCH] lib/librte_ethdev: Error checking for stats mapping Kiran Kumar
@ 2018-07-10 15:54 ` Andrew Rybchenko
  2018-07-11  8:41 ` [dpdk-dev] [PATCH v2] ethdev: check queue stats mapping input arguments Kiran Kumar
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Rybchenko @ 2018-07-10 15:54 UTC (permalink / raw)
  To: Kiran Kumar, dev; +Cc: thomas, ferruh.yigit

On 10.07.2018 18:26, Kiran Kumar wrote:
> With current implementation, we are not checking for queue_id range
> and stat_idx range in stats mapping function. This patch will add
> check for queue_id and stat_idx range.
>
> Fixes: 5de201df892 ("ethdev: add stats per queue")
>
> Signed-off-by: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
> ---
>   lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index a9977df..0849016 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -2457,6 +2457,16 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
>   	dev = &rte_eth_devices[port_id];
>   
>   	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
> +
> +	if (is_rx && (queue_id >= dev->data->nb_rx_queues))
> +		return -EINVAL;
> +
> +	if (!is_rx && (queue_id >= dev->data->nb_tx_queues))
> +		return -EINVAL;
> +
> +	if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
> +		return -EINVAL;
> +
>   	return (*dev->dev_ops->queue_stats_mapping_set)
>   			(dev, queue_id, stat_idx, is_rx);
>   }

Summary should be something like:
ethdev: check queue stats mapping input arguments

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] ethdev: check queue stats mapping input arguments
  2018-07-10 15:26 [dpdk-dev] [PATCH] lib/librte_ethdev: Error checking for stats mapping Kiran Kumar
  2018-07-10 15:54 ` Andrew Rybchenko
@ 2018-07-11  8:41 ` Kiran Kumar
  2018-07-13 22:10   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Kiran Kumar @ 2018-07-11  8:41 UTC (permalink / raw)
  To: thomas, ferruh.yigit, arybchenko; +Cc: dev, Kiran Kumar

With current implementation, we are not checking for queue_id range
and stat_idx range in stats mapping function. This patch will add
check for queue_id and stat_idx range.

Fixes: 5de201df892 ("ethdev: add stats per queue")

Signed-off-by: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 v2 changes:
 - changed summery

 lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index a9977df..0849016 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2457,6 +2457,16 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 	dev = &rte_eth_devices[port_id];

 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
+
+	if (is_rx && (queue_id >= dev->data->nb_rx_queues))
+		return -EINVAL;
+
+	if (!is_rx && (queue_id >= dev->data->nb_tx_queues))
+		return -EINVAL;
+
+	if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
+		return -EINVAL;
+
 	return (*dev->dev_ops->queue_stats_mapping_set)
 			(dev, queue_id, stat_idx, is_rx);
 }
--
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] ethdev: check queue stats mapping input arguments
  2018-07-11  8:41 ` [dpdk-dev] [PATCH v2] ethdev: check queue stats mapping input arguments Kiran Kumar
@ 2018-07-13 22:10   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2018-07-13 22:10 UTC (permalink / raw)
  To: Kiran Kumar; +Cc: dev, ferruh.yigit, arybchenko

11/07/2018 10:41, Kiran Kumar:
> With current implementation, we are not checking for queue_id range
> and stat_idx range in stats mapping function. This patch will add
> check for queue_id and stat_idx range.
> 
> Fixes: 5de201df892 ("ethdev: add stats per queue")
> 
> Signed-off-by: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-13 22:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10 15:26 [dpdk-dev] [PATCH] lib/librte_ethdev: Error checking for stats mapping Kiran Kumar
2018-07-10 15:54 ` Andrew Rybchenko
2018-07-11  8:41 ` [dpdk-dev] [PATCH v2] ethdev: check queue stats mapping input arguments Kiran Kumar
2018-07-13 22:10   ` Thomas Monjalon

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).