Skip to contentSkip to conversation

baseband/fpga_5gnr_fec: changes for 23.07

PATCH Superseded Hernan Vargas 2 participants 10 messages May 23, 2023

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover baseband/fpga_5gnr_fec: changes for 23.07

Targeting 23.07 if possible. Add support for AGX100 (N6000) and corner case fixes.

Hernan Vargas (6):
baseband/fpga_5gnr_fec: fix possible div by zero baseband/fpga_5gnr_fec: fix seg fault unconf queue baseband/fpga_5gnr_fec: renaming for consistency baseband/fpga_5gnr_fec: add Vista Creek variant baseband/fpga_5gnr_fec: add AGX100 support baseband/fpga_5gnr_fec: cosmetic comment changes

 doc/guides/bbdevs/fpga_5gnr_fec.rst           |   72 +-
 drivers/baseband/fpga_5gnr_fec/agx100_pmd.h   |  273 ++
 .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    |  349 +--
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         | 2261 ++++++++++++-----
 .../fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h     |   27 +-
 drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h  |  140 +
 6 files changed, 2157 insertions(+), 965 deletions(-)
 create mode 100644 drivers/baseband/fpga_5gnr_fec/agx100_pmd.h
 create mode 100644 drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h
Signature · 1 line
2.37.1
#1 lore raw

PATCH 1/6 baseband/fpga_5gnr_fec: fix possible div by zero

Add fix to have an early exit when z_c is zero to prevent a possible division by zero.

Fixes 44dc6faa796f ("baseband/fpga_5gnr_fec: add LDPC processing functions")
---
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +2 -0
index f29565af8cca..9388cce52960 100644
@@ -879,6 +879,8 @@ get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index)
 {
 	if (rv_index == 0)
 		return 0;
+	if (z_c == 0)
+		return 0;
 	uint16_t n = (bg == 1 ? N_ZC_1 : N_ZC_2) * z_c;
 	if (n_cb == n) {
 		if (rv_index == 1)
Signature · 1 line
2.37.1
#3 lore raw

PATCH 2/6 baseband/fpga_5gnr_fec: fix seg fault unconf queue

In reply to Hernan Vargas

Adding exception to prevent segmentation fault in case a queue is started which was not configured earlier.

Fixes c58109a8871d ("baseband/fpga_5gnr_fec: add queue configuration")
---
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +4 -0
index 9388cce52960..a6211f73e6e3 100644
@@ -573,6 +573,10 @@ fpga_queue_start(struct rte_bbdev *dev, uint16_t queue_id)
 		return -1;
 	}
 #endif
+	if (dev->data->queues[queue_id].queue_private == NULL) {
+		rte_bbdev_log(ERR, "Cannot start invalid queue %d", queue_id);
+		return -1;
+	}
 	struct fpga_queue *q = dev->data->queues[queue_id].queue_private;
 	uint32_t offset = FPGA_5GNR_FEC_RING_CTRL_REGS +
 			(sizeof(struct fpga_ring_ctrl_reg) * q->q_idx);
Signature · 1 line
2.37.1
#5 lore raw

PATCH 3/6 baseband/fpga_5gnr_fec: renaming for consistency

In reply to Hernan Vargas

Rename generic functions and constants using the FPGA 5GNR prefix naming to prepare for code reuse for new FPGA implementation variant. No functional impact.

---
 .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    | 117 +++--
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         | 455 ++++++++----------
 .../fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h     |  17 +-
 3 files changed, 269 insertions(+), 320 deletions(-)
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +56 -61
index e3038112fabb..9300349a731b 100644
@@ -31,26 +31,26 @@
 #define FPGA_5GNR_FEC_VF_DEVICE_ID (0x0D90)
 
 /* Align DMA descriptors to 256 bytes - cache-aligned */
-#define FPGA_RING_DESC_ENTRY_LENGTH (8)
+#define FPGA_5GNR_RING_DESC_ENTRY_LENGTH (8)
 /* Ring size is in 256 bits (32 bytes) units */
 #define FPGA_RING_DESC_LEN_UNIT_BYTES (32)
 /* Maximum size of queue */
-#define FPGA_RING_MAX_SIZE (1024)
+#define FPGA_5GNR_RING_MAX_SIZE (1024)
 
 #define FPGA_NUM_UL_QUEUES (32)
 #define FPGA_NUM_DL_QUEUES (32)
 #define FPGA_TOTAL_NUM_QUEUES (FPGA_NUM_UL_QUEUES + FPGA_NUM_DL_QUEUES)
 #define FPGA_NUM_INTR_VEC (FPGA_TOTAL_NUM_QUEUES - RTE_INTR_VEC_RXTX_OFFSET)
 
-#define FPGA_INVALID_HW_QUEUE_ID (0xFFFFFFFF)
+#define FPGA_5GNR_INVALID_HW_QUEUE_ID (0xFFFFFFFF)
 
-#define FPGA_QUEUE_FLUSH_TIMEOUT_US (1000)
-#define FPGA_HARQ_RDY_TIMEOUT (10)
-#define FPGA_TIMEOUT_CHECK_INTERVAL (5)
-#define FPGA_DDR_OVERFLOW (0x10)
+#define FPGA_5GNR_QUEUE_FLUSH_TIMEOUT_US (1000)
+#define FPGA_5GNR_HARQ_RDY_TIMEOUT (10)
+#define FPGA_5GNR_TIMEOUT_CHECK_INTERVAL (5)
+#define FPGA_5GNR_DDR_OVERFLOW (0x10)
 
-#define FPGA_5GNR_FEC_DDR_WR_DATA_LEN_IN_BYTES 8
-#define FPGA_5GNR_FEC_DDR_RD_DATA_LEN_IN_BYTES 8
+#define FPGA_5GNR_DDR_WR_DATA_LEN_IN_BYTES 8
+#define FPGA_5GNR_DDR_RD_DATA_LEN_IN_BYTES 8
 
 /* Constants from K0 computation from 3GPP 38.212 Table 5.4.2.1-2 */
 #define N_ZC_1 66 /* N = 66 Zc for BG 1 */
@@ -152,7 +152,7 @@ struct __rte_packed fpga_dma_enc_desc {
 		};
 
 		uint8_t sw_ctxt[FPGA_RING_DESC_LEN_UNIT_BYTES *
-					(FPGA_RING_DESC_ENTRY_LENGTH - 1)];
+					(FPGA_5GNR_RING_DESC_ENTRY_LENGTH - 1)];
 	};
 };
 
@@ -197,7 +197,7 @@ struct __rte_packed fpga_dma_dec_desc {
 			uint8_t cbs_in_op;
 		};
 
-		uint32_t sw_ctxt[8 * (FPGA_RING_DESC_ENTRY_LENGTH - 1)];
+		uint32_t sw_ctxt[8 * (FPGA_5GNR_RING_DESC_ENTRY_LENGTH - 1)];
 	};
 };
 
@@ -207,8 +207,8 @@ union fpga_dma_desc {
 	struct fpga_dma_dec_desc dec_req;
 };
 
-/* FPGA 5GNR FEC Ring Control Register */
-struct __rte_packed fpga_ring_ctrl_reg {
+/* FPGA 5GNR Ring Control Register. */
+struct __rte_packed fpga_5gnr_ring_ctrl_reg {
 	uint64_t ring_base_addr;
 	uint64_t ring_head_addr;
 	uint16_t ring_size:11;
@@ -226,38 +226,37 @@ struct __rte_packed fpga_ring_ctrl_reg {
 	uint16_t rsrvd3;
 	uint16_t head_point;
 	uint16_t rsrvd4;
-
 };
 
-/* Private data structure for each FPGA FEC device */
+/* Private data structure for each FPGA 5GNR device. */
 struct fpga_5gnr_fec_device {
-	/** Base address of MMIO registers (BAR0) */
+	/** Base address of MMIO registers (BAR0). */
 	void *mmio_base;
-	/** Base address of memory for sw rings */
+	/** Base address of memory for sw rings. */
 	void *sw_rings;
-	/** Physical address of sw_rings */
+	/** Physical address of sw_rings. */
 	rte_iova_t sw_rings_phys;
 	/** Number of bytes available for each queue in device. */
 	uint32_t sw_ring_size;
-	/** Max number of entries available for each queue in device */
+	/** Max number of entries available for each queue in device. */
 	uint32_t sw_ring_max_depth;
-	/** Base address of response tail pointer buffer */
+	/** Base address of response tail pointer buffer. */
 	uint32_t *tail_ptrs;
-	/** Physical address of tail pointers */
+	/** Physical address of tail pointers. */
 	rte_iova_t tail_ptr_phys;
-	/** Queues flush completion flag */
+	/** Queues flush completion flag. */
 	uint64_t *flush_queue_status;
-	/* Bitmap capturing which Queues are bound to the PF/VF */
+	/** Bitmap capturing which Queues are bound to the PF/VF. */
 	uint64_t q_bound_bit_map;
-	/* Bitmap capturing which Queues have already been assigned */
+	/** Bitmap capturing which Queues have already been assigned. */
 	uint64_t q_assigned_bit_map;
-	/** True if this is a PF FPGA FEC device */
+	/** True if this is a PF FPGA 5GNR device. */
 	bool pf_device;
 };
 
-/* Structure associated with each queue. */
-struct __rte_cache_aligned fpga_queue {
-	struct fpga_ring_ctrl_reg ring_ctrl_reg;  /* Ring Control Register */
+/** Structure associated with each queue. */
+struct __rte_cache_aligned fpga_5gnr_queue {
+	struct fpga_5gnr_ring_ctrl_reg ring_ctrl_reg;  /**< Ring Control Register */
 	union fpga_dma_desc *ring_addr;  /* Virtual address of software ring */
 	uint64_t *ring_head_addr;  /* Virtual address of completion_head */
 	uint64_t shadow_completion_head; /* Shadow completion head value */
@@ -274,84 +273,80 @@ struct __rte_cache_aligned fpga_queue {
 	void *shadow_tail_addr;
 };
 
-/* Write to 16 bit MMIO register address */
+/* Write to 16 bit MMIO register address. */
 static inline void
 mmio_write_16(void *addr, uint16_t value)
 {
 	*((volatile uint16_t *)(addr)) = rte_cpu_to_le_16(value);
 }
 
-/* Write to 32 bit MMIO register address */
+/* Write to 32 bit MMIO register address. */
 static inline void
 mmio_write_32(void *addr, uint32_t value)
 {
 	*((volatile uint32_t *)(addr)) = rte_cpu_to_le_32(value);
 }
 
-/* Write to 64 bit MMIO register address */
+/* Write to 64 bit MMIO register address. */
 static inline void
 mmio_write_64(void *addr, uint64_t value)
 {
 	*((volatile uint64_t *)(addr)) = rte_cpu_to_le_64(value);
 }
 
-/* Write a 8 bit register of a FPGA 5GNR FEC device */
+/* Write a 8 bit register of a FPGA 5GNR device. */
 static inline void
-fpga_reg_write_8(void *mmio_base, uint32_t offset, uint8_t payload)
+fpga_5gnr_reg_write_8(void *mmio_base, uint32_t offset, uint8_t payload)
 {
 	void *reg_addr = RTE_PTR_ADD(mmio_base, offset);
 	*((volatile uint8_t *)(reg_addr)) = payload;
 }
 
-/* Write a 16 bit register of a FPGA 5GNR FEC device */
+/* Write a 16 bit register of a FPGA 5GNR device. */
 static inline void
-fpga_reg_write_16(void *mmio_base, uint32_t offset, uint16_t payload)
+fpga_5gnr_reg_write_16(void *mmio_base, uint32_t offset, uint16_t payload)
 {
 	void *reg_addr = RTE_PTR_ADD(mmio_base, offset);
 	mmio_write_16(reg_addr, payload);
 }
 
-/* Write a 32 bit register of a FPGA 5GNR FEC device */
+/* Write a 32 bit register of a FPGA 5GNR device. */
 static inline void
-fpga_reg_write_32(void *mmio_base, uint32_t offset, uint32_t payload)
+fpga_5gnr_reg_write_32(void *mmio_base, uint32_t offset, uint32_t payload)
 {
 	void *reg_addr = RTE_PTR_ADD(mmio_base, offset);
 	mmio_write_32(reg_addr, payload);
 }
 
-/* Write a 64 bit register of a FPGA 5GNR FEC device */
+/* Write a 64 bit register of a FPGA 5GNR device. */
 static inline void
-fpga_reg_write_64(void *mmio_base, uint32_t offset, uint64_t payload)
+fpga_5gnr_reg_write_64(void *mmio_base, uint32_t offset, uint64_t payload)
 {
 	void *reg_addr = RTE_PTR_ADD(mmio_base, offset);
 	mmio_write_64(reg_addr, payload);
 }
 
-/* Write a ring control register of a FPGA 5GNR FEC device */
+/* Write a ring control register of a FPGA 5GNR device. */
 static inline void
-fpga_ring_reg_write(void *mmio_base, uint32_t offset,
-		struct fpga_ring_ctrl_reg payload)
+fpga_ring_reg_write(void *mmio_base, uint32_t offset, struct fpga_5gnr_ring_ctrl_reg payload)
 {
-	fpga_reg_write_64(mmio_base, offset, payload.ring_base_addr);
-	fpga_reg_write_64(mmio_base, offset + FPGA_5GNR_FEC_RING_HEAD_ADDR,
+	fpga_5gnr_reg_write_64(mmio_base, offset, payload.ring_base_addr);
+	fpga_5gnr_reg_write_64(mmio_base, offset + FPGA_5GNR_FEC_RING_HEAD_ADDR,
 			payload.ring_head_addr);
-	fpga_reg_write_16(mmio_base, offset + FPGA_5GNR_FEC_RING_SIZE,
-			payload.ring_size);
-	fpga_reg_write_16(mmio_base, offset + FPGA_5GNR_FEC_RING_HEAD_POINT,
+	fpga_5gnr_reg_write_16(mmio_base, offset + FPGA_5GNR_FEC_RING_SIZE, payload.ring_size);
+	fpga_5gnr_reg_write_16(mmio_base, offset + FPGA_5GNR_FEC_RING_HEAD_POINT,
 			payload.head_point);
-	fpga_reg_write_8(mmio_base, offset + FPGA_5GNR_FEC_RING_FLUSH_QUEUE_EN,
+	fpga_5gnr_reg_write_8(mmio_base, offset + FPGA_5GNR_FEC_RING_FLUSH_QUEUE_EN,
 			payload.flush_queue_en);
-	fpga_reg_write_16(mmio_base, offset + FPGA_5GNR_FEC_RING_SHADOW_TAIL,
+	fpga_5gnr_reg_write_16(mmio_base, offset + FPGA_5GNR_FEC_RING_SHADOW_TAIL,
 			payload.shadow_tail);
-	fpga_reg_write_8(mmio_base, offset + FPGA_5GNR_FEC_RING_MISC,
-			payload.misc);
-	fpga_reg_write_8(mmio_base, offset + FPGA_5GNR_FEC_RING_ENABLE,
-			payload.enable);
+	fpga_5gnr_reg_write_8(mmio_base, offset + FPGA_5GNR_FEC_RING_MISC, payload.misc);
+	fpga_5gnr_reg_write_8(mmio_base, offset + FPGA_5GNR_FEC_RING_ENABLE, payload.enable);
 }
 
-/* Read a register of FPGA 5GNR FEC device */
+/* Read a register of FPGA 5GNR device. */
 static inline uint32_t
-fpga_reg_read_32(void *mmio_base, uint32_t offset)
+fpga_5gnr_reg_read_32(void *mmio_base, uint32_t offset)
 {
 	void *reg_addr = RTE_PTR_ADD(mmio_base, offset);
 	uint32_t ret = *((volatile uint32_t *)(reg_addr));
@@ -360,9 +355,9 @@ fpga_reg_read_32(void *mmio_base, uint32_t offset)
 
 #ifdef RTE_LIBRTE_BBDEV_DEBUG
 
-/* Read a register of FPGA 5GNR FEC device */
+/* Read a register of FPGA 5GNR device. */
 static inline uint16_t
-fpga_reg_read_16(void *mmio_base, uint32_t offset)
+fpga_5gnr_reg_read_16(void *mmio_base, uint32_t offset)
 {
 	void *reg_addr = RTE_PTR_ADD(mmio_base, offset);
 	uint16_t ret = *((volatile uint16_t *)(reg_addr));
@@ -371,17 +366,17 @@ fpga_reg_read_16(void *mmio_base, uint32_t offset)
 
 #endif
 
-/* Read a register of FPGA 5GNR FEC device */
+/* Read a register of FPGA 5GNR device. */
 static inline uint8_t
-fpga_reg_read_8(void *mmio_base, uint32_t offset)
+fpga_5gnr_reg_read_8(void *mmio_base, uint32_t offset)
 {
 	void *reg_addr = RTE_PTR_ADD(mmio_base, offset);
 	return *((volatile uint8_t *)(reg_addr));
 }
 
-/* Read a register of FPGA 5GNR FEC device */
+/* Read a register of FPGA 5GNR device. */
 static inline uint64_t
-fpga_reg_read_64(void *mmio_base, uint32_t offset)
+fpga_5gnr_reg_read_64(void *mmio_base, uint32_t offset)
 {
 	void *reg_addr = RTE_PTR_ADD(mmio_base, offset);
 	uint64_t ret = *((volatile uint64_t *)(reg_addr));
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +205 -250

1,088 lines not on this page · raw message

drivers/baseband/fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h +8 -9
index f042d5dea586..894c218a5f7d 100644
@@ -13,9 +13,8 @@
 /**
  * @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
+ * Functions for configuring VC 5GNR and AGX100 HW, exposed directly to applications.
+ * Configuration related to encoding/decoding is done through the
  * librte_bbdev library.
  *
  * @warning
@@ -26,11 +25,11 @@
 extern "C" {
 #endif
 
-/** Number of Virtual Functions FGPA 4G FEC supports */
+/** Number of Virtual Functions FPGA 5GNR FEC supports */
 #define FPGA_5GNR_FEC_NUM_VFS 8
 
 /**
- * Structure to pass FPGA 4G FEC configuration.
+ * Structure to pass FPGA 5GNR FEC configuration.
  */
 struct rte_fpga_5gnr_fec_conf {
 	/** 1 if PF is used for dataplane, 0 for VFs */
@@ -39,9 +38,9 @@ struct rte_fpga_5gnr_fec_conf {
 	uint8_t vf_ul_queues_number[FPGA_5GNR_FEC_NUM_VFS];
 	/** Number of DL queues per VF */
 	uint8_t vf_dl_queues_number[FPGA_5GNR_FEC_NUM_VFS];
-	/** UL bandwidth. Needed for schedule algorithm */
+	/** UL bandwidth. Needed only for VC schedule algorithm */
 	uint8_t ul_bandwidth;
-	/** DL bandwidth. Needed for schedule algorithm */
+	/** DL bandwidth. Needed only for VC schedule algorithm */
 	uint8_t dl_bandwidth;
 	/** UL Load Balance */
 	uint8_t ul_load_balance;
@@ -50,14 +49,14 @@ struct rte_fpga_5gnr_fec_conf {
 };
 
 /**
- * Configure Intel(R) FPGA 5GNR FEC device
+ * Configure a FPGA 5GNR device in PF mode notably for bbdev-test
  *
  * @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.
+ *   Configuration to apply to FPGA 5GNR FEC.
  *
  * @return
  *   Zero on success, negative value on failure.
Signature · 1 line
2.37.1
#6 lore raw

PATCH 4/6 baseband/fpga_5gnr_fec: add Vista Creek variant

In reply to Hernan Vargas

Create a new file vc_5gnr_pmd.h to store structures and macros specific to Vista Creek 5G FPGA implementation and rename functions specific to the Vista Creek variant.

---
 .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    | 183 +-----
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         | 531 +++++++++---------
 drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h  | 140 +++++
 3 files changed, 426 insertions(+), 428 deletions(-)
 create mode 100644 drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +31 -152
index 9300349a731b..c88d276cc48f 100644
@@ -8,6 +8,8 @@
 #include <stdint.h>
 #include <stdbool.h>
 
+#include "vc_5gnr_pmd.h"
+
 /* Helper macro for logging */
 #define rte_bbdev_log(level, fmt, ...) \
 	rte_log(RTE_LOG_ ## level, fpga_5gnr_fec_logtype, fmt "\n", \
@@ -25,32 +27,20 @@
 #define FPGA_5GNR_FEC_PF_DRIVER_NAME intel_fpga_5gnr_fec_pf
 #define FPGA_5GNR_FEC_VF_DRIVER_NAME intel_fpga_5gnr_fec_vf
 
-/* FPGA 5GNR FEC PCI vendor & device IDs */
-#define FPGA_5GNR_FEC_VENDOR_ID (0x8086)
-#define FPGA_5GNR_FEC_PF_DEVICE_ID (0x0D8F)
-#define FPGA_5GNR_FEC_VF_DEVICE_ID (0x0D90)
-
-/* Align DMA descriptors to 256 bytes - cache-aligned */
-#define FPGA_5GNR_RING_DESC_ENTRY_LENGTH (8)
-/* Ring size is in 256 bits (32 bytes) units */
-#define FPGA_RING_DESC_LEN_UNIT_BYTES (32)
-/* Maximum size of queue */
-#define FPGA_5GNR_RING_MAX_SIZE (1024)
-
-#define FPGA_NUM_UL_QUEUES (32)
-#define FPGA_NUM_DL_QUEUES (32)
-#define FPGA_TOTAL_NUM_QUEUES (FPGA_NUM_UL_QUEUES + FPGA_NUM_DL_QUEUES)
-#define FPGA_NUM_INTR_VEC (FPGA_TOTAL_NUM_QUEUES - RTE_INTR_VEC_RXTX_OFFSET)
-
 #define FPGA_5GNR_INVALID_HW_QUEUE_ID (0xFFFFFFFF)
-
 #define FPGA_5GNR_QUEUE_FLUSH_TIMEOUT_US (1000)
 #define FPGA_5GNR_HARQ_RDY_TIMEOUT (10)
 #define FPGA_5GNR_TIMEOUT_CHECK_INTERVAL (5)
 #define FPGA_5GNR_DDR_OVERFLOW (0x10)
-
 #define FPGA_5GNR_DDR_WR_DATA_LEN_IN_BYTES 8
 #define FPGA_5GNR_DDR_RD_DATA_LEN_IN_BYTES 8
+/* Align DMA descriptors to 256 bytes - cache-aligned. */
+#define FPGA_5GNR_RING_DESC_ENTRY_LENGTH (8)
+/* Maximum size of queue. */
+#define FPGA_5GNR_RING_MAX_SIZE (1024)
+
+#define VC_5GNR_FPGA_VARIANT	0
+#define AGX100_FPGA_VARIANT	1
 
 /* Constants from K0 computation from 3GPP 38.212 Table 5.4.2.1-2 */
 #define N_ZC_1 66 /* N = 66 Zc for BG 1 */
@@ -62,32 +52,7 @@
 #define K0_3_1 56 /* K0 fraction numerator for rv 3 and BG 1 */
 #define K0_3_2 43 /* K0 fraction numerator for rv 3 and BG 2 */
 
-/* FPGA 5GNR FEC Register mapping on BAR0 */
-enum {
-	FPGA_5GNR_FEC_VERSION_ID = 0x00000000, /* len: 4B */
-	FPGA_5GNR_FEC_CONFIGURATION = 0x00000004, /* len: 2B */
-	FPGA_5GNR_FEC_QUEUE_PF_VF_MAP_DONE = 0x00000008, /* len: 1B */
-	FPGA_5GNR_FEC_LOAD_BALANCE_FACTOR = 0x0000000a, /* len: 2B */
-	FPGA_5GNR_FEC_RING_DESC_LEN = 0x0000000c, /* len: 2B */
-	FPGA_5GNR_FEC_VFQ_FLUSH_STATUS_LW = 0x00000018, /* len: 4B */
-	FPGA_5GNR_FEC_VFQ_FLUSH_STATUS_HI = 0x0000001c, /* len: 4B */
-	FPGA_5GNR_FEC_QUEUE_MAP = 0x00000040, /* len: 256B */
-	FPGA_5GNR_FEC_RING_CTRL_REGS = 0x00000200, /* len: 2048B */
-	FPGA_5GNR_FEC_DDR4_WR_ADDR_REGS = 0x00000A00, /* len: 4B */
-	FPGA_5GNR_FEC_DDR4_WR_DATA_REGS = 0x00000A08, /* len: 8B */
-	FPGA_5GNR_FEC_DDR4_WR_DONE_REGS = 0x00000A10, /* len: 1B */
-	FPGA_5GNR_FEC_DDR4_RD_ADDR_REGS = 0x00000A18, /* len: 4B */
-	FPGA_5GNR_FEC_DDR4_RD_DONE_REGS = 0x00000A20, /* len: 1B */
-	FPGA_5GNR_FEC_DDR4_RD_RDY_REGS = 0x00000A28, /* len: 1B */
-	FPGA_5GNR_FEC_DDR4_RD_DATA_REGS = 0x00000A30, /* len: 8B */
-	FPGA_5GNR_FEC_DDR4_ADDR_RDY_REGS = 0x00000A38, /* len: 1B */
-	FPGA_5GNR_FEC_HARQ_BUF_SIZE_RDY_REGS = 0x00000A40, /* len: 1B */
-	FPGA_5GNR_FEC_HARQ_BUF_SIZE_REGS = 0x00000A48, /* len: 4B */
-	FPGA_5GNR_FEC_MUTEX = 0x00000A60, /* len: 4B */
-	FPGA_5GNR_FEC_MUTEX_RESET = 0x00000A68  /* len: 4B */
-};
-
-/* FPGA 5GNR FEC Ring Control Registers */
+/* FPGA 5GNR Ring Control Registers. */
 enum {
 	FPGA_5GNR_FEC_RING_HEAD_ADDR = 0x00000008,
 	FPGA_5GNR_FEC_RING_SIZE = 0x00000010,
@@ -98,113 +63,27 @@ enum {
 	FPGA_5GNR_FEC_RING_HEAD_POINT = 0x0000001C
 };
 
-/* FPGA 5GNR FEC DESCRIPTOR ERROR */
+/* VC 5GNR and AGX100 common register mapping on BAR0. */
 enum {
-	DESC_ERR_NO_ERR = 0x0,
-	DESC_ERR_K_P_OUT_OF_RANGE = 0x1,
-	DESC_ERR_Z_C_NOT_LEGAL = 0x2,
-	DESC_ERR_DESC_OFFSET_ERR = 0x3,
-	DESC_ERR_DESC_READ_FAIL = 0x8,
-	DESC_ERR_DESC_READ_TIMEOUT = 0x9,
-	DESC_ERR_DESC_READ_TLP_POISONED = 0xA,
-	DESC_ERR_HARQ_INPUT_LEN = 0xB,
-	DESC_ERR_CB_READ_FAIL = 0xC,
-	DESC_ERR_CB_READ_TIMEOUT = 0xD,
-	DESC_ERR_CB_READ_TLP_POISONED = 0xE,
-	DESC_ERR_HBSTORE_ERR = 0xF
-};
-
-
-/* FPGA 5GNR FEC DMA Encoding Request Descriptor */
-struct __rte_packed fpga_dma_enc_desc {
-	uint32_t done:1,
-		rsrvd0:7,
-		error:4,
-		rsrvd1:4,
-		num_null:10,
-		rsrvd2:6;
-	uint32_t ncb:15,
-		rsrvd3:1,
-		k0:16;
-	uint32_t irq_en:1,
-		crc_en:1,
-		rsrvd4:1,
-		qm_idx:3,
-		bg_idx:1,
-		zc:9,
-		desc_idx:10,
-		rsrvd5:6;
-	uint16_t rm_e;
-	uint16_t k_;
-	uint32_t out_addr_lw;
-	uint32_t out_addr_hi;
-	uint32_t in_addr_lw;
-	uint32_t in_addr_hi;
-
-	union {
-		struct {
-			/* Virtual addresses used to retrieve SW context info */
-			void *op_addr;
-			/* Stores information about total number of Code Blocks
-			 * in currently processed Transport Block
-			 */
-			uint64_t cbs_in_op;
-		};
-
-		uint8_t sw_ctxt[FPGA_RING_DESC_LEN_UNIT_BYTES *
-					(FPGA_5GNR_RING_DESC_ENTRY_LENGTH - 1)];
-	};
-};
-
-
-/* FPGA 5GNR DPC FEC DMA Decoding Request Descriptor */
-struct __rte_packed fpga_dma_dec_desc {
-	uint32_t done:1,
-		iter:5,
-		et_pass:1,
-		crcb_pass:1,
-		error:4,
-		qm_idx:3,
-		max_iter:5,
-		bg_idx:1,
-		rsrvd0:1,
-		harqin_en:1,
-		zc:9;
-	uint32_t hbstroe_offset:22,
-		num_null:10;
-	uint32_t irq_en:1,
-		ncb:15,
-		desc_idx:10,
-		drop_crc24b:1,
-		crc24b_ind:1,
-		rv:2,
-		et_dis:1,
-		rsrvd2:1;
-	uint32_t harq_input_length:16,
-		rm_e:16;/*the inbound data byte length*/
-	uint32_t out_addr_lw;
-	uint32_t out_addr_hi;
-	uint32_t in_addr_lw;
-	uint32_t in_addr_hi;
-
-	union {
-		struct {
-			/* Virtual addresses used to retrieve SW context info */
-			void *op_addr;
-			/* Stores information about total number of Code Blocks
-			 * in currently processed Transport Block
-			 */
-			uint8_t cbs_in_op;
-		};
-
-		uint32_t sw_ctxt[8 * (FPGA_5GNR_RING_DESC_ENTRY_LENGTH - 1)];
-	};
-};
-
-/* FPGA 5GNR DMA Descriptor */
-union fpga_dma_desc {
-	struct fpga_dma_enc_desc enc_req;
-	struct fpga_dma_dec_desc dec_req;
+	FPGA_5GNR_FEC_VERSION_ID = 0x00000000, /**< len: 4B */
+	FPGA_5GNR_FEC_QUEUE_PF_VF_MAP_DONE = 0x00000008, /**< len: 1B */
+	FPGA_5GNR_FEC_LOAD_BALANCE_FACTOR = 0x0000000A, /**< len: 2B */
+	FPGA_5GNR_FEC_RING_DESC_LEN = 0x0000000C, /**< len: 2B */
+	FPGA_5GNR_FEC_VFQ_FLUSH_STATUS_LW = 0x00000018, /**< len: 4B */
+	FPGA_5GNR_FEC_VFQ_FLUSH_STATUS_HI = 0x0000001C, /**< len: 4B */
+	FPGA_5GNR_FEC_RING_CTRL_REGS = 0x00000200, /**< len: 2048B */
+	FPGA_5GNR_FEC_DDR4_WR_ADDR_REGS = 0x00000A00, /**< len: 4B */
+	FPGA_5GNR_FEC_DDR4_WR_DATA_REGS = 0x00000A08, /**< len: 8B */
+	FPGA_5GNR_FEC_DDR4_WR_DONE_REGS = 0x00000A10, /**< len: 1B */
+	FPGA_5GNR_FEC_DDR4_RD_ADDR_REGS = 0x00000A18, /**< len: 4B */
+	FPGA_5GNR_FEC_DDR4_RD_DONE_REGS = 0x00000A20, /**< len: 1B */
+	FPGA_5GNR_FEC_DDR4_RD_RDY_REGS = 0x00000A28, /**< len: 1B */
+	FPGA_5GNR_FEC_DDR4_RD_DATA_REGS = 0x00000A30, /**< len: 8B */
+	FPGA_5GNR_FEC_DDR4_ADDR_RDY_REGS = 0x00000A38, /**< len: 1B */
+	FPGA_5GNR_FEC_HARQ_BUF_SIZE_RDY_REGS = 0x00000A40, /**< len: 1B */
+	FPGA_5GNR_FEC_HARQ_BUF_SIZE_REGS = 0x00000A48, /**< len: 4B */
+	FPGA_5GNR_FEC_MUTEX = 0x00000A60, /**< len: 4B */
+	FPGA_5GNR_FEC_MUTEX_RESET = 0x00000A68  /**< len: 4B */
 };
 
 /* FPGA 5GNR Ring Control Register. */
@@ -257,7 +136,7 @@ struct fpga_5gnr_fec_device {
 /** Structure associated with each queue. */
 struct __rte_cache_aligned fpga_5gnr_queue {
 	struct fpga_5gnr_ring_ctrl_reg ring_ctrl_reg;  /**< Ring Control Register */
-	union fpga_dma_desc *ring_addr;  /* Virtual address of software ring */
+	union vc_5gnr_dma_desc *vc_5gnr_ring_addr; /**< Virtual address of VC 5GNR software ring. */
 	uint64_t *ring_head_addr;  /* Virtual address of completion_head */
 	uint64_t shadow_completion_head; /* Shadow completion head value */
 	uint16_t head_free_desc;  /* Ring head */
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +255 -276

1,065 lines not on this page · raw message

drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h new file +140 -0

140 lines not on this page · raw message

Signature · 1 line
2.37.1
#7 lore raw

PATCH 5/6 baseband/fpga_5gnr_fec: add AGX100 support

In reply to Hernan Vargas

Add support for new FPGA variant AGX100 (on Arrow Creek N6000).

---
 doc/guides/bbdevs/fpga_5gnr_fec.rst           |   72 +-
 drivers/baseband/fpga_5gnr_fec/agx100_pmd.h   |  273 ++++
 .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    |    6 +
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         | 1197 +++++++++++++++--
 4 files changed, 1395 insertions(+), 153 deletions(-)
 create mode 100644 drivers/baseband/fpga_5gnr_fec/agx100_pmd.h
doc/guides/bbdevs/fpga_5gnr_fec.rst +47 -25
index 9d71585e9e18..c27db695a834 100644
@@ -6,12 +6,13 @@ Intel(R) FPGA 5GNR FEC Poll Mode Driver
 
 The BBDEV FPGA 5GNR FEC poll mode driver (PMD) supports an FPGA implementation of a VRAN
 LDPC Encode / Decode 5GNR wireless acceleration function, using Intel's PCI-e and FPGA
-based Vista Creek device.
+based Vista Creek (N3000, referred to as VC_5GNR in the code) as well as Arrow Creek (N6000,
+referred to as AGX100 in the code).
 
 Features
 --------
 
-FPGA 5GNR FEC PMD supports the following features:
+FPGA 5GNR FEC PMD supports the following BBDEV capabilities:
 
 - LDPC Encode in the DL
 - LDPC Decode in the UL
@@ -67,10 +68,18 @@ Initialization
 
 When the device first powers up, its PCI Physical Functions (PF) can be listed through this command:
 
+Vista Creek (N3000)
+
 .. code-block:: console
 
   sudo lspci -vd8086:0d8f
 
+Arrow Creek (N6000)
+
+.. code-block:: console
+
+  sudo lspci -vd8086:5799
+
 The physical and virtual functions are compatible with Linux UIO drivers:
 ``vfio`` and ``igb_uio``. However, in order to work the FPGA 5GNR FEC device firstly needs
 to be bound to one of these linux drivers through DPDK.
@@ -85,24 +94,34 @@ Install the DPDK igb_uio driver, bind it with the PF PCI device ID and use
 The igb_uio driver may be bound to the PF PCI device using one of two methods:
 
 
-1. PCI functions (physical or virtual, depending on the use case) can be bound to
-the UIO driver by repeating this command for every function.
+1. PCI functions (physical or virtual, depending on the use case) can be bound to the UIO driver by repeating this command for every function.
 
-.. code-block:: console
+  .. code-block:: console
+
+    insmod igb_uio.ko
+
+  Bind N3000 to igb_uio
+
+  .. code-block:: console
 
-  insmod igb_uio.ko
-  echo "8086 0d8f" > /sys/bus/pci/drivers/igb_uio/new_id
-  lspci -vd8086:0d8f
+    echo "8086 0d8f" > /sys/bus/pci/drivers/igb_uio/new_id
+    lspci -vd8086:0d8f
 
+  Bind N6000 to igb_uio
+
+  .. code-block:: console
+
+    echo "8086 5799" > /sys/bus/pci/drivers/igb_uio/new_id
+    lspci -vd8086:5799
 
 2. Another way to bind PF with DPDK UIO driver is by using the ``dpdk-devbind.py`` tool
 
-.. code-block:: console
+  .. code-block:: console
 
-  cd <dpdk-top-level-directory>
-  ./usertools/dpdk-devbind.py -b igb_uio 0000:06:00.0
+    cd <dpdk-top-level-directory>
+    ./usertools/dpdk-devbind.py -b igb_uio 0000:06:00.0
 
-where the PCI device ID (example: 0000:06:00.0) is obtained using lspci -vd8086:0d8f
+where the PCI device ID (example: 0000:06:00.0) is obtained using lspci -vd8086:0d8f for N3000 or lspci -vd8086:5799 for N6000
 
 
 In the same way the FPGA 5GNR FEC PF can be bound with vfio, but vfio driver does not
@@ -165,7 +184,6 @@ parameters defined in ``rte_fpga_5gnr_fec_conf`` structure:
       uint8_t dl_bandwidth;
       uint8_t ul_load_balance;
       uint8_t dl_load_balance;
-      uint16_t flr_time_out;
   };
 
 - ``pf_mode_en``: identifies whether only PF is to be used, or the VFs. PF and
@@ -176,12 +194,12 @@ parameters defined in ``rte_fpga_5gnr_fec_conf`` structure:
 
 - ``vf_*l_queues_number``: defines the hardware queue mapping for every VF.
 
-- ``*l_bandwidth``: in case of congestion on PCIe interface. The device
-  allocates different bandwidth to UL and DL. The weight is configured by this
-  setting. The unit of weight is 3 code blocks. For example, if the code block
-  cbps (code block per second) ratio between UL and DL is 12:1, then the
-  configuration value should be set to 36:3. The schedule algorithm is based
-  on code block regardless the length of each block.
+- ``*l_bandwidth``: Only used for the Vista Creek schedule algorithm in case of
+  congestion on PCIe interface. The device allocates different bandwidth to UL
+  and DL. The weight is configured by this setting. The unit of weight is 3 code
+  blocks. For example, if the code block cbps (code block per second) ratio between
+  UL and DL is 12:1, then the configuration value should be set to 36:3.
+  The schedule algorithm is based on code block regardless the length of each block.
 
 - ``*l_load_balance``: hardware queues are load-balanced in a round-robin
   fashion. Queues get filled first-in first-out until they reach a pre-defined
@@ -191,10 +209,6 @@ parameters defined in ``rte_fpga_5gnr_fec_conf`` structure:
   If all hardware queues exceeds the watermark, no code blocks will be
   streamed in from UL/DL code block FIFO.
 
-- ``flr_time_out``: specifies how many 16.384us to be FLR time out. The
-  time_out = flr_time_out x 16.384us. For instance, if you want to set 10ms for
-  the FLR time out then set this setting to 0x262=610.
-
 
 An example configuration code calling the function ``rte_fpga_5gnr_fec_configure()`` is shown
 below:
@@ -219,7 +233,7 @@ below:
   /* setup FPGA PF */
   ret = rte_fpga_5gnr_fec_configure(info->dev_name, &conf);
   TEST_ASSERT_SUCCESS(ret,
-      "Failed to configure 4G FPGA PF for bbdev %s",
+      "Failed to configure 5GNR FPGA PF for bbdev %s",
       info->dev_name);
 
 
@@ -263,7 +277,6 @@ are defined in test_bbdev_perf.c as:
 - DL_BANDWIDTH 3
 - UL_LOAD_BALANCE 128
 - DL_LOAD_BALANCE 128
-- FLR_TIMEOUT 610
 
 
 Test Vectors
@@ -287,7 +300,16 @@ See for more details: https://github.com/intel/pf-bb-config
 
 Specifically for the BBDEV FPGA 5GNR FEC PMD, the command below can be used:
 
+Vista Creek (N3000)
+
 .. code-block:: console
 
   ./pf_bb_config FPGA_5GNR -c fpga_5gnr/fpga_5gnr_config_vf.cfg
   ./test-bbdev.py -e="-c 0xff0 -a${VF_PCI_ADDR}" -c validation -n 64 -b 32 -l 1 -v ./ldpc_dec_default.data
+
+Arrow Creek (N6000)
+
+.. code-block:: console
+
+  ./pf_bb_config AGX100 -c agx100/agx100_config_1vf.cfg
+  ./test-bbdev.py -e="-c 0xff0 -a${VF_PCI_ADDR}" -c validation -n 64 -b 32 -l 1 -v ./ldpc_dec_default.data
drivers/baseband/fpga_5gnr_fec/agx100_pmd.h new file +273 -0

273 lines not on this page · raw message

drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +6 -0
index c88d276cc48f..d0d9ee64dbde 100644
@@ -8,6 +8,7 @@
 #include <stdint.h>
 #include <stdbool.h>
 
+#include "agx100_pmd.h"
 #include "vc_5gnr_pmd.h"
 
 /* Helper macro for logging */
@@ -131,12 +132,17 @@ struct fpga_5gnr_fec_device {
 	uint64_t q_assigned_bit_map;
 	/** True if this is a PF FPGA 5GNR device. */
 	bool pf_device;
+	/** Maximum number of possible queues for this device */
+	uint8_t total_num_queues;
+	/** FPGA Variant. VC_5GNR_FPGA_VARIANT = 0; AGX100_FPGA_VARIANT = 1 */
+	uint8_t fpga_variant;
 };
 
 /** Structure associated with each queue. */
 struct __rte_cache_aligned fpga_5gnr_queue {
 	struct fpga_5gnr_ring_ctrl_reg ring_ctrl_reg;  /**< Ring Control Register */
 	union vc_5gnr_dma_desc *vc_5gnr_ring_addr; /**< Virtual address of VC 5GNR software ring. */
+	union agx100_dma_desc *agx100_ring_addr;  /**< Virtual address of AGX100 software ring */
 	uint64_t *ring_head_addr;  /* Virtual address of completion_head */
 	uint64_t shadow_completion_head; /* Shadow completion head value */
 	uint16_t head_free_desc;  /* Ring head */
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +1069 -128

1,526 lines not on this page · raw message

Signature · 1 line
2.37.1
#8 lore raw

PATCH 6/6 baseband/fpga_5gnr_fec: cosmetic comment changes

In reply to Hernan Vargas

Cosmetic changes for comments.
No functional impact.

---
 .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    |  93 ++--
 .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         | 398 +++++++++---------
 .../fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h     |  16 +-
 3 files changed, 252 insertions(+), 255 deletions(-)
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +45 -48
index d0d9ee64dbde..c2aa5af2af40 100644
@@ -11,7 +11,7 @@
 #include "agx100_pmd.h"
 #include "vc_5gnr_pmd.h"
 
-/* Helper macro for logging */
+/* Helper macro for logging. */
 #define rte_bbdev_log(level, fmt, ...) \
 	rte_log(RTE_LOG_ ## level, fpga_5gnr_fec_logtype, fmt "\n", \
 		##__VA_ARGS__)
@@ -24,7 +24,7 @@
 #define rte_bbdev_log_debug(fmt, ...)
 #endif
 
-/* FPGA 5GNR FEC driver names */
+/* FPGA 5GNR FEC driver names. */
 #define FPGA_5GNR_FEC_PF_DRIVER_NAME intel_fpga_5gnr_fec_pf
 #define FPGA_5GNR_FEC_VF_DRIVER_NAME intel_fpga_5gnr_fec_vf
 
@@ -43,15 +43,15 @@
 #define VC_5GNR_FPGA_VARIANT	0
 #define AGX100_FPGA_VARIANT	1
 
-/* Constants from K0 computation from 3GPP 38.212 Table 5.4.2.1-2 */
-#define N_ZC_1 66 /* N = 66 Zc for BG 1 */
-#define N_ZC_2 50 /* N = 50 Zc for BG 2 */
-#define K0_1_1 17 /* K0 fraction numerator for rv 1 and BG 1 */
-#define K0_1_2 13 /* K0 fraction numerator for rv 1 and BG 2 */
-#define K0_2_1 33 /* K0 fraction numerator for rv 2 and BG 1 */
-#define K0_2_2 25 /* K0 fraction numerator for rv 2 and BG 2 */
-#define K0_3_1 56 /* K0 fraction numerator for rv 3 and BG 1 */
-#define K0_3_2 43 /* K0 fraction numerator for rv 3 and BG 2 */
+/* Constants from K0 computation from 3GPP 38.212 Table 5.4.2.1-2. */
+#define N_ZC_1 66 /**< N = 66 Zc for BG 1. */
+#define N_ZC_2 50 /**< N = 50 Zc for BG 2. */
+#define K0_1_1 17 /**< K0 fraction numerator for rv 1 and BG 1. */
+#define K0_1_2 13 /**< K0 fraction numerator for rv 1 and BG 2. */
+#define K0_2_1 33 /**< K0 fraction numerator for rv 2 and BG 1. */
+#define K0_2_2 25 /**< K0 fraction numerator for rv 2 and BG 2. */
+#define K0_3_1 56 /**< K0 fraction numerator for rv 3 and BG 1. */
+#define K0_3_2 43 /**< K0 fraction numerator for rv 3 and BG 2. */
 
 /* FPGA 5GNR Ring Control Registers. */
 enum {
@@ -66,25 +66,25 @@ enum {
 
 /* VC 5GNR and AGX100 common register mapping on BAR0. */
 enum {
-	FPGA_5GNR_FEC_VERSION_ID = 0x00000000, /**< len: 4B */
-	FPGA_5GNR_FEC_QUEUE_PF_VF_MAP_DONE = 0x00000008, /**< len: 1B */
-	FPGA_5GNR_FEC_LOAD_BALANCE_FACTOR = 0x0000000A, /**< len: 2B */
-	FPGA_5GNR_FEC_RING_DESC_LEN = 0x0000000C, /**< len: 2B */
-	FPGA_5GNR_FEC_VFQ_FLUSH_STATUS_LW = 0x00000018, /**< len: 4B */
-	FPGA_5GNR_FEC_VFQ_FLUSH_STATUS_HI = 0x0000001C, /**< len: 4B */
-	FPGA_5GNR_FEC_RING_CTRL_REGS = 0x00000200, /**< len: 2048B */
-	FPGA_5GNR_FEC_DDR4_WR_ADDR_REGS = 0x00000A00, /**< len: 4B */
-	FPGA_5GNR_FEC_DDR4_WR_DATA_REGS = 0x00000A08, /**< len: 8B */
-	FPGA_5GNR_FEC_DDR4_WR_DONE_REGS = 0x00000A10, /**< len: 1B */
-	FPGA_5GNR_FEC_DDR4_RD_ADDR_REGS = 0x00000A18, /**< len: 4B */
-	FPGA_5GNR_FEC_DDR4_RD_DONE_REGS = 0x00000A20, /**< len: 1B */
-	FPGA_5GNR_FEC_DDR4_RD_RDY_REGS = 0x00000A28, /**< len: 1B */
-	FPGA_5GNR_FEC_DDR4_RD_DATA_REGS = 0x00000A30, /**< len: 8B */
-	FPGA_5GNR_FEC_DDR4_ADDR_RDY_REGS = 0x00000A38, /**< len: 1B */
-	FPGA_5GNR_FEC_HARQ_BUF_SIZE_RDY_REGS = 0x00000A40, /**< len: 1B */
-	FPGA_5GNR_FEC_HARQ_BUF_SIZE_REGS = 0x00000A48, /**< len: 4B */
-	FPGA_5GNR_FEC_MUTEX = 0x00000A60, /**< len: 4B */
-	FPGA_5GNR_FEC_MUTEX_RESET = 0x00000A68  /**< len: 4B */
+	FPGA_5GNR_FEC_VERSION_ID = 0x00000000, /**< len: 4B. */
+	FPGA_5GNR_FEC_QUEUE_PF_VF_MAP_DONE = 0x00000008, /**< len: 1B. */
+	FPGA_5GNR_FEC_LOAD_BALANCE_FACTOR = 0x0000000A, /**< len: 2B. */
+	FPGA_5GNR_FEC_RING_DESC_LEN = 0x0000000C, /**< len: 2B. */
+	FPGA_5GNR_FEC_VFQ_FLUSH_STATUS_LW = 0x00000018, /**< len: 4B. */
+	FPGA_5GNR_FEC_VFQ_FLUSH_STATUS_HI = 0x0000001C, /**< len: 4B. */
+	FPGA_5GNR_FEC_RING_CTRL_REGS = 0x00000200, /**< len: 2048B. */
+	FPGA_5GNR_FEC_DDR4_WR_ADDR_REGS = 0x00000A00, /**< len: 4B. */
+	FPGA_5GNR_FEC_DDR4_WR_DATA_REGS = 0x00000A08, /**< len: 8B. */
+	FPGA_5GNR_FEC_DDR4_WR_DONE_REGS = 0x00000A10, /**< len: 1B. */
+	FPGA_5GNR_FEC_DDR4_RD_ADDR_REGS = 0x00000A18, /**< len: 4B. */
+	FPGA_5GNR_FEC_DDR4_RD_DONE_REGS = 0x00000A20, /**< len: 1B. */
+	FPGA_5GNR_FEC_DDR4_RD_RDY_REGS = 0x00000A28, /**< len: 1B. */
+	FPGA_5GNR_FEC_DDR4_RD_DATA_REGS = 0x00000A30, /**< len: 8B. */
+	FPGA_5GNR_FEC_DDR4_ADDR_RDY_REGS = 0x00000A38, /**< len: 1B. */
+	FPGA_5GNR_FEC_HARQ_BUF_SIZE_RDY_REGS = 0x00000A40, /**< len: 1B. */
+	FPGA_5GNR_FEC_HARQ_BUF_SIZE_REGS = 0x00000A48, /**< len: 4B. */
+	FPGA_5GNR_FEC_MUTEX = 0x00000A60, /**< len: 4B. */
+	FPGA_5GNR_FEC_MUTEX_RESET = 0x00000A68  /**< len: 4B. */
 };
 
 /* FPGA 5GNR Ring Control Register. */
@@ -93,7 +93,7 @@ struct __rte_packed fpga_5gnr_ring_ctrl_reg {
 	uint64_t ring_head_addr;
 	uint16_t ring_size:11;
 	uint16_t rsrvd0;
-	union { /* Miscellaneous register */
+	union { /* Miscellaneous register. */
 		uint8_t misc;
 		uint8_t max_ul_dec:5,
 			max_ul_dec_en:1,
@@ -132,30 +132,27 @@ struct fpga_5gnr_fec_device {
 	uint64_t q_assigned_bit_map;
 	/** True if this is a PF FPGA 5GNR device. */
 	bool pf_device;
-	/** Maximum number of possible queues for this device */
+	/** Maximum number of possible queues for this device. */
 	uint8_t total_num_queues;
-	/** FPGA Variant. VC_5GNR_FPGA_VARIANT = 0; AGX100_FPGA_VARIANT = 1 */
+	/** FPGA Variant. VC_5GNR_FPGA_VARIANT = 0; AGX100_FPGA_VARIANT = 1. */
 	uint8_t fpga_variant;
 };
 
 /** Structure associated with each queue. */
 struct __rte_cache_aligned fpga_5gnr_queue {
-	struct fpga_5gnr_ring_ctrl_reg ring_ctrl_reg;  /**< Ring Control Register */
+	struct fpga_5gnr_ring_ctrl_reg ring_ctrl_reg;  /**< Ring Control Register. */
 	union vc_5gnr_dma_desc *vc_5gnr_ring_addr; /**< Virtual address of VC 5GNR software ring. */
-	union agx100_dma_desc *agx100_ring_addr;  /**< Virtual address of AGX100 software ring */
-	uint64_t *ring_head_addr;  /* Virtual address of completion_head */
-	uint64_t shadow_completion_head; /* Shadow completion head value */
-	uint16_t head_free_desc;  /* Ring head */
-	uint16_t tail;  /* Ring tail */
-	/* Mask used to wrap enqueued descriptors on the sw ring */
-	uint32_t sw_ring_wrap_mask;
-	uint32_t irq_enable;  /* Enable ops dequeue interrupts if set to 1 */
-	uint8_t q_idx;  /* Queue index */
-	/** uuid used for MUTEX acquision for DDR */
-	uint16_t ddr_mutex_uuid;
-	struct fpga_5gnr_fec_device *d;
-	/* MMIO register of shadow_tail used to enqueue descriptors */
-	void *shadow_tail_addr;
+	union agx100_dma_desc *agx100_ring_addr;  /**< Virtual address of AGX100 software ring. */
+	uint64_t *ring_head_addr;  /**< Virtual address of completion_head. */
+	uint64_t shadow_completion_head; /**< Shadow completion head value. */
+	uint16_t head_free_desc;  /**< Ring head. */
+	uint16_t tail;  /**< Ring tail. */
+	uint32_t sw_ring_wrap_mask; /**< Mask used to wrap enqueued descriptors on the sw ring. */
+	uint32_t irq_enable;  /**< Enable ops dequeue interrupts if set to 1. */
+	uint8_t q_idx;  /**< Queue index. */
+	uint16_t ddr_mutex_uuid; /**< uuid used for MUTEX acquision for DDR. */
+	struct fpga_5gnr_fec_device *d; /**< FPGA 5GNR device structure. */
+	void *shadow_tail_addr; /**< MMIO register of shadow_tail used to enqueue descriptors. */
 };
 
 /* Write to 16 bit MMIO register address. */
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +199 -199

1,173 lines not on this page · raw message

drivers/baseband/fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h +8 -8
index 894c218a5f7d..2bf87c197f54 100644
@@ -25,26 +25,26 @@
 extern "C" {
 #endif
 
-/** Number of Virtual Functions FPGA 5GNR FEC supports */
+/** Number of Virtual Functions FPGA 5GNR FEC supports. */
 #define FPGA_5GNR_FEC_NUM_VFS 8
 
 /**
  * Structure to pass FPGA 5GNR FEC configuration.
  */
 struct rte_fpga_5gnr_fec_conf {
-	/** 1 if PF is used for dataplane, 0 for VFs */
+	/** 1 if PF is used for dataplane, 0 for VFs. */
 	bool pf_mode_en;
-	/** Number of UL queues per VF */
+	/** Number of UL queues per VF. */
 	uint8_t vf_ul_queues_number[FPGA_5GNR_FEC_NUM_VFS];
-	/** Number of DL queues per VF */
+	/** Number of DL queues per VF. */
 	uint8_t vf_dl_queues_number[FPGA_5GNR_FEC_NUM_VFS];
-	/** UL bandwidth. Needed only for VC schedule algorithm */
+	/** UL bandwidth. Needed only for VC schedule algorithm. */
 	uint8_t ul_bandwidth;
-	/** DL bandwidth. Needed only for VC schedule algorithm */
+	/** DL bandwidth. Needed only for VC schedule algorithm. */
 	uint8_t dl_bandwidth;
-	/** UL Load Balance */
+	/** UL Load Balance. */
 	uint8_t ul_load_balance;
-	/** DL Load Balance */
+	/** DL Load Balance. */
 	uint8_t dl_load_balance;
 };
 
Signature · 1 line
2.37.1
#9 lore raw
In reply to Hernan Vargas

Hi Hernan,

Quoted 1 line · Hernan Vargas

Targeting 23.07 if possible. Add support for AGX100 (N6000) and corner case fixes.

We can take the fixes in 23.07, but for the new devices support, it will have to wait for v23.11. Indeed, the submission deadline was one month ago (April 22nd).

Regards,
Maxime

Quoted 18 lines

Hernan Vargas (6):
baseband/fpga_5gnr_fec: fix possible div by zero baseband/fpga_5gnr_fec: fix seg fault unconf queue baseband/fpga_5gnr_fec: renaming for consistency baseband/fpga_5gnr_fec: add Vista Creek variant baseband/fpga_5gnr_fec: add AGX100 support baseband/fpga_5gnr_fec: cosmetic comment changes

  doc/guides/bbdevs/fpga_5gnr_fec.rst           |   72 +-
  drivers/baseband/fpga_5gnr_fec/agx100_pmd.h   |  273 ++
  .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h    |  349 +--
  .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c         | 2261 ++++++++++++-----
  .../fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h     |   27 +-
  drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h  |  140 +
  6 files changed, 2157 insertions(+), 965 deletions(-)

create mode 100644 drivers/baseband/fpga_5gnr_fec/agx100_pmd.h create mode 100644 drivers/baseband/fpga_5gnr_fec/vc_5gnr_pmd.h

Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH v1 1/6] baseband/fpga_5gnr_fec: fix possible div by zero

In reply to Hernan Vargas
Quoted 16 lines · Hernan Vargas

Add fix to have an early exit when z_c is zero to prevent a possible division by zero.

Fixes 44dc6faa796f ("baseband/fpga_5gnr_fec: add LDPC processing functions")
---
  drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +0 -0
index f29565af8cca..9388cce52960 100644

drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index) · line 884

Quoted 6 lines
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +2 -0
@@ -879,6 +879,8 @@ get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index)
  {
  	if (rv_index == 0)
  		return 0;
+	if (z_c == 0)
+		return 0;
  	uint16_t n = (bg == 1 ? N_ZC_1 : N_ZC_2) * z_c;

You could take the opportunity to move n declaration at the top of the function.

We this done, feel free to add:

Thanks,
Maxime

Quoted 2 lines
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +0 -0
  	if (n_cb == n) {
  		if (rv_index == 1)
#4 lore raw

Re: [PATCH v1 2/6] baseband/fpga_5gnr_fec: fix seg fault unconf queue

In reply to Hernan Vargas
Quoted 16 lines · Hernan Vargas

Adding exception to prevent segmentation fault in case a queue is started which was not configured earlier.

Fixes c58109a8871d ("baseband/fpga_5gnr_fec: add queue configuration")
---
  drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +0 -0
index 9388cce52960..a6211f73e6e3 100644

drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c fpga_queue_start(struct rte_bbdev *dev, uint16_t queue_id) · line 582

Quoted 10 lines
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +4 -0
@@ -573,6 +573,10 @@ fpga_queue_start(struct rte_bbdev *dev, uint16_t queue_id)
  		return -1;
  	}
  #endif
+	if (dev->data->queues[queue_id].queue_private == NULL) {
+		rte_bbdev_log(ERR, "Cannot start invalid queue %d", queue_id);
+		return -1;
+	}
  	struct fpga_queue *q = dev->data->queues[queue_id].queue_private;
  	uint32_t offset = FPGA_5GNR_FEC_RING_CTRL_REGS +
  			(sizeof(struct fpga_ring_ctrl_reg) * q->q_idx);

Same comment here for offset and q declarations, it should be at the top of the function.

Maxime