Skip to contentSkip to conversation

virtio: fix crashes in virtio stats functions

PATCH Applied Bernard Iremonger 4 participants 4 messages Dec 23, 2015 – Feb 10, 2016 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/net/virtio/virtio_ethdev.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/virtio/virtio_ethdev.c +0 -3
index d928339..5ef0752 100644
@@ -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",
Signature · 1 line
2.6.3
Acked-by on v1 1/1
#1 lore raw
Quoted 37 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bernard Iremonger
Sent: Wednesday, December 23, 2015 9:45 AM
To: [email protected]
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")
---
 drivers/net/virtio/virtio_ethdev.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/virtio/virtio_ethdev.c +0 -0
index d928339..5ef0752 100644

drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev)

Quoted 10 lines
drivers/net/virtio/virtio_ethdev.c +0 -4
@@ -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",
--
Quoted 1 line

2.6.3

Acked-by on v1 1/1
#2 lore raw
In reply to Bernard Iremonger
Quoted 13 lines · Bernard Iremonger

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:

Quoted 7 lines

rte_eth_stats_get
rte_eth_stats_reset
rte_eth_xstats_get
rte_eth_xstats_reset

Fixes 823ad647950a ("virtio: support multiple queues")

Thanks.

	--yliu
#3 lore raw
Quoted 19 lines · Yuanhan Liu
Quoted 18 lines · Bernard Iremonger

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

Quoted 8 lines
Quoted 2 lines
Fixes 823ad647950a ("virtio: support multiple queues")

Thanks.

	--yliu

Applied to dpdk-next-net/rel_16_04

/Bruce