[v6,02/12] baseband/acc: add FFT window width in the VRB PMD

Message ID 20231010202049.771959-3-nicolas.chautru@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series VRB2 bbdev PMD introduction |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chautru, Nicolas Oct. 10, 2023, 8:20 p.m. UTC
  This allows to expose the FFT window width being introduced in
previous commit based on what is configured dynamically on the
device platform.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/baseband/acc/acc_common.h  |  5 ++++
 drivers/baseband/acc/rte_vrb_pmd.c | 41 +++++++++++++++++++++++++-----
 2 files changed, 40 insertions(+), 6 deletions(-)
  

Patch

diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h
index 5bb00746c3..cfdadcc473 100644
--- a/drivers/baseband/acc/acc_common.h
+++ b/drivers/baseband/acc/acc_common.h
@@ -131,6 +131,8 @@ 
 #define ACC_LIM_31 20 /* 0.31 */
 #define ACC_MAX_E (128 * 1024 - 2)
 
+#define ACC_MAX_FFT_WIN      16
+
 /* Helper macro for logging */
 #define rte_acc_log(level, fmt, ...) \
 	rte_log(RTE_LOG_ ## level, RTE_LOG_NOTICE, fmt "\n", \
@@ -512,6 +514,8 @@  struct acc_deq_intr_details {
 enum {
 	ACC_VF2PF_STATUS_REQUEST = 1,
 	ACC_VF2PF_USING_VF = 2,
+	ACC_VF2PF_LUT_VER_REQUEST = 3,
+	ACC_VF2PF_FFT_WIN_REQUEST = 4,
 };
 
 
@@ -558,6 +562,7 @@  struct acc_device {
 	queue_offset_fun_t queue_offset;  /* Device specific queue offset */
 	uint16_t num_qgroups;
 	uint16_t num_aqs;
+	uint16_t fft_window_width[ACC_MAX_FFT_WIN]; /* FFT windowing size. */
 };
 
 /* Structure associated with each queue. */
diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c
index 9e5a73c9c7..b86e814f8f 100644
--- a/drivers/baseband/acc/rte_vrb_pmd.c
+++ b/drivers/baseband/acc/rte_vrb_pmd.c
@@ -183,6 +183,37 @@  vrb_check_device_enable(struct rte_bbdev *dev)
 	return false;
 }
 
+static inline void
+vrb_vf2pf(struct acc_device *d, unsigned int payload)
+{
+	acc_reg_write(d, d->reg_addr->vf2pf_doorbell, payload);
+}
+
+/* Request device FFT windowing information. */
+static inline void
+vrb_device_fft_win(struct rte_bbdev *dev)
+{
+	struct acc_device *d = dev->data->dev_private;
+	uint32_t reg, time_out = 0, win;
+
+	if (d->pf_device)
+		return;
+
+	/* Check from the device the first time. */
+	if (d->fft_window_width[0] == 0) {
+		for (win = 0; win < ACC_MAX_FFT_WIN; win++) {
+			vrb_vf2pf(d, ACC_VF2PF_FFT_WIN_REQUEST | win);
+			reg = acc_reg_read(d, d->reg_addr->pf2vf_doorbell);
+			while ((time_out < ACC_STATUS_TO) && (reg == RTE_BBDEV_DEV_NOSTATUS)) {
+				usleep(ACC_STATUS_WAIT); /*< Wait or VF->PF->VF Comms. */
+				reg = acc_reg_read(d, d->reg_addr->pf2vf_doorbell);
+				time_out++;
+			}
+			d->fft_window_width[win] = reg;
+		}
+	}
+}
+
 /* Fetch configuration enabled for the PF/VF using MMIO Read (slow). */
 static inline void
 fetch_acc_config(struct rte_bbdev *dev)
@@ -206,6 +237,8 @@  fetch_acc_config(struct rte_bbdev *dev)
 		return;
 	}
 
+	vrb_device_fft_win(dev);
+
 	d->ddr_size = 0;
 
 	/* Single VF Bundle by VF. */
@@ -271,12 +304,6 @@  fetch_acc_config(struct rte_bbdev *dev)
 			acc_conf->q_fft.aq_depth_log2);
 }
 
-static inline void
-vrb_vf2pf(struct acc_device *d, unsigned int payload)
-{
-	acc_reg_write(d, d->reg_addr->vf2pf_doorbell, payload);
-}
-
 /* Request device status information. */
 static inline uint32_t
 vrb_device_status(struct rte_bbdev *dev)
@@ -1085,6 +1112,7 @@  vrb_dev_info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
 						RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
 				.num_buffers_dst =
 						RTE_BBDEV_LDPC_MAX_CODE_BLOCKS,
+				.fft_windows_num = ACC_MAX_FFT_WIN,
 			}
 		},
 		RTE_BBDEV_END_OF_CAPABILITIES_LIST()
@@ -1100,6 +1128,7 @@  vrb_dev_info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info)
 	fetch_acc_config(dev);
 	/* Check the status of device. */
 	dev_info->device_status = vrb_device_status(dev);
+	dev_info->fft_window_width = d->fft_window_width;
 
 	/* Exposed number of queues. */
 	dev_info->num_queues[RTE_BBDEV_OP_NONE] = 0;