From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-f193.google.com (mail-oi1-f193.google.com [209.85.167.193]) by dpdk.org (Postfix) with ESMTP id EF4CF1B16F for ; Fri, 12 Oct 2018 10:32:46 +0200 (CEST) Received: by mail-oi1-f193.google.com with SMTP id v69-v6so9285091oif.1 for ; Fri, 12 Oct 2018 01:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netcope.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+9wUFpPyQKXnMIFV4B6kokW4g9RgQng9UgMGDWlB2b4=; b=oqSBGczCzkHpIWXKF4MRQknOD3bAxf7vPrAu++MtlKnB5s5O4K+Fwi7MB9iiMWF7Ra lPfvV+sCasvdx/D5OOfRYV5ZKdvYhrKSXVUToMFKogKesDfOHhLhWggSkOrYi8AjxvK/ /SaYwp913up3jz8YaqJy1q8qeAQocRWWsIEtF+CPDKqnchKVnUG2eSZCzckpY3nU71jq yhoYil5T/WyZi0TuShswMNtLrba+QJv+cxcr83NN8Ksl5+3jaev8TQZEeCoWESPGHseY xIHQblMfp7YNc5RwBPsxntkpDugN1Mq4UV/7k2xy+tz+a4IuPxQRQWgpLwnCW1DGz05D DOOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+9wUFpPyQKXnMIFV4B6kokW4g9RgQng9UgMGDWlB2b4=; b=YLZaVnBXuoBhYigwAlXN7K9cs9Pjll1GY/bV/NXlnz8mtUXZd5RDy33jBzR0rkEkZ0 BOinJ7BlU2vBck/HpysijSC/cc43BpXU83J7gN/WjOVVOfWBItg4FC5O5hE1BRIFTUjD 8RTwEuGeq9ZuoqNW01EAn45jJpyolpumOkQiCwD1d71D7JYd8cMm7GZDq1t/mFly+qCw FkmlflTtmkPk90loa3UpKVo8/t5KkHtImMPJKfjXaafPvQuWlStAG4k47gvRi2+AiGaX qp565l/3iKU1CbROghMAx9cRjh16BLcr4FbSYnpYw6EB+wYIZjKmFdS6J58TNJEViNgn 44Xg== X-Gm-Message-State: ABuFfojSoQCZHfm72ccCXBw/WNXqJyFHH3YZBvfqxpCMapfmjUDO8fnI Vea7/SFR3BXMPIiq+PA8bfyZWS+5cHeml1VJUKBSiA== X-Google-Smtp-Source: ACcGV60D3sgp8eutqNmfSOYnMhQcI84YPcJsHl5+7OH8HxjWJfX1elYMOkEJK/uOUjvo9C2G6nWpLBodmqdsIcEi/J4= X-Received: by 2002:aca:508f:: with SMTP id e137-v6mr2795763oib.73.1539333166025; Fri, 12 Oct 2018 01:32:46 -0700 (PDT) MIME-Version: 1.0 References: <20180907230958.21402-1-thomas@monjalon.net> <20181011210251.7705-1-thomas@monjalon.net> <20181011210251.7705-3-thomas@monjalon.net> <14058760-a35c-c991-74c1-8a86b39df5b0@solarflare.com> In-Reply-To: <14058760-a35c-c991-74c1-8a86b39df5b0@solarflare.com> From: =?UTF-8?Q?Jan_Reme=C5=A1?= Date: Fri, 12 Oct 2018 10:32:34 +0200 Message-ID: To: arybchenko@solarflare.com Cc: Thomas Monjalon , dev@dpdk.org, gaetan.rivet@6wind.com, ophirmu@mellanox.com, qi.z.zhang@intel.com, Ferruh Yigit , shahafs@mellanox.com, yskoh@mellanox.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v4 2/4] drivers/bus: move driver assignment to end of probing 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: Fri, 12 Oct 2018 08:32:47 -0000 Hi Andrew, 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 mapping") > > > > 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_szedata2.c > rte_szedata2_eth_dev_init() which is used from probe? > for szedata2, this is easily fixed by using the driver name directly from the #define above. 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(); PMD_INIT_LOG(INFO, "Initializing eth_dev %s (driver %s)", data->name, - dev->device->driver->name); + RTE_STR(RTE_SZEDATA2_DRIVER_NAME)); /* Fill internal private structure. */ internals->dev = dev; @@ -1525,7 +1525,7 @@ struct szedata2_tx_queue { ether_addr_copy(ð_addr, data->mac_addrs); PMD_INIT_LOG(INFO, "%s device %s successfully initialized", - dev->device->driver->name, data->name); + RTE_STR(RTE_SZEDATA2_DRIVER_NAME), data->name); return 0; } @@ -1547,7 +1547,7 @@ struct szedata2_tx_queue { rte_free(dev->data->mac_addrs); PMD_DRV_LOG(INFO, "%s device %s successfully uninitialized", - dev->device->driver->name, dev->data->name); + RTE_STR(RTE_SZEDATA2_DRIVER_NAME), dev->data->name); return 0; } > It looks like drivers/net/mlx5/mlx5.c > mlx5_pci_probe()->mlx5_dev_spawn()->mlx5_dev_to_port_id() goes > to device->driver. Is the code OK with the move? > > I've added above drivers maintainers in CC. Jan