From patchwork Tue Nov 3 13:01:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Iremonger, Bernard" X-Patchwork-Id: 8578 Return-Path: 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 B900D91A1; Tue, 3 Nov 2015 14:02:29 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 656C98F9B for ; Tue, 3 Nov 2015 14:02:27 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 03 Nov 2015 05:02:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,238,1444719600"; d="scan'208";a="593168948" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 03 Nov 2015 05:02:12 -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 tA3D2BYq011912; Tue, 3 Nov 2015 13:02:11 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id tA3D2Bua019614; Tue, 3 Nov 2015 13:02:11 GMT Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id tA3D2BvJ019609; Tue, 3 Nov 2015 13:02:11 GMT From: Bernard Iremonger To: dev@dpdk.org Date: Tue, 3 Nov 2015 13:01:57 +0000 Message-Id: <1446555725-19540-4-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1446555725-19540-1-git-send-email-bernard.iremonger@intel.com> References: <1446555725-19540-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v8 03/11] vdev: copy device info to eth_dev data X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" initialise dev_flags, driver, kdrv, drv_name and numa_node fields in eth_dev data. for the following vdevs: null ring pcap af_packet xenvirt mpipe bonding Signed-off-by: Bernard Iremonger Acked-by: Bruce Richardson --- drivers/net/af_packet/rte_eth_af_packet.c | 12 ++++++++---- drivers/net/bonding/rte_eth_bond_api.c | 11 +++++++++-- drivers/net/mpipe/mpipe_tilegx.c | 7 +++++++ drivers/net/null/rte_eth_null.c | 13 +++++++++---- drivers/net/pcap/rte_eth_pcap.c | 13 ++++++++----- drivers/net/ring/rte_eth_ring.c | 13 ++++++++----- drivers/net/xenvirt/rte_eth_xenvirt.c | 8 ++++++-- 7 files changed, 55 insertions(+), 22 deletions(-) diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index bfde661..2f14482 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -5,7 +5,7 @@ * * Originally based upon librte_pmd_pcap code: * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * Copyright(c) 2014 6WIND S.A. * All rights reserved. * @@ -656,8 +656,8 @@ rte_pmd_init_internals(const char *name, /* * now put it all together * - store queue data in internals, - * - store numa_node info in pci_driver - * - point eth_dev_data to internals and pci_driver + * - store numa_node in eth_dev + * - point eth_dev_data to internals * - and point eth_dev structure to new eth_dev_data structure */ @@ -674,7 +674,11 @@ rte_pmd_init_internals(const char *name, (*eth_dev)->data = data; (*eth_dev)->dev_ops = &ops; - (*eth_dev)->pci_dev = pci_dev; + (*eth_dev)->driver = NULL; + (*eth_dev)->data->dev_flags = 0; + (*eth_dev)->data->drv_name = drivername; + (*eth_dev)->data->kdrv = RTE_KDRV_NONE; + (*eth_dev)->data->numa_node = numa_node; return 0; diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 92073df..34adbde 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -44,6 +44,8 @@ #define DEFAULT_POLLING_INTERVAL_10_MS (10) +const char pmd_bond_driver_name[] = "rte_bond_pmd"; + int valid_bonded_ethdev(const struct rte_eth_dev *eth_dev) { @@ -163,8 +165,6 @@ number_of_sockets(void) return ++sockets; } -const char pmd_bond_driver_name[] = "rte_bond_pmd"; - static struct rte_pci_id pci_id_table = { .device_id = PCI_ANY_ID, .subsystem_device_id = PCI_ANY_ID, @@ -252,6 +252,13 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) eth_dev->dev_ops = &default_dev_ops; eth_dev->pci_dev = pci_dev; + eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC | + RTE_ETH_DEV_DETACHABLE; + eth_dev->driver = NULL; + eth_dev->data->kdrv = RTE_KDRV_NONE; + eth_dev->data->drv_name = pmd_bond_driver_name; + eth_dev->data->numa_node = socket_id; + rte_spinlock_init(&internals->lock); internals->port_id = eth_dev->data->port_id; diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c index 6e3e304..4dc32f7 100644 --- a/drivers/net/mpipe/mpipe_tilegx.c +++ b/drivers/net/mpipe/mpipe_tilegx.c @@ -80,6 +80,7 @@ struct mpipe_context { static struct mpipe_context mpipe_contexts[GXIO_MPIPE_INSTANCE_MAX]; static int mpipe_instances; +static const char *drivername = "MPIPE PMD"; /* Per queue statistics. */ struct mpipe_queue_stats { @@ -1595,6 +1596,12 @@ rte_pmd_mpipe_devinit(const char *ifname, eth_dev->pci_dev = &priv->pci_dev; eth_dev->data->mac_addrs = &priv->mac_addr; + eth_dev->data->dev_flags = 0; + eth_dev->data->kdrv = RTE_KDRV_NONE; + eth_dev->driver = NULL; + eth_dev->data->drv_name = drivername; + eth_dev->data->numa_node = instance; + eth_dev->dev_ops = &mpipe_dev_ops; eth_dev->rx_pkt_burst = &mpipe_recv_pkts; eth_dev->tx_pkt_burst = &mpipe_xmit_pkts; diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 64e9000..11d6037 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -540,8 +540,8 @@ eth_dev_null_create(const char *name, /* now put it all together * - store queue data in internals, - * - store numa_node info in pci_driver - * - point eth_dev_data to internals and pci_driver + * - store numa_node info in ethdev data + * - point eth_dev_data to internals * - and point eth_dev structure to new eth_dev_data structure */ /* NOTE: we'll replace the data element, of originally allocated eth_dev @@ -571,10 +571,15 @@ eth_dev_null_create(const char *name, eth_dev->data = data; eth_dev->dev_ops = &ops; - eth_dev->pci_dev = pci_dev; - eth_dev->driver = &rte_null_pmd; + TAILQ_INIT(ð_dev->link_intr_cbs); + eth_dev->driver = NULL; + eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + eth_dev->data->kdrv = RTE_KDRV_NONE; + eth_dev->data->drv_name = drivername; + eth_dev->data->numa_node = numa_node; + /* finally assign rx and tx ops */ if (packet_copy) { eth_dev->rx_pkt_burst = eth_null_copy_rx; diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index f2e4634..850274c 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * Copyright(c) 2014 6WIND S.A. * All rights reserved. * @@ -845,8 +845,8 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues, /* now put it all together * - store queue data in internals, - * - store numa_node info in pci_driver - * - point eth_dev_data to internals and pci_driver + * - store numa_node info in eth_dev + * - point eth_dev_data to internals * - and point eth_dev structure to new eth_dev_data structure */ /* NOTE: we'll replace the data element, of originally allocated eth_dev @@ -874,8 +874,11 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues, (*eth_dev)->data = data; (*eth_dev)->dev_ops = &ops; - (*eth_dev)->pci_dev = pci_dev; - (*eth_dev)->driver = &rte_pcap_pmd; + (*eth_dev)->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + (*eth_dev)->driver = NULL; + (*eth_dev)->data->kdrv = RTE_KDRV_NONE; + (*eth_dev)->data->drv_name = drivername; + (*eth_dev)->data->numa_node = numa_node; return 0; diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 0ba36d5..77ac23a 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -304,11 +304,10 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], if (eth_dev == NULL) goto error; - /* now put it all together * - store queue data in internals, - * - store numa_node info in pci_driver - * - point eth_dev_data to internals and pci_driver + * - store numa_node info in eth_dev_data + * - point eth_dev_data to internals * - and point eth_dev structure to new eth_dev_data structure */ /* NOTE: we'll replace the data element, of originally allocated eth_dev @@ -338,9 +337,13 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], data->mac_addrs = &internals->address; eth_dev->data = data; - eth_dev->driver = &rte_ring_pmd; + eth_dev->driver = NULL; eth_dev->dev_ops = &ops; - eth_dev->pci_dev = pci_dev; + eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + eth_dev->data->kdrv = RTE_KDRV_NONE; + eth_dev->data->drv_name = drivername; + eth_dev->data->numa_node = numa_node; + TAILQ_INIT(&(eth_dev->link_intr_cbs)); /* finally assign rx and tx ops */ diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c index b527552..6f9d96f 100644 --- a/drivers/net/xenvirt/rte_eth_xenvirt.c +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c @@ -67,7 +67,7 @@ /* virtio_idx is increased after new device is created.*/ static int virtio_idx = 0; -static const char *drivername = "xen dummy virtio PMD"; +static const char *drivername = "xen virtio PMD"; static struct rte_eth_link pmd_link = { .link_speed = 10000, @@ -688,8 +688,12 @@ eth_dev_xenvirt_create(const char *name, const char *params, eth_dev->data = data; eth_dev->dev_ops = &ops; + eth_dev->data->dev_flags = RTE_PCI_DRV_DETACHABLE; - eth_dev->pci_dev = pci_dev; + eth_dev->data->kdrv = RTE_KDRV_NONE; + eth_dev->data->drv_name = drivername; + eth_dev->driver = NULL; + eth_dev->data->numa_node = numa_node; eth_dev->rx_pkt_burst = eth_xenvirt_rx; eth_dev->tx_pkt_burst = eth_xenvirt_tx;