From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by dpdk.org (Postfix) with ESMTP id A70D21B058 for ; Thu, 28 Jun 2018 15:16:13 +0200 (CEST) Received: by mail-lj1-f194.google.com with SMTP id u6-v6so4467303lju.13 for ; Thu, 28 Jun 2018 06:16:13 -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=TN5gJIpVgEqZSWIgDyeRZCdFoyvFZ+ZFjuJTVlNon6M=; b=sNZ13QrPJYiBS0V3wFex2Sq6JPMDSWpkxaVSHJ0KWuGWVQ2ijl6TF9jj/4ozxc1cY6 ICaDcoLbIuiD/HrMx1RPgscqCOd3q+3HlwGI2msdcUNkMq3WxLiIHOFvwbD7CIS4Wc+5 GRwl70XWxIJ7CPDv1fiQ2H+7ccj7Bi9jk4IQPTVqrOfI7xvBb/zhOm50l8BWxueUDSZt /Rl/Ewvg/LxeiiWk7z/BUrdbcXgC/HFltaBKoLMeao8zH7vlYckH/daRWS43JU0gfHiQ DOXljlXT+aTl5j6LfcB0eBFk72KvTWV84MS6HkhCAlqeDEEqrK52/hlrwCFB73kILspf uZAg== 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=TN5gJIpVgEqZSWIgDyeRZCdFoyvFZ+ZFjuJTVlNon6M=; b=PvsQ6PXrVfAkmYwbjvB+TssFIXfUg1UVDwdkVSDOq5Zp0Xv4FXLdGXxlNnfOBHLvIy VVUh+hX05MlPVuvR2sx7Q+ZC2VpXNeWckqmVK4EPPo2INxzS9m1HZXwG3StVMteJcUBm 3AU3eQ26V+m6IoIxEy3/KYB2ybrLJydUwXVuqHgckkJXliO+deZ/e1cElco78eM1CQBQ GUj90CZfn6bdz+YgrlHpFeXFeZgC5/GYBQRu114Pem6MsSEqLAiAAUfywxcAeeUsKWMd RbSnhWh3rbDw2nt6DUEOBI0NnDQkuuWB4MQomMA2chz1Rp41WFHicNxTUXbfaJ4qX59w E3RA== X-Gm-Message-State: APt69E23YOsrCo4JvZIbdErKHrLLbidTh8vndTatADFwtLwdZ/EMF1x6 SxxANGEusTcM5jzJO5gJ8tplLsmnhTWQBg== X-Google-Smtp-Source: AAOMgpe+25XYU7JMHruOxCGDj/bdB56fGkj2vRoNBHIU+IEUWFf6XlQr/46lXWhrjGqRp8nM1/KWgw== X-Received: by 2002:a2e:1290:: with SMTP id 16-v6mr5049846ljs.94.1530191773009; Thu, 28 Jun 2018 06:16:13 -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 o196-v6sm1303246lfe.95.2018.06.28.06.16.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jun 2018 06:16:12 -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, Rafal Kozik Date: Thu, 28 Jun 2018 15:15:51 +0200 Message-Id: <1530191753-18689-3-git-send-email-rk@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530191753-18689-1-git-send-email-rk@semihalf.com> References: <1530191753-18689-1-git-send-email-rk@semihalf.com> Subject: [dpdk-dev] [PATCH v2 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: Thu, 28 Jun 2018 13:16:13 -0000 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