Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/21235/?format=api
https://patches.dpdk.org/api/patches/21235/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1488525977-15321-11-git-send-email-beilei.xing@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": "<1488525977-15321-11-git-send-email-beilei.xing@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1488525977-15321-11-git-send-email-beilei.xing@intel.com", "date": "2017-03-03T07:26:15", "name": "[dpdk-dev,4/6] app/testpmd: add command for writing personalization profile", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2d073f9f429084de8bca0b08d7a56f41fb25614a", "submitter": { "id": 410, "url": "https://patches.dpdk.org/api/people/410/?format=api", "name": "Xing, Beilei", "email": "beilei.xing@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1488525977-15321-11-git-send-email-beilei.xing@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/21235/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/21235/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 7CB0BF966;\n\tFri, 3 Mar 2017 08:28:09 +0100 (CET)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 925FE2B93\n\tfor <dev@dpdk.org>; Fri, 3 Mar 2017 08:27:34 +0100 (CET)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 Mar 2017 23:27:33 -0800", "from unknown (HELO dpdk9.sh.intel.com) ([10.239.129.31])\n\tby FMSMGA003.fm.intel.com with ESMTP; 02 Mar 2017 23:27:33 -0800" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.35,235,1484035200\"; d=\"scan'208\";a=\"830442009\"", "From": "Beilei Xing <beilei.xing@intel.com>", "To": "jingjing.wu@intel.com", "Cc": "helin.zhang@intel.com,\n\tdev@dpdk.org", "Date": "Fri, 3 Mar 2017 15:26:15 +0800", "Message-Id": "<1488525977-15321-11-git-send-email-beilei.xing@intel.com>", "X-Mailer": "git-send-email 2.5.5", "In-Reply-To": "<1488525977-15321-1-git-send-email-beilei.xing@intel.com>", "References": "<1488525977-15321-1-git-send-email-beilei.xing@intel.com>", "Subject": "[dpdk-dev] [PATCH 4/6] app/testpmd: add command for writing\n\tpersonalization profile", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This patch is to add testpmd CLI for writing personalization\nprofile.\n\nSigned-off-by: Beilei Xing <beilei.xing@intel.com>\n---\n app/test-pmd/cmdline.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++\n app/test-pmd/config.c | 54 ++++++++++++++++++++++++++++++++++++++++++++\n app/test-pmd/testpmd.h | 3 +++\n 3 files changed, 118 insertions(+)", "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 43fc636..6b6af87 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -12395,6 +12395,66 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = {\n \t},\n };\n \n+/* Write Pipeline Personalization Profile */\n+struct cmd_write_ppp_result {\n+\tcmdline_fixed_string_t write;\n+\tcmdline_fixed_string_t ppp;\n+\tuint8_t port_id;\n+\tchar filename[];\n+};\n+\n+cmdline_parse_token_string_t cmd_write_ppp_write =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, write, \"write\");\n+cmdline_parse_token_string_t cmd_write_ppp_ppp =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, ppp, \"ppp\");\n+cmdline_parse_token_num_t cmd_write_ppp_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_write_ppp_result, port_id, UINT8);\n+cmdline_parse_token_string_t cmd_write_ppp_filename =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, filename, NULL);\n+\n+static void\n+cmd_write_ppp_parsed(\n+\tvoid *parsed_result,\n+\t__attribute__((unused)) struct cmdline *cl,\n+\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_write_ppp_result *res = parsed_result;\n+\tuint8_t *buff;\n+\tint ret = -ENOTSUP;\n+\n+\tif (res->port_id > nb_ports) {\n+\t\tprintf(\"Invalid port, range is [0, %d]\\n\", nb_ports - 1);\n+\t\treturn;\n+\t}\n+\n+\tif (!all_ports_stopped()) {\n+\t\tprintf(\"Please stop all ports first\\n\");\n+\t\treturn;\n+\t}\n+\n+\tbuff = open_package_file(res->filename);\n+\tif (!buff)\n+\t\treturn;\n+\n+\tret = i40e_process_package(res->port_id, buff);\n+\tif (ret < 0)\n+\t\tprintf(\"Failed to write profile.\\n\");\n+\n+\tclose_package_file(buff);\n+}\n+\n+cmdline_parse_inst_t cmd_write_ppp = {\n+\t.f = cmd_write_ppp_parsed,\n+\t.data = NULL,\n+\t.help_str = \"write ppp <port_id> <profile_name>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_write_ppp_write,\n+\t\t(void *)&cmd_write_ppp_ppp,\n+\t\t(void *)&cmd_write_ppp_port_id,\n+\t\t(void *)&cmd_write_ppp_filename,\n+\t\tNULL,\n+\t},\n+};\n /* ******************************************************************************** */\n \n /* list of instructions */\n@@ -12570,6 +12630,7 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_set_vf_allmulti,\n \t(cmdline_parse_inst_t *)&cmd_set_vf_broadcast,\n \t(cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag,\n+\t(cmdline_parse_inst_t *)&cmd_write_ppp,\n \tNULL,\n };\n \ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 80491fc..f520c42 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -3245,3 +3245,57 @@ port_dcb_info_display(uint8_t port_id)\n \t\tprintf(\"\\t%4d\", dcb_info.tc_queue.tc_txq[0][i].nb_queue);\n \tprintf(\"\\n\");\n }\n+\n+uint8_t *\n+open_package_file(const char *file_path)\n+{\n+\tFILE *fh = fopen(file_path, \"rb\");\n+\tuint32_t pkg_size;\n+\tuint8_t *buf = NULL;\n+\tint ret = 0;\n+\n+\tif (fh == NULL) {\n+\t\tprintf(\"%s: Failed to open %s\\n\", __func__, file_path);\n+\t\treturn buf;\n+\t}\n+\n+\tret = fseek(fh, 0, SEEK_END);\n+\tif (ret < 0) {\n+\t\tfclose(fh);\n+\t\tprintf(\"%s: File operations failed\\n\", __func__);\n+\t\treturn buf;\n+\t}\n+\n+\tpkg_size = ftell(fh);\n+\n+\tbuf = (uint8_t *)malloc(pkg_size);\n+\tif (!buf) {\n+\t\tfclose(fh);\n+\t\tprintf(\"%s: Failed to malloc memory\\n\",\t__func__);\n+\t\treturn buf;\n+\t}\n+\n+\tret = fseek(fh, 0, SEEK_SET);\n+\tif (ret < 0) {\n+\t\tfclose(fh);\n+\t\tprintf(\"%s: File operations failed\\n\", __func__);\n+\t\tclose_package_file(buf);\n+\t\treturn NULL;\n+\t}\n+\tfread(buf, 1, pkg_size, fh);\n+\n+\tfclose(fh);\n+\n+\treturn buf;\n+}\n+\n+int\n+close_package_file(uint8_t *buf)\n+{\n+\tif (buf) {\n+\t\tfree((void *)buf);\n+\t\treturn 0;\n+\t}\n+\n+\treturn -1;\n+}\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 8cf2860..2a7f683 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);\n void mcast_addr_remove(uint8_t port_id, struct ether_addr *mc_addr);\n void port_dcb_info_display(uint8_t port_id);\n \n+uint8_t *open_package_file(const char *file_path);\n+int close_package_file(uint8_t *buf);\n+\n enum print_warning {\n \tENABLED_WARN = 0,\n \tDISABLED_WARN\n", "prefixes": [ "dpdk-dev", "4/6" ] }{ "id": 21235, "url": "