From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 5E0E01BBCC for ; Wed, 11 Apr 2018 16:07:40 +0200 (CEST) Received: by mail-wr0-f193.google.com with SMTP id c24so1916622wrc.6 for ; Wed, 11 Apr 2018 07:07:40 -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=9znCpNGo6uSpIbMP7apBqMpTnfKgLyB7hwMmlzQrZdM=; b=OxqvCjSeqGielCAetVp5clVye4KgLNJJY7Rd/1SKbR+wCvJK/FPCk3jmD0MaMFJ14L sTjVGFQi+p/4zTGVYUQQTTOAwHJAfaXqSQJtV+z7ZbL6vhTusexRHkLhPFVtXnV/OJ5f i0PQs+7S/lUnDtQLxwZ7xdBUGF8Xf2/iuYdJAHriSlXzkkutFR0t1g7gw6ANxnwmkAfo rZ1OuPYYVE0vpdWs1K9GchFy/Tvmt6nKEf0girz8XrS/uCm2hlJb46O7V5OQ8GmtsELA nRUnCB/RYJ3HP//FrH0DhdIUB+p1h5PrdCtey9xBrQtnYqzo1hl3GQSJAVfi5l/eQgPZ 5yWg== 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=9znCpNGo6uSpIbMP7apBqMpTnfKgLyB7hwMmlzQrZdM=; b=nvnsS5mBuP4oTdltiSQYvdJTzhFOWK/c2mQKTZW8fKKFcTdUUTwmsMj8mcYuPEvCUp ibeWHb3afIeOyURxK2er39qYj+jpePx54MHJE04QQwOJSsJsePFkTc5cscgab+y8x/AS 7BTKZ6/NwXE2p5822P0b24h8ZuQ59XIaFw6i2hsVQfy4c7jVT+f1JmDk0qb52evJk9a6 cjh2J3h3EPXPH1vc8bzGrhYcUCbt583H1rRf8JBNCctB1V3HCqkI9ha1zQsZuL+Tx5Y1 3WGfDulXzZvVYnxwvADg4ZzMktVNnmDuMZtpJrhdyMM6/Df8+M9caNbnNzqeTF3MgJNl K5dA== X-Gm-Message-State: ALQs6tA3wGQKC3aeGBnMSCPhDCCJt+UJQVKL13cS9YhVt0aIsvDcYPhj 7k4Kvib3xH9LhxPU7rSFF4cHCcvmoCrWmw== X-Google-Smtp-Source: AIpwx48NGDsBFijS4Jj9kOcAPQpPPYmj06zf8zIncJieW89/G873u21SciGdAcMU2+pnWYDtwlKHJg== X-Received: by 10.223.171.164 with SMTP id s33mr3724082wrc.181.1523455659901; Wed, 11 Apr 2018 07:07:39 -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 6sm1607761wmf.31.2018.04.11.07.07.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 07:07:38 -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, ferruh.yigit@intel.com, Rafal Kozik Date: Wed, 11 Apr 2018 16:07:15 +0200 Message-Id: <1523455637-31719-3-git-send-email-rk@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523455637-31719-1-git-send-email-rk@semihalf.com> References: <1523455637-31719-1-git-send-email-rk@semihalf.com> Subject: [dpdk-dev] [PATCH 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: Wed, 11 Apr 2018 14:07:40 -0000 Reference driver structure before calling rte_pci_map_device. It allow to use driver flags for adjusting configuration. Signed-off-by: Rafal Kozik --- drivers/bus/pci/pci_common.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 2a00f36..15e9a47 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -159,17 +159,20 @@ 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 */ + 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