From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id B9012A04DD;
	Fri, 23 Oct 2020 20:31:37 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id BA56B68F6;
	Fri, 23 Oct 2020 20:28:56 +0200 (CEST)
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by dpdk.org (Postfix) with ESMTP id D62FF5AB5
 for <dev@dpdk.org>; Fri, 23 Oct 2020 20:28:43 +0200 (CEST)
IronPort-SDR: VqJPp5T3O/0zPQfj4Y9j/+dtwqn9yx6d99w32TcNimtAxtESEMLlpGKDUQoErRRhWvD1mHUm/M
 oQaHOSdrNJXA==
X-IronPort-AV: E=McAfee;i="6000,8403,9783"; a="147006023"
X-IronPort-AV: E=Sophos;i="5.77,409,1596524400"; d="scan'208";a="147006023"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga005.fm.intel.com ([10.253.24.32])
 by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 23 Oct 2020 11:28:40 -0700
IronPort-SDR: yXtMB4yVNFn7dkukpNTxM5n/5DvOVsU8tI3FCz3/qj53j4QrepBLDES3ZePsOH/KRfmwQb44WJ
 2LE/r25LK1qw==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.77,409,1596524400"; d="scan'208";a="524764014"
Received: from txasoft-yocto.an.intel.com ([10.123.72.192])
 by fmsmga005.fm.intel.com with ESMTP; 23 Oct 2020 11:28:39 -0700
From: Timothy McDaniel <timothy.mcdaniel@intel.com>
To: 
Cc: dev@dpdk.org, erik.g.carrillo@intel.com, gage.eads@intel.com,
 harry.van.haaren@intel.com, jerinj@marvell.com
Date: Fri, 23 Oct 2020 13:30:10 -0500
Message-Id: <1603477826-31374-8-git-send-email-timothy.mcdaniel@intel.com>
X-Mailer: git-send-email 1.7.10
In-Reply-To: <1603477826-31374-1-git-send-email-timothy.mcdaniel@intel.com>
References: <1599855987-25976-2-git-send-email-timothy.mcdaniel@intel.com>
 <1603477826-31374-1-git-send-email-timothy.mcdaniel@intel.com>
Subject: [dpdk-dev] [PATCH v3 07/23] event/dlb2: add flexible interface
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
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
Sender: "dev" <dev-bounces@dpdk.org>

This commit introduces the flexible interface. This
interface allows the core code to operate in PF mode (direct
hardware access) or bifurcated mode (hardware configured via
kernel driver). This driver currently only supports PF mode
but bifurcated mode will be added in a future DPDK patch-set.
Note that the flexible interface is not used for data path
operations, and thus there are no performance concerns
related to the use of function pointers.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
---
 drivers/event/dlb2/dlb2_iface.c | 28 ++++++++++++++++++++++++++++
 drivers/event/dlb2/dlb2_iface.h | 29 +++++++++++++++++++++++++++++
 drivers/event/dlb2/meson.build  |  1 +
 3 files changed, 58 insertions(+)
 create mode 100644 drivers/event/dlb2/dlb2_iface.c
 create mode 100644 drivers/event/dlb2/dlb2_iface.h

diff --git a/drivers/event/dlb2/dlb2_iface.c b/drivers/event/dlb2/dlb2_iface.c
new file mode 100644
index 0000000..0fc9991
--- /dev/null
+++ b/drivers/event/dlb2/dlb2_iface.c
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2020 Intel Corporation
+ */
+
+#include <stdint.h>
+
+#include "dlb2_priv.h"
+
+/* DLB2 PMD Internal interface function pointers.
+ * If VDEV (bifurcated PMD),  these will resolve to functions that issue ioctls
+ * serviced by DLB kernel module.
+ * If PCI (PF PMD),  these will be implemented locally in user mode.
+ */
+
+void (*dlb2_iface_low_level_io_init)(void);
+
+int (*dlb2_iface_open)(struct dlb2_hw_dev *handle, const char *name);
+
+int (*dlb2_iface_get_device_version)(struct dlb2_hw_dev *handle,
+				     uint8_t *revision);
+
+void (*dlb2_iface_hardware_init)(struct dlb2_hw_dev *handle);
+
+int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle,
+				   enum dlb2_cq_poll_modes *mode);
+
+int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle,
+				struct dlb2_get_num_resources_args *rsrcs);
diff --git a/drivers/event/dlb2/dlb2_iface.h b/drivers/event/dlb2/dlb2_iface.h
new file mode 100644
index 0000000..4fb416e
--- /dev/null
+++ b/drivers/event/dlb2/dlb2_iface.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2020 Intel Corporation
+ */
+
+#ifndef _DLB2_IFACE_H_
+#define _DLB2_IFACE_H_
+
+/* DLB2 PMD Internal interface function pointers.
+ * If VDEV (bifurcated PMD),  these will resolve to functions that issue ioctls
+ * serviced by DLB kernel module.
+ * If PCI (PF PMD),  these will be implemented locally in user mode.
+ */
+
+extern void (*dlb2_iface_low_level_io_init)(void);
+
+extern int (*dlb2_iface_open)(struct dlb2_hw_dev *handle, const char *name);
+
+extern int (*dlb2_iface_get_device_version)(struct dlb2_hw_dev *handle,
+					    uint8_t *revision);
+
+extern void (*dlb2_iface_hardware_init)(struct dlb2_hw_dev *handle);
+
+extern int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle,
+					  enum dlb2_cq_poll_modes *mode);
+
+extern int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle,
+				struct dlb2_get_num_resources_args *rsrcs);
+
+#endif /* _DLB2_IFACE_H_ */
diff --git a/drivers/event/dlb2/meson.build b/drivers/event/dlb2/meson.build
index 1eab9b9..491e76d 100644
--- a/drivers/event/dlb2/meson.build
+++ b/drivers/event/dlb2/meson.build
@@ -8,6 +8,7 @@ if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64')
 endif
 
 sources = files('dlb2.c',
+		'dlb2_iface.c',
 		'pf/dlb2_main.c',
 		'pf/dlb2_pf.c'
 )
-- 
2.6.4