From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v4 2/4] drivers/bus: move driver assignment to end of probing Date: Fri, 12 Oct 2018 12:45:33 +0200 Message-ID: <2747410.AD2BYnryfn@xps> References: <20180907230958.21402-1-thomas@monjalon.net> <14058760-a35c-c991-74c1-8a86b39df5b0@solarflare.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org, gaetan.rivet@6wind.com, ophirmu@mellanox.com, qi.z.zhang@intel.com, Ferruh Yigit , shahafs@mellanox.com, yskoh@mellanox.com To: Jan =?utf-8?B?UmVtZcWh?= , arybchenko@solarflare.com Return-path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id E08491B4EC for ; Fri, 12 Oct 2018 12:45:42 +0200 (CEST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 12/10/2018 10:32, Jan Reme=C5=A1: > Hi Andrew, >=20 > On Fri, Oct 12, 2018 at 9:45 AM Andrew Rybchenko > wrote: > > > > Hi, Thomas, > > > > On 10/12/18 12:02 AM, Thomas Monjalon wrote: > > > The PCI mapping requires to know the PCI driver to use, > > > even before the probing is done. That's why the PCI driver is > > > referenced early inside the PCI device structure. See > > > commit 1d20a073fa5e ("bus/pci: reference driver structure before mapp= ing") > > > > > > However the rte_driver does not need to be referenced in rte_device > > > before the device probing is done. > > > By moving back this assignment at the end of the device probing, > > > it becomes possible to make clear the status of a rte_device. > > > > > > Signed-off-by: Thomas Monjalon > > > Reviewed-by: Andrew Rybchenko > > > > Have you seen driver->name usage in drivers/net/szedata2/rte_eth_szedat= a2.c > > rte_szedata2_eth_dev_init() which is used from probe? > > >=20 > for szedata2, this is easily fixed by using the driver name directly > from the #define above. >=20 > diff --git a/drivers/net/szedata2/rte_eth_szedata2.c > b/drivers/net/szedata2/rte_eth_szedata2.c > index 8f92e72..4e5e01c 100644 > --- a/drivers/net/szedata2/rte_eth_szedata2.c > +++ b/drivers/net/szedata2/rte_eth_szedata2.c > @@ -1474,7 +1474,7 @@ struct szedata2_tx_queue { > PMD_INIT_FUNC_TRACE(); >=20 > PMD_INIT_LOG(INFO, "Initializing eth_dev %s (driver %s)", data->n= ame, > - dev->device->driver->name); > + RTE_STR(RTE_SZEDATA2_DRIVER_NAME)); >=20 > /* Fill internal private structure. */ > internals->dev =3D dev; > @@ -1525,7 +1525,7 @@ struct szedata2_tx_queue { > ether_addr_copy(ð_addr, data->mac_addrs); >=20 > PMD_INIT_LOG(INFO, "%s device %s successfully initialized", > - dev->device->driver->name, data->name); > + RTE_STR(RTE_SZEDATA2_DRIVER_NAME), data->name); >=20 > return 0; > } > @@ -1547,7 +1547,7 @@ struct szedata2_tx_queue { > rte_free(dev->data->mac_addrs); >=20 > PMD_DRV_LOG(INFO, "%s device %s successfully uninitialized", > - dev->device->driver->name, dev->data->name); > + RTE_STR(RTE_SZEDATA2_DRIVER_NAME), dev->data->nam= e); >=20 > return 0; > } OK, I'll include such change in next version.