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

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

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

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE representor of PMD driver.

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

887 lines not on this page · raw message

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

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

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE TM of PMD driver.

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

2,068 lines not on this page · raw message

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

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

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE Flow of PMD driver.

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

1,374 lines not on this page · raw message

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

106 lines not on this page · raw message

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

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

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

546 lines not on this page · raw message

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

199 lines not on this page · raw message

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

92 lines not on this page · raw message

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

205 lines not on this page · raw message

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

88 lines not on this page · raw message

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

60 lines not on this page · raw message

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

304 lines not on this page · raw message

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

160 lines not on this page · raw message

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

438 lines not on this page · raw message

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

99 lines not on this page · raw message

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

88 lines not on this page · raw message

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

69 lines not on this page · raw message

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

490 lines not on this page · raw message

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

130 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author
#162 lore raw

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

98 lines not on this page · raw message

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

271 lines not on this page · raw message

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

145 lines not on this page · raw message

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

96 lines not on this page · raw message

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

152 lines not on this page · raw message

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

54 lines not on this page · raw message

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

add verion description on READ about ifpga base code.

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

114 lines not on this page · raw message

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

268 lines not on this page · raw message

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

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

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE support for IFPGA Rawdev.

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

306 lines not on this page · raw message

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

Re: [dpdk-dev] [PATCH v8 14/14] raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Quoted 5 lines · Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE support for IFPGA Rawdev.

<...>

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 144

Quoted 9 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +5 -0
@@ -128,6 +137,45 @@
 			return;
 		}
 	}
+
+	/* get opae_manager to rawdev */
+	mgr = opae_adapter_get_mgr(adapter);
+	if (mgr) {
+		//get LineSide BAR Index

Please prefer c89 comments, /* */

<...>

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 557

Quoted 5 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +5 -0
+	}
+	if (!strcmp(attr_name, "NICSideLinkStatus")) {
+		/*
+		 *
+		 */

Please add some comments or drop.

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 569

Quoted 12 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +12 -0
+		return 0;
+	}
+	if (!strcmp(attr_name, "NICSideBARIndex")) {
+		/* eth_group 1 on FPGA connect to NicSide */
+		if (opae_manager_get_eth_group_region_info(mgr, 1,
+			&opae_eth_grp_reg_info))
+			return -1;
+		*attr_value = (uint64_t)opae_eth_grp_reg_info.mem_idx;
+		return 0;
+	}
+
+	IFPGA_RAWDEV_PMD_ERR("attr_name not support");

It can be useful to print requested attr_name

<...>

drivers/raw/ifpga_rawdev/ifpga_rawdev.h line 12

Quoted 8 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.h +2 -2
@@ -8,8 +8,8 @@
 extern int ifpga_rawdev_logtype;
 
 #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "%s(): " fmt "\n", \
-				__func__, ##args)
+	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifpga_rawdev: " fmt, \
+		##args)

Are you sure about this change? Another commit in this release [1] updates "ifgpa" -> "%s", __func__; but this commit revert it back to "ifpga_rawdev: "

[1]
Fixes a3a6a3d94f7e ("raw/ifpga: modify log output")
author
#167 lore raw

Re: [dpdk-dev] [PATCH v8 14/14] raw/ifpga_rawdev: add IPN3KE support for IFPGA Rawdev

Hi Ferruh,

Quoted 21 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, April 15, 2019 20:29
To: Xu, Rosen <[email protected]>; [email protected]
Cc: Zhang, Tianfei <[email protected]>; Wei, Dan <[email protected]>; Pei, Andy <[email protected]>; Yang, Qiming <[email protected]>; Wang, Haiyue <[email protected]>; Chen, Santos <[email protected]>; Zhang, Zhang <[email protected]>; Lomartire, David <[email protected]>; Hu, Jia <[email protected]>
Subject: Re: [PATCH v8 14/14] 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 11 lines

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 144

Quoted 9 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +5 -0
@@ -128,6 +137,45 @@
 			return;
 		}
 	}
+
+	/* get opae_manager to rawdev */
+	mgr = opae_adapter_get_mgr(adapter);
+	if (mgr) {
+		//get LineSide BAR Index

Please prefer c89 comments, /* */

Fixed in v9.

Quoted 9 lines

<...>

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 557

Quoted 5 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +5 -0
+	}
+	if (!strcmp(attr_name, "NICSideLinkStatus")) {
+		/*
+		 *
+		 */

Please add some comments or drop.

Dropped in v9.

Quoted 6 lines
Quoted 6 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +6 -0
+		return 0;
+	}
+	if (!strcmp(attr_name, "NICSideBARIndex")) {
+		/* eth_group 1 on FPGA connect to NicSide */
+		if (opae_manager_get_eth_group_region_info(mgr, 1,
+			&opae_eth_grp_reg_info))
Quoted 8 lines

drivers/raw/ifpga_rawdev/ifpga_rawdev.c line 569

Quoted 6 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +6 -0
+			return -1;
+		*attr_value = (uint64_t)opae_eth_grp_reg_info.mem_idx;
+		return 0;
+	}
+
+	IFPGA_RAWDEV_PMD_ERR("attr_name not support");

It can be useful to print requested attr_name

Added in v9.

Quoted 10 lines

<...>

drivers/raw/ifpga_rawdev/ifpga_rawdev.h line 11

Quoted 7 lines
drivers/raw/ifpga_rawdev/ifpga_rawdev.h +1 -2
@@ -8,8 +8,8 @@
 extern int ifpga_rawdev_logtype;
 
 #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "%s(): " fmt "\n", \
-				__func__, ##args)
+	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "ifpga_rawdev: "

fmt, \

Quoted 8 lines

drivers/raw/ifpga_rawdev/ifpga_rawdev.h line 12

Quoted 1 line
drivers/raw/ifpga_rawdev/ifpga_rawdev.h +1 -0
+		##args)

Are you sure about this change? Another commit in this release [1] updates "ifgpa" -> "%s", __func__; but this commit revert it back to "ifpga_rawdev: "

[1]
Fixes a3a6a3d94f7e ("raw/ifpga: modify log output")

Thanks you reminder, dropped this change in v9.

#168 lore raw
In reply to Rosen Xu
Quoted 58 lines · Rosen Xu

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

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

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

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

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

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

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

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

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

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

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

Quoted 8 lines

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

Hi Rosen,

Overall patchset looks good to me, only there are a few minor issues I have put comment on individual patches, can you please check them?

Thanks,
ferruh

author
#169 lore raw
Quoted 82 lines

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

Quoted 59 lines · Rosen Xu

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

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

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

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

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

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

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

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

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

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

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

Quoted 8 lines

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

Quoted 7 lines

Hi Rosen,

Overall patchset looks good to me, only there are a few minor issues I have put comment on individual patches, can you please check them?

Thanks,
ferruh

Okay

author
#170 lore raw

v9 cover Add patch set for IPN3KE

In reply to Rosen Xu

v9 updates:
=========
- Fix v8 comments
- 02/14 patch check error, just follow Ferruh's v8 comments

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

In reply to Rosen Xu

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

---
 drivers/bus/ifpga/ifpga_bus.c               | 13 +++++++++++++
 drivers/bus/ifpga/rte_bus_ifpga.h           |  9 +++++++++
 drivers/bus/ifpga/rte_bus_ifpga_version.map |  9 +++++++++
 3 files changed, 31 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 +9 -0
index a027979..51b1353 100644
@@ -8,3 +8,12 @@ DPDK_18.05 {
 
 	local: *;
 };
+
+DPDK_19.05 {
+	global:
+
+	rte_ifpga_find_afu_by_name;
+
+	local: *;
+};
+
Signature · 1 line
1.8.3.1
#173 lore raw

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

Quoted 62 lines · Rosen Xu

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

---
 drivers/bus/ifpga/ifpga_bus.c               | 13 +++++++++++++
 drivers/bus/ifpga/rte_bus_ifpga.h           |  9 +++++++++
 drivers/bus/ifpga/rte_bus_ifpga_version.map |  9 +++++++++
 3 files changed, 31 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 +0 -0
index a027979..51b1353 100644
@@ -8,3 +8,12 @@ DPDK_18.05 {
 
 	local: *;

drivers/bus/ifpga/rte_bus_ifpga_version.map DPDK_18.05 { · line 19

Quoted 10 lines
drivers/bus/ifpga/rte_bus_ifpga_version.map +9 -0
 };
+
+DPDK_19.05 {
+	global:
+
+	rte_ifpga_find_afu_by_name;
+
+	local: *;
+};
+

syntax is slightly different [1] but I can fix while merging.

[1]

DPDK_19.05 {
       global:

       rte_ifpga_find_afu_by_name;

} DPDK_18.05;

no 'local: *;' except first one, and later ones has a reference at the end of the block 'DPDK_18.05;'

author
#174 lore raw

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

Quoted 77 lines

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

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

Quoted 16 lines · Rosen Xu

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

---
 drivers/bus/ifpga/ifpga_bus.c               | 13 +++++++++++++
 drivers/bus/ifpga/rte_bus_ifpga.h           |  9 +++++++++
 drivers/bus/ifpga/rte_bus_ifpga_version.map |  9 +++++++++
 3 files changed, 31 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 45 lines
drivers/bus/ifpga/ifpga_bus.c +12 -0
 	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 +0 -0
index a027979..51b1353 100644
@@ -8,3 +8,12 @@ DPDK_18.05 {
 
Quoted 13 lines

drivers/bus/ifpga/rte_bus_ifpga_version.map DPDK_18.05 { · line 19

Quoted 11 lines
drivers/bus/ifpga/rte_bus_ifpga_version.map +9 -0
 	local: *;
 };
+
+DPDK_19.05 {
+	global:
+
+	rte_ifpga_find_afu_by_name;
+
+	local: *;
+};
+

syntax is slightly different [1] but I can fix while merging.

Thanks Ferruh.

Quoted 10 lines

[1]

DPDK_19.05 {
       global:

       rte_ifpga_find_afu_by_name;

} DPDK_18.05;

no 'local: *;' except first one, and later ones has a reference at the end of the block 'DPDK_18.05;'

author
#175 lore raw

PATCH v9 3/14 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                    | 107 +++
 drivers/net/Makefile                          |   1 +
 drivers/net/ipn3ke/Makefile                   |  36 +
 drivers/net/ipn3ke/ipn3ke_ethdev.c            | 645 ++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_ethdev.h            | 942 ++++++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_logs.h              |  30 +
 drivers/net/ipn3ke/ipn3ke_rawdev_api.h        |  62 ++
 drivers/net/ipn3ke/meson.build                |  14 +
 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map |   4 +
 drivers/net/meson.build                       |   1 +
 mk/rte.app.mk                                 |   1 +
 usertools/dpdk-devbind.py                     |   4 +-
 16 files changed, 1913 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/nics/features/ipn3ke.ini
 create mode 100644 doc/guides/nics/ipn3ke.rst
 create mode 100644 drivers/net/ipn3ke/Makefile
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.c
 create mode 100644 drivers/net/ipn3ke/ipn3ke_ethdev.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_logs.h
 create mode 100644 drivers/net/ipn3ke/ipn3ke_rawdev_api.h
 create mode 100644 drivers/net/ipn3ke/meson.build
 create mode 100644 drivers/net/ipn3ke/rte_pmd_ipn3ke_version.map
MAINTAINERS +7 -0
index a085834..0d7cd71 100644
@@ -633,6 +633,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 7fb0ded..4236c2a 100644
@@ -328,6 +328,10 @@ CONFIG_RTE_LIBRTE_IAVF_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_IAVF_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_IAVF_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_IAVF_16BYTE_RX_DESC=n
+#
+# Compile burst-oriented IPN3KE PMD driver
+#
+CONFIG_RTE_LIBRTE_IPN3KE_PMD=y
 
 #
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD
doc/guides/nics/features/ipn3ke.ini new file +55 -0

55 lines not on this page · raw message

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

107 lines not on this page · raw message

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

645 lines not on this page · raw message

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

942 lines not on this page · raw message

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

62 lines not on this page · raw message

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

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

doc/guides/nics/ipn3ke.rst line 107

Quoted 7 lines · Rosen Xu
doc/guides/nics/ipn3ke.rst new file +7 -0
+Limitations or Known issues
+---------------------------
+
+19.05 limitation
+~~~~~~~~~~~~~~~~
+
+Ipn3ke code released in 19.05 is for evaluation only.

Hi Rosen,

What is the status of the driver, is it still "evaluation only" ?

author
#177 lore raw

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

Hi Ferruh,

No, thanks your reminder.

Thanks,
Rosen

Quoted 24 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, March 22, 2023 4:20 AM
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]>; [email protected]; [email protected]; Lomartire, David <[email protected]>; Hu, Jia <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v9 03/14] net/ipn3ke: add IPN3KE ethdev PMD driver

doc/guides/nics/ipn3ke.rst line 107

Quoted 7 lines · Rosen Xu
doc/guides/nics/ipn3ke.rst new file +7 -0
+Limitations or Known issues
+---------------------------
+
+19.05 limitation
+~~~~~~~~~~~~~~~~
+
+Ipn3ke code released in 19.05 is for evaluation only.

Hi Rosen,

What is the status of the driver, is it still "evaluation only" ?

author
#178 lore raw

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

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE representor of PMD driver.

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

887 lines not on this page · raw message

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

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

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE TM of PMD driver.

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

2,068 lines not on this page · raw message

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

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

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE Flow of PMD driver.

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

1,374 lines not on this page · raw message

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

106 lines not on this page · raw message

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

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

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

546 lines not on this page · raw message

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

199 lines not on this page · raw message

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

92 lines not on this page · raw message

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

205 lines not on this page · raw message

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

88 lines not on this page · raw message

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

60 lines not on this page · raw message

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

304 lines not on this page · raw message

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

160 lines not on this page · raw message

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

438 lines not on this page · raw message

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

99 lines not on this page · raw message

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

88 lines not on this page · raw message

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

69 lines not on this page · raw message

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

490 lines not on this page · raw message

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

130 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author
#185 lore raw

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

98 lines not on this page · raw message

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

271 lines not on this page · raw message

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

145 lines not on this page · raw message

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

96 lines not on this page · raw message

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

152 lines not on this page · raw message

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

54 lines not on this page · raw message

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

add verion description on READ about ifpga base code.

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

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

In reply to Rosen Xu

From: Tianfei zhang <[email protected]>

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

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

114 lines not on this page · raw message

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

268 lines not on this page · raw message

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

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

In reply to Rosen Xu

Add Intel FPGA Acceleration NIC IPN3KE support for IFPGA Rawdev.

---
 drivers/raw/ifpga_rawdev/Makefile       |   1 +
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 244 +++++++++++++++++++++++++++++++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.h |  12 ++
 drivers/raw/ifpga_rawdev/meson.build    |   6 +-
 4 files changed, 259 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 +241 -3

302 lines not on this page · raw message

drivers/raw/ifpga_rawdev/ifpga_rawdev.h +12 -0
index 234ce36..e153dba 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
#189 lore raw
In reply to Rosen Xu
Quoted 62 lines · Rosen Xu

v9 updates:
=========
- Fix v8 comments
- 02/14 patch check error, just follow Ferruh's v8 comments

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

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

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

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

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

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

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

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

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

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

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

Quoted 8 lines

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

Series applied to dpdk-next-net/master, thanks.

Can you please send a release notes patch, that updates:

- introduce new ipn3ke net driver
- updates on ifpga_rawdev

Thanks,
ferruh

#190 lore raw
Quoted 6 lines · Ferruh Yigit

Series applied to dpdk-next-net/master, thanks.

Can you please send a release notes patch, that updates:

- introduce new ipn3ke net driver
- updates on ifpga_rawdev

btw, after the patch has been merged to main repo, can you also send a web patch to announce the new net PMD in dpdk.org web site.

author
#191 lore raw
Quoted 16 lines

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

Quoted 2 lines · Ferruh Yigit

Series applied to dpdk-next-net/master, thanks.

Quoted 7 lines
Quoted 4 lines

Can you please send a release notes patch, that updates:

- introduce new ipn3ke net driver
- updates on ifpga_rawdev

btw, after the patch has been merged to main repo, can you also send a web patch to announce the new net PMD in dpdk.org web site.

Okay

author
#192 lore raw
In reply to Ferruh Yigit
Quoted 86 lines

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

Quoted 63 lines · Rosen Xu

v9 updates:
=========
- Fix v8 comments
- 02/14 patch check error, just follow Ferruh's v8 comments

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

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

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

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

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

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

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

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

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

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

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

Quoted 8 lines

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

Quoted 1 line

Series applied to dpdk-next-net/master, thanks.

Thanks.

Quoted 4 lines

Can you please send a release notes patch, that updates:

- introduce new ipn3ke net driver
- updates on ifpga_rawdev

Okay.

Quoted 2 lines

Thanks,
ferruh