Message ID | 1450863919-29684-1-git-send-email-bernard.iremonger@intel.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Bruce Richardson |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7DAFF5A0A; Wed, 23 Dec 2015 10:45:26 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 67E2E594B for <dev@dpdk.org>; Wed, 23 Dec 2015 10:45:25 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 23 Dec 2015 01:45:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,468,1444719600"; d="scan'208";a="877352846" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 23 Dec 2015 01:45:23 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id tBN9jMnt023976; Wed, 23 Dec 2015 09:45:22 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id tBN9jM6j029725; Wed, 23 Dec 2015 09:45:22 GMT Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id tBN9jMbR029721; Wed, 23 Dec 2015 09:45:22 GMT From: Bernard Iremonger <bernard.iremonger@intel.com> To: dev@dpdk.org Date: Wed, 23 Dec 2015 09:45:19 +0000 Message-Id: <1450863919-29684-1-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] virtio: fix crashes in virtio stats functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Iremonger, Bernard
Dec. 23, 2015, 9:45 a.m. UTC
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(-)
Comments
> -----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
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
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
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",