Skip to contentSkip to conversation

Add patch set for IPN3KE

PATCH Superseded Rosen Xu 9 participants 193 messages Feb 28, 2019 – Mar 22, 2023 Page 2 of 3

Subsystems (2)
lore
Share & tools
lore
author
#82 lore raw

PATCH v4 8/14 raw/ifpga/base: store private features in FME and Port list

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

Get private features attrubite like size, id, address after enumeration, and insert into FEM or Port dedicate list.

when initial the private feature driver, we just compare the private feature id between the list and feature drivers array to match the proper drivers.

This patch avoid the hardcore in feature_info array in previous implementation. and the same time we can use one driver for mulitple devices which the id is the same.

---
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |  46 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   | 347 ++++++++--------------
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c | 160 +++++++---
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |  46 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         |  32 ++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |  16 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c        |  21 ++
 7 files changed, 363 insertions(+), 305 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +20 -26
index aa02527..217d0b1 100644
@@ -15,6 +15,7 @@
 #define FME_FEATURE_GLOBAL_IPERF    "fme_iperf"
 #define FME_FEATURE_GLOBAL_ERR      "fme_error"
 #define FME_FEATURE_PR_MGMT         "fme_pr"
+#define FME_FEATURE_EMIF_MGMT       "fme_emif"
 #define FME_FEATURE_HSSI_ETH        "fme_hssi"
 #define FME_FEATURE_GLOBAL_DPERF    "fme_dperf"
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
@@ -59,7 +60,8 @@
 #define FEATURE_FIU_ID_FME	0x0
 #define FEATURE_FIU_ID_PORT	0x1
 
-#define FEATURE_ID_HEADER	0x0
+/* Reserved 0xfe for Header, 0xff for AFU*/
+#define FEATURE_ID_FIU_HEADER	0xfe
 #define FEATURE_ID_AFU		0xff
 
 enum fpga_id_type {
@@ -68,31 +70,23 @@ enum fpga_id_type {
 	FPGA_ID_MAX,
 };
 
-enum fme_feature_id {
-	FME_FEATURE_ID_HEADER = 0x0,
-
-	FME_FEATURE_ID_THERMAL_MGMT	= 0x1,
-	FME_FEATURE_ID_POWER_MGMT = 0x2,
-	FME_FEATURE_ID_GLOBAL_IPERF = 0x3,
-	FME_FEATURE_ID_GLOBAL_ERR = 0x4,
-	FME_FEATURE_ID_PR_MGMT = 0x5,
-	FME_FEATURE_ID_HSSI_ETH = 0x6,
-	FME_FEATURE_ID_GLOBAL_DPERF = 0x7,
-	FME_FEATURE_ID_QSPI_FLASH = 0x8,
-
-	/* one for fme header. */
-	FME_FEATURE_ID_MAX = 0x9,
-};
-
-enum port_feature_id {
-	PORT_FEATURE_ID_HEADER = 0x0,
-	PORT_FEATURE_ID_ERROR = 0x1,
-	PORT_FEATURE_ID_UMSG = 0x2,
-	PORT_FEATURE_ID_UINT = 0x3,
-	PORT_FEATURE_ID_STP = 0x4,
-	PORT_FEATURE_ID_UAFU = 0x5,
-	PORT_FEATURE_ID_MAX = 0x6,
-};
+#define FME_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
+#define FME_FEATURE_ID_THERMAL_MGMT 0x1
+#define FME_FEATURE_ID_POWER_MGMT 0x2
+#define FME_FEATURE_ID_GLOBAL_IPERF 0x3
+#define FME_FEATURE_ID_GLOBAL_ERR 0x4
+#define FME_FEATURE_ID_PR_MGMT 0x5
+#define FME_FEATURE_ID_HSSI_ETH 0x6
+#define FME_FEATURE_ID_GLOBAL_DPERF 0x7
+#define FME_FEATURE_ID_QSPI_FLASH 0x8
+#define FME_FEATURE_ID_EMIF_MGMT  0x9
+
+#define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
+#define PORT_FEATURE_ID_ERROR 0x10
+#define PORT_FEATURE_ID_UMSG 0x12
+#define PORT_FEATURE_ID_UINT 0x13
+#define PORT_FEATURE_ID_STP 0x14
+#define PORT_FEATURE_ID_UAFU FEATURE_ID_AFU
 
 /*
  * All headers and structures must be byte-packed to match the spec.
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +122 -225

546 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +116 -44

199 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +38 -8

92 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme.c +32 -0
index 4be60c0..9451086 100644
@@ -732,3 +732,35 @@ struct feature_ops fme_power_mgmt_ops = {
 	.get_prop = fme_power_mgmt_get_prop,
 	.set_prop = fme_power_mgmt_set_prop,
 };
+
+static int fme_hssi_eth_init(struct feature *feature)
+{
+	UNUSED(feature);
+	return 0;
+}
+
+static void fme_hssi_eth_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+}
+
+struct feature_ops fme_hssi_eth_ops = {
+	.init = fme_hssi_eth_init,
+	.uinit = fme_hssi_eth_uinit,
+};
+
+static int fme_emif_init(struct feature *feature)
+{
+	UNUSED(feature);
+	return 0;
+}
+
+static void fme_emif_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+}
+
+struct feature_ops fme_emif_ops = {
+	.init = fme_emif_init,
+	.uinit = fme_emif_uinit,
+};
drivers/raw/ifpga_rawdev/base/ifpga_hw.h +14 -2
index a20520c..8aaa056 100644
@@ -8,18 +8,28 @@
 #include "ifpga_defines.h"
 #include "opae_ifpga_hw_api.h"
 
+/** List of private feateues */
+TAILQ_HEAD(ifpga_feature_list, feature);
+
 enum ifpga_feature_state {
 	IFPGA_FEATURE_UNUSED = 0,
 	IFPGA_FEATURE_ATTACHED,
 };
 
+enum feature_type {
+	FEATURE_FME_TYPE = 0,
+	FEATURE_PORT_TYPE,
+};
+
 struct feature_irq_ctx {
 	int eventfd;
 	int idx;
 };
 
 struct feature {
+	TAILQ_ENTRY(feature)next;
 	enum ifpga_feature_state state;
+	enum feature_type type;
 	const char *name;
 	u64 id;
 	u8 *addr;
@@ -34,6 +44,8 @@ struct feature {
 	void *parent;		/* to parent hw data structure */
 
 	struct feature_ops *ops;/* callback to this private feature */
+	unsigned int vec_start;
+	unsigned int vec_cnt;
 };
 
 struct feature_ops {
@@ -52,7 +64,7 @@ enum ifpga_fme_state {
 struct ifpga_fme_hw {
 	enum ifpga_fme_state state;
 
-	struct feature sub_feature[FME_FEATURE_ID_MAX];
+	struct ifpga_feature_list feature_list;
 	spinlock_t lock;	/* protect hardware access */
 
 	void *parent;		/* pointer to ifpga_hw */
@@ -78,7 +90,7 @@ enum ifpga_port_state {
 struct ifpga_port_hw {
 	enum ifpga_port_state state;
 
-	struct feature sub_feature[PORT_FEATURE_ID_MAX];
+	struct ifpga_feature_list feature_list;
 	spinlock_t lock;	/* protect access to hw */
 
 	void *parent;		/* pointer to ifpga_hw */
drivers/raw/ifpga_rawdev/base/ifpga_port.c +21 -0
index 8b5668d..4628783 100644
@@ -386,3 +386,24 @@ struct feature_ops ifpga_rawdev_port_uint_ops = {
 	.init = port_uint_init,
 	.uinit = port_uint_uinit,
 };
+
+static int port_afu_init(struct feature *feature)
+{
+	UNUSED(feature);
+
+	dev_info(NULL, "PORT AFU Init.\n");
+
+	return 0;
+}
+
+static void port_afu_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+
+	dev_info(NULL, "PORT AFU UInit.\n");
+}
+
+struct feature_ops ifpga_rawdev_port_afu_ops = {
+	.init = port_afu_init,
+	.uinit = port_afu_uinit,
+};
Signature · 1 line
1.8.3.1
author
#83 lore raw

PATCH v4 9/14 raw/ifpga/base: add SPI and MAX10 device driver

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

There is a SPI bus link between A10 FPGA and MAX10 FPGA. MAX10 is in charge of board management, like power management, sensors, flash devices.

---
 drivers/raw/ifpga_rawdev/base/Makefile             |   3 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |   5 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  |   4 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          | 196 +++++++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |   2 +
 drivers/raw/ifpga_rawdev/base/meson.build          |   5 +-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |   1 +
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   |  88 +++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |  60 +++
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |   4 +
 drivers/raw/ifpga_rawdev/base/opae_spi.c           | 304 ++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           | 160 ++++++++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   | 438 +++++++++++++++++++++
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |  14 +
 15 files changed, 1285 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c
drivers/raw/ifpga_rawdev/base/Makefile +3 -0
index d79da72..c6f51a8 100644
@@ -22,5 +22,8 @@ SRCS-y += opae_hw_api.c
 SRCS-y += opae_ifpga_hw_api.c
 SRCS-y += opae_debug.c
 SRCS-y += ifpga_fme_pr.c
+SRCS-y += opae_spi.c
+SRCS-y += opae_spi_transaction.c
+SRCS-y += opae_intel_max10.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +5 -0
index 217d0b1..f5e22ae 100644
@@ -19,6 +19,8 @@
 #define FME_FEATURE_HSSI_ETH        "fme_hssi"
 #define FME_FEATURE_GLOBAL_DPERF    "fme_dperf"
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
+#define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
+#define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -43,6 +45,7 @@
 #define FME_HSSI_ETH_REVISION		0
 #define FME_GLOBAL_DPERF_REVISION	0
 #define FME_QSPI_REVISION		0
+#define FME_MAX10_SPI                   0
 
 #define PORT_HEADER_REVISION		0
 /* UAFU's header info depends on the downloaded GBS */
@@ -80,6 +83,8 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_GLOBAL_DPERF 0x7
 #define FME_FEATURE_ID_QSPI_FLASH 0x8
 #define FME_FEATURE_ID_EMIF_MGMT  0x9
+#define FME_FEATURE_ID_MAX10_SPI  0xe
+#define FME_FEATURE_ID_NIOS_SPI 0xd
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +4 -0
index d82a890..2a35c06 100644
@@ -197,6 +197,10 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_hssi_eth_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_EMIF_MGMT, FME_FEATURE_EMIF_MGMT,
 	&fme_emif_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_MAX10_SPI, FME_FEATURE_MAX10_SPI,
+	&fme_spi_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_NIOS_SPI, FME_FEATURE_NIOS_SPI,
+	&fme_nios_spi_master_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +2 -0
index 1d80f1d..72352ee 100644
@@ -171,6 +171,8 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_global_dperf_ops;
 extern struct feature_ops fme_hssi_eth_ops;
 extern struct feature_ops fme_emif_ops;
+extern struct feature_ops fme_spi_master_ops;
+extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
 int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +196 -0

205 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +2 -0
index 8aaa056..a2f4776 100644
@@ -79,6 +79,8 @@ struct ifpga_fme_hw {
 	u32 cache_size;
 
 	u32 capability;
+
+	void *max10_dev; /* MAX10 device */
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +4 -1
index 03f5112..6bc762f 100644
@@ -14,7 +14,10 @@ sources = [
 	'ifpga_fme_pr.c',
 	'opae_hw_api.c',
 	'opae_ifpga_hw_api.c',
-	'opae_debug.c'
+	'opae_debug.c',
+	'opae_spi.c',
+	'opae_spi_transaction.c',
+	'opae_intel_max10.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_hw_api.h +1 -0
index 332e0f3..76224b4 100644
@@ -11,6 +11,7 @@
 #include <sys/queue.h>
 
 #include "opae_osdep.h"
+#include "opae_intel_max10.h"
 
 #ifndef PCI_MAX_RESOURCE
 #define PCI_MAX_RESOURCE 6
drivers/raw/ifpga_rawdev/base/opae_intel_max10.c new file +88 -0

88 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_intel_max10.h new file +60 -0

60 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_osdep.h +4 -0
index 78fec50..d710ec0 100644
@@ -35,6 +35,7 @@ struct uuid {
 #ifndef BIT
 #define BIT(a) (1UL << (a))
 #endif /* BIT */
+#define U64_C(x) x ## ULL
 #ifndef BIT_ULL
 #define BIT_ULL(a) (1ULL << (a))
 #endif /* BIT_ULL */
@@ -76,5 +77,8 @@ struct uuid {
 #define msleep(x) opae_udelay(1000 * (x))
 #define usleep_range(min, max) msleep(DIV_ROUND_UP(min, 1000))
 
+#define time_after(a, b)	((long)((b) - (a)) < 0)
+#define time_before(a, b)	time_after(b, a)
 #define opae_memset(a, b, c)    memset((a), (b), (c))
+
 #endif
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +304 -0

304 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_spi.h new file +160 -0

160 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +438 -0

438 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h +14 -0
index 3d9a0ca..3ff49a8 100644
@@ -11,6 +11,7 @@
 #include <rte_log.h>
 #include <rte_io.h>
 #include <rte_malloc.h>
+#include <rte_byteorder.h>
 #include <rte_memcpy.h>
 
 #define dev_printf(level, fmt, args...) \
@@ -43,5 +44,18 @@
 #define spinlock_lock(x) rte_spinlock_lock(x)
 #define spinlock_unlock(x) rte_spinlock_unlock(x)
 
+#define cpu_to_be16(o) rte_cpu_to_be_16(o)
+#define cpu_to_be32(o) rte_cpu_to_be_32(o)
+#define cpu_to_be64(o) rte_cpu_to_be_64(o)
+#define cpu_to_le16(o) rte_cpu_to_le_16(o)
+#define cpu_to_le32(o) rte_cpu_to_le_32(o)
+#define cpu_to_le64(o) rte_cpu_to_le_64(o)
+
 #define opae_memcpy(a, b, c) rte_memcpy((a), (b), (c))
+
+static inline unsigned long msecs_to_timer_cycles(unsigned int m)
+{
+	return rte_get_timer_hz() * (m / 1000);
+}
+
 #endif
Signature · 1 line
1.8.3.1
author
#84 lore raw

PATCH v4 10/14 raw/ifpga/base: add I2C and at24 EEPROM driver

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

1. Add Altera I2C master device driver
2. Add at24 eeprom driver which is i2c slave device
3. Introducing a new ops for opae_manager: opae_manager_networking_ops. This ops will include some networking operation by FPGA, like vBNG operation, MAC ROM operation and so on.

---
 drivers/raw/ifpga_rawdev/base/Makefile            |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c         |  22 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.h         |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |   3 +
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |   2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |   7 +
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         |  90 ++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |   1 +
 drivers/raw/ifpga_rawdev/base/meson.build         |   2 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c  |  88 ++++
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h  |  14 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c       |  49 ++-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h       |  26 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c          | 490 ++++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h          | 130 ++++++
 16 files changed, 926 insertions(+), 3 deletions(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.h
drivers/raw/ifpga_rawdev/base/Makefile +2 -0
index c6f51a8..edb538f 100644
@@ -25,5 +25,7 @@ SRCS-y += ifpga_fme_pr.c
 SRCS-y += opae_spi.c
 SRCS-y += opae_spi_transaction.c
 SRCS-y += opae_intel_max10.c
+SRCS-y += opae_i2c.c
+SRCS-y += opae_at24_eeprom.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +22 -0
index 77d9471..c447b3c 100644
@@ -196,6 +196,28 @@ struct opae_manager_ops ifpga_mgr_ops = {
 	.flash = ifpga_mgr_flash,
 };
 
+static int ifpga_mgr_read_mac_rom(struct opae_manager *mgr, int offset,
+		void *buf, int size)
+{
+	struct ifpga_fme_hw *fme = mgr->data;
+
+	return fme_mgr_read_mac_rom(fme, offset, buf, size);
+}
+
+static int ifpga_mgr_write_mac_rom(struct opae_manager *mgr, int offset,
+		void *buf, int size)
+{
+	struct ifpga_fme_hw *fme = mgr->data;
+
+	return fme_mgr_write_mac_rom(fme, offset, buf, size);
+}
+
+/* Network APIs in FME */
+struct opae_manager_networking_ops ifpga_mgr_network_ops = {
+	.read_mac_rom = ifpga_mgr_read_mac_rom,
+	.write_mac_rom = ifpga_mgr_write_mac_rom,
+};
+
 /* Adapter APIs */
 static int ifpga_adapter_enumerate(struct opae_adapter *adapter)
 {
drivers/raw/ifpga_rawdev/base/ifpga_api.h +1 -0
index dae7ca1..4a24769 100644
@@ -12,6 +12,7 @@
 extern struct opae_manager_ops ifpga_mgr_ops;
 extern struct opae_bridge_ops ifpga_br_ops;
 extern struct opae_accelerator_ops ifpga_acc_ops;
+extern struct opae_manager_networking_ops ifpga_mgr_network_ops;
 
 /* common APIs */
 int ifpga_get_prop(struct ifpga_hw *hw, u32 fiu_id, u32 port_id,
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +3 -0
index f5e22ae..62f71c7 100644
@@ -21,6 +21,7 @@
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
 #define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
 #define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
+#define FME_FEATURE_I2C_MASTER      "fme_i2c_master"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -46,6 +47,7 @@
 #define FME_GLOBAL_DPERF_REVISION	0
 #define FME_QSPI_REVISION		0
 #define FME_MAX10_SPI                   0
+#define FME_I2C_MASTER                  0
 
 #define PORT_HEADER_REVISION		0
 /* UAFU's header info depends on the downloaded GBS */
@@ -85,6 +87,7 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_EMIF_MGMT  0x9
 #define FME_FEATURE_ID_MAX10_SPI  0xe
 #define FME_FEATURE_ID_NIOS_SPI 0xd
+#define FME_FEATURE_ID_I2C_MASTER  0xf
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +1 -1
index c779e0c..666dae1 100644
@@ -270,7 +270,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 
 	} else if (binfo->current_type == FME_ID) {
 		mgr = opae_manager_alloc(hw->adapter->name, &ifpga_mgr_ops,
-				binfo->fiu);
+				&ifpga_mgr_network_ops, binfo->fiu);
 		if (!mgr)
 			return -ENOMEM;
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -0
index 2a35c06..0454f80 100644
@@ -201,6 +201,8 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_spi_master_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_NIOS_SPI, FME_FEATURE_NIOS_SPI,
 	&fme_nios_spi_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_I2C_MASTER, FME_FEATURE_I2C_MASTER,
+	&fme_i2c_master_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +7 -0
index 72352ee..a398a98 100644
@@ -172,6 +172,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_hssi_eth_ops;
 extern struct feature_ops fme_emif_ops;
 extern struct feature_ops fme_spi_master_ops;
+extern struct feature_ops fme_i2c_master_ops;
 extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
@@ -197,4 +198,10 @@ struct fpga_uafu_irq_set {
 /* help functions for feature ops */
 int fpga_msix_set_block(struct feature *feature, unsigned int start,
 			unsigned int count, s32 *fds);
+
+/* FME network function ops*/
+int fme_mgr_read_mac_rom(struct ifpga_fme_hw *fme, int offset,
+		void *buf, int size);
+int fme_mgr_write_mac_rom(struct ifpga_fme_hw *fme, int offset,
+		void *buf, int size);
 #endif /* _IFPGA_FEATURE_DEV_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +90 -0

99 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +1 -0
index a2f4776..e296dd2 100644
@@ -81,6 +81,7 @@ struct ifpga_fme_hw {
 	u32 capability;
 
 	void *max10_dev; /* MAX10 device */
+	void *i2c_master; /* I2C Master device */
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +2 -0
index 6bc762f..7655985 100644
@@ -18,6 +18,8 @@ sources = [
 	'opae_spi.c',
 	'opae_spi_transaction.c',
 	'opae_intel_max10.c',
+	'opae_i2c.c',
+	'opae_at24_eeprom.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c new file +88 -0

88 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h new file +14 -0
new file mode 100644
index 0000000..caae9a3
@@ -0,0 +1,14 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#define AT24C512_PAGE_SIZE 128
+#define AT24C512_IO_LIMIT  128
+
+#define AT24512_SLAVE_ADDR 0x51
+
+int at24_eeprom_read(struct altera_i2c_dev *dev, unsigned int slave_addr,
+		u32 offset, u8 *buf, int count);
+int at24_eeprom_write(struct altera_i2c_dev *dev, unsigned int slave_addr,
+		u32 offset, u8 *buf, int count);
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +48 -1

69 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.h +25 -1
index 76224b4..826da37 100644
@@ -26,6 +26,7 @@ enum opae_adapter_type {
 
 /* OPAE Manager Data Structure */
 struct opae_manager_ops;
+struct opae_manager_networking_ops;
 
 /*
  * opae_manager has pointer to its parent adapter, as it could be able to manage
@@ -36,6 +37,7 @@ struct opae_manager {
 	const char *name;
 	struct opae_adapter *adapter;
 	struct opae_manager_ops *ops;
+	struct opae_manager_networking_ops *network_ops;
 	void *data;
 };
 
@@ -45,9 +47,18 @@ struct opae_manager_ops {
 		     u32 size, u64 *status);
 };
 
+/* networking management ops in FME */
+struct opae_manager_networking_ops {
+	int (*read_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
+			int size);
+	int (*write_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
+			int size);
+};
+
 /* OPAE Manager APIs */
 struct opae_manager *
-opae_manager_alloc(const char *name, struct opae_manager_ops *ops, void *data);
+opae_manager_alloc(const char *name, struct opae_manager_ops *ops,
+		struct opae_manager_networking_ops *network_ops, void *data);
 #define opae_manager_free(mgr) opae_free(mgr)
 int opae_manager_flash(struct opae_manager *mgr, int acc_id, void *buf,
 		       u32 size, u64 *status);
@@ -252,4 +263,17 @@ static inline void opae_adapter_remove_acc(struct opae_adapter *adapter,
 {
 	TAILQ_REMOVE(&adapter->acc_list, acc, node);
 }
+
+/* OPAE vBNG network datastruct */
+#define OPAE_ETHER_ADDR_LEN 6
+
+struct opae_ether_addr {
+	unsigned char addr_bytes[OPAE_ETHER_ADDR_LEN];
+} __attribute__((__packed__));
+
+/* OPAE vBNG network API*/
+int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
+		struct opae_ether_addr *addr);
+int opae_manager_write_mac_rom(struct opae_manager *mgr, int port,
+		struct opae_ether_addr *addr);
 #endif /* _OPAE_HW_API_H_*/
drivers/raw/ifpga_rawdev/base/opae_i2c.c new file +490 -0

490 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_i2c.h new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author
#85 lore raw

PATCH v4 11/14 raw/ifpga/base: add eth group driver

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

There is two eth group devices in PAC N3000 card, each eth group include PHY device and MAC device. Exposing APIs for DPDK PMD driver to access those devices.

---
 drivers/raw/ifpga_rawdev/base/Makefile            |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c         |  74 ++++++-
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |  39 ++++
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |   6 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |  12 ++
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         | 250 ++++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |   7 +
 drivers/raw/ifpga_rawdev/base/meson.build         |   1 +
 drivers/raw/ifpga_rawdev/base/opae_eth_group.c    | 145 +++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_eth_group.h    |  96 +++++++++
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c       | 149 +++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h       |  27 +++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h  |  42 +++-
 drivers/raw/ifpga_rawdev/base/opae_osdep.h        |  16 +-
 15 files changed, 858 insertions(+), 9 deletions(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.h
drivers/raw/ifpga_rawdev/base/Makefile +1 -0
index edb538f..c5bbcbd 100644
@@ -27,5 +27,6 @@ SRCS-y += opae_spi_transaction.c
 SRCS-y += opae_intel_max10.c
 SRCS-y += opae_i2c.c
 SRCS-y += opae_at24_eeprom.c
+SRCS-y += opae_eth_group.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +73 -1

98 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_defines.h +39 -0
index 62f71c7..b7151ca 100644
@@ -22,6 +22,7 @@
 #define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
 #define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
 #define FME_FEATURE_I2C_MASTER      "fme_i2c_master"
+#define FME_FEATURE_ETH_GROUP       "fme_eth_group"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -88,6 +89,7 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_MAX10_SPI  0xe
 #define FME_FEATURE_ID_NIOS_SPI 0xd
 #define FME_FEATURE_ID_I2C_MASTER  0xf
+#define FME_FEATURE_ID_ETH_GROUP 0x10
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
@@ -1661,5 +1663,42 @@ struct bts_header {
 	(((bts_hdr)->guid_h == GBS_GUID_H) &&		\
 	((bts_hdr)->guid_l == GBS_GUID_L))
 
+/* bitstream id definition */
+struct fme_bitstream_id {
+	union {
+		u64 id;
+		struct {
+			u64 hash:32;
+			u64 interface:4;
+			u64 reserved:12;
+			u64 debug:4;
+			u64 patch:4;
+			u64 minor:4;
+			u64 major:4;
+		};
+	};
+};
+
+enum board_interface {
+	VC_8_10G = 0,
+	VC_4_25G = 1,
+	VC_2_1_25 = 2,
+	VC_4_25G_2_25G = 3,
+	VC_2_2_25G = 4,
+};
+
+struct ifpga_fme_board_info {
+	enum board_interface type;
+	u32 build_hash;
+	u32 debug_version;
+	u32 patch_version;
+	u32 minor_version;
+	u32 major_version;
+	u32 nums_of_retimer;
+	u32 ports_per_retimer;
+	u32 nums_of_fvl;
+	u32 ports_per_fvl;
+};
+
 #pragma pack(pop)
 #endif /* _BASE_IFPGA_DEFINES_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +6 -0
index 666dae1..44086c1 100644
@@ -232,6 +232,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 	struct opae_bridge *br;
 	struct opae_accelerator *acc;
 	struct ifpga_port_hw *port;
+	struct ifpga_fme_hw *fme;
 	struct feature *feature;
 
 	if (!binfo->fiu)
@@ -264,8 +265,13 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 		}
 
 		acc->br = br;
+		if (hw->adapter->mgr)
+			acc->mgr = hw->adapter->mgr;
 		acc->index = br->id;
 
+		fme = &hw->fme;
+		fme->nums_acc_region = info->num_regions;
+
 		opae_adapter_add_acc(hw->adapter, acc);
 
 	} else if (binfo->current_type == FME_ID) {
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -0
index 0454f80..5ebc449 100644
@@ -203,6 +203,8 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_nios_spi_master_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_I2C_MASTER, FME_FEATURE_I2C_MASTER,
 	&fme_i2c_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_ETH_GROUP, FME_FEATURE_ETH_GROUP,
+	&fme_eth_group_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +12 -0
index a398a98..3f63f5a 100644
@@ -173,6 +173,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_emif_ops;
 extern struct feature_ops fme_spi_master_ops;
 extern struct feature_ops fme_i2c_master_ops;
+extern struct feature_ops fme_eth_group_ops;
 extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
@@ -204,4 +205,15 @@ int fme_mgr_read_mac_rom(struct ifpga_fme_hw *fme, int offset,
 		void *buf, int size);
 int fme_mgr_write_mac_rom(struct ifpga_fme_hw *fme, int offset,
 		void *buf, int size);
+int fme_mgr_get_eth_group_nums(struct ifpga_fme_hw *fme);
+int fme_mgr_get_eth_group_info(struct ifpga_fme_hw *fme,
+		u8 group_id, struct opae_eth_group_info *info);
+int fme_mgr_eth_group_read_reg(struct ifpga_fme_hw *fme, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 *data);
+int fme_mgr_eth_group_write_reg(struct ifpga_fme_hw *fme, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 data);
+int fme_mgr_get_retimer_info(struct ifpga_fme_hw *fme,
+		struct opae_retimer_info *info);
+int fme_mgr_get_retimer_status(struct ifpga_fme_hw *fme,
+		struct opae_retimer_status *status);
 #endif /* _IFPGA_FEATURE_DEV_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +250 -0

271 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +7 -0
index e296dd2..a428d69 100644
@@ -7,6 +7,7 @@
 
 #include "ifpga_defines.h"
 #include "opae_ifpga_hw_api.h"
+#include "opae_eth_group.h"
 
 /** List of private feateues */
 TAILQ_HEAD(ifpga_feature_list, feature);
@@ -82,6 +83,12 @@ struct ifpga_fme_hw {
 
 	void *max10_dev; /* MAX10 device */
 	void *i2c_master; /* I2C Master device */
+	void *eth_dev[MAX_ETH_GROUP_DEVICES];
+	struct opae_reg_region
+		eth_group_region[MAX_ETH_GROUP_DEVICES];
+	struct ifpga_fme_board_info board_info;
+	int nums_eth_dev;
+	unsigned int nums_acc_region;
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +1 -0
index 7655985..f1015bb 100644
@@ -20,6 +20,7 @@ sources = [
 	'opae_intel_max10.c',
 	'opae_i2c.c',
 	'opae_at24_eeprom.c',
+	'opae_eth_group.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_eth_group.c new file +145 -0

145 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_eth_group.h new file +96 -0

96 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.c +149 -0

152 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.h +27 -0
index 826da37..383e751 100644
@@ -12,6 +12,7 @@
 
 #include "opae_osdep.h"
 #include "opae_intel_max10.h"
+#include "opae_eth_group.h"
 
 #ifndef PCI_MAX_RESOURCE
 #define PCI_MAX_RESOURCE 6
@@ -45,6 +46,8 @@ struct opae_manager {
 struct opae_manager_ops {
 	int (*flash)(struct opae_manager *mgr, int id, void *buffer,
 		     u32 size, u64 *status);
+	int (*get_eth_group_region_info)(struct opae_manager *mgr,
+			struct opae_eth_group_region_info *info);
 };
 
 /* networking management ops in FME */
@@ -53,6 +56,17 @@ struct opae_manager_networking_ops {
 			int size);
 	int (*write_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
 			int size);
+	int (*get_eth_group_nums)(struct opae_manager *mgr);
+	int (*get_eth_group_info)(struct opae_manager *mgr,
+			u8 group_id, struct opae_eth_group_info *info);
+	int (*eth_group_reg_read)(struct opae_manager *mgr, u8 group_id,
+			u8 type, u8 index, u16 addr, u32 *data);
+	int (*eth_group_reg_write)(struct opae_manager *mgr, u8 group_id,
+			u8 type, u8 index, u16 addr, u32 data);
+	int (*get_retimer_info)(struct opae_manager *mgr,
+			struct opae_retimer_info *info);
+	int (*get_retimer_status)(struct opae_manager *mgr,
+			struct opae_retimer_status *status);
 };
 
 /* OPAE Manager APIs */
@@ -62,6 +76,8 @@ struct opae_manager *
 #define opae_manager_free(mgr) opae_free(mgr)
 int opae_manager_flash(struct opae_manager *mgr, int acc_id, void *buf,
 		       u32 size, u64 *status);
+int opae_manager_get_eth_group_region_info(struct opae_manager *mgr,
+		u8 group_id, struct opae_eth_group_region_info *info);
 
 /* OPAE Bridge Data Structure */
 struct opae_bridge_ops;
@@ -276,4 +292,15 @@ int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
 		struct opae_ether_addr *addr);
 int opae_manager_write_mac_rom(struct opae_manager *mgr, int port,
 		struct opae_ether_addr *addr);
+int opae_manager_get_retimer_info(struct opae_manager *mgr,
+		struct opae_retimer_info *info);
+int opae_manager_get_retimer_status(struct opae_manager *mgr,
+		struct opae_retimer_status *status);
+int opae_manager_get_eth_group_nums(struct opae_manager *mgr);
+int opae_manager_get_eth_group_info(struct opae_manager *mgr,
+		u8 group_id, struct opae_eth_group_info *info);
+int opae_manager_eth_group_write_reg(struct opae_manager *mgr, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 data);
+int opae_manager_eth_group_read_reg(struct opae_manager *mgr, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 *data);
 #endif /* _OPAE_HW_API_H_*/
drivers/raw/ifpga_rawdev/base/opae_intel_max10.h +39 -3

54 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_osdep.h +11 -5
index d710ec0..1596adc 100644
@@ -53,12 +53,7 @@ struct uuid {
 #define dev_err(x, args...) dev_printf(ERR, args)
 #define dev_info(x, args...) dev_printf(INFO, args)
 #define dev_warn(x, args...) dev_printf(WARNING, args)
-
-#ifdef OPAE_DEBUG
 #define dev_debug(x, args...) dev_printf(DEBUG, args)
-#else
-#define dev_debug(x, args...) do { } while (0)
-#endif
 
 #define pr_err(y, args...) dev_err(0, y, ##args)
 #define pr_warn(y, args...) dev_warn(0, y, ##args)
@@ -81,4 +76,15 @@ struct uuid {
 #define time_before(a, b)	time_after(b, a)
 #define opae_memset(a, b, c)    memset((a), (b), (c))
 
+#define opae_readq_poll_timeout(addr, val, cond, invl, timeout)\
+({									     \
+	int wait = 0;							     \
+	for (; wait <= timeout; wait += invl) {			     \
+		(val) = opae_readq(addr);				     \
+		if (cond)                  \
+			break;						     \
+		udelay(invl);						     \
+	}								     \
+	(cond) ? 0 : -ETIMEDOUT;	  \
+})
 #endif
Signature · 1 line
1.8.3.1
author
#86 lore raw

PATCH v4 12/14 raw/ifpga/base: add version description on README

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

add verion description on READ about ifpga base code.

---
 drivers/raw/ifpga_rawdev/base/README | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/raw/ifpga_rawdev/base/README +15 -0
index 5bc2ed0..6b2b171 100644
@@ -29,3 +29,18 @@ the following file(s):
 
 	osdep_raw/osdep_generic.h
 	osdep_rte/osdep_generic.h
+
+
+New Features
+==================
+
+2019-03:
+Support Intel FPGA PAC N3000 card.
+Some features added in this version:
+1. Store private features in FME and Port list.
+2. Add eth group devices driver.
+3. Add altera SPI master driver and Intel MAX10 device driver.
+4. Add Altera I2C master driver and AT24 eeprom driver.
+5. Add Device Tree support to get the configuration from card.
+6. Instruding and exposing APIs to DPDK PMD driver to access networking
+functionality.
Signature · 1 line
1.8.3.1
author
#87 lore raw

PATCH v4 13/14 raw/ifpga/base: using prefix name "ifpga_" for feature and feature_ops data struct

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

Using prefix name "ifpga_" for feature and feature_ops data struct on ifpga base code, which is suggested by Yigit, Ferruh.

---
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |  8 +--
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |  4 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h | 58 ++++++++++---------
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         | 70 +++++++++++------------
 drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c   | 16 +++---
 drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c   | 18 +++---
 drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c   | 28 ++++-----
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c      |  6 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          | 22 +++----
 drivers/raw/ifpga_rawdev/base/ifpga_port.c        | 36 ++++++------
 drivers/raw/ifpga_rawdev/base/ifpga_port_error.c  | 10 ++--
 11 files changed, 141 insertions(+), 135 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +4 -4
index 44086c1..b8846e3 100644
@@ -73,7 +73,7 @@ static u64 feature_id(void __iomem *start)
 		unsigned int vec_cnt)
 {
 	struct ifpga_hw *hw = binfo->hw;
-	struct feature *feature = NULL;
+	struct ifpga_feature *feature = NULL;
 	struct feature_irq_ctx *ctx = NULL;
 	int port_id, ret = 0;
 	unsigned int i;
@@ -81,7 +81,7 @@ static u64 feature_id(void __iomem *start)
 	fid = fid?fid:feature_id(start);
 	size = size?size:feature_size(start);
 
-	feature = opae_malloc(sizeof(struct feature));
+	feature = opae_malloc(sizeof(struct ifpga_feature));
 	if (!feature)
 		return -ENOMEM;
 
@@ -233,7 +233,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 	struct opae_accelerator *acc;
 	struct ifpga_port_hw *port;
 	struct ifpga_fme_hw *fme;
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!binfo->fiu)
 		return 0;
@@ -645,7 +645,7 @@ static void ifpga_print_device_feature_list(struct ifpga_hw *hw)
 {
 	struct ifpga_fme_hw *fme = &hw->fme;
 	struct ifpga_port_hw *port;
-	struct feature *feature;
+	struct ifpga_feature *feature;
 	int i;
 
 	dev_info(hw, "found fme_device, is in PF: %s\n",
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -2
index 5ebc449..63c8bcc 100644
@@ -252,7 +252,7 @@ const char *get_port_feature_name(unsigned int id)
 
 static void feature_uinit(struct ifpga_feature_list *list)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	TAILQ_FOREACH(feature, list, next) {
 		if (feature->state != IFPGA_FEATURE_ATTACHED)
@@ -265,7 +265,7 @@ static void feature_uinit(struct ifpga_feature_list *list)
 static int feature_init(struct feature_driver *drv,
 		struct ifpga_feature_list *list)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 	int ret;
 
 	while (drv->ops) {
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +30 -28

114 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme.c +35 -35

268 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c +8 -8
index 1773b87..954f8a8 100644
@@ -183,7 +183,7 @@ static int fme_dperf_set_fab_freeze(struct ifpga_fme_hw *fme, u64 freeze)
 
 #define PERF_MAX_PORT_NUM	1
 
-static int fme_global_dperf_init(struct feature *feature)
+static int fme_global_dperf_init(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
@@ -192,14 +192,14 @@ static int fme_global_dperf_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_dperf_uinit(struct feature *feature)
+static void fme_global_dperf_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME global_dperf UInit.\n");
 }
 
-static int fme_dperf_fab_get_prop(struct feature *feature,
+static int fme_dperf_fab_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -225,7 +225,7 @@ static int fme_dperf_fab_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_dperf_root_get_prop(struct feature *feature,
+static int fme_dperf_root_get_prop(struct ifpga_feature *feature,
 				   struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -245,7 +245,7 @@ static int fme_dperf_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_dperf_get_prop(struct feature *feature,
+static int fme_global_dperf_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -260,7 +260,7 @@ static int fme_global_dperf_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_dperf_fab_set_prop(struct feature *feature,
+static int fme_dperf_fab_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -279,7 +279,7 @@ static int fme_dperf_fab_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_dperf_set_prop(struct feature *feature,
+static int fme_global_dperf_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -292,7 +292,7 @@ static int fme_global_dperf_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_dperf_ops = {
+struct ifpga_feature_ops fme_global_dperf_ops = {
 	.init = fme_global_dperf_init,
 	.uinit = fme_global_dperf_uinit,
 	.get_prop = fme_global_dperf_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c +9 -9
index 8c26fb2..3794564 100644
@@ -240,7 +240,7 @@ static void fme_error_enable(struct ifpga_fme_hw *fme)
 	writeq(0UL, &fme_err->ras_catfat_mask);
 }
 
-static int fme_global_error_init(struct feature *feature)
+static int fme_global_error_init(struct ifpga_feature *feature)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
 
@@ -252,12 +252,12 @@ static int fme_global_error_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_error_uinit(struct feature *feature)
+static void fme_global_error_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 }
 
-static int fme_err_fme_err_get_prop(struct feature *feature,
+static int fme_err_fme_err_get_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -275,7 +275,7 @@ static int fme_err_fme_err_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_root_get_prop(struct feature *feature,
+static int fme_err_root_get_prop(struct ifpga_feature *feature,
 				 struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -301,7 +301,7 @@ static int fme_err_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_error_get_prop(struct feature *feature,
+static int fme_global_error_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -321,7 +321,7 @@ static int fme_global_error_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_fme_err_set_prop(struct feature *feature,
+static int fme_err_fme_err_set_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -335,7 +335,7 @@ static int fme_err_fme_err_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_root_set_prop(struct feature *feature,
+static int fme_err_root_set_prop(struct ifpga_feature *feature,
 				 struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -353,7 +353,7 @@ static int fme_err_root_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_error_set_prop(struct feature *feature,
+static int fme_global_error_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -373,7 +373,7 @@ static int fme_global_error_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_err_ops = {
+struct ifpga_feature_ops fme_global_err_ops = {
 	.init = fme_global_error_init,
 	.uinit = fme_global_error_uinit,
 	.get_prop = fme_global_error_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c +14 -14
index e6c40a1..70543b9 100644
@@ -407,7 +407,7 @@ static int fme_iperf_set_fab_freeze(struct ifpga_fme_hw *fme, u64 freeze)
 #define PERF_MAX_PORT_NUM	1
 #define FME_IPERF_CAP_IOMMU	0x1
 
-static int fme_global_iperf_init(struct feature *feature)
+static int fme_global_iperf_init(struct ifpga_feature *feature)
 {
 	struct ifpga_fme_hw *fme;
 	struct feature_fme_header *fme_hdr;
@@ -429,14 +429,14 @@ static int fme_global_iperf_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_iperf_uinit(struct feature *feature)
+static void fme_global_iperf_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME global_iperf UInit.\n");
 }
 
-static int fme_iperf_root_get_prop(struct feature *feature,
+static int fme_iperf_root_get_prop(struct ifpga_feature *feature,
 				   struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -456,7 +456,7 @@ static int fme_iperf_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_cache_get_prop(struct feature *feature,
+static int fme_iperf_cache_get_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -496,7 +496,7 @@ static int fme_iperf_cache_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_root_get_prop(struct feature *feature,
+static int fme_iperf_vtd_root_get_prop(struct ifpga_feature *feature,
 				       struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -534,7 +534,7 @@ static int fme_iperf_vtd_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_sub_get_prop(struct feature *feature,
+static int fme_iperf_vtd_sub_get_prop(struct ifpga_feature *feature,
 				      struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -571,7 +571,7 @@ static int fme_iperf_vtd_sub_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_get_prop(struct feature *feature,
+static int fme_iperf_vtd_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	u8 sub = GET_FIELD(PROP_SUB, prop->prop_id);
@@ -582,7 +582,7 @@ static int fme_iperf_vtd_get_prop(struct feature *feature,
 	return fme_iperf_vtd_sub_get_prop(feature, prop);
 }
 
-static int fme_iperf_fab_get_prop(struct feature *feature,
+static int fme_iperf_fab_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -626,7 +626,7 @@ static int fme_iperf_fab_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_iperf_get_prop(struct feature *feature,
+static int fme_global_iperf_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -645,7 +645,7 @@ static int fme_global_iperf_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_cache_set_prop(struct feature *feature,
+static int fme_iperf_cache_set_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -658,7 +658,7 @@ static int fme_iperf_cache_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_set_prop(struct feature *feature,
+static int fme_iperf_vtd_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -671,7 +671,7 @@ static int fme_iperf_vtd_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_fab_set_prop(struct feature *feature,
+static int fme_iperf_fab_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -690,7 +690,7 @@ static int fme_iperf_fab_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_iperf_set_prop(struct feature *feature,
+static int fme_global_iperf_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -707,7 +707,7 @@ static int fme_global_iperf_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_iperf_ops = {
+struct ifpga_feature_ops fme_global_iperf_ops = {
 	.init = fme_global_iperf_init,
 	.uinit = fme_global_iperf_uinit,
 	.get_prop = fme_global_iperf_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c +3 -3
index 8890f4b..efa7266 100644
@@ -315,7 +315,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size, u64 *status)
 	return fme_pr(hw, port_id, buf, size, status);
 }
 
-static int fme_pr_mgmt_init(struct feature *feature)
+static int fme_pr_mgmt_init(struct ifpga_feature *feature)
 {
 	struct feature_fme_pr *fme_pr;
 	struct feature_header fme_pr_header;
@@ -339,14 +339,14 @@ static int fme_pr_mgmt_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_pr_mgmt_uinit(struct feature *feature)
+static void fme_pr_mgmt_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME PR MGMT UInit.\n");
 }
 
-struct feature_ops fme_pr_mgmt_ops = {
+struct ifpga_feature_ops fme_pr_mgmt_ops = {
 	.init = fme_pr_mgmt_init,
 	.uinit = fme_pr_mgmt_uinit,
 };
drivers/raw/ifpga_rawdev/base/ifpga_hw.h +12 -10
index a428d69..ff91c46 100644
@@ -10,7 +10,7 @@
 #include "opae_eth_group.h"
 
 /** List of private feateues */
-TAILQ_HEAD(ifpga_feature_list, feature);
+TAILQ_HEAD(ifpga_feature_list, ifpga_feature);
 
 enum ifpga_feature_state {
 	IFPGA_FEATURE_UNUSED = 0,
@@ -27,8 +27,8 @@ struct feature_irq_ctx {
 	int idx;
 };
 
-struct feature {
-	TAILQ_ENTRY(feature)next;
+struct ifpga_feature {
+	TAILQ_ENTRY(ifpga_feature)next;
 	enum ifpga_feature_state state;
 	enum feature_type type;
 	const char *name;
@@ -44,17 +44,19 @@ struct feature {
 
 	void *parent;		/* to parent hw data structure */
 
-	struct feature_ops *ops;/* callback to this private feature */
+	struct ifpga_feature_ops *ops;/* callback to this private feature */
 	unsigned int vec_start;
 	unsigned int vec_cnt;
 };
 
-struct feature_ops {
-	int (*init)(struct feature *feature);
-	void (*uinit)(struct feature *feature);
-	int (*get_prop)(struct feature *feature, struct feature_prop *prop);
-	int (*set_prop)(struct feature *feature, struct feature_prop *prop);
-	int (*set_irq)(struct feature *feature, void *irq_set);
+struct ifpga_feature_ops {
+	int (*init)(struct ifpga_feature *feature);
+	void (*uinit)(struct ifpga_feature *feature);
+	int (*get_prop)(struct ifpga_feature *feature,
+			struct feature_prop *prop);
+	int (*set_prop)(struct ifpga_feature *feature,
+			struct feature_prop *prop);
+	int (*set_irq)(struct ifpga_feature *feature, void *irq_set);
 };
 
 enum ifpga_fme_state {
drivers/raw/ifpga_rawdev/base/ifpga_port.c +19 -17
index 4628783..6c41164 100644
@@ -6,7 +6,7 @@
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -21,7 +21,7 @@ int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 
 int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -36,7 +36,7 @@ int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 
 int port_set_irq(struct ifpga_port_hw *port, u32 feature_id, void *irq_set)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -260,7 +260,7 @@ static int port_get_userclk_freqcntrsts(struct ifpga_port_hw *port, u64 *val)
 	return 0;
 }
 
-static int port_hdr_init(struct feature *feature)
+static int port_hdr_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -271,14 +271,15 @@ static int port_hdr_init(struct feature *feature)
 	return 0;
 }
 
-static void port_hdr_uinit(struct feature *feature)
+static void port_hdr_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "port hdr uinit.\n");
 }
 
-static int port_hdr_get_prop(struct feature *feature, struct feature_prop *prop)
+static int port_hdr_get_prop(struct ifpga_feature *feature,
+		struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -308,7 +309,8 @@ static int port_hdr_get_prop(struct feature *feature, struct feature_prop *prop)
 	return -ENOENT;
 }
 
-static int port_hdr_set_prop(struct feature *feature, struct feature_prop *prop)
+static int port_hdr_set_prop(struct ifpga_feature *feature,
+		struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -326,14 +328,14 @@ static int port_hdr_set_prop(struct feature *feature, struct feature_prop *prop)
 	return -ENOENT;
 }
 
-struct feature_ops ifpga_rawdev_port_hdr_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_hdr_ops = {
 	.init = port_hdr_init,
 	.uinit = port_hdr_uinit,
 	.get_prop = port_hdr_get_prop,
 	.set_prop = port_hdr_set_prop,
 };
 
-static int port_stp_init(struct feature *feature)
+static int port_stp_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -347,19 +349,19 @@ static int port_stp_init(struct feature *feature)
 	return 0;
 }
 
-static void port_stp_uinit(struct feature *feature)
+static void port_stp_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "port stp uinit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_stp_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_stp_ops = {
 	.init = port_stp_init,
 	.uinit = port_stp_uinit,
 };
 
-static int port_uint_init(struct feature *feature)
+static int port_uint_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -375,19 +377,19 @@ static int port_uint_init(struct feature *feature)
 	return 0;
 }
 
-static void port_uint_uinit(struct feature *feature)
+static void port_uint_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "PORT UINT UInit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_uint_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_uint_ops = {
 	.init = port_uint_init,
 	.uinit = port_uint_uinit,
 };
 
-static int port_afu_init(struct feature *feature)
+static int port_afu_init(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
@@ -396,14 +398,14 @@ static int port_afu_init(struct feature *feature)
 	return 0;
 }
 
-static void port_afu_uinit(struct feature *feature)
+static void port_afu_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "PORT AFU UInit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_afu_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_afu_ops = {
 	.init = port_afu_init,
 	.uinit = port_afu_uinit,
 };
drivers/raw/ifpga_rawdev/base/ifpga_port_error.c +5 -5
index 9dd1cf5..138284e 100644
@@ -84,7 +84,7 @@ static int port_err_set_clear(struct ifpga_port_hw *port, u64 val)
 	return ret;
 }
 
-static int port_error_init(struct feature *feature)
+static int port_error_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -99,12 +99,12 @@ static int port_error_init(struct feature *feature)
 	return 0;
 }
 
-static void port_error_uinit(struct feature *feature)
+static void port_error_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 }
 
-static int port_error_get_prop(struct feature *feature,
+static int port_error_get_prop(struct ifpga_feature *feature,
 			       struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
@@ -125,7 +125,7 @@ static int port_error_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int port_error_set_prop(struct feature *feature,
+static int port_error_set_prop(struct ifpga_feature *feature,
 			       struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
@@ -136,7 +136,7 @@ static int port_error_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops ifpga_rawdev_port_error_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_error_ops = {
 	.init = port_error_init,
 	.uinit = port_error_uinit,
 	.get_prop = port_error_get_prop,
Signature · 1 line
1.8.3.1
author
#88 lore raw

PATCH v4 14/14 drivers/raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE support for IFPGA Rawdev.

---
 drivers/raw/ifpga_rawdev/Makefile       |   1 +
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 248 +++++++++++++++++++++++++++++++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h |  14 +-
 drivers/raw/ifpga_rawdev/meson.build    |   6 +-
 4 files changed, 264 insertions(+), 5 deletions(-)
drivers/raw/ifpga_rawdev/Makefile +1 -0
index f3b9d5e..f60b547 100644
@@ -13,6 +13,7 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga
 CFLAGS += -I$(RTE_SDK)/drivers/raw/ifpga_rawdev
+CFLAGS += -I$(RTE_SDK)/drivers/net/ipn3ke
 LDLIBS += -lrte_eal
 LDLIBS += -lrte_rawdev
 LDLIBS += -lrte_bus_vdev
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +245 -3

306 lines not on this page · raw message

drivers/raw/ifpga_rawdev/ifpga_rawdev.h +13 -1
index c7759b8..fcb1a96 100644
@@ -8,7 +8,7 @@
 extern int ifpga_rawdev_logtype;
 
 #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifgpa: " fmt, \
+	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifpga_rawdev: " fmt, \
 		##args)
 
 #define IFPGA_RAWDEV_PMD_FUNC_TRACE() IFPGA_RAWDEV_PMD_LOG(DEBUG, ">>")
@@ -28,6 +28,18 @@ enum ifpga_rawdev_device_state {
 	IFPGA_ERROR
 };
 
+/** Set a bit in the uint64 variable */
+#define IFPGA_BIT_SET(var, pos) \
+	((var) |= ((uint64_t)1 << ((pos))))
+
+/** Reset the bit in the variable */
+#define IFPGA_BIT_RESET(var, pos) \
+	((var) &= ~((uint64_t)1 << ((pos))))
+
+/** Check the bit is set in the variable */
+#define IFPGA_BIT_ISSET(var, pos) \
+	(((var) & ((uint64_t)1 << ((pos)))) ? 1 : 0)
+
 static inline struct opae_adapter *
 ifpga_rawdev_get_priv(const struct rte_rawdev *rawdev)
 {
drivers/raw/ifpga_rawdev/meson.build +5 -1
index 6725687..132b777 100644
@@ -6,8 +6,12 @@ version = 1
 subdir('base')
 objs = [base_objs]
 
+dep = dependency('libfdt', required: false)
+if not dep.found()
+	build = false
+endif
 deps += ['rawdev', 'pci', 'bus_pci', 'kvargs',
-	'bus_vdev', 'bus_ifpga']
+	'bus_vdev', 'bus_ifpga', 'net']
 sources = files('ifpga_rawdev.c')
 
 includes += include_directories('base')
Signature · 1 line
1.8.3.1
author
#89 lore raw

v5 cover Add patch set for IPN3KE

In reply to Rosen Xu

v5 updates:
==========
- Fix EXPERIMENTAL symbol definition issue

v4 updates:
==========
- Fix coding style issues

v3 updates:
==========
- Fix v2 comments
- Update MAC BAR of AFU index get ops
- Remove OPAE share code dependency of libfdt

v2 updates:
==========
- Fix v1 comments
- Add support for 10G Base Line Design Bitstream
- Add support for 25G Base Line Design Bitstream

This patch set adds the support of a new net PMD, Intel® FPGA Programmable Acceleration Card N3000, also called ipn3ke.

The ipn3ke PMD (librte_pmd_ipn3ke) provides poll mode driver support for Intel® FPGA PAC(Programmable Acceleration Card) N3000 based on the Intel Ethernet Controller X710/XXV710 and Intel Arria 10 FPGA.

In this card, FPGA is an acceleration bridge between network interface and the Intel Ethernet Controller. Although both FPGA and Ethernet Controllers are connected to CPU with PCIe Gen3x16 Switch, all the packet RX/TX is handled by Intel Ethernet Controller. So from application point of view the data path is still the legacy Intel Ethernet Controller X710/XXV710 PMD. Besides this, users can enable more acceleration features by FPGA IP.

Rosen Xu (7):
drivers/bus/ifpga: add AFU shared data drivers/bus/ifpga: add function for AFU search by name drivers/net/ipn3ke: add IPN3KE ethdev PMD driver drivers/net/ipn3ke: add IPN3KE representor of PMD driver drivers/net/ipn3ke: add IPN3KE TM of PMD driver drivers/net/ipn3ke: add IPN3KE Flow of PMD driver drivers/raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Zhang, Tianfei (7):
raw/ifpga/base: clean up code for ifpga share code raw/ifpga/base: store private features in FME and Port list raw/ifpga/base: add SPI and MAX10 device driver raw/ifpga/base: add I2C and at24 EEPROM driver raw/ifpga/base: add eth group driver
raw/ifpga/base: add version description on README raw/ifpga/base: using prefix name "ifpga_" for feature and feature_ops
data struct

 MAINTAINERS                                        |    7 +
 config/common_base                                 |    4 +
 doc/guides/nics/features/ipn3ke.ini                |   55 +
 doc/guides/nics/index.rst                          |    1 +
 doc/guides/nics/ipn3ke.rst                         |   98 +
 drivers/bus/ifpga/ifpga_bus.c                      |   13 +
 drivers/bus/ifpga/rte_bus_ifpga.h                  |   16 +
 drivers/bus/ifpga/rte_bus_ifpga_version.map        |    6 +
 drivers/net/Makefile                               |    1 +
 drivers/net/ipn3ke/Makefile                        |   39 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c                 |  732 +++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h                 |  898 +++++++++
 drivers/net/ipn3ke/ipn3ke_flow.c                   | 1392 +++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h                   |  106 +
 drivers/net/ipn3ke/ipn3ke_logs.h                   |   30 +
 drivers/net/ipn3ke/ipn3ke_rawdev_api.h             |   62 +
 drivers/net/ipn3ke/ipn3ke_representor.c            |  965 +++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c                     | 2087 ++++++++++++++++++++
 drivers/net/ipn3ke/meson.build                     |    9 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map      |    4 +
 drivers/net/meson.build                            |    1 +
 drivers/raw/ifpga_rawdev/Makefile                  |    1 +
 drivers/raw/ifpga_rawdev/base/Makefile             |    6 +
 drivers/raw/ifpga_rawdev/base/README               |   15 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c          |   98 +-
 drivers/raw/ifpga_rawdev/base/ifpga_api.h          |    1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |   93 +-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c    |  357 ++--
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  |  174 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |   99 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          |  602 +++++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c    |   16 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c    |   18 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c    |   28 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c       |    8 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |   44 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c         |   51 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port_error.c   |   10 +-
 drivers/raw/ifpga_rawdev/base/meson.build          |    8 +-
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c   |   88 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h   |   14 +
 drivers/raw/ifpga_rawdev/base/opae_debug.c         |   16 +-
 drivers/raw/ifpga_rawdev/base/opae_eth_group.c     |  145 ++
 drivers/raw/ifpga_rawdev/base/opae_eth_group.h     |   96 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c        |  200 +-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |   54 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c           |  490 +++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h           |  130 ++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   |   88 +
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |   96 +
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |   21 +-
 drivers/raw/ifpga_rawdev/base/opae_spi.c           |  304 +++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           |  160 ++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   |  438 ++++
 .../ifpga_rawdev/base/osdep_raw/osdep_generic.h    |    1 +
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |   16 +
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c            |  248 ++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h            |   14 +-
 drivers/raw/ifpga_rawdev/meson.build               |    6 +-
 mk/rte.app.mk                                      |    1 +
 usertools/dpdk-devbind.py                          |    4 +-
 61 files changed, 10356 insertions(+), 429 deletions(-)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
 create mode 100644 drivers/net/ipn3ke/Makefile
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_logs.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_rawdev_api.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_representor.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c
 create mode 100644 drivers/net/ipn3ke/meson.build
 create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c
Signature · 1 line
1.8.3.1
author
#90 lore raw

PATCH v5 1/14 drivers/bus/ifpga: add AFU shared data

AFU can be implemented into many different acceleration devices, these devices need shared data to store private information when they are handled by users.

---
 drivers/bus/ifpga/rte_bus_ifpga.h | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/bus/ifpga/rte_bus_ifpga.h +7 -0
index 0bf43ba..820eeaa 100644
@@ -17,6 +17,7 @@
 
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_spinlock.h>
 
 /** Name of Intel FPGA Bus */
 #define IFPGA_BUS_NAME ifpga
@@ -60,6 +61,11 @@ struct rte_afu_pr_conf {
 
 #define AFU_PRI_STR_SIZE (PCI_PRI_STR_SIZE + 8)
 
+struct rte_afu_shared {
+	rte_spinlock_t lock;
+	void *data;
+};
+
 /**
  * A structure describing a AFU device.
  */
@@ -71,6 +77,7 @@ struct rte_afu_device {
 	uint32_t num_region;   /**< number of regions found */
 	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
 						/**< AFU Memory Resource */
+	struct rte_afu_shared shared;
 	struct rte_intr_handle intr_handle;     /**< Interrupt handle */
 	struct rte_afu_driver *driver;          /**< Associated driver */
 	char path[IFPGA_BUS_BITSTREAM_PATH_MAX_LEN];
Signature · 1 line
1.8.3.1
author
#91 lore raw

PATCH v5 2/14 drivers/bus/ifpga: add function for AFU search by name

In reply to Rosen Xu

In many scenarios, AFU is needed searched by name, this function add the feature.

---
 drivers/bus/ifpga/ifpga_bus.c               | 13 +++++++++++++
 drivers/bus/ifpga/rte_bus_ifpga.h           |  9 +++++++++
 drivers/bus/ifpga/rte_bus_ifpga_version.map |  6 ++++++
 3 files changed, 28 insertions(+)
drivers/bus/ifpga/ifpga_bus.c +13 -0
index 55d3abf..8bfae29 100644
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
 	return NULL;
 }
 
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name)
+{
+	struct rte_afu_device *afu_dev = NULL;
+
+	TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) {
+		if (afu_dev &&
+			!strcmp(afu_dev->device.name, name))
+			return afu_dev;
+	}
+	return NULL;
+}
+
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
 	IFPGA_ARG_NAME,
drivers/bus/ifpga/rte_bus_ifpga.h +9 -0
index 820eeaa..c00f60e 100644
@@ -120,6 +120,15 @@ struct rte_afu_driver {
 }
 
 /**
+ * Find AFU by AFU name.
+ *
+ * @param name
+ *   A pointer to AFU name string.
+ */
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name);
+
+/**
  * Register a ifpga afu device driver.
  *
  * @param driver
drivers/bus/ifpga/rte_bus_ifpga_version.map +6 -0
index a027979..247ccfe 100644
@@ -8,3 +8,9 @@ DPDK_18.05 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+    global:
+
+    rte_ifpga_find_afu_by_name;
+};
\ No newline at end of file
Signature · 1 line
1.8.3.1
author
#92 lore raw

PATCH v5 3/14 drivers/net/ipn3ke: add IPN3KE ethdev PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE ethdev PMD driver.

---
 MAINTAINERS                                   |   7 +
 config/common_base                            |   4 +
 doc/guides/nics/features/ipn3ke.ini           |  55 ++
 doc/guides/nics/index.rst                     |   1 +
 doc/guides/nics/ipn3ke.rst                    |  98 +++
 drivers/net/Makefile                          |   1 +
 drivers/net/ipn3ke/Makefile                   |  36 ++
 drivers/net/ipn3ke/ipn3ke_ethdev.c            | 707 ++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h            | 891 ++++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_logs.h              |  30 +
 drivers/net/ipn3ke/ipn3ke_rawdev_api.h        |  62 ++
 drivers/net/ipn3ke/meson.build                |   6 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map |   4 +
 drivers/net/meson.build                       |   1 +
 mk/rte.app.mk                                 |   1 +
 usertools/dpdk-devbind.py                     |   4 +-
 16 files changed, 1907 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
 create mode 100644 drivers/net/ipn3ke/Makefile
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_logs.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_rawdev_api.h
 create mode 100644 drivers/net/ipn3ke/meson.build
 create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
MAINTAINERS +7 -0
index e9ff2b4..92c1912 100644
@@ -608,6 +608,13 @@ F: drivers/net/ice/
 F: doc/guides/nics/ice.rst
 F: doc/guides/nics/features/ice.ini
 
+Intel ipn3ke
+M: Rosen Xu <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/ipn3ke/
+F: doc/guides/nics/ipn3ke.rst
+F: doc/guides/nics/features/ipn3ke.ini
+
 Marvell mvpp2
 M: Tomasz Duszynski <[email protected]>
 M: Liron Himi <[email protected]>
config/common_base +4 -0
index 6292bc4..ee148a1 100644
@@ -328,6 +328,10 @@ CONFIG_RTE_LIBRTE_IAVF_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_IAVF_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_IAVF_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_IAVF_16BYTE_RX_DESC=n
+#
+# Compile burst-oriented IPN3KE PMD driver
+#
+CONFIG_RTE_LIBRTE_IPN3KE_PMD=y
 
 #
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD
doc/guides/nics/features/ipn3ke.ini new file +55 -0

55 lines not on this page · raw message

doc/guides/nics/index.rst +1 -0
index 5c80e3b..611ffb8 100644
@@ -30,6 +30,7 @@ Network Interface Controller Drivers
     ice
     ifc
     igb
+    ipn3ke
     ixgbe
     intel_vf
     kni
doc/guides/nics/ipn3ke.rst new file +98 -0

98 lines not on this page · raw message

drivers/net/Makefile +1 -0
index 502869a..f78a6bc 100644
@@ -31,6 +31,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += iavf
 DIRS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice
+DIRS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
 DIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += liquidio
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
drivers/net/ipn3ke/Makefile new file +36 -0
new file mode 100644
index 0000000..d7aa79b
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_ipn3ke.a
+
+#
+# Add the experimenatal APIs called from this PMD
+#  rte_eth_switch_domain_alloc()
+#  rte_eth_dev_create()
+#  rte_eth_dev_destroy()
+#  rte_eth_switch_domain_free()
+#
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_ifpga
+LDLIBS += -lrte_bus_vdev
+
+EXPORT_MAP := rte_pmd_ipn3ke_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +707 -0

707 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_ethdev.h new file +891 -0

891 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_logs.h new file +30 -0
new file mode 100644
index 0000000..dedaece
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _IPN3KE_LOGS_H_
+#define _IPN3KE_LOGS_H_
+
+#include <rte_log.h>
+
+extern int ipn3ke_afu_logtype;
+
+#define IPN3KE_AFU_PMD_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, ipn3ke_afu_logtype, "ipn3ke_afu: " fmt, \
+		##args)
+
+#define IPN3KE_AFU_PMD_FUNC_TRACE() IPN3KE_AFU_PMD_LOG(DEBUG, ">>")
+
+#define IPN3KE_AFU_PMD_DEBUG(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(DEBUG, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_INFO(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(INFO, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_ERR(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(ERR, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_WARN(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(WARNING, fmt, ## args)
+
+#endif /* _IPN3KE_LOGS_H_ */
drivers/net/ipn3ke/ipn3ke_rawdev_api.h new file +62 -0

62 lines not on this page · raw message

drivers/net/ipn3ke/meson.build new file +6 -0
new file mode 100644
index 0000000..e983bb3
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+allow_experimental_apis = true
+sources += files('ipn3ke_ethdev.c')
+deps += ['bus_ifpga', 'sched']
drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +4 -0
new file mode 100644
index 0000000..fc8c95e
@@ -0,0 +1,4 @@
+DPDK_19.05 {
+
+	local: *;
+};
drivers/net/meson.build +1 -0
index 3ecc78c..81a6c79 100644
@@ -19,6 +19,7 @@ drivers = ['af_packet',
 	'iavf',
 	'ice',
 	'ifc',
+	'ipn3ke',
 	'ixgbe',
 	'kni',
 	'liquidio',
mk/rte.app.mk +1 -0
index 262132f..3bb0821 100644
@@ -295,6 +295,7 @@ endif # CONFIG_RTE_LIBRTE_FSLMC_BUS
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IFPGA_BUS)      += -lrte_bus_ifpga
 ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
usertools/dpdk-devbind.py +3 -1
index 249b65a..3fb358e 100755
@@ -12,6 +12,8 @@
 # The PCI base class for all devices
 network_class = {'Class': '02', 'Vendor': None, 'Device': None,
                     'SVendor': None, 'SDevice': None}
+ifpga_class = {'Class': '12', 'Vendor': '8086', 'Device': 'bcc0,09c4,0b30',
+                    'SVendor': None, 'SDevice': None}
 encryption_class = {'Class': '10', 'Vendor': None, 'Device': None,
                    'SVendor': None, 'SDevice': None}
 intel_processor_class = {'Class': '0b', 'Vendor': '8086', 'Device': None,
@@ -34,7 +36,7 @@
 octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
               'SVendor': None, 'SDevice': None}
 
-network_devices = [network_class, cavium_pkx, avp_vnic]
+network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
 crypto_devices = [encryption_class, intel_processor_class]
 eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
 mempool_devices = [cavium_fpa, octeontx2_npa]
Signature · 1 line
1.8.3.1
#93 lore raw

Re: [PATCH v5 03/14] drivers/net/ipn3ke: add IPN3KE ethdev PMD driver

Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE ethdev PMD driver.

<...>

doc/guides/nics/ipn3ke.rst line 40

Quoted 7 lines
doc/guides/nics/ipn3ke.rst new file +7 -0
+Config File Options
+~~~~~~~~~~~~~~~~~~~
+
+The following options can be modified in the ``config`` file.
+Please note that enabling debugging options may affect system performance.
+
+- ``CONFIG_RTE_LIBRTE_IPN3KE_PMD`` (default ``n``)

It looks like enabled by default in config file, which one is the intention.

Quoted 9 lines
doc/guides/nics/ipn3ke.rst new file +9 -0
+
+  Toggle compilation of the ``librte_pmd_ipn3ke`` driver.
+
+Runtime Config Options
+~~~~~~~~~~~~~~~~~~~~~~
+
+- ``AFU name``
+
+  AFU name identifies which AFU is used by IPN3KE.

doc/guides/nics/ipn3ke.rst line 59

Quoted 10 lines
doc/guides/nics/ipn3ke.rst new file +10 -0
+
+- ``FPGA Acceleration list``
+
+  For IPN3KE FPGA can provide different bitstream, different bitstream includes different
+  Acceleration, so users need to identify which Acceleration is used.
+
+- ``I40e PF name list``
+
+  Users need to bind FPGA LineSidePort to FVL PF. So I40e PF name list should be involved in
+  startup command.

Can you please document the actual options themselves here?

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 41

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +5 -0
+static int ipn3ke_indirect_read(struct ipn3ke_hw *hw,
+					 uint32_t *rd_data,
+					 uint32_t addr,
+					 uint32_t dev_sel,
+					 uint32_t eth_group_sel)

Can you please apply the coding convention:
static int
<function name> (parameters)
{

Also how parameters aligned here?
according coding convention it should be:

static int
ipn3ke_indirect_read(struct ipn3ke_hw *hw, uint32_t *rd_data, uint32_t addr,

	uint32_t dev_sel, uint32_t eth_group_sel)

Can you please fix this for all functions?

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 502

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +3 -0
+static int
+ipn3ke_cfg_parse_i40e_pf_ethdev(const char *afu_name,
+const char *pf_name)

Please fix indentation.

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 694

Quoted 2 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +2 -0
+RTE_PMD_REGISTER_VDEV(ipn3ke_cfg, ipn3ke_cfg_driver);
+RTE_PMD_REGISTER_ALIAS(ipn3ke_cfg, ipn3ke_cfg);

Creating alias with same name :) Please drop.

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 702

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +3 -0
+RTE_INIT(ipn3ke_afu_init_log);
+static void
+ipn3ke_afu_init_log(void)

Can merge these lines into single:
RTE_INIT(ipn3ke_afu_init_log)

It looks like I did same comment in previous versions as well, can you please check previous reviews for missed comments.

Review

Quoted 2 lines
(quoted diff) +2 -0
+{
+	ipn3ke_afu_logtype = rte_log_register("driver.afu.ipn3ke");

"pmd.afu.ipn3ke"

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.h line 30

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_ethdev.h new file +5 -0
+#include <rte_cycles.h>
+#include <rte_bus_ifpga.h>
+#include <rte_tm_driver.h>
+
+struct ipn3ke_rpst;

Is this forward decleration needed?

<...>

drivers/net/ipn3ke/meson.build line 4

Quoted 5 lines
drivers/net/ipn3ke/meson.build new file +4 -0
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+allow_experimental_apis = true

Can you please add list of experimental APIs called in a comment as done in makefile

<...>

usertools/dpdk-devbind.py line 16

Quoted 6 lines
usertools/dpdk-devbind.py +2 -0
@@ -12,6 +12,8 @@
 # The PCI base class for all devices
 network_class = {'Class': '02', 'Vendor': None, 'Device': None,
                     'SVendor': None, 'SDevice': None}
+ifpga_class = {'Class': '12', 'Vendor': '8086', 'Device': 'bcc0,09c4,0b30',
+                    'SVendor': None, 'SDevice': None}

Only '0x0B30' added in this patch, right?
If you can make this seperate patch, with older device ids, it becomes backportable, and in this patch you can add new ids.

Should add VF ids, 0x0B31 etc... ?

author
#94 lore raw

Re: [dpdk-dev] [PATCH v5 03/14] drivers/net/ipn3ke: add IPN3KE ethdev PMD driver

Hi,

Quoted 26 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, April 05, 2019 3:38
To: Xu, Rosen <[email protected]>; [email protected]
Cc: Zhang, Tianfei <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>; Lomartire, David <[email protected]>
Subject: Re: [PATCH v5 03/14] drivers/net/ipn3ke: add IPN3KE ethdev PMD driver

Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE ethdev PMD driver.

<...>

doc/guides/nics/ipn3ke.rst

Quoted 5 lines
doc/guides/nics/ipn3ke.rst new file +5 -0
+Config File Options
+~~~~~~~~~~~~~~~~~~~
+
+The following options can be modified in the ``config`` file.
+Please note that enabling debugging options may affect system

performance.

Quoted 4 lines
Quoted 2 lines

+
+- ``CONFIG_RTE_LIBRTE_IPN3KE_PMD`` (default ``n``)

It looks like enabled by default in config file, which one is the intention.

Fixed in v6.

Quoted 15 lines
Quoted 4 lines
doc/guides/nics/ipn3ke.rst new file +4 -0
+
+  Toggle compilation of the ``librte_pmd_ipn3ke`` driver.
+
+Runtime Config Options

doc/guides/nics/ipn3ke.rst

Quoted 10 lines
doc/guides/nics/ipn3ke.rst new file +10 -0
+~~~~~~~~~~~~~~~~~~~~~~
+
+- ``AFU name``
+
+  AFU name identifies which AFU is used by IPN3KE.
+
+- ``FPGA Acceleration list``
+
+  For IPN3KE FPGA can provide different bitstream, different
+ bitstream includes different  Acceleration, so users need to identify

which Acceleration is used.

Quoted 7 lines

doc/guides/nics/ipn3ke.rst

Quoted 5 lines
doc/guides/nics/ipn3ke.rst new file +5 -0
+
+- ``I40e PF name list``
+
+  Users need to bind FPGA LineSidePort to FVL PF. So I40e PF name
+ list should be involved in  startup command.

Can you please document the actual options themselves here?

Okay, added in v6.

Quoted 16 lines

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 41

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +5 -0
+static int ipn3ke_indirect_read(struct ipn3ke_hw *hw,
+					 uint32_t *rd_data,
+					 uint32_t addr,
+					 uint32_t dev_sel,
+					 uint32_t eth_group_sel)

Can you please apply the coding convention:
static int
<function name> (parameters)
{

Also how parameters aligned here?
according coding convention it should be:

Quoted 8 lines

static int
ipn3ke_indirect_read(struct ipn3ke_hw *hw, uint32_t *rd_data, uint32_t addr,

	uint32_t dev_sel, uint32_t eth_group_sel)

Can you please fix this for all functions?

<...>

Okay, checked all functions and fixed mismatch in v6.

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+static int
+ipn3ke_cfg_parse_i40e_pf_ethdev(const char *afu_name, const char
+*pf_name)

Please fix indentation.

Okay, fixed in v6.

Quoted 6 lines

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 694

Quoted 2 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +2 -0
+RTE_PMD_REGISTER_VDEV(ipn3ke_cfg, ipn3ke_cfg_driver);
+RTE_PMD_REGISTER_ALIAS(ipn3ke_cfg, ipn3ke_cfg);

Creating alias with same name :) Please drop.

Okay, removed in v6 and checked in platform.

Quoted 11 lines

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 702

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +3 -0
+RTE_INIT(ipn3ke_afu_init_log);
+static void
+ipn3ke_afu_init_log(void)

Can merge these lines into single:
RTE_INIT(ipn3ke_afu_init_log)

It looks like I did same comment in previous versions as well, can you please check previous reviews for missed comments.

Sorry, I miss this comment.
Fixed in v6.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+{
+	ipn3ke_afu_logtype = rte_log_register("driver.afu.ipn3ke");

"pmd.afu.ipn3ke"

It seems better, so modified in v6.

Quoted 9 lines

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.h line 30

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_ethdev.h new file +5 -0
+#include <rte_cycles.h>
+#include <rte_bus_ifpga.h>
+#include <rte_tm_driver.h>
+
+struct ipn3ke_rpst;

Is this forward decleration needed?

No need, so removed in v6.

Quoted 10 lines

<...>

drivers/net/ipn3ke/meson.build line 4

Quoted 5 lines
drivers/net/ipn3ke/meson.build new file +4 -0
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel
+Corporation
+
+allow_experimental_apis = true

Can you please add list of experimental APIs called in a comment as done in makefile

Okay, added in v6.

Quoted 10 lines

<...>

usertools/dpdk-devbind.py line 16

Quoted 6 lines
usertools/dpdk-devbind.py +2 -0
@@ -12,6 +12,8 @@
 # The PCI base class for all devices
 network_class = {'Class': '02', 'Vendor': None, 'Device': None,
                     'SVendor': None, 'SDevice': None}
+ifpga_class = {'Class': '12', 'Vendor': '8086', 'Device': 'bcc0,09c4,0b30',
+                    'SVendor': None, 'SDevice': None}

Only '0x0B30' added in this patch, right?

Yep, only keep '0x0B30' and remove others.

Quoted 2 lines

If you can make this seperate patch, with older device ids, it becomes backportable, and in this patch you can add new ids.

Removed others, thanks.

Quoted 1 line

Should add VF ids, 0x0B31 etc... ?

VF supporting has not been released, but it will upstream in next release cycle. So for this release, no VF ids.

author
#95 lore raw

PATCH v5 4/14 drivers/net/ipn3ke: add IPN3KE representor of PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE representor of PMD driver.

---
 drivers/net/ipn3ke/Makefile             |   1 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c      |  16 +
 drivers/net/ipn3ke/ipn3ke_representor.c | 961 ++++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/meson.build          |   3 +-
 4 files changed, 980 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ipn3ke/ipn3ke_representor.c
drivers/net/ipn3ke/Makefile +1 -0
index d7aa79b..828df3a 100644
@@ -32,5 +32,6 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_representor.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c +16 -0
index 372ce80..dc20009 100644
@@ -404,9 +404,23 @@ static int ipn3ke_vswitch_probe(struct rte_afu_device *afu_dev)
 
 	/* probe representor ports */
 	for (i = 0; i < hw->port_num; i++) {
+		struct ipn3ke_rpst rpst = {
+			.port_id = i,
+			.switch_domain_id = hw->switch_domain_id,
+			.hw = hw
+		};
+
 		/* representor port net_bdf_port */
 		snprintf(name, sizeof(name), "net_%s_representor_%d",
 			afu_dev->device.name, i);
+
+		retval = rte_eth_dev_create(&afu_dev->device, name,
+			sizeof(struct ipn3ke_rpst), NULL, NULL,
+			ipn3ke_rpst_init, &rpst);
+
+		if (retval)
+			IPN3KE_AFU_PMD_ERR("failed to create ipn3ke representor %s.",
+								name);
 	}
 
 	return 0;
@@ -430,6 +444,8 @@ static int ipn3ke_vswitch_remove(struct rte_afu_device *afu_dev)
 		ethdev = rte_eth_dev_allocated(afu_dev->device.name);
 		if (!ethdev)
 			return -ENODEV;
+
+		rte_eth_dev_destroy(ethdev, ipn3ke_rpst_uninit);
 	}
 
 	ret = rte_eth_switch_domain_free(hw->switch_domain_id);
drivers/net/ipn3ke/ipn3ke_representor.c new file +961 -0

961 lines not on this page · raw message

drivers/net/ipn3ke/meson.build +2 -1
index e983bb3..7ba4ca9 100644
@@ -2,5 +2,6 @@
 # Copyright(c) 2019 Intel Corporation
 
 allow_experimental_apis = true
-sources += files('ipn3ke_ethdev.c')
+sources += files('ipn3ke_ethdev.c',
+	'ipn3ke_representor.c')
 deps += ['bus_ifpga', 'sched']
Signature · 1 line
1.8.3.1
#96 lore raw

Re: [PATCH v5 04/14] drivers/net/ipn3ke: add IPN3KE representor of PMD driver

Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE representor of PMD driver.

<...>

drivers/net/ipn3ke/ipn3ke_representor.c line 205

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +3 -0
+static void
+ipn3ke_rpst_dev_stop(__rte_unused struct rte_eth_dev *dev)
+{

'dev' is used in this function, can drop '__rte_unused'

drivers/net/ipn3ke/ipn3ke_representor.c line 133

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +6 -0
+	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
+	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(dev);
+	uint32_t val;
+
+	if (hw->retimer.mac_type == IFPGA_RAWDEV_RETIMER_MAC_TYPE_25GE_25GAUI) {
+	} else {

Why having empty 'if' condition and put everything into 'else', why not revert the check in if?
Similar usage in many places.

Review

Quoted 1 line
(quoted diff) +1 -0
+	/* Disable the TX path */

Fix indentation please.

Review

Quoted 1 line
(quoted diff) +1 -0
+		val = 1;

I assume this is the value to write to say disable Tx path, I wonder if there is a define MACRO for it? If not does it make sense to have one?

<...>

Quoted 20 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +20 -0
+/*
+ * Reset PF device only to re-initialize resources in PMD layer
+ */
+static int
+ipn3ke_rpst_dev_reset(struct rte_eth_dev *dev)
+{
+	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
+	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(dev);
+	uint32_t val;
+
+	if (hw->retimer.mac_type == IFPGA_RAWDEV_RETIMER_MAC_TYPE_25GE_25GAUI) {
+	} else {
+		/* Disable the TX path */
+		val = 1;
+		val &= IPN3KE_MAC_TX_PACKET_CONTROL_MASK;
+		(*hw->f_mac_write)(hw,
+				val,
+				IPN3KE_MAC_TX_PACKET_CONTROL,
+				rpst->port_id,
+				0);

drivers/net/ipn3ke/ipn3ke_representor.c line 290

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +10 -0
+
+		/* Disable the RX path */
+		val = 1;
+		val &= IPN3KE_MAC_RX_TRANSFER_CONTROL_MASK;
+		(*hw->f_mac_write)(hw,
+				val,
+				IPN3KE_MAC_RX_TRANSFER_CONTROL,
+				rpst->port_id,
+				0);
+	}

Same exact block repeated third time now, and there is one more copy as 'val = 0', what do you think converting this into function which gets enable/disable as argument so that 'val' also can be detail of that function.

<...>

drivers/net/ipn3ke/ipn3ke_representor.c line 363

Quoted 13 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +13 -0
+static int
+ipn3ke_rpst_xstats_get(__rte_unused struct rte_eth_dev *dev,
+	__rte_unused struct rte_eth_xstat *xstats,
+	__rte_unused unsigned int n)
+{
+	return 0;
+}
+static int ipn3ke_rpst_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+		__rte_unused struct rte_eth_xstat_name *xstats_names,
+		__rte_unused unsigned int limit)
+{
+	return 0;
+}

Can you please apply same syntax to this function as others:
static int
....

Also can you please put a empty line between previous and this function.

<...>

Quoted 14 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +14 -0
+static int
+ipn3ke_rpst_link_check(struct ipn3ke_rpst *rpst)
+{
+	struct ipn3ke_hw *hw;
+	struct rte_rawdev *rawdev;
+	struct rte_eth_link link;
+	struct rte_eth_dev *pf;
+
+	if (rpst == NULL)
+		return -1;
+
+	hw = rpst->hw;
+
+	memset(&link, 0, sizeof(link));

drivers/net/ipn3ke/ipn3ke_representor.c line 521

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +10 -0
+
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_autoneg = !(rpst->ethdev->data->dev_conf.link_speeds &
+				ETH_LINK_SPEED_FIXED);
+
+	rawdev = hw->rawdev;
+	ipn3ke_update_link(rawdev, rpst->port_id, &link);
+
+	if (!rpst->ori_linfo.link_status &&
+		link.link_status) {

Better to put one more tab here, to make it easy to pick the condition part from the indendent code.

<...>

drivers/net/ipn3ke/ipn3ke_representor.c line 835

Quoted 2 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +2 -0
+
+struct eth_dev_ops ipn3ke_rpst_dev_ops = {

This can be "static const"

Quoted 27 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +27 -0
+	.dev_infos_get        = ipn3ke_rpst_dev_infos_get,
+
+	.dev_configure        = ipn3ke_rpst_dev_configure,
+	.dev_start            = ipn3ke_rpst_dev_start,
+	.dev_stop             = ipn3ke_rpst_dev_stop,
+	.dev_close            = ipn3ke_rpst_dev_close,
+	.dev_reset            = ipn3ke_rpst_dev_reset,
+
+	.stats_get            = ipn3ke_rpst_stats_get,
+	.xstats_get           = ipn3ke_rpst_xstats_get,
+	.xstats_get_names     = ipn3ke_rpst_xstats_get_names,
+	.stats_reset          = ipn3ke_rpst_stats_reset,
+	.xstats_reset         = ipn3ke_rpst_stats_reset,
+
+	.filter_ctrl          = ipn3ke_afu_filter_ctrl,
+
+	.rx_queue_start       = ipn3ke_rpst_rx_queue_start,
+	.rx_queue_stop        = ipn3ke_rpst_rx_queue_stop,
+	.tx_queue_start       = ipn3ke_rpst_tx_queue_start,
+	.tx_queue_stop        = ipn3ke_rpst_tx_queue_stop,
+	.rx_queue_setup       = ipn3ke_rpst_rx_queue_setup,
+	.rx_queue_release     = ipn3ke_rpst_rx_queue_release,
+	.tx_queue_setup       = ipn3ke_rpst_tx_queue_setup,
+	.tx_queue_release     = ipn3ke_rpst_tx_queue_release,
+
+	.dev_set_link_up      = ipn3ke_rpst_dev_set_link_up,
+	.dev_set_link_down    = ipn3ke_rpst_dev_set_link_down,

drivers/net/ipn3ke/ipn3ke_representor.c line 872

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +10 -0
+	.link_update          = ipn3ke_rpst_link_update,
+
+	.promiscuous_enable   = ipn3ke_rpst_promiscuous_enable,
+	.promiscuous_disable  = ipn3ke_rpst_promiscuous_disable,
+	.allmulticast_enable  = ipn3ke_rpst_allmulticast_enable,
+	.allmulticast_disable = ipn3ke_rpst_allmulticast_disable,
+	.mac_addr_set         = ipn3ke_rpst_mac_addr_set,
+	.mtu_set              = ipn3ke_rpst_mtu_set,
+
+	.tm_ops_get           = NULL,

No need to set NULL ones.

<...>

Quoted 18 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +18 -0
+int
+ipn3ke_rpst_init(struct rte_eth_dev *ethdev, void *init_params)
+{
+	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev);
+	struct ipn3ke_rpst *representor_param =
+			(struct ipn3ke_rpst *)init_params;
+
+	if (representor_param->port_id >= representor_param->hw->port_num)
+		return -ENODEV;
+
+	rpst->ethdev = ethdev;
+	rpst->switch_domain_id = representor_param->switch_domain_id;
+	rpst->port_id = representor_param->port_id;
+	rpst->hw = representor_param->hw;
+	rpst->i40e_pf_eth = NULL;
+	rpst->i40e_pf_eth_port_id = 0xFFFF;
+
+	ethdev->data->mac_addrs = rte_zmalloc("ipn3ke", ETHER_ADDR_LEN, 0);

drivers/net/ipn3ke/ipn3ke_representor.c line 915

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +10 -0
+	if (!ethdev->data->mac_addrs) {
+		IPN3KE_AFU_PMD_ERR("Failed to "
+			"allocated memory for storing mac address");
+		return -ENODEV;
+	}
+
+	/** representor shares the same driver as it's PF device */
+	/**
+	 * ethdev->device->driver = rpst->hw->eth_dev->device->driver;
+	 */

Please remove commented code.

author
#97 lore raw

Re: [dpdk-dev] [PATCH v5 04/14] drivers/net/ipn3ke: add IPN3KE representor of PMD driver

Hi,

Quoted 19 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, April 05, 2019 3:02
To: Xu, Rosen <[email protected]>; [email protected]
Cc: Zhang, Tianfei <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>; Lomartire, David <[email protected]>
Subject: Re: [PATCH v5 04/14] drivers/net/ipn3ke: add IPN3KE representor of PMD driver

Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE representor of PMD driver.

Quoted 6 lines

<...>

Review

Quoted 2 lines
(quoted diff) +2 -0
+static void
+ipn3ke_rpst_dev_stop(__rte_unused struct rte_eth_dev *dev) {

'dev' is used in this function, can drop '__rte_unused'

Removed in v6.

Quoted 7 lines

drivers/net/ipn3ke/ipn3ke_representor.c

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +5 -0
+	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
+	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(dev);
+	uint32_t val;
+
+	if (hw->retimer.mac_type ==

IFPGA_RAWDEV_RETIMER_MAC_TYPE_25GE_25GAUI) {

Quoted 5 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	} else {

Why having empty 'if' condition and put everything into 'else', why not revert the check in if?
Similar usage in many places.

Currently 25G MAC is auto configurable in FPGA, this condition is just to identify 10G MAC and 25G MAC configuration.
In v6, all the condition is exactly modified to' IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI'.

Quoted 5 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	/* Disable the TX path */

Fix indentation please.

Review

Quoted 1 line
(quoted diff) +1 -0
+		val = 1;

Fixed in v6.

Quoted 2 lines

I assume this is the value to write to say disable Tx path, I wonder if there is a define MACRO for it? If not does it make sense to have one?

Yep, added new inline functions for them.
ipn3ke_xmac_tx_enable()
ipn3ke_xmac_tx_disable()
ipn3ke_xmac_rx_enable()
ipn3ke_xmac_rx_disable()
ipn3ke_xmac_smac_override_disable()
ipn3ke_xmac_tx_clear_statistics()
ipn3ke_xmac_rx_clear_statistics()

Quoted 26 lines

<...>

drivers/net/ipn3ke/ipn3ke_representor.c

Quoted 8 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +8 -0
+/*
+ * Reset PF device only to re-initialize resources in PMD layer  */
+static int ipn3ke_rpst_dev_reset(struct rte_eth_dev *dev) {
+	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
+	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(dev);
+	uint32_t val;
+
+	if (hw->retimer.mac_type ==

IFPGA_RAWDEV_RETIMER_MAC_TYPE_25GE_25GAUI) {

Quoted 15 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +15 -0
+	} else {
+		/* Disable the TX path */
+		val = 1;
+		val &= IPN3KE_MAC_TX_PACKET_CONTROL_MASK;
+		(*hw->f_mac_write)(hw,
+				val,
+				IPN3KE_MAC_TX_PACKET_CONTROL,
+				rpst->port_id,
+				0);
+
+		/* Disable the RX path */
+		val = 1;
+		val &= IPN3KE_MAC_RX_TRANSFER_CONTROL_MASK;
+		(*hw->f_mac_write)(hw,
+				val,
Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_representor.c line 196

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +4 -0
+				IPN3KE_MAC_RX_TRANSFER_CONTROL,
+				rpst->port_id,
+				0);
+	}

Same exact block repeated third time now, and there is one more copy as 'val = 0', what do you think converting this into function which gets enable/disable as argument so that 'val' also can be detail of that function.

I agree with you, and fixed it in v6.
Added some inline functions in v6.
Pls see my reply before.

Quoted 11 lines

<...>

drivers/net/ipn3ke/ipn3ke_representor.c

Quoted 8 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +8 -0
+static int
+ipn3ke_rpst_xstats_get(__rte_unused struct rte_eth_dev *dev,
+	__rte_unused struct rte_eth_xstat *xstats,
+	__rte_unused unsigned int n)
+{
+	return 0;
+}
+static int ipn3ke_rpst_xstats_get_names(__rte_unused struct

rte_eth_dev *dev,

Quoted 9 lines

drivers/net/ipn3ke/ipn3ke_representor.c line 363

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +5 -0
+		__rte_unused struct rte_eth_xstat_name *xstats_names,
+		__rte_unused unsigned int limit)
+{
+	return 0;
+}

Can you please apply same syntax to this function as others:
static int
....

Yep, checked and fixed in all code.

Quoted 4 lines

Also can you please put a empty line between previous and this function.

<...>

Yep, checked and fixed in all code.

Quoted 18 lines
Quoted 18 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +18 -0
+static int
+ipn3ke_rpst_link_check(struct ipn3ke_rpst *rpst) {
+	struct ipn3ke_hw *hw;
+	struct rte_rawdev *rawdev;
+	struct rte_eth_link link;
+	struct rte_eth_dev *pf;
+
+	if (rpst == NULL)
+		return -1;
+
+	hw = rpst->hw;
+
+	memset(&link, 0, sizeof(link));
+
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_autoneg = !(rpst->ethdev->data->dev_conf.link_speeds &
+				ETH_LINK_SPEED_FIXED);
+
Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_representor.c line 463

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +5 -0
+	rawdev = hw->rawdev;
+	ipn3ke_update_link(rawdev, rpst->port_id, &link);
+
+	if (!rpst->ori_linfo.link_status &&
+		link.link_status) {

Better to put one more tab here, to make it easy to pick the condition part from the indendent code.

Okay, has put one more tab here in v6.

Quoted 6 lines

<...>

drivers/net/ipn3ke/ipn3ke_representor.c line 835

Quoted 2 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +2 -0
+
+struct eth_dev_ops ipn3ke_rpst_dev_ops = {

This can be "static const"

Yep, fixed in v6.

Quoted 31 lines
Quoted 31 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +31 -0
+	.dev_infos_get        = ipn3ke_rpst_dev_infos_get,
+
+	.dev_configure        = ipn3ke_rpst_dev_configure,
+	.dev_start            = ipn3ke_rpst_dev_start,
+	.dev_stop             = ipn3ke_rpst_dev_stop,
+	.dev_close            = ipn3ke_rpst_dev_close,
+	.dev_reset            = ipn3ke_rpst_dev_reset,
+
+	.stats_get            = ipn3ke_rpst_stats_get,
+	.xstats_get           = ipn3ke_rpst_xstats_get,
+	.xstats_get_names     = ipn3ke_rpst_xstats_get_names,
+	.stats_reset          = ipn3ke_rpst_stats_reset,
+	.xstats_reset         = ipn3ke_rpst_stats_reset,
+
+	.filter_ctrl          = ipn3ke_afu_filter_ctrl,
+
+	.rx_queue_start       = ipn3ke_rpst_rx_queue_start,
+	.rx_queue_stop        = ipn3ke_rpst_rx_queue_stop,
+	.tx_queue_start       = ipn3ke_rpst_tx_queue_start,
+	.tx_queue_stop        = ipn3ke_rpst_tx_queue_stop,
+	.rx_queue_setup       = ipn3ke_rpst_rx_queue_setup,
+	.rx_queue_release     = ipn3ke_rpst_rx_queue_release,
+	.tx_queue_setup       = ipn3ke_rpst_tx_queue_setup,
+	.tx_queue_release     = ipn3ke_rpst_tx_queue_release,
+
+	.dev_set_link_up      = ipn3ke_rpst_dev_set_link_up,
+	.dev_set_link_down    = ipn3ke_rpst_dev_set_link_down,
+	.link_update          = ipn3ke_rpst_link_update,
+
+	.promiscuous_enable   = ipn3ke_rpst_promiscuous_enable,
+	.promiscuous_disable  = ipn3ke_rpst_promiscuous_disable,
Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_representor.c line 872

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +6 -0
+	.allmulticast_enable  = ipn3ke_rpst_allmulticast_enable,
+	.allmulticast_disable = ipn3ke_rpst_allmulticast_disable,
+	.mac_addr_set         = ipn3ke_rpst_mac_addr_set,
+	.mtu_set              = ipn3ke_rpst_mtu_set,
+
+	.tm_ops_get           = NULL,

No need to set NULL ones.

Fixed in v6.

Quoted 21 lines

<...>

Quoted 8 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +7 -0
+int
+ipn3ke_rpst_init(struct rte_eth_dev *ethdev, void *init_params) {
+	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev);
+	struct ipn3ke_rpst *representor_param =
+			(struct ipn3ke_rpst *)init_params;
+
+	if (representor_param->port_id >= representor_param->hw-

port_num)

drivers/net/ipn3ke/ipn3ke_representor.c

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +10 -0
+		return -ENODEV;
+
+	rpst->ethdev = ethdev;
+	rpst->switch_domain_id = representor_param->switch_domain_id;
+	rpst->port_id = representor_param->port_id;
+	rpst->hw = representor_param->hw;
+	rpst->i40e_pf_eth = NULL;
+	rpst->i40e_pf_eth_port_id = 0xFFFF;
+
+	ethdev->data->mac_addrs = rte_zmalloc("ipn3ke",

ETHER_ADDR_LEN, 0);

Quoted 12 lines

drivers/net/ipn3ke/ipn3ke_representor.c line 915

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +10 -0
+	if (!ethdev->data->mac_addrs) {
+		IPN3KE_AFU_PMD_ERR("Failed to "
+			"allocated memory for storing mac address");
+		return -ENODEV;
+	}
+
+	/** representor shares the same driver as it's PF device */
+	/**
+	 * ethdev->device->driver = rpst->hw->eth_dev->device->driver;
+	 */

Please remove commented code.

Okay, fixed in v6.

author
#98 lore raw

PATCH v5 5/14 drivers/net/ipn3ke: add IPN3KE TM of PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE TM of PMD driver.

---
 drivers/net/ipn3ke/Makefile             |    1 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c      |    3 +
 drivers/net/ipn3ke/ipn3ke_ethdev.h      |    6 +
 drivers/net/ipn3ke/ipn3ke_representor.c |    5 +-
 drivers/net/ipn3ke/ipn3ke_tm.c          | 2086 +++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/meson.build          |    3 +-
 6 files changed, 2102 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c
drivers/net/ipn3ke/Makefile +1 -0
index 828df3a..903ec39 100644
@@ -33,5 +33,6 @@ LIBABIVER := 1
 #
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_representor.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_tm.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c +3 -0
index dc20009..55e83db 100644
@@ -314,6 +314,9 @@ static int ipn3ke_indirect_mac_write(struct ipn3ke_hw *hw,
 	hw->flow_hw_enable = 0;
 	if (afu_dev->id.uuid.uuid_low == IPN3KE_UUID_VBNG_LOW &&
 		afu_dev->id.uuid.uuid_high == IPN3KE_UUID_VBNG_HIGH) {
+		ret = ipn3ke_hw_tm_init(hw);
+		if (ret)
+			return ret;
 		hw->tm_hw_enable = 1;
 	}
 
drivers/net/ipn3ke/ipn3ke_ethdev.h +6 -0
index 3baa9fe..95bc188 100644
@@ -148,6 +148,12 @@ enum ipn3ke_tm_node_priority {
 
 #define IPN3KE_TM_NODE_WEIGHT_MAX UINT8_MAX
 
+void
+ipn3ke_tm_init(struct ipn3ke_rpst *rpst);
+int
+ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev,
+		void *arg);
+
 /** Set a bit in the uint32 variable */
 #define IPN3KE_BIT_SET(var, pos) \
 	((var) |= ((uint32_t)1 << ((pos))))
drivers/net/ipn3ke/ipn3ke_representor.c +4 -1
index fdb4b5c..0d527eb 100644
@@ -869,7 +869,7 @@ struct eth_dev_ops ipn3ke_rpst_dev_ops = {
 	.mac_addr_set         = ipn3ke_rpst_mac_addr_set,
 	.mtu_set              = ipn3ke_rpst_mtu_set,
 
-	.tm_ops_get           = NULL,
+	.tm_ops_get           = ipn3ke_tm_ops_get,
 };
 
 static uint16_t ipn3ke_rpst_recv_pkts(__rte_unused void *rx_q,
@@ -909,6 +909,9 @@ static uint16_t ipn3ke_rpst_recv_pkts(__rte_unused void *rx_q,
 		return -ENODEV;
 	}
 
+	if (rpst->hw->tm_hw_enable)
+		ipn3ke_tm_init(rpst);
+
 	/** representor shares the same driver as it's PF device */
 	/**
 	 * ethdev->device->driver = rpst->hw->eth_dev->device->driver;
drivers/net/ipn3ke/ipn3ke_tm.c new file +2086 -0

2,086 lines not on this page · raw message

drivers/net/ipn3ke/meson.build +2 -1
index 7ba4ca9..093ddbc 100644
@@ -3,5 +3,6 @@
 
 allow_experimental_apis = true
 sources += files('ipn3ke_ethdev.c',
-	'ipn3ke_representor.c')
+	'ipn3ke_representor.c',
+	'ipn3ke_tm.c')
 deps += ['bus_ifpga', 'sched']
Signature · 1 line
1.8.3.1
author
#99 lore raw

PATCH v5 6/14 drivers/net/ipn3ke: add IPN3KE Flow of PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE Flow of PMD driver.

---
 drivers/net/ipn3ke/Makefile             |    1 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c      |    6 +
 drivers/net/ipn3ke/ipn3ke_ethdev.h      |    1 +
 drivers/net/ipn3ke/ipn3ke_flow.c        | 1392 +++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h        |  106 +++
 drivers/net/ipn3ke/ipn3ke_representor.c |    3 +-
 drivers/net/ipn3ke/ipn3ke_tm.c          |    1 +
 drivers/net/ipn3ke/meson.build          |    3 +-
 8 files changed, 1511 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.h
drivers/net/ipn3ke/Makefile +1 -0
index 903ec39..aaffede 100644
@@ -34,5 +34,6 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_representor.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_tm.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_flow.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c +6 -0
index 55e83db..da3b069 100644
@@ -21,6 +21,7 @@
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
+#include "ipn3ke_flow.h"
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
@@ -318,6 +319,11 @@ static int ipn3ke_indirect_mac_write(struct ipn3ke_hw *hw,
 		if (ret)
 			return ret;
 		hw->tm_hw_enable = 1;
+
+		ret = ipn3ke_flow_init(hw);
+		if (ret)
+			return ret;
+		hw->flow_hw_enable = 1;
 	}
 
 	hw->acc_tm = 0;
drivers/net/ipn3ke/ipn3ke_ethdev.h +1 -0
index 95bc188..d6b93aa 100644
@@ -303,6 +303,7 @@ struct ipn3ke_hw {
 	uint32_t acc_tm;
 	uint32_t acc_flow;
 
+	struct ipn3ke_flow_list flow_list;
 	uint32_t flow_max_entries;
 	uint32_t flow_num_entries;
 
drivers/net/ipn3ke/ipn3ke_flow.c new file +1392 -0

1,392 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_flow.h new file +106 -0

106 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_representor.c +2 -1
index 0d527eb..2dd3035 100644
@@ -21,6 +21,7 @@
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
+#include "ipn3ke_flow.h"
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
@@ -813,7 +814,7 @@ static int ipn3ke_rpst_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 		case RTE_ETH_FILTER_GENERIC:
 			if (filter_op != RTE_ETH_FILTER_GET)
 				return -EINVAL;
-			*(const void **)arg = NULL;
+			*(const void **)arg = &ipn3ke_flow_ops;
 			break;
 		default:
 			IPN3KE_AFU_PMD_WARN("Filter type (%d) not supported",
drivers/net/ipn3ke/ipn3ke_tm.c +1 -0
index 54409ea..5dab6df 100644
@@ -23,6 +23,7 @@
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
+#include "ipn3ke_flow.h"
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
drivers/net/ipn3ke/meson.build +2 -1
index 093ddbc..c35e667 100644
@@ -4,5 +4,6 @@
 allow_experimental_apis = true
 sources += files('ipn3ke_ethdev.c',
 	'ipn3ke_representor.c',
-	'ipn3ke_tm.c')
+	'ipn3ke_tm.c',
+	'ipn3ke_flow.c')
 deps += ['bus_ifpga', 'sched']
Signature · 1 line
1.8.3.1
author
#100 lore raw

PATCH v5 7/14 raw/ifpga/base: clean up code for ifpga share code

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

clean up code:
1. use opae_memcpy instead of memcpy
2. use opae_memset instead of memset
3. disable opae_adapter_dump by default

---
 drivers/raw/ifpga_rawdev/base/ifpga_api.c               |  2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c       |  4 ++--
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c            |  2 +-
 drivers/raw/ifpga_rawdev/base/opae_debug.c              | 16 ++++++++--------
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c             |  2 +-
 drivers/raw/ifpga_rawdev/base/opae_osdep.h              |  1 +
 drivers/raw/ifpga_rawdev/base/osdep_raw/osdep_generic.h |  1 +
 drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h |  2 ++
 8 files changed, 17 insertions(+), 13 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +1 -1
index 540e171..77d9471 100644
@@ -202,7 +202,7 @@ static int ifpga_adapter_enumerate(struct opae_adapter *adapter)
 	struct ifpga_hw *hw = malloc(sizeof(*hw));
 
 	if (hw) {
-		memset(hw, 0, sizeof(*hw));
+		opae_memset(hw, 0, sizeof(*hw));
 		hw->pci_data = adapter->data;
 		hw->adapter = adapter;
 		if (ifpga_bus_enumerate(hw))
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -2
index be7ac9e..0a27c38 100644
@@ -77,8 +77,8 @@ int fpga_get_afu_uuid(struct ifpga_port_hw *port, struct uuid *uuid)
 	guidh = readq(&port_hdr->afu_header.guid.b[8]);
 	spinlock_unlock(&port->lock);
 
-	memcpy(uuid->b, &guidl, sizeof(u64));
-	memcpy(uuid->b + 8, &guidh, sizeof(u64));
+	opae_memcpy(uuid->b, &guidl, sizeof(u64));
+	opae_memcpy(uuid->b + 8, &guidh, sizeof(u64));
 
 	return 0;
 }
drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c +1 -1
index ec0beeb..8890f4b 100644
@@ -257,7 +257,7 @@ static int fme_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 		return -EINVAL;
 	}
 
-	memset(&info, 0, sizeof(struct fpga_pr_info));
+	opae_memset(&info, 0, sizeof(struct fpga_pr_info));
 	info.flags = FPGA_MGR_PARTIAL_RECONFIG;
 	info.port_id = port_id;
 
drivers/raw/ifpga_rawdev/base/opae_debug.c +8 -8
index 024d7d2..88f2d5c 100644
@@ -78,13 +78,13 @@ void opae_adapter_dump(struct opae_adapter *adapter, int verbose)
 {
 	struct opae_accelerator *acc;
 
-	opae_log("=====%s=====\n", __func__);
-	opae_log("OPAE Adapter %s\n", adapter->name);
-	opae_log("OPAE Adapter OPs = %p\n", adapter->ops);
-	opae_log("OPAE Adapter Private Data = %p\n", adapter->data);
-	opae_log("OPAE Manager (downstream) = %p\n", adapter->mgr);
-
 	if (verbose) {
+		opae_log("=====%s=====\n", __func__);
+		opae_log("OPAE Adapter %s\n", adapter->name);
+		opae_log("OPAE Adapter OPs = %p\n", adapter->ops);
+		opae_log("OPAE Adapter Private Data = %p\n", adapter->data);
+		opae_log("OPAE Manager (downstream) = %p\n", adapter->mgr);
+
 		if (adapter->mgr)
 			opae_manager_dump(adapter->mgr);
 
@@ -93,7 +93,7 @@ void opae_adapter_dump(struct opae_adapter *adapter, int verbose)
 
 		if (adapter->data)
 			opae_adapter_data_dump(adapter->data);
-	}
 
-	opae_log("==========================\n");
+		opae_log("==========================\n");
+	}
 }
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +1 -1
index 1541b67..41c5903 100644
@@ -341,7 +341,7 @@ int opae_adapter_enumerate(struct opae_adapter *adapter)
 		ret = adapter->ops->enumerate(adapter);
 
 	if (!ret)
-		opae_adapter_dump(adapter, 1);
+		opae_adapter_dump(adapter, 0);
 
 	return ret;
 }
drivers/raw/ifpga_rawdev/base/opae_osdep.h +1 -0
index 90f54f7..78fec50 100644
@@ -76,4 +76,5 @@ struct uuid {
 #define msleep(x) opae_udelay(1000 * (x))
 #define usleep_range(min, max) msleep(DIV_ROUND_UP(min, 1000))
 
+#define opae_memset(a, b, c)    memset((a), (b), (c))
 #endif
drivers/raw/ifpga_rawdev/base/osdep_raw/osdep_generic.h +1 -0
index 895a1d8..6769109 100644
@@ -71,5 +71,6 @@ static inline void opae_writeq(uint64_t value, volatile void *addr)
 }
 
 #define opae_free(addr) free(addr)
+#define opae_memcpy(a, b, c) memcpy((a), (b), (c))
 
 #endif
drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h +2 -0
index 76902e2..3d9a0ca 100644
@@ -11,6 +11,7 @@
 #include <rte_log.h>
 #include <rte_io.h>
 #include <rte_malloc.h>
+#include <rte_memcpy.h>
 
 #define dev_printf(level, fmt, args...) \
 	RTE_LOG(level, PMD, "osdep_rte: " fmt, ## args)
@@ -42,4 +43,5 @@
 #define spinlock_lock(x) rte_spinlock_lock(x)
 #define spinlock_unlock(x) rte_spinlock_unlock(x)
 
+#define opae_memcpy(a, b, c) rte_memcpy((a), (b), (c))
 #endif
Signature · 1 line
1.8.3.1
author
#101 lore raw

PATCH v5 8/14 raw/ifpga/base: store private features in FME and Port list

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

Get private features attrubite like size, id, address after enumeration, and insert into FEM or Port dedicate list.

when initial the private feature driver, we just compare the private feature id between the list and feature drivers array to match the proper drivers.

This patch avoid the hardcore in feature_info array in previous implementation. and the same time we can use one driver for mulitple devices which the id is the same.

---
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |  46 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   | 347 ++++++++--------------
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c | 160 +++++++---
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |  46 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         |  32 ++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |  16 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c        |  21 ++
 7 files changed, 363 insertions(+), 305 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +20 -26
index aa02527..217d0b1 100644
@@ -15,6 +15,7 @@
 #define FME_FEATURE_GLOBAL_IPERF    "fme_iperf"
 #define FME_FEATURE_GLOBAL_ERR      "fme_error"
 #define FME_FEATURE_PR_MGMT         "fme_pr"
+#define FME_FEATURE_EMIF_MGMT       "fme_emif"
 #define FME_FEATURE_HSSI_ETH        "fme_hssi"
 #define FME_FEATURE_GLOBAL_DPERF    "fme_dperf"
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
@@ -59,7 +60,8 @@
 #define FEATURE_FIU_ID_FME	0x0
 #define FEATURE_FIU_ID_PORT	0x1
 
-#define FEATURE_ID_HEADER	0x0
+/* Reserved 0xfe for Header, 0xff for AFU*/
+#define FEATURE_ID_FIU_HEADER	0xfe
 #define FEATURE_ID_AFU		0xff
 
 enum fpga_id_type {
@@ -68,31 +70,23 @@ enum fpga_id_type {
 	FPGA_ID_MAX,
 };
 
-enum fme_feature_id {
-	FME_FEATURE_ID_HEADER = 0x0,
-
-	FME_FEATURE_ID_THERMAL_MGMT	= 0x1,
-	FME_FEATURE_ID_POWER_MGMT = 0x2,
-	FME_FEATURE_ID_GLOBAL_IPERF = 0x3,
-	FME_FEATURE_ID_GLOBAL_ERR = 0x4,
-	FME_FEATURE_ID_PR_MGMT = 0x5,
-	FME_FEATURE_ID_HSSI_ETH = 0x6,
-	FME_FEATURE_ID_GLOBAL_DPERF = 0x7,
-	FME_FEATURE_ID_QSPI_FLASH = 0x8,
-
-	/* one for fme header. */
-	FME_FEATURE_ID_MAX = 0x9,
-};
-
-enum port_feature_id {
-	PORT_FEATURE_ID_HEADER = 0x0,
-	PORT_FEATURE_ID_ERROR = 0x1,
-	PORT_FEATURE_ID_UMSG = 0x2,
-	PORT_FEATURE_ID_UINT = 0x3,
-	PORT_FEATURE_ID_STP = 0x4,
-	PORT_FEATURE_ID_UAFU = 0x5,
-	PORT_FEATURE_ID_MAX = 0x6,
-};
+#define FME_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
+#define FME_FEATURE_ID_THERMAL_MGMT 0x1
+#define FME_FEATURE_ID_POWER_MGMT 0x2
+#define FME_FEATURE_ID_GLOBAL_IPERF 0x3
+#define FME_FEATURE_ID_GLOBAL_ERR 0x4
+#define FME_FEATURE_ID_PR_MGMT 0x5
+#define FME_FEATURE_ID_HSSI_ETH 0x6
+#define FME_FEATURE_ID_GLOBAL_DPERF 0x7
+#define FME_FEATURE_ID_QSPI_FLASH 0x8
+#define FME_FEATURE_ID_EMIF_MGMT  0x9
+
+#define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
+#define PORT_FEATURE_ID_ERROR 0x10
+#define PORT_FEATURE_ID_UMSG 0x12
+#define PORT_FEATURE_ID_UINT 0x13
+#define PORT_FEATURE_ID_STP 0x14
+#define PORT_FEATURE_ID_UAFU FEATURE_ID_AFU
 
 /*
  * All headers and structures must be byte-packed to match the spec.
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +122 -225

546 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +116 -44

199 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +38 -8

92 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme.c +32 -0
index 4be60c0..9451086 100644
@@ -732,3 +732,35 @@ struct feature_ops fme_power_mgmt_ops = {
 	.get_prop = fme_power_mgmt_get_prop,
 	.set_prop = fme_power_mgmt_set_prop,
 };
+
+static int fme_hssi_eth_init(struct feature *feature)
+{
+	UNUSED(feature);
+	return 0;
+}
+
+static void fme_hssi_eth_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+}
+
+struct feature_ops fme_hssi_eth_ops = {
+	.init = fme_hssi_eth_init,
+	.uinit = fme_hssi_eth_uinit,
+};
+
+static int fme_emif_init(struct feature *feature)
+{
+	UNUSED(feature);
+	return 0;
+}
+
+static void fme_emif_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+}
+
+struct feature_ops fme_emif_ops = {
+	.init = fme_emif_init,
+	.uinit = fme_emif_uinit,
+};
drivers/raw/ifpga_rawdev/base/ifpga_hw.h +14 -2
index a20520c..8aaa056 100644
@@ -8,18 +8,28 @@
 #include "ifpga_defines.h"
 #include "opae_ifpga_hw_api.h"
 
+/** List of private feateues */
+TAILQ_HEAD(ifpga_feature_list, feature);
+
 enum ifpga_feature_state {
 	IFPGA_FEATURE_UNUSED = 0,
 	IFPGA_FEATURE_ATTACHED,
 };
 
+enum feature_type {
+	FEATURE_FME_TYPE = 0,
+	FEATURE_PORT_TYPE,
+};
+
 struct feature_irq_ctx {
 	int eventfd;
 	int idx;
 };
 
 struct feature {
+	TAILQ_ENTRY(feature)next;
 	enum ifpga_feature_state state;
+	enum feature_type type;
 	const char *name;
 	u64 id;
 	u8 *addr;
@@ -34,6 +44,8 @@ struct feature {
 	void *parent;		/* to parent hw data structure */
 
 	struct feature_ops *ops;/* callback to this private feature */
+	unsigned int vec_start;
+	unsigned int vec_cnt;
 };
 
 struct feature_ops {
@@ -52,7 +64,7 @@ enum ifpga_fme_state {
 struct ifpga_fme_hw {
 	enum ifpga_fme_state state;
 
-	struct feature sub_feature[FME_FEATURE_ID_MAX];
+	struct ifpga_feature_list feature_list;
 	spinlock_t lock;	/* protect hardware access */
 
 	void *parent;		/* pointer to ifpga_hw */
@@ -78,7 +90,7 @@ enum ifpga_port_state {
 struct ifpga_port_hw {
 	enum ifpga_port_state state;
 
-	struct feature sub_feature[PORT_FEATURE_ID_MAX];
+	struct ifpga_feature_list feature_list;
 	spinlock_t lock;	/* protect access to hw */
 
 	void *parent;		/* pointer to ifpga_hw */
drivers/raw/ifpga_rawdev/base/ifpga_port.c +21 -0
index 8b5668d..4628783 100644
@@ -386,3 +386,24 @@ struct feature_ops ifpga_rawdev_port_uint_ops = {
 	.init = port_uint_init,
 	.uinit = port_uint_uinit,
 };
+
+static int port_afu_init(struct feature *feature)
+{
+	UNUSED(feature);
+
+	dev_info(NULL, "PORT AFU Init.\n");
+
+	return 0;
+}
+
+static void port_afu_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+
+	dev_info(NULL, "PORT AFU UInit.\n");
+}
+
+struct feature_ops ifpga_rawdev_port_afu_ops = {
+	.init = port_afu_init,
+	.uinit = port_afu_uinit,
+};
Signature · 1 line
1.8.3.1
author
#102 lore raw

PATCH v5 9/14 raw/ifpga/base: add SPI and MAX10 device driver

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

There is a SPI bus link between A10 FPGA and MAX10 FPGA. MAX10 is in charge of board management, like power management, sensors, flash devices.

---
 drivers/raw/ifpga_rawdev/base/Makefile             |   3 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |   5 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  |   4 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          | 196 +++++++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |   2 +
 drivers/raw/ifpga_rawdev/base/meson.build          |   5 +-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |   1 +
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   |  88 +++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |  60 +++
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |   4 +
 drivers/raw/ifpga_rawdev/base/opae_spi.c           | 304 ++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           | 160 ++++++++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   | 438 +++++++++++++++++++++
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |  14 +
 15 files changed, 1285 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c
drivers/raw/ifpga_rawdev/base/Makefile +3 -0
index d79da72..c6f51a8 100644
@@ -22,5 +22,8 @@ SRCS-y += opae_hw_api.c
 SRCS-y += opae_ifpga_hw_api.c
 SRCS-y += opae_debug.c
 SRCS-y += ifpga_fme_pr.c
+SRCS-y += opae_spi.c
+SRCS-y += opae_spi_transaction.c
+SRCS-y += opae_intel_max10.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +5 -0
index 217d0b1..f5e22ae 100644
@@ -19,6 +19,8 @@
 #define FME_FEATURE_HSSI_ETH        "fme_hssi"
 #define FME_FEATURE_GLOBAL_DPERF    "fme_dperf"
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
+#define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
+#define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -43,6 +45,7 @@
 #define FME_HSSI_ETH_REVISION		0
 #define FME_GLOBAL_DPERF_REVISION	0
 #define FME_QSPI_REVISION		0
+#define FME_MAX10_SPI                   0
 
 #define PORT_HEADER_REVISION		0
 /* UAFU's header info depends on the downloaded GBS */
@@ -80,6 +83,8 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_GLOBAL_DPERF 0x7
 #define FME_FEATURE_ID_QSPI_FLASH 0x8
 #define FME_FEATURE_ID_EMIF_MGMT  0x9
+#define FME_FEATURE_ID_MAX10_SPI  0xe
+#define FME_FEATURE_ID_NIOS_SPI 0xd
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +4 -0
index d82a890..2a35c06 100644
@@ -197,6 +197,10 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_hssi_eth_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_EMIF_MGMT, FME_FEATURE_EMIF_MGMT,
 	&fme_emif_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_MAX10_SPI, FME_FEATURE_MAX10_SPI,
+	&fme_spi_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_NIOS_SPI, FME_FEATURE_NIOS_SPI,
+	&fme_nios_spi_master_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +2 -0
index 1d80f1d..72352ee 100644
@@ -171,6 +171,8 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_global_dperf_ops;
 extern struct feature_ops fme_hssi_eth_ops;
 extern struct feature_ops fme_emif_ops;
+extern struct feature_ops fme_spi_master_ops;
+extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
 int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +196 -0

205 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +2 -0
index 8aaa056..a2f4776 100644
@@ -79,6 +79,8 @@ struct ifpga_fme_hw {
 	u32 cache_size;
 
 	u32 capability;
+
+	void *max10_dev; /* MAX10 device */
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +4 -1
index 03f5112..6bc762f 100644
@@ -14,7 +14,10 @@ sources = [
 	'ifpga_fme_pr.c',
 	'opae_hw_api.c',
 	'opae_ifpga_hw_api.c',
-	'opae_debug.c'
+	'opae_debug.c',
+	'opae_spi.c',
+	'opae_spi_transaction.c',
+	'opae_intel_max10.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_hw_api.h +1 -0
index 332e0f3..76224b4 100644
@@ -11,6 +11,7 @@
 #include <sys/queue.h>
 
 #include "opae_osdep.h"
+#include "opae_intel_max10.h"
 
 #ifndef PCI_MAX_RESOURCE
 #define PCI_MAX_RESOURCE 6
drivers/raw/ifpga_rawdev/base/opae_intel_max10.c new file +88 -0

88 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_intel_max10.h new file +60 -0

60 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_osdep.h +4 -0
index 78fec50..d710ec0 100644
@@ -35,6 +35,7 @@ struct uuid {
 #ifndef BIT
 #define BIT(a) (1UL << (a))
 #endif /* BIT */
+#define U64_C(x) x ## ULL
 #ifndef BIT_ULL
 #define BIT_ULL(a) (1ULL << (a))
 #endif /* BIT_ULL */
@@ -76,5 +77,8 @@ struct uuid {
 #define msleep(x) opae_udelay(1000 * (x))
 #define usleep_range(min, max) msleep(DIV_ROUND_UP(min, 1000))
 
+#define time_after(a, b)	((long)((b) - (a)) < 0)
+#define time_before(a, b)	time_after(b, a)
 #define opae_memset(a, b, c)    memset((a), (b), (c))
+
 #endif
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +304 -0

304 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_spi.h new file +160 -0

160 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +438 -0

438 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h +14 -0
index 3d9a0ca..3ff49a8 100644
@@ -11,6 +11,7 @@
 #include <rte_log.h>
 #include <rte_io.h>
 #include <rte_malloc.h>
+#include <rte_byteorder.h>
 #include <rte_memcpy.h>
 
 #define dev_printf(level, fmt, args...) \
@@ -43,5 +44,18 @@
 #define spinlock_lock(x) rte_spinlock_lock(x)
 #define spinlock_unlock(x) rte_spinlock_unlock(x)
 
+#define cpu_to_be16(o) rte_cpu_to_be_16(o)
+#define cpu_to_be32(o) rte_cpu_to_be_32(o)
+#define cpu_to_be64(o) rte_cpu_to_be_64(o)
+#define cpu_to_le16(o) rte_cpu_to_le_16(o)
+#define cpu_to_le32(o) rte_cpu_to_le_32(o)
+#define cpu_to_le64(o) rte_cpu_to_le_64(o)
+
 #define opae_memcpy(a, b, c) rte_memcpy((a), (b), (c))
+
+static inline unsigned long msecs_to_timer_cycles(unsigned int m)
+{
+	return rte_get_timer_hz() * (m / 1000);
+}
+
 #endif
Signature · 1 line
1.8.3.1
author
#103 lore raw

PATCH v5 10/14 raw/ifpga/base: add I2C and at24 EEPROM driver

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

1. Add Altera I2C master device driver
2. Add at24 eeprom driver which is i2c slave device
3. Introducing a new ops for opae_manager: opae_manager_networking_ops. This ops will include some networking operation by FPGA, like vBNG operation, MAC ROM operation and so on.

---
 drivers/raw/ifpga_rawdev/base/Makefile            |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c         |  22 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.h         |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |   3 +
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |   2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |   7 +
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         |  90 ++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |   1 +
 drivers/raw/ifpga_rawdev/base/meson.build         |   2 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c  |  88 ++++
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h  |  14 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c       |  49 ++-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h       |  26 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c          | 490 ++++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h          | 130 ++++++
 16 files changed, 926 insertions(+), 3 deletions(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.h
drivers/raw/ifpga_rawdev/base/Makefile +2 -0
index c6f51a8..edb538f 100644
@@ -25,5 +25,7 @@ SRCS-y += ifpga_fme_pr.c
 SRCS-y += opae_spi.c
 SRCS-y += opae_spi_transaction.c
 SRCS-y += opae_intel_max10.c
+SRCS-y += opae_i2c.c
+SRCS-y += opae_at24_eeprom.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +22 -0
index 77d9471..c447b3c 100644
@@ -196,6 +196,28 @@ struct opae_manager_ops ifpga_mgr_ops = {
 	.flash = ifpga_mgr_flash,
 };
 
+static int ifpga_mgr_read_mac_rom(struct opae_manager *mgr, int offset,
+		void *buf, int size)
+{
+	struct ifpga_fme_hw *fme = mgr->data;
+
+	return fme_mgr_read_mac_rom(fme, offset, buf, size);
+}
+
+static int ifpga_mgr_write_mac_rom(struct opae_manager *mgr, int offset,
+		void *buf, int size)
+{
+	struct ifpga_fme_hw *fme = mgr->data;
+
+	return fme_mgr_write_mac_rom(fme, offset, buf, size);
+}
+
+/* Network APIs in FME */
+struct opae_manager_networking_ops ifpga_mgr_network_ops = {
+	.read_mac_rom = ifpga_mgr_read_mac_rom,
+	.write_mac_rom = ifpga_mgr_write_mac_rom,
+};
+
 /* Adapter APIs */
 static int ifpga_adapter_enumerate(struct opae_adapter *adapter)
 {
drivers/raw/ifpga_rawdev/base/ifpga_api.h +1 -0
index dae7ca1..4a24769 100644
@@ -12,6 +12,7 @@
 extern struct opae_manager_ops ifpga_mgr_ops;
 extern struct opae_bridge_ops ifpga_br_ops;
 extern struct opae_accelerator_ops ifpga_acc_ops;
+extern struct opae_manager_networking_ops ifpga_mgr_network_ops;
 
 /* common APIs */
 int ifpga_get_prop(struct ifpga_hw *hw, u32 fiu_id, u32 port_id,
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +3 -0
index f5e22ae..62f71c7 100644
@@ -21,6 +21,7 @@
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
 #define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
 #define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
+#define FME_FEATURE_I2C_MASTER      "fme_i2c_master"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -46,6 +47,7 @@
 #define FME_GLOBAL_DPERF_REVISION	0
 #define FME_QSPI_REVISION		0
 #define FME_MAX10_SPI                   0
+#define FME_I2C_MASTER                  0
 
 #define PORT_HEADER_REVISION		0
 /* UAFU's header info depends on the downloaded GBS */
@@ -85,6 +87,7 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_EMIF_MGMT  0x9
 #define FME_FEATURE_ID_MAX10_SPI  0xe
 #define FME_FEATURE_ID_NIOS_SPI 0xd
+#define FME_FEATURE_ID_I2C_MASTER  0xf
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +1 -1
index c779e0c..666dae1 100644
@@ -270,7 +270,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 
 	} else if (binfo->current_type == FME_ID) {
 		mgr = opae_manager_alloc(hw->adapter->name, &ifpga_mgr_ops,
-				binfo->fiu);
+				&ifpga_mgr_network_ops, binfo->fiu);
 		if (!mgr)
 			return -ENOMEM;
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -0
index 2a35c06..0454f80 100644
@@ -201,6 +201,8 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_spi_master_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_NIOS_SPI, FME_FEATURE_NIOS_SPI,
 	&fme_nios_spi_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_I2C_MASTER, FME_FEATURE_I2C_MASTER,
+	&fme_i2c_master_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +7 -0
index 72352ee..a398a98 100644
@@ -172,6 +172,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_hssi_eth_ops;
 extern struct feature_ops fme_emif_ops;
 extern struct feature_ops fme_spi_master_ops;
+extern struct feature_ops fme_i2c_master_ops;
 extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
@@ -197,4 +198,10 @@ struct fpga_uafu_irq_set {
 /* help functions for feature ops */
 int fpga_msix_set_block(struct feature *feature, unsigned int start,
 			unsigned int count, s32 *fds);
+
+/* FME network function ops*/
+int fme_mgr_read_mac_rom(struct ifpga_fme_hw *fme, int offset,
+		void *buf, int size);
+int fme_mgr_write_mac_rom(struct ifpga_fme_hw *fme, int offset,
+		void *buf, int size);
 #endif /* _IFPGA_FEATURE_DEV_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +90 -0

99 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +1 -0
index a2f4776..e296dd2 100644
@@ -81,6 +81,7 @@ struct ifpga_fme_hw {
 	u32 capability;
 
 	void *max10_dev; /* MAX10 device */
+	void *i2c_master; /* I2C Master device */
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +2 -0
index 6bc762f..7655985 100644
@@ -18,6 +18,8 @@ sources = [
 	'opae_spi.c',
 	'opae_spi_transaction.c',
 	'opae_intel_max10.c',
+	'opae_i2c.c',
+	'opae_at24_eeprom.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c new file +88 -0

88 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h new file +14 -0
new file mode 100644
index 0000000..caae9a3
@@ -0,0 +1,14 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#define AT24C512_PAGE_SIZE 128
+#define AT24C512_IO_LIMIT  128
+
+#define AT24512_SLAVE_ADDR 0x51
+
+int at24_eeprom_read(struct altera_i2c_dev *dev, unsigned int slave_addr,
+		u32 offset, u8 *buf, int count);
+int at24_eeprom_write(struct altera_i2c_dev *dev, unsigned int slave_addr,
+		u32 offset, u8 *buf, int count);
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +48 -1

69 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.h +25 -1
index 76224b4..826da37 100644
@@ -26,6 +26,7 @@ enum opae_adapter_type {
 
 /* OPAE Manager Data Structure */
 struct opae_manager_ops;
+struct opae_manager_networking_ops;
 
 /*
  * opae_manager has pointer to its parent adapter, as it could be able to manage
@@ -36,6 +37,7 @@ struct opae_manager {
 	const char *name;
 	struct opae_adapter *adapter;
 	struct opae_manager_ops *ops;
+	struct opae_manager_networking_ops *network_ops;
 	void *data;
 };
 
@@ -45,9 +47,18 @@ struct opae_manager_ops {
 		     u32 size, u64 *status);
 };
 
+/* networking management ops in FME */
+struct opae_manager_networking_ops {
+	int (*read_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
+			int size);
+	int (*write_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
+			int size);
+};
+
 /* OPAE Manager APIs */
 struct opae_manager *
-opae_manager_alloc(const char *name, struct opae_manager_ops *ops, void *data);
+opae_manager_alloc(const char *name, struct opae_manager_ops *ops,
+		struct opae_manager_networking_ops *network_ops, void *data);
 #define opae_manager_free(mgr) opae_free(mgr)
 int opae_manager_flash(struct opae_manager *mgr, int acc_id, void *buf,
 		       u32 size, u64 *status);
@@ -252,4 +263,17 @@ static inline void opae_adapter_remove_acc(struct opae_adapter *adapter,
 {
 	TAILQ_REMOVE(&adapter->acc_list, acc, node);
 }
+
+/* OPAE vBNG network datastruct */
+#define OPAE_ETHER_ADDR_LEN 6
+
+struct opae_ether_addr {
+	unsigned char addr_bytes[OPAE_ETHER_ADDR_LEN];
+} __attribute__((__packed__));
+
+/* OPAE vBNG network API*/
+int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
+		struct opae_ether_addr *addr);
+int opae_manager_write_mac_rom(struct opae_manager *mgr, int port,
+		struct opae_ether_addr *addr);
 #endif /* _OPAE_HW_API_H_*/
drivers/raw/ifpga_rawdev/base/opae_i2c.c new file +490 -0

490 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_i2c.h new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author
#104 lore raw

PATCH v5 11/14 raw/ifpga/base: add eth group driver

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

There is two eth group devices in PAC N3000 card, each eth group include PHY device and MAC device. Exposing APIs for DPDK PMD driver to access those devices.

---
 drivers/raw/ifpga_rawdev/base/Makefile            |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c         |  74 ++++++-
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |  39 ++++
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |   6 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |  12 ++
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         | 250 ++++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |   7 +
 drivers/raw/ifpga_rawdev/base/meson.build         |   1 +
 drivers/raw/ifpga_rawdev/base/opae_eth_group.c    | 145 +++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_eth_group.h    |  96 +++++++++
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c       | 149 +++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h       |  27 +++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h  |  42 +++-
 drivers/raw/ifpga_rawdev/base/opae_osdep.h        |  16 +-
 15 files changed, 858 insertions(+), 9 deletions(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.h
drivers/raw/ifpga_rawdev/base/Makefile +1 -0
index edb538f..c5bbcbd 100644
@@ -27,5 +27,6 @@ SRCS-y += opae_spi_transaction.c
 SRCS-y += opae_intel_max10.c
 SRCS-y += opae_i2c.c
 SRCS-y += opae_at24_eeprom.c
+SRCS-y += opae_eth_group.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +73 -1

98 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_defines.h +39 -0
index 62f71c7..b7151ca 100644
@@ -22,6 +22,7 @@
 #define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
 #define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
 #define FME_FEATURE_I2C_MASTER      "fme_i2c_master"
+#define FME_FEATURE_ETH_GROUP       "fme_eth_group"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -88,6 +89,7 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_MAX10_SPI  0xe
 #define FME_FEATURE_ID_NIOS_SPI 0xd
 #define FME_FEATURE_ID_I2C_MASTER  0xf
+#define FME_FEATURE_ID_ETH_GROUP 0x10
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
@@ -1661,5 +1663,42 @@ struct bts_header {
 	(((bts_hdr)->guid_h == GBS_GUID_H) &&		\
 	((bts_hdr)->guid_l == GBS_GUID_L))
 
+/* bitstream id definition */
+struct fme_bitstream_id {
+	union {
+		u64 id;
+		struct {
+			u64 hash:32;
+			u64 interface:4;
+			u64 reserved:12;
+			u64 debug:4;
+			u64 patch:4;
+			u64 minor:4;
+			u64 major:4;
+		};
+	};
+};
+
+enum board_interface {
+	VC_8_10G = 0,
+	VC_4_25G = 1,
+	VC_2_1_25 = 2,
+	VC_4_25G_2_25G = 3,
+	VC_2_2_25G = 4,
+};
+
+struct ifpga_fme_board_info {
+	enum board_interface type;
+	u32 build_hash;
+	u32 debug_version;
+	u32 patch_version;
+	u32 minor_version;
+	u32 major_version;
+	u32 nums_of_retimer;
+	u32 ports_per_retimer;
+	u32 nums_of_fvl;
+	u32 ports_per_fvl;
+};
+
 #pragma pack(pop)
 #endif /* _BASE_IFPGA_DEFINES_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +6 -0
index 666dae1..44086c1 100644
@@ -232,6 +232,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 	struct opae_bridge *br;
 	struct opae_accelerator *acc;
 	struct ifpga_port_hw *port;
+	struct ifpga_fme_hw *fme;
 	struct feature *feature;
 
 	if (!binfo->fiu)
@@ -264,8 +265,13 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 		}
 
 		acc->br = br;
+		if (hw->adapter->mgr)
+			acc->mgr = hw->adapter->mgr;
 		acc->index = br->id;
 
+		fme = &hw->fme;
+		fme->nums_acc_region = info->num_regions;
+
 		opae_adapter_add_acc(hw->adapter, acc);
 
 	} else if (binfo->current_type == FME_ID) {
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -0
index 0454f80..5ebc449 100644
@@ -203,6 +203,8 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_nios_spi_master_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_I2C_MASTER, FME_FEATURE_I2C_MASTER,
 	&fme_i2c_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_ETH_GROUP, FME_FEATURE_ETH_GROUP,
+	&fme_eth_group_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +12 -0
index a398a98..3f63f5a 100644
@@ -173,6 +173,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_emif_ops;
 extern struct feature_ops fme_spi_master_ops;
 extern struct feature_ops fme_i2c_master_ops;
+extern struct feature_ops fme_eth_group_ops;
 extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
@@ -204,4 +205,15 @@ int fme_mgr_read_mac_rom(struct ifpga_fme_hw *fme, int offset,
 		void *buf, int size);
 int fme_mgr_write_mac_rom(struct ifpga_fme_hw *fme, int offset,
 		void *buf, int size);
+int fme_mgr_get_eth_group_nums(struct ifpga_fme_hw *fme);
+int fme_mgr_get_eth_group_info(struct ifpga_fme_hw *fme,
+		u8 group_id, struct opae_eth_group_info *info);
+int fme_mgr_eth_group_read_reg(struct ifpga_fme_hw *fme, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 *data);
+int fme_mgr_eth_group_write_reg(struct ifpga_fme_hw *fme, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 data);
+int fme_mgr_get_retimer_info(struct ifpga_fme_hw *fme,
+		struct opae_retimer_info *info);
+int fme_mgr_get_retimer_status(struct ifpga_fme_hw *fme,
+		struct opae_retimer_status *status);
 #endif /* _IFPGA_FEATURE_DEV_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +250 -0

271 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +7 -0
index e296dd2..a428d69 100644
@@ -7,6 +7,7 @@
 
 #include "ifpga_defines.h"
 #include "opae_ifpga_hw_api.h"
+#include "opae_eth_group.h"
 
 /** List of private feateues */
 TAILQ_HEAD(ifpga_feature_list, feature);
@@ -82,6 +83,12 @@ struct ifpga_fme_hw {
 
 	void *max10_dev; /* MAX10 device */
 	void *i2c_master; /* I2C Master device */
+	void *eth_dev[MAX_ETH_GROUP_DEVICES];
+	struct opae_reg_region
+		eth_group_region[MAX_ETH_GROUP_DEVICES];
+	struct ifpga_fme_board_info board_info;
+	int nums_eth_dev;
+	unsigned int nums_acc_region;
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +1 -0
index 7655985..f1015bb 100644
@@ -20,6 +20,7 @@ sources = [
 	'opae_intel_max10.c',
 	'opae_i2c.c',
 	'opae_at24_eeprom.c',
+	'opae_eth_group.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_eth_group.c new file +145 -0

145 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_eth_group.h new file +96 -0

96 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.c +149 -0

152 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.h +27 -0
index 826da37..383e751 100644
@@ -12,6 +12,7 @@
 
 #include "opae_osdep.h"
 #include "opae_intel_max10.h"
+#include "opae_eth_group.h"
 
 #ifndef PCI_MAX_RESOURCE
 #define PCI_MAX_RESOURCE 6
@@ -45,6 +46,8 @@ struct opae_manager {
 struct opae_manager_ops {
 	int (*flash)(struct opae_manager *mgr, int id, void *buffer,
 		     u32 size, u64 *status);
+	int (*get_eth_group_region_info)(struct opae_manager *mgr,
+			struct opae_eth_group_region_info *info);
 };
 
 /* networking management ops in FME */
@@ -53,6 +56,17 @@ struct opae_manager_networking_ops {
 			int size);
 	int (*write_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
 			int size);
+	int (*get_eth_group_nums)(struct opae_manager *mgr);
+	int (*get_eth_group_info)(struct opae_manager *mgr,
+			u8 group_id, struct opae_eth_group_info *info);
+	int (*eth_group_reg_read)(struct opae_manager *mgr, u8 group_id,
+			u8 type, u8 index, u16 addr, u32 *data);
+	int (*eth_group_reg_write)(struct opae_manager *mgr, u8 group_id,
+			u8 type, u8 index, u16 addr, u32 data);
+	int (*get_retimer_info)(struct opae_manager *mgr,
+			struct opae_retimer_info *info);
+	int (*get_retimer_status)(struct opae_manager *mgr,
+			struct opae_retimer_status *status);
 };
 
 /* OPAE Manager APIs */
@@ -62,6 +76,8 @@ struct opae_manager *
 #define opae_manager_free(mgr) opae_free(mgr)
 int opae_manager_flash(struct opae_manager *mgr, int acc_id, void *buf,
 		       u32 size, u64 *status);
+int opae_manager_get_eth_group_region_info(struct opae_manager *mgr,
+		u8 group_id, struct opae_eth_group_region_info *info);
 
 /* OPAE Bridge Data Structure */
 struct opae_bridge_ops;
@@ -276,4 +292,15 @@ int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
 		struct opae_ether_addr *addr);
 int opae_manager_write_mac_rom(struct opae_manager *mgr, int port,
 		struct opae_ether_addr *addr);
+int opae_manager_get_retimer_info(struct opae_manager *mgr,
+		struct opae_retimer_info *info);
+int opae_manager_get_retimer_status(struct opae_manager *mgr,
+		struct opae_retimer_status *status);
+int opae_manager_get_eth_group_nums(struct opae_manager *mgr);
+int opae_manager_get_eth_group_info(struct opae_manager *mgr,
+		u8 group_id, struct opae_eth_group_info *info);
+int opae_manager_eth_group_write_reg(struct opae_manager *mgr, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 data);
+int opae_manager_eth_group_read_reg(struct opae_manager *mgr, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 *data);
 #endif /* _OPAE_HW_API_H_*/
drivers/raw/ifpga_rawdev/base/opae_intel_max10.h +39 -3

54 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_osdep.h +11 -5
index d710ec0..1596adc 100644
@@ -53,12 +53,7 @@ struct uuid {
 #define dev_err(x, args...) dev_printf(ERR, args)
 #define dev_info(x, args...) dev_printf(INFO, args)
 #define dev_warn(x, args...) dev_printf(WARNING, args)
-
-#ifdef OPAE_DEBUG
 #define dev_debug(x, args...) dev_printf(DEBUG, args)
-#else
-#define dev_debug(x, args...) do { } while (0)
-#endif
 
 #define pr_err(y, args...) dev_err(0, y, ##args)
 #define pr_warn(y, args...) dev_warn(0, y, ##args)
@@ -81,4 +76,15 @@ struct uuid {
 #define time_before(a, b)	time_after(b, a)
 #define opae_memset(a, b, c)    memset((a), (b), (c))
 
+#define opae_readq_poll_timeout(addr, val, cond, invl, timeout)\
+({									     \
+	int wait = 0;							     \
+	for (; wait <= timeout; wait += invl) {			     \
+		(val) = opae_readq(addr);				     \
+		if (cond)                  \
+			break;						     \
+		udelay(invl);						     \
+	}								     \
+	(cond) ? 0 : -ETIMEDOUT;	  \
+})
 #endif
Signature · 1 line
1.8.3.1
author
#105 lore raw

PATCH v5 12/14 raw/ifpga/base: add version description on README

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

add verion description on READ about ifpga base code.

---
 drivers/raw/ifpga_rawdev/base/README | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/raw/ifpga_rawdev/base/README +15 -0
index 5bc2ed0..6b2b171 100644
@@ -29,3 +29,18 @@ the following file(s):
 
 	osdep_raw/osdep_generic.h
 	osdep_rte/osdep_generic.h
+
+
+New Features
+==================
+
+2019-03:
+Support Intel FPGA PAC N3000 card.
+Some features added in this version:
+1. Store private features in FME and Port list.
+2. Add eth group devices driver.
+3. Add altera SPI master driver and Intel MAX10 device driver.
+4. Add Altera I2C master driver and AT24 eeprom driver.
+5. Add Device Tree support to get the configuration from card.
+6. Instruding and exposing APIs to DPDK PMD driver to access networking
+functionality.
Signature · 1 line
1.8.3.1
author
#106 lore raw

PATCH v5 13/14 raw/ifpga/base: using prefix name "ifpga_" for feature and feature_ops data struct

In reply to Rosen Xu

From: "Zhang, Tianfei" <[email protected]>

Using prefix name "ifpga_" for feature and feature_ops data struct on ifpga base code, which is suggested by Yigit, Ferruh.

---
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |  8 +--
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |  4 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h | 58 ++++++++++---------
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         | 70 +++++++++++------------
 drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c   | 16 +++---
 drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c   | 18 +++---
 drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c   | 28 ++++-----
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c      |  6 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          | 22 +++----
 drivers/raw/ifpga_rawdev/base/ifpga_port.c        | 36 ++++++------
 drivers/raw/ifpga_rawdev/base/ifpga_port_error.c  | 10 ++--
 11 files changed, 141 insertions(+), 135 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +4 -4
index 44086c1..b8846e3 100644
@@ -73,7 +73,7 @@ static u64 feature_id(void __iomem *start)
 		unsigned int vec_cnt)
 {
 	struct ifpga_hw *hw = binfo->hw;
-	struct feature *feature = NULL;
+	struct ifpga_feature *feature = NULL;
 	struct feature_irq_ctx *ctx = NULL;
 	int port_id, ret = 0;
 	unsigned int i;
@@ -81,7 +81,7 @@ static u64 feature_id(void __iomem *start)
 	fid = fid?fid:feature_id(start);
 	size = size?size:feature_size(start);
 
-	feature = opae_malloc(sizeof(struct feature));
+	feature = opae_malloc(sizeof(struct ifpga_feature));
 	if (!feature)
 		return -ENOMEM;
 
@@ -233,7 +233,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 	struct opae_accelerator *acc;
 	struct ifpga_port_hw *port;
 	struct ifpga_fme_hw *fme;
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!binfo->fiu)
 		return 0;
@@ -645,7 +645,7 @@ static void ifpga_print_device_feature_list(struct ifpga_hw *hw)
 {
 	struct ifpga_fme_hw *fme = &hw->fme;
 	struct ifpga_port_hw *port;
-	struct feature *feature;
+	struct ifpga_feature *feature;
 	int i;
 
 	dev_info(hw, "found fme_device, is in PF: %s\n",
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -2
index 5ebc449..63c8bcc 100644
@@ -252,7 +252,7 @@ const char *get_port_feature_name(unsigned int id)
 
 static void feature_uinit(struct ifpga_feature_list *list)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	TAILQ_FOREACH(feature, list, next) {
 		if (feature->state != IFPGA_FEATURE_ATTACHED)
@@ -265,7 +265,7 @@ static void feature_uinit(struct ifpga_feature_list *list)
 static int feature_init(struct feature_driver *drv,
 		struct ifpga_feature_list *list)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 	int ret;
 
 	while (drv->ops) {
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +30 -28

114 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme.c +35 -35

268 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c +8 -8
index 1773b87..954f8a8 100644
@@ -183,7 +183,7 @@ static int fme_dperf_set_fab_freeze(struct ifpga_fme_hw *fme, u64 freeze)
 
 #define PERF_MAX_PORT_NUM	1
 
-static int fme_global_dperf_init(struct feature *feature)
+static int fme_global_dperf_init(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
@@ -192,14 +192,14 @@ static int fme_global_dperf_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_dperf_uinit(struct feature *feature)
+static void fme_global_dperf_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME global_dperf UInit.\n");
 }
 
-static int fme_dperf_fab_get_prop(struct feature *feature,
+static int fme_dperf_fab_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -225,7 +225,7 @@ static int fme_dperf_fab_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_dperf_root_get_prop(struct feature *feature,
+static int fme_dperf_root_get_prop(struct ifpga_feature *feature,
 				   struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -245,7 +245,7 @@ static int fme_dperf_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_dperf_get_prop(struct feature *feature,
+static int fme_global_dperf_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -260,7 +260,7 @@ static int fme_global_dperf_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_dperf_fab_set_prop(struct feature *feature,
+static int fme_dperf_fab_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -279,7 +279,7 @@ static int fme_dperf_fab_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_dperf_set_prop(struct feature *feature,
+static int fme_global_dperf_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -292,7 +292,7 @@ static int fme_global_dperf_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_dperf_ops = {
+struct ifpga_feature_ops fme_global_dperf_ops = {
 	.init = fme_global_dperf_init,
 	.uinit = fme_global_dperf_uinit,
 	.get_prop = fme_global_dperf_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c +9 -9
index 8c26fb2..3794564 100644
@@ -240,7 +240,7 @@ static void fme_error_enable(struct ifpga_fme_hw *fme)
 	writeq(0UL, &fme_err->ras_catfat_mask);
 }
 
-static int fme_global_error_init(struct feature *feature)
+static int fme_global_error_init(struct ifpga_feature *feature)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
 
@@ -252,12 +252,12 @@ static int fme_global_error_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_error_uinit(struct feature *feature)
+static void fme_global_error_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 }
 
-static int fme_err_fme_err_get_prop(struct feature *feature,
+static int fme_err_fme_err_get_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -275,7 +275,7 @@ static int fme_err_fme_err_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_root_get_prop(struct feature *feature,
+static int fme_err_root_get_prop(struct ifpga_feature *feature,
 				 struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -301,7 +301,7 @@ static int fme_err_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_error_get_prop(struct feature *feature,
+static int fme_global_error_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -321,7 +321,7 @@ static int fme_global_error_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_fme_err_set_prop(struct feature *feature,
+static int fme_err_fme_err_set_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -335,7 +335,7 @@ static int fme_err_fme_err_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_root_set_prop(struct feature *feature,
+static int fme_err_root_set_prop(struct ifpga_feature *feature,
 				 struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -353,7 +353,7 @@ static int fme_err_root_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_error_set_prop(struct feature *feature,
+static int fme_global_error_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -373,7 +373,7 @@ static int fme_global_error_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_err_ops = {
+struct ifpga_feature_ops fme_global_err_ops = {
 	.init = fme_global_error_init,
 	.uinit = fme_global_error_uinit,
 	.get_prop = fme_global_error_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c +14 -14
index e6c40a1..70543b9 100644
@@ -407,7 +407,7 @@ static int fme_iperf_set_fab_freeze(struct ifpga_fme_hw *fme, u64 freeze)
 #define PERF_MAX_PORT_NUM	1
 #define FME_IPERF_CAP_IOMMU	0x1
 
-static int fme_global_iperf_init(struct feature *feature)
+static int fme_global_iperf_init(struct ifpga_feature *feature)
 {
 	struct ifpga_fme_hw *fme;
 	struct feature_fme_header *fme_hdr;
@@ -429,14 +429,14 @@ static int fme_global_iperf_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_iperf_uinit(struct feature *feature)
+static void fme_global_iperf_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME global_iperf UInit.\n");
 }
 
-static int fme_iperf_root_get_prop(struct feature *feature,
+static int fme_iperf_root_get_prop(struct ifpga_feature *feature,
 				   struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -456,7 +456,7 @@ static int fme_iperf_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_cache_get_prop(struct feature *feature,
+static int fme_iperf_cache_get_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -496,7 +496,7 @@ static int fme_iperf_cache_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_root_get_prop(struct feature *feature,
+static int fme_iperf_vtd_root_get_prop(struct ifpga_feature *feature,
 				       struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -534,7 +534,7 @@ static int fme_iperf_vtd_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_sub_get_prop(struct feature *feature,
+static int fme_iperf_vtd_sub_get_prop(struct ifpga_feature *feature,
 				      struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -571,7 +571,7 @@ static int fme_iperf_vtd_sub_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_get_prop(struct feature *feature,
+static int fme_iperf_vtd_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	u8 sub = GET_FIELD(PROP_SUB, prop->prop_id);
@@ -582,7 +582,7 @@ static int fme_iperf_vtd_get_prop(struct feature *feature,
 	return fme_iperf_vtd_sub_get_prop(feature, prop);
 }
 
-static int fme_iperf_fab_get_prop(struct feature *feature,
+static int fme_iperf_fab_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -626,7 +626,7 @@ static int fme_iperf_fab_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_iperf_get_prop(struct feature *feature,
+static int fme_global_iperf_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -645,7 +645,7 @@ static int fme_global_iperf_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_cache_set_prop(struct feature *feature,
+static int fme_iperf_cache_set_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -658,7 +658,7 @@ static int fme_iperf_cache_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_set_prop(struct feature *feature,
+static int fme_iperf_vtd_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -671,7 +671,7 @@ static int fme_iperf_vtd_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_fab_set_prop(struct feature *feature,
+static int fme_iperf_fab_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -690,7 +690,7 @@ static int fme_iperf_fab_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_iperf_set_prop(struct feature *feature,
+static int fme_global_iperf_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -707,7 +707,7 @@ static int fme_global_iperf_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_iperf_ops = {
+struct ifpga_feature_ops fme_global_iperf_ops = {
 	.init = fme_global_iperf_init,
 	.uinit = fme_global_iperf_uinit,
 	.get_prop = fme_global_iperf_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c +3 -3
index 8890f4b..efa7266 100644
@@ -315,7 +315,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size, u64 *status)
 	return fme_pr(hw, port_id, buf, size, status);
 }
 
-static int fme_pr_mgmt_init(struct feature *feature)
+static int fme_pr_mgmt_init(struct ifpga_feature *feature)
 {
 	struct feature_fme_pr *fme_pr;
 	struct feature_header fme_pr_header;
@@ -339,14 +339,14 @@ static int fme_pr_mgmt_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_pr_mgmt_uinit(struct feature *feature)
+static void fme_pr_mgmt_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME PR MGMT UInit.\n");
 }
 
-struct feature_ops fme_pr_mgmt_ops = {
+struct ifpga_feature_ops fme_pr_mgmt_ops = {
 	.init = fme_pr_mgmt_init,
 	.uinit = fme_pr_mgmt_uinit,
 };
drivers/raw/ifpga_rawdev/base/ifpga_hw.h +12 -10
index a428d69..ff91c46 100644
@@ -10,7 +10,7 @@
 #include "opae_eth_group.h"
 
 /** List of private feateues */
-TAILQ_HEAD(ifpga_feature_list, feature);
+TAILQ_HEAD(ifpga_feature_list, ifpga_feature);
 
 enum ifpga_feature_state {
 	IFPGA_FEATURE_UNUSED = 0,
@@ -27,8 +27,8 @@ struct feature_irq_ctx {
 	int idx;
 };
 
-struct feature {
-	TAILQ_ENTRY(feature)next;
+struct ifpga_feature {
+	TAILQ_ENTRY(ifpga_feature)next;
 	enum ifpga_feature_state state;
 	enum feature_type type;
 	const char *name;
@@ -44,17 +44,19 @@ struct feature {
 
 	void *parent;		/* to parent hw data structure */
 
-	struct feature_ops *ops;/* callback to this private feature */
+	struct ifpga_feature_ops *ops;/* callback to this private feature */
 	unsigned int vec_start;
 	unsigned int vec_cnt;
 };
 
-struct feature_ops {
-	int (*init)(struct feature *feature);
-	void (*uinit)(struct feature *feature);
-	int (*get_prop)(struct feature *feature, struct feature_prop *prop);
-	int (*set_prop)(struct feature *feature, struct feature_prop *prop);
-	int (*set_irq)(struct feature *feature, void *irq_set);
+struct ifpga_feature_ops {
+	int (*init)(struct ifpga_feature *feature);
+	void (*uinit)(struct ifpga_feature *feature);
+	int (*get_prop)(struct ifpga_feature *feature,
+			struct feature_prop *prop);
+	int (*set_prop)(struct ifpga_feature *feature,
+			struct feature_prop *prop);
+	int (*set_irq)(struct ifpga_feature *feature, void *irq_set);
 };
 
 enum ifpga_fme_state {
drivers/raw/ifpga_rawdev/base/ifpga_port.c +19 -17
index 4628783..6c41164 100644
@@ -6,7 +6,7 @@
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -21,7 +21,7 @@ int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 
 int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -36,7 +36,7 @@ int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 
 int port_set_irq(struct ifpga_port_hw *port, u32 feature_id, void *irq_set)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -260,7 +260,7 @@ static int port_get_userclk_freqcntrsts(struct ifpga_port_hw *port, u64 *val)
 	return 0;
 }
 
-static int port_hdr_init(struct feature *feature)
+static int port_hdr_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -271,14 +271,15 @@ static int port_hdr_init(struct feature *feature)
 	return 0;
 }
 
-static void port_hdr_uinit(struct feature *feature)
+static void port_hdr_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "port hdr uinit.\n");
 }
 
-static int port_hdr_get_prop(struct feature *feature, struct feature_prop *prop)
+static int port_hdr_get_prop(struct ifpga_feature *feature,
+		struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -308,7 +309,8 @@ static int port_hdr_get_prop(struct feature *feature, struct feature_prop *prop)
 	return -ENOENT;
 }
 
-static int port_hdr_set_prop(struct feature *feature, struct feature_prop *prop)
+static int port_hdr_set_prop(struct ifpga_feature *feature,
+		struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -326,14 +328,14 @@ static int port_hdr_set_prop(struct feature *feature, struct feature_prop *prop)
 	return -ENOENT;
 }
 
-struct feature_ops ifpga_rawdev_port_hdr_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_hdr_ops = {
 	.init = port_hdr_init,
 	.uinit = port_hdr_uinit,
 	.get_prop = port_hdr_get_prop,
 	.set_prop = port_hdr_set_prop,
 };
 
-static int port_stp_init(struct feature *feature)
+static int port_stp_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -347,19 +349,19 @@ static int port_stp_init(struct feature *feature)
 	return 0;
 }
 
-static void port_stp_uinit(struct feature *feature)
+static void port_stp_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "port stp uinit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_stp_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_stp_ops = {
 	.init = port_stp_init,
 	.uinit = port_stp_uinit,
 };
 
-static int port_uint_init(struct feature *feature)
+static int port_uint_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -375,19 +377,19 @@ static int port_uint_init(struct feature *feature)
 	return 0;
 }
 
-static void port_uint_uinit(struct feature *feature)
+static void port_uint_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "PORT UINT UInit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_uint_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_uint_ops = {
 	.init = port_uint_init,
 	.uinit = port_uint_uinit,
 };
 
-static int port_afu_init(struct feature *feature)
+static int port_afu_init(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
@@ -396,14 +398,14 @@ static int port_afu_init(struct feature *feature)
 	return 0;
 }
 
-static void port_afu_uinit(struct feature *feature)
+static void port_afu_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "PORT AFU UInit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_afu_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_afu_ops = {
 	.init = port_afu_init,
 	.uinit = port_afu_uinit,
 };
drivers/raw/ifpga_rawdev/base/ifpga_port_error.c +5 -5
index 9dd1cf5..138284e 100644
@@ -84,7 +84,7 @@ static int port_err_set_clear(struct ifpga_port_hw *port, u64 val)
 	return ret;
 }
 
-static int port_error_init(struct feature *feature)
+static int port_error_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -99,12 +99,12 @@ static int port_error_init(struct feature *feature)
 	return 0;
 }
 
-static void port_error_uinit(struct feature *feature)
+static void port_error_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 }
 
-static int port_error_get_prop(struct feature *feature,
+static int port_error_get_prop(struct ifpga_feature *feature,
 			       struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
@@ -125,7 +125,7 @@ static int port_error_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int port_error_set_prop(struct feature *feature,
+static int port_error_set_prop(struct ifpga_feature *feature,
 			       struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
@@ -136,7 +136,7 @@ static int port_error_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops ifpga_rawdev_port_error_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_error_ops = {
 	.init = port_error_init,
 	.uinit = port_error_uinit,
 	.get_prop = port_error_get_prop,
Signature · 1 line
1.8.3.1
author
#107 lore raw

PATCH v5 14/14 drivers/raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE support for IFPGA Rawdev.

---
 drivers/raw/ifpga_rawdev/Makefile       |   1 +
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 248 +++++++++++++++++++++++++++++++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h |  14 +-
 drivers/raw/ifpga_rawdev/meson.build    |   6 +-
 4 files changed, 264 insertions(+), 5 deletions(-)
drivers/raw/ifpga_rawdev/Makefile +1 -0
index f3b9d5e..f60b547 100644
@@ -13,6 +13,7 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga
 CFLAGS += -I$(RTE_SDK)/drivers/raw/ifpga_rawdev
+CFLAGS += -I$(RTE_SDK)/drivers/net/ipn3ke
 LDLIBS += -lrte_eal
 LDLIBS += -lrte_rawdev
 LDLIBS += -lrte_bus_vdev
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +245 -3

306 lines not on this page · raw message

drivers/raw/ifpga_rawdev/ifpga_rawdev.h +13 -1
index c7759b8..fcb1a96 100644
@@ -8,7 +8,7 @@
 extern int ifpga_rawdev_logtype;
 
 #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifgpa: " fmt, \
+	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifpga_rawdev: " fmt, \
 		##args)
 
 #define IFPGA_RAWDEV_PMD_FUNC_TRACE() IFPGA_RAWDEV_PMD_LOG(DEBUG, ">>")
@@ -28,6 +28,18 @@ enum ifpga_rawdev_device_state {
 	IFPGA_ERROR
 };
 
+/** Set a bit in the uint64 variable */
+#define IFPGA_BIT_SET(var, pos) \
+	((var) |= ((uint64_t)1 << ((pos))))
+
+/** Reset the bit in the variable */
+#define IFPGA_BIT_RESET(var, pos) \
+	((var) &= ~((uint64_t)1 << ((pos))))
+
+/** Check the bit is set in the variable */
+#define IFPGA_BIT_ISSET(var, pos) \
+	(((var) & ((uint64_t)1 << ((pos)))) ? 1 : 0)
+
 static inline struct opae_adapter *
 ifpga_rawdev_get_priv(const struct rte_rawdev *rawdev)
 {
drivers/raw/ifpga_rawdev/meson.build +5 -1
index 6725687..132b777 100644
@@ -6,8 +6,12 @@ version = 1
 subdir('base')
 objs = [base_objs]
 
+dep = dependency('libfdt', required: false)
+if not dep.found()
+	build = false
+endif
 deps += ['rawdev', 'pci', 'bus_pci', 'kvargs',
-	'bus_vdev', 'bus_ifpga']
+	'bus_vdev', 'bus_ifpga', 'net']
 sources = files('ifpga_rawdev.c')
 
 includes += include_directories('base')
Signature · 1 line
1.8.3.1
#108 lore raw
In reply to Rosen Xu
Quoted 44 lines · Rosen Xu

v5 updates:
==========
- Fix EXPERIMENTAL symbol definition issue

v4 updates:
==========
- Fix coding style issues

v3 updates:
==========
- Fix v2 comments
- Update MAC BAR of AFU index get ops
- Remove OPAE share code dependency of libfdt

v2 updates:
==========
- Fix v1 comments
- Add support for 10G Base Line Design Bitstream
- Add support for 25G Base Line Design Bitstream

This patch set adds the support of a new net PMD, Intel® FPGA Programmable Acceleration Card N3000, also called ipn3ke.

The ipn3ke PMD (librte_pmd_ipn3ke) provides poll mode driver support for Intel® FPGA PAC(Programmable Acceleration Card) N3000 based on the Intel Ethernet Controller X710/XXV710 and Intel Arria 10 FPGA.

In this card, FPGA is an acceleration bridge between network interface and the Intel Ethernet Controller. Although both FPGA and Ethernet Controllers are connected to CPU with PCIe Gen3x16 Switch, all the packet RX/TX is handled by Intel Ethernet Controller. So from application point of view the data path is still the legacy Intel Ethernet Controller X710/XXV710 PMD. Besides this, users can enable more acceleration features by FPGA IP.

Rosen Xu (7):
drivers/bus/ifpga: add AFU shared data drivers/bus/ifpga: add function for AFU search by name drivers/net/ipn3ke: add IPN3KE ethdev PMD driver drivers/net/ipn3ke: add IPN3KE representor of PMD driver drivers/net/ipn3ke: add IPN3KE TM of PMD driver drivers/net/ipn3ke: add IPN3KE Flow of PMD driver drivers/raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Quoted 9 lines

Zhang, Tianfei (7):
raw/ifpga/base: clean up code for ifpga share code raw/ifpga/base: store private features in FME and Port list raw/ifpga/base: add SPI and MAX10 device driver raw/ifpga/base: add I2C and at24 EEPROM driver raw/ifpga/base: add eth group driver
raw/ifpga/base: add version description on README raw/ifpga/base: using prefix name "ifpga_" for feature and feature_ops
data struct

There are still build errors with shared build [1] related to missing pthread library [2], can you please check it?

Also there are set of errors from 'check-git-log.sh', can you please run following and fix the reported errors:
./devtools/check-git-log.sh -14

Thanks,
ferruh

[1]
CONFIG_RTE_BUILD_SHARED_LIB=y

[2]
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_init':
ipn3ke_representor.c:(.text+0xd13): undefined reference to pthread_create' /usr/bin/ld: ipn3ke_representor.c:(.text+0xd32): undefined reference to pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xd4d): undefined reference to `pthread_join'
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_uninit':
ipn3ke_representor.c:(.text+0xe13): undefined reference to pthread_create' /usr/bin/ld: ipn3ke_representor.c:(.text+0xe32): undefined reference to pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xe4d): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status

author
#109 lore raw

Hi,

Quoted 67 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, April 05, 2019 2:38
To: Xu, Rosen <[email protected]>; [email protected]
Cc: Zhang, Tianfei <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>; Lomartire, David <[email protected]>
Subject: Re: [PATCH v5 00/14] Add patch set for IPN3KE

Quoted 45 lines · Rosen Xu

v5 updates:
==========
- Fix EXPERIMENTAL symbol definition issue

v4 updates:
==========
- Fix coding style issues

v3 updates:
==========
- Fix v2 comments
- Update MAC BAR of AFU index get ops
- Remove OPAE share code dependency of libfdt

v2 updates:
==========
- Fix v1 comments
- Add support for 10G Base Line Design Bitstream
- Add support for 25G Base Line Design Bitstream

This patch set adds the support of a new net PMD, Intel® FPGA Programmable Acceleration Card N3000, also called ipn3ke.

The ipn3ke PMD (librte_pmd_ipn3ke) provides poll mode driver support for Intel® FPGA PAC(Programmable Acceleration Card) N3000 based on the Intel Ethernet Controller X710/XXV710 and Intel Arria 10 FPGA.

In this card, FPGA is an acceleration bridge between network interface and the Intel Ethernet Controller. Although both FPGA and Ethernet Controllers are connected to CPU with PCIe Gen3x16 Switch, all the packet RX/TX is handled by Intel Ethernet Controller. So from application point of view the data path is still the legacy Intel Ethernet Controller
X710/XXV710 PMD. Besides this, users can enable more acceleration features by FPGA IP.

Rosen Xu (7):
drivers/bus/ifpga: add AFU shared data drivers/bus/ifpga: add function for AFU search by name drivers/net/ipn3ke: add IPN3KE ethdev PMD driver drivers/net/ipn3ke: add IPN3KE representor of PMD driver drivers/net/ipn3ke: add IPN3KE TM of PMD driver drivers/net/ipn3ke: add IPN3KE Flow of PMD driver drivers/raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Quoted 9 lines

Zhang, Tianfei (7):
raw/ifpga/base: clean up code for ifpga share code raw/ifpga/base: store private features in FME and Port list raw/ifpga/base: add SPI and MAX10 device driver raw/ifpga/base: add I2C and at24 EEPROM driver raw/ifpga/base: add eth group driver
raw/ifpga/base: add version description on README raw/ifpga/base: using prefix name "ifpga_" for feature and feature_ops
data struct

Quoted 3 lines

There are still build errors with shared build [1] related to missing pthread library [2], can you please check it?

IPN3KE Makefile misses include lib pthread.
LDLIBS += -lpthread
Fixed in v6.

Quoted 4 lines

Also there are set of errors from 'check-git-log.sh', can you please run following and fix the reported errors:
./devtools/check-git-log.sh -14

Fixed in v6.

Quoted 3 lines

Thanks,
ferruh

Welcome, thanks your reminder.

Quoted 3 lines

[1]
CONFIG_RTE_BUILD_SHARED_LIB=y

Check before send v6.

Quoted 8 lines

[2]
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_init':
ipn3ke_representor.c:(.text+0xd13): undefined reference to `pthread_create'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xd32): undefined reference to `pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xd4d): undefined reference to `pthread_join'

Quoted 9 lines

/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_uninit':
ipn3ke_representor.c:(.text+0xe13): undefined reference to `pthread_create'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xe32): undefined reference to `pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xe4d): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status

Fixed in v6.

author
#110 lore raw

v6 cover Add patch set for IPN3KE

In reply to Rosen Xu

v6 updates:
==========
- Fix v5 comments
- Fix TM Shaper rate issue

v5 updates:
==========
- Fix EXPERIMENTAL symbol definition issue

v4 updates:
==========
- Fix coding style issues

v3 updates:
==========
- Fix v2 comments
- Update MAC BAR of AFU index get ops
- Remove OPAE share code dependency of libfdt

v2 updates:
==========
- Fix v1 comments
- Add support for 10G Base Line Design Bitstream
- Add support for 25G Base Line Design Bitstream

This patch set adds the support of a new net PMD, Intel® FPGA Programmable Acceleration Card N3000, also called ipn3ke.

The ipn3ke PMD (librte_pmd_ipn3ke) provides poll mode driver support for Intel® FPGA PAC(Programmable Acceleration Card) N3000 based on the Intel Ethernet Controller X710/XXV710 and Intel Arria 10 FPGA.

In this card, FPGA is an acceleration bridge between network interface and the Intel Ethernet Controller. Although both FPGA and Ethernet Controllers are connected to CPU with PCIe Gen3x16 Switch, all the packet RX/TX is handled by Intel Ethernet Controller. So from application point of view the data path is still the legacy Intel Ethernet Controller X710/XXV710 PMD. Besides this, users can enable more acceleration features by FPGA IP.

Rosen Xu (7):
bus/ifpga: add AFU shared data
bus/ifpga: add function for AFU search by name net/ipn3ke: add IPN3KE ethdev PMD driver net/ipn3ke: add IPN3KE representor of PMD driver net/ipn3ke: add IPN3KE TM of PMD driver net/ipn3ke: add IPN3KE Flow of PMD driver raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Tianfei zhang (7):
raw/ifpga_rawdev: clean up code for ifpga share code raw/ifpga_rawdev: store private features in FME and Port raw/ifpga_rawdev: add SPI and MAX10 device driver raw/ifpga_rawdev: add I2C and at24 EEPROM driver raw/ifpga_rawdev: add eth group driver raw/ifpga_rawdev: add version description on README raw/ifpga_rawdev: using prefix name for feature and its ops

 MAINTAINERS                                        |    6 +
 config/common_base                                 |    4 +
 doc/guides/nics/features/ipn3ke.ini                |   55 +
 doc/guides/nics/index.rst                          |    1 +
 doc/guides/nics/ipn3ke.rst                         |  108 +
 drivers/bus/ifpga/ifpga_bus.c                      |   13 +
 drivers/bus/ifpga/rte_bus_ifpga.h                  |   16 +
 drivers/bus/ifpga/rte_bus_ifpga_version.map        |    6 +
 drivers/net/Makefile                               |    1 +
 drivers/net/ipn3ke/Makefile                        |   40 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c                 |  665 +++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h                 |  978 +++++++++
 drivers/net/ipn3ke/ipn3ke_flow.c                   | 1374 +++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h                   |  106 +
 drivers/net/ipn3ke/ipn3ke_logs.h                   |   30 +
 drivers/net/ipn3ke/ipn3ke_rawdev_api.h             |   62 +
 drivers/net/ipn3ke/ipn3ke_representor.c            |  893 +++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c                     | 2069 ++++++++++++++++++++
 drivers/net/ipn3ke/meson.build                     |   17 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map      |    4 +
 drivers/net/meson.build                            |    1 +
 drivers/raw/ifpga_rawdev/Makefile                  |    1 +
 drivers/raw/ifpga_rawdev/base/Makefile             |    6 +
 drivers/raw/ifpga_rawdev/base/README               |   15 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c          |   98 +-
 drivers/raw/ifpga_rawdev/base/ifpga_api.h          |    1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |   93 +-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c    |  357 ++--
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  |  174 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |   99 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          |  602 +++++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c    |   16 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c    |   18 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c    |   28 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c       |    8 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |   44 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c         |   51 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port_error.c   |   10 +-
 drivers/raw/ifpga_rawdev/base/meson.build          |    8 +-
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c   |   88 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h   |   14 +
 drivers/raw/ifpga_rawdev/base/opae_debug.c         |   16 +-
 drivers/raw/ifpga_rawdev/base/opae_eth_group.c     |  145 ++
 drivers/raw/ifpga_rawdev/base/opae_eth_group.h     |   96 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c        |  200 +-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |   54 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c           |  490 +++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h           |  130 ++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   |   88 +
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |   96 +
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |   21 +-
 drivers/raw/ifpga_rawdev/base/opae_spi.c           |  304 +++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           |  160 ++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   |  438 +++++
 .../ifpga_rawdev/base/osdep_raw/osdep_generic.h    |    1 +
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |   16 +
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c            |  248 ++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h            |   16 +-
 drivers/raw/ifpga_rawdev/meson.build               |    6 +-
 mk/rte.app.mk                                      |    1 +
 usertools/dpdk-devbind.py                          |    4 +-
 61 files changed, 10280 insertions(+), 430 deletions(-)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
 create mode 100644 drivers/net/ipn3ke/Makefile
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_logs.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_rawdev_api.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_representor.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c
 create mode 100644 drivers/net/ipn3ke/meson.build
 create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c
Signature · 1 line
1.8.3.1
author
#111 lore raw

PATCH v6 1/14 bus/ifpga: add AFU shared data

AFU can be implemented into many different acceleration devices, these devices need shared data to store private information when they are handled by users.

---
 drivers/bus/ifpga/rte_bus_ifpga.h | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/bus/ifpga/rte_bus_ifpga.h +7 -0
index 0bf43ba..820eeaa 100644
@@ -17,6 +17,7 @@
 
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_spinlock.h>
 
 /** Name of Intel FPGA Bus */
 #define IFPGA_BUS_NAME ifpga
@@ -60,6 +61,11 @@ struct rte_afu_pr_conf {
 
 #define AFU_PRI_STR_SIZE (PCI_PRI_STR_SIZE + 8)
 
+struct rte_afu_shared {
+	rte_spinlock_t lock;
+	void *data;
+};
+
 /**
  * A structure describing a AFU device.
  */
@@ -71,6 +77,7 @@ struct rte_afu_device {
 	uint32_t num_region;   /**< number of regions found */
 	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
 						/**< AFU Memory Resource */
+	struct rte_afu_shared shared;
 	struct rte_intr_handle intr_handle;     /**< Interrupt handle */
 	struct rte_afu_driver *driver;          /**< Associated driver */
 	char path[IFPGA_BUS_BITSTREAM_PATH_MAX_LEN];
Signature · 1 line
1.8.3.1
author
#112 lore raw

PATCH v6 2/14 bus/ifpga: add function for AFU search by name

In reply to Rosen Xu

In many scenarios, AFU is needed searched by name, this function add the feature.

---
 drivers/bus/ifpga/ifpga_bus.c               | 13 +++++++++++++
 drivers/bus/ifpga/rte_bus_ifpga.h           |  9 +++++++++
 drivers/bus/ifpga/rte_bus_ifpga_version.map |  6 ++++++
 3 files changed, 28 insertions(+)
drivers/bus/ifpga/ifpga_bus.c +13 -0
index 55d3abf..8bfae29 100644
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
 	return NULL;
 }
 
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name)
+{
+	struct rte_afu_device *afu_dev = NULL;
+
+	TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) {
+		if (afu_dev &&
+			!strcmp(afu_dev->device.name, name))
+			return afu_dev;
+	}
+	return NULL;
+}
+
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
 	IFPGA_ARG_NAME,
drivers/bus/ifpga/rte_bus_ifpga.h +9 -0
index 820eeaa..c00f60e 100644
@@ -120,6 +120,15 @@ struct rte_afu_driver {
 }
 
 /**
+ * Find AFU by AFU name.
+ *
+ * @param name
+ *   A pointer to AFU name string.
+ */
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name);
+
+/**
  * Register a ifpga afu device driver.
  *
  * @param driver
drivers/bus/ifpga/rte_bus_ifpga_version.map +6 -0
index a027979..247ccfe 100644
@@ -8,3 +8,9 @@ DPDK_18.05 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+    global:
+
+    rte_ifpga_find_afu_by_name;
+};
\ No newline at end of file
Signature · 1 line
1.8.3.1
author
#113 lore raw

PATCH v6 3/14 net/ipn3ke: add IPN3KE ethdev PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE ethdev PMD driver.

---
 MAINTAINERS                                   |   6 +
 config/common_base                            |   4 +
 doc/guides/nics/features/ipn3ke.ini           |  55 ++
 doc/guides/nics/index.rst                     |   1 +
 doc/guides/nics/ipn3ke.rst                    | 108 +++
 drivers/net/Makefile                          |   1 +
 drivers/net/ipn3ke/Makefile                   |  36 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c            | 657 ++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h            | 945 ++++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_logs.h              |  30 +
 drivers/net/ipn3ke/ipn3ke_rawdev_api.h        |  62 ++
 drivers/net/ipn3ke/meson.build                |  14 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map |   4 +
 drivers/net/meson.build                       |   1 +
 mk/rte.app.mk                                 |   1 +
 usertools/dpdk-devbind.py                     |   4 +-
 16 files changed, 1928 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
 create mode 100644 drivers/net/ipn3ke/Makefile
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_logs.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_rawdev_api.h
 create mode 100644 drivers/net/ipn3ke/meson.build
 create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
MAINTAINERS +6 -0
index 9774344..8db925f 100644
@@ -633,6 +633,12 @@ F: drivers/net/ice/
 F: doc/guides/nics/ice.rst
 F: doc/guides/nics/features/ice.ini
 
+Intel ipn3ke
+M: Rosen Xu <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/ipn3ke/
+F: doc/guides/nics/ipn3ke.rst
+F: doc/guides/nics/features/ipn3ke.ini
 Marvell mvpp2
 M: Tomasz Duszynski <[email protected]>
 M: Liron Himi <[email protected]>
config/common_base +4 -0
index 8da0810..cb9e3b6 100644
@@ -328,6 +328,10 @@ CONFIG_RTE_LIBRTE_IAVF_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_IAVF_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_IAVF_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_IAVF_16BYTE_RX_DESC=n
+#
+# Compile burst-oriented IPN3KE PMD driver
+#
+CONFIG_RTE_LIBRTE_IPN3KE_PMD=y
 
 #
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD
doc/guides/nics/features/ipn3ke.ini new file +55 -0

55 lines not on this page · raw message

doc/guides/nics/index.rst +1 -0
index a4b80a3..1892350 100644
@@ -31,6 +31,7 @@ Network Interface Controller Drivers
     ice
     ifc
     igb
+    ipn3ke
     ixgbe
     intel_vf
     kni
doc/guides/nics/ipn3ke.rst new file +108 -0

108 lines not on this page · raw message

drivers/net/Makefile +1 -0
index 5d401b8..5c972eb 100644
@@ -32,6 +32,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += iavf
 DIRS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice
+DIRS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
 DIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += liquidio
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
drivers/net/ipn3ke/Makefile new file +36 -0
new file mode 100644
index 0000000..d7aa79b
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_ipn3ke.a
+
+#
+# Add the experimenatal APIs called from this PMD
+#  rte_eth_switch_domain_alloc()
+#  rte_eth_dev_create()
+#  rte_eth_dev_destroy()
+#  rte_eth_switch_domain_free()
+#
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_ifpga
+LDLIBS += -lrte_bus_vdev
+
+EXPORT_MAP := rte_pmd_ipn3ke_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +657 -0

657 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_ethdev.h new file +945 -0

945 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_logs.h new file +30 -0
new file mode 100644
index 0000000..dedaece
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _IPN3KE_LOGS_H_
+#define _IPN3KE_LOGS_H_
+
+#include <rte_log.h>
+
+extern int ipn3ke_afu_logtype;
+
+#define IPN3KE_AFU_PMD_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, ipn3ke_afu_logtype, "ipn3ke_afu: " fmt, \
+		##args)
+
+#define IPN3KE_AFU_PMD_FUNC_TRACE() IPN3KE_AFU_PMD_LOG(DEBUG, ">>")
+
+#define IPN3KE_AFU_PMD_DEBUG(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(DEBUG, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_INFO(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(INFO, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_ERR(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(ERR, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_WARN(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(WARNING, fmt, ## args)
+
+#endif /* _IPN3KE_LOGS_H_ */
drivers/net/ipn3ke/ipn3ke_rawdev_api.h new file +62 -0

62 lines not on this page · raw message

drivers/net/ipn3ke/meson.build new file +14 -0
new file mode 100644
index 0000000..b511600
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+#
+# Add the experimenatal APIs called from this PMD
+#  rte_eth_switch_domain_alloc()
+#  rte_eth_dev_create()
+#  rte_eth_dev_destroy()
+#  rte_eth_switch_domain_free()
+#
+allow_experimental_apis = true
+
+sources += files('ipn3ke_ethdev.c')
+deps += ['bus_ifpga', 'sched']
drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +4 -0
new file mode 100644
index 0000000..fc8c95e
@@ -0,0 +1,4 @@
+DPDK_19.05 {
+
+	local: *;
+};
drivers/net/meson.build +1 -0
index 1105e72..6b96786 100644
@@ -20,6 +20,7 @@ drivers = ['af_packet',
 	'iavf',
 	'ice',
 	'ifc',
+	'ipn3ke',
 	'ixgbe',
 	'kni',
 	'liquidio',
mk/rte.app.mk +1 -0
index 7d994be..d2b8ab6 100644
@@ -298,6 +298,7 @@ endif # CONFIG_RTE_LIBRTE_FSLMC_BUS
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IFPGA_BUS)      += -lrte_bus_ifpga
 ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
usertools/dpdk-devbind.py +3 -1
index 249b65a..9e79f0d 100755
@@ -12,6 +12,8 @@
 # The PCI base class for all devices
 network_class = {'Class': '02', 'Vendor': None, 'Device': None,
                     'SVendor': None, 'SDevice': None}
+ifpga_class = {'Class': '12', 'Vendor': '8086', 'Device': '0b30',
+                    'SVendor': None, 'SDevice': None}
 encryption_class = {'Class': '10', 'Vendor': None, 'Device': None,
                    'SVendor': None, 'SDevice': None}
 intel_processor_class = {'Class': '0b', 'Vendor': '8086', 'Device': None,
@@ -34,7 +36,7 @@
 octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
               'SVendor': None, 'SDevice': None}
 
-network_devices = [network_class, cavium_pkx, avp_vnic]
+network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
 crypto_devices = [encryption_class, intel_processor_class]
 eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
 mempool_devices = [cavium_fpa, octeontx2_npa]
Signature · 1 line
1.8.3.1
#114 lore raw

Re: [dpdk-dev] [PATCH v6 03/14] net/ipn3ke: add IPN3KE ethdev PMD driver

Minor nits.

drivers/net/ipn3ke/ipn3ke_ethdev.c line 76

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +4 -0
+
+	(*rd_data) = rte_le_to_cpu_32(read_data);
+	return 0;
+}

Paren around *rd_data are unnecessary

Review

Quoted 2 lines
(quoted diff) +2 -0
+	indirect_addrs = (volatile void *)(hw->eth_group_bar[eth_group_sel] +
+		0x10);

cast is to void * is unnecesary

+ return ipn3ke_indirect_read(hw,
+ rd_data,
+ addr,
+ dev_sel,
+ eth_group_sel);

One parameter per line is not necessary here.

+static int
+ipn3ke_hw_cap_init(struct ipn3ke_hw *hw)
+{

Always returns 0 make it void

drivers/net/ipn3ke/ipn3ke_ethdev.c line 350

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +3 -0
+		/* representor port net_bdf_port */
+		snprintf(name, sizeof(name), "net_%s_representor_%d",
+			afu_dev->device.name, i);

That seems like a longer than necessary eth_dev_name and doesn't seem to follow the convention of using PCI address.

Why do only Intel drivers call rte_eth_dev_create, everyone else calls rte_eth_dev_allocate()?

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+	hw = (struct ipn3ke_hw *)afu_dev->shared.data;

Cast of void * is unnecessary in C.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	for (i = 0; i < hw->port_num; i++) {
+		snprintf(name, sizeof(name), "net_%s_representor_%d",

You use this format twice, it should be a #define.

drivers/net/ipn3ke/ipn3ke_ethdev.h line 353

Quoted 7 lines
drivers/net/ipn3ke/ipn3ke_ethdev.h new file +7 -0
+static inline uint32_t _ipn3ke_indrct_read(struct ipn3ke_hw *hw,
+		uint32_t addr)
+{
+	uint64_t word_offset = 0;
+	uint64_t read_data = 0;
+	uint64_t indirect_value = 0;
+	volatile void *indirect_addrs = 0;

You set all these values in next view lines so these initializations are useless. Doing extra initialization is bad since it overrides the ability of compiler and static checkers to find code paths where data is used uninitialized.

drivers/net/ipn3ke/ipn3ke_ethdev.h line 915

Quoted 11 lines
drivers/net/ipn3ke/ipn3ke_ethdev.h new file +11 -0
+static inline void ipn3ke_xmac_smac_ovd_dis(struct ipn3ke_hw *hw,
+	uint32_t mac_num, uint32_t eth_group_sel)
+{
+#define IPN3KE_XMAC_SMAC_OVERRIDE_DISABLE (0 & \
+	(IPN3KE_MAC_TX_SRC_ADDR_OVERRIDE_MASK))
+
+	(*hw->f_mac_write)(hw,
+					IPN3KE_XMAC_SMAC_OVERRIDE_DISABLE,
+					IPN3KE_MAC_TX_SRC_ADDR_OVERRIDE,
+					mac_num,
+					eth_group_sel);

Indentation issue here?

drivers/net/ipn3ke/ipn3ke_logs.h line 14

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_logs.h new file +5 -0
+extern int ipn3ke_afu_logtype;
+
+#define IPN3KE_AFU_PMD_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, ipn3ke_afu_logtype, "ipn3ke_afu: " fmt, \
+		##args)

The common practice in Intel drivers is to put the newline in this macro (and remove it from the format strings). Also put the function name rather than always ipn3ke_afu: in the log message?

author
#115 lore raw

Re: [dpdk-dev] [PATCH v6 03/14] net/ipn3ke: add IPN3KE ethdev PMD driver

Quoted 14 lines

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Tuesday, April 09, 2019 23:19
To: Xu, Rosen <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Zhang, Tianfei <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>; Lomartire, David <[email protected]>; Hu, Jia <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6 03/14] net/ipn3ke: add IPN3KE ethdev PMD driver

Quoted 1 line

Minor nits.

My reply is online.

Quoted 6 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 76

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +4 -0
+
+	(*rd_data) = rte_le_to_cpu_32(read_data);
+	return 0;
+}

Paren around *rd_data are unnecessary

Fixed in v7.

Quoted 5 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	indirect_addrs = (volatile void *)(hw->eth_group_bar[eth_group_sel]

+

Review

Quoted 1 line
(quoted diff) +1 -0
+		0x10);

cast is to void * is unnecesary

Fixed in v7.

Quoted 7 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +5 -0
+	return ipn3ke_indirect_read(hw,
+				rd_data,
+				addr,
+				dev_sel,
+				eth_group_sel);

One parameter per line is not necessary here.

Fixed in v7.

Quoted 10 lines
(quoted diff) +2 -0
+static int
+ipn3ke_hw_cap_init(struct ipn3ke_hw *hw) {

Always returns 0 make it void

drivers/net/ipn3ke/ipn3ke_ethdev.c line 350

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +3 -0
+		/* representor port net_bdf_port */
+		snprintf(name, sizeof(name), "net_%s_representor_%d",
+			afu_dev->device.name, i);

That seems like a longer than necessary eth_dev_name and doesn't seem to follow the convention of using PCI address.

I have checked, it follows eth_dev_name definition.

Quoted 2 lines

Why do only Intel drivers call rte_eth_dev_create, everyone else calls rte_eth_dev_allocate()?

rte_eth_dev_create() is an API.
All APIs may be called by other modules?
Do you think so?

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+	hw = (struct ipn3ke_hw *)afu_dev->shared.data;

Cast of void * is unnecessary in C.

Fixed in v7.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	for (i = 0; i < hw->port_num; i++) {
+		snprintf(name, sizeof(name), "net_%s_representor_%d",

You use this format twice, it should be a #define.

Any rules to define format used more than twice should be a #define? I have checked others' code, many usage as mine.

Quoted 11 lines

drivers/net/ipn3ke/ipn3ke_ethdev.h line 353

Quoted 7 lines
drivers/net/ipn3ke/ipn3ke_ethdev.h new file +7 -0
+static inline uint32_t _ipn3ke_indrct_read(struct ipn3ke_hw *hw,
+		uint32_t addr)
+{
+	uint64_t word_offset = 0;
+	uint64_t read_data = 0;
+	uint64_t indirect_value = 0;
+	volatile void *indirect_addrs = 0;

You set all these values in next view lines so these initializations are useless. Doing extra initialization is bad since it overrides the ability of compiler and static checkers to find code paths where data is used uninitialized.

Fixed in v7.

Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_ethdev.h line 917

Quoted 7 lines
drivers/net/ipn3ke/ipn3ke_ethdev.h new file +7 -0
+static inline void ipn3ke_xmac_smac_ovd_dis(struct ipn3ke_hw *hw,
+	uint32_t mac_num, uint32_t eth_group_sel) { #define
+IPN3KE_XMAC_SMAC_OVERRIDE_DISABLE (0 & \
+	(IPN3KE_MAC_TX_SRC_ADDR_OVERRIDE_MASK))
+
+	(*hw->f_mac_write)(hw,
+

IPN3KE_XMAC_SMAC_OVERRIDE_DISABLE,

Quoted 7 lines
Quoted 1 line

+

IPN3KE_MAC_TX_SRC_ADDR_OVERRIDE,

Review

Quoted 2 lines
(quoted diff) +2 -0
+					mac_num,
+					eth_group_sel);

Indentation issue here?

No, I have checked in Vim of CentOS and Ubuntu. No indentation issue. Pls check your vim configuration. Thanks.

Quoted 10 lines

drivers/net/ipn3ke/ipn3ke_logs.h line 14

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_logs.h new file +5 -0
+extern int ipn3ke_afu_logtype;
+
+#define IPN3KE_AFU_PMD_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, ipn3ke_afu_logtype, "ipn3ke_afu: " fmt, \
+		##args)

The common practice in Intel drivers is to put the newline in this macro (and remove it from the format strings). Also put the function name rather than always ipn3ke_afu: in the log message?

Changed to:

#define IPN3KE_AFU_PMD_LOG(level, fmt, args...) \
	rte_log(RTE_LOG_ ## level, ipn3ke_afu_logtype, "%s(): " fmt "\n", \
		__func__, ##args)
author
#116 lore raw

PATCH v6 4/14 net/ipn3ke: add IPN3KE representor of PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE representor of PMD driver.

---
 drivers/net/ipn3ke/Makefile             |   2 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c      |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h      |  25 +
 drivers/net/ipn3ke/ipn3ke_representor.c | 887 ++++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/meson.build          |   3 +-
 5 files changed, 918 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/ipn3ke/ipn3ke_representor.c
drivers/net/ipn3ke/Makefile +2 -0
index d7aa79b..221567d 100644
@@ -23,6 +23,7 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 LDLIBS += -lrte_bus_ifpga
 LDLIBS += -lrte_bus_vdev
+LDLIBS += -lpthread
 
 EXPORT_MAP := rte_pmd_ipn3ke_version.map
 
@@ -32,5 +33,6 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_representor.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c +2 -2
index a1a1984..146d796 100644
@@ -351,7 +351,7 @@ static int ipn3ke_vswitch_probe(struct rte_afu_device *afu_dev)
 
 		retval = rte_eth_dev_create(&afu_dev->device, name,
 			sizeof(struct ipn3ke_rpst), NULL, NULL,
-			NULL, &rpst);
+			ipn3ke_rpst_init, &rpst);
 
 		if (retval)
 			IPN3KE_AFU_PMD_ERR("failed to create ipn3ke representor %s.",
@@ -380,7 +380,7 @@ static int ipn3ke_vswitch_remove(struct rte_afu_device *afu_dev)
 		if (!ethdev)
 			return -ENODEV;
 
-		rte_eth_dev_destroy(ethdev, NULL);
+		rte_eth_dev_destroy(ethdev, ipn3ke_rpst_uninit);
 	}
 
 	ret = rte_eth_switch_domain_free(hw->switch_domain_id);
drivers/net/ipn3ke/ipn3ke_ethdev.h +25 -0
index 7c87a53..4c2c94b 100644
@@ -530,6 +530,31 @@ static inline void _ipn3ke_indrct_write(struct ipn3ke_hw *hw,
 #define IPN3KE_CLF_MHL_RES_MASK    0xFFFFFFFF
 #define IPN3KE_CLF_MHL_RES         (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x2000)
 
+int
+ipn3ke_rpst_dev_set_link_up(struct rte_eth_dev *dev);
+int
+ipn3ke_rpst_dev_set_link_down(struct rte_eth_dev *dev);
+int
+ipn3ke_rpst_link_update(struct rte_eth_dev *ethdev,
+	__rte_unused int wait_to_complete);
+void
+ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev);
+void
+ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev);
+void
+ipn3ke_rpst_allmulticast_enable(struct rte_eth_dev *ethdev);
+void
+ipn3ke_rpst_allmulticast_disable(struct rte_eth_dev *ethdev);
+int
+ipn3ke_rpst_mac_addr_set(struct rte_eth_dev *ethdev,
+		struct ether_addr *mac_addr);
+int
+ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu);
+
+int
+ipn3ke_rpst_init(struct rte_eth_dev *ethdev, void *init_params);
+int
+ipn3ke_rpst_uninit(struct rte_eth_dev *ethdev);
 
 
 /* IPN3KE_MASK is a macro used on 32 bit registers */
drivers/net/ipn3ke/ipn3ke_representor.c new file +887 -0

887 lines not on this page · raw message

drivers/net/ipn3ke/meson.build +2 -1
index b511600..ec77390 100644
@@ -10,5 +10,6 @@
 #
 allow_experimental_apis = true
 
-sources += files('ipn3ke_ethdev.c')
+sources += files('ipn3ke_ethdev.c',
+	'ipn3ke_representor.c')
 deps += ['bus_ifpga', 'sched']
Signature · 1 line
1.8.3.1
author
#117 lore raw

PATCH v6 5/14 net/ipn3ke: add IPN3KE TM of PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE TM of PMD driver.

---
 drivers/net/ipn3ke/Makefile             |    1 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c      |    3 +
 drivers/net/ipn3ke/ipn3ke_ethdev.h      |    7 +
 drivers/net/ipn3ke/ipn3ke_representor.c |    5 +
 drivers/net/ipn3ke/ipn3ke_tm.c          | 2068 +++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/meson.build          |    3 +-
 6 files changed, 2086 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c
drivers/net/ipn3ke/Makefile +1 -0
index 221567d..38d9384 100644
@@ -34,5 +34,6 @@ LIBABIVER := 1
 #
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_representor.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_tm.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c +3 -0
index 146d796..29828f3 100644
@@ -274,6 +274,9 @@
 	hw->flow_hw_enable = 0;
 	if (afu_dev->id.uuid.uuid_low == IPN3KE_UUID_VBNG_LOW &&
 		afu_dev->id.uuid.uuid_high == IPN3KE_UUID_VBNG_HIGH) {
+		ret = ipn3ke_hw_tm_init(hw);
+		if (ret)
+			return ret;
 		hw->tm_hw_enable = 1;
 		hw->flow_hw_enable = 1;
 	}
drivers/net/ipn3ke/ipn3ke_ethdev.h +7 -0
index 4c2c94b..6985a25 100644
@@ -555,6 +555,13 @@ static inline void _ipn3ke_indrct_write(struct ipn3ke_hw *hw,
 ipn3ke_rpst_init(struct rte_eth_dev *ethdev, void *init_params);
 int
 ipn3ke_rpst_uninit(struct rte_eth_dev *ethdev);
+int
+ipn3ke_hw_tm_init(struct ipn3ke_hw *hw);
+void
+ipn3ke_tm_init(struct ipn3ke_rpst *rpst);
+int
+ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev,
+		void *arg);
 
 
 /* IPN3KE_MASK is a macro used on 32 bit registers */
drivers/net/ipn3ke/ipn3ke_representor.c +5 -0
index 3831982..63098bf 100644
@@ -801,6 +801,8 @@
 	.allmulticast_disable = ipn3ke_rpst_allmulticast_disable,
 	.mac_addr_set         = ipn3ke_rpst_mac_addr_set,
 	.mtu_set              = ipn3ke_rpst_mtu_set,
+
+	.tm_ops_get           = ipn3ke_tm_ops_get,
 };
 
 static uint16_t ipn3ke_rpst_recv_pkts(__rte_unused void *rx_q,
@@ -840,6 +842,9 @@ static uint16_t ipn3ke_rpst_recv_pkts(__rte_unused void *rx_q,
 		return -ENODEV;
 	}
 
+	if (rpst->hw->tm_hw_enable)
+		ipn3ke_tm_init(rpst);
+
 	/* Set representor device ops */
 	ethdev->dev_ops = &ipn3ke_rpst_dev_ops;
 
drivers/net/ipn3ke/ipn3ke_tm.c new file +2068 -0

2,068 lines not on this page · raw message

drivers/net/ipn3ke/meson.build +2 -1
index ec77390..3a95efc 100644
@@ -11,5 +11,6 @@
 allow_experimental_apis = true
 
 sources += files('ipn3ke_ethdev.c',
-	'ipn3ke_representor.c')
+	'ipn3ke_representor.c',
+	'ipn3ke_tm.c')
 deps += ['bus_ifpga', 'sched']
Signature · 1 line
1.8.3.1
author
#118 lore raw

PATCH v6 6/14 net/ipn3ke: add IPN3KE Flow of PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE Flow of PMD driver.

---
 drivers/net/ipn3ke/Makefile             |    1 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c      |    5 +
 drivers/net/ipn3ke/ipn3ke_ethdev.h      |    1 +
 drivers/net/ipn3ke/ipn3ke_flow.c        | 1374 +++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h        |  106 +++
 drivers/net/ipn3ke/ipn3ke_representor.c |    3 +-
 drivers/net/ipn3ke/ipn3ke_tm.c          |    1 +
 drivers/net/ipn3ke/meson.build          |    3 +-
 8 files changed, 1492 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.h
drivers/net/ipn3ke/Makefile +1 -0
index 38d9384..8c3ae37 100644
@@ -35,5 +35,6 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_representor.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_tm.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_flow.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c +5 -0
index 29828f3..16893c7 100644
@@ -21,6 +21,7 @@
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
+#include "ipn3ke_flow.h"
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
@@ -278,6 +279,10 @@
 		if (ret)
 			return ret;
 		hw->tm_hw_enable = 1;
+
+		ret = ipn3ke_flow_init(hw);
+		if (ret)
+			return ret;
 		hw->flow_hw_enable = 1;
 	}
 
drivers/net/ipn3ke/ipn3ke_ethdev.h +1 -0
index 6985a25..948a57e 100644
@@ -291,6 +291,7 @@ struct ipn3ke_hw {
 	uint32_t acc_tm;
 	uint32_t acc_flow;
 
+	struct ipn3ke_flow_list flow_list;
 	uint32_t flow_max_entries;
 	uint32_t flow_num_entries;
 
drivers/net/ipn3ke/ipn3ke_flow.c new file +1374 -0

1,374 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_flow.h new file +106 -0

106 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_representor.c +2 -1
index 63098bf..cf3b214 100644
@@ -21,6 +21,7 @@
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
+#include "ipn3ke_flow.h"
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
@@ -746,7 +747,7 @@
 		case RTE_ETH_FILTER_GENERIC:
 			if (filter_op != RTE_ETH_FILTER_GET)
 				return -EINVAL;
-			*(const void **)arg = NULL;
+			*(const void **)arg = &ipn3ke_flow_ops;
 			break;
 		default:
 			IPN3KE_AFU_PMD_WARN("Filter type (%d) not supported",
drivers/net/ipn3ke/ipn3ke_tm.c +1 -0
index 4ca4c97..ef87a41 100644
@@ -23,6 +23,7 @@
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
+#include "ipn3ke_flow.h"
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
drivers/net/ipn3ke/meson.build +2 -1
index 3a95efc..74b4d7c 100644
@@ -12,5 +12,6 @@ allow_experimental_apis = true
 
 sources += files('ipn3ke_ethdev.c',
 	'ipn3ke_representor.c',
-	'ipn3ke_tm.c')
+	'ipn3ke_tm.c',
+	'ipn3ke_flow.c')
 deps += ['bus_ifpga', 'sched']
Signature · 1 line
1.8.3.1
author
#119 lore raw

PATCH v6 7/14 raw/ifpga_rawdev: clean up code for ifpga share code

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

clean up code:
1. use opae_memcpy instead of memcpy
2. use opae_memset instead of memset
3. disable opae_adapter_dump by default

---
 drivers/raw/ifpga_rawdev/base/ifpga_api.c               |  2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c       |  4 ++--
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c            |  2 +-
 drivers/raw/ifpga_rawdev/base/opae_debug.c              | 16 ++++++++--------
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c             |  2 +-
 drivers/raw/ifpga_rawdev/base/opae_osdep.h              |  1 +
 drivers/raw/ifpga_rawdev/base/osdep_raw/osdep_generic.h |  1 +
 drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h |  2 ++
 8 files changed, 17 insertions(+), 13 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +1 -1
index 540e171..77d9471 100644
@@ -202,7 +202,7 @@ static int ifpga_adapter_enumerate(struct opae_adapter *adapter)
 	struct ifpga_hw *hw = malloc(sizeof(*hw));
 
 	if (hw) {
-		memset(hw, 0, sizeof(*hw));
+		opae_memset(hw, 0, sizeof(*hw));
 		hw->pci_data = adapter->data;
 		hw->adapter = adapter;
 		if (ifpga_bus_enumerate(hw))
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -2
index be7ac9e..0a27c38 100644
@@ -77,8 +77,8 @@ int fpga_get_afu_uuid(struct ifpga_port_hw *port, struct uuid *uuid)
 	guidh = readq(&port_hdr->afu_header.guid.b[8]);
 	spinlock_unlock(&port->lock);
 
-	memcpy(uuid->b, &guidl, sizeof(u64));
-	memcpy(uuid->b + 8, &guidh, sizeof(u64));
+	opae_memcpy(uuid->b, &guidl, sizeof(u64));
+	opae_memcpy(uuid->b + 8, &guidh, sizeof(u64));
 
 	return 0;
 }
drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c +1 -1
index ec0beeb..8890f4b 100644
@@ -257,7 +257,7 @@ static int fme_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 		return -EINVAL;
 	}
 
-	memset(&info, 0, sizeof(struct fpga_pr_info));
+	opae_memset(&info, 0, sizeof(struct fpga_pr_info));
 	info.flags = FPGA_MGR_PARTIAL_RECONFIG;
 	info.port_id = port_id;
 
drivers/raw/ifpga_rawdev/base/opae_debug.c +8 -8
index 024d7d2..88f2d5c 100644
@@ -78,13 +78,13 @@ void opae_adapter_dump(struct opae_adapter *adapter, int verbose)
 {
 	struct opae_accelerator *acc;
 
-	opae_log("=====%s=====\n", __func__);
-	opae_log("OPAE Adapter %s\n", adapter->name);
-	opae_log("OPAE Adapter OPs = %p\n", adapter->ops);
-	opae_log("OPAE Adapter Private Data = %p\n", adapter->data);
-	opae_log("OPAE Manager (downstream) = %p\n", adapter->mgr);
-
 	if (verbose) {
+		opae_log("=====%s=====\n", __func__);
+		opae_log("OPAE Adapter %s\n", adapter->name);
+		opae_log("OPAE Adapter OPs = %p\n", adapter->ops);
+		opae_log("OPAE Adapter Private Data = %p\n", adapter->data);
+		opae_log("OPAE Manager (downstream) = %p\n", adapter->mgr);
+
 		if (adapter->mgr)
 			opae_manager_dump(adapter->mgr);
 
@@ -93,7 +93,7 @@ void opae_adapter_dump(struct opae_adapter *adapter, int verbose)
 
 		if (adapter->data)
 			opae_adapter_data_dump(adapter->data);
-	}
 
-	opae_log("==========================\n");
+		opae_log("==========================\n");
+	}
 }
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +1 -1
index 1541b67..41c5903 100644
@@ -341,7 +341,7 @@ int opae_adapter_enumerate(struct opae_adapter *adapter)
 		ret = adapter->ops->enumerate(adapter);
 
 	if (!ret)
-		opae_adapter_dump(adapter, 1);
+		opae_adapter_dump(adapter, 0);
 
 	return ret;
 }
drivers/raw/ifpga_rawdev/base/opae_osdep.h +1 -0
index 90f54f7..78fec50 100644
@@ -76,4 +76,5 @@ struct uuid {
 #define msleep(x) opae_udelay(1000 * (x))
 #define usleep_range(min, max) msleep(DIV_ROUND_UP(min, 1000))
 
+#define opae_memset(a, b, c)    memset((a), (b), (c))
 #endif
drivers/raw/ifpga_rawdev/base/osdep_raw/osdep_generic.h +1 -0
index 895a1d8..6769109 100644
@@ -71,5 +71,6 @@ static inline void opae_writeq(uint64_t value, volatile void *addr)
 }
 
 #define opae_free(addr) free(addr)
+#define opae_memcpy(a, b, c) memcpy((a), (b), (c))
 
 #endif
drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h +2 -0
index 76902e2..3d9a0ca 100644
@@ -11,6 +11,7 @@
 #include <rte_log.h>
 #include <rte_io.h>
 #include <rte_malloc.h>
+#include <rte_memcpy.h>
 
 #define dev_printf(level, fmt, args...) \
 	RTE_LOG(level, PMD, "osdep_rte: " fmt, ## args)
@@ -42,4 +43,5 @@
 #define spinlock_lock(x) rte_spinlock_lock(x)
 #define spinlock_unlock(x) rte_spinlock_unlock(x)
 
+#define opae_memcpy(a, b, c) rte_memcpy((a), (b), (c))
 #endif
Signature · 1 line
1.8.3.1
author
#120 lore raw

PATCH v6 8/14 raw/ifpga_rawdev: store private features in FME and Port

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

Get private features attrubite like size, id, address after enumeration, and insert into FEM or Port dedicate list.

when initial the private feature driver, we just compare the private feature id between the list and feature drivers array to match the proper drivers.

This patch avoid the hardcore in feature_info array in previous implementation. and the same time we can use one driver for mulitple devices which the id is the same.

---
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |  46 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   | 347 ++++++++--------------
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c | 160 +++++++---
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |  46 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         |  32 ++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |  16 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c        |  21 ++
 7 files changed, 363 insertions(+), 305 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +20 -26
index aa02527..217d0b1 100644
@@ -15,6 +15,7 @@
 #define FME_FEATURE_GLOBAL_IPERF    "fme_iperf"
 #define FME_FEATURE_GLOBAL_ERR      "fme_error"
 #define FME_FEATURE_PR_MGMT         "fme_pr"
+#define FME_FEATURE_EMIF_MGMT       "fme_emif"
 #define FME_FEATURE_HSSI_ETH        "fme_hssi"
 #define FME_FEATURE_GLOBAL_DPERF    "fme_dperf"
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
@@ -59,7 +60,8 @@
 #define FEATURE_FIU_ID_FME	0x0
 #define FEATURE_FIU_ID_PORT	0x1
 
-#define FEATURE_ID_HEADER	0x0
+/* Reserved 0xfe for Header, 0xff for AFU*/
+#define FEATURE_ID_FIU_HEADER	0xfe
 #define FEATURE_ID_AFU		0xff
 
 enum fpga_id_type {
@@ -68,31 +70,23 @@ enum fpga_id_type {
 	FPGA_ID_MAX,
 };
 
-enum fme_feature_id {
-	FME_FEATURE_ID_HEADER = 0x0,
-
-	FME_FEATURE_ID_THERMAL_MGMT	= 0x1,
-	FME_FEATURE_ID_POWER_MGMT = 0x2,
-	FME_FEATURE_ID_GLOBAL_IPERF = 0x3,
-	FME_FEATURE_ID_GLOBAL_ERR = 0x4,
-	FME_FEATURE_ID_PR_MGMT = 0x5,
-	FME_FEATURE_ID_HSSI_ETH = 0x6,
-	FME_FEATURE_ID_GLOBAL_DPERF = 0x7,
-	FME_FEATURE_ID_QSPI_FLASH = 0x8,
-
-	/* one for fme header. */
-	FME_FEATURE_ID_MAX = 0x9,
-};
-
-enum port_feature_id {
-	PORT_FEATURE_ID_HEADER = 0x0,
-	PORT_FEATURE_ID_ERROR = 0x1,
-	PORT_FEATURE_ID_UMSG = 0x2,
-	PORT_FEATURE_ID_UINT = 0x3,
-	PORT_FEATURE_ID_STP = 0x4,
-	PORT_FEATURE_ID_UAFU = 0x5,
-	PORT_FEATURE_ID_MAX = 0x6,
-};
+#define FME_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
+#define FME_FEATURE_ID_THERMAL_MGMT 0x1
+#define FME_FEATURE_ID_POWER_MGMT 0x2
+#define FME_FEATURE_ID_GLOBAL_IPERF 0x3
+#define FME_FEATURE_ID_GLOBAL_ERR 0x4
+#define FME_FEATURE_ID_PR_MGMT 0x5
+#define FME_FEATURE_ID_HSSI_ETH 0x6
+#define FME_FEATURE_ID_GLOBAL_DPERF 0x7
+#define FME_FEATURE_ID_QSPI_FLASH 0x8
+#define FME_FEATURE_ID_EMIF_MGMT  0x9
+
+#define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
+#define PORT_FEATURE_ID_ERROR 0x10
+#define PORT_FEATURE_ID_UMSG 0x12
+#define PORT_FEATURE_ID_UINT 0x13
+#define PORT_FEATURE_ID_STP 0x14
+#define PORT_FEATURE_ID_UAFU FEATURE_ID_AFU
 
 /*
  * All headers and structures must be byte-packed to match the spec.
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +122 -225

546 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +116 -44

199 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +38 -8

92 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme.c +32 -0
index 4be60c0..9451086 100644
@@ -732,3 +732,35 @@ struct feature_ops fme_power_mgmt_ops = {
 	.get_prop = fme_power_mgmt_get_prop,
 	.set_prop = fme_power_mgmt_set_prop,
 };
+
+static int fme_hssi_eth_init(struct feature *feature)
+{
+	UNUSED(feature);
+	return 0;
+}
+
+static void fme_hssi_eth_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+}
+
+struct feature_ops fme_hssi_eth_ops = {
+	.init = fme_hssi_eth_init,
+	.uinit = fme_hssi_eth_uinit,
+};
+
+static int fme_emif_init(struct feature *feature)
+{
+	UNUSED(feature);
+	return 0;
+}
+
+static void fme_emif_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+}
+
+struct feature_ops fme_emif_ops = {
+	.init = fme_emif_init,
+	.uinit = fme_emif_uinit,
+};
drivers/raw/ifpga_rawdev/base/ifpga_hw.h +14 -2
index a20520c..8aaa056 100644
@@ -8,18 +8,28 @@
 #include "ifpga_defines.h"
 #include "opae_ifpga_hw_api.h"
 
+/** List of private feateues */
+TAILQ_HEAD(ifpga_feature_list, feature);
+
 enum ifpga_feature_state {
 	IFPGA_FEATURE_UNUSED = 0,
 	IFPGA_FEATURE_ATTACHED,
 };
 
+enum feature_type {
+	FEATURE_FME_TYPE = 0,
+	FEATURE_PORT_TYPE,
+};
+
 struct feature_irq_ctx {
 	int eventfd;
 	int idx;
 };
 
 struct feature {
+	TAILQ_ENTRY(feature)next;
 	enum ifpga_feature_state state;
+	enum feature_type type;
 	const char *name;
 	u64 id;
 	u8 *addr;
@@ -34,6 +44,8 @@ struct feature {
 	void *parent;		/* to parent hw data structure */
 
 	struct feature_ops *ops;/* callback to this private feature */
+	unsigned int vec_start;
+	unsigned int vec_cnt;
 };
 
 struct feature_ops {
@@ -52,7 +64,7 @@ enum ifpga_fme_state {
 struct ifpga_fme_hw {
 	enum ifpga_fme_state state;
 
-	struct feature sub_feature[FME_FEATURE_ID_MAX];
+	struct ifpga_feature_list feature_list;
 	spinlock_t lock;	/* protect hardware access */
 
 	void *parent;		/* pointer to ifpga_hw */
@@ -78,7 +90,7 @@ enum ifpga_port_state {
 struct ifpga_port_hw {
 	enum ifpga_port_state state;
 
-	struct feature sub_feature[PORT_FEATURE_ID_MAX];
+	struct ifpga_feature_list feature_list;
 	spinlock_t lock;	/* protect access to hw */
 
 	void *parent;		/* pointer to ifpga_hw */
drivers/raw/ifpga_rawdev/base/ifpga_port.c +21 -0
index 8b5668d..4628783 100644
@@ -386,3 +386,24 @@ struct feature_ops ifpga_rawdev_port_uint_ops = {
 	.init = port_uint_init,
 	.uinit = port_uint_uinit,
 };
+
+static int port_afu_init(struct feature *feature)
+{
+	UNUSED(feature);
+
+	dev_info(NULL, "PORT AFU Init.\n");
+
+	return 0;
+}
+
+static void port_afu_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+
+	dev_info(NULL, "PORT AFU UInit.\n");
+}
+
+struct feature_ops ifpga_rawdev_port_afu_ops = {
+	.init = port_afu_init,
+	.uinit = port_afu_uinit,
+};
Signature · 1 line
1.8.3.1
author
#121 lore raw

PATCH v6 9/14 raw/ifpga_rawdev: add SPI and MAX10 device driver

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

There is a SPI bus link between A10 FPGA and MAX10 FPGA. MAX10 is in charge of board management, like power management, sensors, flash devices.

---
 drivers/raw/ifpga_rawdev/base/Makefile             |   3 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |   5 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  |   4 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          | 196 +++++++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |   2 +
 drivers/raw/ifpga_rawdev/base/meson.build          |   5 +-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |   1 +
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   |  88 +++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |  60 +++
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |   4 +
 drivers/raw/ifpga_rawdev/base/opae_spi.c           | 304 ++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           | 160 ++++++++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   | 438 +++++++++++++++++++++
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |  14 +
 15 files changed, 1285 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c
drivers/raw/ifpga_rawdev/base/Makefile +3 -0
index d79da72..c6f51a8 100644
@@ -22,5 +22,8 @@ SRCS-y += opae_hw_api.c
 SRCS-y += opae_ifpga_hw_api.c
 SRCS-y += opae_debug.c
 SRCS-y += ifpga_fme_pr.c
+SRCS-y += opae_spi.c
+SRCS-y += opae_spi_transaction.c
+SRCS-y += opae_intel_max10.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +5 -0
index 217d0b1..f5e22ae 100644
@@ -19,6 +19,8 @@
 #define FME_FEATURE_HSSI_ETH        "fme_hssi"
 #define FME_FEATURE_GLOBAL_DPERF    "fme_dperf"
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
+#define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
+#define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -43,6 +45,7 @@
 #define FME_HSSI_ETH_REVISION		0
 #define FME_GLOBAL_DPERF_REVISION	0
 #define FME_QSPI_REVISION		0
+#define FME_MAX10_SPI                   0
 
 #define PORT_HEADER_REVISION		0
 /* UAFU's header info depends on the downloaded GBS */
@@ -80,6 +83,8 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_GLOBAL_DPERF 0x7
 #define FME_FEATURE_ID_QSPI_FLASH 0x8
 #define FME_FEATURE_ID_EMIF_MGMT  0x9
+#define FME_FEATURE_ID_MAX10_SPI  0xe
+#define FME_FEATURE_ID_NIOS_SPI 0xd
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +4 -0
index d82a890..2a35c06 100644
@@ -197,6 +197,10 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_hssi_eth_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_EMIF_MGMT, FME_FEATURE_EMIF_MGMT,
 	&fme_emif_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_MAX10_SPI, FME_FEATURE_MAX10_SPI,
+	&fme_spi_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_NIOS_SPI, FME_FEATURE_NIOS_SPI,
+	&fme_nios_spi_master_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +2 -0
index 1d80f1d..72352ee 100644
@@ -171,6 +171,8 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_global_dperf_ops;
 extern struct feature_ops fme_hssi_eth_ops;
 extern struct feature_ops fme_emif_ops;
+extern struct feature_ops fme_spi_master_ops;
+extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
 int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +196 -0

205 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +2 -0
index 8aaa056..a2f4776 100644
@@ -79,6 +79,8 @@ struct ifpga_fme_hw {
 	u32 cache_size;
 
 	u32 capability;
+
+	void *max10_dev; /* MAX10 device */
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +4 -1
index 03f5112..6bc762f 100644
@@ -14,7 +14,10 @@ sources = [
 	'ifpga_fme_pr.c',
 	'opae_hw_api.c',
 	'opae_ifpga_hw_api.c',
-	'opae_debug.c'
+	'opae_debug.c',
+	'opae_spi.c',
+	'opae_spi_transaction.c',
+	'opae_intel_max10.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_hw_api.h +1 -0
index 332e0f3..76224b4 100644
@@ -11,6 +11,7 @@
 #include <sys/queue.h>
 
 #include "opae_osdep.h"
+#include "opae_intel_max10.h"
 
 #ifndef PCI_MAX_RESOURCE
 #define PCI_MAX_RESOURCE 6
drivers/raw/ifpga_rawdev/base/opae_intel_max10.c new file +88 -0

88 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_intel_max10.h new file +60 -0

60 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_osdep.h +4 -0
index 78fec50..d710ec0 100644
@@ -35,6 +35,7 @@ struct uuid {
 #ifndef BIT
 #define BIT(a) (1UL << (a))
 #endif /* BIT */
+#define U64_C(x) x ## ULL
 #ifndef BIT_ULL
 #define BIT_ULL(a) (1ULL << (a))
 #endif /* BIT_ULL */
@@ -76,5 +77,8 @@ struct uuid {
 #define msleep(x) opae_udelay(1000 * (x))
 #define usleep_range(min, max) msleep(DIV_ROUND_UP(min, 1000))
 
+#define time_after(a, b)	((long)((b) - (a)) < 0)
+#define time_before(a, b)	time_after(b, a)
 #define opae_memset(a, b, c)    memset((a), (b), (c))
+
 #endif
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +304 -0

304 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_spi.h new file +160 -0

160 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +438 -0

438 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h +14 -0
index 3d9a0ca..3ff49a8 100644
@@ -11,6 +11,7 @@
 #include <rte_log.h>
 #include <rte_io.h>
 #include <rte_malloc.h>
+#include <rte_byteorder.h>
 #include <rte_memcpy.h>
 
 #define dev_printf(level, fmt, args...) \
@@ -43,5 +44,18 @@
 #define spinlock_lock(x) rte_spinlock_lock(x)
 #define spinlock_unlock(x) rte_spinlock_unlock(x)
 
+#define cpu_to_be16(o) rte_cpu_to_be_16(o)
+#define cpu_to_be32(o) rte_cpu_to_be_32(o)
+#define cpu_to_be64(o) rte_cpu_to_be_64(o)
+#define cpu_to_le16(o) rte_cpu_to_le_16(o)
+#define cpu_to_le32(o) rte_cpu_to_le_32(o)
+#define cpu_to_le64(o) rte_cpu_to_le_64(o)
+
 #define opae_memcpy(a, b, c) rte_memcpy((a), (b), (c))
+
+static inline unsigned long msecs_to_timer_cycles(unsigned int m)
+{
+	return rte_get_timer_hz() * (m / 1000);
+}
+
 #endif
Signature · 1 line
1.8.3.1
author
#122 lore raw

PATCH v6 10/14 raw/ifpga_rawdev: add I2C and at24 EEPROM driver

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

1. Add Altera I2C master device driver
2. Add at24 eeprom driver which is i2c slave device
3. Introducing a new ops for opae_manager: opae_manager_networking_ops. This ops will include some networking operation by FPGA, like vBNG operation, MAC ROM operation and so on.

---
 drivers/raw/ifpga_rawdev/base/Makefile            |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c         |  22 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.h         |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |   3 +
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |   2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |   7 +
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         |  90 ++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |   1 +
 drivers/raw/ifpga_rawdev/base/meson.build         |   2 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c  |  88 ++++
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h  |  14 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c       |  49 ++-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h       |  26 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c          | 490 ++++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h          | 130 ++++++
 16 files changed, 926 insertions(+), 3 deletions(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.h
drivers/raw/ifpga_rawdev/base/Makefile +2 -0
index c6f51a8..edb538f 100644
@@ -25,5 +25,7 @@ SRCS-y += ifpga_fme_pr.c
 SRCS-y += opae_spi.c
 SRCS-y += opae_spi_transaction.c
 SRCS-y += opae_intel_max10.c
+SRCS-y += opae_i2c.c
+SRCS-y += opae_at24_eeprom.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +22 -0
index 77d9471..c447b3c 100644
@@ -196,6 +196,28 @@ struct opae_manager_ops ifpga_mgr_ops = {
 	.flash = ifpga_mgr_flash,
 };
 
+static int ifpga_mgr_read_mac_rom(struct opae_manager *mgr, int offset,
+		void *buf, int size)
+{
+	struct ifpga_fme_hw *fme = mgr->data;
+
+	return fme_mgr_read_mac_rom(fme, offset, buf, size);
+}
+
+static int ifpga_mgr_write_mac_rom(struct opae_manager *mgr, int offset,
+		void *buf, int size)
+{
+	struct ifpga_fme_hw *fme = mgr->data;
+
+	return fme_mgr_write_mac_rom(fme, offset, buf, size);
+}
+
+/* Network APIs in FME */
+struct opae_manager_networking_ops ifpga_mgr_network_ops = {
+	.read_mac_rom = ifpga_mgr_read_mac_rom,
+	.write_mac_rom = ifpga_mgr_write_mac_rom,
+};
+
 /* Adapter APIs */
 static int ifpga_adapter_enumerate(struct opae_adapter *adapter)
 {
drivers/raw/ifpga_rawdev/base/ifpga_api.h +1 -0
index dae7ca1..4a24769 100644
@@ -12,6 +12,7 @@
 extern struct opae_manager_ops ifpga_mgr_ops;
 extern struct opae_bridge_ops ifpga_br_ops;
 extern struct opae_accelerator_ops ifpga_acc_ops;
+extern struct opae_manager_networking_ops ifpga_mgr_network_ops;
 
 /* common APIs */
 int ifpga_get_prop(struct ifpga_hw *hw, u32 fiu_id, u32 port_id,
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +3 -0
index f5e22ae..62f71c7 100644
@@ -21,6 +21,7 @@
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
 #define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
 #define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
+#define FME_FEATURE_I2C_MASTER      "fme_i2c_master"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -46,6 +47,7 @@
 #define FME_GLOBAL_DPERF_REVISION	0
 #define FME_QSPI_REVISION		0
 #define FME_MAX10_SPI                   0
+#define FME_I2C_MASTER                  0
 
 #define PORT_HEADER_REVISION		0
 /* UAFU's header info depends on the downloaded GBS */
@@ -85,6 +87,7 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_EMIF_MGMT  0x9
 #define FME_FEATURE_ID_MAX10_SPI  0xe
 #define FME_FEATURE_ID_NIOS_SPI 0xd
+#define FME_FEATURE_ID_I2C_MASTER  0xf
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +1 -1
index c779e0c..666dae1 100644
@@ -270,7 +270,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 
 	} else if (binfo->current_type == FME_ID) {
 		mgr = opae_manager_alloc(hw->adapter->name, &ifpga_mgr_ops,
-				binfo->fiu);
+				&ifpga_mgr_network_ops, binfo->fiu);
 		if (!mgr)
 			return -ENOMEM;
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -0
index 2a35c06..0454f80 100644
@@ -201,6 +201,8 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_spi_master_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_NIOS_SPI, FME_FEATURE_NIOS_SPI,
 	&fme_nios_spi_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_I2C_MASTER, FME_FEATURE_I2C_MASTER,
+	&fme_i2c_master_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +7 -0
index 72352ee..a398a98 100644
@@ -172,6 +172,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_hssi_eth_ops;
 extern struct feature_ops fme_emif_ops;
 extern struct feature_ops fme_spi_master_ops;
+extern struct feature_ops fme_i2c_master_ops;
 extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
@@ -197,4 +198,10 @@ struct fpga_uafu_irq_set {
 /* help functions for feature ops */
 int fpga_msix_set_block(struct feature *feature, unsigned int start,
 			unsigned int count, s32 *fds);
+
+/* FME network function ops*/
+int fme_mgr_read_mac_rom(struct ifpga_fme_hw *fme, int offset,
+		void *buf, int size);
+int fme_mgr_write_mac_rom(struct ifpga_fme_hw *fme, int offset,
+		void *buf, int size);
 #endif /* _IFPGA_FEATURE_DEV_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +90 -0

99 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +1 -0
index a2f4776..e296dd2 100644
@@ -81,6 +81,7 @@ struct ifpga_fme_hw {
 	u32 capability;
 
 	void *max10_dev; /* MAX10 device */
+	void *i2c_master; /* I2C Master device */
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +2 -0
index 6bc762f..7655985 100644
@@ -18,6 +18,8 @@ sources = [
 	'opae_spi.c',
 	'opae_spi_transaction.c',
 	'opae_intel_max10.c',
+	'opae_i2c.c',
+	'opae_at24_eeprom.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c new file +88 -0

88 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h new file +14 -0
new file mode 100644
index 0000000..caae9a3
@@ -0,0 +1,14 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#define AT24C512_PAGE_SIZE 128
+#define AT24C512_IO_LIMIT  128
+
+#define AT24512_SLAVE_ADDR 0x51
+
+int at24_eeprom_read(struct altera_i2c_dev *dev, unsigned int slave_addr,
+		u32 offset, u8 *buf, int count);
+int at24_eeprom_write(struct altera_i2c_dev *dev, unsigned int slave_addr,
+		u32 offset, u8 *buf, int count);
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +48 -1

69 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.h +25 -1
index 76224b4..826da37 100644
@@ -26,6 +26,7 @@ enum opae_adapter_type {
 
 /* OPAE Manager Data Structure */
 struct opae_manager_ops;
+struct opae_manager_networking_ops;
 
 /*
  * opae_manager has pointer to its parent adapter, as it could be able to manage
@@ -36,6 +37,7 @@ struct opae_manager {
 	const char *name;
 	struct opae_adapter *adapter;
 	struct opae_manager_ops *ops;
+	struct opae_manager_networking_ops *network_ops;
 	void *data;
 };
 
@@ -45,9 +47,18 @@ struct opae_manager_ops {
 		     u32 size, u64 *status);
 };
 
+/* networking management ops in FME */
+struct opae_manager_networking_ops {
+	int (*read_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
+			int size);
+	int (*write_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
+			int size);
+};
+
 /* OPAE Manager APIs */
 struct opae_manager *
-opae_manager_alloc(const char *name, struct opae_manager_ops *ops, void *data);
+opae_manager_alloc(const char *name, struct opae_manager_ops *ops,
+		struct opae_manager_networking_ops *network_ops, void *data);
 #define opae_manager_free(mgr) opae_free(mgr)
 int opae_manager_flash(struct opae_manager *mgr, int acc_id, void *buf,
 		       u32 size, u64 *status);
@@ -252,4 +263,17 @@ static inline void opae_adapter_remove_acc(struct opae_adapter *adapter,
 {
 	TAILQ_REMOVE(&adapter->acc_list, acc, node);
 }
+
+/* OPAE vBNG network datastruct */
+#define OPAE_ETHER_ADDR_LEN 6
+
+struct opae_ether_addr {
+	unsigned char addr_bytes[OPAE_ETHER_ADDR_LEN];
+} __attribute__((__packed__));
+
+/* OPAE vBNG network API*/
+int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
+		struct opae_ether_addr *addr);
+int opae_manager_write_mac_rom(struct opae_manager *mgr, int port,
+		struct opae_ether_addr *addr);
 #endif /* _OPAE_HW_API_H_*/
drivers/raw/ifpga_rawdev/base/opae_i2c.c new file +490 -0

490 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_i2c.h new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author
#123 lore raw

PATCH v6 11/14 raw/ifpga_rawdev: add eth group driver

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

There is two eth group devices in PAC N3000 card, each eth group include PHY device and MAC device. Exposing APIs for DPDK PMD driver to access those devices.

---
 drivers/raw/ifpga_rawdev/base/Makefile            |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c         |  74 ++++++-
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |  39 ++++
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |   6 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |  12 ++
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         | 250 ++++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |   7 +
 drivers/raw/ifpga_rawdev/base/meson.build         |   1 +
 drivers/raw/ifpga_rawdev/base/opae_eth_group.c    | 145 +++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_eth_group.h    |  96 +++++++++
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c       | 149 +++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h       |  27 +++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h  |  42 +++-
 drivers/raw/ifpga_rawdev/base/opae_osdep.h        |  16 +-
 15 files changed, 858 insertions(+), 9 deletions(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.h
drivers/raw/ifpga_rawdev/base/Makefile +1 -0
index edb538f..c5bbcbd 100644
@@ -27,5 +27,6 @@ SRCS-y += opae_spi_transaction.c
 SRCS-y += opae_intel_max10.c
 SRCS-y += opae_i2c.c
 SRCS-y += opae_at24_eeprom.c
+SRCS-y += opae_eth_group.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +73 -1

98 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_defines.h +39 -0
index 62f71c7..b7151ca 100644
@@ -22,6 +22,7 @@
 #define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
 #define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
 #define FME_FEATURE_I2C_MASTER      "fme_i2c_master"
+#define FME_FEATURE_ETH_GROUP       "fme_eth_group"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -88,6 +89,7 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_MAX10_SPI  0xe
 #define FME_FEATURE_ID_NIOS_SPI 0xd
 #define FME_FEATURE_ID_I2C_MASTER  0xf
+#define FME_FEATURE_ID_ETH_GROUP 0x10
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
@@ -1661,5 +1663,42 @@ struct bts_header {
 	(((bts_hdr)->guid_h == GBS_GUID_H) &&		\
 	((bts_hdr)->guid_l == GBS_GUID_L))
 
+/* bitstream id definition */
+struct fme_bitstream_id {
+	union {
+		u64 id;
+		struct {
+			u64 hash:32;
+			u64 interface:4;
+			u64 reserved:12;
+			u64 debug:4;
+			u64 patch:4;
+			u64 minor:4;
+			u64 major:4;
+		};
+	};
+};
+
+enum board_interface {
+	VC_8_10G = 0,
+	VC_4_25G = 1,
+	VC_2_1_25 = 2,
+	VC_4_25G_2_25G = 3,
+	VC_2_2_25G = 4,
+};
+
+struct ifpga_fme_board_info {
+	enum board_interface type;
+	u32 build_hash;
+	u32 debug_version;
+	u32 patch_version;
+	u32 minor_version;
+	u32 major_version;
+	u32 nums_of_retimer;
+	u32 ports_per_retimer;
+	u32 nums_of_fvl;
+	u32 ports_per_fvl;
+};
+
 #pragma pack(pop)
 #endif /* _BASE_IFPGA_DEFINES_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +6 -0
index 666dae1..44086c1 100644
@@ -232,6 +232,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 	struct opae_bridge *br;
 	struct opae_accelerator *acc;
 	struct ifpga_port_hw *port;
+	struct ifpga_fme_hw *fme;
 	struct feature *feature;
 
 	if (!binfo->fiu)
@@ -264,8 +265,13 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 		}
 
 		acc->br = br;
+		if (hw->adapter->mgr)
+			acc->mgr = hw->adapter->mgr;
 		acc->index = br->id;
 
+		fme = &hw->fme;
+		fme->nums_acc_region = info->num_regions;
+
 		opae_adapter_add_acc(hw->adapter, acc);
 
 	} else if (binfo->current_type == FME_ID) {
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -0
index 0454f80..5ebc449 100644
@@ -203,6 +203,8 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_nios_spi_master_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_I2C_MASTER, FME_FEATURE_I2C_MASTER,
 	&fme_i2c_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_ETH_GROUP, FME_FEATURE_ETH_GROUP,
+	&fme_eth_group_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +12 -0
index a398a98..3f63f5a 100644
@@ -173,6 +173,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_emif_ops;
 extern struct feature_ops fme_spi_master_ops;
 extern struct feature_ops fme_i2c_master_ops;
+extern struct feature_ops fme_eth_group_ops;
 extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
@@ -204,4 +205,15 @@ int fme_mgr_read_mac_rom(struct ifpga_fme_hw *fme, int offset,
 		void *buf, int size);
 int fme_mgr_write_mac_rom(struct ifpga_fme_hw *fme, int offset,
 		void *buf, int size);
+int fme_mgr_get_eth_group_nums(struct ifpga_fme_hw *fme);
+int fme_mgr_get_eth_group_info(struct ifpga_fme_hw *fme,
+		u8 group_id, struct opae_eth_group_info *info);
+int fme_mgr_eth_group_read_reg(struct ifpga_fme_hw *fme, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 *data);
+int fme_mgr_eth_group_write_reg(struct ifpga_fme_hw *fme, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 data);
+int fme_mgr_get_retimer_info(struct ifpga_fme_hw *fme,
+		struct opae_retimer_info *info);
+int fme_mgr_get_retimer_status(struct ifpga_fme_hw *fme,
+		struct opae_retimer_status *status);
 #endif /* _IFPGA_FEATURE_DEV_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +250 -0

271 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +7 -0
index e296dd2..a428d69 100644
@@ -7,6 +7,7 @@
 
 #include "ifpga_defines.h"
 #include "opae_ifpga_hw_api.h"
+#include "opae_eth_group.h"
 
 /** List of private feateues */
 TAILQ_HEAD(ifpga_feature_list, feature);
@@ -82,6 +83,12 @@ struct ifpga_fme_hw {
 
 	void *max10_dev; /* MAX10 device */
 	void *i2c_master; /* I2C Master device */
+	void *eth_dev[MAX_ETH_GROUP_DEVICES];
+	struct opae_reg_region
+		eth_group_region[MAX_ETH_GROUP_DEVICES];
+	struct ifpga_fme_board_info board_info;
+	int nums_eth_dev;
+	unsigned int nums_acc_region;
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +1 -0
index 7655985..f1015bb 100644
@@ -20,6 +20,7 @@ sources = [
 	'opae_intel_max10.c',
 	'opae_i2c.c',
 	'opae_at24_eeprom.c',
+	'opae_eth_group.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_eth_group.c new file +145 -0

145 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_eth_group.h new file +96 -0

96 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.c +149 -0

152 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.h +27 -0
index 826da37..383e751 100644
@@ -12,6 +12,7 @@
 
 #include "opae_osdep.h"
 #include "opae_intel_max10.h"
+#include "opae_eth_group.h"
 
 #ifndef PCI_MAX_RESOURCE
 #define PCI_MAX_RESOURCE 6
@@ -45,6 +46,8 @@ struct opae_manager {
 struct opae_manager_ops {
 	int (*flash)(struct opae_manager *mgr, int id, void *buffer,
 		     u32 size, u64 *status);
+	int (*get_eth_group_region_info)(struct opae_manager *mgr,
+			struct opae_eth_group_region_info *info);
 };
 
 /* networking management ops in FME */
@@ -53,6 +56,17 @@ struct opae_manager_networking_ops {
 			int size);
 	int (*write_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
 			int size);
+	int (*get_eth_group_nums)(struct opae_manager *mgr);
+	int (*get_eth_group_info)(struct opae_manager *mgr,
+			u8 group_id, struct opae_eth_group_info *info);
+	int (*eth_group_reg_read)(struct opae_manager *mgr, u8 group_id,
+			u8 type, u8 index, u16 addr, u32 *data);
+	int (*eth_group_reg_write)(struct opae_manager *mgr, u8 group_id,
+			u8 type, u8 index, u16 addr, u32 data);
+	int (*get_retimer_info)(struct opae_manager *mgr,
+			struct opae_retimer_info *info);
+	int (*get_retimer_status)(struct opae_manager *mgr,
+			struct opae_retimer_status *status);
 };
 
 /* OPAE Manager APIs */
@@ -62,6 +76,8 @@ struct opae_manager *
 #define opae_manager_free(mgr) opae_free(mgr)
 int opae_manager_flash(struct opae_manager *mgr, int acc_id, void *buf,
 		       u32 size, u64 *status);
+int opae_manager_get_eth_group_region_info(struct opae_manager *mgr,
+		u8 group_id, struct opae_eth_group_region_info *info);
 
 /* OPAE Bridge Data Structure */
 struct opae_bridge_ops;
@@ -276,4 +292,15 @@ int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
 		struct opae_ether_addr *addr);
 int opae_manager_write_mac_rom(struct opae_manager *mgr, int port,
 		struct opae_ether_addr *addr);
+int opae_manager_get_retimer_info(struct opae_manager *mgr,
+		struct opae_retimer_info *info);
+int opae_manager_get_retimer_status(struct opae_manager *mgr,
+		struct opae_retimer_status *status);
+int opae_manager_get_eth_group_nums(struct opae_manager *mgr);
+int opae_manager_get_eth_group_info(struct opae_manager *mgr,
+		u8 group_id, struct opae_eth_group_info *info);
+int opae_manager_eth_group_write_reg(struct opae_manager *mgr, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 data);
+int opae_manager_eth_group_read_reg(struct opae_manager *mgr, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 *data);
 #endif /* _OPAE_HW_API_H_*/
drivers/raw/ifpga_rawdev/base/opae_intel_max10.h +39 -3

54 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_osdep.h +11 -5
index d710ec0..1596adc 100644
@@ -53,12 +53,7 @@ struct uuid {
 #define dev_err(x, args...) dev_printf(ERR, args)
 #define dev_info(x, args...) dev_printf(INFO, args)
 #define dev_warn(x, args...) dev_printf(WARNING, args)
-
-#ifdef OPAE_DEBUG
 #define dev_debug(x, args...) dev_printf(DEBUG, args)
-#else
-#define dev_debug(x, args...) do { } while (0)
-#endif
 
 #define pr_err(y, args...) dev_err(0, y, ##args)
 #define pr_warn(y, args...) dev_warn(0, y, ##args)
@@ -81,4 +76,15 @@ struct uuid {
 #define time_before(a, b)	time_after(b, a)
 #define opae_memset(a, b, c)    memset((a), (b), (c))
 
+#define opae_readq_poll_timeout(addr, val, cond, invl, timeout)\
+({									     \
+	int wait = 0;							     \
+	for (; wait <= timeout; wait += invl) {			     \
+		(val) = opae_readq(addr);				     \
+		if (cond)                  \
+			break;						     \
+		udelay(invl);						     \
+	}								     \
+	(cond) ? 0 : -ETIMEDOUT;	  \
+})
 #endif
Signature · 1 line
1.8.3.1
author
#124 lore raw

PATCH v6 12/14 raw/ifpga_rawdev: add version description on README

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

add verion description on READ about ifpga base code.

---
 drivers/raw/ifpga_rawdev/base/README | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/raw/ifpga_rawdev/base/README +15 -0
index 5bc2ed0..6b2b171 100644
@@ -29,3 +29,18 @@ the following file(s):
 
 	osdep_raw/osdep_generic.h
 	osdep_rte/osdep_generic.h
+
+
+New Features
+==================
+
+2019-03:
+Support Intel FPGA PAC N3000 card.
+Some features added in this version:
+1. Store private features in FME and Port list.
+2. Add eth group devices driver.
+3. Add altera SPI master driver and Intel MAX10 device driver.
+4. Add Altera I2C master driver and AT24 eeprom driver.
+5. Add Device Tree support to get the configuration from card.
+6. Instruding and exposing APIs to DPDK PMD driver to access networking
+functionality.
Signature · 1 line
1.8.3.1
author
#125 lore raw

PATCH v6 13/14 raw/ifpga_rawdev: using prefix name for feature and its ops

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

Using prefix name "ifpga_" for feature and feature_ops data struct on ifpga base code, which is suggested by Yigit, Ferruh.

---
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |  8 +--
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |  4 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h | 58 ++++++++++---------
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         | 70 +++++++++++------------
 drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c   | 16 +++---
 drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c   | 18 +++---
 drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c   | 28 ++++-----
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c      |  6 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          | 22 +++----
 drivers/raw/ifpga_rawdev/base/ifpga_port.c        | 36 ++++++------
 drivers/raw/ifpga_rawdev/base/ifpga_port_error.c  | 10 ++--
 11 files changed, 141 insertions(+), 135 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +4 -4
index 44086c1..b8846e3 100644
@@ -73,7 +73,7 @@ static u64 feature_id(void __iomem *start)
 		unsigned int vec_cnt)
 {
 	struct ifpga_hw *hw = binfo->hw;
-	struct feature *feature = NULL;
+	struct ifpga_feature *feature = NULL;
 	struct feature_irq_ctx *ctx = NULL;
 	int port_id, ret = 0;
 	unsigned int i;
@@ -81,7 +81,7 @@ static u64 feature_id(void __iomem *start)
 	fid = fid?fid:feature_id(start);
 	size = size?size:feature_size(start);
 
-	feature = opae_malloc(sizeof(struct feature));
+	feature = opae_malloc(sizeof(struct ifpga_feature));
 	if (!feature)
 		return -ENOMEM;
 
@@ -233,7 +233,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 	struct opae_accelerator *acc;
 	struct ifpga_port_hw *port;
 	struct ifpga_fme_hw *fme;
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!binfo->fiu)
 		return 0;
@@ -645,7 +645,7 @@ static void ifpga_print_device_feature_list(struct ifpga_hw *hw)
 {
 	struct ifpga_fme_hw *fme = &hw->fme;
 	struct ifpga_port_hw *port;
-	struct feature *feature;
+	struct ifpga_feature *feature;
 	int i;
 
 	dev_info(hw, "found fme_device, is in PF: %s\n",
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -2
index 5ebc449..63c8bcc 100644
@@ -252,7 +252,7 @@ const char *get_port_feature_name(unsigned int id)
 
 static void feature_uinit(struct ifpga_feature_list *list)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	TAILQ_FOREACH(feature, list, next) {
 		if (feature->state != IFPGA_FEATURE_ATTACHED)
@@ -265,7 +265,7 @@ static void feature_uinit(struct ifpga_feature_list *list)
 static int feature_init(struct feature_driver *drv,
 		struct ifpga_feature_list *list)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 	int ret;
 
 	while (drv->ops) {
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +30 -28

114 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme.c +35 -35

268 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c +8 -8
index 1773b87..954f8a8 100644
@@ -183,7 +183,7 @@ static int fme_dperf_set_fab_freeze(struct ifpga_fme_hw *fme, u64 freeze)
 
 #define PERF_MAX_PORT_NUM	1
 
-static int fme_global_dperf_init(struct feature *feature)
+static int fme_global_dperf_init(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
@@ -192,14 +192,14 @@ static int fme_global_dperf_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_dperf_uinit(struct feature *feature)
+static void fme_global_dperf_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME global_dperf UInit.\n");
 }
 
-static int fme_dperf_fab_get_prop(struct feature *feature,
+static int fme_dperf_fab_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -225,7 +225,7 @@ static int fme_dperf_fab_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_dperf_root_get_prop(struct feature *feature,
+static int fme_dperf_root_get_prop(struct ifpga_feature *feature,
 				   struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -245,7 +245,7 @@ static int fme_dperf_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_dperf_get_prop(struct feature *feature,
+static int fme_global_dperf_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -260,7 +260,7 @@ static int fme_global_dperf_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_dperf_fab_set_prop(struct feature *feature,
+static int fme_dperf_fab_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -279,7 +279,7 @@ static int fme_dperf_fab_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_dperf_set_prop(struct feature *feature,
+static int fme_global_dperf_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -292,7 +292,7 @@ static int fme_global_dperf_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_dperf_ops = {
+struct ifpga_feature_ops fme_global_dperf_ops = {
 	.init = fme_global_dperf_init,
 	.uinit = fme_global_dperf_uinit,
 	.get_prop = fme_global_dperf_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c +9 -9
index 8c26fb2..3794564 100644
@@ -240,7 +240,7 @@ static void fme_error_enable(struct ifpga_fme_hw *fme)
 	writeq(0UL, &fme_err->ras_catfat_mask);
 }
 
-static int fme_global_error_init(struct feature *feature)
+static int fme_global_error_init(struct ifpga_feature *feature)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
 
@@ -252,12 +252,12 @@ static int fme_global_error_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_error_uinit(struct feature *feature)
+static void fme_global_error_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 }
 
-static int fme_err_fme_err_get_prop(struct feature *feature,
+static int fme_err_fme_err_get_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -275,7 +275,7 @@ static int fme_err_fme_err_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_root_get_prop(struct feature *feature,
+static int fme_err_root_get_prop(struct ifpga_feature *feature,
 				 struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -301,7 +301,7 @@ static int fme_err_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_error_get_prop(struct feature *feature,
+static int fme_global_error_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -321,7 +321,7 @@ static int fme_global_error_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_fme_err_set_prop(struct feature *feature,
+static int fme_err_fme_err_set_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -335,7 +335,7 @@ static int fme_err_fme_err_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_root_set_prop(struct feature *feature,
+static int fme_err_root_set_prop(struct ifpga_feature *feature,
 				 struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -353,7 +353,7 @@ static int fme_err_root_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_error_set_prop(struct feature *feature,
+static int fme_global_error_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -373,7 +373,7 @@ static int fme_global_error_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_err_ops = {
+struct ifpga_feature_ops fme_global_err_ops = {
 	.init = fme_global_error_init,
 	.uinit = fme_global_error_uinit,
 	.get_prop = fme_global_error_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c +14 -14
index e6c40a1..70543b9 100644
@@ -407,7 +407,7 @@ static int fme_iperf_set_fab_freeze(struct ifpga_fme_hw *fme, u64 freeze)
 #define PERF_MAX_PORT_NUM	1
 #define FME_IPERF_CAP_IOMMU	0x1
 
-static int fme_global_iperf_init(struct feature *feature)
+static int fme_global_iperf_init(struct ifpga_feature *feature)
 {
 	struct ifpga_fme_hw *fme;
 	struct feature_fme_header *fme_hdr;
@@ -429,14 +429,14 @@ static int fme_global_iperf_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_iperf_uinit(struct feature *feature)
+static void fme_global_iperf_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME global_iperf UInit.\n");
 }
 
-static int fme_iperf_root_get_prop(struct feature *feature,
+static int fme_iperf_root_get_prop(struct ifpga_feature *feature,
 				   struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -456,7 +456,7 @@ static int fme_iperf_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_cache_get_prop(struct feature *feature,
+static int fme_iperf_cache_get_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -496,7 +496,7 @@ static int fme_iperf_cache_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_root_get_prop(struct feature *feature,
+static int fme_iperf_vtd_root_get_prop(struct ifpga_feature *feature,
 				       struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -534,7 +534,7 @@ static int fme_iperf_vtd_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_sub_get_prop(struct feature *feature,
+static int fme_iperf_vtd_sub_get_prop(struct ifpga_feature *feature,
 				      struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -571,7 +571,7 @@ static int fme_iperf_vtd_sub_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_get_prop(struct feature *feature,
+static int fme_iperf_vtd_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	u8 sub = GET_FIELD(PROP_SUB, prop->prop_id);
@@ -582,7 +582,7 @@ static int fme_iperf_vtd_get_prop(struct feature *feature,
 	return fme_iperf_vtd_sub_get_prop(feature, prop);
 }
 
-static int fme_iperf_fab_get_prop(struct feature *feature,
+static int fme_iperf_fab_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -626,7 +626,7 @@ static int fme_iperf_fab_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_iperf_get_prop(struct feature *feature,
+static int fme_global_iperf_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -645,7 +645,7 @@ static int fme_global_iperf_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_cache_set_prop(struct feature *feature,
+static int fme_iperf_cache_set_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -658,7 +658,7 @@ static int fme_iperf_cache_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_set_prop(struct feature *feature,
+static int fme_iperf_vtd_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -671,7 +671,7 @@ static int fme_iperf_vtd_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_fab_set_prop(struct feature *feature,
+static int fme_iperf_fab_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -690,7 +690,7 @@ static int fme_iperf_fab_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_iperf_set_prop(struct feature *feature,
+static int fme_global_iperf_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -707,7 +707,7 @@ static int fme_global_iperf_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_iperf_ops = {
+struct ifpga_feature_ops fme_global_iperf_ops = {
 	.init = fme_global_iperf_init,
 	.uinit = fme_global_iperf_uinit,
 	.get_prop = fme_global_iperf_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c +3 -3
index 8890f4b..efa7266 100644
@@ -315,7 +315,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size, u64 *status)
 	return fme_pr(hw, port_id, buf, size, status);
 }
 
-static int fme_pr_mgmt_init(struct feature *feature)
+static int fme_pr_mgmt_init(struct ifpga_feature *feature)
 {
 	struct feature_fme_pr *fme_pr;
 	struct feature_header fme_pr_header;
@@ -339,14 +339,14 @@ static int fme_pr_mgmt_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_pr_mgmt_uinit(struct feature *feature)
+static void fme_pr_mgmt_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME PR MGMT UInit.\n");
 }
 
-struct feature_ops fme_pr_mgmt_ops = {
+struct ifpga_feature_ops fme_pr_mgmt_ops = {
 	.init = fme_pr_mgmt_init,
 	.uinit = fme_pr_mgmt_uinit,
 };
drivers/raw/ifpga_rawdev/base/ifpga_hw.h +12 -10
index a428d69..ff91c46 100644
@@ -10,7 +10,7 @@
 #include "opae_eth_group.h"
 
 /** List of private feateues */
-TAILQ_HEAD(ifpga_feature_list, feature);
+TAILQ_HEAD(ifpga_feature_list, ifpga_feature);
 
 enum ifpga_feature_state {
 	IFPGA_FEATURE_UNUSED = 0,
@@ -27,8 +27,8 @@ struct feature_irq_ctx {
 	int idx;
 };
 
-struct feature {
-	TAILQ_ENTRY(feature)next;
+struct ifpga_feature {
+	TAILQ_ENTRY(ifpga_feature)next;
 	enum ifpga_feature_state state;
 	enum feature_type type;
 	const char *name;
@@ -44,17 +44,19 @@ struct feature {
 
 	void *parent;		/* to parent hw data structure */
 
-	struct feature_ops *ops;/* callback to this private feature */
+	struct ifpga_feature_ops *ops;/* callback to this private feature */
 	unsigned int vec_start;
 	unsigned int vec_cnt;
 };
 
-struct feature_ops {
-	int (*init)(struct feature *feature);
-	void (*uinit)(struct feature *feature);
-	int (*get_prop)(struct feature *feature, struct feature_prop *prop);
-	int (*set_prop)(struct feature *feature, struct feature_prop *prop);
-	int (*set_irq)(struct feature *feature, void *irq_set);
+struct ifpga_feature_ops {
+	int (*init)(struct ifpga_feature *feature);
+	void (*uinit)(struct ifpga_feature *feature);
+	int (*get_prop)(struct ifpga_feature *feature,
+			struct feature_prop *prop);
+	int (*set_prop)(struct ifpga_feature *feature,
+			struct feature_prop *prop);
+	int (*set_irq)(struct ifpga_feature *feature, void *irq_set);
 };
 
 enum ifpga_fme_state {
drivers/raw/ifpga_rawdev/base/ifpga_port.c +19 -17
index 4628783..6c41164 100644
@@ -6,7 +6,7 @@
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -21,7 +21,7 @@ int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 
 int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -36,7 +36,7 @@ int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 
 int port_set_irq(struct ifpga_port_hw *port, u32 feature_id, void *irq_set)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -260,7 +260,7 @@ static int port_get_userclk_freqcntrsts(struct ifpga_port_hw *port, u64 *val)
 	return 0;
 }
 
-static int port_hdr_init(struct feature *feature)
+static int port_hdr_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -271,14 +271,15 @@ static int port_hdr_init(struct feature *feature)
 	return 0;
 }
 
-static void port_hdr_uinit(struct feature *feature)
+static void port_hdr_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "port hdr uinit.\n");
 }
 
-static int port_hdr_get_prop(struct feature *feature, struct feature_prop *prop)
+static int port_hdr_get_prop(struct ifpga_feature *feature,
+		struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -308,7 +309,8 @@ static int port_hdr_get_prop(struct feature *feature, struct feature_prop *prop)
 	return -ENOENT;
 }
 
-static int port_hdr_set_prop(struct feature *feature, struct feature_prop *prop)
+static int port_hdr_set_prop(struct ifpga_feature *feature,
+		struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -326,14 +328,14 @@ static int port_hdr_set_prop(struct feature *feature, struct feature_prop *prop)
 	return -ENOENT;
 }
 
-struct feature_ops ifpga_rawdev_port_hdr_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_hdr_ops = {
 	.init = port_hdr_init,
 	.uinit = port_hdr_uinit,
 	.get_prop = port_hdr_get_prop,
 	.set_prop = port_hdr_set_prop,
 };
 
-static int port_stp_init(struct feature *feature)
+static int port_stp_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -347,19 +349,19 @@ static int port_stp_init(struct feature *feature)
 	return 0;
 }
 
-static void port_stp_uinit(struct feature *feature)
+static void port_stp_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "port stp uinit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_stp_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_stp_ops = {
 	.init = port_stp_init,
 	.uinit = port_stp_uinit,
 };
 
-static int port_uint_init(struct feature *feature)
+static int port_uint_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -375,19 +377,19 @@ static int port_uint_init(struct feature *feature)
 	return 0;
 }
 
-static void port_uint_uinit(struct feature *feature)
+static void port_uint_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "PORT UINT UInit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_uint_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_uint_ops = {
 	.init = port_uint_init,
 	.uinit = port_uint_uinit,
 };
 
-static int port_afu_init(struct feature *feature)
+static int port_afu_init(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
@@ -396,14 +398,14 @@ static int port_afu_init(struct feature *feature)
 	return 0;
 }
 
-static void port_afu_uinit(struct feature *feature)
+static void port_afu_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "PORT AFU UInit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_afu_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_afu_ops = {
 	.init = port_afu_init,
 	.uinit = port_afu_uinit,
 };
drivers/raw/ifpga_rawdev/base/ifpga_port_error.c +5 -5
index 9dd1cf5..138284e 100644
@@ -84,7 +84,7 @@ static int port_err_set_clear(struct ifpga_port_hw *port, u64 val)
 	return ret;
 }
 
-static int port_error_init(struct feature *feature)
+static int port_error_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -99,12 +99,12 @@ static int port_error_init(struct feature *feature)
 	return 0;
 }
 
-static void port_error_uinit(struct feature *feature)
+static void port_error_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 }
 
-static int port_error_get_prop(struct feature *feature,
+static int port_error_get_prop(struct ifpga_feature *feature,
 			       struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
@@ -125,7 +125,7 @@ static int port_error_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int port_error_set_prop(struct feature *feature,
+static int port_error_set_prop(struct ifpga_feature *feature,
 			       struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
@@ -136,7 +136,7 @@ static int port_error_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops ifpga_rawdev_port_error_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_error_ops = {
 	.init = port_error_init,
 	.uinit = port_error_uinit,
 	.get_prop = port_error_get_prop,
Signature · 1 line
1.8.3.1
author
#126 lore raw

PATCH v6 14/14 raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE support for IFPGA Rawdev.

---
 drivers/raw/ifpga_rawdev/Makefile       |   1 +
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 248 +++++++++++++++++++++++++++++++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h |  16 ++-
 drivers/raw/ifpga_rawdev/meson.build    |   6 +-
 4 files changed, 265 insertions(+), 6 deletions(-)
drivers/raw/ifpga_rawdev/Makefile +1 -0
index f3b9d5e..f60b547 100644
@@ -13,6 +13,7 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga
 CFLAGS += -I$(RTE_SDK)/drivers/raw/ifpga_rawdev
+CFLAGS += -I$(RTE_SDK)/drivers/net/ipn3ke
 LDLIBS += -lrte_eal
 LDLIBS += -lrte_rawdev
 LDLIBS += -lrte_bus_vdev
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +245 -3

306 lines not on this page · raw message

drivers/raw/ifpga_rawdev/ifpga_rawdev.h +14 -2
index 234ce36..fcb1a96 100644
@@ -8,8 +8,8 @@
 extern int ifpga_rawdev_logtype;
 
 #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "%s(): " fmt "\n", \
-				__func__, ##args)
+	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifpga_rawdev: " fmt, \
+		##args)
 
 #define IFPGA_RAWDEV_PMD_FUNC_TRACE() IFPGA_RAWDEV_PMD_LOG(DEBUG, ">>")
 
@@ -28,6 +28,18 @@ enum ifpga_rawdev_device_state {
 	IFPGA_ERROR
 };
 
+/** Set a bit in the uint64 variable */
+#define IFPGA_BIT_SET(var, pos) \
+	((var) |= ((uint64_t)1 << ((pos))))
+
+/** Reset the bit in the variable */
+#define IFPGA_BIT_RESET(var, pos) \
+	((var) &= ~((uint64_t)1 << ((pos))))
+
+/** Check the bit is set in the variable */
+#define IFPGA_BIT_ISSET(var, pos) \
+	(((var) & ((uint64_t)1 << ((pos)))) ? 1 : 0)
+
 static inline struct opae_adapter *
 ifpga_rawdev_get_priv(const struct rte_rawdev *rawdev)
 {
drivers/raw/ifpga_rawdev/meson.build +5 -1
index 6725687..132b777 100644
@@ -6,8 +6,12 @@ version = 1
 subdir('base')
 objs = [base_objs]
 
+dep = dependency('libfdt', required: false)
+if not dep.found()
+	build = false
+endif
 deps += ['rawdev', 'pci', 'bus_pci', 'kvargs',
-	'bus_vdev', 'bus_ifpga']
+	'bus_vdev', 'bus_ifpga', 'net']
 sources = files('ifpga_rawdev.c')
 
 includes += include_directories('base')
Signature · 1 line
1.8.3.1
author
#127 lore raw

v7 cover Add patch set for IPN3KE

In reply to Rosen Xu

v7 updates:
=========
- Fix Stephen comments

v6 updates:
==========
- Fix v5 comments
- Fix TM Shaper rate issue

v5 updates:
==========
- Fix EXPERIMENTAL symbol definition issue

v4 updates:
==========
- Fix coding style issues

v3 updates:
==========
- Fix v2 comments
- Update MAC BAR of AFU index get ops
- Remove OPAE share code dependency of libfdt

v2 updates:
==========
- Fix v1 comments
- Add support for 10G Base Line Design Bitstream
- Add support for 25G Base Line Design Bitstream

This patch set adds the support of a new net PMD, Intel® FPGA Programmable Acceleration Card N3000, also called ipn3ke.

The ipn3ke PMD (librte_pmd_ipn3ke) provides poll mode driver support for Intel® FPGA PAC(Programmable Acceleration Card) N3000 based on the Intel Ethernet Controller X710/XXV710 and Intel Arria 10 FPGA.

In this card, FPGA is an acceleration bridge between network interface and the Intel Ethernet Controller. Although both FPGA and Ethernet Controllers are connected to CPU with PCIe Gen3x16 Switch, all the packet RX/TX is handled by Intel Ethernet Controller. So from application point of view the data path is still the legacy Intel Ethernet Controller X710/XXV710 PMD. Besides this, users can enable more acceleration features by FPGA IP.

Rosen Xu (7):
bus/ifpga: add AFU shared data
bus/ifpga: add function for AFU search by name net/ipn3ke: add IPN3KE ethdev PMD driver net/ipn3ke: add IPN3KE representor of PMD driver net/ipn3ke: add IPN3KE TM of PMD driver net/ipn3ke: add IPN3KE Flow of PMD driver raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Tianfei zhang (7):
raw/ifpga_rawdev: clean up code for ifpga share code raw/ifpga_rawdev: store private features in FME and Port raw/ifpga_rawdev: add SPI and MAX10 device driver raw/ifpga_rawdev: add I2C and at24 EEPROM driver raw/ifpga_rawdev: add eth group driver raw/ifpga_rawdev: add version description on README raw/ifpga_rawdev: using prefix name for feature and its ops

 MAINTAINERS                                        |    6 +
 config/common_base                                 |    4 +
 doc/guides/nics/features/ipn3ke.ini                |   55 +
 doc/guides/nics/index.rst                          |    1 +
 doc/guides/nics/ipn3ke.rst                         |  108 +
 drivers/bus/ifpga/ifpga_bus.c                      |   13 +
 drivers/bus/ifpga/rte_bus_ifpga.h                  |   16 +
 drivers/bus/ifpga/rte_bus_ifpga_version.map        |    6 +
 drivers/net/Makefile                               |    1 +
 drivers/net/ipn3ke/Makefile                        |   40 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c                 |  653 ++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h                 |  975 +++++++++
 drivers/net/ipn3ke/ipn3ke_flow.c                   | 1374 +++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h                   |  106 +
 drivers/net/ipn3ke/ipn3ke_logs.h                   |   30 +
 drivers/net/ipn3ke/ipn3ke_rawdev_api.h             |   62 +
 drivers/net/ipn3ke/ipn3ke_representor.c            |  893 +++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c                     | 2069 ++++++++++++++++++++
 drivers/net/ipn3ke/meson.build                     |   17 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map      |    4 +
 drivers/net/meson.build                            |    1 +
 drivers/raw/ifpga_rawdev/Makefile                  |    1 +
 drivers/raw/ifpga_rawdev/base/Makefile             |    6 +
 drivers/raw/ifpga_rawdev/base/README               |   15 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c          |   98 +-
 drivers/raw/ifpga_rawdev/base/ifpga_api.h          |    1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |   93 +-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c    |  357 ++--
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  |  174 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |   99 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          |  602 +++++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c    |   16 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c    |   18 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c    |   28 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c       |    8 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |   44 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c         |   51 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port_error.c   |   10 +-
 drivers/raw/ifpga_rawdev/base/meson.build          |    8 +-
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c   |   88 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h   |   14 +
 drivers/raw/ifpga_rawdev/base/opae_debug.c         |   16 +-
 drivers/raw/ifpga_rawdev/base/opae_eth_group.c     |  145 ++
 drivers/raw/ifpga_rawdev/base/opae_eth_group.h     |   96 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c        |  200 +-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |   54 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c           |  490 +++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h           |  130 ++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   |   88 +
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |   96 +
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |   21 +-
 drivers/raw/ifpga_rawdev/base/opae_spi.c           |  304 +++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           |  160 ++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   |  438 +++++
 .../ifpga_rawdev/base/osdep_raw/osdep_generic.h    |    1 +
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |   16 +
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c            |  248 ++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h            |   16 +-
 drivers/raw/ifpga_rawdev/meson.build               |    6 +-
 mk/rte.app.mk                                      |    1 +
 usertools/dpdk-devbind.py                          |    4 +-
 61 files changed, 10265 insertions(+), 430 deletions(-)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
 create mode 100644 drivers/net/ipn3ke/Makefile
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_logs.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_rawdev_api.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_representor.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c
 create mode 100644 drivers/net/ipn3ke/meson.build
 create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c
Signature · 1 line
1.8.3.1
author
#128 lore raw

PATCH v7 1/14 bus/ifpga: add AFU shared data

AFU can be implemented into many different acceleration devices, these devices need shared data to store private information when they are handled by users.

---
 drivers/bus/ifpga/rte_bus_ifpga.h | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/bus/ifpga/rte_bus_ifpga.h +7 -0
index 0bf43ba..820eeaa 100644
@@ -17,6 +17,7 @@
 
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_spinlock.h>
 
 /** Name of Intel FPGA Bus */
 #define IFPGA_BUS_NAME ifpga
@@ -60,6 +61,11 @@ struct rte_afu_pr_conf {
 
 #define AFU_PRI_STR_SIZE (PCI_PRI_STR_SIZE + 8)
 
+struct rte_afu_shared {
+	rte_spinlock_t lock;
+	void *data;
+};
+
 /**
  * A structure describing a AFU device.
  */
@@ -71,6 +77,7 @@ struct rte_afu_device {
 	uint32_t num_region;   /**< number of regions found */
 	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
 						/**< AFU Memory Resource */
+	struct rte_afu_shared shared;
 	struct rte_intr_handle intr_handle;     /**< Interrupt handle */
 	struct rte_afu_driver *driver;          /**< Associated driver */
 	char path[IFPGA_BUS_BITSTREAM_PATH_MAX_LEN];
Signature · 1 line
1.8.3.1
author
#129 lore raw

PATCH v7 2/14 bus/ifpga: add function for AFU search by name

In reply to Rosen Xu

In many scenarios, AFU is needed searched by name, this function add the feature.

---
 drivers/bus/ifpga/ifpga_bus.c               | 13 +++++++++++++
 drivers/bus/ifpga/rte_bus_ifpga.h           |  9 +++++++++
 drivers/bus/ifpga/rte_bus_ifpga_version.map |  6 ++++++
 3 files changed, 28 insertions(+)
drivers/bus/ifpga/ifpga_bus.c +13 -0
index 55d3abf..8bfae29 100644
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
 	return NULL;
 }
 
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name)
+{
+	struct rte_afu_device *afu_dev = NULL;
+
+	TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) {
+		if (afu_dev &&
+			!strcmp(afu_dev->device.name, name))
+			return afu_dev;
+	}
+	return NULL;
+}
+
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
 	IFPGA_ARG_NAME,
drivers/bus/ifpga/rte_bus_ifpga.h +9 -0
index 820eeaa..c00f60e 100644
@@ -120,6 +120,15 @@ struct rte_afu_driver {
 }
 
 /**
+ * Find AFU by AFU name.
+ *
+ * @param name
+ *   A pointer to AFU name string.
+ */
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name);
+
+/**
  * Register a ifpga afu device driver.
  *
  * @param driver
drivers/bus/ifpga/rte_bus_ifpga_version.map +6 -0
index a027979..247ccfe 100644
@@ -8,3 +8,9 @@ DPDK_18.05 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+    global:
+
+    rte_ifpga_find_afu_by_name;
+};
\ No newline at end of file
Signature · 1 line
1.8.3.1
author
#130 lore raw

PATCH v7 3/14 net/ipn3ke: add IPN3KE ethdev PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE ethdev PMD driver.

---
 MAINTAINERS                                   |   6 +
 config/common_base                            |   4 +
 doc/guides/nics/features/ipn3ke.ini           |  55 ++
 doc/guides/nics/index.rst                     |   1 +
 doc/guides/nics/ipn3ke.rst                    | 108 +++
 drivers/net/Makefile                          |   1 +
 drivers/net/ipn3ke/Makefile                   |  36 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c            | 645 ++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h            | 942 ++++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_logs.h              |  30 +
 drivers/net/ipn3ke/ipn3ke_rawdev_api.h        |  62 ++
 drivers/net/ipn3ke/meson.build                |  14 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map |   4 +
 drivers/net/meson.build                       |   1 +
 mk/rte.app.mk                                 |   1 +
 usertools/dpdk-devbind.py                     |   4 +-
 16 files changed, 1913 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
 create mode 100644 drivers/net/ipn3ke/Makefile
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_logs.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_rawdev_api.h
 create mode 100644 drivers/net/ipn3ke/meson.build
 create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
MAINTAINERS +6 -0
index 9774344..8db925f 100644
@@ -633,6 +633,12 @@ F: drivers/net/ice/
 F: doc/guides/nics/ice.rst
 F: doc/guides/nics/features/ice.ini
 
+Intel ipn3ke
+M: Rosen Xu <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/ipn3ke/
+F: doc/guides/nics/ipn3ke.rst
+F: doc/guides/nics/features/ipn3ke.ini
 Marvell mvpp2
 M: Tomasz Duszynski <[email protected]>
 M: Liron Himi <[email protected]>
config/common_base +4 -0
index 8da0810..cb9e3b6 100644
@@ -328,6 +328,10 @@ CONFIG_RTE_LIBRTE_IAVF_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_IAVF_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_IAVF_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_IAVF_16BYTE_RX_DESC=n
+#
+# Compile burst-oriented IPN3KE PMD driver
+#
+CONFIG_RTE_LIBRTE_IPN3KE_PMD=y
 
 #
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD
doc/guides/nics/features/ipn3ke.ini new file +55 -0

55 lines not on this page · raw message

doc/guides/nics/index.rst +1 -0
index a4b80a3..1892350 100644
@@ -31,6 +31,7 @@ Network Interface Controller Drivers
     ice
     ifc
     igb
+    ipn3ke
     ixgbe
     intel_vf
     kni
doc/guides/nics/ipn3ke.rst new file +108 -0

108 lines not on this page · raw message

drivers/net/Makefile +1 -0
index 5d401b8..5c972eb 100644
@@ -32,6 +32,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += iavf
 DIRS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice
+DIRS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
 DIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += liquidio
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
drivers/net/ipn3ke/Makefile new file +36 -0
new file mode 100644
index 0000000..d7aa79b
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_ipn3ke.a
+
+#
+# Add the experimenatal APIs called from this PMD
+#  rte_eth_switch_domain_alloc()
+#  rte_eth_dev_create()
+#  rte_eth_dev_destroy()
+#  rte_eth_switch_domain_free()
+#
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_ifpga
+LDLIBS += -lrte_bus_vdev
+
+EXPORT_MAP := rte_pmd_ipn3ke_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +645 -0

645 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_ethdev.h new file +942 -0

942 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_logs.h new file +30 -0
new file mode 100644
index 0000000..147fd80
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _IPN3KE_LOGS_H_
+#define _IPN3KE_LOGS_H_
+
+#include <rte_log.h>
+
+extern int ipn3ke_afu_logtype;
+
+#define IPN3KE_AFU_PMD_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, ipn3ke_afu_logtype, "%s(): " fmt "\n", \
+		__func__, ##args)
+
+#define IPN3KE_AFU_PMD_FUNC_TRACE() IPN3KE_AFU_PMD_LOG(DEBUG, ">>")
+
+#define IPN3KE_AFU_PMD_DEBUG(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(DEBUG, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_INFO(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(INFO, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_ERR(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(ERR, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_WARN(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(WARNING, fmt, ## args)
+
+#endif /* _IPN3KE_LOGS_H_ */
drivers/net/ipn3ke/ipn3ke_rawdev_api.h new file +62 -0

62 lines not on this page · raw message

drivers/net/ipn3ke/meson.build new file +14 -0
new file mode 100644
index 0000000..b511600
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+#
+# Add the experimenatal APIs called from this PMD
+#  rte_eth_switch_domain_alloc()
+#  rte_eth_dev_create()
+#  rte_eth_dev_destroy()
+#  rte_eth_switch_domain_free()
+#
+allow_experimental_apis = true
+
+sources += files('ipn3ke_ethdev.c')
+deps += ['bus_ifpga', 'sched']
drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +4 -0
new file mode 100644
index 0000000..fc8c95e
@@ -0,0 +1,4 @@
+DPDK_19.05 {
+
+	local: *;
+};
drivers/net/meson.build +1 -0
index 1105e72..6b96786 100644
@@ -20,6 +20,7 @@ drivers = ['af_packet',
 	'iavf',
 	'ice',
 	'ifc',
+	'ipn3ke',
 	'ixgbe',
 	'kni',
 	'liquidio',
mk/rte.app.mk +1 -0
index 7d994be..d2b8ab6 100644
@@ -298,6 +298,7 @@ endif # CONFIG_RTE_LIBRTE_FSLMC_BUS
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IFPGA_BUS)      += -lrte_bus_ifpga
 ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
usertools/dpdk-devbind.py +3 -1
index 249b65a..9e79f0d 100755
@@ -12,6 +12,8 @@
 # The PCI base class for all devices
 network_class = {'Class': '02', 'Vendor': None, 'Device': None,
                     'SVendor': None, 'SDevice': None}
+ifpga_class = {'Class': '12', 'Vendor': '8086', 'Device': '0b30',
+                    'SVendor': None, 'SDevice': None}
 encryption_class = {'Class': '10', 'Vendor': None, 'Device': None,
                    'SVendor': None, 'SDevice': None}
 intel_processor_class = {'Class': '0b', 'Vendor': '8086', 'Device': None,
@@ -34,7 +36,7 @@
 octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
               'SVendor': None, 'SDevice': None}
 
-network_devices = [network_class, cavium_pkx, avp_vnic]
+network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
 crypto_devices = [encryption_class, intel_processor_class]
 eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
 mempool_devices = [cavium_fpa, octeontx2_npa]
Signature · 1 line
1.8.3.1
author
#131 lore raw

PATCH v7 4/14 net/ipn3ke: add IPN3KE representor of PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE representor of PMD driver.

---
 drivers/net/ipn3ke/Makefile             |   2 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c      |   4 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.h      |  25 +
 drivers/net/ipn3ke/ipn3ke_representor.c | 887 ++++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/meson.build          |   3 +-
 5 files changed, 918 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/ipn3ke/ipn3ke_representor.c
drivers/net/ipn3ke/Makefile +2 -0
index d7aa79b..221567d 100644
@@ -23,6 +23,7 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 LDLIBS += -lrte_bus_ifpga
 LDLIBS += -lrte_bus_vdev
+LDLIBS += -lpthread
 
 EXPORT_MAP := rte_pmd_ipn3ke_version.map
 
@@ -32,5 +33,6 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_representor.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c +2 -2
index d5fee6f..58c8ce4 100644
@@ -339,7 +339,7 @@ static int ipn3ke_vswitch_probe(struct rte_afu_device *afu_dev)
 
 		retval = rte_eth_dev_create(&afu_dev->device, name,
 			sizeof(struct ipn3ke_rpst), NULL, NULL,
-			NULL, &rpst);
+			ipn3ke_rpst_init, &rpst);
 
 		if (retval)
 			IPN3KE_AFU_PMD_ERR("failed to create ipn3ke representor %s.",
@@ -368,7 +368,7 @@ static int ipn3ke_vswitch_remove(struct rte_afu_device *afu_dev)
 		if (!ethdev)
 			return -ENODEV;
 
-		rte_eth_dev_destroy(ethdev, NULL);
+		rte_eth_dev_destroy(ethdev, ipn3ke_rpst_uninit);
 	}
 
 	ret = rte_eth_switch_domain_free(hw->switch_domain_id);
drivers/net/ipn3ke/ipn3ke_ethdev.h +25 -0
index 09d085c..d2c73e5 100644
@@ -527,6 +527,31 @@ static inline void _ipn3ke_indrct_write(struct ipn3ke_hw *hw,
 #define IPN3KE_CLF_MHL_RES_MASK    0xFFFFFFFF
 #define IPN3KE_CLF_MHL_RES         (IPN3KE_CLASSIFY_OFFSET + 0x50000 + 0x2000)
 
+int
+ipn3ke_rpst_dev_set_link_up(struct rte_eth_dev *dev);
+int
+ipn3ke_rpst_dev_set_link_down(struct rte_eth_dev *dev);
+int
+ipn3ke_rpst_link_update(struct rte_eth_dev *ethdev,
+	__rte_unused int wait_to_complete);
+void
+ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev);
+void
+ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev);
+void
+ipn3ke_rpst_allmulticast_enable(struct rte_eth_dev *ethdev);
+void
+ipn3ke_rpst_allmulticast_disable(struct rte_eth_dev *ethdev);
+int
+ipn3ke_rpst_mac_addr_set(struct rte_eth_dev *ethdev,
+		struct ether_addr *mac_addr);
+int
+ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu);
+
+int
+ipn3ke_rpst_init(struct rte_eth_dev *ethdev, void *init_params);
+int
+ipn3ke_rpst_uninit(struct rte_eth_dev *ethdev);
 
 
 /* IPN3KE_MASK is a macro used on 32 bit registers */
drivers/net/ipn3ke/ipn3ke_representor.c new file +887 -0

887 lines not on this page · raw message

drivers/net/ipn3ke/meson.build +2 -1
index b511600..ec77390 100644
@@ -10,5 +10,6 @@
 #
 allow_experimental_apis = true
 
-sources += files('ipn3ke_ethdev.c')
+sources += files('ipn3ke_ethdev.c',
+	'ipn3ke_representor.c')
 deps += ['bus_ifpga', 'sched']
Signature · 1 line
1.8.3.1
author
#132 lore raw

PATCH v7 5/14 net/ipn3ke: add IPN3KE TM of PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE TM of PMD driver.

---
 drivers/net/ipn3ke/Makefile             |    1 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c      |    3 +
 drivers/net/ipn3ke/ipn3ke_ethdev.h      |    7 +
 drivers/net/ipn3ke/ipn3ke_representor.c |    5 +
 drivers/net/ipn3ke/ipn3ke_tm.c          | 2068 +++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/meson.build          |    3 +-
 6 files changed, 2086 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c
drivers/net/ipn3ke/Makefile +1 -0
index 221567d..38d9384 100644
@@ -34,5 +34,6 @@ LIBABIVER := 1
 #
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_representor.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_tm.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c +3 -0
index 58c8ce4..508ea01 100644
@@ -262,6 +262,9 @@
 	hw->flow_hw_enable = 0;
 	if (afu_dev->id.uuid.uuid_low == IPN3KE_UUID_VBNG_LOW &&
 		afu_dev->id.uuid.uuid_high == IPN3KE_UUID_VBNG_HIGH) {
+		ret = ipn3ke_hw_tm_init(hw);
+		if (ret)
+			return ret;
 		hw->tm_hw_enable = 1;
 		hw->flow_hw_enable = 1;
 	}
drivers/net/ipn3ke/ipn3ke_ethdev.h +7 -0
index d2c73e5..36ff2f8 100644
@@ -552,6 +552,13 @@ static inline void _ipn3ke_indrct_write(struct ipn3ke_hw *hw,
 ipn3ke_rpst_init(struct rte_eth_dev *ethdev, void *init_params);
 int
 ipn3ke_rpst_uninit(struct rte_eth_dev *ethdev);
+int
+ipn3ke_hw_tm_init(struct ipn3ke_hw *hw);
+void
+ipn3ke_tm_init(struct ipn3ke_rpst *rpst);
+int
+ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev,
+		void *arg);
 
 
 /* IPN3KE_MASK is a macro used on 32 bit registers */
drivers/net/ipn3ke/ipn3ke_representor.c +5 -0
index 3831982..63098bf 100644
@@ -801,6 +801,8 @@
 	.allmulticast_disable = ipn3ke_rpst_allmulticast_disable,
 	.mac_addr_set         = ipn3ke_rpst_mac_addr_set,
 	.mtu_set              = ipn3ke_rpst_mtu_set,
+
+	.tm_ops_get           = ipn3ke_tm_ops_get,
 };
 
 static uint16_t ipn3ke_rpst_recv_pkts(__rte_unused void *rx_q,
@@ -840,6 +842,9 @@ static uint16_t ipn3ke_rpst_recv_pkts(__rte_unused void *rx_q,
 		return -ENODEV;
 	}
 
+	if (rpst->hw->tm_hw_enable)
+		ipn3ke_tm_init(rpst);
+
 	/* Set representor device ops */
 	ethdev->dev_ops = &ipn3ke_rpst_dev_ops;
 
drivers/net/ipn3ke/ipn3ke_tm.c new file +2068 -0

2,068 lines not on this page · raw message

drivers/net/ipn3ke/meson.build +2 -1
index ec77390..3a95efc 100644
@@ -11,5 +11,6 @@
 allow_experimental_apis = true
 
 sources += files('ipn3ke_ethdev.c',
-	'ipn3ke_representor.c')
+	'ipn3ke_representor.c',
+	'ipn3ke_tm.c')
 deps += ['bus_ifpga', 'sched']
Signature · 1 line
1.8.3.1
author
#133 lore raw

PATCH v7 6/14 net/ipn3ke: add IPN3KE Flow of PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE Flow of PMD driver.

---
 drivers/net/ipn3ke/Makefile             |    1 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c      |    5 +
 drivers/net/ipn3ke/ipn3ke_ethdev.h      |    1 +
 drivers/net/ipn3ke/ipn3ke_flow.c        | 1374 +++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h        |  106 +++
 drivers/net/ipn3ke/ipn3ke_representor.c |    3 +-
 drivers/net/ipn3ke/ipn3ke_tm.c          |    1 +
 drivers/net/ipn3ke/meson.build          |    3 +-
 8 files changed, 1492 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.h
drivers/net/ipn3ke/Makefile +1 -0
index 38d9384..8c3ae37 100644
@@ -35,5 +35,6 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_representor.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_tm.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_flow.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c +5 -0
index 508ea01..9079b57 100644
@@ -21,6 +21,7 @@
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
+#include "ipn3ke_flow.h"
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
@@ -266,6 +267,10 @@
 		if (ret)
 			return ret;
 		hw->tm_hw_enable = 1;
+
+		ret = ipn3ke_flow_init(hw);
+		if (ret)
+			return ret;
 		hw->flow_hw_enable = 1;
 	}
 
drivers/net/ipn3ke/ipn3ke_ethdev.h +1 -0
index 36ff2f8..bfda9d5 100644
@@ -291,6 +291,7 @@ struct ipn3ke_hw {
 	uint32_t acc_tm;
 	uint32_t acc_flow;
 
+	struct ipn3ke_flow_list flow_list;
 	uint32_t flow_max_entries;
 	uint32_t flow_num_entries;
 
drivers/net/ipn3ke/ipn3ke_flow.c new file +1374 -0

1,374 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_flow.h new file +106 -0

106 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_representor.c +2 -1
index 63098bf..cf3b214 100644
@@ -21,6 +21,7 @@
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
+#include "ipn3ke_flow.h"
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
@@ -746,7 +747,7 @@
 		case RTE_ETH_FILTER_GENERIC:
 			if (filter_op != RTE_ETH_FILTER_GET)
 				return -EINVAL;
-			*(const void **)arg = NULL;
+			*(const void **)arg = &ipn3ke_flow_ops;
 			break;
 		default:
 			IPN3KE_AFU_PMD_WARN("Filter type (%d) not supported",
drivers/net/ipn3ke/ipn3ke_tm.c +1 -0
index 4ca4c97..ef87a41 100644
@@ -23,6 +23,7 @@
 #include <ifpga_logs.h>
 
 #include "ipn3ke_rawdev_api.h"
+#include "ipn3ke_flow.h"
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
drivers/net/ipn3ke/meson.build +2 -1
index 3a95efc..74b4d7c 100644
@@ -12,5 +12,6 @@ allow_experimental_apis = true
 
 sources += files('ipn3ke_ethdev.c',
 	'ipn3ke_representor.c',
-	'ipn3ke_tm.c')
+	'ipn3ke_tm.c',
+	'ipn3ke_flow.c')
 deps += ['bus_ifpga', 'sched']
Signature · 1 line
1.8.3.1
author
#134 lore raw

PATCH v7 7/14 raw/ifpga_rawdev: clean up code for ifpga share code

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

clean up code:
1. use opae_memcpy instead of memcpy
2. use opae_memset instead of memset
3. disable opae_adapter_dump by default

---
 drivers/raw/ifpga_rawdev/base/ifpga_api.c               |  2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c       |  4 ++--
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c            |  2 +-
 drivers/raw/ifpga_rawdev/base/opae_debug.c              | 16 ++++++++--------
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c             |  2 +-
 drivers/raw/ifpga_rawdev/base/opae_osdep.h              |  1 +
 drivers/raw/ifpga_rawdev/base/osdep_raw/osdep_generic.h |  1 +
 drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h |  2 ++
 8 files changed, 17 insertions(+), 13 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +1 -1
index 540e171..77d9471 100644
@@ -202,7 +202,7 @@ static int ifpga_adapter_enumerate(struct opae_adapter *adapter)
 	struct ifpga_hw *hw = malloc(sizeof(*hw));
 
 	if (hw) {
-		memset(hw, 0, sizeof(*hw));
+		opae_memset(hw, 0, sizeof(*hw));
 		hw->pci_data = adapter->data;
 		hw->adapter = adapter;
 		if (ifpga_bus_enumerate(hw))
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -2
index be7ac9e..0a27c38 100644
@@ -77,8 +77,8 @@ int fpga_get_afu_uuid(struct ifpga_port_hw *port, struct uuid *uuid)
 	guidh = readq(&port_hdr->afu_header.guid.b[8]);
 	spinlock_unlock(&port->lock);
 
-	memcpy(uuid->b, &guidl, sizeof(u64));
-	memcpy(uuid->b + 8, &guidh, sizeof(u64));
+	opae_memcpy(uuid->b, &guidl, sizeof(u64));
+	opae_memcpy(uuid->b + 8, &guidh, sizeof(u64));
 
 	return 0;
 }
drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c +1 -1
index ec0beeb..8890f4b 100644
@@ -257,7 +257,7 @@ static int fme_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 		return -EINVAL;
 	}
 
-	memset(&info, 0, sizeof(struct fpga_pr_info));
+	opae_memset(&info, 0, sizeof(struct fpga_pr_info));
 	info.flags = FPGA_MGR_PARTIAL_RECONFIG;
 	info.port_id = port_id;
 
drivers/raw/ifpga_rawdev/base/opae_debug.c +8 -8
index 024d7d2..88f2d5c 100644
@@ -78,13 +78,13 @@ void opae_adapter_dump(struct opae_adapter *adapter, int verbose)
 {
 	struct opae_accelerator *acc;
 
-	opae_log("=====%s=====\n", __func__);
-	opae_log("OPAE Adapter %s\n", adapter->name);
-	opae_log("OPAE Adapter OPs = %p\n", adapter->ops);
-	opae_log("OPAE Adapter Private Data = %p\n", adapter->data);
-	opae_log("OPAE Manager (downstream) = %p\n", adapter->mgr);
-
 	if (verbose) {
+		opae_log("=====%s=====\n", __func__);
+		opae_log("OPAE Adapter %s\n", adapter->name);
+		opae_log("OPAE Adapter OPs = %p\n", adapter->ops);
+		opae_log("OPAE Adapter Private Data = %p\n", adapter->data);
+		opae_log("OPAE Manager (downstream) = %p\n", adapter->mgr);
+
 		if (adapter->mgr)
 			opae_manager_dump(adapter->mgr);
 
@@ -93,7 +93,7 @@ void opae_adapter_dump(struct opae_adapter *adapter, int verbose)
 
 		if (adapter->data)
 			opae_adapter_data_dump(adapter->data);
-	}
 
-	opae_log("==========================\n");
+		opae_log("==========================\n");
+	}
 }
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +1 -1
index 1541b67..41c5903 100644
@@ -341,7 +341,7 @@ int opae_adapter_enumerate(struct opae_adapter *adapter)
 		ret = adapter->ops->enumerate(adapter);
 
 	if (!ret)
-		opae_adapter_dump(adapter, 1);
+		opae_adapter_dump(adapter, 0);
 
 	return ret;
 }
drivers/raw/ifpga_rawdev/base/opae_osdep.h +1 -0
index 90f54f7..78fec50 100644
@@ -76,4 +76,5 @@ struct uuid {
 #define msleep(x) opae_udelay(1000 * (x))
 #define usleep_range(min, max) msleep(DIV_ROUND_UP(min, 1000))
 
+#define opae_memset(a, b, c)    memset((a), (b), (c))
 #endif
drivers/raw/ifpga_rawdev/base/osdep_raw/osdep_generic.h +1 -0
index 895a1d8..6769109 100644
@@ -71,5 +71,6 @@ static inline void opae_writeq(uint64_t value, volatile void *addr)
 }
 
 #define opae_free(addr) free(addr)
+#define opae_memcpy(a, b, c) memcpy((a), (b), (c))
 
 #endif
drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h +2 -0
index 76902e2..3d9a0ca 100644
@@ -11,6 +11,7 @@
 #include <rte_log.h>
 #include <rte_io.h>
 #include <rte_malloc.h>
+#include <rte_memcpy.h>
 
 #define dev_printf(level, fmt, args...) \
 	RTE_LOG(level, PMD, "osdep_rte: " fmt, ## args)
@@ -42,4 +43,5 @@
 #define spinlock_lock(x) rte_spinlock_lock(x)
 #define spinlock_unlock(x) rte_spinlock_unlock(x)
 
+#define opae_memcpy(a, b, c) rte_memcpy((a), (b), (c))
 #endif
Signature · 1 line
1.8.3.1
author
#135 lore raw

PATCH v7 8/14 raw/ifpga_rawdev: store private features in FME and Port

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

Get private features attrubite like size, id, address after enumeration, and insert into FEM or Port dedicate list.

when initial the private feature driver, we just compare the private feature id between the list and feature drivers array to match the proper drivers.

This patch avoid the hardcore in feature_info array in previous implementation. and the same time we can use one driver for mulitple devices which the id is the same.

---
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |  46 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   | 347 ++++++++--------------
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c | 160 +++++++---
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |  46 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         |  32 ++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |  16 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c        |  21 ++
 7 files changed, 363 insertions(+), 305 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +20 -26
index aa02527..217d0b1 100644
@@ -15,6 +15,7 @@
 #define FME_FEATURE_GLOBAL_IPERF    "fme_iperf"
 #define FME_FEATURE_GLOBAL_ERR      "fme_error"
 #define FME_FEATURE_PR_MGMT         "fme_pr"
+#define FME_FEATURE_EMIF_MGMT       "fme_emif"
 #define FME_FEATURE_HSSI_ETH        "fme_hssi"
 #define FME_FEATURE_GLOBAL_DPERF    "fme_dperf"
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
@@ -59,7 +60,8 @@
 #define FEATURE_FIU_ID_FME	0x0
 #define FEATURE_FIU_ID_PORT	0x1
 
-#define FEATURE_ID_HEADER	0x0
+/* Reserved 0xfe for Header, 0xff for AFU*/
+#define FEATURE_ID_FIU_HEADER	0xfe
 #define FEATURE_ID_AFU		0xff
 
 enum fpga_id_type {
@@ -68,31 +70,23 @@ enum fpga_id_type {
 	FPGA_ID_MAX,
 };
 
-enum fme_feature_id {
-	FME_FEATURE_ID_HEADER = 0x0,
-
-	FME_FEATURE_ID_THERMAL_MGMT	= 0x1,
-	FME_FEATURE_ID_POWER_MGMT = 0x2,
-	FME_FEATURE_ID_GLOBAL_IPERF = 0x3,
-	FME_FEATURE_ID_GLOBAL_ERR = 0x4,
-	FME_FEATURE_ID_PR_MGMT = 0x5,
-	FME_FEATURE_ID_HSSI_ETH = 0x6,
-	FME_FEATURE_ID_GLOBAL_DPERF = 0x7,
-	FME_FEATURE_ID_QSPI_FLASH = 0x8,
-
-	/* one for fme header. */
-	FME_FEATURE_ID_MAX = 0x9,
-};
-
-enum port_feature_id {
-	PORT_FEATURE_ID_HEADER = 0x0,
-	PORT_FEATURE_ID_ERROR = 0x1,
-	PORT_FEATURE_ID_UMSG = 0x2,
-	PORT_FEATURE_ID_UINT = 0x3,
-	PORT_FEATURE_ID_STP = 0x4,
-	PORT_FEATURE_ID_UAFU = 0x5,
-	PORT_FEATURE_ID_MAX = 0x6,
-};
+#define FME_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
+#define FME_FEATURE_ID_THERMAL_MGMT 0x1
+#define FME_FEATURE_ID_POWER_MGMT 0x2
+#define FME_FEATURE_ID_GLOBAL_IPERF 0x3
+#define FME_FEATURE_ID_GLOBAL_ERR 0x4
+#define FME_FEATURE_ID_PR_MGMT 0x5
+#define FME_FEATURE_ID_HSSI_ETH 0x6
+#define FME_FEATURE_ID_GLOBAL_DPERF 0x7
+#define FME_FEATURE_ID_QSPI_FLASH 0x8
+#define FME_FEATURE_ID_EMIF_MGMT  0x9
+
+#define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
+#define PORT_FEATURE_ID_ERROR 0x10
+#define PORT_FEATURE_ID_UMSG 0x12
+#define PORT_FEATURE_ID_UINT 0x13
+#define PORT_FEATURE_ID_STP 0x14
+#define PORT_FEATURE_ID_UAFU FEATURE_ID_AFU
 
 /*
  * All headers and structures must be byte-packed to match the spec.
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +122 -225

546 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +116 -44

199 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +38 -8

92 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme.c +32 -0
index 4be60c0..9451086 100644
@@ -732,3 +732,35 @@ struct feature_ops fme_power_mgmt_ops = {
 	.get_prop = fme_power_mgmt_get_prop,
 	.set_prop = fme_power_mgmt_set_prop,
 };
+
+static int fme_hssi_eth_init(struct feature *feature)
+{
+	UNUSED(feature);
+	return 0;
+}
+
+static void fme_hssi_eth_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+}
+
+struct feature_ops fme_hssi_eth_ops = {
+	.init = fme_hssi_eth_init,
+	.uinit = fme_hssi_eth_uinit,
+};
+
+static int fme_emif_init(struct feature *feature)
+{
+	UNUSED(feature);
+	return 0;
+}
+
+static void fme_emif_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+}
+
+struct feature_ops fme_emif_ops = {
+	.init = fme_emif_init,
+	.uinit = fme_emif_uinit,
+};
drivers/raw/ifpga_rawdev/base/ifpga_hw.h +14 -2
index a20520c..8aaa056 100644
@@ -8,18 +8,28 @@
 #include "ifpga_defines.h"
 #include "opae_ifpga_hw_api.h"
 
+/** List of private feateues */
+TAILQ_HEAD(ifpga_feature_list, feature);
+
 enum ifpga_feature_state {
 	IFPGA_FEATURE_UNUSED = 0,
 	IFPGA_FEATURE_ATTACHED,
 };
 
+enum feature_type {
+	FEATURE_FME_TYPE = 0,
+	FEATURE_PORT_TYPE,
+};
+
 struct feature_irq_ctx {
 	int eventfd;
 	int idx;
 };
 
 struct feature {
+	TAILQ_ENTRY(feature)next;
 	enum ifpga_feature_state state;
+	enum feature_type type;
 	const char *name;
 	u64 id;
 	u8 *addr;
@@ -34,6 +44,8 @@ struct feature {
 	void *parent;		/* to parent hw data structure */
 
 	struct feature_ops *ops;/* callback to this private feature */
+	unsigned int vec_start;
+	unsigned int vec_cnt;
 };
 
 struct feature_ops {
@@ -52,7 +64,7 @@ enum ifpga_fme_state {
 struct ifpga_fme_hw {
 	enum ifpga_fme_state state;
 
-	struct feature sub_feature[FME_FEATURE_ID_MAX];
+	struct ifpga_feature_list feature_list;
 	spinlock_t lock;	/* protect hardware access */
 
 	void *parent;		/* pointer to ifpga_hw */
@@ -78,7 +90,7 @@ enum ifpga_port_state {
 struct ifpga_port_hw {
 	enum ifpga_port_state state;
 
-	struct feature sub_feature[PORT_FEATURE_ID_MAX];
+	struct ifpga_feature_list feature_list;
 	spinlock_t lock;	/* protect access to hw */
 
 	void *parent;		/* pointer to ifpga_hw */
drivers/raw/ifpga_rawdev/base/ifpga_port.c +21 -0
index 8b5668d..4628783 100644
@@ -386,3 +386,24 @@ struct feature_ops ifpga_rawdev_port_uint_ops = {
 	.init = port_uint_init,
 	.uinit = port_uint_uinit,
 };
+
+static int port_afu_init(struct feature *feature)
+{
+	UNUSED(feature);
+
+	dev_info(NULL, "PORT AFU Init.\n");
+
+	return 0;
+}
+
+static void port_afu_uinit(struct feature *feature)
+{
+	UNUSED(feature);
+
+	dev_info(NULL, "PORT AFU UInit.\n");
+}
+
+struct feature_ops ifpga_rawdev_port_afu_ops = {
+	.init = port_afu_init,
+	.uinit = port_afu_uinit,
+};
Signature · 1 line
1.8.3.1
author
#136 lore raw

PATCH v7 9/14 raw/ifpga_rawdev: add SPI and MAX10 device driver

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

There is a SPI bus link between A10 FPGA and MAX10 FPGA. MAX10 is in charge of board management, like power management, sensors, flash devices.

---
 drivers/raw/ifpga_rawdev/base/Makefile             |   3 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |   5 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  |   4 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          | 196 +++++++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |   2 +
 drivers/raw/ifpga_rawdev/base/meson.build          |   5 +-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |   1 +
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   |  88 +++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |  60 +++
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |   4 +
 drivers/raw/ifpga_rawdev/base/opae_spi.c           | 304 ++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           | 160 ++++++++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   | 438 +++++++++++++++++++++
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |  14 +
 15 files changed, 1285 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c
drivers/raw/ifpga_rawdev/base/Makefile +3 -0
index d79da72..c6f51a8 100644
@@ -22,5 +22,8 @@ SRCS-y += opae_hw_api.c
 SRCS-y += opae_ifpga_hw_api.c
 SRCS-y += opae_debug.c
 SRCS-y += ifpga_fme_pr.c
+SRCS-y += opae_spi.c
+SRCS-y += opae_spi_transaction.c
+SRCS-y += opae_intel_max10.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +5 -0
index 217d0b1..f5e22ae 100644
@@ -19,6 +19,8 @@
 #define FME_FEATURE_HSSI_ETH        "fme_hssi"
 #define FME_FEATURE_GLOBAL_DPERF    "fme_dperf"
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
+#define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
+#define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -43,6 +45,7 @@
 #define FME_HSSI_ETH_REVISION		0
 #define FME_GLOBAL_DPERF_REVISION	0
 #define FME_QSPI_REVISION		0
+#define FME_MAX10_SPI                   0
 
 #define PORT_HEADER_REVISION		0
 /* UAFU's header info depends on the downloaded GBS */
@@ -80,6 +83,8 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_GLOBAL_DPERF 0x7
 #define FME_FEATURE_ID_QSPI_FLASH 0x8
 #define FME_FEATURE_ID_EMIF_MGMT  0x9
+#define FME_FEATURE_ID_MAX10_SPI  0xe
+#define FME_FEATURE_ID_NIOS_SPI 0xd
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +4 -0
index d82a890..2a35c06 100644
@@ -197,6 +197,10 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_hssi_eth_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_EMIF_MGMT, FME_FEATURE_EMIF_MGMT,
 	&fme_emif_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_MAX10_SPI, FME_FEATURE_MAX10_SPI,
+	&fme_spi_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_NIOS_SPI, FME_FEATURE_NIOS_SPI,
+	&fme_nios_spi_master_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +2 -0
index 1d80f1d..72352ee 100644
@@ -171,6 +171,8 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_global_dperf_ops;
 extern struct feature_ops fme_hssi_eth_ops;
 extern struct feature_ops fme_emif_ops;
+extern struct feature_ops fme_spi_master_ops;
+extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
 int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +196 -0

205 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +2 -0
index 8aaa056..a2f4776 100644
@@ -79,6 +79,8 @@ struct ifpga_fme_hw {
 	u32 cache_size;
 
 	u32 capability;
+
+	void *max10_dev; /* MAX10 device */
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +4 -1
index 03f5112..6bc762f 100644
@@ -14,7 +14,10 @@ sources = [
 	'ifpga_fme_pr.c',
 	'opae_hw_api.c',
 	'opae_ifpga_hw_api.c',
-	'opae_debug.c'
+	'opae_debug.c',
+	'opae_spi.c',
+	'opae_spi_transaction.c',
+	'opae_intel_max10.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_hw_api.h +1 -0
index 332e0f3..76224b4 100644
@@ -11,6 +11,7 @@
 #include <sys/queue.h>
 
 #include "opae_osdep.h"
+#include "opae_intel_max10.h"
 
 #ifndef PCI_MAX_RESOURCE
 #define PCI_MAX_RESOURCE 6
drivers/raw/ifpga_rawdev/base/opae_intel_max10.c new file +88 -0

88 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_intel_max10.h new file +60 -0

60 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_osdep.h +4 -0
index 78fec50..d710ec0 100644
@@ -35,6 +35,7 @@ struct uuid {
 #ifndef BIT
 #define BIT(a) (1UL << (a))
 #endif /* BIT */
+#define U64_C(x) x ## ULL
 #ifndef BIT_ULL
 #define BIT_ULL(a) (1ULL << (a))
 #endif /* BIT_ULL */
@@ -76,5 +77,8 @@ struct uuid {
 #define msleep(x) opae_udelay(1000 * (x))
 #define usleep_range(min, max) msleep(DIV_ROUND_UP(min, 1000))
 
+#define time_after(a, b)	((long)((b) - (a)) < 0)
+#define time_before(a, b)	time_after(b, a)
 #define opae_memset(a, b, c)    memset((a), (b), (c))
+
 #endif
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +304 -0

304 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_spi.h new file +160 -0

160 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +438 -0

438 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h +14 -0
index 3d9a0ca..3ff49a8 100644
@@ -11,6 +11,7 @@
 #include <rte_log.h>
 #include <rte_io.h>
 #include <rte_malloc.h>
+#include <rte_byteorder.h>
 #include <rte_memcpy.h>
 
 #define dev_printf(level, fmt, args...) \
@@ -43,5 +44,18 @@
 #define spinlock_lock(x) rte_spinlock_lock(x)
 #define spinlock_unlock(x) rte_spinlock_unlock(x)
 
+#define cpu_to_be16(o) rte_cpu_to_be_16(o)
+#define cpu_to_be32(o) rte_cpu_to_be_32(o)
+#define cpu_to_be64(o) rte_cpu_to_be_64(o)
+#define cpu_to_le16(o) rte_cpu_to_le_16(o)
+#define cpu_to_le32(o) rte_cpu_to_le_32(o)
+#define cpu_to_le64(o) rte_cpu_to_le_64(o)
+
 #define opae_memcpy(a, b, c) rte_memcpy((a), (b), (c))
+
+static inline unsigned long msecs_to_timer_cycles(unsigned int m)
+{
+	return rte_get_timer_hz() * (m / 1000);
+}
+
 #endif
Signature · 1 line
1.8.3.1
author
#137 lore raw

PATCH v7 10/14 raw/ifpga_rawdev: add I2C and at24 EEPROM driver

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

1. Add Altera I2C master device driver
2. Add at24 eeprom driver which is i2c slave device
3. Introducing a new ops for opae_manager: opae_manager_networking_ops. This ops will include some networking operation by FPGA, like vBNG operation, MAC ROM operation and so on.

---
 drivers/raw/ifpga_rawdev/base/Makefile            |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c         |  22 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.h         |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |   3 +
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |   2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |   7 +
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         |  90 ++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |   1 +
 drivers/raw/ifpga_rawdev/base/meson.build         |   2 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c  |  88 ++++
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h  |  14 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c       |  49 ++-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h       |  26 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c          | 490 ++++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h          | 130 ++++++
 16 files changed, 926 insertions(+), 3 deletions(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.h
drivers/raw/ifpga_rawdev/base/Makefile +2 -0
index c6f51a8..edb538f 100644
@@ -25,5 +25,7 @@ SRCS-y += ifpga_fme_pr.c
 SRCS-y += opae_spi.c
 SRCS-y += opae_spi_transaction.c
 SRCS-y += opae_intel_max10.c
+SRCS-y += opae_i2c.c
+SRCS-y += opae_at24_eeprom.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +22 -0
index 77d9471..c447b3c 100644
@@ -196,6 +196,28 @@ struct opae_manager_ops ifpga_mgr_ops = {
 	.flash = ifpga_mgr_flash,
 };
 
+static int ifpga_mgr_read_mac_rom(struct opae_manager *mgr, int offset,
+		void *buf, int size)
+{
+	struct ifpga_fme_hw *fme = mgr->data;
+
+	return fme_mgr_read_mac_rom(fme, offset, buf, size);
+}
+
+static int ifpga_mgr_write_mac_rom(struct opae_manager *mgr, int offset,
+		void *buf, int size)
+{
+	struct ifpga_fme_hw *fme = mgr->data;
+
+	return fme_mgr_write_mac_rom(fme, offset, buf, size);
+}
+
+/* Network APIs in FME */
+struct opae_manager_networking_ops ifpga_mgr_network_ops = {
+	.read_mac_rom = ifpga_mgr_read_mac_rom,
+	.write_mac_rom = ifpga_mgr_write_mac_rom,
+};
+
 /* Adapter APIs */
 static int ifpga_adapter_enumerate(struct opae_adapter *adapter)
 {
drivers/raw/ifpga_rawdev/base/ifpga_api.h +1 -0
index dae7ca1..4a24769 100644
@@ -12,6 +12,7 @@
 extern struct opae_manager_ops ifpga_mgr_ops;
 extern struct opae_bridge_ops ifpga_br_ops;
 extern struct opae_accelerator_ops ifpga_acc_ops;
+extern struct opae_manager_networking_ops ifpga_mgr_network_ops;
 
 /* common APIs */
 int ifpga_get_prop(struct ifpga_hw *hw, u32 fiu_id, u32 port_id,
drivers/raw/ifpga_rawdev/base/ifpga_defines.h +3 -0
index f5e22ae..62f71c7 100644
@@ -21,6 +21,7 @@
 #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
 #define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
 #define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
+#define FME_FEATURE_I2C_MASTER      "fme_i2c_master"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -46,6 +47,7 @@
 #define FME_GLOBAL_DPERF_REVISION	0
 #define FME_QSPI_REVISION		0
 #define FME_MAX10_SPI                   0
+#define FME_I2C_MASTER                  0
 
 #define PORT_HEADER_REVISION		0
 /* UAFU's header info depends on the downloaded GBS */
@@ -85,6 +87,7 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_EMIF_MGMT  0x9
 #define FME_FEATURE_ID_MAX10_SPI  0xe
 #define FME_FEATURE_ID_NIOS_SPI 0xd
+#define FME_FEATURE_ID_I2C_MASTER  0xf
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +1 -1
index c779e0c..666dae1 100644
@@ -270,7 +270,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 
 	} else if (binfo->current_type == FME_ID) {
 		mgr = opae_manager_alloc(hw->adapter->name, &ifpga_mgr_ops,
-				binfo->fiu);
+				&ifpga_mgr_network_ops, binfo->fiu);
 		if (!mgr)
 			return -ENOMEM;
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -0
index 2a35c06..0454f80 100644
@@ -201,6 +201,8 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_spi_master_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_NIOS_SPI, FME_FEATURE_NIOS_SPI,
 	&fme_nios_spi_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_I2C_MASTER, FME_FEATURE_I2C_MASTER,
+	&fme_i2c_master_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +7 -0
index 72352ee..a398a98 100644
@@ -172,6 +172,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_hssi_eth_ops;
 extern struct feature_ops fme_emif_ops;
 extern struct feature_ops fme_spi_master_ops;
+extern struct feature_ops fme_i2c_master_ops;
 extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
@@ -197,4 +198,10 @@ struct fpga_uafu_irq_set {
 /* help functions for feature ops */
 int fpga_msix_set_block(struct feature *feature, unsigned int start,
 			unsigned int count, s32 *fds);
+
+/* FME network function ops*/
+int fme_mgr_read_mac_rom(struct ifpga_fme_hw *fme, int offset,
+		void *buf, int size);
+int fme_mgr_write_mac_rom(struct ifpga_fme_hw *fme, int offset,
+		void *buf, int size);
 #endif /* _IFPGA_FEATURE_DEV_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +90 -0

99 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +1 -0
index a2f4776..e296dd2 100644
@@ -81,6 +81,7 @@ struct ifpga_fme_hw {
 	u32 capability;
 
 	void *max10_dev; /* MAX10 device */
+	void *i2c_master; /* I2C Master device */
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +2 -0
index 6bc762f..7655985 100644
@@ -18,6 +18,8 @@ sources = [
 	'opae_spi.c',
 	'opae_spi_transaction.c',
 	'opae_intel_max10.c',
+	'opae_i2c.c',
+	'opae_at24_eeprom.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c new file +88 -0

88 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h new file +14 -0
new file mode 100644
index 0000000..caae9a3
@@ -0,0 +1,14 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2019 Intel Corporation
+ */
+
+#define AT24C512_PAGE_SIZE 128
+#define AT24C512_IO_LIMIT  128
+
+#define AT24512_SLAVE_ADDR 0x51
+
+int at24_eeprom_read(struct altera_i2c_dev *dev, unsigned int slave_addr,
+		u32 offset, u8 *buf, int count);
+int at24_eeprom_write(struct altera_i2c_dev *dev, unsigned int slave_addr,
+		u32 offset, u8 *buf, int count);
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +48 -1

69 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.h +25 -1
index 76224b4..826da37 100644
@@ -26,6 +26,7 @@ enum opae_adapter_type {
 
 /* OPAE Manager Data Structure */
 struct opae_manager_ops;
+struct opae_manager_networking_ops;
 
 /*
  * opae_manager has pointer to its parent adapter, as it could be able to manage
@@ -36,6 +37,7 @@ struct opae_manager {
 	const char *name;
 	struct opae_adapter *adapter;
 	struct opae_manager_ops *ops;
+	struct opae_manager_networking_ops *network_ops;
 	void *data;
 };
 
@@ -45,9 +47,18 @@ struct opae_manager_ops {
 		     u32 size, u64 *status);
 };
 
+/* networking management ops in FME */
+struct opae_manager_networking_ops {
+	int (*read_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
+			int size);
+	int (*write_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
+			int size);
+};
+
 /* OPAE Manager APIs */
 struct opae_manager *
-opae_manager_alloc(const char *name, struct opae_manager_ops *ops, void *data);
+opae_manager_alloc(const char *name, struct opae_manager_ops *ops,
+		struct opae_manager_networking_ops *network_ops, void *data);
 #define opae_manager_free(mgr) opae_free(mgr)
 int opae_manager_flash(struct opae_manager *mgr, int acc_id, void *buf,
 		       u32 size, u64 *status);
@@ -252,4 +263,17 @@ static inline void opae_adapter_remove_acc(struct opae_adapter *adapter,
 {
 	TAILQ_REMOVE(&adapter->acc_list, acc, node);
 }
+
+/* OPAE vBNG network datastruct */
+#define OPAE_ETHER_ADDR_LEN 6
+
+struct opae_ether_addr {
+	unsigned char addr_bytes[OPAE_ETHER_ADDR_LEN];
+} __attribute__((__packed__));
+
+/* OPAE vBNG network API*/
+int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
+		struct opae_ether_addr *addr);
+int opae_manager_write_mac_rom(struct opae_manager *mgr, int port,
+		struct opae_ether_addr *addr);
 #endif /* _OPAE_HW_API_H_*/
drivers/raw/ifpga_rawdev/base/opae_i2c.c new file +490 -0

490 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_i2c.h new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author
#138 lore raw

PATCH v7 11/14 raw/ifpga_rawdev: add eth group driver

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

There is two eth group devices in PAC N3000 card, each eth group include PHY device and MAC device. Exposing APIs for DPDK PMD driver to access those devices.

---
 drivers/raw/ifpga_rawdev/base/Makefile            |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c         |  74 ++++++-
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h     |  39 ++++
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |   6 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |   2 +
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h |  12 ++
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         | 250 ++++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          |   7 +
 drivers/raw/ifpga_rawdev/base/meson.build         |   1 +
 drivers/raw/ifpga_rawdev/base/opae_eth_group.c    | 145 +++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_eth_group.h    |  96 +++++++++
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c       | 149 +++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h       |  27 +++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h  |  42 +++-
 drivers/raw/ifpga_rawdev/base/opae_osdep.h        |  16 +-
 15 files changed, 858 insertions(+), 9 deletions(-)
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.h
drivers/raw/ifpga_rawdev/base/Makefile +1 -0
index edb538f..c5bbcbd 100644
@@ -27,5 +27,6 @@ SRCS-y += opae_spi_transaction.c
 SRCS-y += opae_intel_max10.c
 SRCS-y += opae_i2c.c
 SRCS-y += opae_at24_eeprom.c
+SRCS-y += opae_eth_group.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +73 -1

98 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_defines.h +39 -0
index 62f71c7..b7151ca 100644
@@ -22,6 +22,7 @@
 #define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
 #define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
 #define FME_FEATURE_I2C_MASTER      "fme_i2c_master"
+#define FME_FEATURE_ETH_GROUP       "fme_eth_group"
 
 #define PORT_FEATURE_HEADER         "port_hdr"
 #define PORT_FEATURE_UAFU           "port_uafu"
@@ -88,6 +89,7 @@ enum fpga_id_type {
 #define FME_FEATURE_ID_MAX10_SPI  0xe
 #define FME_FEATURE_ID_NIOS_SPI 0xd
 #define FME_FEATURE_ID_I2C_MASTER  0xf
+#define FME_FEATURE_ID_ETH_GROUP 0x10
 
 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
 #define PORT_FEATURE_ID_ERROR 0x10
@@ -1661,5 +1663,42 @@ struct bts_header {
 	(((bts_hdr)->guid_h == GBS_GUID_H) &&		\
 	((bts_hdr)->guid_l == GBS_GUID_L))
 
+/* bitstream id definition */
+struct fme_bitstream_id {
+	union {
+		u64 id;
+		struct {
+			u64 hash:32;
+			u64 interface:4;
+			u64 reserved:12;
+			u64 debug:4;
+			u64 patch:4;
+			u64 minor:4;
+			u64 major:4;
+		};
+	};
+};
+
+enum board_interface {
+	VC_8_10G = 0,
+	VC_4_25G = 1,
+	VC_2_1_25 = 2,
+	VC_4_25G_2_25G = 3,
+	VC_2_2_25G = 4,
+};
+
+struct ifpga_fme_board_info {
+	enum board_interface type;
+	u32 build_hash;
+	u32 debug_version;
+	u32 patch_version;
+	u32 minor_version;
+	u32 major_version;
+	u32 nums_of_retimer;
+	u32 ports_per_retimer;
+	u32 nums_of_fvl;
+	u32 ports_per_fvl;
+};
+
 #pragma pack(pop)
 #endif /* _BASE_IFPGA_DEFINES_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +6 -0
index 666dae1..44086c1 100644
@@ -232,6 +232,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 	struct opae_bridge *br;
 	struct opae_accelerator *acc;
 	struct ifpga_port_hw *port;
+	struct ifpga_fme_hw *fme;
 	struct feature *feature;
 
 	if (!binfo->fiu)
@@ -264,8 +265,13 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 		}
 
 		acc->br = br;
+		if (hw->adapter->mgr)
+			acc->mgr = hw->adapter->mgr;
 		acc->index = br->id;
 
+		fme = &hw->fme;
+		fme->nums_acc_region = info->num_regions;
+
 		opae_adapter_add_acc(hw->adapter, acc);
 
 	} else if (binfo->current_type == FME_ID) {
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -0
index 0454f80..5ebc449 100644
@@ -203,6 +203,8 @@ int port_clear_error(struct ifpga_port_hw *port)
 	&fme_nios_spi_master_ops),},
 	{FEATURE_DRV(FME_FEATURE_ID_I2C_MASTER, FME_FEATURE_I2C_MASTER,
 	&fme_i2c_master_ops),},
+	{FEATURE_DRV(FME_FEATURE_ID_ETH_GROUP, FME_FEATURE_ETH_GROUP,
+	&fme_eth_group_ops),},
 	{0, NULL, NULL}, /* end of arrary */
 };
 
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +12 -0
index a398a98..3f63f5a 100644
@@ -173,6 +173,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size,
 extern struct feature_ops fme_emif_ops;
 extern struct feature_ops fme_spi_master_ops;
 extern struct feature_ops fme_i2c_master_ops;
+extern struct feature_ops fme_eth_group_ops;
 extern struct feature_ops fme_nios_spi_master_ops;
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop);
@@ -204,4 +205,15 @@ int fme_mgr_read_mac_rom(struct ifpga_fme_hw *fme, int offset,
 		void *buf, int size);
 int fme_mgr_write_mac_rom(struct ifpga_fme_hw *fme, int offset,
 		void *buf, int size);
+int fme_mgr_get_eth_group_nums(struct ifpga_fme_hw *fme);
+int fme_mgr_get_eth_group_info(struct ifpga_fme_hw *fme,
+		u8 group_id, struct opae_eth_group_info *info);
+int fme_mgr_eth_group_read_reg(struct ifpga_fme_hw *fme, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 *data);
+int fme_mgr_eth_group_write_reg(struct ifpga_fme_hw *fme, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 data);
+int fme_mgr_get_retimer_info(struct ifpga_fme_hw *fme,
+		struct opae_retimer_info *info);
+int fme_mgr_get_retimer_status(struct ifpga_fme_hw *fme,
+		struct opae_retimer_status *status);
 #endif /* _IFPGA_FEATURE_DEV_H_ */
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +250 -0

271 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_hw.h +7 -0
index e296dd2..a428d69 100644
@@ -7,6 +7,7 @@
 
 #include "ifpga_defines.h"
 #include "opae_ifpga_hw_api.h"
+#include "opae_eth_group.h"
 
 /** List of private feateues */
 TAILQ_HEAD(ifpga_feature_list, feature);
@@ -82,6 +83,12 @@ struct ifpga_fme_hw {
 
 	void *max10_dev; /* MAX10 device */
 	void *i2c_master; /* I2C Master device */
+	void *eth_dev[MAX_ETH_GROUP_DEVICES];
+	struct opae_reg_region
+		eth_group_region[MAX_ETH_GROUP_DEVICES];
+	struct ifpga_fme_board_info board_info;
+	int nums_eth_dev;
+	unsigned int nums_acc_region;
 };
 
 enum ifpga_port_state {
drivers/raw/ifpga_rawdev/base/meson.build +1 -0
index 7655985..f1015bb 100644
@@ -20,6 +20,7 @@ sources = [
 	'opae_intel_max10.c',
 	'opae_i2c.c',
 	'opae_at24_eeprom.c',
+	'opae_eth_group.c',
 ]
 
 error_cflags = ['-Wno-sign-compare', '-Wno-unused-value',
drivers/raw/ifpga_rawdev/base/opae_eth_group.c new file +145 -0

145 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_eth_group.h new file +96 -0

96 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.c +149 -0

152 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.h +27 -0
index 826da37..383e751 100644
@@ -12,6 +12,7 @@
 
 #include "opae_osdep.h"
 #include "opae_intel_max10.h"
+#include "opae_eth_group.h"
 
 #ifndef PCI_MAX_RESOURCE
 #define PCI_MAX_RESOURCE 6
@@ -45,6 +46,8 @@ struct opae_manager {
 struct opae_manager_ops {
 	int (*flash)(struct opae_manager *mgr, int id, void *buffer,
 		     u32 size, u64 *status);
+	int (*get_eth_group_region_info)(struct opae_manager *mgr,
+			struct opae_eth_group_region_info *info);
 };
 
 /* networking management ops in FME */
@@ -53,6 +56,17 @@ struct opae_manager_networking_ops {
 			int size);
 	int (*write_mac_rom)(struct opae_manager *mgr, int offset, void *buf,
 			int size);
+	int (*get_eth_group_nums)(struct opae_manager *mgr);
+	int (*get_eth_group_info)(struct opae_manager *mgr,
+			u8 group_id, struct opae_eth_group_info *info);
+	int (*eth_group_reg_read)(struct opae_manager *mgr, u8 group_id,
+			u8 type, u8 index, u16 addr, u32 *data);
+	int (*eth_group_reg_write)(struct opae_manager *mgr, u8 group_id,
+			u8 type, u8 index, u16 addr, u32 data);
+	int (*get_retimer_info)(struct opae_manager *mgr,
+			struct opae_retimer_info *info);
+	int (*get_retimer_status)(struct opae_manager *mgr,
+			struct opae_retimer_status *status);
 };
 
 /* OPAE Manager APIs */
@@ -62,6 +76,8 @@ struct opae_manager *
 #define opae_manager_free(mgr) opae_free(mgr)
 int opae_manager_flash(struct opae_manager *mgr, int acc_id, void *buf,
 		       u32 size, u64 *status);
+int opae_manager_get_eth_group_region_info(struct opae_manager *mgr,
+		u8 group_id, struct opae_eth_group_region_info *info);
 
 /* OPAE Bridge Data Structure */
 struct opae_bridge_ops;
@@ -276,4 +292,15 @@ int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
 		struct opae_ether_addr *addr);
 int opae_manager_write_mac_rom(struct opae_manager *mgr, int port,
 		struct opae_ether_addr *addr);
+int opae_manager_get_retimer_info(struct opae_manager *mgr,
+		struct opae_retimer_info *info);
+int opae_manager_get_retimer_status(struct opae_manager *mgr,
+		struct opae_retimer_status *status);
+int opae_manager_get_eth_group_nums(struct opae_manager *mgr);
+int opae_manager_get_eth_group_info(struct opae_manager *mgr,
+		u8 group_id, struct opae_eth_group_info *info);
+int opae_manager_eth_group_write_reg(struct opae_manager *mgr, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 data);
+int opae_manager_eth_group_read_reg(struct opae_manager *mgr, u8 group_id,
+		u8 type, u8 index, u16 addr, u32 *data);
 #endif /* _OPAE_HW_API_H_*/
drivers/raw/ifpga_rawdev/base/opae_intel_max10.h +39 -3

54 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_osdep.h +11 -5
index d710ec0..1596adc 100644
@@ -53,12 +53,7 @@ struct uuid {
 #define dev_err(x, args...) dev_printf(ERR, args)
 #define dev_info(x, args...) dev_printf(INFO, args)
 #define dev_warn(x, args...) dev_printf(WARNING, args)
-
-#ifdef OPAE_DEBUG
 #define dev_debug(x, args...) dev_printf(DEBUG, args)
-#else
-#define dev_debug(x, args...) do { } while (0)
-#endif
 
 #define pr_err(y, args...) dev_err(0, y, ##args)
 #define pr_warn(y, args...) dev_warn(0, y, ##args)
@@ -81,4 +76,15 @@ struct uuid {
 #define time_before(a, b)	time_after(b, a)
 #define opae_memset(a, b, c)    memset((a), (b), (c))
 
+#define opae_readq_poll_timeout(addr, val, cond, invl, timeout)\
+({									     \
+	int wait = 0;							     \
+	for (; wait <= timeout; wait += invl) {			     \
+		(val) = opae_readq(addr);				     \
+		if (cond)                  \
+			break;						     \
+		udelay(invl);						     \
+	}								     \
+	(cond) ? 0 : -ETIMEDOUT;	  \
+})
 #endif
Signature · 1 line
1.8.3.1
author
#139 lore raw

PATCH v7 12/14 raw/ifpga_rawdev: add version description on README

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

add verion description on READ about ifpga base code.

---
 drivers/raw/ifpga_rawdev/base/README | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/raw/ifpga_rawdev/base/README +15 -0
index 5bc2ed0..6b2b171 100644
@@ -29,3 +29,18 @@ the following file(s):
 
 	osdep_raw/osdep_generic.h
 	osdep_rte/osdep_generic.h
+
+
+New Features
+==================
+
+2019-03:
+Support Intel FPGA PAC N3000 card.
+Some features added in this version:
+1. Store private features in FME and Port list.
+2. Add eth group devices driver.
+3. Add altera SPI master driver and Intel MAX10 device driver.
+4. Add Altera I2C master driver and AT24 eeprom driver.
+5. Add Device Tree support to get the configuration from card.
+6. Instruding and exposing APIs to DPDK PMD driver to access networking
+functionality.
Signature · 1 line
1.8.3.1
author
#140 lore raw

PATCH v7 13/14 raw/ifpga_rawdev: using prefix name for feature and its ops

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

Using prefix name "ifpga_" for feature and feature_ops data struct on ifpga base code, which is suggested by Yigit, Ferruh.

---
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c   |  8 +--
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c |  4 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h | 58 ++++++++++---------
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c         | 70 +++++++++++------------
 drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c   | 16 +++---
 drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c   | 18 +++---
 drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c   | 28 ++++-----
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c      |  6 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h          | 22 +++----
 drivers/raw/ifpga_rawdev/base/ifpga_port.c        | 36 ++++++------
 drivers/raw/ifpga_rawdev/base/ifpga_port_error.c  | 10 ++--
 11 files changed, 141 insertions(+), 135 deletions(-)
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +4 -4
index 44086c1..b8846e3 100644
@@ -73,7 +73,7 @@ static u64 feature_id(void __iomem *start)
 		unsigned int vec_cnt)
 {
 	struct ifpga_hw *hw = binfo->hw;
-	struct feature *feature = NULL;
+	struct ifpga_feature *feature = NULL;
 	struct feature_irq_ctx *ctx = NULL;
 	int port_id, ret = 0;
 	unsigned int i;
@@ -81,7 +81,7 @@ static u64 feature_id(void __iomem *start)
 	fid = fid?fid:feature_id(start);
 	size = size?size:feature_size(start);
 
-	feature = opae_malloc(sizeof(struct feature));
+	feature = opae_malloc(sizeof(struct ifpga_feature));
 	if (!feature)
 		return -ENOMEM;
 
@@ -233,7 +233,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
 	struct opae_accelerator *acc;
 	struct ifpga_port_hw *port;
 	struct ifpga_fme_hw *fme;
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!binfo->fiu)
 		return 0;
@@ -645,7 +645,7 @@ static void ifpga_print_device_feature_list(struct ifpga_hw *hw)
 {
 	struct ifpga_fme_hw *fme = &hw->fme;
 	struct ifpga_port_hw *port;
-	struct feature *feature;
+	struct ifpga_feature *feature;
 	int i;
 
 	dev_info(hw, "found fme_device, is in PF: %s\n",
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +2 -2
index 5ebc449..63c8bcc 100644
@@ -252,7 +252,7 @@ const char *get_port_feature_name(unsigned int id)
 
 static void feature_uinit(struct ifpga_feature_list *list)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	TAILQ_FOREACH(feature, list, next) {
 		if (feature->state != IFPGA_FEATURE_ATTACHED)
@@ -265,7 +265,7 @@ static void feature_uinit(struct ifpga_feature_list *list)
 static int feature_init(struct feature_driver *drv,
 		struct ifpga_feature_list *list)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 	int ret;
 
 	while (drv->ops) {
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +30 -28

114 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme.c +35 -35

268 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c +8 -8
index 1773b87..954f8a8 100644
@@ -183,7 +183,7 @@ static int fme_dperf_set_fab_freeze(struct ifpga_fme_hw *fme, u64 freeze)
 
 #define PERF_MAX_PORT_NUM	1
 
-static int fme_global_dperf_init(struct feature *feature)
+static int fme_global_dperf_init(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
@@ -192,14 +192,14 @@ static int fme_global_dperf_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_dperf_uinit(struct feature *feature)
+static void fme_global_dperf_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME global_dperf UInit.\n");
 }
 
-static int fme_dperf_fab_get_prop(struct feature *feature,
+static int fme_dperf_fab_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -225,7 +225,7 @@ static int fme_dperf_fab_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_dperf_root_get_prop(struct feature *feature,
+static int fme_dperf_root_get_prop(struct ifpga_feature *feature,
 				   struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -245,7 +245,7 @@ static int fme_dperf_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_dperf_get_prop(struct feature *feature,
+static int fme_global_dperf_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -260,7 +260,7 @@ static int fme_global_dperf_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_dperf_fab_set_prop(struct feature *feature,
+static int fme_dperf_fab_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -279,7 +279,7 @@ static int fme_dperf_fab_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_dperf_set_prop(struct feature *feature,
+static int fme_global_dperf_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -292,7 +292,7 @@ static int fme_global_dperf_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_dperf_ops = {
+struct ifpga_feature_ops fme_global_dperf_ops = {
 	.init = fme_global_dperf_init,
 	.uinit = fme_global_dperf_uinit,
 	.get_prop = fme_global_dperf_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c +9 -9
index 8c26fb2..3794564 100644
@@ -240,7 +240,7 @@ static void fme_error_enable(struct ifpga_fme_hw *fme)
 	writeq(0UL, &fme_err->ras_catfat_mask);
 }
 
-static int fme_global_error_init(struct feature *feature)
+static int fme_global_error_init(struct ifpga_feature *feature)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
 
@@ -252,12 +252,12 @@ static int fme_global_error_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_error_uinit(struct feature *feature)
+static void fme_global_error_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 }
 
-static int fme_err_fme_err_get_prop(struct feature *feature,
+static int fme_err_fme_err_get_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -275,7 +275,7 @@ static int fme_err_fme_err_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_root_get_prop(struct feature *feature,
+static int fme_err_root_get_prop(struct ifpga_feature *feature,
 				 struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -301,7 +301,7 @@ static int fme_err_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_error_get_prop(struct feature *feature,
+static int fme_global_error_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -321,7 +321,7 @@ static int fme_global_error_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_fme_err_set_prop(struct feature *feature,
+static int fme_err_fme_err_set_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -335,7 +335,7 @@ static int fme_err_fme_err_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_err_root_set_prop(struct feature *feature,
+static int fme_err_root_set_prop(struct ifpga_feature *feature,
 				 struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -353,7 +353,7 @@ static int fme_err_root_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_error_set_prop(struct feature *feature,
+static int fme_global_error_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -373,7 +373,7 @@ static int fme_global_error_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_err_ops = {
+struct ifpga_feature_ops fme_global_err_ops = {
 	.init = fme_global_error_init,
 	.uinit = fme_global_error_uinit,
 	.get_prop = fme_global_error_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c +14 -14
index e6c40a1..70543b9 100644
@@ -407,7 +407,7 @@ static int fme_iperf_set_fab_freeze(struct ifpga_fme_hw *fme, u64 freeze)
 #define PERF_MAX_PORT_NUM	1
 #define FME_IPERF_CAP_IOMMU	0x1
 
-static int fme_global_iperf_init(struct feature *feature)
+static int fme_global_iperf_init(struct ifpga_feature *feature)
 {
 	struct ifpga_fme_hw *fme;
 	struct feature_fme_header *fme_hdr;
@@ -429,14 +429,14 @@ static int fme_global_iperf_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_global_iperf_uinit(struct feature *feature)
+static void fme_global_iperf_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME global_iperf UInit.\n");
 }
 
-static int fme_iperf_root_get_prop(struct feature *feature,
+static int fme_iperf_root_get_prop(struct ifpga_feature *feature,
 				   struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -456,7 +456,7 @@ static int fme_iperf_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_cache_get_prop(struct feature *feature,
+static int fme_iperf_cache_get_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -496,7 +496,7 @@ static int fme_iperf_cache_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_root_get_prop(struct feature *feature,
+static int fme_iperf_vtd_root_get_prop(struct ifpga_feature *feature,
 				       struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -534,7 +534,7 @@ static int fme_iperf_vtd_root_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_sub_get_prop(struct feature *feature,
+static int fme_iperf_vtd_sub_get_prop(struct ifpga_feature *feature,
 				      struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -571,7 +571,7 @@ static int fme_iperf_vtd_sub_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_get_prop(struct feature *feature,
+static int fme_iperf_vtd_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	u8 sub = GET_FIELD(PROP_SUB, prop->prop_id);
@@ -582,7 +582,7 @@ static int fme_iperf_vtd_get_prop(struct feature *feature,
 	return fme_iperf_vtd_sub_get_prop(feature, prop);
 }
 
-static int fme_iperf_fab_get_prop(struct feature *feature,
+static int fme_iperf_fab_get_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -626,7 +626,7 @@ static int fme_iperf_fab_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_iperf_get_prop(struct feature *feature,
+static int fme_global_iperf_get_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -645,7 +645,7 @@ static int fme_global_iperf_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_cache_set_prop(struct feature *feature,
+static int fme_iperf_cache_set_prop(struct ifpga_feature *feature,
 				    struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -658,7 +658,7 @@ static int fme_iperf_cache_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_vtd_set_prop(struct feature *feature,
+static int fme_iperf_vtd_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -671,7 +671,7 @@ static int fme_iperf_vtd_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_iperf_fab_set_prop(struct feature *feature,
+static int fme_iperf_fab_set_prop(struct ifpga_feature *feature,
 				  struct feature_prop *prop)
 {
 	struct ifpga_fme_hw *fme = feature->parent;
@@ -690,7 +690,7 @@ static int fme_iperf_fab_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int fme_global_iperf_set_prop(struct feature *feature,
+static int fme_global_iperf_set_prop(struct ifpga_feature *feature,
 				     struct feature_prop *prop)
 {
 	u8 top = GET_FIELD(PROP_TOP, prop->prop_id);
@@ -707,7 +707,7 @@ static int fme_global_iperf_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops fme_global_iperf_ops = {
+struct ifpga_feature_ops fme_global_iperf_ops = {
 	.init = fme_global_iperf_init,
 	.uinit = fme_global_iperf_uinit,
 	.get_prop = fme_global_iperf_get_prop,
drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c +3 -3
index 8890f4b..efa7266 100644
@@ -315,7 +315,7 @@ int do_pr(struct ifpga_hw *hw, u32 port_id, void *buffer, u32 size, u64 *status)
 	return fme_pr(hw, port_id, buf, size, status);
 }
 
-static int fme_pr_mgmt_init(struct feature *feature)
+static int fme_pr_mgmt_init(struct ifpga_feature *feature)
 {
 	struct feature_fme_pr *fme_pr;
 	struct feature_header fme_pr_header;
@@ -339,14 +339,14 @@ static int fme_pr_mgmt_init(struct feature *feature)
 	return 0;
 }
 
-static void fme_pr_mgmt_uinit(struct feature *feature)
+static void fme_pr_mgmt_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "FME PR MGMT UInit.\n");
 }
 
-struct feature_ops fme_pr_mgmt_ops = {
+struct ifpga_feature_ops fme_pr_mgmt_ops = {
 	.init = fme_pr_mgmt_init,
 	.uinit = fme_pr_mgmt_uinit,
 };
drivers/raw/ifpga_rawdev/base/ifpga_hw.h +12 -10
index a428d69..ff91c46 100644
@@ -10,7 +10,7 @@
 #include "opae_eth_group.h"
 
 /** List of private feateues */
-TAILQ_HEAD(ifpga_feature_list, feature);
+TAILQ_HEAD(ifpga_feature_list, ifpga_feature);
 
 enum ifpga_feature_state {
 	IFPGA_FEATURE_UNUSED = 0,
@@ -27,8 +27,8 @@ struct feature_irq_ctx {
 	int idx;
 };
 
-struct feature {
-	TAILQ_ENTRY(feature)next;
+struct ifpga_feature {
+	TAILQ_ENTRY(ifpga_feature)next;
 	enum ifpga_feature_state state;
 	enum feature_type type;
 	const char *name;
@@ -44,17 +44,19 @@ struct feature {
 
 	void *parent;		/* to parent hw data structure */
 
-	struct feature_ops *ops;/* callback to this private feature */
+	struct ifpga_feature_ops *ops;/* callback to this private feature */
 	unsigned int vec_start;
 	unsigned int vec_cnt;
 };
 
-struct feature_ops {
-	int (*init)(struct feature *feature);
-	void (*uinit)(struct feature *feature);
-	int (*get_prop)(struct feature *feature, struct feature_prop *prop);
-	int (*set_prop)(struct feature *feature, struct feature_prop *prop);
-	int (*set_irq)(struct feature *feature, void *irq_set);
+struct ifpga_feature_ops {
+	int (*init)(struct ifpga_feature *feature);
+	void (*uinit)(struct ifpga_feature *feature);
+	int (*get_prop)(struct ifpga_feature *feature,
+			struct feature_prop *prop);
+	int (*set_prop)(struct ifpga_feature *feature,
+			struct feature_prop *prop);
+	int (*set_irq)(struct ifpga_feature *feature, void *irq_set);
 };
 
 enum ifpga_fme_state {
drivers/raw/ifpga_rawdev/base/ifpga_port.c +19 -17
index 4628783..6c41164 100644
@@ -6,7 +6,7 @@
 
 int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -21,7 +21,7 @@ int port_get_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 
 int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -36,7 +36,7 @@ int port_set_prop(struct ifpga_port_hw *port, struct feature_prop *prop)
 
 int port_set_irq(struct ifpga_port_hw *port, u32 feature_id, void *irq_set)
 {
-	struct feature *feature;
+	struct ifpga_feature *feature;
 
 	if (!port)
 		return -ENOENT;
@@ -260,7 +260,7 @@ static int port_get_userclk_freqcntrsts(struct ifpga_port_hw *port, u64 *val)
 	return 0;
 }
 
-static int port_hdr_init(struct feature *feature)
+static int port_hdr_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -271,14 +271,15 @@ static int port_hdr_init(struct feature *feature)
 	return 0;
 }
 
-static void port_hdr_uinit(struct feature *feature)
+static void port_hdr_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "port hdr uinit.\n");
 }
 
-static int port_hdr_get_prop(struct feature *feature, struct feature_prop *prop)
+static int port_hdr_get_prop(struct ifpga_feature *feature,
+		struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -308,7 +309,8 @@ static int port_hdr_get_prop(struct feature *feature, struct feature_prop *prop)
 	return -ENOENT;
 }
 
-static int port_hdr_set_prop(struct feature *feature, struct feature_prop *prop)
+static int port_hdr_set_prop(struct ifpga_feature *feature,
+		struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -326,14 +328,14 @@ static int port_hdr_set_prop(struct feature *feature, struct feature_prop *prop)
 	return -ENOENT;
 }
 
-struct feature_ops ifpga_rawdev_port_hdr_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_hdr_ops = {
 	.init = port_hdr_init,
 	.uinit = port_hdr_uinit,
 	.get_prop = port_hdr_get_prop,
 	.set_prop = port_hdr_set_prop,
 };
 
-static int port_stp_init(struct feature *feature)
+static int port_stp_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -347,19 +349,19 @@ static int port_stp_init(struct feature *feature)
 	return 0;
 }
 
-static void port_stp_uinit(struct feature *feature)
+static void port_stp_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "port stp uinit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_stp_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_stp_ops = {
 	.init = port_stp_init,
 	.uinit = port_stp_uinit,
 };
 
-static int port_uint_init(struct feature *feature)
+static int port_uint_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -375,19 +377,19 @@ static int port_uint_init(struct feature *feature)
 	return 0;
 }
 
-static void port_uint_uinit(struct feature *feature)
+static void port_uint_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "PORT UINT UInit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_uint_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_uint_ops = {
 	.init = port_uint_init,
 	.uinit = port_uint_uinit,
 };
 
-static int port_afu_init(struct feature *feature)
+static int port_afu_init(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
@@ -396,14 +398,14 @@ static int port_afu_init(struct feature *feature)
 	return 0;
 }
 
-static void port_afu_uinit(struct feature *feature)
+static void port_afu_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 
 	dev_info(NULL, "PORT AFU UInit.\n");
 }
 
-struct feature_ops ifpga_rawdev_port_afu_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_afu_ops = {
 	.init = port_afu_init,
 	.uinit = port_afu_uinit,
 };
drivers/raw/ifpga_rawdev/base/ifpga_port_error.c +5 -5
index 9dd1cf5..138284e 100644
@@ -84,7 +84,7 @@ static int port_err_set_clear(struct ifpga_port_hw *port, u64 val)
 	return ret;
 }
 
-static int port_error_init(struct feature *feature)
+static int port_error_init(struct ifpga_feature *feature)
 {
 	struct ifpga_port_hw *port = feature->parent;
 
@@ -99,12 +99,12 @@ static int port_error_init(struct feature *feature)
 	return 0;
 }
 
-static void port_error_uinit(struct feature *feature)
+static void port_error_uinit(struct ifpga_feature *feature)
 {
 	UNUSED(feature);
 }
 
-static int port_error_get_prop(struct feature *feature,
+static int port_error_get_prop(struct ifpga_feature *feature,
 			       struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
@@ -125,7 +125,7 @@ static int port_error_get_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-static int port_error_set_prop(struct feature *feature,
+static int port_error_set_prop(struct ifpga_feature *feature,
 			       struct feature_prop *prop)
 {
 	struct ifpga_port_hw *port = feature->parent;
@@ -136,7 +136,7 @@ static int port_error_set_prop(struct feature *feature,
 	return -ENOENT;
 }
 
-struct feature_ops ifpga_rawdev_port_error_ops = {
+struct ifpga_feature_ops ifpga_rawdev_port_error_ops = {
 	.init = port_error_init,
 	.uinit = port_error_uinit,
 	.get_prop = port_error_get_prop,
Signature · 1 line
1.8.3.1
author
#141 lore raw

PATCH v7 14/14 raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE support for IFPGA Rawdev.

---
 drivers/raw/ifpga_rawdev/Makefile       |   1 +
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 248 +++++++++++++++++++++++++++++++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h |  16 ++-
 drivers/raw/ifpga_rawdev/meson.build    |   6 +-
 4 files changed, 265 insertions(+), 6 deletions(-)
drivers/raw/ifpga_rawdev/Makefile +1 -0
index f3b9d5e..f60b547 100644
@@ -13,6 +13,7 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga
 CFLAGS += -I$(RTE_SDK)/drivers/raw/ifpga_rawdev
+CFLAGS += -I$(RTE_SDK)/drivers/net/ipn3ke
 LDLIBS += -lrte_eal
 LDLIBS += -lrte_rawdev
 LDLIBS += -lrte_bus_vdev
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +245 -3

306 lines not on this page · raw message

drivers/raw/ifpga_rawdev/ifpga_rawdev.h +14 -2
index 234ce36..fcb1a96 100644
@@ -8,8 +8,8 @@
 extern int ifpga_rawdev_logtype;
 
 #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "%s(): " fmt "\n", \
-				__func__, ##args)
+	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifpga_rawdev: " fmt, \
+		##args)
 
 #define IFPGA_RAWDEV_PMD_FUNC_TRACE() IFPGA_RAWDEV_PMD_LOG(DEBUG, ">>")
 
@@ -28,6 +28,18 @@ enum ifpga_rawdev_device_state {
 	IFPGA_ERROR
 };
 
+/** Set a bit in the uint64 variable */
+#define IFPGA_BIT_SET(var, pos) \
+	((var) |= ((uint64_t)1 << ((pos))))
+
+/** Reset the bit in the variable */
+#define IFPGA_BIT_RESET(var, pos) \
+	((var) &= ~((uint64_t)1 << ((pos))))
+
+/** Check the bit is set in the variable */
+#define IFPGA_BIT_ISSET(var, pos) \
+	(((var) & ((uint64_t)1 << ((pos)))) ? 1 : 0)
+
 static inline struct opae_adapter *
 ifpga_rawdev_get_priv(const struct rte_rawdev *rawdev)
 {
drivers/raw/ifpga_rawdev/meson.build +5 -1
index 6725687..132b777 100644
@@ -6,8 +6,12 @@ version = 1
 subdir('base')
 objs = [base_objs]
 
+dep = dependency('libfdt', required: false)
+if not dep.found()
+	build = false
+endif
 deps += ['rawdev', 'pci', 'bus_pci', 'kvargs',
-	'bus_vdev', 'bus_ifpga']
+	'bus_vdev', 'bus_ifpga', 'net']
 sources = files('ifpga_rawdev.c')
 
 includes += include_directories('base')
Signature · 1 line
1.8.3.1
#142 lore raw
In reply to Rosen Xu
Quoted 53 lines · Rosen Xu

v7 updates:
=========
- Fix Stephen comments

v6 updates:
==========
- Fix v5 comments
- Fix TM Shaper rate issue

v5 updates:
==========
- Fix EXPERIMENTAL symbol definition issue

v4 updates:
==========
- Fix coding style issues

v3 updates:
==========
- Fix v2 comments
- Update MAC BAR of AFU index get ops
- Remove OPAE share code dependency of libfdt

v2 updates:
==========
- Fix v1 comments
- Add support for 10G Base Line Design Bitstream
- Add support for 25G Base Line Design Bitstream

This patch set adds the support of a new net PMD, Intel® FPGA Programmable Acceleration Card N3000, also called ipn3ke.

The ipn3ke PMD (librte_pmd_ipn3ke) provides poll mode driver support for Intel® FPGA PAC(Programmable Acceleration Card) N3000 based on the Intel Ethernet Controller X710/XXV710 and Intel Arria 10 FPGA.

In this card, FPGA is an acceleration bridge between network interface and the Intel Ethernet Controller. Although both FPGA and Ethernet Controllers are connected to CPU with PCIe Gen3x16 Switch, all the packet RX/TX is handled by Intel Ethernet Controller. So from application point of view the data path is still the legacy Intel Ethernet Controller X710/XXV710 PMD. Besides this, users can enable more acceleration features by FPGA IP.

Rosen Xu (7):
bus/ifpga: add AFU shared data
bus/ifpga: add function for AFU search by name net/ipn3ke: add IPN3KE ethdev PMD driver net/ipn3ke: add IPN3KE representor of PMD driver net/ipn3ke: add IPN3KE TM of PMD driver net/ipn3ke: add IPN3KE Flow of PMD driver raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Quoted 8 lines

Tianfei zhang (7):
raw/ifpga_rawdev: clean up code for ifpga share code raw/ifpga_rawdev: store private features in FME and Port raw/ifpga_rawdev: add SPI and MAX10 device driver raw/ifpga_rawdev: add I2C and at24 EEPROM driver raw/ifpga_rawdev: add eth group driver raw/ifpga_rawdev: add version description on README raw/ifpga_rawdev: using prefix name for feature and its ops

Getting following build error [1], some tm enums seems merged into main repo, can you please send a new version with fix?

[1]
.../drivers/net/ipn3ke/ipn3ke_tm.c: In function ‘ipn3ke_tm_tdrop_profile_check’:
.../drivers/net/ipn3ke/ipn3ke_tm.c:816:20: error: storage size of ‘color’ isn’t known

  enum rte_tm_color color;
                    ^~~~~
.../drivers/net/ipn3ke/ipn3ke_tm.c:843:15: error: ‘RTE_TM_GREEN’ undeclared
(first use in this function); did you mean ‘RTE_COLOR_GREEN’?
  for (color = RTE_TM_GREEN; color <= RTE_TM_GREEN; color++) {
               ^~~~~~~~~~~~
               RTE_COLOR_GREEN

.../drivers/net/ipn3ke/ipn3ke_tm.c:843:15: note: each undeclared identifier is reported only once for each function it appears in .../drivers/net/ipn3ke/ipn3ke_tm.c:816:20: error: unused variable ‘color’ [-Werror=unused-variable]

  enum rte_tm_color color;
                    ^~~~~
.../drivers/net/ipn3ke/ipn3ke_tm.c: In function ‘ipn3ke_tm_tdrop_profile_add’:
.../drivers/net/ipn3ke/ipn3ke_tm.c:919:31: error: ‘RTE_TM_GREEN’ undeclared
(first use in this function); did you mean ‘RTE_COLOR_GREEN’?
  min_th = profile->red_params[RTE_TM_GREEN].min_th;
                               ^~~~~~~~~~~~
                               RTE_COLOR_GREEN

cc1: all warnings being treated as errors
make[4]: *** [.../mk/internal/rte.compile-pre.mk:116: ipn3ke_tm.o] Error 1 make[4]: *** Waiting for unfinished jobs....

author
#143 lore raw
Quoted 103 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, April 13, 2019 0:53
To: Xu, Rosen <[email protected]>; [email protected]
Cc: Zhang, Tianfei <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>; Lomartire, David <[email protected]>; Hu, Jia <[email protected]>
Subject: Re: [PATCH v7 00/14] Add patch set for IPN3KE

Quoted 54 lines · Rosen Xu

v7 updates:
=========
- Fix Stephen comments

v6 updates:
==========
- Fix v5 comments
- Fix TM Shaper rate issue

v5 updates:
==========
- Fix EXPERIMENTAL symbol definition issue

v4 updates:
==========
- Fix coding style issues

v3 updates:
==========
- Fix v2 comments
- Update MAC BAR of AFU index get ops
- Remove OPAE share code dependency of libfdt

v2 updates:
==========
- Fix v1 comments
- Add support for 10G Base Line Design Bitstream
- Add support for 25G Base Line Design Bitstream

This patch set adds the support of a new net PMD, Intel® FPGA Programmable Acceleration Card N3000, also called ipn3ke.

The ipn3ke PMD (librte_pmd_ipn3ke) provides poll mode driver support for Intel® FPGA PAC(Programmable Acceleration Card) N3000 based on the Intel Ethernet Controller X710/XXV710 and Intel Arria 10 FPGA.

In this card, FPGA is an acceleration bridge between network interface and the Intel Ethernet Controller. Although both FPGA and Ethernet Controllers are connected to CPU with PCIe Gen3x16 Switch, all the packet RX/TX is handled by Intel Ethernet Controller. So from application point of view the data path is still the legacy Intel Ethernet Controller
X710/XXV710 PMD. Besides this, users can enable more acceleration features by FPGA IP.

Rosen Xu (7):
bus/ifpga: add AFU shared data
bus/ifpga: add function for AFU search by name net/ipn3ke: add IPN3KE ethdev PMD driver net/ipn3ke: add IPN3KE representor of PMD driver net/ipn3ke: add IPN3KE TM of PMD driver net/ipn3ke: add IPN3KE Flow of PMD driver raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Quoted 8 lines

Tianfei zhang (7):
raw/ifpga_rawdev: clean up code for ifpga share code raw/ifpga_rawdev: store private features in FME and Port raw/ifpga_rawdev: add SPI and MAX10 device driver raw/ifpga_rawdev: add I2C and at24 EEPROM driver raw/ifpga_rawdev: add eth group driver raw/ifpga_rawdev: add version description on README raw/ifpga_rawdev: using prefix name for feature and its ops

Getting following build error [1], some tm enums seems merged into main repo, can you please send a new version with fix?

[1]
.../drivers/net/ipn3ke/ipn3ke_tm.c: In function ‘ipn3ke_tm_tdrop_profile_check’:
.../drivers/net/ipn3ke/ipn3ke_tm.c:816:20: error: storage size of ‘color’ isn’t known

  enum rte_tm_color color;
                    ^~~~~
.../drivers/net/ipn3ke/ipn3ke_tm.c:843:15: error: ‘RTE_TM_GREEN’
undeclared (first use in this function); did you mean ‘RTE_COLOR_GREEN’?
  for (color = RTE_TM_GREEN; color <= RTE_TM_GREEN; color++) {
               ^~~~~~~~~~~~
               RTE_COLOR_GREEN

.../drivers/net/ipn3ke/ipn3ke_tm.c:843:15: note: each undeclared identifier is reported only once for each function it appears in .../drivers/net/ipn3ke/ipn3ke_tm.c:816:20: error: unused variable ‘color’ [-Werror=unused-variable]

  enum rte_tm_color color;
                    ^~~~~

.../drivers/net/ipn3ke/ipn3ke_tm.c: In function ‘ipn3ke_tm_tdrop_profile_add’:
.../drivers/net/ipn3ke/ipn3ke_tm.c:919:31: error: ‘RTE_TM_GREEN’ undeclared (first use in this function); did you mean ‘RTE_COLOR_GREEN’?

Quoted 7 lines
  min_th = profile->red_params[RTE_TM_GREEN].min_th;
                               ^~~~~~~~~~~~
                               RTE_COLOR_GREEN

cc1: all warnings being treated as errors
make[4]: *** [.../mk/internal/rte.compile-pre.mk:116: ipn3ke_tm.o] Error 1 make[4]: *** Waiting for unfinished jobs....

Fixed in v8.

author
#144 lore raw

v8 cover Add patch set for IPN3KE

In reply to Rosen Xu

v8 updates:
=========
- Fix meter color definition replacement

v7 updates:
=========
- Fix Stephen comments

v6 updates:
==========
- Fix v5 comments
- Fix TM Shaper rate issue

v5 updates:
==========
- Fix EXPERIMENTAL symbol definition issue

v4 updates:
==========
- Fix coding style issues

v3 updates:
==========
- Fix v2 comments
- Update MAC BAR of AFU index get ops
- Remove OPAE share code dependency of libfdt

v2 updates:
==========
- Fix v1 comments
- Add support for 10G Base Line Design Bitstream
- Add support for 25G Base Line Design Bitstream

This patch set adds the support of a new net PMD, Intel® FPGA Programmable Acceleration Card N3000, also called ipn3ke.

The ipn3ke PMD (librte_pmd_ipn3ke) provides poll mode driver support for Intel® FPGA PAC(Programmable Acceleration Card) N3000 based on the Intel Ethernet Controller X710/XXV710 and Intel Arria 10 FPGA.

In this card, FPGA is an acceleration bridge between network interface and the Intel Ethernet Controller. Although both FPGA and Ethernet Controllers are connected to CPU with PCIe Gen3x16 Switch, all the packet RX/TX is handled by Intel Ethernet Controller. So from application point of view the data path is still the legacy Intel Ethernet Controller X710/XXV710 PMD. Besides this, users can enable more acceleration features by FPGA IP.

Rosen Xu (7):
bus/ifpga: add AFU shared data
bus/ifpga: add function for AFU search by name net/ipn3ke: add IPN3KE ethdev PMD driver net/ipn3ke: add IPN3KE representor of PMD driver net/ipn3ke: add IPN3KE TM of PMD driver net/ipn3ke: add IPN3KE Flow of PMD driver raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Tianfei zhang (7):
raw/ifpga_rawdev: clean up code for ifpga share code raw/ifpga_rawdev: store private features in FME and Port raw/ifpga_rawdev: add SPI and MAX10 device driver raw/ifpga_rawdev: add I2C and at24 EEPROM driver raw/ifpga_rawdev: add eth group driver raw/ifpga_rawdev: add version description on README raw/ifpga_rawdev: using prefix name for feature and its ops

 MAINTAINERS                                        |    6 +
 config/common_base                                 |    4 +
 doc/guides/nics/features/ipn3ke.ini                |   55 +
 doc/guides/nics/index.rst                          |    1 +
 doc/guides/nics/ipn3ke.rst                         |  108 +
 drivers/bus/ifpga/ifpga_bus.c                      |   13 +
 drivers/bus/ifpga/rte_bus_ifpga.h                  |   16 +
 drivers/bus/ifpga/rte_bus_ifpga_version.map        |    6 +
 drivers/net/Makefile                               |    1 +
 drivers/net/ipn3ke/Makefile                        |   40 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c                 |  653 ++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h                 |  975 +++++++++
 drivers/net/ipn3ke/ipn3ke_flow.c                   | 1374 +++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h                   |  106 +
 drivers/net/ipn3ke/ipn3ke_logs.h                   |   30 +
 drivers/net/ipn3ke/ipn3ke_rawdev_api.h             |   62 +
 drivers/net/ipn3ke/ipn3ke_representor.c            |  893 +++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c                     | 2069 ++++++++++++++++++++
 drivers/net/ipn3ke/meson.build                     |   17 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map      |    4 +
 drivers/net/meson.build                            |    1 +
 drivers/raw/ifpga_rawdev/Makefile                  |    1 +
 drivers/raw/ifpga_rawdev/base/Makefile             |    6 +
 drivers/raw/ifpga_rawdev/base/README               |   15 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c          |   98 +-
 drivers/raw/ifpga_rawdev/base/ifpga_api.h          |    1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |   93 +-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c    |  357 ++--
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  |  174 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |   99 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          |  602 +++++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c    |   16 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_error.c    |   18 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_iperf.c    |   28 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c       |    8 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |   44 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c         |   51 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port_error.c   |   10 +-
 drivers/raw/ifpga_rawdev/base/meson.build          |    8 +-
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c   |   88 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h   |   14 +
 drivers/raw/ifpga_rawdev/base/opae_debug.c         |   16 +-
 drivers/raw/ifpga_rawdev/base/opae_eth_group.c     |  145 ++
 drivers/raw/ifpga_rawdev/base/opae_eth_group.h     |   96 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c        |  200 +-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |   54 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c           |  490 +++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h           |  130 ++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   |   88 +
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |   96 +
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |   21 +-
 drivers/raw/ifpga_rawdev/base/opae_spi.c           |  304 +++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           |  160 ++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   |  438 +++++
 .../ifpga_rawdev/base/osdep_raw/osdep_generic.h    |    1 +
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |   16 +
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c            |  248 ++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h            |   16 +-
 drivers/raw/ifpga_rawdev/meson.build               |    6 +-
 mk/rte.app.mk                                      |    1 +
 usertools/dpdk-devbind.py                          |    4 +-
 61 files changed, 10265 insertions(+), 430 deletions(-)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
 create mode 100644 drivers/net/ipn3ke/Makefile
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_flow.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_logs.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_rawdev_api.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_representor.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c
 create mode 100644 drivers/net/ipn3ke/meson.build
 create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_eth_group.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_i2c.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c
Signature · 1 line
1.8.3.1
author
#145 lore raw

PATCH v8 1/14 bus/ifpga: add AFU shared data

AFU can be implemented into many different acceleration devices, these devices need shared data to store private information when they are handled by users.

---
 drivers/bus/ifpga/rte_bus_ifpga.h | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/bus/ifpga/rte_bus_ifpga.h +7 -0
index 0bf43ba..820eeaa 100644
@@ -17,6 +17,7 @@
 
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_spinlock.h>
 
 /** Name of Intel FPGA Bus */
 #define IFPGA_BUS_NAME ifpga
@@ -60,6 +61,11 @@ struct rte_afu_pr_conf {
 
 #define AFU_PRI_STR_SIZE (PCI_PRI_STR_SIZE + 8)
 
+struct rte_afu_shared {
+	rte_spinlock_t lock;
+	void *data;
+};
+
 /**
  * A structure describing a AFU device.
  */
@@ -71,6 +77,7 @@ struct rte_afu_device {
 	uint32_t num_region;   /**< number of regions found */
 	struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
 						/**< AFU Memory Resource */
+	struct rte_afu_shared shared;
 	struct rte_intr_handle intr_handle;     /**< Interrupt handle */
 	struct rte_afu_driver *driver;          /**< Associated driver */
 	char path[IFPGA_BUS_BITSTREAM_PATH_MAX_LEN];
Signature · 1 line
1.8.3.1
author
#146 lore raw

PATCH v8 2/14 bus/ifpga: add function for AFU search by name

In reply to Rosen Xu

In many scenarios, AFU is needed searched by name, this function add the feature.

---
 drivers/bus/ifpga/ifpga_bus.c               | 13 +++++++++++++
 drivers/bus/ifpga/rte_bus_ifpga.h           |  9 +++++++++
 drivers/bus/ifpga/rte_bus_ifpga_version.map |  6 ++++++
 3 files changed, 28 insertions(+)
drivers/bus/ifpga/ifpga_bus.c +13 -0
index 55d3abf..8bfae29 100644
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
 	return NULL;
 }
 
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name)
+{
+	struct rte_afu_device *afu_dev = NULL;
+
+	TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) {
+		if (afu_dev &&
+			!strcmp(afu_dev->device.name, name))
+			return afu_dev;
+	}
+	return NULL;
+}
+
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
 	IFPGA_ARG_NAME,
drivers/bus/ifpga/rte_bus_ifpga.h +9 -0
index 820eeaa..c00f60e 100644
@@ -120,6 +120,15 @@ struct rte_afu_driver {
 }
 
 /**
+ * Find AFU by AFU name.
+ *
+ * @param name
+ *   A pointer to AFU name string.
+ */
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name);
+
+/**
  * Register a ifpga afu device driver.
  *
  * @param driver
drivers/bus/ifpga/rte_bus_ifpga_version.map +6 -0
index a027979..247ccfe 100644
@@ -8,3 +8,9 @@ DPDK_18.05 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+    global:
+
+    rte_ifpga_find_afu_by_name;
+};
\ No newline at end of file
Signature · 1 line
1.8.3.1
#147 lore raw

Re: [dpdk-dev] [PATCH v8 02/14] bus/ifpga: add function for AFU search by name

Quoted 41 lines · Rosen Xu

In many scenarios, AFU is needed searched by name, this function add the feature.

---
 drivers/bus/ifpga/ifpga_bus.c               | 13 +++++++++++++
 drivers/bus/ifpga/rte_bus_ifpga.h           |  9 +++++++++
 drivers/bus/ifpga/rte_bus_ifpga_version.map |  6 ++++++
 3 files changed, 28 insertions(+)
drivers/bus/ifpga/ifpga_bus.c +13 -0
index 55d3abf..8bfae29 100644
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
 	return NULL;
 }
 
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name)
+{
+	struct rte_afu_device *afu_dev = NULL;
+
+	TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) {
+		if (afu_dev &&
+			!strcmp(afu_dev->device.name, name))
+			return afu_dev;
+	}
+	return NULL;
+}
+
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
 	IFPGA_ARG_NAME,
drivers/bus/ifpga/rte_bus_ifpga.h +0 -0
index 820eeaa..c00f60e 100644
@@ -120,6 +120,15 @@ struct rte_afu_driver {
 }

drivers/bus/ifpga/rte_bus_ifpga.h struct rte_afu_driver { · line 130

Quoted 10 lines
drivers/bus/ifpga/rte_bus_ifpga.h +8 -0
 
 /**
+ * Find AFU by AFU name.
+ *
+ * @param name
+ *   A pointer to AFU name string.
+ */
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name);
+

Hi Rosen,

This is the bus code, and only drivers will call it right? I think there is no intention to make this run by application code, the functions need to be exported because driver and bus are different libraries.
If above correct, there is no point of making the function experimental, can drop the __rte_experimental tag, and update .map file to not use EXPERIMENTAL.

Quoted 20 lines
drivers/bus/ifpga/rte_bus_ifpga.h +1 -0
+/**
  * Register a ifpga afu device driver.
  *
  * @param driver
drivers/bus/ifpga/rte_bus_ifpga_version.map +6 -0
index a027979..247ccfe 100644
@@ -8,3 +8,9 @@ DPDK_18.05 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+    global:
+
+    rte_ifpga_find_afu_by_name;
+};
\ No newline at end of file
author
#148 lore raw

Re: [dpdk-dev] [PATCH v8 02/14] bus/ifpga: add function for AFU search by name

Hi Ferruh,

Quoted 69 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, April 15, 2019 20:28
To: Xu, Rosen <[email protected]>; [email protected]
Cc: Zhang, Tianfei <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>; Lomartire, David <[email protected]>; Hu, Jia <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [PATCH v8 02/14] bus/ifpga: add function for AFU search by name

drivers/bus/ifpga/ifpga_bus.c void rte_ifpga_driver_unregister(struct

Quoted 16 lines · Rosen Xu

In many scenarios, AFU is needed searched by name, this function add the feature.

---
 drivers/bus/ifpga/ifpga_bus.c               | 13 +++++++++++++
 drivers/bus/ifpga/rte_bus_ifpga.h           |  9 +++++++++
 drivers/bus/ifpga/rte_bus_ifpga_version.map |  6 ++++++
 3 files changed, 28 insertions(+)
(quoted diff) +0 -0

b/drivers/bus/ifpga/ifpga_bus.c index 55d3abf..8bfae29 100644

drivers/bus/ifpga/ifpga_bus.c +0 -0
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct

rte_afu_driver *driver)

Quoted 24 lines
drivers/bus/ifpga/ifpga_bus.c +12 -0
 	return NULL;
 }
 
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name) {
+	struct rte_afu_device *afu_dev = NULL;
+
+	TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) {
+		if (afu_dev &&
+			!strcmp(afu_dev->device.name, name))
+			return afu_dev;
+	}
+	return NULL;
+}
+
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
 	IFPGA_ARG_NAME,
drivers/bus/ifpga/rte_bus_ifpga.h +0 -0
index 820eeaa..c00f60e 100644

drivers/bus/ifpga/rte_bus_ifpga.h struct rte_afu_driver { } · line 129

Quoted 10 lines
drivers/bus/ifpga/rte_bus_ifpga.h +8 -0
@@ -120,6 +120,15 @@ struct rte_afu_driver {  }
 
 /**
+ * Find AFU by AFU name.
+ *
+ * @param name
+ *   A pointer to AFU name string.
+ */
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name);
+

Hi Rosen,

Quoted 6 lines

This is the bus code, and only drivers will call it right? I think there is no intention to make this run by application code, the functions need to be exported because driver and bus are different libraries.
If above correct, there is no point of making the function experimental, can drop the __rte_experimental tag, and update .map file to not use EXPERIMENTAL.

Yes, above is correct.
I will apply it in v9.

Quoted 22 lines
Quoted 22 lines
drivers/bus/ifpga/rte_bus_ifpga.h +1 -0
+/**
  * Register a ifpga afu device driver.
  *
  * @param driver
drivers/bus/ifpga/rte_bus_ifpga_version.map +6 -0
index a027979..247ccfe 100644
@@ -8,3 +8,9 @@ DPDK_18.05 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+    global:
+
+    rte_ifpga_find_afu_by_name;
+};
\ No newline at end of file
author
#149 lore raw

Re: [dpdk-dev] [PATCH v8 02/14] bus/ifpga: add function for AFU search by name

In reply to Ferruh Yigit
Quoted 70 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, April 15, 2019 20:28
To: Xu, Rosen <[email protected]>; [email protected]
Cc: Zhang, Tianfei <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>; Lomartire, David <[email protected]>; Hu, Jia <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [PATCH v8 02/14] bus/ifpga: add function for AFU search by name

drivers/bus/ifpga/ifpga_bus.c void rte_ifpga_driver_unregister(struct

Quoted 16 lines · Rosen Xu

In many scenarios, AFU is needed searched by name, this function add the feature.

---
 drivers/bus/ifpga/ifpga_bus.c               | 13 +++++++++++++
 drivers/bus/ifpga/rte_bus_ifpga.h           |  9 +++++++++
 drivers/bus/ifpga/rte_bus_ifpga_version.map |  6 ++++++
 3 files changed, 28 insertions(+)
(quoted diff) +0 -0

b/drivers/bus/ifpga/ifpga_bus.c index 55d3abf..8bfae29 100644

drivers/bus/ifpga/ifpga_bus.c +0 -0
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct

rte_afu_driver *driver)

Quoted 24 lines
drivers/bus/ifpga/ifpga_bus.c +12 -0
 	return NULL;
 }
 
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name) {
+	struct rte_afu_device *afu_dev = NULL;
+
+	TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) {
+		if (afu_dev &&
+			!strcmp(afu_dev->device.name, name))
+			return afu_dev;
+	}
+	return NULL;
+}
+
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
 	IFPGA_ARG_NAME,
drivers/bus/ifpga/rte_bus_ifpga.h +0 -0
index 820eeaa..c00f60e 100644

drivers/bus/ifpga/rte_bus_ifpga.h struct rte_afu_driver { } · line 129

Quoted 10 lines
drivers/bus/ifpga/rte_bus_ifpga.h +8 -0
@@ -120,6 +120,15 @@ struct rte_afu_driver {  }
 
 /**
+ * Find AFU by AFU name.
+ *
+ * @param name
+ *   A pointer to AFU name string.
+ */
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name);
+

Hi Rosen,

Quoted 6 lines

This is the bus code, and only drivers will call it right? I think there is no intention to make this run by application code, the functions need to be exported because driver and bus are different libraries.
If above correct, there is no point of making the function experimental, can drop the __rte_experimental tag, and update .map file to not use EXPERIMENTAL.

Hi Ferruh,

Just double confirm with you, if I follow this modification, there is one checkpatch error.

Quoted 22 lines
Quoted 22 lines
drivers/bus/ifpga/rte_bus_ifpga.h +1 -0
+/**
  * Register a ifpga afu device driver.
  *
  * @param driver
drivers/bus/ifpga/rte_bus_ifpga_version.map +6 -0
index a027979..247ccfe 100644
@@ -8,3 +8,9 @@ DPDK_18.05 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+    global:
+
+    rte_ifpga_find_afu_by_name;
+};
\ No newline at end of file
#150 lore raw

Re: [dpdk-dev] [PATCH v8 02/14] bus/ifpga: add function for AFU search by name

16/04/2019 04:50, Xu, Rosen:

Quoted 25 lines

From: Yigit, Ferruh

Quoted 17 lines

drivers/bus/ifpga/rte_bus_ifpga.h struct rte_afu_driver { } · line 129

Quoted 13 lines
drivers/bus/ifpga/rte_bus_ifpga.h +8 -0
@@ -120,6 +120,15 @@ struct rte_afu_driver {  }
 
 /**
+ * Find AFU by AFU name.
+ *
+ * @param name
+ *   A pointer to AFU name string.
+ */
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name);
+

Hi Rosen,

Quoted 6 lines

This is the bus code, and only drivers will call it right? I think there is no intention to make this run by application code, the functions need to be exported because driver and bus are different libraries.
If above correct, there is no point of making the function experimental, can drop the __rte_experimental tag, and update .map file to not use EXPERIMENTAL.

Quoted 3 lines

Hi Ferruh,

Just double confirm with you, if I follow this modification, there is one checkpatch error.

This is a warning, and Ferruh allows it in this case :)

author
#151 lore raw

Re: [dpdk-dev] [PATCH v8 02/14] bus/ifpga: add function for AFU search by name

Quoted 42 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, April 16, 2019 16:10
To: Xu, Rosen <[email protected]>
Cc: Yigit, Ferruh <[email protected]>; [email protected]; Zhang, Tianfei <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>; Lomartire, David <[email protected]>; Hu, Jia <[email protected]>
Subject: Re: [PATCH v8 02/14] bus/ifpga: add function for AFU search by name

16/04/2019 04:50, Xu, Rosen:

Quoted 21 lines

From: Yigit, Ferruh

Quoted 20 lines

drivers/bus/ifpga/rte_bus_ifpga.h struct rte_afu_driver { } · line 129

Quoted 13 lines
drivers/bus/ifpga/rte_bus_ifpga.h +8 -0
@@ -120,6 +120,15 @@ struct rte_afu_driver {  }
 
 /**
+ * Find AFU by AFU name.
+ *
+ * @param name
+ *   A pointer to AFU name string.
+ */
+struct rte_afu_device *__rte_experimental
+rte_ifpga_find_afu_by_name(const char *name);
+

Hi Rosen,

This is the bus code, and only drivers will call it right? I think there is no intention to make this run by application code, the functions need to be exported because driver and bus are different

libraries.

Quoted 4 lines
Quoted 3 lines

If above correct, there is no point of making the function experimental, can drop the __rte_experimental tag, and update .map file to not use EXPERIMENTAL.

Quoted 7 lines
Quoted 3 lines

Hi Ferruh,

Just double confirm with you, if I follow this modification, there is one

checkpatch error.

This is a warning, and Ferruh allows it in this case :)

Okay Thomas.

author
#152 lore raw

PATCH v8 3/14 net/ipn3ke: add IPN3KE ethdev PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE ethdev PMD driver.

---
 MAINTAINERS                                   |   6 +
 config/common_base                            |   4 +
 doc/guides/nics/features/ipn3ke.ini           |  55 ++
 doc/guides/nics/index.rst                     |   1 +
 doc/guides/nics/ipn3ke.rst                    | 108 +++
 drivers/net/Makefile                          |   1 +
 drivers/net/ipn3ke/Makefile                   |  36 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c            | 645 ++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h            | 942 ++++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_logs.h              |  30 +
 drivers/net/ipn3ke/ipn3ke_rawdev_api.h        |  62 ++
 drivers/net/ipn3ke/meson.build                |  14 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map |   4 +
 drivers/net/meson.build                       |   1 +
 mk/rte.app.mk                                 |   1 +
 usertools/dpdk-devbind.py                     |   4 +-
 16 files changed, 1913 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
 create mode 100644 drivers/net/ipn3ke/Makefile
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_logs.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_rawdev_api.h
 create mode 100644 drivers/net/ipn3ke/meson.build
 create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
MAINTAINERS +6 -0
index a085834..40a4d7b 100644
@@ -633,6 +633,12 @@ F: drivers/net/ice/
 F: doc/guides/nics/ice.rst
 F: doc/guides/nics/features/ice.ini
 
+Intel ipn3ke
+M: Rosen Xu <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/ipn3ke/
+F: doc/guides/nics/ipn3ke.rst
+F: doc/guides/nics/features/ipn3ke.ini
 Marvell mvpp2
 M: Tomasz Duszynski <[email protected]>
 M: Liron Himi <[email protected]>
config/common_base +4 -0
index 7fb0ded..4236c2a 100644
@@ -328,6 +328,10 @@ CONFIG_RTE_LIBRTE_IAVF_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_IAVF_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_IAVF_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_IAVF_16BYTE_RX_DESC=n
+#
+# Compile burst-oriented IPN3KE PMD driver
+#
+CONFIG_RTE_LIBRTE_IPN3KE_PMD=y
 
 #
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD
doc/guides/nics/features/ipn3ke.ini new file +55 -0

55 lines not on this page · raw message

doc/guides/nics/index.rst +1 -0
index 8a4e145..2221c35 100644
@@ -31,6 +31,7 @@ Network Interface Controller Drivers
     ice
     ifc
     igb
+    ipn3ke
     ixgbe
     intel_vf
     kni
doc/guides/nics/ipn3ke.rst new file +108 -0

108 lines not on this page · raw message

drivers/net/Makefile +1 -0
index 0969eed..3a72cf3 100644
@@ -32,6 +32,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += iavf
 DIRS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice
+DIRS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
 DIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += liquidio
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
drivers/net/ipn3ke/Makefile new file +36 -0
new file mode 100644
index 0000000..d7aa79b
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_ipn3ke.a
+
+#
+# Add the experimenatal APIs called from this PMD
+#  rte_eth_switch_domain_alloc()
+#  rte_eth_dev_create()
+#  rte_eth_dev_destroy()
+#  rte_eth_switch_domain_free()
+#
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_ifpga
+LDLIBS += -lrte_bus_vdev
+
+EXPORT_MAP := rte_pmd_ipn3ke_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +645 -0

645 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_ethdev.h new file +942 -0

942 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_logs.h new file +30 -0
new file mode 100644
index 0000000..147fd80
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _IPN3KE_LOGS_H_
+#define _IPN3KE_LOGS_H_
+
+#include <rte_log.h>
+
+extern int ipn3ke_afu_logtype;
+
+#define IPN3KE_AFU_PMD_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, ipn3ke_afu_logtype, "%s(): " fmt "\n", \
+		__func__, ##args)
+
+#define IPN3KE_AFU_PMD_FUNC_TRACE() IPN3KE_AFU_PMD_LOG(DEBUG, ">>")
+
+#define IPN3KE_AFU_PMD_DEBUG(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(DEBUG, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_INFO(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(INFO, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_ERR(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(ERR, fmt, ## args)
+
+#define IPN3KE_AFU_PMD_WARN(fmt, args...) \
+	IPN3KE_AFU_PMD_LOG(WARNING, fmt, ## args)
+
+#endif /* _IPN3KE_LOGS_H_ */
drivers/net/ipn3ke/ipn3ke_rawdev_api.h new file +62 -0

62 lines not on this page · raw message

drivers/net/ipn3ke/meson.build new file +14 -0
new file mode 100644
index 0000000..b511600
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+#
+# Add the experimenatal APIs called from this PMD
+#  rte_eth_switch_domain_alloc()
+#  rte_eth_dev_create()
+#  rte_eth_dev_destroy()
+#  rte_eth_switch_domain_free()
+#
+allow_experimental_apis = true
+
+sources += files('ipn3ke_ethdev.c')
+deps += ['bus_ifpga', 'sched']
drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +4 -0
new file mode 100644
index 0000000..fc8c95e
@@ -0,0 +1,4 @@
+DPDK_19.05 {
+
+	local: *;
+};
drivers/net/meson.build +1 -0
index 28146cc..ed99896 100644
@@ -20,6 +20,7 @@ drivers = ['af_packet',
 	'iavf',
 	'ice',
 	'ifc',
+	'ipn3ke',
 	'ixgbe',
 	'kni',
 	'liquidio',
mk/rte.app.mk +1 -0
index abea16d..f020bb1 100644
@@ -300,6 +300,7 @@ endif # CONFIG_RTE_LIBRTE_FSLMC_BUS
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IFPGA_BUS)      += -lrte_bus_ifpga
 ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
usertools/dpdk-devbind.py +3 -1
index 249b65a..9e79f0d 100755
@@ -12,6 +12,8 @@
 # The PCI base class for all devices
 network_class = {'Class': '02', 'Vendor': None, 'Device': None,
                     'SVendor': None, 'SDevice': None}
+ifpga_class = {'Class': '12', 'Vendor': '8086', 'Device': '0b30',
+                    'SVendor': None, 'SDevice': None}
 encryption_class = {'Class': '10', 'Vendor': None, 'Device': None,
                    'SVendor': None, 'SDevice': None}
 intel_processor_class = {'Class': '0b', 'Vendor': '8086', 'Device': None,
@@ -34,7 +36,7 @@
 octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
               'SVendor': None, 'SDevice': None}
 
-network_devices = [network_class, cavium_pkx, avp_vnic]
+network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
 crypto_devices = [encryption_class, intel_processor_class]
 eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
 mempool_devices = [cavium_fpa, octeontx2_npa]
Signature · 1 line
1.8.3.1
#153 lore raw

Re: [dpdk-dev] [PATCH v8 03/14] net/ipn3ke: add IPN3KE ethdev PMD driver

Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE ethdev PMD driver.

<...>

MAINTAINERS F: drivers/net/ice/ · line 642

Quoted 11 lines
MAINTAINERS +6 -0
@@ -633,6 +633,12 @@ F: drivers/net/ice/
 F: doc/guides/nics/ice.rst
 F: doc/guides/nics/features/ice.ini
 
+Intel ipn3ke
+M: Rosen Xu <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/ipn3ke/
+F: doc/guides/nics/ipn3ke.rst
+F: doc/guides/nics/features/ipn3ke.ini
 Marvell mvpp2

Please put an empty line after ipn3ke block.

<...>

doc/guides/nics/ipn3ke.rst line 38

Quoted 8 lines
doc/guides/nics/ipn3ke.rst new file +8 -0
+Pre-Installation Configuration
+------------------------------
+
+Config File Options
+~~~~~~~~~~~~~~~~~~~
+
+The following options can be modified in the ``config`` file.
+Please note that enabling debugging options may affect system performance.

There is no DEBUG option for driver, looks like copy/paste from other driver docs.

author
#154 lore raw

Re: [dpdk-dev] [PATCH v8 03/14] net/ipn3ke: add IPN3KE ethdev PMD driver

Hi Ferruh,

Quoted 24 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, April 15, 2019 20:29
To: Xu, Rosen <[email protected]>; [email protected]
Cc: Zhang, Tianfei <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>; Lomartire, David <[email protected]>; Hu, Jia <[email protected]>
Subject: Re: [PATCH v8 03/14] net/ipn3ke: add IPN3KE ethdev PMD driver

Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE ethdev PMD driver.

<...>

Quoted 4 lines
MAINTAINERS +0 -0
@@ -633,6 +633,12 @@ F: drivers/net/ice/
 F: doc/guides/nics/ice.rst
 F: doc/guides/nics/features/ice.ini
 
Quoted 9 lines

MAINTAINERS F: drivers/net/ice/ · line 642

Quoted 7 lines
MAINTAINERS +6 -0
+Intel ipn3ke
+M: Rosen Xu <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/ipn3ke/
+F: doc/guides/nics/ipn3ke.rst
+F: doc/guides/nics/features/ipn3ke.ini
 Marvell mvpp2

Please put an empty line after ipn3ke block.

Fixed in v9.

Quoted 12 lines

<...>

doc/guides/nics/ipn3ke.rst

Quoted 8 lines
doc/guides/nics/ipn3ke.rst new file +8 -0
+Pre-Installation Configuration
+------------------------------
+
+Config File Options
+~~~~~~~~~~~~~~~~~~~
+
+The following options can be modified in the ``config`` file.
+Please note that enabling debugging options may affect system

performance.

Quoted 2 lines

There is no DEBUG option for driver, looks like copy/paste from other driver docs.

Fixed in v9.