Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/112584/?format=api
https://patches.dpdk.org/api/patches/112584/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1654742650-7214-5-git-send-email-wei.huang@intel.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1654742650-7214-5-git-send-email-wei.huang@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1654742650-7214-5-git-send-email-wei.huang@intel.com", "date": "2022-06-09T02:44:09", "name": "[v6,4/5] raw/ifpga: add HE-MEM AFU driver", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "8eaae4132c370c7124401de92307150e97df36b6", "submitter": { "id": 2033, "url": "https://patches.dpdk.org/api/people/2033/?format=api", "name": "Wei Huang", "email": "wei.huang@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1654742650-7214-5-git-send-email-wei.huang@intel.com/mbox/", "series": [ { "id": 23427, "url": "https://patches.dpdk.org/api/series/23427/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=23427", "date": "2022-06-09T02:44:05", "name": "introduce AFU PMD driver of FPGA", "version": 6, "mbox": "https://patches.dpdk.org/series/23427/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/112584/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/112584/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id AE327A0547;\n\tThu, 9 Jun 2022 04:37:09 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2F7764282C;\n\tThu, 9 Jun 2022 04:36:48 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id BFC4142B6E;\n Thu, 9 Jun 2022 04:36:45 +0200 (CEST)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Jun 2022 19:36:45 -0700", "from unknown (HELO zj-fpga-amt.sh.intel.com) ([10.238.175.102])\n by fmsmga006.fm.intel.com with ESMTP; 08 Jun 2022 19:36:43 -0700" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1654742206; x=1686278206;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=98Mc+5c6Ed41KmRIvylx+wpG0AlaKIepWL4K+WrdSN8=;\n b=iu5URBxRJLeRYWAPJ1JKNUFZHohL90O7qpapt+r/98ZPVnlGpdtLLTf0\n 9redcw0Vnql7+ikt+P3WegGPVEP5XUERCZmjQq/IWy/ThvB+3HK+P80YX\n 4+fQsZVtI0K4QdVDS6YmF6sHavMdFWyQKUeBmSefmbfR3kG6Ivt4VyjZR\n BriIj48JGvhqejDdVFuewSaz8ejv9Jbj7Dt1PlpA1zLTtGWm15yNvqy+h\n suPpYw0FQjaoEGa0Nz7L/uD1aJUFRNqwZ5Gsi8d6fQGsE1ZXi8rbQLAeg\n soNqxqTJRfrZlevFfO1ADVstFFC3XxjH3YMHebAvxlk/Nxr0qgMjWijNm g==;", "X-IronPort-AV": [ "E=McAfee;i=\"6400,9594,10372\"; a=\"277146317\"", "E=Sophos;i=\"5.91,287,1647327600\"; d=\"scan'208\";a=\"277146317\"", "E=Sophos;i=\"5.91,287,1647327600\"; d=\"scan'208\";a=\"827300433\"" ], "X-ExtLoop1": "1", "From": "Wei Huang <wei.huang@intel.com>", "To": "dev@dpdk.org, thomas@monjalon.net, nipun.gupta@nxp.com,\n hemant.agrawal@nxp.com", "Cc": "stable@dpdk.org, rosen.xu@intel.com, tianfei.zhang@intel.com,\n qi.z.zhang@intel.com, Wei Huang <wei.huang@intel.com>", "Subject": "[PATCH v6 4/5] raw/ifpga: add HE-MEM AFU driver", "Date": "Wed, 8 Jun 2022 22:44:09 -0400", "Message-Id": "<1654742650-7214-5-git-send-email-wei.huang@intel.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1654742650-7214-1-git-send-email-wei.huang@intel.com>", "References": "<1653629824-4535-1-git-send-email-wei.huang@intel.com>\n <1654742650-7214-1-git-send-email-wei.huang@intel.com>", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "HE-MEM is one of the host exerciser modules in OFS FPGA,\nwhich is used to test local memory with built-in traffic\ngenerator.\nThis driver initialize the module and report test result.\n\nSigned-off-by: Wei Huang <wei.huang@intel.com>\n---\n drivers/raw/ifpga/afu_pmd_he_mem.c | 183 +++++++++++++++++++++++++++++++++++++\n drivers/raw/ifpga/afu_pmd_he_mem.h | 46 ++++++++++\n drivers/raw/ifpga/meson.build | 2 +-\n drivers/raw/ifpga/rte_pmd_afu.h | 7 ++\n 4 files changed, 237 insertions(+), 1 deletion(-)\n create mode 100644 drivers/raw/ifpga/afu_pmd_he_mem.c\n create mode 100644 drivers/raw/ifpga/afu_pmd_he_mem.h", "diff": "diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c\nnew file mode 100644\nindex 0000000..0f57a03\n--- /dev/null\n+++ b/drivers/raw/ifpga/afu_pmd_he_mem.c\n@@ -0,0 +1,183 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2022 Intel Corporation\n+ */\n+\n+#include <errno.h>\n+#include <stdio.h>\n+#include <stdint.h>\n+#include <stdlib.h>\n+#include <unistd.h>\n+#include <fcntl.h>\n+#include <poll.h>\n+#include <sys/eventfd.h>\n+#include <sys/ioctl.h>\n+\n+#include <rte_eal.h>\n+#include <rte_malloc.h>\n+#include <rte_memcpy.h>\n+#include <rte_io.h>\n+#include <rte_vfio.h>\n+#include <rte_bus_pci.h>\n+#include <rte_bus_ifpga.h>\n+#include <rte_rawdev.h>\n+\n+#include \"afu_pmd_core.h\"\n+#include \"afu_pmd_he_mem.h\"\n+\n+static int he_mem_tg_test(struct afu_rawdev *dev)\n+{\n+\tstruct he_mem_tg_priv *priv = NULL;\n+\tstruct rte_pmd_afu_he_mem_tg_cfg *cfg = NULL;\n+\tstruct he_mem_tg_ctx *ctx = NULL;\n+\tuint64_t value = 0x12345678;\n+\tuint64_t cap = 0;\n+\tuint64_t channel_mask = 0;\n+\tint i, t = 0;\n+\n+\tif (!dev)\n+\t\treturn -EINVAL;\n+\n+\tpriv = (struct he_mem_tg_priv *)dev->priv;\n+\tif (!priv)\n+\t\treturn -ENOENT;\n+\n+\tcfg = &priv->he_mem_tg_cfg;\n+\tctx = &priv->he_mem_tg_ctx;\n+\n+\tIFPGA_RAWDEV_PMD_DEBUG(\"Channel mask: 0x%x\", cfg->channel_mask);\n+\n+\trte_write64(value, ctx->addr + MEM_TG_SCRATCHPAD);\n+\tcap = rte_read64(ctx->addr + MEM_TG_SCRATCHPAD);\n+\tIFPGA_RAWDEV_PMD_DEBUG(\"Scratchpad value: 0x%\"PRIx64, cap);\n+\tif (cap != value) {\n+\t\tIFPGA_RAWDEV_PMD_ERR(\"Test scratchpad register failed\");\n+\t\treturn -EIO;\n+\t}\n+\n+\tcap = rte_read64(ctx->addr + MEM_TG_CTRL);\n+\tIFPGA_RAWDEV_PMD_DEBUG(\"Capability: 0x%\"PRIx64, cap);\n+\n+\tchannel_mask = cfg->channel_mask & cap;\n+\t/* start traffic generators */\n+\trte_write64(channel_mask, ctx->addr + MEM_TG_CTRL);\n+\n+\t/* check test status */\n+\twhile (t < MEM_TG_TIMEOUT_MS) {\n+\t\tvalue = rte_read64(ctx->addr + MEM_TG_STAT);\n+\t\tfor (i = 0; i < NUM_MEM_TG_CHANNELS; i++) {\n+\t\t\tif (channel_mask & (1 << i)) {\n+\t\t\t\tif (TGACTIVE(value, i))\n+\t\t\t\t\tcontinue;\n+\t\t\t\tprintf(\"TG channel %d test %s\\n\", i,\n+\t\t\t\t\tTGPASS(value, i) ? \"pass\" :\n+\t\t\t\t\tTGTIMEOUT(value, i) ? \"timeout\" :\n+\t\t\t\t\tTGFAIL(value, i) ? \"fail\" : \"error\");\n+\t\t\t\tchannel_mask &= ~(1 << i);\n+\t\t\t}\n+\t\t}\n+\t\tif (!channel_mask)\n+\t\t\tbreak;\n+\t\trte_delay_ms(MEM_TG_POLL_INTERVAL_MS);\n+\t\tt += MEM_TG_POLL_INTERVAL_MS;\n+\t}\n+\n+\tif (channel_mask) {\n+\t\tIFPGA_RAWDEV_PMD_ERR(\"Timeout 0x%04lx\", (unsigned long)value);\n+\t\treturn channel_mask;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int he_mem_tg_init(struct afu_rawdev *dev)\n+{\n+\tstruct he_mem_tg_priv *priv = NULL;\n+\tstruct he_mem_tg_ctx *ctx = NULL;\n+\n+\tif (!dev)\n+\t\treturn -EINVAL;\n+\n+\tpriv = (struct he_mem_tg_priv *)dev->priv;\n+\tif (!priv) {\n+\t\tpriv = rte_zmalloc(NULL, sizeof(struct he_mem_tg_priv), 0);\n+\t\tif (!priv)\n+\t\t\treturn -ENOMEM;\n+\t\tdev->priv = priv;\n+\t}\n+\n+\tctx = &priv->he_mem_tg_ctx;\n+\tctx->addr = (uint8_t *)dev->addr;\n+\n+\treturn 0;\n+}\n+\n+static int he_mem_tg_config(struct afu_rawdev *dev, void *config,\n+\tsize_t config_size)\n+{\n+\tstruct he_mem_tg_priv *priv = NULL;\n+\n+\tif (!dev || !config || !config_size)\n+\t\treturn -EINVAL;\n+\n+\tpriv = (struct he_mem_tg_priv *)dev->priv;\n+\tif (!priv)\n+\t\treturn -ENOENT;\n+\n+\tif (config_size != sizeof(struct rte_pmd_afu_he_mem_tg_cfg))\n+\t\treturn -EINVAL;\n+\n+\trte_memcpy(&priv->he_mem_tg_cfg, config, sizeof(priv->he_mem_tg_cfg));\n+\n+\treturn 0;\n+}\n+\n+static int he_mem_tg_close(struct afu_rawdev *dev)\n+{\n+\tif (!dev)\n+\t\treturn -EINVAL;\n+\n+\trte_free(dev->priv);\n+\tdev->priv = NULL;\n+\n+\treturn 0;\n+}\n+\n+static int he_mem_tg_dump(struct afu_rawdev *dev, FILE *f)\n+{\n+\tstruct he_mem_tg_priv *priv = NULL;\n+\tstruct he_mem_tg_ctx *ctx = NULL;\n+\n+\tif (!dev)\n+\t\treturn -EINVAL;\n+\n+\tpriv = (struct he_mem_tg_priv *)dev->priv;\n+\tif (!priv)\n+\t\treturn -ENOENT;\n+\n+\tif (!f)\n+\t\tf = stdout;\n+\n+\tctx = &priv->he_mem_tg_ctx;\n+\n+\tfprintf(f, \"addr:\\t\\t%p\\n\", (void *)ctx->addr);\n+\n+\treturn 0;\n+}\n+\n+static struct afu_ops he_mem_tg_ops = {\n+\t.init = he_mem_tg_init,\n+\t.config = he_mem_tg_config,\n+\t.start = NULL,\n+\t.stop = NULL,\n+\t.test = he_mem_tg_test,\n+\t.close = he_mem_tg_close,\n+\t.dump = he_mem_tg_dump,\n+\t.reset = NULL\n+};\n+\n+struct afu_rawdev_drv he_mem_tg_drv = {\n+\t.uuid = { HE_MEM_TG_UUID_L, HE_MEM_TG_UUID_H },\n+\t.ops = &he_mem_tg_ops\n+};\n+\n+AFU_PMD_REGISTER(he_mem_tg_drv);\ndiff --git a/drivers/raw/ifpga/afu_pmd_he_mem.h b/drivers/raw/ifpga/afu_pmd_he_mem.h\nnew file mode 100644\nindex 0000000..5549687\n--- /dev/null\n+++ b/drivers/raw/ifpga/afu_pmd_he_mem.h\n@@ -0,0 +1,46 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2022 Intel Corporation\n+ */\n+\n+#ifndef _AFU_PMD_HE_MEM_H_\n+#define _AFU_PMD_HE_MEM_H_\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include \"afu_pmd_core.h\"\n+#include \"rte_pmd_afu.h\"\n+\n+#define HE_MEM_TG_UUID_L 0xa3dc5b831f5cecbb\n+#define HE_MEM_TG_UUID_H 0x4dadea342c7848cb\n+\n+#define NUM_MEM_TG_CHANNELS 4\n+#define MEM_TG_TIMEOUT_MS 5000\n+#define MEM_TG_POLL_INTERVAL_MS 10\n+\n+/* MEM-TG registers definition */\n+#define MEM_TG_SCRATCHPAD 0x28\n+#define MEM_TG_CTRL 0x30\n+#define TGCONTROL(n) (1 << (n))\n+#define MEM_TG_STAT 0x38\n+#define TGSTATUS(v, n) (((v) >> (n << 2)) & 0xf)\n+#define TGPASS(v, n) (((v) >> ((n << 2) + 3)) & 0x1)\n+#define TGFAIL(v, n) (((v) >> ((n << 2) + 2)) & 0x1)\n+#define TGTIMEOUT(v, n) (((v) >> ((n << 2) + 1)) & 0x1)\n+#define TGACTIVE(v, n) (((v) >> (n << 2)) & 0x1)\n+\n+struct he_mem_tg_ctx {\n+\tuint8_t *addr;\n+};\n+\n+struct he_mem_tg_priv {\n+\tstruct rte_pmd_afu_he_mem_tg_cfg he_mem_tg_cfg;\n+\tstruct he_mem_tg_ctx he_mem_tg_ctx;\n+};\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _AFU_PMD_HE_MEM_H_ */\ndiff --git a/drivers/raw/ifpga/meson.build b/drivers/raw/ifpga/meson.build\nindex 629ff8a..dc6941d 100644\n--- a/drivers/raw/ifpga/meson.build\n+++ b/drivers/raw/ifpga/meson.build\n@@ -14,7 +14,7 @@ deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs',\n 'bus_vdev', 'bus_ifpga', 'net', 'net_i40e', 'net_ipn3ke']\n \n sources = files('ifpga_rawdev.c', 'rte_pmd_ifpga.c', 'afu_pmd_core.c',\n- 'afu_pmd_n3000.c', 'afu_pmd_he_lpbk.c')\n+ 'afu_pmd_n3000.c', 'afu_pmd_he_lpbk.c', 'afu_pmd_he_mem.c')\n \n includes += include_directories('base')\n includes += include_directories('../../net/ipn3ke')\ndiff --git a/drivers/raw/ifpga/rte_pmd_afu.h b/drivers/raw/ifpga/rte_pmd_afu.h\nindex 19b3902..213e854 100644\n--- a/drivers/raw/ifpga/rte_pmd_afu.h\n+++ b/drivers/raw/ifpga/rte_pmd_afu.h\n@@ -104,6 +104,13 @@ struct rte_pmd_afu_he_lpbk_cfg {\n \tuint32_t freq_mhz;\n };\n \n+/**\n+ * HE-MEM-TG AFU configuration data structure.\n+ */\n+struct rte_pmd_afu_he_mem_tg_cfg {\n+\tuint32_t channel_mask; /* mask of traffic generator channel */\n+};\n+\n #ifdef __cplusplus\n }\n #endif\n", "prefixes": [ "v6", "4/5" ] }{ "id": 112584, "url": "