From patchwork Tue Mar 1 10:53:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 108426 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 20453A034F; Tue, 1 Mar 2022 11:54:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C118641C3B; Tue, 1 Mar 2022 11:54:05 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 0428B407FF for ; Tue, 1 Mar 2022 11:54:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646132043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=68EpyWKT1+uW16/Qk6dJhqMD990FFEPWoClujNWHUCk=; b=JXDymy663IhqNajiCwKJv3645rByaPd0V7fJ8s8b9GixryoK/eDi5qTKQ+GJppP6x5Yw5m 73OeYjPfF+/DmPus5UlahC+rRleADQlU6+xVyxZ8l2cfuTyV46mRWrLdWaS/Wm+m8RDNUG pCjnC7bOwHCTSzQI1alfBcr8C8Yrm4A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-323-fzNhI3nOOYi3iFqE08Woew-1; Tue, 01 Mar 2022 05:54:00 -0500 X-MC-Unique: fzNhI3nOOYi3iFqE08Woew-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23A8A1006AA6; Tue, 1 Mar 2022 10:53:59 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32DFF2AABF; Tue, 1 Mar 2022 10:53:57 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net Subject: [PATCH] bus/pci: enhance driver pointer documentation Date: Tue, 1 Mar 2022 11:53:54 +0100 Message-Id: <20220301105354.13323-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Setting driver pointer before mapping required for write combining support since commit 4a928ef9f611 ("bus/pci: enable write combining during mapping"). Move comments that got separated after different changes. Also change the condition relying on dev->driver itself. Signed-off-by: David Marchand --- drivers/bus/pci/pci_common.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index def372b67e..37ab879779 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -207,11 +207,6 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, RTE_LOG(DEBUG, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id, dev->id.device_id, dr->driver.name); - /* - * reference driver structure - * This needs to be before rte_pci_map_device(), as it enables to use - * driver flags for adjusting configuration. - */ if (!already_probed) { enum rte_iova_mode dev_iova_mode; enum rte_iova_mode iova_mode; @@ -247,9 +242,13 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, return -ENOMEM; } + /* + * Reference driver structure. + * This needs to be before rte_pci_map_device(), as it enables + * to use driver flags for adjusting configuration. + */ dev->driver = dr; - - if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) { + if (dev->driver->drv_flags & RTE_PCI_DRV_NEED_MAPPING) { ret = rte_pci_map_device(dev); if (ret != 0) { dev->driver = NULL;