Skip to contentSkip to conversation

drivers/baseband: PMD for FPGA 5GNR FEC

PATCH Applied Nicolas Chautru 2 participants 13 messages Apr 18, 2020 – Apr 19, 2020 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

v5 cover drivers/baseband: PMD for FPGA 5GNR FEC

v5: Fix incremenral patch build and few rebase updates
v4: Fix incremental patch build and expose PMD header file to meson.
v3: Incremental changes from reviews : file name change, moving few inline function to .h, adding missing inline, doxygen markup fix.

Adding new baseband PMD for FPGA 5GNR FEC implementation.

Nicolas Chautru (11):
drivers/baseband: add PMD for FPGA 5GNR FEC baseband/fpga_5gnr_fec: add register definition file baseband/fpga_5gnr_fec: add info_get function baseband/fpga_5gnr_fec: add queue configuration baseband/fpga_5gnr_fec: add LDPC processing functions baseband/fpga_5gnr_fec: add HW error capture baseband/fpga_5gnr_fec: add debug functionality baseband/fpga_5gnr_fec: add configure function baseband/fpga_5gnr_fec: add harq loopback capability baseband/fpga_5gnr_fec: add interrupt support
doc: add feature matrix table for bbdev devices

 .gitignore                                         |    1 +
 app/test-bbdev/Makefile                            |    3 +
 app/test-bbdev/meson.build                         |    3 +
 app/test-bbdev/test_bbdev_perf.c                   |   57 +
 config/common_base                                 |    5 +
 doc/guides/bbdevs/features/default.ini             |   16 +
 doc/guides/bbdevs/features/fpga_5gnr_fec.ini       |   11 +
 doc/guides/bbdevs/features/fpga_lte_fec.ini        |   10 +
 doc/guides/bbdevs/features/mbc.ini                 |   14 +
 doc/guides/bbdevs/features/null.ini                |    7 +
 doc/guides/bbdevs/features/turbo_sw.ini            |   11 +
 doc/guides/bbdevs/fpga_5gnr_fec.rst                |  297 +++
 doc/guides/bbdevs/index.rst                        |    2 +
 doc/guides/bbdevs/overview.rst                     |   15 +
 doc/guides/conf.py                                 |    5 +
 doc/guides/rel_notes/release_20_05.rst             |    7 +-
 drivers/baseband/Makefile                          |    2 +
 drivers/baseband/fpga_5gnr_fec/Makefile            |   28 +
 drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h     |  388 ++++
 drivers/baseband/fpga_5gnr_fec/meson.build         |    8 +
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 2187 ++++++++++++++++++++
 .../rte_pmd_bbdev_fpga_5gnr_fec_version.map        |   10 +
 .../baseband/fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h |   74 +
 drivers/baseband/meson.build                       |    2 +-
 mk/rte.app.mk                                      |    1 +
 25 files changed, 3162 insertions(+), 2 deletions(-)
 create mode 100644 doc/guides/bbdevs/features/default.ini
 create mode 100644 doc/guides/bbdevs/features/fpga_5gnr_fec.ini
 create mode 100644 doc/guides/bbdevs/features/fpga_lte_fec.ini
 create mode 100644 doc/guides/bbdevs/features/mbc.ini
 create mode 100644 doc/guides/bbdevs/features/null.ini
 create mode 100644 doc/guides/bbdevs/features/turbo_sw.ini
 create mode 100644 doc/guides/bbdevs/fpga_5gnr_fec.rst
 create mode 100644 doc/guides/bbdevs/overview.rst
 create mode 100644 drivers/baseband/fpga_5gnr_fec/Makefile
 create mode 100644 drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h
 create mode 100644 drivers/baseband/fpga_5gnr_fec/meson.build
 create mode 100644 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
 create mode 100644 drivers/baseband/fpga_5gnr_fec/rte_pmd_bbdev_fpga_5gnr_fec_version.map
 create mode 100644 drivers/baseband/fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v5 1/11 drivers/baseband: add PMD for FPGA 5GNR FEC

Add stubs for the FPGA 5GNR FEC PMD

---
 config/common_base                                 |   5 +
 doc/guides/bbdevs/fpga_5gnr_fec.rst                | 146 ++++++++++++++++
 doc/guides/bbdevs/index.rst                        |   1 +
 doc/guides/rel_notes/release_20_05.rst             |   7 +-
 drivers/baseband/Makefile                          |   2 +
 drivers/baseband/fpga_5gnr_fec/Makefile            |  25 +++
 drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h     |  41 +++++
 drivers/baseband/fpga_5gnr_fec/meson.build         |   6 +
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 193 +++++++++++++++++++++
 .../rte_pmd_bbdev_fpga_5gnr_fec_version.map        |   3 +
 drivers/baseband/meson.build                       |   2 +-
 mk/rte.app.mk                                      |   1 +
 12 files changed, 430 insertions(+), 2 deletions(-)
 create mode 100644 doc/guides/bbdevs/fpga_5gnr_fec.rst
 create mode 100644 drivers/baseband/fpga_5gnr_fec/Makefile
 create mode 100644 drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h
 create mode 100644 drivers/baseband/fpga_5gnr_fec/meson.build
 create mode 100644 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
 create mode 100644 drivers/baseband/fpga_5gnr_fec/rte_pmd_bbdev_fpga_5gnr_fec_version.map
config/common_base +5 -0
index c31175f..9ec689d 100644
@@ -577,6 +577,11 @@ CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW=y
 CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_LTE_FEC=y
 
 #
+# Compile PMD for Intel FPGA 5GNR FEC bbdev device
+#
+CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_5GNR_FEC=y
+
+#
 # Compile generic crypto device library
 #
 CONFIG_RTE_LIBRTE_CRYPTODEV=y
doc/guides/bbdevs/fpga_5gnr_fec.rst new file +146 -0

146 lines not on this page · raw message

doc/guides/bbdevs/index.rst +1 -0
index 005b95e..1a79343 100644
@@ -11,3 +11,4 @@ Baseband Device Drivers
     null
     turbo_sw
     fpga_lte_fec
+    fpga_5gnr_fec
doc/guides/rel_notes/release_20_05.rst +6 -1
index 6837abe..098de51 100644
@@ -89,6 +89,12 @@ New Features
 
   Supported large size code blocks which does not fit in one mbuf segment.
 
+* **Added Intel FPGA_5GNR_FEC bbdev PMD.**
+
+  Added a new ``fpga_5gnr_fec`` bbdev driver for the Intel\ |reg| FPGA PAC
+  (Programmable  Acceleration Card) N3000.  See the
+  :doc:`../bbdevs/fpga_5gnr_fec` BBDEV guide for more details on this new driver.
+
 * **Updated ipsec-secgw sample application with following features.**
 
   * Updated ipsec-secgw application to add event based packet processing.
@@ -104,7 +110,6 @@ New Features
   * Added IPsec inbound load-distribution support for ipsec-secgw application
     using NIC load distribution feature(Flow Director).
 
-
 Removed Items
 -------------
 
drivers/baseband/Makefile +2 -0
index 91048be..dcc0969 100644
@@ -12,5 +12,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += turbo_sw
 DEPDIRS-turbo_sw = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_LTE_FEC) += fpga_lte_fec
 DEPDIRS-fpga_lte_fec = $(core-libs)
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_5GNR_FEC) += fpga_5gnr_fec
+DEPDIRS-fpga_5gnr_fec = $(core-libs)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/baseband/fpga_5gnr_fec/Makefile new file +25 -0
new file mode 100644
index 0000000..ffdd65c
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_bbdev_fpga_5gnr_fec.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_bbdev
+LDLIBS += -lrte_pci -lrte_bus_pci
+
+# versioning export map
+EXPORT_MAP := rte_pmd_bbdev_fpga_5gnr_fec_version.map
+
+# library version
+LIBABIVER := 1
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_5GNR_FEC) += rte_fpga_5gnr_fec.c
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h new file +41 -0

41 lines not on this page · raw message

drivers/baseband/fpga_5gnr_fec/meson.build new file +6 -0
new file mode 100644
index 0000000..75c225e
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2020 Intel Corporation
+
+deps += ['bbdev', 'bus_vdev', 'ring', 'pci', 'bus_pci']
+
+sources = files('rte_fpga_5gnr_fec.c')
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c new file +193 -0

193 lines not on this page · raw message

drivers/baseband/fpga_5gnr_fec/rte_pmd_bbdev_fpga_5gnr_fec_version.map new file +3 -0
new file mode 100644
index 0000000..f9f17e4
@@ -0,0 +1,3 @@
+DPDK_20.0 {
+	local: *;
+};
drivers/baseband/meson.build +1 -1
index be7677f..4d909f9 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <[email protected]>
 
-drivers = ['null', 'turbo_sw', 'fpga_lte_fec']
+drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec']
 
 config_flag_fmt = 'RTE_LIBRTE_PMD_BBDEV_@0@'
 driver_name_fmt = 'rte_pmd_bbdev_@0@'
mk/rte.app.mk +1 -0
index d295ca0..da12b9e 100644
@@ -246,6 +246,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD)     += -lrte_pmd_netvsc
 ifeq ($(CONFIG_RTE_LIBRTE_BBDEV),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_NULL)     += -lrte_pmd_bbdev_null
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_LTE_FEC) += -lrte_pmd_bbdev_fpga_lte_fec
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_5GNR_FEC) += -lrte_pmd_bbdev_fpga_5gnr_fec
 
 # TURBO SOFTWARE PMD is dependent on the FLEXRAN library
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -lrte_pmd_bbdev_turbo_sw
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v5 2/11 baseband/fpga_5gnr_fec: add register definition file

In reply to Nicolas Chautru

Add in the list of registers for the device and related HW specs definitions.

---
 drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h | 189 +++++++++++++++++++++++++
 1 file changed, 189 insertions(+)
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +189 -0
index 0c481e2..8db623f 100644
@@ -30,6 +30,195 @@
 #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_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_FLR_TIMEOUT_UNIT (16.384)
+
+#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_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_FEC_DDR_WR_DATA_LEN_IN_BYTES 8
+#define FPGA_5GNR_FEC_DDR_RD_DATA_LEN_IN_BYTES 8
+
+
+/* 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_FLR_TIME_OUT = 0x0000000e, /* 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 Ring Control Registers */
+enum {
+	FPGA_5GNR_FEC_RING_HEAD_ADDR = 0x00000008,
+	FPGA_5GNR_FEC_RING_SIZE = 0x00000010,
+	FPGA_5GNR_FEC_RING_MISC = 0x00000014,
+	FPGA_5GNR_FEC_RING_ENABLE = 0x00000015,
+	FPGA_5GNR_FEC_RING_FLUSH_QUEUE_EN = 0x00000016,
+	FPGA_5GNR_FEC_RING_SHADOW_TAIL = 0x00000018,
+	FPGA_5GNR_FEC_RING_HEAD_POINT = 0x0000001C
+};
+
+/* FPGA 5GNR FEC DESCRIPTOR ERROR */
+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_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 __attribute__((__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_RING_DESC_ENTRY_LENGTH - 1)];
+	};
+};
+
+
+/* FPGA 5GNR DPC FEC DMA Decoding Request Descriptor */
+struct __attribute__((__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_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 Ring Control Register */
+struct __attribute__((__packed__)) fpga_ring_ctrl_reg {
+	uint64_t ring_base_addr;
+	uint64_t ring_head_addr;
+	uint16_t ring_size:11;
+	uint16_t rsrvd0;
+	union { /* Miscellaneous register */
+		uint8_t misc;
+		uint8_t max_ul_dec:5,
+			max_ul_dec_en:1,
+			rsrvd1:2;
+	};
+	uint8_t enable;
+	uint8_t flush_queue_en;
+	uint8_t rsrvd2;
+	uint16_t shadow_tail;
+	uint16_t rsrvd3;
+	uint16_t head_point;
+	uint16_t rsrvd4;
+
+};
+
 /* Private data structure for each FPGA FEC device */
 struct fpga_5gnr_fec_device {
 	/** Base address of MMIO registers (BAR0) */
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH v5 3/11 baseband/fpga_5gnr_fec: add info_get function

In reply to Nicolas Chautru

Add in the "info_get" function to the driver, to allow us to query the device.
No capability are available yet.
Linking bbdev-test to support the PMD with null capability.

---
 app/test-bbdev/Makefile                            |  3 ++
 app/test-bbdev/meson.build                         |  3 ++
 drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h     |  9 ++++
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 53 ++++++++++++++++++++++
 4 files changed, 68 insertions(+)
app/test-bbdev/Makefile +3 -0
index 8272d2b..dc29557 100644
@@ -23,5 +23,8 @@ LDLIBS += -lm
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_LTE_FEC),y)
 LDLIBS += -lrte_pmd_bbdev_fpga_lte_fec
 endif
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_5GNR_FEC),y)
+LDLIBS += -lrte_pmd_bbdev_fpga_5gnr_fec
+endif
 
 include $(RTE_SDK)/mk/rte.app.mk
app/test-bbdev/meson.build +3 -0
index 0d9f684..18ab6a8 100644
@@ -9,3 +9,6 @@ deps += ['bbdev', 'bus_vdev']
 if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_FPGA_LTE_FEC')
 	deps += ['pmd_bbdev_fpga_lte_fec']
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_FPGA_5GNR_FEC')
+	deps += ['pmd_bbdev_fpga_5gnr_fec']
+endif
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +9 -0
index 8db623f..167d440 100644
@@ -227,4 +227,13 @@ struct fpga_5gnr_fec_device {
 	bool pf_device;
 };
 
+/* Read a register of FPGA 5GNR FEC device */
+static inline uint32_t
+fpga_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));
+	return rte_le_to_cpu_32(ret);
+}
+
 #endif /* _FPGA_5GNR_FEC_H_ */
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +53 -0

61 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#4 lore raw

PATCH v5 4/11 baseband/fpga_5gnr_fec: add queue configuration

In reply to Nicolas Chautru

Adding function to create and configure queues for the device. Still no capability.

---
 drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h     | 110 +++++++
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 365 ++++++++++++++++++++-
 2 files changed, 474 insertions(+), 1 deletion(-)
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +110 -0
index 167d440..acfa3ad 100644
@@ -223,10 +223,120 @@ struct __attribute__((__packed__)) fpga_ring_ctrl_reg {
 struct fpga_5gnr_fec_device {
 	/** Base address of MMIO registers (BAR0) */
 	void *mmio_base;
+	/** Base address of memory for sw rings */
+	void *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 */
+	uint32_t sw_ring_max_depth;
+	/** Base address of response tail pointer buffer */
+	uint32_t *tail_ptrs;
+	/** Physical address of tail pointers */
+	rte_iova_t tail_ptr_phys;
+	/** Queues flush completion flag */
+	uint64_t *flush_queue_status;
+	/* Bitmap capturing which Queues are bound to the PF/VF */
+	uint64_t q_bound_bit_map;
+	/* Bitmap capturing which Queues have already been assigned */
+	uint64_t q_assigned_bit_map;
 	/** True if this is a PF FPGA FEC 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 */
+	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 */
+	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 */
+	struct fpga_5gnr_fec_device *d;
+	/* MMIO register of shadow_tail used to enqueue descriptors */
+	void *shadow_tail_addr;
+};
+
+/* 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 */
+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 */
+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 */
+static inline void
+fpga_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 */
+static inline void
+fpga_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 */
+static inline void
+fpga_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 */
+static inline void
+fpga_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 */
+static inline void
+fpga_ring_reg_write(void *mmio_base, uint32_t offset,
+		struct fpga_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,
+			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,
+			payload.head_point);
+	fpga_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,
+			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);
+}
+
 /* Read a register of FPGA 5GNR FEC device */
 static inline uint32_t
 fpga_reg_read_32(void *mmio_base, uint32_t offset)
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +364 -1

381 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#5 lore raw

PATCH v5 5/11 baseband/fpga_5gnr_fec: add LDPC processing functions

In reply to Nicolas Chautru

Adding LDPC processing operations and related documentation.

---
 doc/guides/bbdevs/fpga_5gnr_fec.rst                |  28 +
 drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h     |   9 +
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 660 +++++++++++++++++++++
 3 files changed, 697 insertions(+)
doc/guides/bbdevs/fpga_5gnr_fec.rst +28 -0
index 007ace0..7eab7a4 100644
@@ -13,6 +13,8 @@ Features
 
 FPGA 5GNR FEC PMD supports the following features:
 
+- LDPC Encode in the DL
+- LDPC Decode in the UL
 - 8 VFs per PF (physical device)
 - Maximum of 32 UL queues per VF
 - Maximum of 32 DL queues per VF
@@ -20,6 +22,24 @@ FPGA 5GNR FEC PMD supports the following features:
 - MSI-X
 - SR-IOV
 
+FPGA 5GNR FEC PMD supports the following BBDEV capabilities:
+
+* For the LDPC encode operation:
+   - ``RTE_BBDEV_LDPC_CRC_24B_ATTACH`` :  set to attach CRC24B to CB(s)
+   - ``RTE_BBDEV_LDPC_RATE_MATCH`` :  if set then do not do Rate Match bypass
+
+* For the LDPC decode operation:
+   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK`` :  check CRC24B from CB(s)
+   - ``RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE`` :  disable early termination
+   - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP`` :  drops CRC24B bits appended while decoding
+   - ``RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE`` :  provides an input for HARQ combining
+   - ``RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE`` :  provides an input for HARQ combining
+   - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE`` :  HARQ memory input is internal
+   - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE`` :  HARQ memory output is internal
+   - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK`` :  loopback data to/from HARQ memory
+   - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS`` :  HARQ memory includes the fillers bits
+
+
 Limitations
 -----------
 
@@ -144,3 +164,11 @@ name is different:
 .. code-block:: console
 
   echo <num-of-vfs> > /sys/bus/pci/devices/0000\:<b>\:<d>.<f>/sriov_numvfs
+
+
+Test Vectors
+~~~~~~~~~~~~
+
+In addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides
+a range of additional tests under the test_vectors folder, which may be useful. The results
+of these tests will depend on the FPGA 5GNR FEC capabilities.
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +9 -0
index acfa3ad..aa5a0ff 100644
@@ -53,6 +53,15 @@
 #define FPGA_5GNR_FEC_DDR_WR_DATA_LEN_IN_BYTES 8
 #define FPGA_5GNR_FEC_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 */
+#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 FEC Register mapping on BAR0 */
 enum {
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +660 -0

684 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#6 lore raw

PATCH v5 6/11 baseband/fpga_5gnr_fec: add HW error capture

In reply to Nicolas Chautru

Adding HW specific parsing of error report for
negative scenarios. Not hit through unit test.

---
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 62 ++++++++++++++++++++--
 1 file changed, 59 insertions(+), 3 deletions(-)
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +59 -3
index 2d0fb4f..ed07cab 100644
@@ -519,6 +519,54 @@
 	return bitmap & bitmask;
 }
 
+/* Print an error if a descriptor error has occurred.
+ *  Return 0 on success, 1 on failure
+ */
+static inline int
+check_desc_error(uint32_t error_code) {
+	switch (error_code) {
+	case DESC_ERR_NO_ERR:
+		return 0;
+	case DESC_ERR_K_P_OUT_OF_RANGE:
+		rte_bbdev_log(ERR, "Encode block size K' is out of range");
+		break;
+	case DESC_ERR_Z_C_NOT_LEGAL:
+		rte_bbdev_log(ERR, "Zc is illegal");
+		break;
+	case DESC_ERR_DESC_OFFSET_ERR:
+		rte_bbdev_log(ERR,
+				"Queue offset does not meet the expectation in the FPGA"
+				);
+		break;
+	case DESC_ERR_DESC_READ_FAIL:
+		rte_bbdev_log(ERR, "Unsuccessful completion for descriptor read");
+		break;
+	case DESC_ERR_DESC_READ_TIMEOUT:
+		rte_bbdev_log(ERR, "Descriptor read time-out");
+		break;
+	case DESC_ERR_DESC_READ_TLP_POISONED:
+		rte_bbdev_log(ERR, "Descriptor read TLP poisoned");
+		break;
+	case DESC_ERR_CB_READ_FAIL:
+		rte_bbdev_log(ERR, "Unsuccessful completion for code block");
+		break;
+	case DESC_ERR_CB_READ_TIMEOUT:
+		rte_bbdev_log(ERR, "Code block read time-out");
+		break;
+	case DESC_ERR_CB_READ_TLP_POISONED:
+		rte_bbdev_log(ERR, "Code block read TLP poisoned");
+		break;
+	case DESC_ERR_HBSTORE_ERR:
+		rte_bbdev_log(ERR, "Hbstroe exceeds HARQ buffer size.");
+		break;
+	default:
+		rte_bbdev_log(ERR, "Descriptor error unknown error code %u",
+				error_code);
+		break;
+	}
+	return 1;
+}
+
 /* Compute value of k0.
  * Based on 3GPP 38.212 Table 5.4.2.1-2
  * Starting position of different redundancy versions, k0
@@ -982,11 +1030,11 @@
 
 static inline int
 dequeue_ldpc_enc_one_op_cb(struct fpga_queue *q,
-		struct rte_bbdev_enc_op **op __rte_unused,
+		struct rte_bbdev_enc_op **op,
 		uint16_t desc_offset)
 {
 	union fpga_dma_desc *desc;
-
+	int desc_error;
 	/* Set current desc */
 	desc = q->ring_addr + ((q->head_free_desc + desc_offset)
 			& q->sw_ring_wrap_mask);
@@ -1000,6 +1048,11 @@
 
 	rte_bbdev_log_debug("DMA response desc %p", desc);
 
+	*op = desc->enc_req.op_addr;
+	/* Check the descriptor error field, return 1 on error */
+	desc_error = check_desc_error(desc->enc_req.error);
+	(*op)->status = desc_error << RTE_BBDEV_DATA_ERROR;
+
 	return 1;
 }
 
@@ -1009,7 +1062,7 @@
 		uint16_t desc_offset)
 {
 	union fpga_dma_desc *desc;
-
+	int desc_error;
 	/* Set descriptor */
 	desc = q->ring_addr + ((q->head_free_desc + desc_offset)
 			& q->sw_ring_wrap_mask);
@@ -1036,6 +1089,9 @@
 		(*op)->status = 1 << RTE_BBDEV_CRC_ERROR;
 	/* et_pass = 0 when decoder fails */
 	(*op)->status |= !(desc->dec_req.et_pass) << RTE_BBDEV_SYNDROME_ERROR;
+	/* Check the descriptor error field, return 1 on error */
+	desc_error = check_desc_error(desc->dec_req.error);
+	(*op)->status |= desc_error << RTE_BBDEV_DATA_ERROR;
 	return 1;
 }
 
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v5 7/11 baseband/fpga_5gnr_fec: add debug functionality

In reply to Nicolas Chautru

Adding functionality for debug mode to be more verbose and catch error from unsupported configuration.

---
 drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h     |  30 ++
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 356 +++++++++++++++++++++
 2 files changed, 386 insertions(+)
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +30 -0
index aa5a0ff..b70edf0 100644
@@ -355,4 +355,34 @@ struct __rte_cache_aligned fpga_queue {
 	return rte_le_to_cpu_32(ret);
 }
 
+#ifdef RTE_LIBRTE_BBDEV_DEBUG
+
+/* Read a register of FPGA 5GNR FEC device */
+static inline uint16_t
+fpga_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));
+	return rte_le_to_cpu_16(ret);
+}
+
+/* Read a register of FPGA 5GNR FEC device */
+static inline uint8_t
+fpga_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 */
+static inline uint64_t
+fpga_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));
+	return rte_le_to_cpu_64(ret);
+}
+
+#endif
+
 #endif /* _FPGA_5GNR_FEC_H_ */
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +356 -0

428 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#8 lore raw

PATCH v5 8/11 baseband/fpga_5gnr_fec: add configure function

In reply to Nicolas Chautru

Add configure function to configure the PF from within the bbdev-test itself without external application configuration the device.

---
 app/test-bbdev/test_bbdev_perf.c                   |  57 ++++++
 doc/guides/bbdevs/fpga_5gnr_fec.rst                | 123 +++++++++++++
 drivers/baseband/fpga_5gnr_fec/Makefile            |   3 +
 drivers/baseband/fpga_5gnr_fec/meson.build         |   2 +
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 196 +++++++++++++++++++++
 .../rte_pmd_bbdev_fpga_5gnr_fec_version.map        |   7 +
 .../baseband/fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h |  74 ++++++++
 7 files changed, 462 insertions(+)
 create mode 100644 drivers/baseband/fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h
app/test-bbdev/test_bbdev_perf.c +57 -0
index 6ec17e5..45c0d62 100644
@@ -39,6 +39,19 @@
 #define FLR_4G_TIMEOUT 610
 #endif
 
+#ifdef RTE_LIBRTE_PMD_BBDEV_FPGA_5GNR_FEC
+#include <rte_pmd_fpga_5gnr_fec.h>
+#define FPGA_5GNR_PF_DRIVER_NAME ("intel_fpga_5gnr_fec_pf")
+#define FPGA_5GNR_VF_DRIVER_NAME ("intel_fpga_5gnr_fec_vf")
+#define VF_UL_5G_QUEUE_VALUE 4
+#define VF_DL_5G_QUEUE_VALUE 4
+#define UL_5G_BANDWIDTH 3
+#define DL_5G_BANDWIDTH 3
+#define UL_5G_LOAD_BALANCE 128
+#define DL_5G_LOAD_BALANCE 128
+#define FLR_5G_TIMEOUT 610
+#endif
+
 #define OPS_CACHE_SIZE 256U
 #define OPS_POOL_SIZE_MIN 511U /* 0.5K per queue */
 
@@ -596,6 +609,50 @@ typedef int (test_case_function)(struct active_device *ad,
 				info->dev_name);
 	}
 #endif
+#ifdef RTE_LIBRTE_PMD_BBDEV_FPGA_5GNR_FEC
+	if ((get_init_device() == true) &&
+		(!strcmp(info->drv.driver_name, FPGA_5GNR_PF_DRIVER_NAME))) {
+		struct fpga_5gnr_fec_conf conf;
+		unsigned int i;
+
+		printf("Configure FPGA 5GNR FEC Driver %s with default values\n",
+				info->drv.driver_name);
+
+		/* clear default configuration before initialization */
+		memset(&conf, 0, sizeof(struct fpga_5gnr_fec_conf));
+
+		/* Set PF mode :
+		 * true if PF is used for data plane
+		 * false for VFs
+		 */
+		conf.pf_mode_en = true;
+
+		for (i = 0; i < FPGA_5GNR_FEC_NUM_VFS; ++i) {
+			/* Number of UL queues per VF (fpga supports 8 VFs) */
+			conf.vf_ul_queues_number[i] = VF_UL_5G_QUEUE_VALUE;
+			/* Number of DL queues per VF (fpga supports 8 VFs) */
+			conf.vf_dl_queues_number[i] = VF_DL_5G_QUEUE_VALUE;
+		}
+
+		/* UL bandwidth. Needed for schedule algorithm */
+		conf.ul_bandwidth = UL_5G_BANDWIDTH;
+		/* DL bandwidth */
+		conf.dl_bandwidth = DL_5G_BANDWIDTH;
+
+		/* UL & DL load Balance Factor to 64 */
+		conf.ul_load_balance = UL_5G_LOAD_BALANCE;
+		conf.dl_load_balance = DL_5G_LOAD_BALANCE;
+
+		/**< FLR timeout value */
+		conf.flr_time_out = FLR_5G_TIMEOUT;
+
+		/* setup FPGA PF with configuration information */
+		ret = fpga_5gnr_fec_configure(info->dev_name, &conf);
+		TEST_ASSERT_SUCCESS(ret,
+				"Failed to configure 5G FPGA PF for bbdev %s",
+				info->dev_name);
+	}
+#endif
 	nb_queues = RTE_MIN(rte_lcore_count(), info->drv.max_num_queues);
 	nb_queues = RTE_MIN(nb_queues, (unsigned int) MAX_QUEUES);
 
doc/guides/bbdevs/fpga_5gnr_fec.rst +123 -0

129 lines not on this page · raw message

drivers/baseband/fpga_5gnr_fec/Makefile +3 -0
index ffdd65c..7b7017c 100644
@@ -22,4 +22,7 @@ LIBABIVER := 1
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_5GNR_FEC) += rte_fpga_5gnr_fec.c
 
+# export include files
+SYMLINK-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_FPGA_5GNR_FEC)-include += rte_pmd_fpga_5gnr_fec.h
+
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/baseband/fpga_5gnr_fec/meson.build +2 -0
index 75c225e..9d10bcf 100644
@@ -4,3 +4,5 @@
 deps += ['bbdev', 'bus_vdev', 'ring', 'pci', 'bus_pci']
 
 sources = files('rte_fpga_5gnr_fec.c')
+
+install_headers('rte_pmd_fpga_5gnr_fec.h')
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +196 -0

208 lines not on this page · raw message

drivers/baseband/fpga_5gnr_fec/rte_pmd_bbdev_fpga_5gnr_fec_version.map +7 -0
index f9f17e4..b0fb971 100644
@@ -1,3 +1,10 @@
 DPDK_20.0 {
 	local: *;
 };
+
+EXPERIMENTAL {
+	global:
+
+	fpga_5gnr_fec_configure;
+
+};
drivers/baseband/fpga_5gnr_fec/rte_pmd_fpga_5gnr_fec.h new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#9 lore raw

PATCH v5 9/11 baseband/fpga_5gnr_fec: add harq loopback capability

In reply to Nicolas Chautru

Adding optional capability to support loopback preloading and check of the extern HARQ memory.
This function is required to run the HARQ bit exact test successfully.

---
 drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h     |   4 +-
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 171 +++++++++++++++++++++
 2 files changed, 173 insertions(+), 2 deletions(-)
drivers/baseband/fpga_5gnr_fec/fpga_5gnr_fec.h +2 -2
index b70edf0..2587af1 100644
@@ -366,6 +366,8 @@ struct __rte_cache_aligned fpga_queue {
 	return rte_le_to_cpu_16(ret);
 }
 
+#endif
+
 /* Read a register of FPGA 5GNR FEC device */
 static inline uint8_t
 fpga_reg_read_8(void *mmio_base, uint32_t offset)
@@ -383,6 +385,4 @@ struct __rte_cache_aligned fpga_queue {
 	return rte_le_to_cpu_64(ret);
 }
 
-#endif
-
 #endif /* _FPGA_5GNR_FEC_H_ */
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +171 -0

189 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#10 lore raw

PATCH v5 10/11 baseband/fpga_5gnr_fec: add interrupt support

In reply to Nicolas Chautru

Adding support for interrupt capability in the PMD and the related operations.

---
 drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 139 +++++++++++++++++++++
 1 file changed, 139 insertions(+)
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +139 -0
index 63d11ad..e152b20 100644
@@ -325,6 +325,7 @@
 				RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE |
 				RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE |
 				RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK |
+				RTE_BBDEV_LDPC_DEC_INTERRUPTS |
 				RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS,
 			.llr_size = 6,
 			.llr_decimals = 2,
@@ -636,14 +637,152 @@
 	return 0;
 }
 
+static inline uint16_t
+get_queue_id(struct rte_bbdev_data *data, uint8_t q_idx)
+{
+	uint16_t queue_id;
+
+	for (queue_id = 0; queue_id < data->num_queues; ++queue_id) {
+		struct fpga_queue *q = data->queues[queue_id].queue_private;
+		if (q != NULL && q->q_idx == q_idx)
+			return queue_id;
+	}
+
+	return -1;
+}
+
+/* Interrupt handler triggered by FPGA dev for handling specific interrupt */
+static void
+fpga_dev_interrupt_handler(void *cb_arg)
+{
+	struct rte_bbdev *dev = cb_arg;
+	struct fpga_5gnr_fec_device *fpga_dev = dev->data->dev_private;
+	struct fpga_queue *q;
+	uint64_t ring_head;
+	uint64_t q_idx;
+	uint16_t queue_id;
+	uint8_t i;
+
+	/* Scan queue assigned to this device */
+	for (i = 0; i < FPGA_TOTAL_NUM_QUEUES; ++i) {
+		q_idx = 1ULL << i;
+		if (fpga_dev->q_bound_bit_map & q_idx) {
+			queue_id = get_queue_id(dev->data, i);
+			if (queue_id == (uint16_t) -1)
+				continue;
+
+			/* Check if completion head was changed */
+			q = dev->data->queues[queue_id].queue_private;
+			ring_head = *q->ring_head_addr;
+			if (q->shadow_completion_head != ring_head &&
+				q->irq_enable == 1) {
+				q->shadow_completion_head = ring_head;
+				rte_bbdev_pmd_callback_process(
+						dev,
+						RTE_BBDEV_EVENT_DEQUEUE,
+						&queue_id);
+			}
+		}
+	}
+}
+
+static int
+fpga_queue_intr_enable(struct rte_bbdev *dev, uint16_t queue_id)
+{
+	struct fpga_queue *q = dev->data->queues[queue_id].queue_private;
+
+	if (!rte_intr_cap_multiple(dev->intr_handle))
+		return -ENOTSUP;
+
+	q->irq_enable = 1;
+
+	return 0;
+}
+
+static int
+fpga_queue_intr_disable(struct rte_bbdev *dev, uint16_t queue_id)
+{
+	struct fpga_queue *q = dev->data->queues[queue_id].queue_private;
+	q->irq_enable = 0;
+
+	return 0;
+}
+
+static int
+fpga_intr_enable(struct rte_bbdev *dev)
+{
+	int ret;
+	uint8_t i;
+
+	if (!rte_intr_cap_multiple(dev->intr_handle)) {
+		rte_bbdev_log(ERR, "Multiple intr vector is not supported by FPGA (%s)",
+				dev->data->name);
+		return -ENOTSUP;
+	}
+
+	/* Create event file descriptors for each of 64 queue. Event fds will be
+	 * mapped to FPGA IRQs in rte_intr_enable(). This is a 1:1 mapping where
+	 * the IRQ number is a direct translation to the queue number.
+	 *
+	 * 63 (FPGA_NUM_INTR_VEC) event fds are created as rte_intr_enable()
+	 * mapped the first IRQ to already created interrupt event file
+	 * descriptor (intr_handle->fd).
+	 */
+	if (rte_intr_efd_enable(dev->intr_handle, FPGA_NUM_INTR_VEC)) {
+		rte_bbdev_log(ERR, "Failed to create fds for %u queues",
+				dev->data->num_queues);
+		return -1;
+	}
+
+	/* TODO Each event file descriptor is overwritten by interrupt event
+	 * file descriptor. That descriptor is added to epoll observed list.
+	 * It ensures that callback function assigned to that descriptor will
+	 * invoked when any FPGA queue issues interrupt.
+	 */
+	for (i = 0; i < FPGA_NUM_INTR_VEC; ++i)
+		dev->intr_handle->efds[i] = dev->intr_handle->fd;
+
+	if (!dev->intr_handle->intr_vec) {
+		dev->intr_handle->intr_vec = rte_zmalloc("intr_vec",
+				dev->data->num_queues * sizeof(int), 0);
+		if (!dev->intr_handle->intr_vec) {
+			rte_bbdev_log(ERR, "Failed to allocate %u vectors",
+					dev->data->num_queues);
+			return -ENOMEM;
+		}
+	}
+
+	ret = rte_intr_enable(dev->intr_handle);
+	if (ret < 0) {
+		rte_bbdev_log(ERR,
+				"Couldn't enable interrupts for device: %s",
+				dev->data->name);
+		return ret;
+	}
+
+	ret = rte_intr_callback_register(dev->intr_handle,
+			fpga_dev_interrupt_handler, dev);
+	if (ret < 0) {
+		rte_bbdev_log(ERR,
+				"Couldn't register interrupt callback for device: %s",
+				dev->data->name);
+		return ret;
+	}
+
+	return 0;
+}
+
 static const struct rte_bbdev_ops fpga_ops = {
 	.setup_queues = fpga_setup_queues,
+	.intr_enable = fpga_intr_enable,
 	.close = fpga_dev_close,
 	.info_get = fpga_dev_info_get,
 	.queue_setup = fpga_queue_setup,
 	.queue_stop = fpga_queue_stop,
 	.queue_start = fpga_queue_start,
 	.queue_release = fpga_queue_release,
+	.queue_intr_enable = fpga_queue_intr_enable,
+	.queue_intr_disable = fpga_queue_intr_disable
 };
 
 static inline void
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH v5 11/11 doc: add feature matrix table for bbdev devices

In reply to Nicolas Chautru

Adding missing overview page in documentation with comparison of feature set by each available PMD implementation.

---
 .gitignore                                   |  1 +
 doc/guides/bbdevs/features/default.ini       | 16 ++++++++++++++++
 doc/guides/bbdevs/features/fpga_5gnr_fec.ini | 11 +++++++++++
 doc/guides/bbdevs/features/fpga_lte_fec.ini  | 10 ++++++++++
 doc/guides/bbdevs/features/mbc.ini           | 14 ++++++++++++++
 doc/guides/bbdevs/features/null.ini          |  7 +++++++
 doc/guides/bbdevs/features/turbo_sw.ini      | 11 +++++++++++
 doc/guides/bbdevs/index.rst                  |  1 +
 doc/guides/bbdevs/overview.rst               | 15 +++++++++++++++
 doc/guides/conf.py                           |  5 +++++
 10 files changed, 91 insertions(+)
 create mode 100644 doc/guides/bbdevs/features/default.ini
 create mode 100644 doc/guides/bbdevs/features/fpga_5gnr_fec.ini
 create mode 100644 doc/guides/bbdevs/features/fpga_lte_fec.ini
 create mode 100644 doc/guides/bbdevs/features/mbc.ini
 create mode 100644 doc/guides/bbdevs/features/null.ini
 create mode 100644 doc/guides/bbdevs/features/turbo_sw.ini
 create mode 100644 doc/guides/bbdevs/overview.rst
.gitignore +1 -0
index 2acb459..f2f8892 100644
@@ -10,6 +10,7 @@ doc/guides/cryptodevs/overview_aead_table.txt
 doc/guides/cryptodevs/overview_asym_table.txt
 doc/guides/compressdevs/overview_feature_table.txt
 doc/guides/vdpadevs/overview_feature_table.txt
+doc/guides/bbdevs/overview_feature_table.txt
 
 # ignore generated ctags/cscope files
 cscope.out.po
doc/guides/bbdevs/features/default.ini new file +16 -0
new file mode 100644
index 0000000..5fe267a
@@ -0,0 +1,16 @@
+;
+; Features of a default bbdev driver.
+;
+; This file defines the features that are valid for inclusion in
+; the other driver files and also the order that they appear in
+; the features table in the documentation.
+;
+[Features]
+Turbo Decoder (4G)     =
+Turbo Encoder (4G)     =
+LDPC Decoder (5G)      =
+LDPC Encoder (5G)      =
+LLR/HARQ Compression   =
+External DDR Access    =
+HW Accelerated         =
+BBDEV API              =
doc/guides/bbdevs/features/fpga_5gnr_fec.ini new file +11 -0
new file mode 100644
index 0000000..7a0b8d4
@@ -0,0 +1,11 @@
+;
+; Supported features of the 'fpga_5ngr_fec' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+External DDR Access    = Y
+HW Accelerated         = Y
+BBDEV API              = Y
doc/guides/bbdevs/features/fpga_lte_fec.ini new file +10 -0
new file mode 100644
index 0000000..f1cfb92
@@ -0,0 +1,10 @@
+;
+; Supported features of the 'fpga_lte_fec' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = Y
+Turbo Encoder (4G)     = Y
+HW Accelerated         = Y
+BBDEV API              = Y
doc/guides/bbdevs/features/mbc.ini new file +14 -0
new file mode 100644
index 0000000..78a7b95
@@ -0,0 +1,14 @@
+;
+; Supported features of the 'mbc' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = Y
+Turbo Encoder (4G)     = Y
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+LLR/HARQ Compression   = Y
+External DDR Access    = Y
+HW Accelerated         = Y
+BBDEV API              = Y
doc/guides/bbdevs/features/null.ini new file +7 -0
new file mode 100644
index 0000000..d9bbda9
@@ -0,0 +1,7 @@
+;
+; Supported features of the 'null' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+BBDEV API              = Y
doc/guides/bbdevs/features/turbo_sw.ini new file +11 -0
new file mode 100644
index 0000000..2c7075e
@@ -0,0 +1,11 @@
+;
+; Supported features of the 'turbo_sw' bbdev driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Turbo Decoder (4G)     = Y
+Turbo Encoder (4G)     = Y
+LDPC Decoder (5G)      = Y
+LDPC Encoder (5G)      = Y
+BBDEV API              = Y
doc/guides/bbdevs/index.rst +1 -0
index 1a79343..a8092dd 100644
@@ -8,6 +8,7 @@ Baseband Device Drivers
     :maxdepth: 2
     :numbered:
 
+    overview
     null
     turbo_sw
     fpga_lte_fec
doc/guides/bbdevs/overview.rst new file +15 -0
new file mode 100644
index 0000000..ace4e67
@@ -0,0 +1,15 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2020 Intel Corporation.
+
+Baseband Device Supported Functionality Matrices
+==============================================
+
+Supported Feature Flags
+-----------------------
+
+.. _table_bbdev_pmd_features:
+
+.. include:: overview_feature_table.txt
+
+
+
doc/guides/conf.py +5 -0
index 9093ad3..700e05e 100644
@@ -414,6 +414,11 @@ def setup(app):
                             'Features',
                             'Features availability in vDPA drivers',
                             'Feature')
+    table_file = dirname(__file__) + '/bbdevs/overview_feature_table.txt'
+    generate_overview_table(table_file, 1,
+                            'Features',
+                            'Features availability in bbdev drivers',
+                            'Feature')
 
     if LooseVersion(sphinx_version) < LooseVersion('1.3.1'):
         print('Upgrade sphinx to version >= 1.3.1 for '
Signature · 1 line
1.8.3.1
Acked-by on the v5 series Applied
#12 lore raw
In reply to Nicolas Chautru
Quoted 9 lines

v5: Fix incremenral patch build and few rebase updates
v4: Fix incremental patch build and expose PMD header file to meson.
v3: Incremental changes from reviews : file name change, moving few inline function to .h, adding missing inline, doxygen markup fix.

Adding new baseband PMD for FPGA 5GNR FEC implementation.

Applied to dpdk-next-crypto

Thanks