Skip to contentSkip to conversation

baseband PMD API

RFC New Nicolas Chautru 1 participant 2 messages Oct 14, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover baseband PMD API

Option to move PMD API into bbdev API.
For discussion only, not yet sure this is the
right way to go.

Nicolas Chautru (1):
bbdev: device PF initialization helper through bbdev API

 app/test-bbdev/test_bbdev_perf.c              |  10 +-
 drivers/baseband/acc/acc100_pmd.h             |   1 -
 drivers/baseband/acc/acc200_cfg.h             |  32 --
 drivers/baseband/acc/acc200_pmd.h             |   1 -
 drivers/baseband/acc/meson.build              |   2 +-
 drivers/baseband/acc/rte_acc100_pmd.c         | 308 +++++++++---------
 drivers/baseband/acc/rte_acc200_pmd.c         | 256 +++++++--------
 drivers/baseband/acc/rte_acc_cfg.h            |  49 ---
 drivers/baseband/acc/rte_acc_common_cfg.h     |  15 +-
 drivers/baseband/acc/version.map              |   6 -
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         | 206 ++++++------
 .../fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h     |  35 +-
 drivers/baseband/fpga_5gnr_fec/version.map    |   7 -
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  | 202 ++++++------
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.h  |  35 +-
 drivers/baseband/fpga_lte_fec/version.map     |   7 -
 lib/bbdev/rte_bbdev.c                         |  20 ++
 lib/bbdev/rte_bbdev.h                         |  17 +
 lib/bbdev/rte_bbdev_pmd.h                     |  10 +
 lib/bbdev/version.map                         |   1 +
 20 files changed, 535 insertions(+), 685 deletions(-)
 delete mode 100644 drivers/baseband/acc/acc200_cfg.h
 delete mode 100644 drivers/baseband/acc/rte_acc_cfg.h
Signature · 1 line
2.37.1
#1 lore raw

RFC 1/1 bbdev: device PF initialization helper through bbdev API

Moved from PMD API to bbdev API.
This API is only meant for bbdev-test usage (notably for OEMs). The actual configuration structure still need to
be exposed as it is device specific.
RFI only

---
 app/test-bbdev/test_bbdev_perf.c              |  10 +-
 drivers/baseband/acc/acc100_pmd.h             |   1 -
 drivers/baseband/acc/acc200_cfg.h             |  32 --
 drivers/baseband/acc/acc200_pmd.h             |   1 -
 drivers/baseband/acc/meson.build              |   2 +-
 drivers/baseband/acc/rte_acc100_pmd.c         | 308 +++++++++---------
 drivers/baseband/acc/rte_acc200_pmd.c         | 256 +++++++--------
 drivers/baseband/acc/rte_acc_cfg.h            |  49 ---
 drivers/baseband/acc/rte_acc_common_cfg.h     |  15 +-
 drivers/baseband/acc/version.map              |   6 -
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         | 206 ++++++------
 .../fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h     |  35 +-
 drivers/baseband/fpga_5gnr_fec/version.map    |   7 -
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.c  | 202 ++++++------
 drivers/baseband/fpga_lte_fec/fpga_lte_fec.h  |  35 +-
 drivers/baseband/fpga_lte_fec/version.map     |   7 -
 lib/bbdev/rte_bbdev.c                         |  20 ++
 lib/bbdev/rte_bbdev.h                         |  17 +
 lib/bbdev/rte_bbdev_pmd.h                     |  10 +
 lib/bbdev/version.map                         |   1 +
 20 files changed, 535 insertions(+), 685 deletions(-)
 delete mode 100644 drivers/baseband/acc/acc200_cfg.h
 delete mode 100644 drivers/baseband/acc/rte_acc_cfg.h
app/test-bbdev/test_bbdev_perf.c +5 -5
index 52396f1473..89a4f20b0b 100644
@@ -54,7 +54,7 @@
 #endif
 
 #ifdef RTE_BASEBAND_ACC
-#include <rte_acc_cfg.h>
+#include <rte_acc_common_cfg.h>
 #define ACC100PF_DRIVER_NAME   ("intel_acc100_pf")
 #define ACC100VF_DRIVER_NAME   ("intel_acc100_vf")
 #define ACC100_QMGR_NUM_AQS 16
@@ -667,7 +667,7 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info,
 		conf.flr_time_out = FLR_4G_TIMEOUT;
 
 		/* setup FPGA PF with configuration information */
-		ret = rte_fpga_lte_fec_configure(info->dev_name, &conf);
+		ret = rte_bbdev_pf_init_helper(dev_id, (void *)&conf);
 		TEST_ASSERT_SUCCESS(ret,
 				"Failed to configure 4G FPGA PF for bbdev %s",
 				info->dev_name);
@@ -708,7 +708,7 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info,
 		conf.dl_load_balance = DL_5G_LOAD_BALANCE;
 
 		/* setup FPGA PF with configuration information */
-		ret = rte_fpga_5gnr_fec_configure(info->dev_name, &conf);
+		ret = rte_bbdev_pf_init_helper(dev_id, (void *)&conf);
 		TEST_ASSERT_SUCCESS(ret,
 				"Failed to configure 5G FPGA PF for bbdev %s",
 				info->dev_name);
@@ -765,7 +765,7 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info,
 		conf.q_dl_5g.aq_depth_log2 = ACC100_QMGR_AQ_DEPTH;
 
 		/* setup PF with configuration information */
-		ret = rte_acc_configure(info->dev_name, &conf);
+		ret = rte_bbdev_pf_init_helper(dev_id, (void *)&conf);
 		TEST_ASSERT_SUCCESS(ret,
 				"Failed to configure ACC100 PF for bbdev %s",
 				info->dev_name);
@@ -827,7 +827,7 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info,
 		conf.q_fft.aq_depth_log2 = ACC200_QMGR_AQ_DEPTH;
 
 		/* setup PF with configuration information */
-		ret = rte_acc_configure(info->dev_name, &conf);
+		ret = rte_bbdev_pf_init_helper(dev_id, (void *)&conf);
 		TEST_ASSERT_SUCCESS(ret,
 				"Failed to configure ACC200 PF for bbdev %s",
 				info->dev_name);
drivers/baseband/acc/acc100_pmd.h +0 -1
index 9486e98521..56ae427092 100644
@@ -7,7 +7,6 @@
 
 #include "acc100_pf_enum.h"
 #include "acc100_vf_enum.h"
-#include "rte_acc_cfg.h"
 #include "acc_common.h"
 
 /* Helper macro for logging */
drivers/baseband/acc/acc200_cfg.h deleted +0 -32
deleted file mode 100644
index d77506b560..0000000000
@@ -1,32 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2022 Intel Corporation
- */
-
-#ifndef _ACC200_CFG_H_
-#define _ACC200_CFG_H_
-
-/**
- * @file acc200_cfg.h
- *
- * Functions for configuring ACC200 HW.
- * Configuration related to encoding/decoding is done through the
- * librte_bbdev library.
- */
-
-/**
- * Configure a ACC200 device.
- *
- * @param dev_name
- *   The name of the device. This is the short form of PCI BDF, e.g. 00:01.0.
- *   It can also be retrieved for a bbdev device from the dev_name field in the
- *   rte_bbdev_info structure returned by rte_bbdev_info_get().
- * @param conf
- *   Configuration to apply to ACC200 HW.
- *
- * @return
- *   Zero on success, negative value on failure.
- */
-int
-acc200_configure(const char *dev_name, struct rte_acc_conf *conf);
-
-#endif /* _ACC200_CFG_H_ */
drivers/baseband/acc/acc200_pmd.h +0 -1
index f3f2627ae9..acead1d17c 100644
@@ -8,7 +8,6 @@
 #include "acc_common.h"
 #include "acc200_pf_enum.h"
 #include "acc200_vf_enum.h"
-#include "acc200_cfg.h"
 
 /* Helper macro for logging */
 #define rte_bbdev_log(level, fmt, ...) \
drivers/baseband/acc/meson.build +1 -1
index 77c393b533..c7f7004174 100644
@@ -5,4 +5,4 @@ deps += ['bbdev', 'bus_pci']
 
 sources = files('rte_acc100_pmd.c', 'rte_acc200_pmd.c')
 
-headers = files('rte_acc_cfg.h')
+headers = files('rte_acc_common_cfg.h')
drivers/baseband/acc/rte_acc100_pmd.c +147 -161

370 lines not on this page · raw message

drivers/baseband/acc/rte_acc200_pmd.c +126 -130

283 lines not on this page · raw message

drivers/baseband/acc/rte_acc_cfg.h deleted +0 -49

49 lines not on this page · raw message

drivers/baseband/acc/rte_acc_common_cfg.h +2 -13
index cce75d5878..28175c5dde 100644
@@ -8,20 +8,13 @@
 /**
  * @file rte_acc_common_cfg.h
  *
- * Functions for configuring ACC HW, exposed directly to applications.
- * Configuration related to encoding/decoding is done through the
- * librte_bbdev library.
- *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
+ * Structure used for the PF configuration from bbdev-test
+ * using *rte_pf_init_helper*.
  */
 
 #include <stdint.h>
 #include <stdbool.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
 
 /**< Maximum number of Virtual Functions ACC may support */
 #define RTE_ACC_NUM_VFS 64
@@ -94,8 +87,4 @@ struct rte_acc_conf {
 	struct rte_acc_arbitration arb_mld[RTE_ACC_NUM_VFS];
 };
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _RTE_ACC_COMMON_CFG_H_ */
drivers/baseband/acc/version.map +0 -6
index 95ae74dd35..78c3585d7c 100644
@@ -1,9 +1,3 @@
 DPDK_23 {
 	local: *;
 };
-
-EXPERIMENTAL {
-	global:
-
-	rte_acc_configure;
-};
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +102 -104

238 lines not on this page · raw message

drivers/baseband/fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h +2 -33
index 93a87c8e82..1c0eb7d815 100644
@@ -11,19 +11,10 @@
 /**
  * @file rte_pmd_fpga_5gnr_fec.h
  *
- * Interface for Intel(R) FGPA 5GNR FEC device configuration at the host level,
- * directly accessible by the application.
- * Configuration related to 5GNR functionality is done through
- * librte_bbdev library.
- *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
+ * Structure used for the PF configuration from bbdev-test
+ * using *rte_pf_init_helper*.
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /** Number of Virtual Functions FGPA 4G FEC supports */
 #define FPGA_5GNR_FEC_NUM_VFS 8
 
@@ -47,26 +38,4 @@ struct rte_fpga_5gnr_fec_conf {
 	uint8_t dl_load_balance;
 };
 
-/**
- * Configure Intel(R) FPGA 5GNR FEC device
- *
- * @param dev_name
- *   The name of the device. This is the short form of PCI BDF, e.g. 00:01.0.
- *   It can also be retrieved for a bbdev device from the dev_name field in the
- *   rte_bbdev_info structure returned by rte_bbdev_info_get().
- * @param conf
- *   Configuration to apply to FPGA 4G FEC.
- *
- * @return
- *   Zero on success, negative value on failure.
- */
-__rte_experimental
-int
-rte_fpga_5gnr_fec_configure(const char *dev_name,
-		const struct rte_fpga_5gnr_fec_conf *conf);
-
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _RTE_PMD_FPGA_5GNR_FEC_H_ */
drivers/baseband/fpga_5gnr_fec/version.map +0 -7
index 6b191cf330..78c3585d7c 100644
@@ -1,10 +1,3 @@
 DPDK_23 {
 	local: *;
 };
-
-EXPERIMENTAL {
-	global:
-
-	rte_fpga_5gnr_fec_configure;
-
-};
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +100 -102

234 lines not on this page · raw message

drivers/baseband/fpga_lte_fec/fpga_lte_fec.h +2 -33
index b35c7a484e..b416e34018 100644
@@ -11,19 +11,10 @@
 /**
  * @file fpga_lte_fec.h
  *
- * Interface for Intel(R) FGPA LTE FEC device configuration at the host level,
- * directly accessible by the application.
- * Configuration related to LTE Turbo coding functionality is done through
- * librte_bbdev library.
- *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
+ * Structure used for the PF configuration from bbdev-test
+ * using *rte_pf_init_helper*.
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**< Number of Virtual Functions FGPA 4G FEC supports */
 #define FPGA_LTE_FEC_NUM_VFS 8
 
@@ -49,26 +40,4 @@ struct rte_fpga_lte_fec_conf {
 	uint16_t flr_time_out;
 };
 
-/**
- * Configure Intel(R) FPGA LTE FEC device
- *
- * @param dev_name
- *   The name of the device. This is the short form of PCI BDF, e.g. 00:01.0.
- *   It can also be retrieved for a bbdev device from the dev_name field in the
- *   rte_bbdev_info structure returned by rte_bbdev_info_get().
- * @param conf
- *   Configuration to apply to FPGA 4G FEC.
- *
- * @return
- *   Zero on success, negative value on failure.
- */
-__rte_experimental
-int
-rte_fpga_lte_fec_configure(const char *dev_name,
-		const struct rte_fpga_lte_fec_conf *conf);
-
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _FPGA_LTE_FEC_H_ */
drivers/baseband/fpga_lte_fec/version.map +0 -7
index aab28a9976..78c3585d7c 100644
@@ -1,10 +1,3 @@
 DPDK_23 {
 	local: *;
 };
-
-EXPERIMENTAL {
-	global:
-
-	rte_fpga_lte_fec_configure;
-
-};
lib/bbdev/rte_bbdev.c +20 -0
index 1521cdbc53..a84bcac260 100644
@@ -1184,3 +1184,23 @@ rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
 	rte_bbdev_log(ERR, "Invalid enqueue status");
 	return NULL;
 }
+
+int
+rte_bbdev_pf_init_helper(uint16_t dev_id, void *config)
+{
+	struct rte_bbdev *dev = get_dev(dev_id);
+	VALID_DEV_OR_RET_ERR(dev, dev_id);
+
+	VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
+
+	if (dev->dev_ops->pf_init_helper) {
+		int ret = dev->dev_ops->pf_init_helper(dev, config);
+		if (ret < 0) {
+			rte_bbdev_log(ERR, "Device %u PF inialization failed", dev_id);
+			return ret;
+		}
+	}
+
+	rte_bbdev_log_debug("PF initialization of device %u", dev_id);
+	return 0;
+}
lib/bbdev/rte_bbdev.h +17 -0
index 1eb5fa532b..b34c1ea7e6 100644
@@ -230,6 +230,23 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id);
 int
 rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
 
+/**
+ * Helper function to initialize the device from the PF.
+ * This is only meant to be used in the context of bbdev-test
+ * so that to be able to test the device from the PF without
+ * dependency on 3rd party configuration ingredients.
+ * Optional only.
+ *
+ * @param dev_id
+ *   The identifier of the device.
+ *
+ * @return
+ *   - negative value on failure - as returned from PMD
+ */
+__rte_experimental
+int
+rte_bbdev_pf_init_helper(uint16_t dev_id, void *config);
+
 /**
  * Flags to indicate the reason why a previous enqueue may not have
  * consumed all requested operations.
lib/bbdev/rte_bbdev_pmd.h +10 -0
index 3da7a2bdf5..be71db91db 100644
@@ -134,6 +134,13 @@ typedef int (*rte_bbdev_queue_intr_enable_t)(struct rte_bbdev *dev,
 typedef int (*rte_bbdev_queue_intr_disable_t)(struct rte_bbdev *dev,
 				    uint16_t queue_id);
 
+/*
+ * @internal
+ * Function to help to initialize the device from the PF.
+ * Only meant for test purpose notably using bbdev-test.
+ */
+typedef int (*rte_bbdev_pf_init_helper_t)(struct rte_bbdev *dev, void *conf);
+
 /**
  * Operations implemented by drivers. Fields marked as "Required" must be
  * provided by a driver for a device to have basic functionality. "Optional"
@@ -171,6 +178,9 @@ struct rte_bbdev_ops {
 	rte_bbdev_queue_intr_enable_t queue_intr_enable;
 	/** Disable queue interrupt. Optional */
 	rte_bbdev_queue_intr_disable_t queue_intr_disable;
+
+	/** Companion helper to init device for testing purpose. Optional. */
+	rte_bbdev_pf_init_helper_t pf_init_helper;
 };
 
 /**
lib/bbdev/version.map +1 -0
index d0bb835255..d05d63483a 100644
@@ -50,4 +50,5 @@ EXPERIMENTAL {
 	rte_bbdev_enqueue_status_str;
 	rte_bbdev_fft_op_alloc_bulk;
 	rte_bbdev_fft_op_free_bulk;
+	rte_bbdev_pf_init_helper;
 };
Signature · 1 line
2.37.1