DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] virtio: fix crashes in virtio stats functions
@ 2015-12-23  9:45 Bernard Iremonger
  2015-12-23 12:56 ` Ananyev, Konstantin
  2015-12-24  3:48 ` Yuanhan Liu
  0 siblings, 2 replies; 4+ messages in thread
From: Bernard Iremonger @ 2015-12-23  9:45 UTC (permalink / raw)
  To: dev

This initialisation of nb_rx_queues and nb_tx_queues has been removed
from eth_virtio_dev_init.

The nb_rx_queues and nb_tx_queues were being initialised in eth_virtio_dev_init
before the tx_queues and rx_queues arrays were allocated.

The arrays are allocated when the ethdev port is configured and the
nb_tx_queues and nb_rx_queues are initialised.

If any of the following functions were called before the ethdev
port was configured there was a segmentation fault because
rx_queues and tx_queues were NULL:

rte_eth_stats_get
rte_eth_stats_reset
rte_eth_xstats_get
rte_eth_xstats_reset

Fixes: 823ad647950a ("virtio: support multiple queues")
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index d928339..5ef0752 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1378,9 +1378,6 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 		hw->max_tx_queues = 1;
 	}
 
-	eth_dev->data->nb_rx_queues = hw->max_rx_queues;
-	eth_dev->data->nb_tx_queues = hw->max_tx_queues;
-
 	PMD_INIT_LOG(DEBUG, "hw->max_rx_queues=%d   hw->max_tx_queues=%d",
 			hw->max_rx_queues, hw->max_tx_queues);
 	PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
-- 
2.6.3

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

* Re: [dpdk-dev] [PATCH] virtio: fix crashes in virtio stats functions
  2015-12-23  9:45 [dpdk-dev] [PATCH] virtio: fix crashes in virtio stats functions Bernard Iremonger
@ 2015-12-23 12:56 ` Ananyev, Konstantin
  2015-12-24  3:48 ` Yuanhan Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Ananyev, Konstantin @ 2015-12-23 12:56 UTC (permalink / raw)
  To: Iremonger, Bernard, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard Iremonger
> Sent: Wednesday, December 23, 2015 9:45 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] virtio: fix crashes in virtio stats functions
> 
> This initialisation of nb_rx_queues and nb_tx_queues has been removed
> from eth_virtio_dev_init.
> 
> The nb_rx_queues and nb_tx_queues were being initialised in eth_virtio_dev_init
> before the tx_queues and rx_queues arrays were allocated.
> 
> The arrays are allocated when the ethdev port is configured and the
> nb_tx_queues and nb_rx_queues are initialised.
> 
> If any of the following functions were called before the ethdev
> port was configured there was a segmentation fault because
> rx_queues and tx_queues were NULL:
> 
> rte_eth_stats_get
> rte_eth_stats_reset
> rte_eth_xstats_get
> rte_eth_xstats_reset
> 
> Fixes: 823ad647950a ("virtio: support multiple queues")
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index d928339..5ef0752 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1378,9 +1378,6 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
>  		hw->max_tx_queues = 1;
>  	}
> 
> -	eth_dev->data->nb_rx_queues = hw->max_rx_queues;
> -	eth_dev->data->nb_tx_queues = hw->max_tx_queues;
> -
>  	PMD_INIT_LOG(DEBUG, "hw->max_rx_queues=%d   hw->max_tx_queues=%d",
>  			hw->max_rx_queues, hw->max_tx_queues);
>  	PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.6.3

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

* Re: [dpdk-dev] [PATCH] virtio: fix crashes in virtio stats functions
  2015-12-23  9:45 [dpdk-dev] [PATCH] virtio: fix crashes in virtio stats functions Bernard Iremonger
  2015-12-23 12:56 ` Ananyev, Konstantin
@ 2015-12-24  3:48 ` Yuanhan Liu
  2016-02-10 14:23   ` Bruce Richardson
  1 sibling, 1 reply; 4+ messages in thread
From: Yuanhan Liu @ 2015-12-24  3:48 UTC (permalink / raw)
  To: Bernard Iremonger; +Cc: dev

On Wed, Dec 23, 2015 at 09:45:19AM +0000, Bernard Iremonger wrote:
> This initialisation of nb_rx_queues and nb_tx_queues has been removed
> from eth_virtio_dev_init.
> 
> The nb_rx_queues and nb_tx_queues were being initialised in eth_virtio_dev_init
> before the tx_queues and rx_queues arrays were allocated.
> 
> The arrays are allocated when the ethdev port is configured and the
> nb_tx_queues and nb_rx_queues are initialised.
> 
> If any of the following functions were called before the ethdev
> port was configured there was a segmentation fault because
> rx_queues and tx_queues were NULL:
> 
> rte_eth_stats_get
> rte_eth_stats_reset
> rte_eth_xstats_get
> rte_eth_xstats_reset
> 
> Fixes: 823ad647950a ("virtio: support multiple queues")
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>

Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>

Thanks.

	--yliu

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

* Re: [dpdk-dev] [PATCH] virtio: fix crashes in virtio stats functions
  2015-12-24  3:48 ` Yuanhan Liu
@ 2016-02-10 14:23   ` Bruce Richardson
  0 siblings, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2016-02-10 14:23 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dev

On Thu, Dec 24, 2015 at 11:48:41AM +0800, Yuanhan Liu wrote:
> On Wed, Dec 23, 2015 at 09:45:19AM +0000, Bernard Iremonger wrote:
> > This initialisation of nb_rx_queues and nb_tx_queues has been removed
> > from eth_virtio_dev_init.
> > 
> > The nb_rx_queues and nb_tx_queues were being initialised in eth_virtio_dev_init
> > before the tx_queues and rx_queues arrays were allocated.
> > 
> > The arrays are allocated when the ethdev port is configured and the
> > nb_tx_queues and nb_rx_queues are initialised.
> > 
> > If any of the following functions were called before the ethdev
> > port was configured there was a segmentation fault because
> > rx_queues and tx_queues were NULL:
> > 
> > rte_eth_stats_get
> > rte_eth_stats_reset
> > rte_eth_xstats_get
> > rte_eth_xstats_reset
> > 
> > Fixes: 823ad647950a ("virtio: support multiple queues")
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> 
> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> 
> Thanks.
> 
> 	--yliu

Applied to dpdk-next-net/rel_16_04

/Bruce

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

end of thread, other threads:[~2016-02-10 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-23  9:45 [dpdk-dev] [PATCH] virtio: fix crashes in virtio stats functions Bernard Iremonger
2015-12-23 12:56 ` Ananyev, Konstantin
2015-12-24  3:48 ` Yuanhan Liu
2016-02-10 14:23   ` Bruce Richardson

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