From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id B36B5A0550;
	Fri, 26 Aug 2022 14:44:01 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 549FE4284D;
	Fri, 26 Aug 2022 14:43:23 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124])
 by mails.dpdk.org (Postfix) with ESMTP id 22C7D4280C
 for <dev@dpdk.org>; Fri, 26 Aug 2022 14:43:20 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1661517799;
 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:
 in-reply-to:in-reply-to:references:references;
 bh=MNhzfE13KZyqfRO08vxurrjRIKae2O71Emr2NB6KgXc=;
 b=H6e5KuSZFI3hI7oW7Oj7IHuUAfuS4aL+XW3f5owsrOw2m/BlkTM+IcSjUrKPoYaTB4Ptc+
 7ae3ZeUC/vEn7cmYJwbkEg/m0RjZAtcvlonhDNeYWbdbkvIF/B73GCGgGh38pqpWKNi0QG
 odta5NF8HrDSUcjwX/DZTJUacar6cXo=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-624-F7mJ32bZO6-3-0orZDVjzA-1; Fri, 26 Aug 2022 08:43:18 -0400
X-MC-Unique: F7mJ32bZO6-3-0orZDVjzA-1
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com
 [10.11.54.1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 26FCC101A54E;
 Fri, 26 Aug 2022 12:43:18 +0000 (UTC)
Received: from fchome.redhat.com (unknown [10.40.193.251])
 by smtp.corp.redhat.com (Postfix) with ESMTP id BFC1F40B40C8;
 Fri, 26 Aug 2022 12:43:16 +0000 (UTC)
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bruce.richardson@intel.com,
 Rosen Xu <rosen.xu@intel.com>, Ray Kinsella <mdr@ashroe.eu>,
 Tianfei zhang <tianfei.zhang@intel.com>
Subject: [PATCH v4 15/27] bus/ifpga: make driver-only headers private
Date: Fri, 26 Aug 2022 14:41:56 +0200
Message-Id: <20220826124208.671400-16-david.marchand@redhat.com>
In-Reply-To: <20220826124208.671400-1-david.marchand@redhat.com>
References: <20220628144643.1213026-1-david.marchand@redhat.com>
 <20220826124208.671400-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"; x-default=true
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

The ifpga bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- remove unneeded list head structure type,
- reorder the definitions and macro manipulating the bus singleton object,
- remove inclusion of rte_bus.h and fix the code that relied on implicit
  inclusion,

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
Changes since RFC v2:                                                           
- squashed cleanup for this bus code from other patches,
- updated release notes,

---
 doc/guides/rel_notes/release_22_11.rst         |  2 +-
 .../{rte_bus_ifpga.h => bus_ifpga_driver.h}    | 18 ++++++++----------
 drivers/bus/ifpga/ifpga_bus.c                  |  6 +++---
 drivers/bus/ifpga/ifpga_common.h               |  2 +-
 drivers/bus/ifpga/meson.build                  |  2 +-
 drivers/bus/ifpga/version.map                  |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c             |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h             |  2 +-
 drivers/net/ipn3ke/ipn3ke_flow.c               |  2 +-
 drivers/net/ipn3ke/ipn3ke_representor.c        |  2 +-
 drivers/net/ipn3ke/ipn3ke_tm.c                 |  2 +-
 drivers/raw/ifpga/afu_pmd_core.h               |  2 +-
 drivers/raw/ifpga/afu_pmd_he_hssi.c            |  2 +-
 drivers/raw/ifpga/afu_pmd_he_lpbk.c            |  2 +-
 drivers/raw/ifpga/afu_pmd_he_mem.c             |  2 +-
 drivers/raw/ifpga/afu_pmd_n3000.c              |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c               |  2 +-
 17 files changed, 26 insertions(+), 28 deletions(-)
 rename drivers/bus/ifpga/{rte_bus_ifpga.h => bus_ifpga_driver.h} (91%)

diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 9fd95e13dd..2f2bd2b086 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -88,7 +88,7 @@ API Changes
   in the future. Applications can use ``devtools/cocci/func_or_ret.cocci``
   to update their code.
 
-* drivers: Registering a driver on the ``auxiliary``,
+* drivers: Registering a driver on the ``auxiliary``, ``ifpga``
   buses has been marked as an internal API.
   External users may still register their driver using the associated driver
   headers (see ``enable_driver_sdk`` meson option).
diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/bus_ifpga_driver.h
similarity index 91%
rename from drivers/bus/ifpga/rte_bus_ifpga.h
rename to drivers/bus/ifpga/bus_ifpga_driver.h
index 007ad19875..7b75c2ddbc 100644
--- a/drivers/bus/ifpga/rte_bus_ifpga.h
+++ b/drivers/bus/ifpga/bus_ifpga_driver.h
@@ -2,8 +2,8 @@
  * Copyright(c) 2010-2018 Intel Corporation
  */
 
-#ifndef _RTE_BUS_IFPGA_H_
-#define _RTE_BUS_IFPGA_H_
+#ifndef BUS_IFPGA_DRIVER_H
+#define BUS_IFPGA_DRIVER_H
 
 /**
  * @file
@@ -15,23 +15,17 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#include <rte_bus.h>
+#include <rte_compat.h>
 #include <rte_pci.h>
 #include <rte_interrupts.h>
 #include <rte_spinlock.h>
 
-/** Name of Intel FPGA Bus */
 #define IFPGA_BUS_NAME ifpga
 
 /* Forward declarations */
 struct rte_afu_device;
 struct rte_afu_driver;
 
-/** Double linked list of Intel FPGA AFU device. */
-RTE_TAILQ_HEAD(ifpga_afu_dev_list, rte_afu_device);
-/** Double linked list of Intel FPGA AFU device drivers. */
-RTE_TAILQ_HEAD(ifpga_afu_drv_list, rte_afu_driver);
-
 #define IFPGA_BUS_BITSTREAM_PATH_MAX_LEN 256
 
 struct rte_afu_uuid {
@@ -112,6 +106,7 @@ struct rte_afu_driver {
 	const struct rte_afu_uuid *id_table;    /**< AFU uuid within FPGA. */
 };
 
+__rte_internal
 static inline const char *
 rte_ifpga_device_name(const struct rte_afu_device *afu)
 {
@@ -126,6 +121,7 @@ rte_ifpga_device_name(const struct rte_afu_device *afu)
  * @param name
  *   A pointer to AFU name string.
  */
+__rte_internal
 struct rte_afu_device *
 rte_ifpga_find_afu_by_name(const char *name);
 
@@ -136,6 +132,7 @@ rte_ifpga_find_afu_by_name(const char *name);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be registered.
  */
+__rte_internal
 void rte_ifpga_driver_register(struct rte_afu_driver *driver);
 
 /**
@@ -145,6 +142,7 @@ void rte_ifpga_driver_register(struct rte_afu_driver *driver);
  *   A pointer to a rte_afu_driver structure describing the driver
  *   to be unregistered.
  */
+__rte_internal
 void rte_ifpga_driver_unregister(struct rte_afu_driver *driver);
 
 #define RTE_PMD_REGISTER_AFU(nm, afudrv)\
@@ -164,4 +162,4 @@ static const char *afudrvinit_ ## nm ## _alias = RTE_STR(alias)
 }
 #endif /* __cplusplus */
 
-#endif /* _RTE_BUS_IFPGA_H_ */
+#endif /* BUS_IFPGA_DRIVER_H */
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index b1e9eb7cc4..27e2de7072 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -28,7 +28,7 @@
 
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_logs.h"
 #include "ifpga_common.h"
 
@@ -37,9 +37,9 @@
  */
 static struct rte_bus rte_ifpga_bus;
 
-static struct ifpga_afu_dev_list ifpga_afu_dev_list =
+static TAILQ_HEAD(, rte_afu_device) ifpga_afu_dev_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_dev_list);
-static struct ifpga_afu_drv_list ifpga_afu_drv_list =
+static TAILQ_HEAD(, rte_afu_driver) ifpga_afu_drv_list =
 	TAILQ_HEAD_INITIALIZER(ifpga_afu_drv_list);
 
 
diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h
index bb6524030f..a41a1628f5 100644
--- a/drivers/bus/ifpga/ifpga_common.h
+++ b/drivers/bus/ifpga/ifpga_common.h
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_common.h>
 
 static inline int
diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build
index 9d56a4bb2b..dedc94db2d 100644
--- a/drivers/bus/ifpga/meson.build
+++ b/drivers/bus/ifpga/meson.build
@@ -8,5 +8,5 @@ if is_windows
 endif
 
 deps += ['pci', 'kvargs', 'rawdev']
-headers = files('rte_bus_ifpga.h')
+driver_sdk_headers += files('bus_ifpga_driver.h')
 sources = files('ifpga_bus.c')
diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map
index da7f92c2a0..3d1943afe4 100644
--- a/drivers/bus/ifpga/version.map
+++ b/drivers/bus/ifpga/version.map
@@ -1,4 +1,4 @@
-DPDK_23 {
+INTERNAL {
 	global:
 
 	rte_ifpga_driver_register;
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 550a8b0466..2e39113941 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -16,7 +16,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index 58fcc50c57..dbf57f9ba8 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -24,7 +24,7 @@
 #include <rte_spinlock.h>
 
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_tm_driver.h>
 
 #define IPN3KE_TM_SCRATCH_RW 0
diff --git a/drivers/net/ipn3ke/ipn3ke_flow.c b/drivers/net/ipn3ke/ipn3ke_flow.c
index 66ae31a5a9..5b57ee9341 100644
--- a/drivers/net/ipn3ke/ipn3ke_flow.c
+++ b/drivers/net/ipn3ke/ipn3ke_flow.c
@@ -20,7 +20,7 @@
 #include <rte_tailq.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_common.h>
 #include <ifpga_logs.h>
 #include <ifpga_rawdev.h>
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index abbecfdf2e..2f088d767f 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 6a9b98fd7f..2f242b678a 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_rawdev.h>
 #include <rte_rawdev_pmd.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
diff --git a/drivers/raw/ifpga/afu_pmd_core.h b/drivers/raw/ifpga/afu_pmd_core.h
index 91118a19ab..ab5a228147 100644
--- a/drivers/raw/ifpga/afu_pmd_core.h
+++ b/drivers/raw/ifpga/afu_pmd_core.h
@@ -15,7 +15,7 @@ extern "C" {
 
 #include <rte_spinlock.h>
 #include <rte_cycles.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "ifpga_rawdev.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c
index 102de50812..eca1edc270 100644
--- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
+++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
index 8b2c85b5f8..da0aba6e00 100644
--- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
+++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c
index 0f57a03b0e..3c41aa9ee8 100644
--- a/drivers/raw/ifpga/afu_pmd_he_mem.c
+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
@@ -18,7 +18,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 5120df5f77..b7438bd372 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -19,7 +19,7 @@
 #include <rte_io.h>
 #include <rte_vfio.h>
 #include <rte_bus_pci.h>
-#include <rte_bus_ifpga.h>
+#include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
 
 #include "afu_pmd_core.h"
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 153203a42f..32de5ff0ce 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -35,7 +35,7 @@
 #include "base/ifpga_api.h"
 #include "rte_rawdev.h"
 #include "rte_rawdev_pmd.h"
-#include "rte_bus_ifpga.h"
+#include "bus_ifpga_driver.h"
 #include "ifpga_common.h"
 #include "ifpga_logs.h"
 #include "ifpga_rawdev.h"
-- 
2.37.2