From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by dpdk.org (Postfix) with ESMTP id D77F61B59A for ; Fri, 29 Jun 2018 14:17:26 +0200 (CEST) Received: by mail-lf0-f67.google.com with SMTP id j26-v6so6644243lfb.11 for ; Fri, 29 Jun 2018 05:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K2dHxLVizsecchLPAUNv+n6dRKmElQ/u1z1COViFIVA=; b=R5ACgpRvCJMocWmFNM62kVa4y4vUtw6Pf76NEmYf4bgiLCrAHsamSb4Ays+7OIRhat YztMvtBxWu7fCS5LDSICau9gwsYwhuJYzhZ3WGgMA4TQL9Ze6Yv0qveVcGSdd33HpcHX 1iRNo77M3TSAj+nKpwfn70HT9bZy5j3OSr0Wkn68EgsbfwKYqsi8cuYEvYyAz56wzIjH ZU3JcWE2zxFbzFYJbHZNGxNfkDBLuIcvyWmLVIc2xZNZycRNnSdY1JCtqI3Fp+deGf6t o+8URgj8ckRnjTsOSYibHaz6JTB0BVjmH9ESsXSlBAr9wNe+U7t2dsv7VXkABrH/Nw+v hLgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K2dHxLVizsecchLPAUNv+n6dRKmElQ/u1z1COViFIVA=; b=uVxUZR4lT9/cgc6VPDtokCfPAh5or/J0Xj8knVZO0bi8sTDSFwaP4Sui+cSGu7U6cN TvEonin43konvxR5a7dVmEoXIJdAavzmM8hczz5hecmOsLzoqULH2u12vKFAFiy5opmC D1rw1GHp4txHplU/UHk2KFAM9nqGxPAEM3j/sLTRmCSKxhBBCHum4kFAxrke20twIBWR 0HjrvtlqVt5pXammYAHNU7atvMEq+qci6wroAeN3vudz1IBqcwpCu+xixRujupbV8kkT nR7OuIcrdvQcjh74ozxUbPqUTv22p4kXFb0yfXbO/UZhZmaobUurSNZYdrsRmGaxFvmt 91Hw== X-Gm-Message-State: APt69E162VH70QSjMd/RUH6Rx37mHgpU45m/a886olr3NUX/gfFBB2u/ zgBsNoOYPwxWPy8kNVigEQi5EK4thVfQXg== X-Google-Smtp-Source: AAOMgpcLT3NyIIqZ2r6/o/l8tkJf6oQc1+VjVoG4dQCdtKNErMRj4obx3DPCDWoJ60uoKj1+ef1IWQ== X-Received: by 2002:a19:ca09:: with SMTP id a9-v6mr339302lfg.142.1530274645571; Fri, 29 Jun 2018 05:17:25 -0700 (PDT) Received: from rafalkozik.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id r21-v6sm1527333lja.92.2018.06.29.05.17.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jun 2018 05:17:24 -0700 (PDT) From: Rafal Kozik To: dev@dpdk.org Cc: mw@semihalf.com, mk@semihalf.com, gtzalik@amazon.com, evgenys@amazon.com, matua@amazon.com, igorch@amazon.com, thomas@monjalon.net, ferruh.yigit@intel.com, Kozik Date: Fri, 29 Jun 2018 14:17:15 +0200 Message-Id: <1530274637-10156-3-git-send-email-rk@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530274637-10156-1-git-send-email-rk@semihalf.com> References: <1530267873-7236-2-git-send-email-rk@semihalf.com> <1530274637-10156-1-git-send-email-rk@semihalf.com> Subject: [dpdk-dev] [PATCH v4 2/4] bus/pci: reference driver structure 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, 29 Jun 2018 12:17:27 -0000 From: Kozik Add pointer to driver structure before calling rte_pci_map_device. It allows to use driver flags for adjusting configuration. Signed-off-by: Rafal Kozik Acked-by: Bruce Richardson --- drivers/bus/pci/pci_common.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index d8151b0..8f5d77f 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -158,17 +158,24 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, RTE_LOG(INFO, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id, dev->id.device_id, dr->driver.name); + /* + * reference driver structure + * This need to be before rte_pci_map_device(), as it enable to use + * driver flags for adjusting configuration. + */ + dev->driver = dr; + dev->device.driver = &dr->driver; + if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) { /* map resources for devices that use igb_uio */ ret = rte_pci_map_device(dev); - if (ret != 0) + if (ret != 0) { + dev->driver = NULL; + dev->device.driver = NULL; return ret; + } } - /* reference driver structure */ - dev->driver = dr; - dev->device.driver = &dr->driver; - /* call the driver probe() function */ ret = dr->probe(dr, dev); if (ret) { -- 2.7.4