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 1 of 3

Subsystems (2)
lore
Share & tools
lore

Rosen Xu

author
#0 lore raw

cover Add patch set for IPN3KE

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 (10):
drivers/bus/ifpga: add AFU shared data drivers/bus/ifpga: add function for AFU search by name drivers/raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev drivers/net/ipn3ke: add IPN3KE PMD driver
config: add build enablement for IPN3KE
mk: add link enablement for IPN3KE
app/test-pmd: add IPN3KE support for testpmd
usertools: add IPN3KE device bind
doc: add IPN3KE document
MAINTAINERS: add MAINTAINERS for IPN3KE

Tianfei Zhang (1):
drivers/raw/ifpga_rawdev: add OPAE share code for IPN3KE

 MAINTAINERS                                        |    7 +
 app/test-pmd/Makefile                              |    4 +
 config/common_base                                 |    6 +
 doc/guides/nics/features/ipn3ke.ini                |   57 +
 doc/guides/nics/index.rst                          |    1 +
 doc/guides/nics/ipn3ke.rst                         |   97 +
 drivers/bus/ifpga/ifpga_bus.c                      |   13 +
 drivers/bus/ifpga/rte_bus_ifpga.h                  |   10 +
 drivers/net/Makefile                               |    1 +
 drivers/net/ipn3ke/Makefile                        |   33 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c                 |  814 +++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h                 |  742 +++++++
 drivers/net/ipn3ke/ipn3ke_flow.c                   | 1407 +++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h                   |  104 +
 drivers/net/ipn3ke/ipn3ke_logs.h                   |   30 +
 drivers/net/ipn3ke/ipn3ke_representor.c            |  890 ++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c                     | 2217 ++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.h                     |  135 ++
 drivers/net/ipn3ke/meson.build                     |    9 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map      |    4 +
 drivers/raw/ifpga_rawdev/base/Makefile             |    7 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c          |   69 +-
 drivers/raw/ifpga_rawdev/base/ifpga_api.h          |    1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |   86 +-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c    |  342 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  |  170 +-
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |   62 +-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          |  373 ++++
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c       |    2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |   21 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c         |   21 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c   |   89 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h   |   14 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c        |  189 +-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |   46 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c           |  490 +++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h           |  127 ++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   |  106 +
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |   36 +
 drivers/raw/ifpga_rawdev/base/opae_mdio.c          |  542 +++++
 drivers/raw/ifpga_rawdev/base/opae_mdio.h          |   90 +
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |   11 +-
 drivers/raw/ifpga_rawdev/base/opae_phy_group.c     |   88 +
 drivers/raw/ifpga_rawdev/base/opae_phy_group.h     |   53 +
 drivers/raw/ifpga_rawdev/base/opae_spi.c           |  260 +++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           |  120 ++
 .../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    |   10 +
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c            |  146 +-
 drivers/raw/ifpga_rawdev/ifpga_rawdev_api.h        |   71 +
 mk/rte.app.mk                                      |    1 +
 usertools/dpdk-devbind.py                          |    4 +-
 53 files changed, 10348 insertions(+), 319 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_representor.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.h
 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_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_mdio.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_mdio.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_phy_group.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_phy_group.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
 create mode 100644 drivers/raw/ifpga_rawdev/ifpga_rawdev_api.h
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/11 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
#2 lore raw

PATCH 2/11 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 |  3 +++
 2 files changed, 16 insertions(+)
drivers/bus/ifpga/ifpga_bus.c +13 -0
index 55d3abf..dfd6b1f 100644
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
 	return NULL;
 }
 
+struct rte_afu_device *
+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 +3 -0
index 820eeaa..5762a33 100644
@@ -119,6 +119,9 @@ struct rte_afu_driver {
 	return NULL;
 }
 
+struct rte_afu_device *
+rte_ifpga_find_afu_by_name(const char *name);
+
 /**
  * Register a ifpga afu device driver.
  *
Signature · 1 line
1.8.3.1
#3 lore raw

Re: [PATCH v1 02/11] drivers/bus/ifpga: add function for AFU search by name

Quoted 20 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 |  3 +++
 2 files changed, 16 insertions(+)
drivers/bus/ifpga/ifpga_bus.c +2 -0
index 55d3abf..dfd6b1f 100644
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
 	return NULL;
 }
 
+struct rte_afu_device *
+rte_ifpga_find_afu_by_name(const char *name)

drivers/bus/ifpga/ifpga_bus.c void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) · line 87

Quoted 10 lines
drivers/bus/ifpga/ifpga_bus.c +10 -0
+{
+	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;
+}

I can see this function called from drivers in following patches, did you test this via shared library build? To be able to called from different library, should this API needs to be added into .map file?

Quoted 9 lines
drivers/bus/ifpga/ifpga_bus.c +1 -0
+
 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..5762a33 100644

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

Quoted 5 lines
drivers/bus/ifpga/rte_bus_ifpga.h +2 -0
@@ -119,6 +119,9 @@ struct rte_afu_driver {
 	return NULL;
 }
 
+struct rte_afu_device *
+rte_ifpga_find_afu_by_name(const char *name);

This is public header, can you please add function comments in doxygen format?

author
#4 lore raw

Re: [PATCH v1 02/11] drivers/bus/ifpga: add function for AFU search by name

Hi,

Quoted 31 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 06, 2019 20:45
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]>
Subject: Re: [PATCH v1 02/11] drivers/bus/ifpga: add function for AFU search by name

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

Quoted 15 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 |  3 +++
 2 files changed, 16 insertions(+)
(quoted diff) +0 -0

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

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

rte_afu_driver *driver)

Quoted 3 lines
drivers/bus/ifpga/ifpga_bus.c +0 -0
 	return NULL;
 }
 
Quoted 15 lines

drivers/bus/ifpga/ifpga_bus.c void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) · line 87

Quoted 11 lines
drivers/bus/ifpga/ifpga_bus.c +11 -0
+struct rte_afu_device *
+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;
+}

I can see this function called from drivers in following patches, did you test this via shared library build? To be able to called from different library, should this API needs to be added into .map file?

Fix in patch v2.

Quoted 13 lines
Quoted 13 lines
drivers/bus/ifpga/ifpga_bus.c +1 -0
+
 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..5762a33 100644
@@ -119,6 +119,9 @@ struct rte_afu_driver {
 	return NULL;
 }
 
Quoted 5 lines

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

Quoted 2 lines
drivers/bus/ifpga/rte_bus_ifpga.h +2 -0
+struct rte_afu_device *
+rte_ifpga_find_afu_by_name(const char *name);

This is public header, can you please add function comments in doxygen format?

Okay.

author
#5 lore raw

PATCH 3/11 drivers/raw/ifpga_rawdev: add OPAE share code for IPN3KE

In reply to Rosen Xu

Add OPAE share code for Intel FPGA Acceleration NIC IPN3KE.

---
 drivers/raw/ifpga_rawdev/base/Makefile             |   7 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c          |  69 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_api.h          |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |  86 +++-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c    | 342 +++++--------
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  | 170 +++++--
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |  62 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          | 373 ++++++++++++++
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c       |   2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |  21 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c         |  21 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c   |  89 ++++
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h   |  14 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c        | 189 ++++++-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |  46 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c           | 490 +++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h           | 127 +++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   | 106 ++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |  36 ++
 drivers/raw/ifpga_rawdev/base/opae_mdio.c          | 542 +++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_mdio.h          |  90 ++++
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |  11 +-
 drivers/raw/ifpga_rawdev/base/opae_phy_group.c     |  88 ++++
 drivers/raw/ifpga_rawdev/base/opae_phy_group.h     |  53 ++
 drivers/raw/ifpga_rawdev/base/opae_spi.c           | 260 ++++++++++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           | 120 +++++
 .../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    |  10 +
 29 files changed, 3549 insertions(+), 315 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
 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_mdio.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_mdio.h
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_phy_group.c
 create mode 100644 drivers/raw/ifpga_rawdev/base/opae_phy_group.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 +7 -0
index d79da72..c77e751 100644
@@ -22,5 +22,12 @@ 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_mdio.c
+SRCS-y += opae_i2c.c
+SRCS-y += opae_at24_eeprom.c
+SRCS-y += opae_phy_group.c
+SRCS-y += opae_intel_max10.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
drivers/raw/ifpga_rawdev/base/ifpga_api.c +67 -2

87 lines not on this page · raw message

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 +60 -26

119 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +120 -222

539 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c +124 -46

215 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h +55 -7

109 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/ifpga_fme.c +373 -0

382 lines not on this page · raw message

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/ifpga_hw.h +19 -2
index a20520c..6ac54c6 100644
@@ -7,19 +7,30 @@
 
 #include "ifpga_defines.h"
 #include "opae_ifpga_hw_api.h"
+#include "opae_phy_group.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 +45,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 +65,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 */
@@ -67,6 +80,10 @@ struct ifpga_fme_hw {
 	u32 cache_size;
 
 	u32 capability;
+
+	void *i2c_master; /* I2C Master device */
+	void *max10_dev; /* MAX10 device */
+	void *phy_dev[MAX_PHY_GROUP_DEVICES];
 };
 
 enum ifpga_port_state {
@@ -78,7 +95,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,
+};
drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c new file +89 -0

89 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..4aa0ee2
@@ -0,0 +1,14 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2018 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 +186 -3

227 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_hw_api.h +45 -1

82 lines not on this page · raw message

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 +127 -0

127 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_intel_max10.c new file +106 -0

106 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_intel_max10.h new file +36 -0
new file mode 100644
index 0000000..b212825
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#ifndef _OPAE_INTEL_MAX10_H_
+#define _OPAE_INTEL_MAX10_H_
+
+#include "opae_osdep.h"
+#include "opae_spi.h"
+#include "opae_mdio.h"
+
+#define INTEL_MAX10_MAX_MDIO_DEVS 2
+#define PKVL_NUMBER_PORTS  4
+
+struct intel_max10_device {
+	struct altera_spi_device *spi_master;
+	struct spi_transaction_dev *spi_tran_dev;
+	struct altera_mdio_dev *mdio[INTEL_MAX10_MAX_MDIO_DEVS];
+	int num_retimer; /* number of retimer */
+	int num_port;   /* number of ports in retimer */
+};
+
+struct resource {
+	u32 start;
+	u32 end;
+	u32 flags;
+};
+
+int max10_reg_read(unsigned int reg, unsigned int *val);
+int max10_reg_write(unsigned int reg, unsigned int val);
+struct intel_max10_device *
+intel_max10_device_probe(struct altera_spi_device *spi,
+		int chipselect);
+int intel_max10_device_remove(struct intel_max10_device *dev);
+
+#endif
drivers/raw/ifpga_rawdev/base/opae_mdio.c new file +542 -0

263 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_mdio.h new file +90 -0

90 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_osdep.h +6 -5
index 90f54f7..6fb8f08 100644

Lines of this file are not shown. View the raw message.

drivers/raw/ifpga_rawdev/base/opae_phy_group.c new file +88 -0

88 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_phy_group.h new file +53 -0

53 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_spi.c new file +260 -0

260 lines not on this page · raw message

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

120 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_raw/osdep_generic.h +1 -0
index 895a1d8..6769109 100644

Lines of this file are not shown. View the raw message.

drivers/raw/ifpga_rawdev/base/osdep_rte/osdep_generic.h +10 -0
index 76902e2..cd5b7c9 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.8.3.1

Part of the diff is not shown here. View the raw message.

#6 lore raw

Re: [PATCH v1 03/11] drivers/raw/ifpga_rawdev: add OPAE share code for IPN3KE

Quoted 1 line · Rosen Xu

Add OPAE share code for Intel FPGA Acceleration NIC IPN3KE.

What do you think adding a file to record the version of the shared code, as it is done in Intel NIC drivers, README file?

Also can you please add more details on what feautures has been added with this update?

And if possible can you please split this patch into logical parts?

Quoted 33 lines
---
 drivers/raw/ifpga_rawdev/base/Makefile             |   7 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c          |  69 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_api.h          |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |  86 +++-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c    | 342 +++++--------
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  | 170 +++++--
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |  62 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          | 373 ++++++++++++++
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c       |   2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |  21 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c         |  21 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c   |  89 ++++
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h   |  14 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c        | 189 ++++++-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |  46 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c           | 490 +++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_i2c.h           | 127 +++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   | 106 ++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |  36 ++
 drivers/raw/ifpga_rawdev/base/opae_mdio.c          | 542 +++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_mdio.h          |  90 ++++
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |  11 +-
 drivers/raw/ifpga_rawdev/base/opae_phy_group.c     |  88 ++++
 drivers/raw/ifpga_rawdev/base/opae_phy_group.h     |  53 ++
 drivers/raw/ifpga_rawdev/base/opae_spi.c           | 260 ++++++++++
 drivers/raw/ifpga_rawdev/base/opae_spi.h           | 120 +++++
 .../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    |  10 +
 29 files changed, 3549 insertions(+), 315 deletions(-)

<...>

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static u64 feature_id(void __iomem *start) · line 76

Quoted 11 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +3 -1
@@ -165,37 +68,35 @@ static u64 feature_id(void __iomem *start)
 
 static int
 build_info_add_sub_feature(struct build_feature_devs_info *binfo,
-			   struct feature_info *finfo, void __iomem *start)
+		void __iomem *start, u64 fid, unsigned int size,
+		unsigned int vec_start,
+		unsigned int vec_cnt)
 {
 	struct ifpga_hw *hw = binfo->hw;
 	struct feature *feature = NULL;

struct names are so generic 'struct feature' & 'struct feature_ops' defined in ifpga_hw.h, they seems not added in this patch, but what do you think prefix them via "ifpga_" in a separate patch?

<...>

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static u64 feature_id(void __iomem *start) · line 99

Quoted 5 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +5 -0
+	feature->vec_start = vec_start;
+	feature->vec_cnt = vec_cnt;
+
+	dev_debug(binfo, "%s: id=0x%lx, phys_addr=0x%lx, size=%d\n",
+			__func__, feature->id, feature->phys_addr, size);

32bit build complains about %lx usage:

.../dpdk/drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c:99:51: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘u64’ {aka ‘long long unsigned int’} [-Werror=
format=]

<...>

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static int parse_feature(struct build_feature_devs_info *binfo, · line 544

Quoted 7 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +3 -0
@@ -651,12 +539,19 @@ static int parse_feature(struct build_feature_devs_info *binfo,
 		}
 
 		hdr = (struct feature_header *)start;
+		header.csr = readq(hdr);
+
+		/*debug*/

I think can drop above comment, not adding extra information.

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static int parse_feature(struct build_feature_devs_info *binfo, · line 546

Quoted 2 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +2 -0
+		dev_debug(binfo, "%s: address=0x%llx, val=0x%lx, header.id=0x%x, header.next_offset=0x%x, header.eol=0x%x, header.type=0x%x\n",
+			__func__, (unsigned long long)(hdr), header.csr,

Why not use "%p" to print the address of the variable but cast it to 'unsigned long long'?

<...>

drivers/raw/ifpga_rawdev/base/ifpga_fme.c struct feature_ops fme_power_mgmt_ops = { · line 773

Quoted 13 lines
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +13 -0
+static int fme_spi_init(struct feature *feature)
+{
+	struct feature_fme_spi *spi;
+	struct ifpga_fme_hw *fme = (struct ifpga_fme_hw *)feature->parent;
+	struct altera_spi_device *spi_master;
+	struct intel_max10_device *max10;
+	int ret = 0;
+
+	spi = (struct feature_fme_spi *)feature->addr;
+
+	dev_info(fme, "FME SPI Master (Max10) Init.\n");
+	dev_debug(fme, "FME SPI base addr %llx.\n",
+		 (unsigned long long)spi);

Same comment here, why not "%p", why casting the variable?

drivers/raw/ifpga_rawdev/base/ifpga_fme.c struct feature_ops fme_power_mgmt_ops = { · line 774

Quoted 1 line
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +1 -0
+	dev_debug(fme, "spi param=0x%lx\n", opae_readq(feature->addr + 0x8));

.../dpdk/drivers/raw/ifpga_rawdev/base/ifpga_fme.c:774:69: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=
format=]

  dev_debug(fme, "spi param=0x%lx\n", opae_readq(feature->addr + 0x8));
                                                                     ^

<...>

Quoted 5 lines
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +5 -0
+/**
+ * opae_manager_get_retimer_info - get retimer info like PKVL chip
+ * @mgr: opae_manager for retimer
+ * @info: info return to caller
+ *

drivers/raw/ifpga_rawdev/base/opae_hw_api.c struct opae_accelerator * · line 510

Quoted 10 lines
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +10 -0
+ * Return: 0 on success, otherwise error code
+ */
+int opae_manager_get_retimer_info(struct opae_manager *mgr,
+	       struct opae_retimer_info *info)
+{
+	if (!mgr || !mgr->network_ops)
+		return -EINVAL;
+
+	//if (mgr->network_ops->get_retimer_info)
+	//	return mgr->network_ops->get_retimer_info(mgr, info);

Please remove commented code, and for comments please prefer c89 style comments.

<...>

drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c line 3

Quoted 4 lines
drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c new file +3 -0
@@ -0,0 +1,490 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2018 Intel Corporation

Do you prefer to update date to 2019?

<...>

drivers/raw/ifpga_rawdev/base/opae_phy_group.c line 32

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/opae_phy_group.c new file +9 -0
+static void phy_indirect_write(struct phy_group_device *dev, u8 entry,
+		u16 addr, u32 value)
+{
+	u64 ctrl;
+
+	ctrl = CMD_RD << CTRL_COMMAND_SHIFT |
+		(entry & CTRL_PHY_NUM_MASK) << CTRL_PHY_NUM_SHIFT |
+		(addr & CTRL_PHY_ADDR_MASK) << CTRL_PHY_ADDR_SHIFT |
+		(value & CTRL_WRITE_DATA_MASK);

Is 32bit supported?
If so, CMD_RD is defined as 'unsigned long' which is 4bytes long in 32bit machine. Since CTRL_COMMAND_SHIFT is 62, the result will be different than expected. Also there is compiler warning for it:

.../drivers/raw/ifpga_rawdev/base/opae_phy_group.c: In function ‘phy_indirect_write’:
.../drivers/raw/ifpga_rawdev/base/opae_phy_group.c:29:16: error: left shift count >= width of type [-Werror=shift-count-overflow]
ctrl = CMD_RD << CTRL_COMMAND_SHIFT |

                ^~

Same for similar usage is phy_indirect_read()

<...>

Quoted 12 lines
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +12 -0
+static unsigned int spi_write_bytes(struct altera_spi_device *dev, int count)
+{
+	unsigned int val = 0;
+	u16 *p16;
+	u32 *p32;
+
+	if (dev->txbuf) {
+		switch (dev->data_width) {
+		case 1:
+			val = dev->txbuf[count];
+			break;
+		case 2:

drivers/raw/ifpga_rawdev/base/opae_spi.c line 122

Quoted 10 lines
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +10 -0
+			p16 = (u16 *)(dev->txbuf + 2*count);
+			val = *p16;
+			if (dev->endian == SPI_BIG_ENDIAN)
+				val = cpu_to_be16(val);
+			break;
+		case 4:
+			p32 = (u32 *)(dev->txbuf + 4*count);
+			val = *p32;
+			if (dev->endian == SPI_BIG_ENDIAN)
+				val = (val);

What is the intention here? Compiler warning:

.../drivers/raw/ifpga_rawdev/base/opae_spi.c:122:9: error: explicitly assigning value of variable of type 'unsigned int' to itself [-Werror,-Wself-assign]

<...>

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c line 34

Quoted 2 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +2 -0
+
+#ifdef OPAE_DEBUG

Is this DEBUG macro defined anywhere?

<...>

Quoted 8 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +8 -0
+	switch (trans_type) {
+	case SPI_TRAN_SEQ_WRITE:
+	case SPI_TRAN_NON_SEQ_WRITE:
+		for (i = 0; i < size; i++)
+			*p++ = *data++;
+
+			ret = packet_to_byte_conver(dev, size + HEADER_LEN,
+				      transaction, RESPONSE_LEN, response,

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c line 376

Quoted 10 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +10 -0
+				      &valid_len);
+			if (ret)
+				return -EBUSY;
+
+			/* check the result */
+			if (size != ((unsigned int)(response[2] & 0xff) << 8 |
+					(unsigned int)(response[3] & 0xff)))
+				ret = -EBUSY;
+
+			break;

Indentation is wrong after 'for' loop. Loops seems copying from 'data' to 'transaction' buffer, which is used later, so the logic seems correct but indentation is misleading, it is causing a build warning:

.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c: In function ‘do_transaction’:
.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c:362:3: error: this ‘for’ clause does not guard... [-Werror=misleading-indentation]
for (i = 0; i < size; i++)
^~~
.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c:365:4: note:
...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
ret = packet_to_byte_conver(dev, size + HEADER_LEN,
^~~

#7 lore raw

Re: [PATCH v1 03/11] drivers/raw/ifpga_rawdev: add OPAE share code for IPN3KE

Quoted 12 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 6, 2019 8:28 PM
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]>
Subject: Re: [PATCH v1 03/11] drivers/raw/ifpga_rawdev: add OPAE share code for IPN3KE

Quoted 8 lines
Quoted 1 line · Rosen Xu

Add OPAE share code for Intel FPGA Acceleration NIC IPN3KE.

What do you think adding a file to record the version of the shared code, as it is done in Intel NIC drivers, README file?

Also can you please add more details on what feautures has been added with this update?

Thanks, good suggestion, I will add a README file in next version.

Quoted 2 lines

And if possible can you please split this patch into logical parts?

Ok, is it possible split into multiple small patches for share code?if necessary, I will do it in next version.

Quoted 45 lines
Quoted 9 lines
---
 drivers/raw/ifpga_rawdev/base/Makefile             |   7 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c          |  69 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_api.h          |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |  86 +++-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c    | 342

+++++--------

Quoted 3 lines
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  | 170 +++++--
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |  62 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          | 373

++++++++++++++

Quoted 8 lines
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c       |   2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |  21 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c         |  21 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c   |  89 ++++
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h   |  14 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c        | 189 ++++++-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |  46 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c           | 490

+++++++++++++++++++

Quoted 4 lines
 drivers/raw/ifpga_rawdev/base/opae_i2c.h           | 127 +++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   | 106 ++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |  36 ++
 drivers/raw/ifpga_rawdev/base/opae_mdio.c          | 542

+++++++++++++++++++++

Quoted 5 lines
 drivers/raw/ifpga_rawdev/base/opae_mdio.h          |  90 ++++
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |  11 +-
 drivers/raw/ifpga_rawdev/base/opae_phy_group.c     |  88 ++++
 drivers/raw/ifpga_rawdev/base/opae_phy_group.h     |  53 ++
 drivers/raw/ifpga_rawdev/base/opae_spi.c           | 260

++++++++++

Quoted 2 lines
 drivers/raw/ifpga_rawdev/base/opae_spi.h           | 120 +++++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   | 438

+++++++++++++++++

Quoted 3 lines
 .../ifpga_rawdev/base/osdep_raw/osdep_generic.h    |   1 +
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |  10 +
 29 files changed, 3549 insertions(+), 315 deletions(-)

<...>

Quoted 2 lines
(quoted diff) +0 -0
@@ -165,37 +68,35 @@ static u64 feature_id(void __iomem *start)
 
Quoted 13 lines

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static u64 feature_id(void __iomem *start) · line 76

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +3 -1
 static int
 build_info_add_sub_feature(struct build_feature_devs_info *binfo,
-			   struct feature_info *finfo, void __iomem *start)
+		void __iomem *start, u64 fid, unsigned int size,
+		unsigned int vec_start,
+		unsigned int vec_cnt)
 {
 	struct ifpga_hw *hw = binfo->hw;
 	struct feature *feature = NULL;

struct names are so generic 'struct feature' & 'struct feature_ops' defined in ifpga_hw.h, they seems not added in this patch, but what do you think prefix them via "ifpga_" in a separate patch?

Yes, I agree, add prefix name is better, maybe we forget that patch, will fix in next version.

Quoted 11 lines

<...>

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static u64 feature_id(void __iomem *start) · line 99

Quoted 5 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +5 -0
+	feature->vec_start = vec_start;
+	feature->vec_cnt = vec_cnt;
+
+	dev_debug(binfo, "%s: id=0x%lx, phys_addr=0x%lx, size=%d\n",
+			__func__, feature->id, feature->phys_addr, size);

32bit build complains about %lx usage:

Quoted 3 lines

.../dpdk/drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c:99:51: error:
format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘u64’ {aka ‘long long unsigned int’} [-Werror= format=]

In this v1 patch, we forget check the 32 bit compiler, will fix in next version.

Quoted 14 lines

<...>

Review static int parse_feature(struct

Quoted 1 line
(quoted diff) +0 -0
@@ -651,12 +539,19 @@ static int parse_feature(struct

build_feature_devs_info *binfo,

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static int parse_feature(struct build_feature_devs_info *binfo, · line 544

Quoted 6 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +3 -0
 		}
 
 		hdr = (struct feature_header *)start;
+		header.csr = readq(hdr);
+
+		/*debug*/

I think can drop above comment, not adding extra information.

Quoted 6 lines

Review static int parse_feature(struct · line 545

Quoted 1 line
(quoted diff) +1 -0
+		dev_debug(binfo, "%s: address=0x%llx, val=0x%lx, header.id=0x%x,

header.next_offset=0x%x, header.eol=0x%x, header.type=0x%x\n",

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static int parse_feature(struct build_feature_devs_info *binfo, · line 546

Quoted 1 line
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +1 -0
+			__func__, (unsigned long long)(hdr), header.csr,

Why not use "%p" to print the address of the variable but cast it to 'unsigned long long'?

Will fix in next version.

Quoted 18 lines

<...>

drivers/raw/ifpga_rawdev/base/ifpga_fme.c struct feature_ops fme_power_mgmt_ops = { · line 773

Quoted 12 lines
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +12 -0
+static int fme_spi_init(struct feature *feature) {
+	struct feature_fme_spi *spi;
+	struct ifpga_fme_hw *fme = (struct ifpga_fme_hw *)feature->parent;
+	struct altera_spi_device *spi_master;
+	struct intel_max10_device *max10;
+	int ret = 0;
+
+	spi = (struct feature_fme_spi *)feature->addr;
+
+	dev_info(fme, "FME SPI Master (Max10) Init.\n");
+	dev_debug(fme, "FME SPI base addr %llx.\n",
+		 (unsigned long long)spi);

Same comment here, why not "%p", why casting the variable?

Quoted 9 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	dev_debug(fme, "spi param=0x%lx\n", opae_readq(feature->addr +
+0x8));

.../dpdk/drivers/raw/ifpga_rawdev/base/ifpga_fme.c:774:69: error: format ‘%lx’
expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’
{aka ‘long long unsigned int’} [-Werror= format=]
dev_debug(fme, "spi param=0x%lx\n", opae_readq(feature->addr + 0x8));

Will fix in next version.

Quoted 14 lines

^

<...>

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +9 -0
+/**
+ * opae_manager_get_retimer_info - get retimer info like PKVL chip
+ * @mgr: opae_manager for retimer
+ * @info: info return to caller
+ *
+ * Return: 0 on success, otherwise error code  */ int
+opae_manager_get_retimer_info(struct opae_manager *mgr,
+	       struct opae_retimer_info *info) {
+	if (!mgr || !mgr->network_ops)
Quoted 8 lines

drivers/raw/ifpga_rawdev/base/opae_hw_api.c struct opae_accelerator * · line 510

Quoted 4 lines
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +4 -0
+		return -EINVAL;
+
+	//if (mgr->network_ops->get_retimer_info)
+	//	return mgr->network_ops->get_retimer_info(mgr, info);

Please remove commented code, and for comments please prefer c89 style comments.

Will fix in next version.

Quoted 9 lines

<...>

drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c line 3

Quoted 4 lines
drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c new file +3 -0
@@ -0,0 +1,490 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2018 Intel Corporation

Do you prefer to update date to 2019?

Ok.

Quoted 18 lines

<...>

drivers/raw/ifpga_rawdev/base/opae_phy_group.c line 32

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/opae_phy_group.c new file +9 -0
+static void phy_indirect_write(struct phy_group_device *dev, u8 entry,
+		u16 addr, u32 value)
+{
+	u64 ctrl;
+
+	ctrl = CMD_RD << CTRL_COMMAND_SHIFT |
+		(entry & CTRL_PHY_NUM_MASK) << CTRL_PHY_NUM_SHIFT |
+		(addr & CTRL_PHY_ADDR_MASK) << CTRL_PHY_ADDR_SHIFT |
+		(value & CTRL_WRITE_DATA_MASK);

Is 32bit supported?
If so, CMD_RD is defined as 'unsigned long' which is 4bytes long in 32bit machine. Since CTRL_COMMAND_SHIFT is 62, the result will be different than expected. Also there is compiler warning for it:

Quoted 8 lines

.../drivers/raw/ifpga_rawdev/base/opae_phy_group.c: In function ‘phy_indirect_write’:
.../drivers/raw/ifpga_rawdev/base/opae_phy_group.c:29:16: error: left shift count >= width of type [-Werror=shift-count-overflow]
ctrl = CMD_RD << CTRL_COMMAND_SHIFT |

                ^~

Same for similar usage is phy_indirect_read()

The register is 64bit. We will fix for the 32bit compiler in next version.

Quoted 28 lines

<...>

Quoted 12 lines
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +12 -0
+static unsigned int spi_write_bytes(struct altera_spi_device *dev,
+int count) {
+	unsigned int val = 0;
+	u16 *p16;
+	u32 *p32;
+
+	if (dev->txbuf) {
+		switch (dev->data_width) {
+		case 1:
+			val = dev->txbuf[count];
+			break;
+		case 2:

drivers/raw/ifpga_rawdev/base/opae_spi.c line 122

Quoted 10 lines
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +10 -0
+			p16 = (u16 *)(dev->txbuf + 2*count);
+			val = *p16;
+			if (dev->endian == SPI_BIG_ENDIAN)
+				val = cpu_to_be16(val);
+			break;
+		case 4:
+			p32 = (u32 *)(dev->txbuf + 4*count);
+			val = *p32;
+			if (dev->endian == SPI_BIG_ENDIAN)
+				val = (val);

What is the intention here? Compiler warning:

Quoted 3 lines

.../drivers/raw/ifpga_rawdev/base/opae_spi.c:122:9: error: explicitly assigning value of variable of type 'unsigned int' to itself [-Werror,-Wself-assign]

Ok, will fix in next version.

Quoted 33 lines

<...>

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c line 34

Quoted 2 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +2 -0
+
+#ifdef OPAE_DEBUG

Is this DEBUG macro defined anywhere?

<...>

Quoted 8 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +8 -0
+	switch (trans_type) {
+	case SPI_TRAN_SEQ_WRITE:
+	case SPI_TRAN_NON_SEQ_WRITE:
+		for (i = 0; i < size; i++)
+			*p++ = *data++;
+
+			ret = packet_to_byte_conver(dev, size + HEADER_LEN,
+				      transaction, RESPONSE_LEN, response,

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c line 376

Quoted 10 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +10 -0
+				      &valid_len);
+			if (ret)
+				return -EBUSY;
+
+			/* check the result */
+			if (size != ((unsigned int)(response[2] & 0xff) << 8 |
+					(unsigned int)(response[3] & 0xff)))
+				ret = -EBUSY;
+
+			break;

Indentation is wrong after 'for' loop. Loops seems copying from 'data' to 'transaction' buffer, which is used later, so the logic seems correct but indentation is misleading, it is causing a build warning:

Quoted 13 lines

.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c: In function
‘do_transaction’:
.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c:362:3:
error: this ‘for’ clause does not guard... [-Werror=misleading-indentation]
for (i = 0; i < size; i++)
^~~
.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c:365:4:
note:
...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
ret = packet_to_byte_conver(dev, size + HEADER_LEN,
^~~

Will fix in next version.

What GCC compiler are you using?

#8 lore raw

Re: [PATCH v1 03/11] drivers/raw/ifpga_rawdev: add OPAE share code for IPN3KE

Quoted 300 lines · Tianfei
Quoted 12 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 6, 2019 8:28 PM
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]>
Subject: Re: [PATCH v1 03/11] drivers/raw/ifpga_rawdev: add OPAE share code for IPN3KE

Quoted 8 lines
Quoted 1 line · Rosen Xu

Add OPAE share code for Intel FPGA Acceleration NIC IPN3KE.

What do you think adding a file to record the version of the shared code, as it is done in Intel NIC drivers, README file?

Also can you please add more details on what feautures has been added with this update?

Thanks, good suggestion, I will add a README file in next version.

Quoted 2 lines

And if possible can you please split this patch into logical parts?

Ok, is it possible split into multiple small patches for share code?if necessary, I will do it in next version.

Quoted 45 lines
Quoted 9 lines
---
 drivers/raw/ifpga_rawdev/base/Makefile             |   7 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c          |  69 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_api.h          |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |  86 +++-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c    | 342

+++++--------

Quoted 3 lines
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  | 170 +++++--
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |  62 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          | 373

++++++++++++++

Quoted 8 lines
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c       |   2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |  21 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c         |  21 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c   |  89 ++++
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h   |  14 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c        | 189 ++++++-
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |  46 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c           | 490

+++++++++++++++++++

Quoted 4 lines
 drivers/raw/ifpga_rawdev/base/opae_i2c.h           | 127 +++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   | 106 ++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |  36 ++
 drivers/raw/ifpga_rawdev/base/opae_mdio.c          | 542

+++++++++++++++++++++

Quoted 5 lines
 drivers/raw/ifpga_rawdev/base/opae_mdio.h          |  90 ++++
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |  11 +-
 drivers/raw/ifpga_rawdev/base/opae_phy_group.c     |  88 ++++
 drivers/raw/ifpga_rawdev/base/opae_phy_group.h     |  53 ++
 drivers/raw/ifpga_rawdev/base/opae_spi.c           | 260

++++++++++

Quoted 2 lines
 drivers/raw/ifpga_rawdev/base/opae_spi.h           | 120 +++++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   | 438

+++++++++++++++++

Quoted 3 lines
 .../ifpga_rawdev/base/osdep_raw/osdep_generic.h    |   1 +
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |  10 +
 29 files changed, 3549 insertions(+), 315 deletions(-)

<...>

Quoted 2 lines
(quoted diff) +0 -0
@@ -165,37 +68,35 @@ static u64 feature_id(void __iomem *start)
 
Quoted 13 lines

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static u64 feature_id(void __iomem *start) · line 76

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +3 -1
 static int
 build_info_add_sub_feature(struct build_feature_devs_info *binfo,
-			   struct feature_info *finfo, void __iomem *start)
+		void __iomem *start, u64 fid, unsigned int size,
+		unsigned int vec_start,
+		unsigned int vec_cnt)
 {
 	struct ifpga_hw *hw = binfo->hw;
 	struct feature *feature = NULL;

struct names are so generic 'struct feature' & 'struct feature_ops' defined in ifpga_hw.h, they seems not added in this patch, but what do you think prefix them via "ifpga_" in a separate patch?

Yes, I agree, add prefix name is better, maybe we forget that patch, will fix in next version.

Quoted 11 lines

<...>

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static u64 feature_id(void __iomem *start) · line 99

Quoted 5 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +5 -0
+	feature->vec_start = vec_start;
+	feature->vec_cnt = vec_cnt;
+
+	dev_debug(binfo, "%s: id=0x%lx, phys_addr=0x%lx, size=%d\n",
+			__func__, feature->id, feature->phys_addr, size);

32bit build complains about %lx usage:

Quoted 3 lines

.../dpdk/drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c:99:51: error:
format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘u64’ {aka ‘long long unsigned int’} [-Werror= format=]

In this v1 patch, we forget check the 32 bit compiler, will fix in next version.

Quoted 14 lines

<...>

Review static int parse_feature(struct

Quoted 1 line
(quoted diff) +0 -0
@@ -651,12 +539,19 @@ static int parse_feature(struct

build_feature_devs_info *binfo,

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static int parse_feature(struct build_feature_devs_info *binfo, · line 544

Quoted 6 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +3 -0
 		}
 
 		hdr = (struct feature_header *)start;
+		header.csr = readq(hdr);
+
+		/*debug*/

I think can drop above comment, not adding extra information.

Quoted 6 lines

Review static int parse_feature(struct · line 545

Quoted 1 line
(quoted diff) +1 -0
+		dev_debug(binfo, "%s: address=0x%llx, val=0x%lx, header.id=0x%x,

header.next_offset=0x%x, header.eol=0x%x, header.type=0x%x\n",

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static int parse_feature(struct build_feature_devs_info *binfo, · line 546

Quoted 1 line
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +1 -0
+			__func__, (unsigned long long)(hdr), header.csr,

Why not use "%p" to print the address of the variable but cast it to 'unsigned long long'?

Will fix in next version.

Quoted 18 lines

<...>

drivers/raw/ifpga_rawdev/base/ifpga_fme.c struct feature_ops fme_power_mgmt_ops = { · line 773

Quoted 12 lines
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +12 -0
+static int fme_spi_init(struct feature *feature) {
+	struct feature_fme_spi *spi;
+	struct ifpga_fme_hw *fme = (struct ifpga_fme_hw *)feature->parent;
+	struct altera_spi_device *spi_master;
+	struct intel_max10_device *max10;
+	int ret = 0;
+
+	spi = (struct feature_fme_spi *)feature->addr;
+
+	dev_info(fme, "FME SPI Master (Max10) Init.\n");
+	dev_debug(fme, "FME SPI base addr %llx.\n",
+		 (unsigned long long)spi);

Same comment here, why not "%p", why casting the variable?

Quoted 9 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	dev_debug(fme, "spi param=0x%lx\n", opae_readq(feature->addr +
+0x8));

.../dpdk/drivers/raw/ifpga_rawdev/base/ifpga_fme.c:774:69: error: format ‘%lx’
expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’
{aka ‘long long unsigned int’} [-Werror= format=]
dev_debug(fme, "spi param=0x%lx\n", opae_readq(feature->addr + 0x8));

Will fix in next version.

Quoted 14 lines

^

<...>

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +9 -0
+/**
+ * opae_manager_get_retimer_info - get retimer info like PKVL chip
+ * @mgr: opae_manager for retimer
+ * @info: info return to caller
+ *
+ * Return: 0 on success, otherwise error code  */ int
+opae_manager_get_retimer_info(struct opae_manager *mgr,
+	       struct opae_retimer_info *info) {
+	if (!mgr || !mgr->network_ops)
Quoted 8 lines

drivers/raw/ifpga_rawdev/base/opae_hw_api.c struct opae_accelerator * · line 510

Quoted 4 lines
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +4 -0
+		return -EINVAL;
+
+	//if (mgr->network_ops->get_retimer_info)
+	//	return mgr->network_ops->get_retimer_info(mgr, info);

Please remove commented code, and for comments please prefer c89 style comments.

Will fix in next version.

Quoted 9 lines

<...>

drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c line 3

Quoted 4 lines
drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c new file +3 -0
@@ -0,0 +1,490 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2018 Intel Corporation

Do you prefer to update date to 2019?

Ok.

Quoted 18 lines

<...>

drivers/raw/ifpga_rawdev/base/opae_phy_group.c line 32

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/opae_phy_group.c new file +9 -0
+static void phy_indirect_write(struct phy_group_device *dev, u8 entry,
+		u16 addr, u32 value)
+{
+	u64 ctrl;
+
+	ctrl = CMD_RD << CTRL_COMMAND_SHIFT |
+		(entry & CTRL_PHY_NUM_MASK) << CTRL_PHY_NUM_SHIFT |
+		(addr & CTRL_PHY_ADDR_MASK) << CTRL_PHY_ADDR_SHIFT |
+		(value & CTRL_WRITE_DATA_MASK);

Is 32bit supported?
If so, CMD_RD is defined as 'unsigned long' which is 4bytes long in 32bit machine. Since CTRL_COMMAND_SHIFT is 62, the result will be different than expected. Also there is compiler warning for it:

Quoted 8 lines

.../drivers/raw/ifpga_rawdev/base/opae_phy_group.c: In function ‘phy_indirect_write’:
.../drivers/raw/ifpga_rawdev/base/opae_phy_group.c:29:16: error: left shift count >= width of type [-Werror=shift-count-overflow]
ctrl = CMD_RD << CTRL_COMMAND_SHIFT |

                ^~

Same for similar usage is phy_indirect_read()

The register is 64bit. We will fix for the 32bit compiler in next version.

Quoted 28 lines

<...>

Quoted 12 lines
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +12 -0
+static unsigned int spi_write_bytes(struct altera_spi_device *dev,
+int count) {
+	unsigned int val = 0;
+	u16 *p16;
+	u32 *p32;
+
+	if (dev->txbuf) {
+		switch (dev->data_width) {
+		case 1:
+			val = dev->txbuf[count];
+			break;
+		case 2:

drivers/raw/ifpga_rawdev/base/opae_spi.c line 122

Quoted 10 lines
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +10 -0
+			p16 = (u16 *)(dev->txbuf + 2*count);
+			val = *p16;
+			if (dev->endian == SPI_BIG_ENDIAN)
+				val = cpu_to_be16(val);
+			break;
+		case 4:
+			p32 = (u32 *)(dev->txbuf + 4*count);
+			val = *p32;
+			if (dev->endian == SPI_BIG_ENDIAN)
+				val = (val);

What is the intention here? Compiler warning:

Quoted 3 lines

.../drivers/raw/ifpga_rawdev/base/opae_spi.c:122:9: error: explicitly assigning value of variable of type 'unsigned int' to itself [-Werror,-Wself-assign]

Ok, will fix in next version.

Quoted 33 lines

<...>

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c line 34

Quoted 2 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +2 -0
+
+#ifdef OPAE_DEBUG

Is this DEBUG macro defined anywhere?

<...>

Quoted 8 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +8 -0
+	switch (trans_type) {
+	case SPI_TRAN_SEQ_WRITE:
+	case SPI_TRAN_NON_SEQ_WRITE:
+		for (i = 0; i < size; i++)
+			*p++ = *data++;
+
+			ret = packet_to_byte_conver(dev, size + HEADER_LEN,
+				      transaction, RESPONSE_LEN, response,

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c line 376

Quoted 10 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +10 -0
+				      &valid_len);
+			if (ret)
+				return -EBUSY;
+
+			/* check the result */
+			if (size != ((unsigned int)(response[2] & 0xff) << 8 |
+					(unsigned int)(response[3] & 0xff)))
+				ret = -EBUSY;
+
+			break;

Indentation is wrong after 'for' loop. Loops seems copying from 'data' to 'transaction' buffer, which is used later, so the logic seems correct but indentation is misleading, it is causing a build warning:

Quoted 13 lines

.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c: In function
‘do_transaction’:
.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c:362:3:
error: this ‘for’ clause does not guard... [-Werror=misleading-indentation]
for (i = 0; i < size; i++)
^~~
.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c:365:4:
note:
...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
ret = packet_to_byte_conver(dev, size + HEADER_LEN,
^~~

Quoted 3 lines

Will fix in next version.

What GCC compiler are you using?

gcc (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6)
clang version 7.0.1 (Fedora 7.0.1-2.fc29)
icc (ICC) 19.0.2.187 20190117

the build errors I put are from one of the above ones, since there were many errors I didn't filter which error is specific to which compiler.

#9 lore raw

Re: [PATCH v1 03/11] drivers/raw/ifpga_rawdev: add OPAE share code for IPN3KE

Quoted 328 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Thursday, March 7, 2019 1:55 AM
To: Zhang, Tianfei <[email protected]>; Xu, Rosen <[email protected]>; [email protected]
Cc: Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>
Subject: Re: [PATCH v1 03/11] drivers/raw/ifpga_rawdev: add OPAE share code for IPN3KE

Quoted 8 lines · Tianfei
Quoted 8 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 6, 2019 8:28 PM
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,

Quoted 1 line
Quoted 1 line

Santos <[email protected]>; Zhang, Zhang

<[email protected]>

Quoted 12 lines
Quoted 11 lines

Subject: Re: [PATCH v1 03/11] drivers/raw/ifpga_rawdev: add OPAE share code for IPN3KE

Quoted 1 line · Rosen Xu

Add OPAE share code for Intel FPGA Acceleration NIC IPN3KE.

What do you think adding a file to record the version of the shared code, as it is done in Intel NIC drivers, README file?

Also can you please add more details on what feautures has been added with this update?

Quoted 6 lines

Thanks, good suggestion, I will add a README file in next version.

Quoted 2 lines

And if possible can you please split this patch into logical parts?

Ok, is it possible split into multiple small patches for share code?if

necessary, I will do it in next version.

Quoted 14 lines
Quoted 14 lines
Quoted 10 lines
---
 drivers/raw/ifpga_rawdev/base/Makefile             |   7 +
 drivers/raw/ifpga_rawdev/base/ifpga_api.c          |  69 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_api.h          |   1 +
 drivers/raw/ifpga_rawdev/base/ifpga_defines.h      |  86 +++-
 drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c    | 342

+++++--------

Quoted 3 lines
 drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.c  | 170 +++++--
drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h  |  62 ++-
 drivers/raw/ifpga_rawdev/base/ifpga_fme.c          | 373
Quoted 7 lines
Quoted 7 lines

++++++++++++++

Quoted 6 lines
 drivers/raw/ifpga_rawdev/base/ifpga_fme_pr.c       |   2 +-
 drivers/raw/ifpga_rawdev/base/ifpga_hw.h           |  21 +-
 drivers/raw/ifpga_rawdev/base/ifpga_port.c         |  21 +
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c   |  89 ++++
 drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.h   |  14 +
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c        | 189

++++++-

Quoted 39 lines
Quoted 25 lines
Quoted 2 lines
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h        |  46 +-
 drivers/raw/ifpga_rawdev/base/opae_i2c.c           | 490

+++++++++++++++++++

Quoted 4 lines
 drivers/raw/ifpga_rawdev/base/opae_i2c.h           | 127 +++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c   | 106 ++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |  36 ++
 drivers/raw/ifpga_rawdev/base/opae_mdio.c          | 542

+++++++++++++++++++++

Quoted 5 lines
 drivers/raw/ifpga_rawdev/base/opae_mdio.h          |  90 ++++
 drivers/raw/ifpga_rawdev/base/opae_osdep.h         |  11 +-
 drivers/raw/ifpga_rawdev/base/opae_phy_group.c     |  88 ++++
 drivers/raw/ifpga_rawdev/base/opae_phy_group.h     |  53 ++
 drivers/raw/ifpga_rawdev/base/opae_spi.c           | 260

++++++++++

Quoted 2 lines
 drivers/raw/ifpga_rawdev/base/opae_spi.h           | 120 +++++
 .../raw/ifpga_rawdev/base/opae_spi_transaction.c   | 438

+++++++++++++++++

Quoted 3 lines
 .../ifpga_rawdev/base/osdep_raw/osdep_generic.h    |   1 +
 .../ifpga_rawdev/base/osdep_rte/osdep_generic.h    |  10 +
 29 files changed, 3549 insertions(+), 315 deletions(-)

<...>

Quoted 2 lines
(quoted diff) +0 -0
@@ -165,37 +68,35 @@ static u64 feature_id(void __iomem *start)
 
Quoted 13 lines

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static u64 feature_id(void __iomem *start) · line 76

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +3 -1
 static int
 build_info_add_sub_feature(struct build_feature_devs_info *binfo,
-			   struct feature_info *finfo, void __iomem *start)
+		void __iomem *start, u64 fid, unsigned int size,
+		unsigned int vec_start,
+		unsigned int vec_cnt)
 {
 	struct ifpga_hw *hw = binfo->hw;
 	struct feature *feature = NULL;

struct names are so generic 'struct feature' & 'struct feature_ops' defined in ifpga_hw.h, they seems not added in this patch, but what do you think prefix them via "ifpga_" in a separate patch?

Quoted 1 line

Yes, I agree, add prefix name is better, maybe we forget that patch, will fix

in next version.

Quoted 26 lines
Quoted 12 lines

<...>

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static u64 feature_id(void __iomem *start) · line 99

Quoted 5 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +5 -0
+	feature->vec_start = vec_start;
+	feature->vec_cnt = vec_cnt;
+
+	dev_debug(binfo, "%s: id=0x%lx, phys_addr=0x%lx, size=%d\n",
+			__func__, feature->id, feature->phys_addr, size);

32bit build complains about %lx usage:

Quoted 4 lines

.../dpdk/drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c:99:51: error:
format ‘%lx’ expects argument of type ‘long unsigned int’, but argument
5 has type ‘u64’ {aka ‘long long unsigned int’} [-Werror= format=]

In this v1 patch, we forget check the 32 bit compiler, will fix in next version.

Quoted 7 lines

<...>

Review static int parse_feature(struct

Quoted 1 line
(quoted diff) +0 -0
@@ -651,12 +539,19 @@ static int parse_feature(struct

build_feature_devs_info *binfo,

Quoted 2 lines
(quoted diff) +0 -0
 		}
 
Quoted 8 lines
Quoted 8 lines

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static int parse_feature(struct build_feature_devs_info *binfo, · line 544

Quoted 4 lines
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +3 -0
 		hdr = (struct feature_header *)start;
+		header.csr = readq(hdr);
+
+		/*debug*/

I think can drop above comment, not adding extra information.

Review static int parse_feature(struct · line 545

Quoted 1 line
(quoted diff) +1 -0
+		dev_debug(binfo, "%s: address=0x%llx, val=0x%lx,

header.id=0x%x,

Quoted 5 lines
Quoted 5 lines

header.next_offset=0x%x, header.eol=0x%x, header.type=0x%x\n",

drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c static int parse_feature(struct build_feature_devs_info *binfo, · line 546

Quoted 1 line
drivers/raw/ifpga_rawdev/base/ifpga_enumerate.c +1 -0
+			__func__, (unsigned long long)(hdr), header.csr,

Why not use "%p" to print the address of the variable but cast it to 'unsigned long long'?

Quoted 7 lines

Will fix in next version.

Quoted 6 lines

<...>

Review

Quoted 3 lines
(quoted diff) +3 -0
+static int fme_spi_init(struct feature *feature) {
+	struct feature_fme_spi *spi;
+	struct ifpga_fme_hw *fme = (struct ifpga_fme_hw

*)feature->parent;

Quoted 12 lines
Quoted 12 lines

drivers/raw/ifpga_rawdev/base/ifpga_fme.c struct feature_ops fme_power_mgmt_ops = { · line 773

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/ifpga_fme.c +9 -0
+	struct altera_spi_device *spi_master;
+	struct intel_max10_device *max10;
+	int ret = 0;
+
+	spi = (struct feature_fme_spi *)feature->addr;
+
+	dev_info(fme, "FME SPI Master (Max10) Init.\n");
+	dev_debug(fme, "FME SPI base addr %llx.\n",
+		 (unsigned long long)spi);

Same comment here, why not "%p", why casting the variable?

Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	dev_debug(fme, "spi param=0x%lx\n", opae_readq(feature->addr

+

Quoted 104 lines
Quoted 9 lines
Quoted 1 line

+0x8));

.../dpdk/drivers/raw/ifpga_rawdev/base/ifpga_fme.c:774:69: error:
format ‘%lx’
expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’
{aka ‘long long unsigned int’} [-Werror= format=]
dev_debug(fme, "spi param=0x%lx\n", opae_readq(feature->addr +
0x8));

Will fix in next version.

Quoted 14 lines

^

<...>

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +9 -0
+/**
+ * opae_manager_get_retimer_info - get retimer info like PKVL chip
+ * @mgr: opae_manager for retimer
+ * @info: info return to caller
+ *
+ * Return: 0 on success, otherwise error code  */ int
+opae_manager_get_retimer_info(struct opae_manager *mgr,
+	       struct opae_retimer_info *info) {
+	if (!mgr || !mgr->network_ops)
Quoted 8 lines

drivers/raw/ifpga_rawdev/base/opae_hw_api.c struct opae_accelerator * · line 510

Quoted 4 lines
drivers/raw/ifpga_rawdev/base/opae_hw_api.c +4 -0
+		return -EINVAL;
+
+	//if (mgr->network_ops->get_retimer_info)
+	//	return mgr->network_ops->get_retimer_info(mgr, info);

Please remove commented code, and for comments please prefer c89 style comments.

Will fix in next version.

Quoted 9 lines

<...>

drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c line 3

Quoted 4 lines
drivers/raw/ifpga_rawdev/base/opae_at24_eeprom.c new file +3 -0
@@ -0,0 +1,490 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2018 Intel Corporation

Do you prefer to update date to 2019?

Ok.

Quoted 18 lines

<...>

drivers/raw/ifpga_rawdev/base/opae_phy_group.c line 32

Quoted 9 lines
drivers/raw/ifpga_rawdev/base/opae_phy_group.c new file +9 -0
+static void phy_indirect_write(struct phy_group_device *dev, u8 entry,
+		u16 addr, u32 value)
+{
+	u64 ctrl;
+
+	ctrl = CMD_RD << CTRL_COMMAND_SHIFT |
+		(entry & CTRL_PHY_NUM_MASK) << CTRL_PHY_NUM_SHIFT |
+		(addr & CTRL_PHY_ADDR_MASK) << CTRL_PHY_ADDR_SHIFT |
+		(value & CTRL_WRITE_DATA_MASK);

Is 32bit supported?
If so, CMD_RD is defined as 'unsigned long' which is 4bytes long in 32bit machine. Since CTRL_COMMAND_SHIFT is 62, the result will be different than expected. Also there is compiler warning for it:

Quoted 8 lines

.../drivers/raw/ifpga_rawdev/base/opae_phy_group.c: In function ‘phy_indirect_write’:
.../drivers/raw/ifpga_rawdev/base/opae_phy_group.c:29:16: error: left shift count >= width of type [-Werror=shift-count-overflow]
ctrl = CMD_RD << CTRL_COMMAND_SHIFT |

                ^~

Same for similar usage is phy_indirect_read()

The register is 64bit. We will fix for the 32bit compiler in next version.

Quoted 28 lines

<...>

Quoted 12 lines
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +12 -0
+static unsigned int spi_write_bytes(struct altera_spi_device *dev,
+int count) {
+	unsigned int val = 0;
+	u16 *p16;
+	u32 *p32;
+
+	if (dev->txbuf) {
+		switch (dev->data_width) {
+		case 1:
+			val = dev->txbuf[count];
+			break;
+		case 2:

drivers/raw/ifpga_rawdev/base/opae_spi.c line 122

Quoted 10 lines
drivers/raw/ifpga_rawdev/base/opae_spi.c new file +10 -0
+			p16 = (u16 *)(dev->txbuf + 2*count);
+			val = *p16;
+			if (dev->endian == SPI_BIG_ENDIAN)
+				val = cpu_to_be16(val);
+			break;
+		case 4:
+			p32 = (u32 *)(dev->txbuf + 4*count);
+			val = *p32;
+			if (dev->endian == SPI_BIG_ENDIAN)
+				val = (val);

What is the intention here? Compiler warning:

Quoted 43 lines
Quoted 3 lines

.../drivers/raw/ifpga_rawdev/base/opae_spi.c:122:9: error: explicitly assigning value of variable of type 'unsigned int' to itself [-Werror,-Wself-assign]

Ok, will fix in next version.

Quoted 38 lines

<...>

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c line 34

Quoted 2 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +2 -0
+
+#ifdef OPAE_DEBUG

Is this DEBUG macro defined anywhere?

<...>

Quoted 8 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +8 -0
+	switch (trans_type) {
+	case SPI_TRAN_SEQ_WRITE:
+	case SPI_TRAN_NON_SEQ_WRITE:
+		for (i = 0; i < size; i++)
+			*p++ = *data++;
+
+			ret = packet_to_byte_conver(dev, size + HEADER_LEN,
+				      transaction, RESPONSE_LEN, response,

drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c line 376

Quoted 10 lines
drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c new file +10 -0
+				      &valid_len);
+			if (ret)
+				return -EBUSY;
+
+			/* check the result */
+			if (size != ((unsigned int)(response[2] & 0xff) << 8 |
+					(unsigned int)(response[3] & 0xff)))
+				ret = -EBUSY;
+
+			break;

Indentation is wrong after 'for' loop. Loops seems copying from 'data' to 'transaction' buffer, which is used later, so the logic seems correct but indentation is misleading, it is causing a build warning:

.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c: In function
‘do_transaction’:
.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c:362:3:
error: this ‘for’ clause does not guard...

[-Werror=misleading-indentation]

Quoted 10 lines
Quoted 8 lines
   for (i = 0; i < size; i++)
   ^~~

.../dpdk/drivers/raw/ifpga_rawdev/base/opae_spi_transaction.c:365:4:
note:
...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
ret = packet_to_byte_conver(dev, size + HEADER_LEN, ^~~

Will fix in next version.

Quoted 7 lines
Quoted 1 line

What GCC compiler are you using?

gcc (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6) clang version 7.0.1 (Fedora 7.0.1-2.fc29) icc (ICC) 19.0.2.187 20190117

the build errors I put are from one of the above ones, since there were many errors I didn't filter which error is specific to which compiler.

Thanks, we will clean our code for all of compilers in next version.

Quoted 1 line
author
#10 lore raw

PATCH 4/11 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/ifpga_rawdev.c     | 146 +++++++++++++++++++++++++++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev_api.h |  71 ++++++++++++++
 2 files changed, 214 insertions(+), 3 deletions(-)
 create mode 100644 drivers/raw/ifpga_rawdev/ifpga_rawdev_api.h
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +143 -3
index da772d0..0635009 100644
@@ -34,6 +34,7 @@
 #include "ifpga_common.h"
 #include "ifpga_logs.h"
 #include "ifpga_rawdev.h"
+#include "ifpga_rawdev_api.h"
 
 int ifpga_rawdev_logtype;
 
@@ -42,10 +43,12 @@
 #define PCIE_DEVICE_ID_PF_INT_5_X    0xBCBD
 #define PCIE_DEVICE_ID_PF_INT_6_X    0xBCC0
 #define PCIE_DEVICE_ID_PF_DSC_1_X    0x09C4
+#define PCIE_DEVICE_ID_PAC_N3000     0x0B30
 /* VF Device */
 #define PCIE_DEVICE_ID_VF_INT_5_X    0xBCBF
 #define PCIE_DEVICE_ID_VF_INT_6_X    0xBCC1
 #define PCIE_DEVICE_ID_VF_DSC_1_X    0x09C5
+#define PCIE_DEVICE_ID_VF_PAC_N3000  0x0B31
 #define RTE_MAX_RAW_DEVICE           10
 
 static const struct rte_pci_id pci_ifpga_map[] = {
@@ -55,6 +58,8 @@
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_VF_INT_6_X) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_PF_DSC_1_X) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_VF_DSC_1_X) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_PAC_N3000),},
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_VF_PAC_N3000),},
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
@@ -327,6 +332,141 @@
 	return 0;
 }
 
+static int
+ifgpa_rawdev_get_attr(struct rte_rawdev *dev,
+		     const char *attr_name,
+		     uint64_t *attr_value)
+{
+	struct ifpga_rawdev_mac_info *mac_info;
+	struct ifpga_rawdevg_retimer_info *retimer_info;
+	struct opae_retimer_info or_info;
+	struct opae_adapter *adapter;
+	struct opae_manager *mgr;
+	struct ifpga_rawdevg_link_info *linfo;
+	struct opae_retimer_status rstatus;
+
+	IFPGA_RAWDEV_PMD_FUNC_TRACE();
+
+	if (!dev || !attr_name || !attr_value) {
+		IFPGA_BUS_ERR("Invalid arguments for getting attributes");
+		return -1;
+	}
+
+	adapter = ifpga_rawdev_get_priv(dev);
+	if (!adapter)
+		return -1;
+
+	mgr = opae_adapter_get_mgr(adapter);
+	if (!mgr)
+		return -1;
+
+	if (!strcmp(attr_name, "retimer_info")) {
+		retimer_info = (struct ifpga_rawdevg_retimer_info *)attr_value;
+		if (opae_manager_get_retimer_info(mgr, &or_info))
+			return -1;
+
+		retimer_info->retimer_num = or_info.num_retimer;
+		retimer_info->port_num = or_info.num_port;
+		switch (or_info.support_speed) {
+		case MXD_10GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI;
+			break;
+		case MXD_25GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_25GE_25GAUI;
+			break;
+		case MXD_40GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEVG_RETIMER_MAC_TYPE_40GE_XLAUI;
+			break;
+		case MXD_100GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_100GE_CAUI;
+			break;
+		default:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_UNKNOWN;
+			break;
+		}
+		return 0;
+	} else if (!strcmp(attr_name, "default_mac")) {
+		/* not implement by MAX */
+		mac_info = (struct ifpga_rawdev_mac_info *)attr_value;
+		mac_info->addr.addr_bytes[0] = 0;
+		mac_info->addr.addr_bytes[1] = 0;
+		mac_info->addr.addr_bytes[2] = 0;
+		mac_info->addr.addr_bytes[3] = 0;
+		mac_info->addr.addr_bytes[4] = 0;
+		mac_info->addr.addr_bytes[5] = 0xA + mac_info->port_id;
+
+		return 0;
+	} else if (!strcmp(attr_name, "retimer_linkstatus")) {
+		linfo = (struct ifpga_rawdevg_link_info *)attr_value;
+		linfo->link_up = 0;
+		linfo->link_speed = IFPGA_RAWDEV_LINK_SPEED_UNKNOWN;
+
+		if (opae_manager_get_retimer_status(mgr, linfo->port, &rstatus))
+			return -1;
+
+		linfo->link_up = rstatus.line_link;
+		switch (rstatus.speed) {
+		case MXD_10GB:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_10GB;
+			break;
+		case MXD_25GB:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_25GB;
+			break;
+		case MXD_40GB:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_40GB;
+			break;
+		default:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_UNKNOWN;
+			break;
+		}
+
+		return 0;
+	} else
+		return -1;
+
+	/* Attribute not found */
+	return -1;
+}
+
+static int ifgpa_rawdev_set_attr(struct rte_rawdev *dev,
+				     const char *attr_name,
+				     const uint64_t attr_value)
+{
+	struct opae_adapter *adapter;
+	struct opae_manager *mgr;
+	/*struct ifpga_rawdevg_link_info *linfo;*/
+	/*struct opae_retimer_status rstatus;*/
+
+	IFPGA_RAWDEV_PMD_FUNC_TRACE();
+
+	if (!dev || !attr_name) {
+		IFPGA_BUS_ERR("Invalid arguments for setting attributes");
+		return -1;
+	}
+
+	adapter = ifpga_rawdev_get_priv(dev);
+	if (!adapter)
+		return -1;
+
+	mgr = opae_adapter_get_mgr(adapter);
+	if (!mgr)
+		return -1;
+
+	if (!strcmp(attr_name, "retimer_linkstatus"))
+		printf("ifgpa_rawdev_set_attr_func %lx\n", attr_value);
+
+	return -1;
+}
+
 static const struct rte_rawdev_ops ifpga_rawdev_ops = {
 	.dev_info_get = ifpga_rawdev_info_get,
 	.dev_configure = ifpga_rawdev_configure,
@@ -339,8 +479,8 @@
 	.queue_setup = NULL,
 	.queue_release = NULL,
 
-	.attr_get = NULL,
-	.attr_set = NULL,
+	.attr_get = ifgpa_rawdev_get_attr,
+	.attr_set = ifgpa_rawdev_set_attr,
 
 	.enqueue_bufs = NULL,
 	.dequeue_bufs = NULL,
@@ -419,7 +559,7 @@
 
 	rawdev->dev_ops = &ifpga_rawdev_ops;
 	rawdev->device = &pci_dev->device;
-	rawdev->driver_name = pci_dev->device.driver->name;
+	rawdev->driver_name = pci_dev->driver->driver.name;
 
 	/* must enumerate the adapter before use it */
 	ret = opae_adapter_enumerate(adapter);
drivers/raw/ifpga_rawdev/ifpga_rawdev_api.h new file +71 -0

71 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#11 lore raw

Re: [PATCH v1 04/11] drivers/raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE support for IFPGA Rawdev.

<...>

Quoted 20 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +20 -0
+static int
+ifgpa_rawdev_get_attr(struct rte_rawdev *dev,
+		     const char *attr_name,
+		     uint64_t *attr_value)
+{
+	struct ifpga_rawdev_mac_info *mac_info;
+	struct ifpga_rawdevg_retimer_info *retimer_info;
+	struct opae_retimer_info or_info;
+	struct opae_adapter *adapter;
+	struct opae_manager *mgr;
+	struct ifpga_rawdevg_link_info *linfo;
+	struct opae_retimer_status rstatus;
+
+	IFPGA_RAWDEV_PMD_FUNC_TRACE();
+
+	if (!dev || !attr_name || !attr_value) {
+		IFPGA_BUS_ERR("Invalid arguments for getting attributes");
+		return -1;
+	}
+

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 364

Quoted 10 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +10 -0
+	adapter = ifpga_rawdev_get_priv(dev);
+	if (!adapter)
+		return -1;
+
+	mgr = opae_adapter_get_mgr(adapter);
+	if (!mgr)
+		return -1;
+
+	if (!strcmp(attr_name, "retimer_info")) {
+		retimer_info = (struct ifpga_rawdevg_retimer_info *)attr_value;

How you are using the 'get_attr' & 'set_attr' is a little odd.

I think the intention with these APIs to provide a map/dictionary like data structure, save/get 'attr_values' by 'attr_name'.

How you are using is, instead of getting 'attr_value', you are passing valid pointers via 'attr_value' and make this function to fill that struct. Why you don't have a specific function for this purpose instead of using 'get_attr' & 'set_attr' ops? I believe this will be source of confusion in long term.

Quoted 73 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +73 -0
+		if (opae_manager_get_retimer_info(mgr, &or_info))
+			return -1;
+
+		retimer_info->retimer_num = or_info.num_retimer;
+		retimer_info->port_num = or_info.num_port;
+		switch (or_info.support_speed) {
+		case MXD_10GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI;
+			break;
+		case MXD_25GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_25GE_25GAUI;
+			break;
+		case MXD_40GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEVG_RETIMER_MAC_TYPE_40GE_XLAUI;
+			break;
+		case MXD_100GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_100GE_CAUI;
+			break;
+		default:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_UNKNOWN;
+			break;
+		}
+		return 0;
+	} else if (!strcmp(attr_name, "default_mac")) {
+		/* not implement by MAX */
+		mac_info = (struct ifpga_rawdev_mac_info *)attr_value;
+		mac_info->addr.addr_bytes[0] = 0;
+		mac_info->addr.addr_bytes[1] = 0;
+		mac_info->addr.addr_bytes[2] = 0;
+		mac_info->addr.addr_bytes[3] = 0;
+		mac_info->addr.addr_bytes[4] = 0;
+		mac_info->addr.addr_bytes[5] = 0xA + mac_info->port_id;
+
+		return 0;
+	} else if (!strcmp(attr_name, "retimer_linkstatus")) {
+		linfo = (struct ifpga_rawdevg_link_info *)attr_value;
+		linfo->link_up = 0;
+		linfo->link_speed = IFPGA_RAWDEV_LINK_SPEED_UNKNOWN;
+
+		if (opae_manager_get_retimer_status(mgr, linfo->port, &rstatus))
+			return -1;
+
+		linfo->link_up = rstatus.line_link;
+		switch (rstatus.speed) {
+		case MXD_10GB:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_10GB;
+			break;
+		case MXD_25GB:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_25GB;
+			break;
+		case MXD_40GB:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_40GB;
+			break;
+		default:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_UNKNOWN;
+			break;
+		}
+
+		return 0;
+	} else
+		return -1;
+
+	/* Attribute not found */
+	return -1;

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 447

Quoted 10 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +10 -0
+}
+
+static int ifgpa_rawdev_set_attr(struct rte_rawdev *dev,
+				     const char *attr_name,
+				     const uint64_t attr_value)
+{
+	struct opae_adapter *adapter;
+	struct opae_manager *mgr;
+	/*struct ifpga_rawdevg_link_info *linfo;*/
+	/*struct opae_retimer_status rstatus;*/

Please remove commented out code.

Quoted 5 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +5 -0
+
+	IFPGA_RAWDEV_PMD_FUNC_TRACE();
+
+	if (!dev || !attr_name) {
+		IFPGA_BUS_ERR("Invalid arguments for setting attributes");

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 462

Quoted 10 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +10 -0
+		return -1;
+	}
+
+	adapter = ifpga_rawdev_get_priv(dev);
+	if (!adapter)
+		return -1;
+
+	mgr = opae_adapter_get_mgr(adapter);
+	if (!mgr)
+		return -1;

nothing done with 'adapter' & 'mgr' ? Why getting them?

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 465

Quoted 3 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +3 -0
+
+	if (!strcmp(attr_name, "retimer_linkstatus"))
+		printf("ifgpa_rawdev_set_attr_func %lx\n", attr_value);

%lx usage is wrong for 32bits, it is giving a build warning [1], also please don't use 'printf' for logging.
And why there is a specific check for a value and log, in a generic function like set_attr?

[1]
.../drivers/raw/ifpga_rawdev/ifpga_rawdev.c: In function ‘ifgpa_rawdev_set_attr’:
.../drivers/raw/ifpga_rawdev/ifpga_rawdev.c:465:40: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘const long long unsigned int’} [-We$
ror=format=]

   printf("ifgpa_rawdev_set_attr_func %lx\n", attr_value);
                                      ~~^     ~~~~~~~~~~
                                      %llx

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+	return -1;

Will function always fail?
And are you aware the you did not set anything in this function? Just ignored the 'attr_value'?

<...>

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 562

Quoted 6 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +1 -1
@@ -419,7 +559,7 @@
 
 	rawdev->dev_ops = &ifpga_rawdev_ops;
 	rawdev->device = &pci_dev->device;
-	rawdev->driver_name = pci_dev->device.driver->name;
+	rawdev->driver_name = pci_dev->driver->driver.name;

They are both same right?

<...>

drivers/raw/ifpga_rawdev/ifpga_rawdev_api.h line 12

Quoted 6 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev_api.h new file +6 -0
+
+#include <rte_ether.h>
+
+#ifndef ETH_ALEN
+#define ETH_ALEN	6
+#endif

You can use "ETHER_ADDR_LEN" instead, it is defined in above included 'rte_ether.h' header.

author Applied
#12 lore raw

Re: [PATCH v1 04/11] drivers/raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Hi,

Quoted 55 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 06, 2019 20:31
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]>; Hemant Agrawal <[email protected]>; Shreyansh Jain <[email protected]>
Subject: Re: [PATCH v1 04/11] drivers/raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE support for IFPGA Rawdev.

<...>

Quoted 20 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +20 -0
+static int
+ifgpa_rawdev_get_attr(struct rte_rawdev *dev,
+		     const char *attr_name,
+		     uint64_t *attr_value)
+{
+	struct ifpga_rawdev_mac_info *mac_info;
+	struct ifpga_rawdevg_retimer_info *retimer_info;
+	struct opae_retimer_info or_info;
+	struct opae_adapter *adapter;
+	struct opae_manager *mgr;
+	struct ifpga_rawdevg_link_info *linfo;
+	struct opae_retimer_status rstatus;
+
+	IFPGA_RAWDEV_PMD_FUNC_TRACE();
+
+	if (!dev || !attr_name || !attr_value) {
+		IFPGA_BUS_ERR("Invalid arguments for getting attributes");
+		return -1;
+	}
+

drivers/raw/ifpga_rawdev/ifpga_rawdev.c

Quoted 10 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +10 -0
+	adapter = ifpga_rawdev_get_priv(dev);
+	if (!adapter)
+		return -1;
+
+	mgr = opae_adapter_get_mgr(adapter);
+	if (!mgr)
+		return -1;
+
+	if (!strcmp(attr_name, "retimer_info")) {
+		retimer_info = (struct ifpga_rawdevg_retimer_info

*)attr_value;

How you are using the 'get_attr' & 'set_attr' is a little odd.

Quoted 8 lines

I think the intention with these APIs to provide a map/dictionary like data structure, save/get 'attr_values' by 'attr_name'.

How you are using is, instead of getting 'attr_value', you are passing valid pointers via 'attr_value' and make this function to fill that struct. Why you don't have a specific function for this purpose instead of using 'get_attr' & 'set_attr' ops? I believe this will be source of confusion in long term.

Good suggestions, I will modify it in v2 patch set.

Quoted 78 lines
Quoted 35 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +35 -0
+		if (opae_manager_get_retimer_info(mgr, &or_info))
+			return -1;
+
+		retimer_info->retimer_num = or_info.num_retimer;
+		retimer_info->port_num = or_info.num_port;
+		switch (or_info.support_speed) {
+		case MXD_10GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI;
+			break;
+		case MXD_25GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_25GE_25GAUI;
+			break;
+		case MXD_40GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEVG_RETIMER_MAC_TYPE_40GE_XLAUI;
+			break;
+		case MXD_100GB:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_100GE_CAUI;
+			break;
+		default:
+			retimer_info->mac_type =
+			IFPGA_RAWDEV_RETIMER_MAC_TYPE_UNKNOWN;
+			break;
+		}
+		return 0;
+	} else if (!strcmp(attr_name, "default_mac")) {
+		/* not implement by MAX */
+		mac_info = (struct ifpga_rawdev_mac_info *)attr_value;
+		mac_info->addr.addr_bytes[0] = 0;
+		mac_info->addr.addr_bytes[1] = 0;
+		mac_info->addr.addr_bytes[2] = 0;
+		mac_info->addr.addr_bytes[3] = 0;

drivers/raw/ifpga_rawdev/ifpga_rawdev.c

Quoted 10 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +10 -0
+		mac_info->addr.addr_bytes[4] = 0;
+		mac_info->addr.addr_bytes[5] = 0xA + mac_info->port_id;
+
+		return 0;
+	} else if (!strcmp(attr_name, "retimer_linkstatus")) {
+		linfo = (struct ifpga_rawdevg_link_info *)attr_value;
+		linfo->link_up = 0;
+		linfo->link_speed = IFPGA_RAWDEV_LINK_SPEED_UNKNOWN;
+
+		if (opae_manager_get_retimer_status(mgr, linfo->port,

&rstatus))

Quoted 32 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +32 -0
+			return -1;
+
+		linfo->link_up = rstatus.line_link;
+		switch (rstatus.speed) {
+		case MXD_10GB:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_10GB;
+			break;
+		case MXD_25GB:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_25GB;
+			break;
+		case MXD_40GB:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_40GB;
+			break;
+		default:
+			linfo->link_speed =
+				IFPGA_RAWDEV_LINK_SPEED_UNKNOWN;
+			break;
+		}
+
+		return 0;
+	} else
+		return -1;
+
+	/* Attribute not found */
+	return -1;
+}
+
+static int ifgpa_rawdev_set_attr(struct rte_rawdev *dev,
+				     const char *attr_name,
Quoted 8 lines

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 447

Quoted 6 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +6 -0
+				     const uint64_t attr_value)
+{
+	struct opae_adapter *adapter;
+	struct opae_manager *mgr;
+	/*struct ifpga_rawdevg_link_info *linfo;*/
+	/*struct opae_retimer_status rstatus;*/

Please remove commented out code.

Applied.

Quoted 9 lines
Quoted 9 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +9 -0
+
+	IFPGA_RAWDEV_PMD_FUNC_TRACE();
+
+	if (!dev || !attr_name) {
+		IFPGA_BUS_ERR("Invalid arguments for setting attributes");
+		return -1;
+	}
+
+	adapter = ifpga_rawdev_get_priv(dev);
Quoted 8 lines

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 361

Quoted 6 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +6 -0
+	if (!adapter)
+		return -1;
+
+	mgr = opae_adapter_get_mgr(adapter);
+	if (!mgr)
+		return -1;

nothing done with 'adapter' & 'mgr' ? Why getting them?

Currently we are not using set_attr, I will remove it.

Quoted 6 lines

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 465

Quoted 3 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +3 -0
+
+	if (!strcmp(attr_name, "retimer_linkstatus"))
+		printf("ifgpa_rawdev_set_attr_func %lx\n", attr_value);

%lx usage is wrong for 32bits, it is giving a build warning [1], also please don't use 'printf' for logging.

Fixed in v2 patch.

Quoted 2 lines

And why there is a specific check for a value and log, in a generic function like set_attr?

Currently we are not using set_attr, I will remove it.

Quoted 9 lines

[1]
.../drivers/raw/ifpga_rawdev/ifpga_rawdev.c: In function ‘ifgpa_rawdev_set_attr’:
.../drivers/raw/ifpga_rawdev/ifpga_rawdev.c:465:40: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘const long long unsigned int’} [-We$ ror=format=]

   printf("ifgpa_rawdev_set_attr_func %lx\n", attr_value);
                                      ~~^     ~~~~~~~~~~
                                      %llx

It's just for debug.
Currently we are not using set_attr, I will remove it.

Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+	return -1;

Will function always fail?
And are you aware the you did not set anything in this function? Just ignored the 'attr_value'?

<...>

Currently we are not using set_attr, I will remove it.

Quoted 8 lines

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 562

Quoted 6 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +1 -1
@@ -419,7 +559,7 @@
 
 	rawdev->dev_ops = &ifpga_rawdev_ops;
 	rawdev->device = &pci_dev->device;
-	rawdev->driver_name = pci_dev->device.driver->name;
+	rawdev->driver_name = pci_dev->driver->driver.name;

They are both same right?

Yes, they are same.

Quoted 11 lines

<...>

drivers/raw/ifpga_rawdev/ifpga_rawdev_api.h line 12

Quoted 6 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev_api.h new file +6 -0
+
+#include <rte_ether.h>
+
+#ifndef ETH_ALEN
+#define ETH_ALEN	6
+#endif

You can use "ETHER_ADDR_LEN" instead, it is defined in above included 'rte_ether.h' header.

Thanks, I will replace " ETH_ALEN " with "ETHER_ADDR_LEN".

author
#13 lore raw

PATCH 5/11 drivers/net/ipn3ke: add IPN3KE PMD driver

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE PMD driver.

---
 drivers/net/Makefile                          |    1 +
 drivers/net/ipn3ke/Makefile                   |   33 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |  814 +++++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |  742 +++++++++
 drivers/net/ipn3ke/ipn3ke_flow.c              | 1407 ++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h              |  104 ++
 drivers/net/ipn3ke/ipn3ke_logs.h              |   30 +
 drivers/net/ipn3ke/ipn3ke_representor.c       |  890 ++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c                | 2217 +++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.h                |  135 ++
 drivers/net/ipn3ke/meson.build                |    9 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map |    4 +
 12 files changed, 6386 insertions(+)
 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_representor.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.h
 create mode 100644 drivers/net/ipn3ke/meson.build
 create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
drivers/net/Makefile +1 -0
index 670d7f7..f66263c 100644
@@ -32,6 +32,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
+DIRS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke
 DIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += liquidio
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5
drivers/net/ipn3ke/Makefile new file +33 -0
new file mode 100644
index 0000000..03f2145
@@ -0,0 +1,33 @@
+# 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
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
+#CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga
+CFLAGS += -I$(RTE_SDK)/drivers/raw/ifpga_rawdev
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_bus_vdev
+
+EXPORT_MAP := rte_pmd_ipn3ke_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-y += ipn3ke_ethdev.c
+SRCS-y += ipn3ke_representor.c
+SRCS-y += ipn3ke_tm.c
+SRCS-y += ipn3ke_flow.c
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +814 -0

814 lines not on this page · raw message

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

742 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_flow.c new file +1407 -0

1,404 lines not on this page · raw message

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

104 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_logs.h new file +30 -0
new file mode 100644
index 0000000..dedaece

Lines of this file are not shown. View the raw message.

drivers/net/ipn3ke/ipn3ke_representor.c new file +890 -0

890 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_tm.c new file +2217 -0

2,217 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_tm.h new file +135 -0

135 lines not on this page · raw message

drivers/net/ipn3ke/meson.build new file +9 -0
new file mode 100644
index 0000000..e02ac25

Lines of this file are not shown. View the raw message.

drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +4 -0
new file mode 100644
index 0000000..ef35398

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.8.3.1

Part of the diff is not shown here. View the raw message.

#14 lore raw

Re: [PATCH v1 05/11] drivers/net/ipn3ke: add IPN3KE PMD driver

Really quick look at this.

Quoted 10 lines · Rosen Xu
drivers/net/ipn3ke/Makefile new file +3 -0
new file mode 100644
index 0000000..03f2145
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+

drivers/net/ipn3ke/Makefile line 13

Quoted 10 lines
drivers/net/ipn3ke/Makefile new file +10 -0
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_ipn3ke.a
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
+#CFLAGS += $(WERROR_FLAGS)

This kind of bypass is likely to be kept as is forever... better fix the issues now.

Quoted 9 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +0 -0
new file mode 100644
index 0000000..e691f68
 

drivers/net/ipn3ke/ipn3ke_ethdev.c

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +8 -0
[snip]
 
+
+RTE_INIT(ipn3ke_afu_init_log);
+static void
+ipn3ke_afu_init_log(void)
+{
+       ipn3ke_afu_logtype = rte_log_register("driver.afu.ipn3ke");
+       if (ipn3ke_afu_logtype >= 0)
+               rte_log_set_level(ipn3ke_afu_logtype, RTE_LOG_NOTICE);

rte_log_register_type_and_pick_level() would be better.

(quoted diff) +0 -0

drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map line 4

Quoted 11 lines

b/drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
new file mode 100644
index 0000000..ef35398

drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +4 -0
@@ -0,0 +1,4 @@
+DPDK_2.0 {
+
+       local: *;
+};

Ok this driver has been around for a long time, but now, we are in 2019, please fix :-)

Signature · 1 line
David Marchand
author
#15 lore raw

Re: [PATCH v1 05/11] drivers/net/ipn3ke: add IPN3KE PMD driver

Hi,

From: David Marchand [mailto:[email protected]]
Sent: Thursday, February 28, 2019 16:32
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]>
Subject: Re: [dpdk-dev] [PATCH v1 05/11] drivers/net/ipn3ke: add IPN3KE PMD driver

Really quick look at this.

On Thu, Feb 28, 2019 at 8:16 AM Rosen Xu <[email protected]<mailto:[email protected]>> wrote:

drivers/net/ipn3ke/Makefile new file +13 -0
new file mode 100644
index 0000000..03f2145
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk<http://rte.vars.mk>
+
+#
+# library name
+#
+LIB = librte_pmd_ipn3ke.a
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
+#CFLAGS += $(WERROR_FLAGS)

This kind of bypass is likely to be kept as is forever... better fix the issues now.

It will be fixed in V2.

drivers/net/ipn3ke/ipn3ke_ethdev.c new file +0 -0
new file mode 100644
index 0000000..e691f68

[snip]
+
+RTE_INIT(ipn3ke_afu_init_log);
+static void
+ipn3ke_afu_init_log(void)
+{
+ ipn3ke_afu_logtype = rte_log_register("driver.afu.ipn3ke");
+ if (ipn3ke_afu_logtype >= 0)
+ rte_log_set_level(ipn3ke_afu_logtype, RTE_LOG_NOTICE);

rte_log_register_type_and_pick_level() would be better. It will be fixed in V2.

drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +4 -0
new file mode 100644
index 0000000..ef35398
@@ -0,0 +1,4 @@
+DPDK_2.0 {
+
+       local: *;
+};

Ok this driver has been around for a long time, but now, we are in 2019, please fix :-) It will be fixed in V2.

--
David Marchand

#16 lore raw

Re: [PATCH v1 05/11] drivers/net/ipn3ke: add IPN3KE PMD driver

In reply to Rosen Xu
Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE PMD driver.

Quoted 13 lines
---
 drivers/net/Makefile                          |    1 +
 drivers/net/ipn3ke/Makefile                   |   33 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |  814 +++++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |  742 +++++++++
 drivers/net/ipn3ke/ipn3ke_flow.c              | 1407 ++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h              |  104 ++
 drivers/net/ipn3ke/ipn3ke_logs.h              |   30 +
 drivers/net/ipn3ke/ipn3ke_representor.c       |  890 ++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c                | 2217 +++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.h                |  135 ++
 drivers/net/ipn3ke/meson.build                |    9 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map |    4 +

Can you please split this patch into multiple patch, at least I think ethdev, flow support and tm support can be seperated.

<...>

drivers/net/Makefile DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k · line 35

Quoted 5 lines
drivers/net/Makefile +1 -0
@@ -32,6 +32,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
+DIRS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke

Can you please add alphatecally sorted, you are almost there, but not quite J

<...>

drivers/net/ipn3ke/Makefile line 11

Quoted 12 lines
drivers/net/ipn3ke/Makefile new file +11 -0
@@ -0,0 +1,33 @@
+# 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
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API

Can you please add the experimenatal APIs called from this PMD as comments here, that can help a lot to trace when to remove the flag, or it is really required?

drivers/net/ipn3ke/Makefile line 19

Quoted 8 lines
drivers/net/ipn3ke/Makefile new file +8 -0
+CFLAGS += -O3
+#CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga
+CFLAGS += -I$(RTE_SDK)/drivers/raw/ifpga_rawdev
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_bus_vdev

Can you please double check if you really have a dependency to both pci and vdev? And don't you need bus_ifpga ?

drivers/net/ipn3ke/Makefile line 28

Quoted 9 lines
drivers/net/ipn3ke/Makefile new file +9 -0
+
+EXPORT_MAP := rte_pmd_ipn3ke_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-y += ipn3ke_ethdev.c

They are same thing, but for consistency can you please use:
SRC-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 38

Quoted 8 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +8 -0
+static const struct rte_afu_uuid afu_uuid_ipn3ke_map[] = {
+	{ MAP_UUID_10G_LOW,  MAP_UUID_10G_HIGH },
+	{ IPN3KE_UUID_10G_LOW, IPN3KE_UUID_10G_HIGH },
+	{ IPN3KE_UUID_25G_LOW, IPN3KE_UUID_25G_HIGH },
+	{ 0, 0 /* sentinel */ },
+};
+
+struct ipn3ke_hw_cap hw_cap;

Do you need this forward decleration? "ipn3ke_ethdev.h" is already included.

drivers/net/ipn3ke/ipn3ke_ethdev.c line 45

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

According our coding convention, it should be like:

static int
ipn3ke_indirect_read(struct ipn3ke_hw *hw,

	uint32_t *rd_data, uint32_t addr, uint32_t mac_num,
	uint32_t dev_sel, uint32_t eth_wrapper_sel)

Since this is a new file, why now follow the project coding convention?
https://doc.dpdk.org/guides/contributing/coding_style.html

<...>

Quoted 17 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +17 -0
+static int
+ipn3ke_hw_init_vbng(struct rte_afu_device *afu_dev,
+	struct ipn3ke_hw *hw)
+{
+	struct rte_rawdev *rawdev;
+	int ret;
+	int i;
+	uint32_t val;
+
+	rawdev  = afu_dev->rawdev;
+
+	hw->afu_id.uuid.uuid_low = afu_dev->id.uuid.uuid_low;
+	hw->afu_id.uuid.uuid_high = afu_dev->id.uuid.uuid_high;
+	hw->afu_id.port = afu_dev->id.port;
+	hw->hw_addr = (uint8_t *)(afu_dev->mem_resource[0].addr);
+	if ((afu_dev->id.uuid.uuid_low == MAP_UUID_10G_LOW) &&
+		(afu_dev->id.uuid.uuid_high == MAP_UUID_10G_HIGH)) {

drivers/net/ipn3ke/ipn3ke_ethdev.c line 380

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +10 -0
+		hw->f_mac_read = map_indirect_mac_read;
+		hw->f_mac_write = map_indirect_mac_write;
+	} else {
+		hw->f_mac_read = ipn3ke_indirect_mac_read;
+		hw->f_mac_write = ipn3ke_indirect_mac_write;
+	}
+	hw->rawdev = rawdev;
+	rawdev->dev_ops->attr_get(rawdev,
+				"retimer_info",
+				(uint64_t *)&hw->retimer);

What do you think casting to "uintptr_t" instead of "uint64_t *" ?

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 443

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +6 -0
+	ret = rte_eth_switch_domain_alloc(&hw->switch_domain_id);
+	if (ret)
+		IPN3KE_AFU_PMD_WARN("failed to allocate switch domain for device %d",
+		ret);
+
+	ret = ipn3ke_hw_tm_init(hw);

function is defined in another .c file, need to declared for the usage, otherwise causing build warning:

.../drivers/net/ipn3ke/ipn3ke_ethdev.c: In function ‘ipn3ke_hw_init_vbng’:
.../drivers/net/ipn3ke/ipn3ke_ethdev.c:443:8: warning: implicit declaration of function ‘ipn3ke_hw_tm_init’; did you mean ‘ipn3ke_hw_cap_init’? [-Wimplicit-function-declaration]

  ret = ipn3ke_hw_tm_init(hw);
        ^~~~~~~~~~~~~~~~~

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 506

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

Can combine both:
RTE_INIT(ipn3ke_afu_init_log)
{

Just for consistency, can you move this function to the buttom of the file?

Review

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

"pmd.net.ipn3ke"

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 532

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +5 -0
+		if (!hw) {
+			IPN3KE_AFU_PMD_LOG(ERR,
+				"failed to allocate hardwart data");
+				retval = -ENOMEM;
+				return -ENOMEM;

There is already 'IPN3KE_AFU_PMD_ERR' and variant macros defined if you prefer to use.

drivers/net/ipn3ke/ipn3ke_ethdev.c line 536

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +4 -0
+		}
+		afu_dev->shared.data = hw;
+
+		rte_spinlock_init(&afu_dev->shared.lock);

Getting following warning with clang [1], worth chekcing, is 'struct rte_afu_device' really needs to be packed?

[1]
.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c:536:22: warning: taking address of packed member 'shared' of class or structure 'rte_afu_device' may result in an unaligned pointer value [-Waddress-of-pack
ed-member]

                rte_spinlock_init(&afu_dev->shared.lock);
                                   ^~~~~~~~~~~~~~~~~~~~

drivers/net/ipn3ke/ipn3ke_ethdev.c line 544

Quoted 8 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +8 -0
+	} else
+		hw = (struct ipn3ke_hw *)afu_dev->shared.data;
+
+#if IPN3KE_HW_BASE_ENABLE
+	retval = ipn3ke_hw_init_base(afu_dev, hw);
+	if (retval)
+		return retval;
+#endif

Is this macro defined anywhere? It looks like not, so is it used like "#if 0", if so removed the macro and the wrapped code please.

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +10 -0
+
+	retval = ipn3ke_hw_init_vbng(afu_dev, hw);
+	if (retval)
+		return retval;
+
+	/* 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,

drivers/net/ipn3ke/ipn3ke_ethdev.c line 564

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +10 -0
+			.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);

Similar allignment warning as above:

.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c:562:32: warning: taking address of packed member 'device' of class or structure 'rte_afu_device' may result in an unaligned pointer value [-Waddress-of-pac$
ed-member]

                retval = rte_eth_dev_create(&afu_dev->device, name,
                                             ^~~~~~~~~~~~~~~

drivers/net/ipn3ke/ipn3ke_ethdev.c line 568

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +4 -0
+
+		if (retval)
+			IPN3KE_AFU_PMD_LOG(ERR, "failed to create ipn3ke "
+				"representor %s.", name);

No need to split the message.

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 600

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +5 -0
+	ret = rte_eth_switch_domain_free(hw->switch_domain_id);
+	if (ret)
+		IPN3KE_AFU_PMD_LOG(WARNING,
+							"failed to free switch domain: %d",
+							ret);

Please fix the indentation.

drivers/net/ipn3ke/ipn3ke_ethdev.c line 604

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +3 -0
+
+	/* flow uninit*/> +
+	ipn3ke_hw_uninit(hw);

Is the comment for "hw_uninit" ?

drivers/net/ipn3ke/ipn3ke_ethdev.c line 615

Quoted 11 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +11 -0
+
+	return 0;
+}
+
+static struct rte_afu_driver afu_ipn3ke_driver = {
+	.id_table = afu_uuid_ipn3ke_map,
+	.probe = ipn3ke_vswitch_probe,
+	.remove = ipn3ke_vswitch_remove,
+};
+
+RTE_PMD_REGISTER_AFU(net_ipn3ke_afu, afu_ipn3ke_driver);

So this file is has two drivers, one vdev driver and one afu driver. Is vdev one only to get the device arguments? If so why not get device arguments directly to afu driver and remove the vdev device/driver?

And since this is an AFU driver, should we have a drivers/ifpga/* folder and put these drivers in it? What do you think?

Quoted 1 line

+RTE_PMD_REGISTER_AFU_ALIAS(net_ipn3ke_afu, afu_dev);

Isn't 'afu_dev' so genereic for being alias?

Also are you taking 'alias' field into account? I checked the ifpga bus code but not able to find, can you please double check? Did you test this alias?

drivers/net/ipn3ke/ipn3ke_ethdev.c line 624

Quoted 8 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +8 -0
+RTE_PMD_REGISTER_PARAM_STRING(net_ipn3ke_afu,
+	"bdf=<string> "
+	"port=<int> "
+	"uudi_high=<int64> "
+	"uuid_low=<int64> "
+	"path=<string> "
+	"pr_enable=<int>"
+	"debug=<int>");

Are these the net driver device arguments? Where they are defined/parsed/used?

drivers/net/ipn3ke/ipn3ke_ethdev.c line 637

Quoted 13 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +13 -0
+
+static const char * const valid_args[] = {
+#define IPN3KE_AFU_NAME         "afu"
+		IPN3KE_AFU_NAME,
+#define IPN3KE_FPGA_ACCELERATION_LIST     "fpga_acc"
+		IPN3KE_FPGA_ACCELERATION_LIST,
+#define IPN3KE_I40E_PF_LIST     "i40e_pf"
+		IPN3KE_I40E_PF_LIST,
+		NULL
+};
+static int
+ipn3ke_cfg_parse_acc_list(const char *afu_name,
+const char *acc_list_name)

Please fix the indentation.

<...>

Quoted 15 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +15 -0
+	if (rte_kvargs_count(kvlist, IPN3KE_FPGA_ACCELERATION_LIST) == 1) {
+		if (rte_kvargs_process(kvlist, IPN3KE_FPGA_ACCELERATION_LIST,
+				       &rte_ifpga_get_string_arg,
+				       &acc_name) < 0) {
+			IPN3KE_AFU_PMD_ERR("error to parse %s",
+				     IPN3KE_FPGA_ACCELERATION_LIST);
+			goto end;
+		}
+		ret = ipn3ke_cfg_parse_acc_list(afu_name, acc_name);
+		if (ret)
+			goto end;
+	} else {
+		IPN3KE_AFU_PMD_INFO("arg %s is optional for ipn3ke, using i40e acc",
+			  IPN3KE_FPGA_ACCELERATION_LIST);
+	}

drivers/net/ipn3ke/ipn3ke_ethdev.c line 778

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +10 -0
+
+	if (rte_kvargs_count(kvlist, IPN3KE_I40E_PF_LIST) == 1) {
+		if (rte_kvargs_process(kvlist, IPN3KE_I40E_PF_LIST,
+				       &rte_ifpga_get_string_arg,
+				       &pf_name) < 0) {
+			IPN3KE_AFU_PMD_ERR("error to parse %s",
+				     IPN3KE_I40E_PF_LIST);
+			goto end;
+		}
+		ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name);

You shouldn't rely on to the order of the devargs, what if 'afu_name' is not provided yet when 'pf_name' arg is provided?

Same concern for above 'ipn3ke_cfg_parse_acc_list()'. It is better to get all the args first, later call the proper APIs.

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 800

Quoted 7 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +7 -0
+static int
+ipn3ke_cfg_remove(struct rte_vdev_device *vdev)
+{
+	IPN3KE_AFU_PMD_INFO("Remove ipn3ke_cfg %p",
+		vdev);
+
+	return 0;

Nothing to be done for remove?

drivers/net/ipn3ke/ipn3ke_ethdev.c line 813

Quoted 13 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +13 -0
+}
+
+static struct rte_vdev_driver ipn3ke_cfg_driver = {
+	.probe = ipn3ke_cfg_probe,
+	.remove = ipn3ke_cfg_remove,
+};
+
+RTE_PMD_REGISTER_VDEV(ipn3ke_cfg, ipn3ke_cfg_driver);
+RTE_PMD_REGISTER_ALIAS(ipn3ke_cfg, ipn3ke_cfg);
+RTE_PMD_REGISTER_PARAM_STRING(ipn3ke_cfg,
+	"afu=<string> "
+	"fpga_acc=<string>"
+	"i40e=<string>");

Isn't this "i40e_pf", using defined macros can prevent mistakes.

<...>

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

drivers/net/ipn3ke/ipn3ke_ethdev.h line 220

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_ethdev.h new file +10 -0
+	uint64_t read_data = 0;
+	uint64_t indirect_value = 0;
+	volatile void *indirect_addrs = 0;
+
+	word_offset = (addr & 0x1FFFFFF) >> 2;
+	indirect_value = RCMD | word_offset << 32;
+	indirect_addrs = (volatile void *)(hw->hw_addr +
+						(uint32_t)(UPL_BASE | 0x10));
+
+	usleep(10);

Required head for usleep seems not included, causing build warning:

In file included from .../drivers/net/ipn3ke/ipn3ke_representor.c:27:
.../drivers/net/ipn3ke/ipn3ke_ethdev.h: In function ‘_ipn3ke_indrct_read’:
.../drivers/net/ipn3ke/ipn3ke_ethdev.h:220:2: warning: implicit declaration of function ‘usleep’; did you mean ‘fseek’? [-Wimplicit-function-declaration]
usleep(10);
^~~~~~

Same warning for all occurances.

<...>

drivers/net/ipn3ke/ipn3ke_flow.c line 1011

Quoted 9 lines
drivers/net/ipn3ke/ipn3ke_flow.c new file +9 -0
+static int
+ipn3ke_flow_hw_update(struct ipn3ke_hw *hw,
+			struct rte_flow *flow, uint32_t is_add)
+{
+	uint32_t *pdata = NULL;
+	uint32_t data;
+	uint32_t time_out = MHL_COMMAND_TIME_COUNT;
+
+#ifdef DEBUG_IPN3KE_FLOW

In many places in this patchset, there are define which are not part of PMD configuration. So most probably need to enable/disable them manually in the code. This approach is very open the errors. The code in the ifdef block is escaped from all compilers, when someone needs it, it is common that they even don't compile and work.

I suggest removing them all.

If a define is really necessary add it as PMD config option.

Quoted 63 lines
drivers/net/ipn3ke/ipn3ke_flow.c new file +63 -0
+	uint32_t i;
+
+	printf("IPN3KE flow dump\n");
+
+	pdata = (uint32_t *)flow->rule.key;
+	printf(" - key   :");
+
+	for (i = 0; i < RTE_DIM(flow->rule.key); i++)
+		printf(" %02x", flow->rule.key[i]);
+
+	for (i = 0; i < 4; i++)
+		printf(" %02x", __SWAP32(pdata[3 - i]));
+	printf("\n");
+
+	pdata = (uint32_t *)flow->rule.result;
+	printf(" - result:");
+
+	for (i = 0; i < RTE_DIM(flow->rule.result); i++)
+		printf(" %02x", flow->rule.result[i]);
+
+	for (i = 0; i < 1; i++)
+		printf(" %02x", pdata[i]);
+	printf("\n");
+#endif
+
+	pdata = (uint32_t *)flow->rule.key;
+
+	IPN3KE_MASK_WRITE_REG(hw,
+			IPN3KE_CLF_MHL_KEY_0,
+			0,
+			__SWAP32(pdata[3]),
+			IPN3KE_CLF_MHL_KEY_MASK);
+
+	IPN3KE_MASK_WRITE_REG(hw,
+			IPN3KE_CLF_MHL_KEY_1,
+			0,
+			__SWAP32(pdata[2]),
+			IPN3KE_CLF_MHL_KEY_MASK);
+
+	IPN3KE_MASK_WRITE_REG(hw,
+			IPN3KE_CLF_MHL_KEY_2,
+			0,
+			__SWAP32(pdata[1]),
+			IPN3KE_CLF_MHL_KEY_MASK);
+
+	IPN3KE_MASK_WRITE_REG(hw,
+			IPN3KE_CLF_MHL_KEY_3,
+			0,
+			__SWAP32(pdata[0]),
+			IPN3KE_CLF_MHL_KEY_MASK);
+
+	pdata = (uint32_t *)flow->rule.result;
+	IPN3KE_MASK_WRITE_REG(hw,
+			IPN3KE_CLF_MHL_RES,
+			0,
+			__SWAP32(pdata[0]),
+			IPN3KE_CLF_MHL_RES_MASK);
+
+	/* insert/delete the key and result */
+	data = 0;
+	data = IPN3KE_MASK_READ_REG(hw,
+				IPN3KE_CLF_MHL_MGMT_CTRL,
+				0,

drivers/net/ipn3ke/ipn3ke_flow.c line 1084

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_flow.c new file +10 -0
+				0x80000000);
+	time_out = MHL_COMMAND_TIME_COUNT;
+	while (IPN3KE_BIT_ISSET(data, IPN3KE_CLF_MHL_MGMT_CTRL_BIT_BUSY) &&
+		(time_out > 0)) {
+		data = IPN3KE_MASK_READ_REG(hw,
+					IPN3KE_CLF_MHL_MGMT_CTRL,
+					0,
+					0x80000000);
+		time_out--;
+		rte_delay_us(MHL_COMMAND_TIME_INTERVAL_US);

This is giving missing decleration warning for cross compile [1], most probably a heder is missing.

[1]
.../drivers/net/ipn3ke/ipn3ke_flow.c:1084:3: warning: implicit declaration of function ‘rte_delay_us’; did you mean ‘rte_realloc’? [-Wimplicit-function-declaration]
rte_delay_us(MHL_COMMAND_TIME_INTERVAL_US);
^~~~~~~~~~~~

<...>

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +5 -0
+static int
+ipn3ke_retimer_conf_link(struct rte_rawdev *rawdev,
+				uint16_t port,
+				uint8_t force_speed,
+				bool is_up)

drivers/net/ipn3ke/ipn3ke_representor.c line 366

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +10 -0
+{
+	struct ifpga_rawdevg_link_info linfo;
+
+	linfo.port = port;
+	linfo.link_up = is_up;
+	linfo.link_speed = force_speed;
+
+	return rawdev->dev_ops->attr_set(rawdev,
+					"retimer_linkstatus",
+					(uint64_t)&linfo);

You are saving the pointer of a local variable converting it to uint64_t.

Can you please elaborate why link info needs to saved as attribute? And when it is retrieved back will the memory be still valid?

Quoted 50 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +50 -0
+}
+
+static void
+ipn3ke_update_link(struct rte_rawdev *rawdev,
+			uint16_t port,
+			struct rte_eth_link *link)
+{
+	struct ifpga_rawdevg_link_info linfo;
+
+	rawdev->dev_ops->attr_get(rawdev,
+				"retimer_linkstatus",
+				(uint64_t *)&linfo);
+	/* Parse the link status */
+	link->link_status = linfo.link_up;
+	switch (linfo.link_speed) {
+	case IFPGA_RAWDEV_LINK_SPEED_10GB:
+		link->link_speed = ETH_SPEED_NUM_10G;
+		break;
+	case IFPGA_RAWDEV_LINK_SPEED_25GB:
+		link->link_speed = ETH_SPEED_NUM_25G;
+		break;
+	default:
+		IPN3KE_AFU_PMD_LOG(ERR, "Unknown link speed info %u",
+			linfo.link_speed);
+		break;
+	}
+}
+
+/*
+ * Set device link up.
+ */
+int
+ipn3ke_rpst_dev_set_link_up(struct rte_eth_dev *dev)
+{
+	uint8_t link_speed = IFPGA_RAWDEV_LINK_SPEED_UNKNOWN;
+	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
+	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(dev);
+	struct rte_rawdev *rawdev;
+	struct rte_eth_conf *conf = &dev->data->dev_conf;
+
+	rawdev = hw->rawdev;
+	if (conf->link_speeds == ETH_LINK_SPEED_AUTONEG) {
+		conf->link_speeds = ETH_LINK_SPEED_25G |
+				ETH_LINK_SPEED_10G;
+	}
+
+	if (conf->link_speeds & ETH_LINK_SPEED_10G)
+		link_speed = IFPGA_RAWDEV_LINK_SPEED_25GB;
+	else if (conf->link_speeds & ETH_LINK_SPEED_25G)
+		link_speed = IFPGA_RAWDEV_LINK_SPEED_10GB;

drivers/net/ipn3ke/ipn3ke_representor.c line 426

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +10 -0
+	else
+		link_speed = IFPGA_RAWDEV_LINK_SPEED_UNKNOWN;
+
+	if (rpst->i40e_pf_eth)
+		rte_eth_dev_set_link_up(rpst->i40e_pf_eth_port_id);
+
+	return ipn3ke_retimer_conf_link(rawdev,
+					rpst->port_id,
+					link_speed,
+					true);

Just a reminder that this is not doing anything useful, although it looks like . 'ipn3ke_retimer_conf_link()' calls 'rawdev->dev_ops->attr_set()' which doesn't do anything functional.
<...>

Quoted 34 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +34 -0
+struct eth_dev_ops ipn3ke_rpst_dev_ops = {
+	.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,
+	.allmulticast_enable  = ipn3ke_rpst_allmulticast_enable,
+	.allmulticast_disable = ipn3ke_rpst_allmulticast_disable,

drivers/net/ipn3ke/ipn3ke_representor.c line 804

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +10 -0
+	.mac_addr_set         = ipn3ke_rpst_mac_addr_set,
+	/*.get_reg              = ipn3ke_get_regs,*/
+	.mtu_set              = ipn3ke_rpst_mtu_set,
+
+	/**
+	 * .rxq_info_get         = ipn3ke_rxq_info_get,
+	 * .txq_info_get         = ipn3ke_txq_info_get,
+	 * .fw_version_get       = ,
+	 * .get_module_info      = ipn3ke_get_module_info,
+	 */

Please remove commented code.

drivers/net/ipn3ke/ipn3ke_representor.c line 807

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +3 -0
+
+	.tm_ops_get           = ipn3ke_tm_ops_get,
+};

Is this understanding correct:
These dev_ops are for representor ports and to control the ethernet ports via FPGA interface.
If so can the ports be configured via regular device drivers? Is there possible conflict between two controls and is there any syncronization required?

<...>

Quoted 37 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +37 -0
+static int
+ipn3ke_tm_hierarchy_commit_check(struct rte_eth_dev *dev,
+						struct rte_tm_error *error)
+{
+	struct ipn3ke_tm_internals *tm = IPN3KE_DEV_PRIVATE_TO_TM(dev);
+	uint32_t tm_id;
+	struct ipn3ke_tm_node_list *nl;
+	struct ipn3ke_tm_node *n, *parent_node;
+	enum ipn3ke_tm_node_state node_state;
+
+	tm_id = tm->tm_id;
+
+	nl = &tm->h.cos_commit_node_list;
+	TAILQ_FOREACH(n, nl, node) {
+		node_state = n->node_state;
+		parent_node = n->parent_node;
+		if (n->node_state == IPN3KE_TM_NODE_STATE_CONFIGURED_ADD) {
+			if ((n->parent_node_id == RTE_TM_NODE_ID_NULL) ||
+				(n->level != IPN3KE_TM_NODE_LEVEL_COS) ||
+				(n->tm_id != tm_id) ||
+				(parent_node == NULL) ||
+				(parent_node &&
+					(parent_node->node_state ==
+					IPN3KE_TM_NODE_STATE_CONFIGURED_DEL)) ||
+				(parent_node &&
+					(parent_node->node_state ==
+						IPN3KE_TM_NODE_STATE_IDLE)) ||
+				(n->shaper_profile.valid == 0))
+				return -rte_tm_error_set(error,
+						EINVAL,
+						RTE_TM_ERROR_TYPE_UNSPECIFIED,
+						NULL,
+						rte_strerror(EINVAL));
+		} else if (n->node_state == IPN3KE_TM_NODE_STATE_CONFIGURED_DEL)
+			if ((n->level != IPN3KE_TM_NODE_LEVEL_COS) ||
+				(n->n_children != 0))
+				return -rte_tm_error_set(error,

drivers/net/ipn3ke/ipn3ke_tm.c line 1556

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +10 -0
+						EINVAL,
+						RTE_TM_ERROR_TYPE_UNSPECIFIED,
+						NULL,
+						rte_strerror(EINVAL));
+		else
+			return -rte_tm_error_set(error,
+						EINVAL,
+						RTE_TM_ERROR_TYPE_UNSPECIFIED,
+						NULL,
+						rte_strerror(EINVAL));

It is easy to confuse last 'else', also I belive its indentation is wrong, so it may be already confused, can you please use braces to clarify, related clang warning:

../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1551:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]

                else
                ^
Quoted 27 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +27 -0
+	}
+
+	nl = &tm->h.vt_commit_node_list;
+	TAILQ_FOREACH(n, nl, node) {
+		node_state = n->node_state;
+		parent_node = n->parent_node;
+		if (n->node_state == IPN3KE_TM_NODE_STATE_CONFIGURED_ADD) {
+			if ((n->parent_node_id == RTE_TM_NODE_ID_NULL) ||
+				(n->level != IPN3KE_TM_NODE_LEVEL_VT) ||
+				(n->tm_id != tm_id) ||
+				(parent_node == NULL) ||
+				(parent_node &&
+					(parent_node->node_state ==
+					IPN3KE_TM_NODE_STATE_CONFIGURED_DEL)) ||
+				(parent_node &&
+					(parent_node->node_state ==
+						IPN3KE_TM_NODE_STATE_IDLE)) ||
+				(n->shaper_profile.valid == 0))
+				return -rte_tm_error_set(error,
+						EINVAL,
+						RTE_TM_ERROR_TYPE_UNSPECIFIED,
+						NULL,
+						rte_strerror(EINVAL));
+		} else if (n->node_state == IPN3KE_TM_NODE_STATE_CONFIGURED_DEL)
+			if ((n->level != IPN3KE_TM_NODE_LEVEL_VT) ||
+				(n->n_children != 0))
+				return -rte_tm_error_set(error,

drivers/net/ipn3ke/ipn3ke_tm.c line 1593

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +10 -0
+						EINVAL,
+						RTE_TM_ERROR_TYPE_UNSPECIFIED,
+						NULL,
+						rte_strerror(EINVAL));
+		else
+			return -rte_tm_error_set(error,
+						EINVAL,
+						RTE_TM_ERROR_TYPE_UNSPECIFIED,
+						NULL,
+						rte_strerror(EINVAL));

Same as above for this 'else', clang warning:

.../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1588:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]

                else
                ^

<...>

Quoted 24 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +24 -0
+static int
+ipn3ke_tm_hierarchy_hw_commit(struct rte_eth_dev *dev,
+					struct rte_tm_error *error)
+{
+	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
+	struct ipn3ke_tm_internals *tm = IPN3KE_DEV_PRIVATE_TO_TM(dev);
+	struct ipn3ke_tm_node_list *nl;
+	struct ipn3ke_tm_node *n, *nn, *parent_node;
+
+	n = tm->h.port_commit_node;
+	if (n) {
+		if (n->node_state == IPN3KE_TM_NODE_STATE_CONFIGURED_ADD) {
+			tm->h.port_commit_node = NULL;
+
+			n->node_state = IPN3KE_TM_NODE_STATE_COMMITTED;
+		} else if (n->node_state ==
+					IPN3KE_TM_NODE_STATE_CONFIGURED_DEL) {
+			tm->h.port_commit_node = NULL;
+
+			n->node_state = IPN3KE_TM_NODE_STATE_IDLE;
+			n->priority = IPN3KE_TM_NODE_PRIORITY_NORMAL0;
+			n->weight = 0;
+			n->tm_id = RTE_TM_NODE_ID_NULL;
+		} else

drivers/net/ipn3ke/ipn3ke_tm.c line 1811

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +10 -0
+			return -rte_tm_error_set(error,
+						EINVAL,
+						RTE_TM_ERROR_TYPE_UNSPECIFIED,
+						NULL,
+						rte_strerror(EINVAL));
+		ipn3ke_hw_tm_node_wr(hw, n);
+	}
+
+	nl = &tm->h.vt_commit_node_list;
+	for (n = TAILQ_FIRST(nl); n; nn) {

what is the point of last 'nn'? clang warning:

.../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1811:31: warning: expression result unused [-Wunused-value]

        for (n = TAILQ_FIRST(nl); n; nn) {
                                     ^~

there are multiple similar usage, am I missing something, if not can you please clean them:
.../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1841:31: warning: expression result unused [-Wunused-value] .../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1897:31: warning: expression result unused [-Wunused-value] .../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1914:31: warning: expression result unused [-Wunused-value]
<...>

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +5 -0
+static void
+ipn3ke_tm_show(struct rte_eth_dev *dev)
+{
+	struct ipn3ke_tm_internals *tm = IPN3KE_DEV_PRIVATE_TO_TM(dev);
+	uint32_t tm_id;

drivers/net/ipn3ke/ipn3ke_tm.c line 1946

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +10 -0
+	struct ipn3ke_tm_node_list *vt_nl, *cos_nl;
+	struct ipn3ke_tm_node *port_n, *vt_n, *cos_n;
+	char *str_state[IPN3KE_TM_NODE_STATE_MAX] = {"Idle",
+						"CfgAdd",
+						"CfgDel",
+						"Committed"};
+
+	tm_id = tm->tm_id;
+
+	printf("*************HQoS Tree(%d)*************\n", tm_id);

Please don't use 'printf' in drivers and libs, instead prefer logging functions.

<...>

drivers/net/ipn3ke/ipn3ke_tm.h line 14

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_tm.h new file +3 -0
+/* TM Levels */
+enum ipn3ke_tm_node_level {
+	IPN3KE_TM_NODE_LEVEL_PORT = 0,

No need to provide initial '0' value to an enum, that is the default value.

<...>

drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map line 1

Quoted 2 lines
drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +1 -0
@@ -0,0 +1,4 @@
+DPDK_2.0 {

Please fix tag with correct DPDK version.

Quoted 4 lines
drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +3 -0
+
+	local: *;
+};
author
#17 lore raw

Re: [PATCH v1 05/11] drivers/net/ipn3ke: add IPN3KE PMD driver

Hi,

Quoted 26 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 06, 2019 20:44
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]>
Subject: Re: [PATCH v1 05/11] drivers/net/ipn3ke: add IPN3KE PMD driver

Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE PMD driver.

Quoted 10 lines
---
 drivers/net/Makefile                          |    1 +
 drivers/net/ipn3ke/Makefile                   |   33 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c            |  814 +++++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |  742 +++++++++
 drivers/net/ipn3ke/ipn3ke_flow.c              | 1407 ++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h              |  104 ++
 drivers/net/ipn3ke/ipn3ke_logs.h              |   30 +
 drivers/net/ipn3ke/ipn3ke_representor.c       |  890 ++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c                | 2217
Quoted 7 lines

+++++++++++++++++++++++++

Quoted 3 lines
 drivers/net/ipn3ke/ipn3ke_tm.h                |  135 ++
 drivers/net/ipn3ke/meson.build                |    9 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map |    4 +

Can you please split this patch into multiple patch, at least I think ethdev, flow support and tm support can be seperated.

Good suggestion. I will apply it in patch v2.

Quoted 9 lines

<...>

drivers/net/Makefile DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k · line 35

Quoted 5 lines
drivers/net/Makefile +1 -0
@@ -32,6 +32,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
+DIRS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke

Can you please add alphatecally sorted, you are almost there, but not quite J

Okay.

Quoted 18 lines

<...>

drivers/net/ipn3ke/Makefile line 11

Quoted 12 lines
drivers/net/ipn3ke/Makefile new file +11 -0
@@ -0,0 +1,33 @@
+# 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
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API

Can you please add the experimenatal APIs called from this PMD as comments here, that can help a lot to trace when to remove the flag, or it is really required?

Okay.

Quoted 10 lines

Review line 18

Quoted 7 lines
(quoted diff) +7 -0
+CFLAGS += -O3
+#CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga CFLAGS +=
+-I$(RTE_SDK)/drivers/raw/ifpga_rawdev
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS +=
+-lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_bus_pci LDLIBS +=
+-lrte_bus_vdev

Can you please double check if you really have a dependency to both pci and vdev?

No dependency to pci, but we need vdev to take some configuration.

Quoted 1 line

And don't you need bus_ifpga ?

It need, I will apply it in patch v2.

Quoted 4 lines
Quoted 4 lines
drivers/net/ipn3ke/Makefile new file +4 -0
+
+EXPORT_MAP := rte_pmd_ipn3ke_version.map
+
+LIBABIVER := 1
Quoted 8 lines

drivers/net/ipn3ke/Makefile line 28

Quoted 5 lines
drivers/net/ipn3ke/Makefile new file +5 -0
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-y += ipn3ke_ethdev.c

They are same thing, but for consistency can you please use:
SRC-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke_ethdev.c

Okay, I will apply it in patch v2.

Quoted 12 lines

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 38

Quoted 8 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +8 -0
+static const struct rte_afu_uuid afu_uuid_ipn3ke_map[] = {
+	{ MAP_UUID_10G_LOW,  MAP_UUID_10G_HIGH },
+	{ IPN3KE_UUID_10G_LOW, IPN3KE_UUID_10G_HIGH },
+	{ IPN3KE_UUID_25G_LOW, IPN3KE_UUID_25G_HIGH },
+	{ 0, 0 /* sentinel */ },
+};
+
+struct ipn3ke_hw_cap hw_cap;

Do you need this forward decleration? "ipn3ke_ethdev.h" is already included.

hw_cap is only used in ipn3ke_ethdev.c, so I will remove the definition in ipn3ke_ethdev.h

Quoted 10 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 45

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

According our coding convention, it should be like:

Quoted 7 lines

static int
ipn3ke_indirect_read(struct ipn3ke_hw *hw,

	uint32_t *rd_data, uint32_t addr, uint32_t mac_num,
	uint32_t dev_sel, uint32_t eth_wrapper_sel)

Since this is a new file, why now follow the project coding convention?
https://doc.dpdk.org/guides/contributing/coding_style.html

Okay, absolutely follow coding convention.

Quoted 24 lines

<...>

Quoted 21 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +21 -0
+static int
+ipn3ke_hw_init_vbng(struct rte_afu_device *afu_dev,
+	struct ipn3ke_hw *hw)
+{
+	struct rte_rawdev *rawdev;
+	int ret;
+	int i;
+	uint32_t val;
+
+	rawdev  = afu_dev->rawdev;
+
+	hw->afu_id.uuid.uuid_low = afu_dev->id.uuid.uuid_low;
+	hw->afu_id.uuid.uuid_high = afu_dev->id.uuid.uuid_high;
+	hw->afu_id.port = afu_dev->id.port;
+	hw->hw_addr = (uint8_t *)(afu_dev->mem_resource[0].addr);
+	if ((afu_dev->id.uuid.uuid_low == MAP_UUID_10G_LOW) &&
+		(afu_dev->id.uuid.uuid_high == MAP_UUID_10G_HIGH)) {
+		hw->f_mac_read = map_indirect_mac_read;
+		hw->f_mac_write = map_indirect_mac_write;
+	} else {
+		hw->f_mac_read = ipn3ke_indirect_mac_read;
Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 289

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +6 -0
+		hw->f_mac_write = ipn3ke_indirect_mac_write;
+	}
+	hw->rawdev = rawdev;
+	rawdev->dev_ops->attr_get(rawdev,
+				"retimer_info",
+				(uint64_t *)&hw->retimer);

What do you think casting to "uintptr_t" instead of "uint64_t *" ?

To fix compile warning and follow the definition of attr_get:
typedef int (*rawdev_get_attr_t)(struct rte_rawdev *dev,

				 const char *attr_name,
				 uint64_t *attr_value);
Quoted 6 lines

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +3 -0
+	ret = rte_eth_switch_domain_alloc(&hw->switch_domain_id);
+	if (ret)
+		IPN3KE_AFU_PMD_WARN("failed to allocate switch domain

for device %d",

Quoted 6 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 443

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +3 -0
+		ret);
+
+	ret = ipn3ke_hw_tm_init(hw);

function is defined in another .c file, need to declared for the usage, otherwise causing build warning:

Okay, I will fix it in patch v2.

Quoted 6 lines

.../drivers/net/ipn3ke/ipn3ke_ethdev.c: In function ‘ipn3ke_hw_init_vbng’:
.../drivers/net/ipn3ke/ipn3ke_ethdev.c:443:8: warning: implicit declaration of function ‘ipn3ke_hw_tm_init’; did you mean ‘ipn3ke_hw_cap_init’? [-Wimplicit-function-declaration]

  ret = ipn3ke_hw_tm_init(hw);
        ^~~~~~~~~~~~~~~~~

I will fix it in patch v2.

Quoted 12 lines

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 506

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

Can combine both:
RTE_INIT(ipn3ke_afu_init_log)
{

Quoted 1 line

Just for consistency, can you move this function to the buttom of the file?

Okay, I will fix it in patch v2.

Quoted 7 lines

Review

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

"pmd.net.ipn3ke"

<...>

Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 532

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +5 -0
+		if (!hw) {
+			IPN3KE_AFU_PMD_LOG(ERR,
+				"failed to allocate hardwart data");
+				retval = -ENOMEM;
+				return -ENOMEM;

There is already 'IPN3KE_AFU_PMD_ERR' and variant macros defined if you prefer to use.

I will replace it with 'IPN3KE_AFU_PMD_ERR'.

Quoted 7 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 536

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +4 -0
+		}
+		afu_dev->shared.data = hw;
+
+		rte_spinlock_init(&afu_dev->shared.lock);

Getting following warning with clang [1], worth chekcing, is 'struct rte_afu_device' really needs to be packed?

I will fix clang compile warning in patch v2.

Quoted 6 lines

[1]
.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c:536:22: warning: taking address of packed member 'shared' of class or structure 'rte_afu_device' may result in an unaligned pointer value [-Waddress-of-pack ed-member]

                rte_spinlock_init(&afu_dev->shared.lock);
                                   ^~~~~~~~~~~~~~~~~~~~

I will fix it in patchv2.

Quoted 11 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 544

Quoted 8 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +8 -0
+	} else
+		hw = (struct ipn3ke_hw *)afu_dev->shared.data;
+
+#if IPN3KE_HW_BASE_ENABLE
+	retval = ipn3ke_hw_init_base(afu_dev, hw);
+	if (retval)
+		return retval;
+#endif

Is this macro defined anywhere? It looks like not, so is it used like "#if 0", if so removed the macro and the wrapped code please.

This macro is just for debug with old FPGA bitstream, with newest bitstream we don't need it. So I will remove it in patch v2.

Quoted 23 lines
Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +10 -0
+
+	retval = ipn3ke_hw_init_vbng(afu_dev, hw);
+	if (retval)
+		return retval;
+
+	/* 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,

drivers/net/ipn3ke/ipn3ke_ethdev.c line 564

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +10 -0
+			.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);

Similar allignment warning as above:

Quoted 5 lines

.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c:562:32: warning: taking address of packed member 'device' of class or structure 'rte_afu_device' may result in an unaligned pointer value [-Waddress-of-pac$ ed-member]

                retval = rte_eth_dev_create(&afu_dev->device, name,
                                             ^~~~~~~~~~~~~~~

I will fix it in patch v2.

Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +3 -0
+
+		if (retval)
+			IPN3KE_AFU_PMD_LOG(ERR, "failed to create

ipn3ke "

drivers/net/ipn3ke/ipn3ke_ethdev.c line 568

Quoted 1 line
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +1 -0
+				"representor %s.", name);

No need to split the message.

Okay.

Quoted 10 lines

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +4 -0
+	ret = rte_eth_switch_domain_free(hw->switch_domain_id);
+	if (ret)
+		IPN3KE_AFU_PMD_LOG(WARNING,
+							"failed to free switch

domain: %d",

Review

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

Please fix the indentation.

Okay.

Quoted 5 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 604

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +3 -0
+
+	/* flow uninit*/> +
+	ipn3ke_hw_uninit(hw);

Is the comment for "hw_uninit" ?

Yes, I will fix it in patch v2, thanks.

Quoted 6 lines
Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +6 -0
+
+	return 0;
+}
+
+static struct rte_afu_driver afu_ipn3ke_driver = {
+	.id_table = afu_uuid_ipn3ke_map,
Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 615

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +5 -0
+	.probe = ipn3ke_vswitch_probe,
+	.remove = ipn3ke_vswitch_remove,
+};
+
+RTE_PMD_REGISTER_AFU(net_ipn3ke_afu, afu_ipn3ke_driver);

So this file is has two drivers, one vdev driver and one afu driver. Is vdev one only to get the device arguments? If so why not get device

Yes

Quoted 1 line

arguments directly to afu driver and remove the vdev device/driver?

Some special arguments for IPN3KE need to use the vdev to take configuration. So we can't merge the new configuration vdev to afu afu driver.

Quoted 2 lines

And since this is an AFU driver, should we have a drivers/ifpga/* folder and put these drivers in it? What do you think?

From function point of view, it's a NIC driver, so we put it in net drivers folder.

Quoted 3 lines
Quoted 1 line

+RTE_PMD_REGISTER_AFU_ALIAS(net_ipn3ke_afu, afu_dev);

Isn't 'afu_dev' so genereic for being alias?

No, I will remove it in patch v2. Thanks.

Quoted 2 lines

Also are you taking 'alias' field into account? I checked the ifpga bus code but not able to find, can you please double check? Did you test this alias?

This alias is no useful, I will remove it in patch v2. Thanks.

Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 624

Quoted 8 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +8 -0
+RTE_PMD_REGISTER_PARAM_STRING(net_ipn3ke_afu,
+	"bdf=<string> "
+	"port=<int> "
+	"uudi_high=<int64> "
+	"uuid_low=<int64> "
+	"path=<string> "
+	"pr_enable=<int>"
+	"debug=<int>");

No useful, I will remove it in patch v2. Thanks.

Quoted 2 lines

Are these the net driver device arguments? Where they are defined/parsed/used?

No useful, I will remove it in patch v2. Thanks.

Quoted 7 lines
Quoted 7 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +7 -0
+
+static const char * const valid_args[] = {
+#define IPN3KE_AFU_NAME         "afu"
+		IPN3KE_AFU_NAME,
+#define IPN3KE_FPGA_ACCELERATION_LIST     "fpga_acc"
+		IPN3KE_FPGA_ACCELERATION_LIST,
+#define IPN3KE_I40E_PF_LIST     "i40e_pf"
Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +6 -0
+		IPN3KE_I40E_PF_LIST,
+		NULL
+};
+static int
+ipn3ke_cfg_parse_acc_list(const char *afu_name, const char
+*acc_list_name)

Please fix the indentation.

Okay.

Quoted 32 lines

<...>

Review

Quoted 1 line
(quoted diff) +1 -0
+	if (rte_kvargs_count(kvlist, IPN3KE_FPGA_ACCELERATION_LIST) == 1)

{

Review

Quoted 1 line
(quoted diff) +1 -0
+		if (rte_kvargs_process(kvlist,

IPN3KE_FPGA_ACCELERATION_LIST,

drivers/net/ipn3ke/ipn3ke_ethdev.c

Quoted 11 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +11 -0
+				       &rte_ifpga_get_string_arg,
+				       &acc_name) < 0) {
+			IPN3KE_AFU_PMD_ERR("error to parse %s",
+				     IPN3KE_FPGA_ACCELERATION_LIST);
+			goto end;
+		}
+		ret = ipn3ke_cfg_parse_acc_list(afu_name, acc_name);
+		if (ret)
+			goto end;
+	} else {
+		IPN3KE_AFU_PMD_INFO("arg %s is optional for ipn3ke, using

i40e acc",

drivers/net/ipn3ke/ipn3ke_ethdev.c

Quoted 12 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +12 -0
+			  IPN3KE_FPGA_ACCELERATION_LIST);
+	}
+
+	if (rte_kvargs_count(kvlist, IPN3KE_I40E_PF_LIST) == 1) {
+		if (rte_kvargs_process(kvlist, IPN3KE_I40E_PF_LIST,
+				       &rte_ifpga_get_string_arg,
+				       &pf_name) < 0) {
+			IPN3KE_AFU_PMD_ERR("error to parse %s",
+				     IPN3KE_I40E_PF_LIST);
+			goto end;
+		}
+		ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name,

pf_name);

Quoted 2 lines

You shouldn't rely on to the order of the devargs, what if 'afu_name' is not provided yet when 'pf_name' arg is provided?

Yes, I will fix order dependency in patch v2. But afu_name and pf_name are mandatory.

Quoted 2 lines

Same concern for above 'ipn3ke_cfg_parse_acc_list()'. It is better to get all the args first, later call the proper APIs.

Good suggestion, I will apply it in patch v2.

Quoted 10 lines

<...>

drivers/net/ipn3ke/ipn3ke_ethdev.c line 800

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +6 -0
+static int
+ipn3ke_cfg_remove(struct rte_vdev_device *vdev) {
+	IPN3KE_AFU_PMD_INFO("Remove ipn3ke_cfg %p",
+		vdev);
+
+	return 0;

Nothing to be done for remove?

I miss unbinding I40e and FPGA port mapping. I will fix it in patch v2.

Quoted 7 lines
Quoted 7 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +7 -0
+}
+
+static struct rte_vdev_driver ipn3ke_cfg_driver = {
+	.probe = ipn3ke_cfg_probe,
+	.remove = ipn3ke_cfg_remove,
+};
+
Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_ethdev.c line 813

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_ethdev.c new file +6 -0
+RTE_PMD_REGISTER_VDEV(ipn3ke_cfg, ipn3ke_cfg_driver);
+RTE_PMD_REGISTER_ALIAS(ipn3ke_cfg, ipn3ke_cfg);
+RTE_PMD_REGISTER_PARAM_STRING(ipn3ke_cfg,
+	"afu=<string> "
+	"fpga_acc=<string>"
+	"i40e=<string>");

Isn't this "i40e_pf", using defined macros can prevent mistakes.

Okay, I will fix it in patch v2.

Quoted 19 lines

<...>

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

drivers/net/ipn3ke/ipn3ke_ethdev.h line 220

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_ethdev.h new file +10 -0
+	uint64_t read_data = 0;
+	uint64_t indirect_value = 0;
+	volatile void *indirect_addrs = 0;
+
+	word_offset = (addr & 0x1FFFFFF) >> 2;
+	indirect_value = RCMD | word_offset << 32;
+	indirect_addrs = (volatile void *)(hw->hw_addr +
+						(uint32_t)(UPL_BASE | 0x10));
+
+	usleep(10);

Required head for usleep seems not included, causing build warning:

Quoted 6 lines

In file included from .../drivers/net/ipn3ke/ipn3ke_representor.c:27:
.../drivers/net/ipn3ke/ipn3ke_ethdev.h: In function ‘_ipn3ke_indrct_read’:
.../drivers/net/ipn3ke/ipn3ke_ethdev.h:220:2: warning: implicit declaration of function ‘usleep’; did you mean ‘fseek’? [-Wimplicit-function-declaration]
usleep(10);
^~~~~~

I will fix it in patch v2.

Quoted 1 line

Same warning for all occurances.

Apply in patch v2.

Quoted 17 lines

<...>

drivers/net/ipn3ke/ipn3ke_flow.c line 1011

Quoted 8 lines
drivers/net/ipn3ke/ipn3ke_flow.c new file +8 -0
+static int
+ipn3ke_flow_hw_update(struct ipn3ke_hw *hw,
+			struct rte_flow *flow, uint32_t is_add) {
+	uint32_t *pdata = NULL;
+	uint32_t data;
+	uint32_t time_out = MHL_COMMAND_TIME_COUNT;
+
+#ifdef DEBUG_IPN3KE_FLOW

In many places in this patchset, there are define which are not part of PMD configuration. So most probably need to enable/disable them manually in the code. This approach is very open the errors. The code in the ifdef block is escaped from all compilers, when someone needs it, it is common that they even don't compile and work.

Quoted 1 line

I suggest removing them all.

Okay, apply in patch v2.

Quoted 1 line

If a define is really necessary add it as PMD config option.

Okay.

Quoted 67 lines
Quoted 56 lines
drivers/net/ipn3ke/ipn3ke_flow.c new file +56 -0
+	uint32_t i;
+
+	printf("IPN3KE flow dump\n");
+
+	pdata = (uint32_t *)flow->rule.key;
+	printf(" - key   :");
+
+	for (i = 0; i < RTE_DIM(flow->rule.key); i++)
+		printf(" %02x", flow->rule.key[i]);
+
+	for (i = 0; i < 4; i++)
+		printf(" %02x", __SWAP32(pdata[3 - i]));
+	printf("\n");
+
+	pdata = (uint32_t *)flow->rule.result;
+	printf(" - result:");
+
+	for (i = 0; i < RTE_DIM(flow->rule.result); i++)
+		printf(" %02x", flow->rule.result[i]);
+
+	for (i = 0; i < 1; i++)
+		printf(" %02x", pdata[i]);
+	printf("\n");
+#endif
+
+	pdata = (uint32_t *)flow->rule.key;
+
+	IPN3KE_MASK_WRITE_REG(hw,
+			IPN3KE_CLF_MHL_KEY_0,
+			0,
+			__SWAP32(pdata[3]),
+			IPN3KE_CLF_MHL_KEY_MASK);
+
+	IPN3KE_MASK_WRITE_REG(hw,
+			IPN3KE_CLF_MHL_KEY_1,
+			0,
+			__SWAP32(pdata[2]),
+			IPN3KE_CLF_MHL_KEY_MASK);
+
+	IPN3KE_MASK_WRITE_REG(hw,
+			IPN3KE_CLF_MHL_KEY_2,
+			0,
+			__SWAP32(pdata[1]),
+			IPN3KE_CLF_MHL_KEY_MASK);
+
+	IPN3KE_MASK_WRITE_REG(hw,
+			IPN3KE_CLF_MHL_KEY_3,
+			0,
+			__SWAP32(pdata[0]),
+			IPN3KE_CLF_MHL_KEY_MASK);
+
+	pdata = (uint32_t *)flow->rule.result;
+	IPN3KE_MASK_WRITE_REG(hw,
+			IPN3KE_CLF_MHL_RES,
+			0,
+			__SWAP32(pdata[0]),

drivers/net/ipn3ke/ipn3ke_flow.c

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_flow.c new file +10 -0
+			IPN3KE_CLF_MHL_RES_MASK);
+
+	/* insert/delete the key and result */
+	data = 0;
+	data = IPN3KE_MASK_READ_REG(hw,
+				IPN3KE_CLF_MHL_MGMT_CTRL,
+				0,
+				0x80000000);
+	time_out = MHL_COMMAND_TIME_COUNT;
+	while (IPN3KE_BIT_ISSET(data,

IPN3KE_CLF_MHL_MGMT_CTRL_BIT_BUSY) &&

Quoted 11 lines

drivers/net/ipn3ke/ipn3ke_flow.c line 1084

Quoted 7 lines
drivers/net/ipn3ke/ipn3ke_flow.c new file +7 -0
+		(time_out > 0)) {
+		data = IPN3KE_MASK_READ_REG(hw,
+					IPN3KE_CLF_MHL_MGMT_CTRL,
+					0,
+					0x80000000);
+		time_out--;
+		rte_delay_us(MHL_COMMAND_TIME_INTERVAL_US);

This is giving missing decleration warning for cross compile [1], most probably a heder is missing.

I will apply it in patch v2.

Quoted 6 lines

[1]
.../drivers/net/ipn3ke/ipn3ke_flow.c:1084:3: warning: implicit declaration of function ‘rte_delay_us’; did you mean ‘rte_realloc’? [-Wimplicit-function-declaration]

   rte_delay_us(MHL_COMMAND_TIME_INTERVAL_US);
   ^~~~~~~~~~~~

Fix in patch v2.

Quoted 20 lines

<...>

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +5 -0
+static int
+ipn3ke_retimer_conf_link(struct rte_rawdev *rawdev,
+				uint16_t port,
+				uint8_t force_speed,
+				bool is_up)

drivers/net/ipn3ke/ipn3ke_representor.c line 366

Quoted 10 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +10 -0
+{
+	struct ifpga_rawdevg_link_info linfo;
+
+	linfo.port = port;
+	linfo.link_up = is_up;
+	linfo.link_speed = force_speed;
+
+	return rawdev->dev_ops->attr_set(rawdev,
+					"retimer_linkstatus",
+					(uint64_t)&linfo);

You are saving the pointer of a local variable converting it to uint64_t.

Quoted 2 lines

Can you please elaborate why link info needs to saved as attribute? And when it is retrieved back will the memory be still valid?

I agree with you, it's not suitable to save the pointer of a local variable converting it to uing64_t. This code is just for test, I will remove it. Thanks.

Quoted 57 lines
Quoted 57 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +56 -0
+}
+
+static void
+ipn3ke_update_link(struct rte_rawdev *rawdev,
+			uint16_t port,
+			struct rte_eth_link *link)
+{
+	struct ifpga_rawdevg_link_info linfo;
+
+	rawdev->dev_ops->attr_get(rawdev,
+				"retimer_linkstatus",
+				(uint64_t *)&linfo);
+	/* Parse the link status */
+	link->link_status = linfo.link_up;
+	switch (linfo.link_speed) {
+	case IFPGA_RAWDEV_LINK_SPEED_10GB:
+		link->link_speed = ETH_SPEED_NUM_10G;
+		break;
+	case IFPGA_RAWDEV_LINK_SPEED_25GB:
+		link->link_speed = ETH_SPEED_NUM_25G;
+		break;
+	default:
+		IPN3KE_AFU_PMD_LOG(ERR, "Unknown link speed info %u",
+			linfo.link_speed);
+		break;
+	}
+}
+
+/*
+ * Set device link up.
+ */
+int
+ipn3ke_rpst_dev_set_link_up(struct rte_eth_dev *dev) {
+	uint8_t link_speed = IFPGA_RAWDEV_LINK_SPEED_UNKNOWN;
+	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
+	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(dev);
+	struct rte_rawdev *rawdev;
+	struct rte_eth_conf *conf = &dev->data->dev_conf;
+
+	rawdev = hw->rawdev;
+	if (conf->link_speeds == ETH_LINK_SPEED_AUTONEG) {
+		conf->link_speeds = ETH_LINK_SPEED_25G |
+				ETH_LINK_SPEED_10G;
+	}
+
+	if (conf->link_speeds & ETH_LINK_SPEED_10G)
+		link_speed = IFPGA_RAWDEV_LINK_SPEED_25GB;
+	else if (conf->link_speeds & ETH_LINK_SPEED_25G)
+		link_speed = IFPGA_RAWDEV_LINK_SPEED_10GB;
+	else
+		link_speed = IFPGA_RAWDEV_LINK_SPEED_UNKNOWN;
+
+	if (rpst->i40e_pf_eth)
+		rte_eth_dev_set_link_up(rpst->i40e_pf_eth_port_id);
+
+	return ipn3ke_retimer_conf_link(rawdev,
Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_representor.c line 426

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +3 -0
+					rpst->port_id,
+					link_speed,
+					true);

Just a reminder that this is not doing anything useful, although it looks like . 'ipn3ke_retimer_conf_link()' calls 'rawdev->dev_ops->attr_set()' which doesn't do anything functional.
<...>

It's just for debug. I will remove it in patch v2. Thanks.

Quoted 38 lines
Quoted 38 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +38 -0
+struct eth_dev_ops ipn3ke_rpst_dev_ops = {
+	.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,
+	.allmulticast_enable  = ipn3ke_rpst_allmulticast_enable,
+	.allmulticast_disable = ipn3ke_rpst_allmulticast_disable,
+	.mac_addr_set         = ipn3ke_rpst_mac_addr_set,
+	/*.get_reg              = ipn3ke_get_regs,*/
+	.mtu_set              = ipn3ke_rpst_mtu_set,
+
Quoted 8 lines

drivers/net/ipn3ke/ipn3ke_representor.c line 804

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +6 -0
+	/**
+	 * .rxq_info_get         = ipn3ke_rxq_info_get,
+	 * .txq_info_get         = ipn3ke_txq_info_get,
+	 * .fw_version_get       = ,
+	 * .get_module_info      = ipn3ke_get_module_info,
+	 */

Please remove commented code.

Okay.

Quoted 7 lines

drivers/net/ipn3ke/ipn3ke_representor.c line 807

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_representor.c new file +3 -0
+
+	.tm_ops_get           = ipn3ke_tm_ops_get,
+};

Is this understanding correct:
These dev_ops are for representor ports and to control the ethernet ports via FPGA interface.

Yes

Quoted 2 lines

If so can the ports be configured via regular device drivers? Is there possible conflict between two controls and is there any syncronization required?

If argument 'fpga_acc ' of vdev enable, representor is just for FPGA port configuration. Otherwise, representor is just for I40e PF port configuration.

Quoted 57 lines

<...>

drivers/net/ipn3ke/ipn3ke_tm.c

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +5 -0
+static int
+ipn3ke_tm_hierarchy_commit_check(struct rte_eth_dev *dev,
+						struct rte_tm_error *error)
+{
+	struct ipn3ke_tm_internals *tm =

IPN3KE_DEV_PRIVATE_TO_TM(dev);

drivers/net/ipn3ke/ipn3ke_tm.c

Quoted 12 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +12 -0
+	uint32_t tm_id;
+	struct ipn3ke_tm_node_list *nl;
+	struct ipn3ke_tm_node *n, *parent_node;
+	enum ipn3ke_tm_node_state node_state;
+
+	tm_id = tm->tm_id;
+
+	nl = &tm->h.cos_commit_node_list;
+	TAILQ_FOREACH(n, nl, node) {
+		node_state = n->node_state;
+		parent_node = n->parent_node;
+		if (n->node_state ==

IPN3KE_TM_NODE_STATE_CONFIGURED_ADD) {

Review

Quoted 1 line
(quoted diff) +1 -0
+			if ((n->parent_node_id == RTE_TM_NODE_ID_NULL)

||

Review

Quoted 1 line
(quoted diff) +1 -0
+				(n->level != IPN3KE_TM_NODE_LEVEL_COS)
||
> +				(n->tm_id != tm_id) ||
> +				(parent_node == NULL) ||

drivers/net/ipn3ke/ipn3ke_tm.c line 1558

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +3 -0
+				(parent_node &&
+					(parent_node->node_state ==
+
	IPN3KE_TM_NODE_STATE_CONFIGURED_DEL)) ||

drivers/net/ipn3ke/ipn3ke_tm.c line 1558

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +3 -0
+				(parent_node &&
+					(parent_node->node_state ==
+
	IPN3KE_TM_NODE_STATE_IDLE)) ||

drivers/net/ipn3ke/ipn3ke_tm.c line 1558

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +4 -0
+				(n->shaper_profile.valid == 0))
+				return -rte_tm_error_set(error,
+						EINVAL,
+

RTE_TM_ERROR_TYPE_UNSPECIFIED,

drivers/net/ipn3ke/ipn3ke_tm.c line 1819

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +3 -0
+						NULL,
+						rte_strerror(EINVAL));
+		} else if (n->node_state ==

IPN3KE_TM_NODE_STATE_CONFIGURED_DEL)

drivers/net/ipn3ke/ipn3ke_tm.c line 1558

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +5 -0
+			if ((n->level != IPN3KE_TM_NODE_LEVEL_COS) ||
+				(n->n_children != 0))
+				return -rte_tm_error_set(error,
+						EINVAL,
+

RTE_TM_ERROR_TYPE_UNSPECIFIED,

drivers/net/ipn3ke/ipn3ke_tm.c line 1558

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +6 -0
+						NULL,
+						rte_strerror(EINVAL));
+		else
+			return -rte_tm_error_set(error,
+						EINVAL,
+

RTE_TM_ERROR_TYPE_UNSPECIFIED,

Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+						NULL,
+						rte_strerror(EINVAL));

It is easy to confuse last 'else', also I belive its indentation is wrong, so it may be already confused, can you please use braces to clarify, related clang warning:

Okay

Quoted 4 lines

../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1551:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]

                else
                ^

Okay

Quoted 49 lines

drivers/net/ipn3ke/ipn3ke_tm.c

Quoted 7 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +7 -0
+	}
+
+	nl = &tm->h.vt_commit_node_list;
+	TAILQ_FOREACH(n, nl, node) {
+		node_state = n->node_state;
+		parent_node = n->parent_node;
+		if (n->node_state ==

IPN3KE_TM_NODE_STATE_CONFIGURED_ADD) {

Review

Quoted 1 line
(quoted diff) +1 -0
+			if ((n->parent_node_id == RTE_TM_NODE_ID_NULL)

||

Review

Quoted 1 line
(quoted diff) +1 -0
+				(n->level != IPN3KE_TM_NODE_LEVEL_VT)
||
> +				(n->tm_id != tm_id) ||
> +				(parent_node == NULL) ||

drivers/net/ipn3ke/ipn3ke_tm.c line 1558

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +3 -0
+				(parent_node &&
+					(parent_node->node_state ==
+
	IPN3KE_TM_NODE_STATE_CONFIGURED_DEL)) ||

drivers/net/ipn3ke/ipn3ke_tm.c line 1558

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +3 -0
+				(parent_node &&
+					(parent_node->node_state ==
+
	IPN3KE_TM_NODE_STATE_IDLE)) ||

drivers/net/ipn3ke/ipn3ke_tm.c line 1558

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +4 -0
+				(n->shaper_profile.valid == 0))
+				return -rte_tm_error_set(error,
+						EINVAL,
+

RTE_TM_ERROR_TYPE_UNSPECIFIED,

drivers/net/ipn3ke/ipn3ke_tm.c line 1819

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +3 -0
+						NULL,
+						rte_strerror(EINVAL));
+		} else if (n->node_state ==

IPN3KE_TM_NODE_STATE_CONFIGURED_DEL)

drivers/net/ipn3ke/ipn3ke_tm.c line 1595

Quoted 5 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +5 -0
+			if ((n->level != IPN3KE_TM_NODE_LEVEL_VT) ||
+				(n->n_children != 0))
+				return -rte_tm_error_set(error,
+						EINVAL,
+

RTE_TM_ERROR_TYPE_UNSPECIFIED,

drivers/net/ipn3ke/ipn3ke_tm.c line 1558

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +6 -0
+						NULL,
+						rte_strerror(EINVAL));
+		else
+			return -rte_tm_error_set(error,
+						EINVAL,
+

RTE_TM_ERROR_TYPE_UNSPECIFIED,

Review

Quoted 2 lines
(quoted diff) +2 -0
+						NULL,
+						rte_strerror(EINVAL));

Same as above for this 'else', clang warning:

Quoted 4 lines

.../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1588:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]

                else
                ^

Apply in patch v2.

Quoted 36 lines

<...>

drivers/net/ipn3ke/ipn3ke_tm.c

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +6 -0
+static int
+ipn3ke_tm_hierarchy_hw_commit(struct rte_eth_dev *dev,
+					struct rte_tm_error *error)
+{
+	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
+	struct ipn3ke_tm_internals *tm =

IPN3KE_DEV_PRIVATE_TO_TM(dev);

drivers/net/ipn3ke/ipn3ke_tm.c

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +6 -0
+	struct ipn3ke_tm_node_list *nl;
+	struct ipn3ke_tm_node *n, *nn, *parent_node;
+
+	n = tm->h.port_commit_node;
+	if (n) {
+		if (n->node_state ==

IPN3KE_TM_NODE_STATE_CONFIGURED_ADD) {

drivers/net/ipn3ke/ipn3ke_tm.c

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +3 -0
+			tm->h.port_commit_node = NULL;
+
+			n->node_state =

IPN3KE_TM_NODE_STATE_COMMITTED;

Review

Quoted 2 lines
(quoted diff) +2 -0
+		} else if (n->node_state ==
+
	IPN3KE_TM_NODE_STATE_CONFIGURED_DEL) {

drivers/net/ipn3ke/ipn3ke_tm.c

Quoted 4 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +4 -0
+			tm->h.port_commit_node = NULL;
+
+			n->node_state = IPN3KE_TM_NODE_STATE_IDLE;
+			n->priority =

IPN3KE_TM_NODE_PRIORITY_NORMAL0;

drivers/net/ipn3ke/ipn3ke_tm.c line 1809

Quoted 6 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +6 -0
+			n->weight = 0;
+			n->tm_id = RTE_TM_NODE_ID_NULL;
+		} else
+			return -rte_tm_error_set(error,
+						EINVAL,
+

RTE_TM_ERROR_TYPE_UNSPECIFIED,

Quoted 9 lines

drivers/net/ipn3ke/ipn3ke_tm.c line 1811

Quoted 7 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +7 -0
+						NULL,
+						rte_strerror(EINVAL));
+		ipn3ke_hw_tm_node_wr(hw, n);
+	}
+
+	nl = &tm->h.vt_commit_node_list;
+	for (n = TAILQ_FIRST(nl); n; nn) {

what is the point of last 'nn'? clang warning:

Fix in patch v2.

Quoted 5 lines

.../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1811:31: warning: expression result unused [-Wunused-value]

        for (n = TAILQ_FIRST(nl); n; nn) {
                                     ^~
Quoted 8 lines

there are multiple similar usage, am I missing something, if not can you please clean them:
.../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1841:31: warning: expression result unused [-Wunused-value] .../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1897:31: warning: expression result unused [-Wunused-value] .../dpdk/drivers/net/ipn3ke/ipn3ke_tm.c:1914:31: warning: expression result unused [-Wunused-value] <...>

Okay, I will fix it in patch v2.

Quoted 4 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+static void
+ipn3ke_tm_show(struct rte_eth_dev *dev) {
+	struct ipn3ke_tm_internals *tm =

IPN3KE_DEV_PRIVATE_TO_TM(dev);

Quoted 13 lines

drivers/net/ipn3ke/ipn3ke_tm.c line 1946

Quoted 11 lines
drivers/net/ipn3ke/ipn3ke_tm.c new file +11 -0
+	uint32_t tm_id;
+	struct ipn3ke_tm_node_list *vt_nl, *cos_nl;
+	struct ipn3ke_tm_node *port_n, *vt_n, *cos_n;
+	char *str_state[IPN3KE_TM_NODE_STATE_MAX] = {"Idle",
+						"CfgAdd",
+						"CfgDel",
+						"Committed"};
+
+	tm_id = tm->tm_id;
+
+	printf("*************HQoS Tree(%d)*************\n", tm_id);

Please don't use 'printf' in drivers and libs, instead prefer logging functions.

Okay.

Quoted 7 lines

<...>

drivers/net/ipn3ke/ipn3ke_tm.h line 14

Quoted 3 lines
drivers/net/ipn3ke/ipn3ke_tm.h new file +3 -0
+/* TM Levels */
+enum ipn3ke_tm_node_level {
+	IPN3KE_TM_NODE_LEVEL_PORT = 0,

No need to provide initial '0' value to an enum, that is the default value.

Okay.

Quoted 6 lines

<...>

drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map line 1

Quoted 2 lines
drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +1 -0
@@ -0,0 +1,4 @@
+DPDK_2.0 {

Please fix tag with correct DPDK version.

Okay

Quoted 4 lines
Quoted 4 lines
drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map new file +3 -0
+
+	local: *;
+};
#18 lore raw

Re: [PATCH v1 05/11] drivers/net/ipn3ke: add IPN3KE PMD driver

In reply to Rosen Xu
Quoted 38 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE PMD driver.

---
 drivers/net/Makefile                          |    1 + drivers/net/ipn3ke/Makefile                   |   33 + drivers/net/ipn3ke/ipn3ke_ethdev.c            |  814 +++++++++ drivers/net/ipn3ke/ipn3ke_ethdev.h            |  742 +++++++++ drivers/net/ipn3ke/ipn3ke_flow.c              | 1407
++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h              |  104 ++ drivers/net/ipn3ke/ipn3ke_logs.h              |   30 + drivers/net/ipn3ke/ipn3ke_representor.c       |  890 ++++++++++ drivers/net/ipn3ke/ipn3ke_tm.c                | 2217
+++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.h                |  135 ++ drivers/net/ipn3ke/meson.build                |    9 + drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map |    4 +

 12 files changed, 6386 insertions(+)

 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_representor.c create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.h create mode 100644 drivers/net/ipn3ke/meson.build create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map

drivers/net/Makefile +0 -0
index 670d7f7..f66263c 100644
@@ -32,6 +32,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
Quoted 7 lines

 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
+DIRS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke
 DIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += liquidio
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5

You need to do the equivalent in drivers/net/meson.build

Signature · 2 lines
Kind regards,
Luca Boccassi
author
#19 lore raw

Re: [PATCH v1 05/11] drivers/net/ipn3ke: add IPN3KE PMD driver

Hi,

Quoted 46 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Sunday, March 10, 2019 3:34
To: Xu, Rosen <[email protected]>; [email protected]
Cc: 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]>
Subject: Re: [dpdk-dev] [PATCH v1 05/11] drivers/net/ipn3ke: add IPN3KE PMD driver

Quoted 33 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE PMD driver.

---
 drivers/net/Makefile                          |    1 + drivers/net/ipn3ke/Makefile                   |   33 + drivers/net/ipn3ke/ipn3ke_ethdev.c            |  814 +++++++++ drivers/net/ipn3ke/ipn3ke_ethdev.h            |  742 +++++++++ drivers/net/ipn3ke/ipn3ke_flow.c              | 1407
++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h              |  104 ++ drivers/net/ipn3ke/ipn3ke_logs.h              |   30 + drivers/net/ipn3ke/ipn3ke_representor.c       |  890 ++++++++++ drivers/net/ipn3ke/ipn3ke_tm.c                | 2217
+++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.h                |  135 ++ drivers/net/ipn3ke/meson.build                |    9 + drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map |    4 +

 12 files changed, 6386 insertions(+)

 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_representor.c create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.c create mode 100644 drivers/net/ipn3ke/ipn3ke_tm.h create mode 100644 drivers/net/ipn3ke/meson.build create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map

Quoted 14 lines
Quoted 5 lines
drivers/net/Makefile index renamed from drivers/net/Makefile +0 -0

670d7f7..f66263c 100644

drivers/net/Makefile +0 -0
@@ -32,6 +32,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
Quoted 7 lines

 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
+DIRS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += ipn3ke
 DIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += liquidio
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5

You need to do the equivalent in drivers/net/meson.build

Okay, thanks.

Quoted 3 lines

--
Kind regards,
Luca Boccassi

author
#20 lore raw

PATCH 6/11 config: add build enablement for IPN3KE

In reply to Rosen Xu

Add build enablement for Intel FPGA Acceleration
NIC IPN3KE.

---
 config/common_base | 6 ++++++
 1 file changed, 6 insertions(+)
config/common_base +6 -0
index 7c6da51..4fac8ba 100644
@@ -316,6 +316,12 @@ CONFIG_RTE_LIBRTE_AVF_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_AVF_16BYTE_RX_DESC=n
 
 #
+# Compile burst-oriented IPN3KE PMD driver
+#
+CONFIG_RTE_LIBRTE_IPN3KE_PMD=n
+CONFIG_RTE_LIBRTE_IPN3KE_DEBUG=n
+
+#
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD
 #
 CONFIG_RTE_LIBRTE_MLX4_PMD=n
Signature · 1 line
1.8.3.1
#21 lore raw

Re: [PATCH v1 06/11] config: add build enablement for IPN3KE

Quoted 2 lines · Rosen Xu

Add build enablement for Intel FPGA Acceleration
NIC IPN3KE.

No need to make this a separate patch, can squash into previous one.

Quoted 11 lines
---
 config/common_base | 6 ++++++
 1 file changed, 6 insertions(+)
config/common_base +0 -0
index 7c6da51..4fac8ba 100644

config/common_base CONFIG_RTE_LIBRTE_AVF_DEBUG_RX=n · line 321

Quoted 6 lines
config/common_base +3 -0
@@ -316,6 +316,12 @@ CONFIG_RTE_LIBRTE_AVF_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_AVF_16BYTE_RX_DESC=n
 
 #
+# Compile burst-oriented IPN3KE PMD driver
+#
+CONFIG_RTE_LIBRTE_IPN3KE_PMD=n

Why PMD is disabled by default?

config/common_base CONFIG_RTE_LIBRTE_AVF_DEBUG_RX=n · line 322

Quoted 1 line
config/common_base +1 -0
+CONFIG_RTE_LIBRTE_IPN3KE_DEBUG=n

_DEBUG seems not used at all, if so can you please remove it?

Quoted 6 lines
config/common_base +2 -0
+
+#
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD
 #
 CONFIG_RTE_LIBRTE_MLX4_PMD=n
author
#22 lore raw

Re: [PATCH v1 06/11] config: add build enablement for IPN3KE

Quoted 14 lines

-----Original Message-----
From: Yigit, Ferruh [mailto:[email protected]]
Sent: Wednesday, March 06, 2019 20:45
To: Xu, Rosen <[email protected]>; [email protected]
Cc: 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]>
Subject: Re: [dpdk-dev] [PATCH v1 06/11] config: add build enablement for IPN3KE

Quoted 4 lines
Quoted 1 line · Rosen Xu

Add build enablement for Intel FPGA Acceleration NIC IPN3KE.

No need to make this a separate patch, can squash into previous one.

I will merge it in patch v2.

Quoted 13 lines
Quoted 13 lines
---
 config/common_base | 6 ++++++
 1 file changed, 6 insertions(+)
config/common_base index renamed from config/common_base +0 -0

7c6da51..4fac8ba 100644

config/common_base +0 -0
@@ -316,6 +316,12 @@ CONFIG_RTE_LIBRTE_AVF_DEBUG_RX=n

CONFIG_RTE_LIBRTE_AVF_16BYTE_RX_DESC=n

Quoted 5 lines

config/common_base

Quoted 3 lines

#

config/common_base +2 -0
+# Compile burst-oriented IPN3KE PMD driver #
+CONFIG_RTE_LIBRTE_IPN3KE_PMD=n

Why PMD is disabled by default?

I will change it to y in patch v2.

Quoted 9 lines
Quoted 1 line

+CONFIG_RTE_LIBRTE_IPN3KE_DEBUG=n

_DEBUG seems not used at all, if so can you please remove it?

Quoted 5 lines
config/common_base +2 -0
+
+#
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD  #

CONFIG_RTE_LIBRTE_MLX4_PMD=n

author
#23 lore raw

Re: [PATCH v1 06/11] config: add build enablement for IPN3KE

In reply to Yigit, Ferruh

Hi Ferruh,

It seems I have missed some comments, so just reply this again.

Quoted 12 lines

-----Original Message-----
From: Yigit, Ferruh [mailto:[email protected]]
Sent: Wednesday, March 06, 2019 20:45
To: Xu, Rosen <[email protected]>; [email protected]
Cc: 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]>
Subject: Re: [dpdk-dev] [PATCH v1 06/11] config: add build enablement for IPN3KE

Quoted 4 lines
Quoted 1 line · Rosen Xu

Add build enablement for Intel FPGA Acceleration NIC IPN3KE.

No need to make this a separate patch, can squash into previous one.

I will merge it in patch v2.

Quoted 13 lines
Quoted 13 lines
---
 config/common_base | 6 ++++++
 1 file changed, 6 insertions(+)
config/common_base index renamed from config/common_base +0 -0

7c6da51..4fac8ba 100644

config/common_base +0 -0
@@ -316,6 +316,12 @@ CONFIG_RTE_LIBRTE_AVF_DEBUG_RX=n

CONFIG_RTE_LIBRTE_AVF_16BYTE_RX_DESC=n

Quoted 5 lines

config/common_base

Quoted 3 lines

#

config/common_base +2 -0
+# Compile burst-oriented IPN3KE PMD driver #
+CONFIG_RTE_LIBRTE_IPN3KE_PMD=n

Why PMD is disabled by default?

It should not be disabled by default.
I will change it to y in patch v2.

Quoted 3 lines
Quoted 1 line

+CONFIG_RTE_LIBRTE_IPN3KE_DEBUG=n

_DEBUG seems not used at all, if so can you please remove it?

Currently it's not used, I will remove it in patch v2.

Quoted 5 lines
Quoted 5 lines
config/common_base +2 -0
+
+#
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD  #

CONFIG_RTE_LIBRTE_MLX4_PMD=n

author
#24 lore raw

PATCH 7/11 mk: add link enablement for IPN3KE

In reply to Rosen Xu

Add link enablement for Intel FPGA Acceleration
NIC IPN3KE.

---
 mk/rte.app.mk | 1 +
 1 file changed, 1 insertion(+)
mk/rte.app.mk +1 -0
index 8a4f0f4..8b427d1 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
 
Signature · 1 line
1.8.3.1
#25 lore raw

Re: [PATCH v1 07/11] mk: add link enablement for IPN3KE

Quoted 2 lines · Rosen Xu

Add link enablement for Intel FPGA Acceleration
NIC IPN3KE.

Again, I think no need/benefit to make this separate patch, please merge into main one that add pmd.

Quoted 19 lines
---
 mk/rte.app.mk | 1 +
 1 file changed, 1 insertion(+)
mk/rte.app.mk +1 -0
index 8a4f0f4..8b427d1 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
 
author
#26 lore raw

Re: [PATCH v1 07/11] mk: add link enablement for IPN3KE

Quoted 14 lines

-----Original Message-----
From: Yigit, Ferruh [mailto:[email protected]]
Sent: Wednesday, March 06, 2019 20:46
To: Xu, Rosen <[email protected]>; [email protected]
Cc: 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]>
Subject: Re: [dpdk-dev] [PATCH v1 07/11] mk: add link enablement for IPN3KE

Quoted 5 lines
Quoted 1 line · Rosen Xu

Add link enablement for Intel FPGA Acceleration NIC IPN3KE.

Again, I think no need/benefit to make this separate patch, please merge into main one that add pmd.

Okay

Quoted 20 lines
Quoted 11 lines
---
 mk/rte.app.mk | 1 +
 1 file changed, 1 insertion(+)
mk/rte.app.mk index 8a4f0f4..8b427d1 renamed from mk/rte.app.mk +0 -0

100644

mk/rte.app.mk endif # CONFIG_RTE_LIBRTE_FSLMC_BUS · line 297

Quoted 3 lines
mk/rte.app.mk +0 -0
@@ -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

Quoted 5 lines
mk/rte.app.mk +1 -0
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
author
#27 lore raw

PATCH 8/11 app/test-pmd: add IPN3KE support for testpmd

In reply to Rosen Xu

Add IPN3KE support for testpmd

---
 app/test-pmd/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/Makefile +4 -0
index d5258ea..a6b6f6f 100644
@@ -62,6 +62,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
 LDLIBS += -lrte_pmd_i40e
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_IPN3KE_PMD),y)
+LDLIBS += -lrte_pmd_ipn3ke
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y)
 LDLIBS += -lrte_pmd_bnxt
 endif
Signature · 1 line
1.8.3.1
#28 lore raw

Re: [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

Quoted 14 lines · Rosen Xu

Add IPN3KE support for testpmd

---
 app/test-pmd/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/Makefile +0 -0
index d5258ea..a6b6f6f 100644

app/test-pmd/Makefile ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y) · line 71

Quoted 10 lines
app/test-pmd/Makefile +4 -0
@@ -62,6 +62,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
 LDLIBS += -lrte_pmd_i40e
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_IPN3KE_PMD),y)
+LDLIBS += -lrte_pmd_ipn3ke
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y)
 LDLIBS += -lrte_pmd_bnxt
 endif

I am a bit lost.
Why is it needed ?

Signature · 1 line
David Marchand
author
#29 lore raw

Re: [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

Hi,

From: David Marchand [mailto:[email protected]]
Sent: Thursday, February 28, 2019 16:37
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]>
Subject: Re: [dpdk-dev] [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

On Thu, Feb 28, 2019 at 8:16 AM Rosen Xu <[email protected]<mailto:[email protected]>> wrote:
Add IPN3KE support for testpmd

---
 app/test-pmd/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/Makefile +4 -0
index d5258ea..a6b6f6f 100644
@@ -62,6 +62,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
 LDLIBS += -lrte_pmd_i40e
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_IPN3KE_PMD),y)
+LDLIBS += -lrte_pmd_ipn3ke
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y)
 LDLIBS += -lrte_pmd_bnxt
 endif

I am a bit lost.
Why is it needed ?
Involve IPN3KE in testpmd, for testpmd is widely used in NIC.

--
David Marchand

#30 lore raw

Re: [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

Quoted 47 lines · Rosen

Hi,

*From:* David Marchand [mailto:[email protected]] *Sent:* Thursday, February 28, 2019 16:37
*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]>
*Subject:* Re: [dpdk-dev] [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

On Thu, Feb 28, 2019 at 8:16 AM Rosen Xu <[email protected]> wrote:

Add IPN3KE support for testpmd

---
 app/test-pmd/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/Makefile +4 -0
index d5258ea..a6b6f6f 100644
@@ -62,6 +62,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
 LDLIBS += -lrte_pmd_i40e
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_IPN3KE_PMD),y)
+LDLIBS += -lrte_pmd_ipn3ke
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y)
 LDLIBS += -lrte_pmd_bnxt
 endif
Quoted 6 lines

I am a bit lost.

Why is it needed ?

Involve IPN3KE in testpmd, for testpmd is widely used in NIC.

The drivers declared in this makefile are there because testpmd directly calls private apis of those drivers.
Bis repetita, why is linking to ipn3ke needed here ?

Signature · 1 line
David Marchand
author
#31 lore raw

Re: [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

Hi,

From: David Marchand [mailto:[email protected]]
Sent: Thursday, February 28, 2019 16:48
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]>
Subject: Re: [dpdk-dev] [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

On Thu, Feb 28, 2019 at 9:45 AM Xu, Rosen <[email protected]<mailto:[email protected]>> wrote:
Hi,

From: David Marchand [mailto:[email protected]<mailto:[email protected]>]
Sent: Thursday, February 28, 2019 16:37
To: Xu, Rosen <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>; Yigit, Ferruh <[email protected]<mailto:[email protected]>>; Zhang, Tianfei <[email protected]<mailto:[email protected]>>; Wei, Dan <[email protected]<mailto:[email protected]>>; Pei, Andy <[email protected]<mailto:[email protected]>>; Yang, Qiming <[email protected]<mailto:[email protected]>>; Wang, Haiyue <[email protected]<mailto:[email protected]>>; Chen, Santos <[email protected]<mailto:[email protected]>>; Zhang, Zhang <[email protected]<mailto:[email protected]>>
Subject: Re: [dpdk-dev] [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

On Thu, Feb 28, 2019 at 8:16 AM Rosen Xu <[email protected]<mailto:[email protected]>> wrote:
Add IPN3KE support for testpmd

---
 app/test-pmd/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/Makefile +4 -0
index d5258ea..a6b6f6f 100644
@@ -62,6 +62,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
 LDLIBS += -lrte_pmd_i40e
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_IPN3KE_PMD),y)
+LDLIBS += -lrte_pmd_ipn3ke
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y)
 LDLIBS += -lrte_pmd_bnxt
 endif

I am a bit lost.
Why is it needed ?
Involve IPN3KE in testpmd, for testpmd is widely used in NIC.

The drivers declared in this makefile are there because testpmd directly calls private apis of those drivers. Bis repetita, why is linking to ipn3ke needed here ?

It will be fixed in v2 patch. Thanks.

--
David Marchand

#32 lore raw

Re: [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

In reply to Rosen Xu
Quoted 1 line · Rosen Xu

Add IPN3KE support for testpmd

I think it is already decided to remove this patch, +1.

Quoted 23 lines
---
 app/test-pmd/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/Makefile +4 -0
index d5258ea..a6b6f6f 100644
@@ -62,6 +62,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
 LDLIBS += -lrte_pmd_i40e
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_IPN3KE_PMD),y)
+LDLIBS += -lrte_pmd_ipn3ke
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y)
 LDLIBS += -lrte_pmd_bnxt
 endif
author
#33 lore raw

Re: [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

Quoted 14 lines

-----Original Message-----
From: Yigit, Ferruh [mailto:[email protected]]
Sent: Wednesday, March 06, 2019 20:46
To: Xu, Rosen <[email protected]>; [email protected]
Cc: 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]>
Subject: Re: [dpdk-dev] [PATCH v1 08/11] app/test-pmd: add IPN3KE support for testpmd

Quoted 4 lines
Quoted 1 line · Rosen Xu

Add IPN3KE support for testpmd

I think it is already decided to remove this patch, +1.

Okay

Quoted 22 lines

app/test-pmd/Makefile ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y) LDLIBS

Quoted 12 lines
---
 app/test-pmd/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/Makefile index renamed from app/test-pmd/Makefile +0 -0

d5258ea..a6b6f6f 100644

app/test-pmd/Makefile +0 -0
@@ -62,6 +62,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)  LDLIBS
+=
> -lrte_pmd_i40e  endif
Quoted 8 lines
app/test-pmd/Makefile +4 -0
+ifeq ($(CONFIG_RTE_LIBRTE_IPN3KE_PMD),y)
+LDLIBS += -lrte_pmd_ipn3ke
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y)  LDLIBS += -lrte_pmd_bnxt

endif

author
#34 lore raw

PATCH 9/11 usertools: add IPN3KE device bind

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE device bind.

---
 usertools/dpdk-devbind.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
usertools/dpdk-devbind.py +3 -1
index a9cd66a..067a809 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,
@@ -29,7 +31,7 @@
 avp_vnic = {'Class': '05', 'Vendor': '1af4', 'Device': '1110',
               '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]
 mempool_devices = [cavium_fpa]
Signature · 1 line
1.8.3.1
author
#35 lore raw

PATCH 10/11 doc: add IPN3KE document

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE document.

---
 doc/guides/nics/features/ipn3ke.ini | 57 ++++++++++++++++++++++
 doc/guides/nics/index.rst           |  1 +
 doc/guides/nics/ipn3ke.rst          | 97 +++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
doc/guides/nics/features/ipn3ke.ini new file +57 -0
new file mode 100644
index 0000000..06cfaf5
@@ -0,0 +1,57 @@
+;
+; Supported features of the 'ipn3ke' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Speed capabilities   = Y
+Link status          = Y
+Link status event    = Y
+Rx interrupt         = Y
+Queue start/stop     = Y
+Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
+Jumbo frame          = Y
+Scattered Rx         = Y
+TSO                  = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
+Unicast MAC filter   = Y
+Multicast MAC filter = Y
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
+VMDq                 = Y
+SR-IOV               = Y
+DCB                  = Y
+VLAN filter          = Y
+Ethertype filter     = Y
+Tunnel filter        = Y
+Hash filter          = Y
+Flow director        = Y
+Flow control         = Y
+Flow API             = Y
+Traffic mirroring    = Y
+CRC offload          = Y
+VLAN offload         = Y
+QinQ offload         = Y
+L3 checksum offload  = Y
+L4 checksum offload  = Y
+Inner L3 checksum    = Y
+Inner L4 checksum    = Y
+Packet type parsing  = Y
+Timesync             = Y
+Rx descriptor status = Y
+Tx descriptor status = Y
+Basic stats          = Y
+Extended stats       = Y
+FW version           = Y
+Module EEPROM dump   = Y
+Multiprocess aware   = Y
+BSD nic_uio          = Y
+Linux UIO            = Y
+Linux VFIO           = Y
+x86-32               = Y
+x86-64               = Y
+ARMv8                = Y
+Power8               = Y
doc/guides/nics/index.rst +1 -0
index 5c80e3b..6671481 100644
@@ -28,6 +28,7 @@ Network Interface Controller Drivers
     fm10k
     i40e
     ice
+    ipn3ke
     ifc
     igb
     ixgbe
doc/guides/nics/ipn3ke.rst new file +97 -0

97 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#36 lore raw

Re: [PATCH v1 10/11] doc: add IPN3KE document

Quoted 1 line · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE document.

No need to separate the doc patch, can merge into the one that adds the driver.

Quoted 64 lines
---
 doc/guides/nics/features/ipn3ke.ini | 57 ++++++++++++++++++++++
 doc/guides/nics/index.rst           |  1 +
 doc/guides/nics/ipn3ke.rst          | 97 +++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
doc/guides/nics/features/ipn3ke.ini new file +47 -0
new file mode 100644
index 0000000..06cfaf5
@@ -0,0 +1,57 @@
+;
+; Supported features of the 'ipn3ke' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Speed capabilities   = Y
+Link status          = Y
+Link status event    = Y
+Rx interrupt         = Y
+Queue start/stop     = Y
+Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
+Jumbo frame          = Y
+Scattered Rx         = Y
+TSO                  = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
+Unicast MAC filter   = Y
+Multicast MAC filter = Y
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
+VMDq                 = Y
+SR-IOV               = Y
+DCB                  = Y
+VLAN filter          = Y
+Ethertype filter     = Y
+Tunnel filter        = Y
+Hash filter          = Y
+Flow director        = Y
+Flow control         = Y
+Flow API             = Y
+Traffic mirroring    = Y
+CRC offload          = Y
+VLAN offload         = Y
+QinQ offload         = Y
+L3 checksum offload  = Y
+L4 checksum offload  = Y
+Inner L3 checksum    = Y
+Inner L4 checksum    = Y
+Packet type parsing  = Y
+Timesync             = Y
+Rx descriptor status = Y
+Tx descriptor status = Y
+Basic stats          = Y
+Extended stats       = Y

doc/guides/nics/features/ipn3ke.ini line 57

Quoted 10 lines
doc/guides/nics/features/ipn3ke.ini new file +10 -0
+FW version           = Y
+Module EEPROM dump   = Y
+Multiprocess aware   = Y
+BSD nic_uio          = Y
+Linux UIO            = Y
+Linux VFIO           = Y
+x86-32               = Y
+x86-64               = Y
+ARMv8                = Y
+Power8               = Y

Are these all marked to 'Y' because the underlying PMD is i40e? Is ipn3ke really verified with Power8, arm etc?

doc/guides/nics/index.rst Network Interface Controller Drivers · line 31

Quoted 9 lines
doc/guides/nics/index.rst +1 -0
index 5c80e3b..6671481 100644
@@ -28,6 +28,7 @@ Network Interface Controller Drivers
     fm10k
     i40e
     ice
+    ipn3ke

Please add alphabetically sorted.

Quoted 43 lines
doc/guides/nics/index.rst +0 -0
     ifc
     igb
     ixgbe
doc/guides/nics/ipn3ke.rst new file +34 -0
new file mode 100644
index 0000000..7386075
@@ -0,0 +1,97 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+IPN3KE Poll Mode Driver
+=======================
+
+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.
+
+Prerequisites
+-------------
+
+- Identifying your adapter using `Intel Support
+  <http://www.intel.com/support>`_ and get the latest NVM/FW images.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+- To get better performance on Intel platforms, please follow the "How to get best performance with NICs on Intel platforms"
+  section of the :ref:`Getting Started Guide for Linux <linux_gsg>`.
+
+
+Pre-Installation Configuration
+------------------------------
+
+Config File Options

doc/guides/nics/ipn3ke.rst line 44

Quoted 10 lines
doc/guides/nics/ipn3ke.rst new file +10 -0
+~~~~~~~~~~~~~~~~~~~
+
+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``)
+
+  Toggle compilation of the ``librte_pmd_ipn3ke`` driver.
+
+- ``CONFIG_RTE_LIBRTE_IPN3KE_DEBUG_*`` (default ``n``)

The name is wrong, there is no DEBUG_*, also it seems not used, if so please remove.

doc/guides/nics/ipn3ke.rst line 57

Quoted 13 lines
doc/guides/nics/ipn3ke.rst new file +13 -0
+
+  Toggle display of generic debugging messages.
+
+Runtime Config Options
+~~~~~~~~~~~~~~~~~~~~~~
+
+- ``Maximum Number of Queue Pairs``
+
+  The maximum number of queue pairs is decided by HW. If not configured, APP
+  uses the number from HW. Users can check the number by calling the API
+  ``rte_eth_dev_info_get``.
+  If users want to limit the number of queues, they can set a smaller number
+  using EAL parameter like ``max_queue_pair_num=n``.

Is this copy/paste error?
There is no 'max_queue_pair_num' device argument in this driver.

And there are other devargs, seems not documented here.

Quoted 11 lines
doc/guides/nics/ipn3ke.rst new file +11 -0
+
+
+Driver compilation and testing
+------------------------------
+
+Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
+for details.
+
+Sample Application Notes
+------------------------
+

doc/guides/nics/ipn3ke.rst line 78

Quoted 10 lines
doc/guides/nics/ipn3ke.rst new file +10 -0
+Packet TX/RX with FPGA Pass-through image
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+FPGA Pass-through bitstream is original FPGA Image.
+
+To start ``testpmd``, and add I40e PF to FPGA network port:
+
+.. code-block:: console
+
+    ./app/testpmd -l 0-15 -n 4 --vdev 'ifpga_rawdev_cfg0,ifpga=b3:00.0,port=0' --vdev 'ipn3ke_cfg0,afu=0|b3:00.0,i40e_pf={0000:b1:00.0|0000:b1:00.1|0000:b1:00.2|0000:b1:00.3|0000:b5:00.0|0000:b5:00.1|0000:b5:00.2|0000:b5:00.3}' -- -i --no-numa --port-topology=loop

Can you please help me understand?

raw device ifpga_rawdev_cfg0, used to get devargs and to create the AFU device.

AFU driver is already in this patch, net_ipn3ke_afu. It should be probed after rawdev created the device.

vdev ipn3ke_cfg0, used to get devargs and link afu device and i40e devices, so i40e devices should be already probed in this stage, and port representors created for AFU device.

Is above correct?
Overall there is a IFPGA bus and AFU device work going on, but they are behind rawdev and vdev.

Quoted 20 lines
doc/guides/nics/ipn3ke.rst new file +19 -0
+
+HQoS and flow acceleration
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+HQoS and flow acceleration bitstream is used to offloading HQoS and flow classifier.
+
+To start ``testpmd``, and add I40e PF to FPGA network port, enable FPGA HQoS and Flow Acceleration:
+
+.. code-block:: console
+
+    ./app/testpmd -l 0-15 -n 4 --vdev 'ifpga_rawdev_cfg0,ifpga=b3:00.0,port=0' --vdev 'ipn3ke_cfg0,afu=0|b3:00.0,fpga_acc={tm|flow},i40e_pf={0000:b1:00.0|0000:b1:00.1|0000:b1:00.2|0000:b1:00.3|0000:b5:00.0|0000:b5:00.1|0000:b5:00.2|0000:b5:00.3}' -- -i --no-numa --forward-mode=macswap
+
+Limitations or Known issues
+---------------------------
+
+19.05 limitation
+~~~~~~~~~~~~~~~~
+
+Ipn3ke code released in 19.05 is for evaluation only.
author
#37 lore raw

Re: [PATCH v1 10/11] doc: add IPN3KE document

Quoted 12 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 06, 2019 20:45
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]>
Subject: Re: [PATCH v1 10/11] doc: add IPN3KE document

Quoted 5 lines
Quoted 1 line · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE document.

No need to separate the doc patch, can merge into the one that adds the driver.

Okay, I will apply it in patch v2.

Quoted 71 lines
Quoted 7 lines
---
 doc/guides/nics/features/ipn3ke.ini | 57 ++++++++++++++++++++++
 doc/guides/nics/index.rst           |  1 +
 doc/guides/nics/ipn3ke.rst          | 97

+++++++++++++++++++++++++++++++++++++

Quoted 63 lines
 3 files changed, 155 insertions(+)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
doc/guides/nics/features/ipn3ke.ini new file +52 -0
new file mode 100644
index 0000000..06cfaf5
@@ -0,0 +1,57 @@
+;
+; Supported features of the 'ipn3ke' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Speed capabilities   = Y
+Link status          = Y
+Link status event    = Y
+Rx interrupt         = Y
+Queue start/stop     = Y
+Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
+Jumbo frame          = Y
+Scattered Rx         = Y
+TSO                  = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
+Unicast MAC filter   = Y
+Multicast MAC filter = Y
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
+VMDq                 = Y
+SR-IOV               = Y
+DCB                  = Y
+VLAN filter          = Y
+Ethertype filter     = Y
+Tunnel filter        = Y
+Hash filter          = Y
+Flow director        = Y
+Flow control         = Y
+Flow API             = Y
+Traffic mirroring    = Y
+CRC offload          = Y
+VLAN offload         = Y
+QinQ offload         = Y
+L3 checksum offload  = Y
+L4 checksum offload  = Y
+Inner L3 checksum    = Y
+Inner L4 checksum    = Y
+Packet type parsing  = Y
+Timesync             = Y
+Rx descriptor status = Y
+Tx descriptor status = Y
+Basic stats          = Y
+Extended stats       = Y
+FW version           = Y
+Module EEPROM dump   = Y
+Multiprocess aware   = Y
+BSD nic_uio          = Y
+Linux UIO            = Y
Quoted 8 lines

doc/guides/nics/features/ipn3ke.ini line 57

Quoted 5 lines
doc/guides/nics/features/ipn3ke.ini new file +5 -0
+Linux VFIO           = Y
+x86-32               = Y
+x86-64               = Y
+ARMv8                = Y
+Power8               = Y

Are these all marked to 'Y' because the underlying PMD is i40e?

Yes, because there are 2xFVL in Vista Creek, and currently all the CPU packets TX/RX are handled by FVL.

Quoted 1 line

Is ipn3ke really verified with Power8, arm etc?

Just copy from FVL, because FVL has this feature and there are 2xFVL in Vista Creek.

Quoted 11 lines

doc/guides/nics/index.rst Network Interface Controller Drivers · line 31

Quoted 9 lines
doc/guides/nics/index.rst +1 -0
index 5c80e3b..6671481 100644
@@ -28,6 +28,7 @@ Network Interface Controller Drivers
     fm10k
     i40e
     ice
+    ipn3ke

Please add alphabetically sorted.

Okay

Quoted 50 lines
Quoted 24 lines
doc/guides/nics/index.rst +0 -0
     ifc
     igb
     ixgbe
doc/guides/nics/ipn3ke.rst new file +16 -0
new file mode 100644 index 0000000..7386075
@@ -0,0 +1,97 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+IPN3KE Poll Mode Driver
+=======================
+
+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

doc/guides/nics/ipn3ke.rst line 26

Quoted 10 lines
doc/guides/nics/ipn3ke.rst new file +10 -0
+X710/XXV710 PMD. Besides this, users can enable more acceleration
+features by FPGA IP.
+
+Prerequisites
+-------------
+
+- Identifying your adapter using `Intel Support
+  <http://www.intel.com/support>`_ and get the latest NVM/FW images.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to

setup the basic DPDK environment.

doc/guides/nics/ipn3ke.rst line 28

Quoted 2 lines
doc/guides/nics/ipn3ke.rst new file +2 -0
+
+- To get better performance on Intel platforms, please follow the "How to

get best performance with NICs on Intel platforms"

doc/guides/nics/ipn3ke.rst

Quoted 11 lines
doc/guides/nics/ipn3ke.rst new file +11 -0
+  section of the :ref:`Getting Started Guide for Linux <linux_gsg>`.
+
+
+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 9 lines

doc/guides/nics/ipn3ke.rst line 44

Quoted 6 lines
doc/guides/nics/ipn3ke.rst new file +6 -0
+
+- ``CONFIG_RTE_LIBRTE_IPN3KE_PMD`` (default ``n``)
+
+  Toggle compilation of the ``librte_pmd_ipn3ke`` driver.
+
+- ``CONFIG_RTE_LIBRTE_IPN3KE_DEBUG_*`` (default ``n``)

The name is wrong, there is no DEBUG_*, also it seems not used, if so please remove.

Fix in patch v2.

Quoted 17 lines

doc/guides/nics/ipn3ke.rst

Quoted 13 lines
doc/guides/nics/ipn3ke.rst new file +13 -0
+
+  Toggle display of generic debugging messages.
+
+Runtime Config Options
+~~~~~~~~~~~~~~~~~~~~~~
+
+- ``Maximum Number of Queue Pairs``
+
+  The maximum number of queue pairs is decided by HW. If not
+ configured, APP  uses the number from HW. Users can check the number
+ by calling the API  ``rte_eth_dev_info_get``.
+  If users want to limit the number of queues, they can set a smaller
+ number  using EAL parameter like ``max_queue_pair_num=n``.

Is this copy/paste error?
There is no 'max_queue_pair_num' device argument in this driver.

Quoted 1 line

And there are other devargs, seems not documented here.

Fix in patch v2.

Quoted 14 lines
Quoted 14 lines
doc/guides/nics/ipn3ke.rst new file +14 -0
+
+
+Driver compilation and testing
+------------------------------
+
+Refer to the document :ref:`compiling and testing a PMD for a NIC
+<pmd_build_and_test>` for details.
+
+Sample Application Notes
+------------------------
+
+Packet TX/RX with FPGA Pass-through image
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
Quoted 8 lines

doc/guides/nics/ipn3ke.rst

Quoted 8 lines
doc/guides/nics/ipn3ke.rst new file +8 -0
+FPGA Pass-through bitstream is original FPGA Image.
+
+To start ``testpmd``, and add I40e PF to FPGA network port:
+
+.. code-block:: console
+
+    ./app/testpmd -l 0-15 -n 4 --vdev
+ 'ifpga_rawdev_cfg0,ifpga=b3:00.0,port=0' --vdev

This is IFPGA BUS AFU configuration, same as before.

Quoted 2 lines

doc/guides/nics/ipn3ke.rst line 82

Quoted 2 lines
doc/guides/nics/ipn3ke.rst new file +2 -0
+ 'ipn3ke_cfg0,afu=0|b3:00.0,i40e_pf={0000:b1:00.0|0000:b1:00.1|0000:b
+ 1:00.2|0000:b1:00.3|0000:b5:00.0|0000:b5:00.1|0000:b5:00.2|0000:b5:0

In IPN3KE, there are one2one port mapping relationship between network side(port representor) and FVL PF, this example is to create mapping of 8 ports.

Quoted 3 lines

doc/guides/nics/ipn3ke.rst line 83

Quoted 1 line
doc/guides/nics/ipn3ke.rst new file +1 -0
+ 0.3}' -- -i --no-numa --port-topology=loop

Can you please help me understand?

Pls see my reply.

Quoted 2 lines

raw device ifpga_rawdev_cfg0, used to get devargs and to create the AFU device.

Yes

Quoted 2 lines

AFU driver is already in this patch, net_ipn3ke_afu. It should be probed after rawdev created the device.

Yes

Quoted 3 lines

vdev ipn3ke_cfg0, used to get devargs and link afu device and i40e devices, so i40e devices should be already probed in this stage, and port representors created for AFU device.

Yes

Quoted 1 line

Is above correct?

Yes

Quoted 2 lines

Overall there is a IFPGA bus and AFU device work going on, but they are behind rawdev and vdev.

Yes

Quoted 26 lines

doc/guides/nics/ipn3ke.rst

Quoted 5 lines
doc/guides/nics/ipn3ke.rst new file +5 -0
+
+HQoS and flow acceleration
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+HQoS and flow acceleration bitstream is used to offloading HQoS and flow

classifier.

doc/guides/nics/ipn3ke.rst line 90

Quoted 2 lines
doc/guides/nics/ipn3ke.rst new file +2 -0
+
+To start ``testpmd``, and add I40e PF to FPGA network port, enable FPGA

HQoS and Flow Acceleration:

Quoted 17 lines
doc/guides/nics/ipn3ke.rst new file +16 -0
+
+.. code-block:: console
+
+    ./app/testpmd -l 0-15 -n 4 --vdev
+ 'ifpga_rawdev_cfg0,ifpga=b3:00.0,port=0' --vdev
+ 'ipn3ke_cfg0,afu=0|b3:00.0,fpga_acc={tm|flow},i40e_pf={0000:b1:00.0|
+ 0000:b1:00.1|0000:b1:00.2|0000:b1:00.3|0000:b5:00.0|0000:b5:00.1|000
+ 0:b5:00.2|0000:b5:00.3}' -- -i --no-numa --forward-mode=macswap
+
+Limitations or Known issues
+---------------------------
+
+19.05 limitation
+~~~~~~~~~~~~~~~~
+
+Ipn3ke code released in 19.05 is for evaluation only.
author
#38 lore raw

PATCH 11/11 MAINTAINERS: add MAINTAINERS for IPN3KE

In reply to Rosen Xu

Add MAINTAINERS for Intel FPGA Acceleration NIC IPN3KE.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 835d8a2..ec49f00 100644
@@ -599,6 +599,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: Dmitri Epshtein <[email protected]>
Signature · 1 line
1.8.3.1
#39 lore raw

Re: [PATCH v1 11/11] MAINTAINERS: add MAINTAINERS for IPN3KE

Quoted 1 line · Rosen Xu

Add MAINTAINERS for Intel FPGA Acceleration NIC IPN3KE.

I think this patch shouldn't be separate, can you please merge with the main patch that adds the pmd.

Quoted 25 lines
---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 835d8a2..ec49f00 100644
@@ -599,6 +599,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: Dmitri Epshtein <[email protected]>
author
#40 lore raw

Re: [PATCH v1 11/11] MAINTAINERS: add MAINTAINERS for IPN3KE

Hi,

Quoted 10 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 06, 2019 20:46
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]>
Subject: Re: [PATCH v1 11/11] MAINTAINERS: add MAINTAINERS for IPN3KE

Quoted 5 lines
Quoted 1 line · Rosen Xu

Add MAINTAINERS for Intel FPGA Acceleration NIC IPN3KE.

I think this patch shouldn't be separate, can you please merge with the main patch that adds the pmd.

Okay, I will merge it in patch v2.

Quoted 24 lines
Quoted 24 lines
---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -599,6 +599,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: Dmitri Epshtein <[email protected]>
author
#41 lore raw

v2 cover Add patch set for IPN3KE

In reply to Rosen Xu

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 (8):
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 device tree support
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        |    1 +
 drivers/net/Makefile                               |    1 +
 drivers/net/ipn3ke/Makefile                        |   39 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c                 |  737 +++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h                 |  897 +++++++++
 drivers/net/ipn3ke/ipn3ke_flow.c                   | 1400 +++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h                   |   86 +
 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                     | 2082 ++++++++++++++++++++
 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             |    8 +
 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   |  271 +++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h   |  106 +
 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            |  205 +-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h            |   12 +
 drivers/raw/ifpga_rawdev/meson.build               |    6 +-
 mk/rte.app.mk                                      |    3 +-
 usertools/dpdk-devbind.py                          |    4 +-
 61 files changed, 10490 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
#42 lore raw

PATCH v2 1/15 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
#43 lore raw

PATCH v2 2/15 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 |  1 +
 3 files changed, 23 insertions(+)
drivers/bus/ifpga/ifpga_bus.c +13 -0
index 55d3abf..dfd6b1f 100644
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
 	return NULL;
 }
 
+struct rte_afu_device *
+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..88a6289 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_ifpga_find_afu_by_name(const char *name);
+
+/**
  * Register a ifpga afu device driver.
  *
  * @param driver
drivers/bus/ifpga/rte_bus_ifpga_version.map +1 -0
index a027979..d2f56c0 100644
@@ -1,6 +1,7 @@
 DPDK_18.05 {
 	global:
 
+	rte_ifpga_find_afu_by_name;
 	rte_ifpga_get_integer32_arg;
 	rte_ifpga_get_string_arg;
 	rte_ifpga_driver_register;
Signature · 1 line
1.8.3.1
author
#44 lore raw

PATCH v2 3/15 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            | 715 +++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h            | 890 ++++++++++++++++++++++++++
 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, 1914 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 +715 -0

715 lines not on this page · raw message

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

890 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
author
#45 lore raw

PATCH v2 4/15 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      |  14 +
 drivers/net/ipn3ke/ipn3ke_representor.c | 962 ++++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/meson.build          |   3 +-
 4 files changed, 979 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 +14 -0
index a495d78..18c9666 100644
@@ -417,11 +417,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;
@@ -445,6 +457,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 +962 -0

962 lines not on this page · raw message

drivers/net/ipn3ke/meson.build +2 -1
index e983bb3..9f20333 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
author
#46 lore raw

PATCH v2 5/15 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 |    4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c          | 2081 +++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/meson.build          |    3 +-
 6 files changed, 2096 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 18c9666..2b4bb4a 100644
@@ -327,6 +327,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 c1fd040..f6344c9 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 +3 -1
index 403ea9e..32f75fb 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,8 @@ 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 */
 	/**
drivers/net/ipn3ke/ipn3ke_tm.c new file +2081 -0

2,081 lines not on this page · raw message

drivers/net/ipn3ke/meson.build +2 -1
index 9f20333..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
#47 lore raw

PATCH v2 6/15 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      |    5 +
 drivers/net/ipn3ke/ipn3ke_ethdev.h      |    1 +
 drivers/net/ipn3ke/ipn3ke_flow.c        | 1400 +++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h        |   86 ++
 drivers/net/ipn3ke/ipn3ke_representor.c |    3 +-
 drivers/net/ipn3ke/ipn3ke_tm.c          |    1 +
 drivers/net/ipn3ke/meson.build          |    3 +-
 8 files changed, 1498 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 +5 -0
index 2b4bb4a..eb5d522 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"
 
@@ -332,6 +333,10 @@ static int ipn3ke_indirect_mac_write(struct ipn3ke_hw *hw,
 			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 f6344c9..0c49d39 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 +1400 -0

1,400 lines not on this page · raw message

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

86 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_representor.c +2 -1
index 32f75fb..6c218a1 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 3aaa61e..0b9be57 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
#48 lore raw

PATCH v2 7/15 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
#49 lore raw

PATCH v2 8/15 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
#50 lore raw

PATCH v2 9/15 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
#51 lore raw

PATCH v2 10/15 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
#52 lore raw

PATCH v2 11/15 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
#53 lore raw

PATCH v2 12/15 raw/ifpga/base: add device tree support

In reply to Rosen Xu

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

In PAC N3000 card, there is using device tree to descript the board info and sensor device info.

Add device tree support by using libfdt library in Linux distribution.

The end-user should pre-install the libfdt and libfdt-devel package.

---
 drivers/raw/ifpga_rawdev/base/Makefile           |   2 +
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.c | 183 +++++++++++++++++++++++
 drivers/raw/ifpga_rawdev/base/opae_intel_max10.h |  10 ++
 3 files changed, 195 insertions(+)
drivers/raw/ifpga_rawdev/base/Makefile +2 -0
index c5bbcbd..86815b4 100644
@@ -8,6 +8,7 @@ OSDEP := osdep_raw
 endif
 
 CFLAGS += -I$(RTE_SDK)/drivers/raw/ifpga_rawdev/base/$(OSDEP)
+CFLAGS += -I libfdt
 
 SRCS-y += ifpga_api.c
 SRCS-y += ifpga_enumerate.c
@@ -30,3 +31,4 @@ SRCS-y += opae_at24_eeprom.c
 SRCS-y += opae_eth_group.c
 
 SRCS-y += $(wildcard $(SRCDIR)/base/$(OSDEP)/*.c)
+LDLIBS += -lfdt
drivers/raw/ifpga_rawdev/base/opae_intel_max10.c +183 -0

213 lines not on this page · raw message

drivers/raw/ifpga_rawdev/base/opae_intel_max10.h +10 -0
index 08b387e..a52b63e 100644
@@ -8,6 +8,14 @@
 #include "opae_osdep.h"
 #include "opae_spi.h"
 
+struct max10_compatible_id {
+	char compatible[128];
+};
+
+#define MAX10_PAC	"intel,max10"
+#define MAX10_PAC_N3000	"intel,max10-pac-n3000"
+#define MAX10_PAC_END    "intel,end"
+
 /* max10 capability flags */
 #define MAX10_FLAGS_NO_I2C2		BIT(0)
 #define MAX10_FLAGS_NO_BMCIMG_FLASH	BIT(1)
@@ -20,6 +28,8 @@ struct intel_max10_device {
 	unsigned int flags; /*max10 hardware capability*/
 	struct altera_spi_device *spi_master;
 	struct spi_transaction_dev *spi_tran_dev;
+	struct max10_compatible_id *id; /*max10 compatible*/
+	char *fdt_root;
 };
 
 /* retimer speed */
Signature · 1 line
1.8.3.1
author
#54 lore raw

PATCH v2 13/15 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
#55 lore raw

PATCH v2 14/15 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 ++--
 mk/rte.app.mk                                     |  2 +-
 12 files changed, 142 insertions(+), 136 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,
mk/rte.app.mk +1 -1
index 3bb0821..64d37b2 100644
@@ -294,7 +294,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += -lrte_pmd_dpaa2_qdma
 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_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev -lfdt
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
 endif # CONFIG_RTE_LIBRTE_RAWDEV
Signature · 1 line
1.8.3.1
author
#56 lore raw

PATCH v2 15/15 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 | 205 +++++++++++++++++++++++++++++++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h |  12 ++
 drivers/raw/ifpga_rawdev/meson.build    |   6 +-
 4 files changed, 220 insertions(+), 4 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 +202 -3

251 lines not on this page · raw message

drivers/raw/ifpga_rawdev/ifpga_rawdev.h +12 -0
index c7759b8..08bff52 100644
@@ -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
#57 lore raw
In reply to Rosen Xu
Quoted 30 lines · Rosen Xu

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 10 lines

Zhang, Tianfei (8):
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 device tree support
raw/ifpga/base: add version description on README raw/ifpga/base: using prefix name "ifpga_" for feature and feature_ops
data struct

Hi Rosen,

I am seeing some build errors, for 32bit [1], cross compilation [2] and linkage errors [3], can you please check them?

Is "libfdt.h" dependency in [2] documented in driver doc?

[1]
Building i686-native-linuxapp-gcc ... .../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c: In function ‘ipn3ke_indirect_read’:
.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c:68:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

  indirect_addrs = (volatile void *)(base_addr | 0x10);
                   ^
.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c:76:19: error: cast to pointer from
integer of different size [-Werror=int-to-pointer-cast]
  indirect_addrs = (volatile void *)(base_addr | 0x18);
                   ^
.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c: In function ‘ipn3ke_indirect_write’:
.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c:118:19: error: cast to pointer from
integer of different size [-Werror=int-to-pointer-cast]
  indirect_addrs = (volatile void *)(base_addr | 0x10);
                   ^

cc1: all warnings being treated as errors
make[7]: *** [.../dpdk/mk/internal/rte.compile-pre.mk:116: ipn3ke_ethdev.o] Error 1 make[7]: *** Waiting for unfinished jobs....
In file included from .../dpdk/drivers/net/ipn3ke/ipn3ke_representor.c:25:
.../dpdk/drivers/net/ipn3ke/ipn3ke_representor.c: In function ‘ipn3ke_update_link’:
.../dpdk/drivers/net/ipn3ke/ipn3ke_logs.h:13:49: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]

  rte_log(RTE_LOG_ ## level, ipn3ke_afu_logtype, "ipn3ke_afu: " fmt, \
                                                 ^~~~~~~~~~~~~~

.../dpdk/drivers/net/ipn3ke/ipn3ke_logs.h:19:2: note: in expansion of macro ‘IPN3KE_AFU_PMD_LOG’
IPN3KE_AFU_PMD_LOG(DEBUG, fmt, ## args)
^~~~~~~~~~~~~~~~~~
.../dpdk/drivers/net/ipn3ke/ipn3ke_representor.c:388:2: note: in expansion of macro ‘IPN3KE_AFU_PMD_DEBUG’
IPN3KE_AFU_PMD_DEBUG("line_link_bitmap is %lx\n", line_link_bitmap); ^~~~~~~~~~~~~~~~~~~~
.../dpdk/drivers/net/ipn3ke/ipn3ke_representor.c:388:46: note: format string is defined here

  IPN3KE_AFU_PMD_DEBUG("line_link_bitmap is %lx\n", line_link_bitmap);
                                            ~~^
                                            %llx

cc1: all warnings being treated as errors

[2] .../dpdk/drivers/raw/ifpga_rawdev/base/opae_intel_max10.c:6:10: fatal error:
libfdt.h: No such file or directory

 #include <libfdt.h>
          ^~~~~~~~~~

[3]
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_init':
ipn3ke_representor.c:(.text+0xc8b): undefined reference to pthread_create' /usr/bin/ld: ipn3ke_representor.c:(.text+0xca8): undefined reference to pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xcbe): undefined reference to `pthread_join'
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_uninit':
ipn3ke_representor.c:(.text+0xd6b): undefined reference to pthread_create' /usr/bin/ld: ipn3ke_representor.c:(.text+0xd88): undefined reference to pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xd9e): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_init':
ipn3ke_representor.c:(.text+0xc8b): undefined reference to pthread_create' /usr/bin/ld: ipn3ke_representor.c:(.text+0xca8): undefined reference to pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xcbe): undefined reference to `pthread_join'
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_uninit':
ipn3ke_representor.c:(.text+0xd6b): undefined reference to pthread_create' /usr/bin/ld: ipn3ke_representor.c:(.text+0xd88): undefined reference to pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xd9e): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status

author
#58 lore raw

Hi Ferruh,

My reply is online.

Quoted 53 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, March 30, 2019 2:59
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]>
Subject: Re: [PATCH v2 00/15] Add patch set for IPN3KE

Quoted 31 lines · Rosen Xu

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 10 lines

Zhang, Tianfei (8):
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 device tree support
raw/ifpga/base: add version description on README raw/ifpga/base: using prefix name "ifpga_" for feature and feature_ops
data struct

Quoted 4 lines

Hi Rosen,

I am seeing some build errors, for 32bit [1], cross compilation [2] and linkage errors [3], can you please check them?

I will fix it ASAP in v3.

Quoted 1 line

Is "libfdt.h" dependency in [2] documented in driver doc?

OPAE share code has dependency on libfdt, I will add it in v3.

Quoted 87 lines

[1]
Building i686-native-linuxapp-gcc ... .../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c: In function ‘ipn3ke_indirect_read’:
.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c:68:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

  indirect_addrs = (volatile void *)(base_addr | 0x10);
                   ^
.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c:76:19: error: cast to pointer
from integer of different size [-Werror=int-to-pointer-cast]
  indirect_addrs = (volatile void *)(base_addr | 0x18);
                   ^

.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c: In function ‘ipn3ke_indirect_write’:
.../dpdk/drivers/net/ipn3ke/ipn3ke_ethdev.c:118:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

  indirect_addrs = (volatile void *)(base_addr | 0x10);
                   ^

cc1: all warnings being treated as errors
make[7]: *** [.../dpdk/mk/internal/rte.compile-pre.mk:116:
ipn3ke_ethdev.o] Error 1
make[7]: *** Waiting for unfinished jobs....
In file included from .../dpdk/drivers/net/ipn3ke/ipn3ke_representor.c:25:
.../dpdk/drivers/net/ipn3ke/ipn3ke_representor.c: In function ‘ipn3ke_update_link’:
.../dpdk/drivers/net/ipn3ke/ipn3ke_logs.h:13:49: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]

  rte_log(RTE_LOG_ ## level, ipn3ke_afu_logtype, "ipn3ke_afu: " fmt, \
                                                 ^~~~~~~~~~~~~~

.../dpdk/drivers/net/ipn3ke/ipn3ke_logs.h:19:2: note: in expansion of macro ‘IPN3KE_AFU_PMD_LOG’
IPN3KE_AFU_PMD_LOG(DEBUG, fmt, ## args)
^~~~~~~~~~~~~~~~~~
.../dpdk/drivers/net/ipn3ke/ipn3ke_representor.c:388:2: note: in expansion of macro ‘IPN3KE_AFU_PMD_DEBUG’
IPN3KE_AFU_PMD_DEBUG("line_link_bitmap is %lx\n", line_link_bitmap); ^~~~~~~~~~~~~~~~~~~~
.../dpdk/drivers/net/ipn3ke/ipn3ke_representor.c:388:46: note: format string is defined here

  IPN3KE_AFU_PMD_DEBUG("line_link_bitmap is %lx\n", line_link_bitmap);
                                            ~~^
                                            %llx

cc1: all warnings being treated as errors

[2] .../dpdk/drivers/raw/ifpga_rawdev/base/opae_intel_max10.c:6:10: fatal error:
libfdt.h: No such file or directory

 #include <libfdt.h>
          ^~~~~~~~~~

[3]
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_init':
ipn3ke_representor.c:(.text+0xc8b): undefined reference to `pthread_create'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xca8): undefined reference to `pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xcbe): undefined reference to `pthread_join'
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_uninit':
ipn3ke_representor.c:(.text+0xd6b): undefined reference to `pthread_create'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xd88): undefined reference to `pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xd9e): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_init':
ipn3ke_representor.c:(.text+0xc8b): undefined reference to `pthread_create'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xca8): undefined reference to `pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xcbe): undefined reference to `pthread_join'
/usr/bin/ld: ipn3ke_representor.o: in function `ipn3ke_rpst_uninit':
ipn3ke_representor.c:(.text+0xd6b): undefined reference to `pthread_create'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xd88): undefined reference to `pthread_cancel'
/usr/bin/ld: ipn3ke_representor.c:(.text+0xd9e): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status

author
#59 lore raw

v3 cover Add patch set for IPN3KE

In reply to Rosen Xu

From: "Xu, Rosen" <[email protected]>

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        |    3 +-
 drivers/net/Makefile                               |    1 +
 drivers/net/ipn3ke/Makefile                        |   39 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c                 |  728 +++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h                 |  898 +++++++++
 drivers/net/ipn3ke/ipn3ke_flow.c                   | 1400 +++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h                   |   86 +
 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                     | 2082 ++++++++++++++++++++
 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, 10331 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
#60 lore raw

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

From: Rosen Xu <[email protected]>

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
#61 lore raw

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

In reply to Xu, Rosen

From: Rosen Xu <[email protected]>

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 |  3 ++-
 3 files changed, 24 insertions(+), 1 deletion(-)
drivers/bus/ifpga/ifpga_bus.c +13 -0
index 55d3abf..dfd6b1f 100644
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
 	return NULL;
 }
 
+struct rte_afu_device *
+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..88a6289 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_ifpga_find_afu_by_name(const char *name);
+
+/**
  * Register a ifpga afu device driver.
  *
  * @param driver
drivers/bus/ifpga/rte_bus_ifpga_version.map +2 -1
index a027979..8f9b781 100644
@@ -1,6 +1,7 @@
-DPDK_18.05 {
+DPDK_19.05 {
 	global:
 
+	rte_ifpga_find_afu_by_name;
 	rte_ifpga_get_integer32_arg;
 	rte_ifpga_get_string_arg;
 	rte_ifpga_driver_register;
Signature · 1 line
1.8.3.1
author
#62 lore raw

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

In reply to Xu, Rosen

From: Rosen Xu <[email protected]>

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            | 706 ++++++++++++++++++++
 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, 1906 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 +706 -0

706 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
author
#63 lore raw

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

In reply to Xu, Rosen

From: Rosen Xu <[email protected]>

Add Intel FPGA Acceleration NIC IPN3KE representor of PMD driver.

---
 drivers/net/ipn3ke/Makefile             |   1 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c      |  14 +
 drivers/net/ipn3ke/ipn3ke_representor.c | 962 ++++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/meson.build          |   3 +-
 4 files changed, 979 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 +14 -0
index 8d5292c..d133b91 100644
@@ -404,11 +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;
@@ -432,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 +962 -0

962 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
author
#64 lore raw

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

In reply to Xu, Rosen

From: Rosen Xu <[email protected]>

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 |    4 +-
 drivers/net/ipn3ke/ipn3ke_tm.c          | 2081 +++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/meson.build          |    3 +-
 6 files changed, 2096 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 d133b91..7c9a97a 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 9c00b0e..ed8d523 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 +3 -1
index 3881a99..7020130 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,8 @@ 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 */
 	/**
drivers/net/ipn3ke/ipn3ke_tm.c new file +2081 -0

2,081 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
#65 lore raw

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

In reply to Xu, Rosen

From: Rosen Xu <[email protected]>

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        | 1400 +++++++++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_flow.h        |   86 ++
 drivers/net/ipn3ke/ipn3ke_representor.c |    3 +-
 drivers/net/ipn3ke/ipn3ke_tm.c          |    1 +
 drivers/net/ipn3ke/meson.build          |    3 +-
 8 files changed, 1498 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 +5 -0
index 7c9a97a..e71be3e 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"
 
@@ -319,6 +320,10 @@ static int ipn3ke_indirect_mac_write(struct ipn3ke_hw *hw,
 			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 ed8d523..6b36f09 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 +1400 -0

1,400 lines not on this page · raw message

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

86 lines not on this page · raw message

drivers/net/ipn3ke/ipn3ke_representor.c +2 -1
index 7020130..37d7b13 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 3aaa61e..0b9be57 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
#66 lore raw

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

In reply to Xu, Rosen

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
#67 lore raw

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

In reply to Xu, Rosen

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
#68 lore raw

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

In reply to Xu, Rosen

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
#69 lore raw

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

In reply to Xu, Rosen

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
#70 lore raw

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

In reply to Xu, Rosen

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
#71 lore raw

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

In reply to Xu, Rosen

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
#72 lore raw

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

In reply to Xu, Rosen

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
#73 lore raw

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

In reply to Xu, Rosen

From: Rosen Xu <[email protected]>

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
#74 lore raw

v4 cover Add patch set for IPN3KE

In reply to Rosen Xu

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        |    3 +-
 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, 10352 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
#75 lore raw

PATCH v4 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
#76 lore raw

PATCH v4 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 |  3 ++-
 3 files changed, 24 insertions(+), 1 deletion(-)
drivers/bus/ifpga/ifpga_bus.c +13 -0
index 55d3abf..dfd6b1f 100644
@@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
 	return NULL;
 }
 
+struct rte_afu_device *
+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..88a6289 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_ifpga_find_afu_by_name(const char *name);
+
+/**
  * Register a ifpga afu device driver.
  *
  * @param driver
drivers/bus/ifpga/rte_bus_ifpga_version.map +2 -1
index a027979..8f9b781 100644
@@ -1,6 +1,7 @@
-DPDK_18.05 {
+DPDK_19.05 {
 	global:
 
+	rte_ifpga_find_afu_by_name;
 	rte_ifpga_get_integer32_arg;
 	rte_ifpga_get_string_arg;
 	rte_ifpga_driver_register;
Signature · 1 line
1.8.3.1
author
#77 lore raw

PATCH v4 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
author
#78 lore raw

PATCH v4 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
author
#79 lore raw

PATCH v4 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
#80 lore raw

PATCH v4 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
#81 lore raw

PATCH v4 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