From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id 120B71B4D1 for ; Fri, 29 Jun 2018 15:54:16 +0200 (CEST) Received: by mail-lf0-f68.google.com with SMTP id i15-v6so6863005lfc.2 for ; Fri, 29 Jun 2018 06:54:16 -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=nhJW3xkW6ucmrZ1kGG+RWGUAatD65eSlxXFz1Bv2HbmWfmQYAAoffI9cim0AYKwY4k lqN43NLlYC5sc9ntBXbrXzvBZM9jVDcQuHxZAZU7xL/tHQ9tw1Ddesg4iN+5RK9NTC6y +np39VLSigZkBwb5nI1fO2eoUErXQXg0p/4Qg1TNkl40l3eXjBj1tUXv9xeWp52n9pRk lVBw1pR8aT03FG+xRLyH6/MeZ0JTmEXJEBTDk00Jk0N3L/NrWTSygJGadvSPJf67Ppbu M+BZaLBoZbp3Jbuyef/bv43/63eYNHT+iLfx7p75RYo8D1QWaZSwZ62U7tbcgwnRw7oU sTNA== 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=mmdZnQkm63o5VtlXNioQHr0xCtq2x2n+9Iye2e4Jfyb41bHgPUwLMSh0r4TGbv/Wi+ 1+0ev9s6a+QgU2qO2DDDy2FDAb4nTi//VHArqJlUBtJ7Zc4Am6rsCWYmWCMSSgIlcj7Y 6tr4m3qeqRAq1dEcIWWCjOgFM2ufHxaG7MRHRa/y6NlhNYddGMf+VPGgVbYwllddO/JR wY6qpgU3jhc8ssb/1RAVU+VF85FhElo6YSd544bTXboi63T/hymxxwBBRn/2FOkWmr1I ZAaykBpLKdnoXCZ46JO6s4m9egHp88zBg3VZurWdON+IYUY4lFtggu4GdGZVOdIbt7kP 0HGg== X-Gm-Message-State: APt69E09UqxpZyh+ImMMe7ckeaFVnRLonPqOzoX3utl1gIIsW2jwozY/ R9EbE9nfBKq9h5j4g3wy2Qi/3rc1sKJuwg== X-Google-Smtp-Source: AAOMgpe0llPvBuAthWD7ybmDawiDSEf5M7MVottVqZN/HEzjxx+PWC7Nyi81DHEeP7dw/ggUZXVqJQ== X-Received: by 2002:a19:53cc:: with SMTP id h73-v6mr9707096lfl.110.1530280455545; Fri, 29 Jun 2018 06:54:15 -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 v136-v6sm114122lfa.10.2018.06.29.06.54.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jun 2018 06:54:14 -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 15:54:06 +0200 Message-Id: <1530280448-12920-3-git-send-email-rk@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530280448-12920-1-git-send-email-rk@semihalf.com> References: <1530267873-7236-2-git-send-email-rk@semihalf.com> <1530280448-12920-1-git-send-email-rk@semihalf.com> Subject: [dpdk-dev] [PATCH v5 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 13:54:16 -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