From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f181.google.com (mail-wr0-f181.google.com [209.85.128.181]) by dpdk.org (Postfix) with ESMTP id 7C654567C for ; Tue, 6 Jun 2017 17:31:38 +0200 (CEST) Received: by mail-wr0-f181.google.com with SMTP id g76so55890952wrd.1 for ; Tue, 06 Jun 2017 08:31:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=eA/SHf1tPY+vhqGqtuxdOft1zPxEfN37fbE76BCrg8U=; b=hUGP0obPCw3epO/DzwB5uHz9oNzxbmV+QVLgpYQVa4/Tmky4Lm3oGU01s8+lTqbfKq zdWA/SiMiQhb6FGwbaeniE13ZHDtft+KTGkPm+6cANS5HXnyKzjDoCxLtKI4ngi9QK9D sIWa0C+9vMGJWv6k4dMEIsLWqcOoOiGUX8ZrARpco/Z1ssUsvCEZERmDWtqd+k1ZaIEK HZaWFdjWHp2s8bw6bkbQy/K4j89qzT93SIxe+cOcEogpSV8QHZFzmIR7TxXz7iyBAGUL EYJBnvEdIla7GLTvgVbrcvYoNviuaHpQPZ3QCquWWxUeOHaHNueQ0LvnLVUXNl7RwCLx 5t3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=eA/SHf1tPY+vhqGqtuxdOft1zPxEfN37fbE76BCrg8U=; b=LmkJdb2GumN67WYnMUtHIwhK9PTAJmZYFIcQ0w34bmPX7HJNA5TfP7X2jhCR/u5aRj +tboNrVWiCNdxWPXAAu0nQRf22yiuo4PARIr9BEM9nCuIQodreWKxNqbXf+rdyHp849a XM02IjBf2+/GiXTbFJ1BQ8MqRyEYg7uK4S/9zN537k6ZOgTMn1IJZ6VhoJdiNu/l6iTl FbzqgdAWiy6oq1s5pm3+tOiFbOTPMZivduY9eyLlqWv8e8cVFtfJ4YLIwjEmyoeNcYg2 ST50hASOgRN1iP1S5Lz72RmqDDsaiMIqSuU8qFgB3P7lpY7/QREed9/M90OS0z/98Jae /4GQ== X-Gm-Message-State: AODbwcD618U38djL0r7UAlrvrlxNxgKEhhbelzb4l6QPVhAas9Rxe1Og hE7wB3BWyhuvn3ti X-Received: by 10.223.169.138 with SMTP id b10mr12020281wrd.29.1496763097887; Tue, 06 Jun 2017 08:31:37 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id r142sm2971984wmg.24.2017.06.06.08.31.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 08:31:37 -0700 (PDT) Date: Tue, 6 Jun 2017 17:31:31 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Ferruh Yigit Cc: Stephen Hurd , Ajit Khaparde , Declan Doherty , Rahul Lakkireddy , Hemant Agrawal , Shreyansh Jain , Helin Zhang , Jingjing Wu , Wenzhuo Lu , Konstantin Ananyev , Bruce Richardson , Pascal Mazon , Shrikrishna Khare , Jianfeng Tan , Thomas Monjalon , dev@dpdk.org, Jan Blunck Message-ID: <20170606153130.GN18840@bidouze.vm.6wind.com> References: <20170526111502.92063-1-ferruh.yigit@intel.com> <20170606151008.62680-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170606151008.62680-1-ferruh.yigit@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2] ethdev: remove driver name from device private data X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jun 2017 15:31:38 -0000 Hi Ferruh, On Tue, Jun 06, 2017 at 04:10:08PM +0100, Ferruh Yigit wrote: > rte_driver->name has the driver name and all physical and virtual > devices has access to it. > > Previously it was not possible for virtual ethernet devices to access > rte_driver->name field (because eth_dev used to keep only pci_dev), > and it was required to save driver name in the device private struct. > > After re-works on bus and vdev, it is possible for all bus types to > access rte_driver. > > It is able to remove the driver name from ethdev device private data and > use eth_dev->device->driver->name. > > Signed-off-by: Ferruh Yigit > --- > Cc: Gaetan Rivet > Cc: Jan Blunck > I'm not sure I am the one who should give his opinion on this, I only took the work from Jan and ported it for integration. However, as far as I am concerned, I agree with this change. > v2: > * rebase on latest next-net > --- > drivers/net/bnxt/bnxt_ethdev.c | 2 +- > drivers/net/bonding/rte_eth_bond_api.c | 4 ++-- > drivers/net/cxgbe/sge.c | 6 +++--- > drivers/net/dpaa2/dpaa2_ethdev.c | 1 - > drivers/net/i40e/i40e_ethdev.c | 3 +-- > drivers/net/i40e/i40e_fdir.c | 2 +- > drivers/net/ixgbe/ixgbe_ethdev.c | 2 +- > drivers/net/ring/rte_eth_ring.c | 1 - > drivers/net/tap/rte_eth_tap.c | 1 - > drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +- > drivers/net/xenvirt/rte_eth_xenvirt.c | 1 - > lib/librte_ether/rte_ethdev.c | 8 ++++---- > lib/librte_ether/rte_ethdev.h | 1 - > lib/librte_ether/rte_ethdev_pci.h | 1 - > lib/librte_ether/rte_ethdev_vdev.h | 1 - > 15 files changed, 14 insertions(+), 22 deletions(-) > > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index f9bedf7..15195c3 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -1940,7 +1940,7 @@ static struct rte_pci_driver bnxt_rte_pmd = { > static bool > is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv) > { > - if (strcmp(dev->data->drv_name, drv->driver.name)) > + if (strcmp(dev->device->driver->name, drv->driver.name)) > return false; > > return true; > diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c > index 36ec65d..164eb59 100644 > --- a/drivers/net/bonding/rte_eth_bond_api.c > +++ b/drivers/net/bonding/rte_eth_bond_api.c > @@ -48,11 +48,11 @@ int > check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev) > { > /* Check valid pointer */ > - if (eth_dev->data->drv_name == NULL) > + if (eth_dev->device->driver->name == NULL) > return -1; > > /* return 0 if driver name matches */ > - return eth_dev->data->drv_name != pmd_bond_drv.driver.name; > + return eth_dev->device->driver->name != pmd_bond_drv.driver.name; > } > > int > diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c > index 9cbd4ec..d088065 100644 > --- a/drivers/net/cxgbe/sge.c > +++ b/drivers/net/cxgbe/sge.c > @@ -1691,7 +1691,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, > iq->size = cxgbe_roundup(iq->size, 16); > > snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", > - eth_dev->data->drv_name, > + eth_dev->device->driver->name, > fwevtq ? "fwq_ring" : "rx_ring", > eth_dev->data->port_id, queue_id); > snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name); > @@ -1745,7 +1745,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, > fl->size = cxgbe_roundup(fl->size, 8); > > snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", > - eth_dev->data->drv_name, > + eth_dev->device->driver->name, > fwevtq ? "fwq_ring" : "fl_ring", > eth_dev->data->port_id, queue_id); > snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name); > @@ -1945,7 +1945,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, > nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc); > > snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", > - eth_dev->data->drv_name, "tx_ring", > + eth_dev->device->driver->name, "tx_ring", > eth_dev->data->port_id, queue_id); > snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name); > > diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c > index 4de1e0c..da309ac 100644 > --- a/drivers/net/dpaa2/dpaa2_ethdev.c > +++ b/drivers/net/dpaa2/dpaa2_ethdev.c > @@ -1464,7 +1464,6 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) > } > > eth_dev->dev_ops = &dpaa2_ethdev_ops; > - eth_dev->data->drv_name = rte_dpaa2_pmd.driver.name; > > eth_dev->rx_pkt_burst = dpaa2_dev_prefetch_rx; > eth_dev->tx_pkt_burst = dpaa2_dev_tx; > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index 2f1cd85..078a808 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -10738,8 +10738,7 @@ i40e_filter_restore(struct i40e_pf *pf) > static bool > is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv) > { > - if (strcmp(dev->data->drv_name, > - drv->driver.name)) > + if (strcmp(dev->device->driver->name, drv->driver.name)) > return false; > > return true; > diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c > index 9c1ab6e..77c23e0 100644 > --- a/drivers/net/i40e/i40e_fdir.c > +++ b/drivers/net/i40e/i40e_fdir.c > @@ -256,7 +256,7 @@ i40e_fdir_setup(struct i40e_pf *pf) > > /* reserve memory for the fdir programming packet */ > snprintf(z_name, sizeof(z_name), "%s_%s_%d", > - eth_dev->data->drv_name, > + eth_dev->device->driver->name, > I40E_FDIR_MZ_NAME, > eth_dev->data->port_id); > mz = i40e_memzone_reserve(z_name, I40E_FDIR_PKT_LEN, SOCKET_ID_ANY); > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index 504e951..ebc5467 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -4659,7 +4659,7 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) > static bool > is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv) > { > - if (strcmp(dev->data->drv_name, drv->driver.name)) > + if (strcmp(dev->device->driver->name, drv->driver.name)) > return false; > > return true; > diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c > index d4dce95..bb5e322 100644 > --- a/drivers/net/ring/rte_eth_ring.c > +++ b/drivers/net/ring/rte_eth_ring.c > @@ -342,7 +342,6 @@ do_eth_dev_ring_create(const char *name, > eth_dev->dev_ops = &ops; > data->dev_flags = RTE_ETH_DEV_DETACHABLE; > data->kdrv = RTE_KDRV_NONE; > - data->drv_name = pmd_ring_drv.driver.name; > data->numa_node = numa_node; > > /* finally assign rx and tx ops */ > diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c > index 1bb660e..305f018 100644 > --- a/drivers/net/tap/rte_eth_tap.c > +++ b/drivers/net/tap/rte_eth_tap.c > @@ -1220,7 +1220,6 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name, > data->dev_private = pmd; > data->dev_flags = RTE_ETH_DEV_DETACHABLE | RTE_ETH_DEV_INTR_LSC; > data->numa_node = numa_node; > - data->drv_name = pmd_tap_drv.driver.name; > > data->dev_link = pmd_link; > data->mac_addrs = &pmd->eth_addr; > diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c > index ee48a9e..292a671 100644 > --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c > +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c > @@ -141,7 +141,7 @@ gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t size, > const struct rte_memzone *mz; > > snprintf(z_name, sizeof(z_name), "%s_%d_%s", > - dev->data->drv_name, dev->data->port_id, post_string); > + dev->device->driver->name, dev->data->port_id, post_string); > > mz = rte_memzone_lookup(z_name); > if (!reuse) { > diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c > index 7bd29fa..e404b77 100644 > --- a/drivers/net/xenvirt/rte_eth_xenvirt.c > +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c > @@ -672,7 +672,6 @@ eth_dev_xenvirt_create(const char *name, const char *params, > > eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; > eth_dev->data->kdrv = RTE_KDRV_NONE; > - eth_dev->data->drv_name = pmd_xenvirt_drv.driver.name; > eth_dev->data->numa_node = numa_node; > > eth_dev->rx_pkt_burst = eth_xenvirt_rx; > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index d257406..f5378a4 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -753,13 +753,13 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, > if ((dev_conf->intr_conf.lsc == 1) && > (!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC))) { > RTE_PMD_DEBUG_TRACE("driver %s does not support lsc\n", > - dev->data->drv_name); > + dev->device->driver->name); > return -EINVAL; > } > if ((dev_conf->intr_conf.rmv == 1) && > (!(dev->data->dev_flags & RTE_ETH_DEV_INTR_RMV))) { > RTE_PMD_DEBUG_TRACE("driver %s does not support rmv\n", > - dev->data->drv_name); > + dev->device->driver->name); > return -EINVAL; > } > > @@ -1900,7 +1900,7 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info) > > RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); > (*dev->dev_ops->dev_infos_get)(dev, dev_info); > - dev_info->driver_name = dev->data->drv_name; > + dev_info->driver_name = dev->device->driver->name; > dev_info->nb_rx_queues = dev->data->nb_rx_queues; > dev_info->nb_tx_queues = dev->data->nb_tx_queues; > } > @@ -2789,7 +2789,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, > const struct rte_memzone *mz; > > snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", > - dev->data->drv_name, ring_name, > + dev->device->driver->name, ring_name, > dev->data->port_id, queue_id); > > mz = rte_memzone_lookup(z_name); > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index b9fd8d3..05ae574 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -1674,7 +1674,6 @@ struct rte_eth_dev_data { > uint32_t dev_flags; /**< Capabilities */ > enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */ > int numa_node; /**< NUMA node connection */ > - const char *drv_name; /**< Driver name */ > }; > > /** Device supports hotplug detach */ > diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h > index d3bc03c..69aab03 100644 > --- a/lib/librte_ether/rte_ethdev_pci.h > +++ b/lib/librte_ether/rte_ethdev_pci.h > @@ -69,7 +69,6 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, > > eth_dev->data->kdrv = pci_dev->kdrv; > eth_dev->data->numa_node = pci_dev->device.numa_node; > - eth_dev->data->drv_name = pci_dev->driver->driver.name; > } > > /** > diff --git a/lib/librte_ether/rte_ethdev_vdev.h b/lib/librte_ether/rte_ethdev_vdev.h > index fa2cb61..4d2c3e2 100644 > --- a/lib/librte_ether/rte_ethdev_vdev.h > +++ b/lib/librte_ether/rte_ethdev_vdev.h > @@ -77,7 +77,6 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size) > > eth_dev->data->kdrv = RTE_KDRV_NONE; > eth_dev->data->numa_node = dev->device.numa_node; > - eth_dev->data->drv_name = dev->device.driver->name; > return eth_dev; > } > > -- > 2.9.3 > -- Gaëtan Rivet 6WIND