Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/28072/?format=api
http://patches.dpdk.org/api/patches/28072/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1504075836-102681-2-git-send-email-kirill.rybalchenko@intel.com/", "project": { "id": 1, "url": "http://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": "<1504075836-102681-2-git-send-email-kirill.rybalchenko@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1504075836-102681-2-git-send-email-kirill.rybalchenko@intel.com", "date": "2017-08-30T06:50:35", "name": "[dpdk-dev,1/2] net/i40e: get information about protocols defined in ddp profile", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "9f37816d8304a8c3550bd0566285c1d18e9c6999", "submitter": { "id": 773, "url": "http://patches.dpdk.org/api/people/773/?format=api", "name": "Rybalchenko, Kirill", "email": "kirill.rybalchenko@intel.com" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1504075836-102681-2-git-send-email-kirill.rybalchenko@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/28072/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/28072/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 CCCDB2C17;\n\tWed, 30 Aug 2017 08:50:54 +0200 (CEST)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 29A422BF3\n\tfor <dev@dpdk.org>; Wed, 30 Aug 2017 08:50:52 +0200 (CEST)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Aug 2017 23:50:52 -0700", "from silpixa00389036.ir.intel.com (HELO\n\tsilpixa00389036.ger.corp.intel.com) ([10.237.223.231])\n\tby fmsmga001.fm.intel.com with ESMTP; 29 Aug 2017 23:50:50 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos; i=\"5.41,447,1498546800\"; d=\"scan'208\";\n\ta=\"1189686590\"", "From": "Kirill Rybalchenko <kirill.rybalchenko@intel.com>", "To": "dev@dpdk.org", "Cc": "kirill.rybalchenko@intel.com,\n\tandrey.chilikin@intel.com", "Date": "Wed, 30 Aug 2017 07:50:35 +0100", "Message-Id": "<1504075836-102681-2-git-send-email-kirill.rybalchenko@intel.com>", "X-Mailer": "git-send-email 2.5.5", "In-Reply-To": "<1504075836-102681-1-git-send-email-kirill.rybalchenko@intel.com>", "References": "<1504075836-102681-1-git-send-email-kirill.rybalchenko@intel.com>", "Subject": "[dpdk-dev] [PATCH 1/2] net/i40e: get information about protocols\n\tdefined in ddp 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 adds new package info types to get list of protocols,\npctypes and ptypes defined in a profile\n\nSigned-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>\n---\n drivers/net/i40e/rte_pmd_i40e.c | 155 ++++++++++++++++++++++++++++++++++++++++\n drivers/net/i40e/rte_pmd_i40e.h | 25 +++++++\n 2 files changed, 180 insertions(+)", "diff": "diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c\nindex d69a472..f232d09 100644\n--- a/drivers/net/i40e/rte_pmd_i40e.c\n+++ b/drivers/net/i40e/rte_pmd_i40e.c\n@@ -1706,6 +1706,27 @@ rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,\n \treturn status;\n }\n \n+\n+/* Get number of tvl records in the section */\n+static unsigned\n+i40e_get_tlv_section_size(struct i40e_profile_section_header *sec)\n+{\n+\tunsigned i, nb_rec, nb_tlv = 0;\n+\tstruct i40e_profile_tlv_section_record *tlv;\n+\n+\tif (sec == NULL)\n+\t\treturn nb_tlv;\n+\n+\t/* get number of records in the section */\n+\tnb_rec = sec->section.size / sizeof(struct i40e_profile_tlv_section_record);\n+\tfor (i = 0; i < nb_rec; ) {\n+\t\ttlv = (struct i40e_profile_tlv_section_record *)&sec[1 + i];\n+\t\ti += tlv->len;\n+\t\tnb_tlv++;\n+\t}\n+\treturn nb_tlv;\n+}\n+\n int rte_pmd_i40e_get_ddp_info(uint8_t *pkg_buff, uint32_t pkg_size,\n \tuint8_t *info_buff, uint32_t info_size,\n \tenum rte_pmd_i40e_package_info type)\n@@ -1860,6 +1881,140 @@ int rte_pmd_i40e_get_ddp_info(uint8_t *pkg_buff, uint32_t pkg_size,\n \t\treturn I40E_SUCCESS;\n \t}\n \n+\t/* get number of protocols */\n+\tif (type == RTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM) {\n+\t\tstruct i40e_profile_section_header *proto;\n+\t\tif (info_size < sizeof(uint32_t)) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Invalid information buffer size\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tproto = i40e_find_section_in_profile(SECTION_TYPE_PROTO,\n+\t\t\t(struct i40e_profile_segment *)i40e_seg_hdr);\n+\t\t*(uint32_t *)info_buff = i40e_get_tlv_section_size(proto);\n+\t\treturn I40E_SUCCESS;\n+\t}\n+\n+\t/* get list of protocols */\n+\tif (type == RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST) {\n+\t\tuint32_t i, j, nb_rec;\n+\t\tstruct rte_pmd_i40e_proto_info *pinfo;\n+\t\tstruct i40e_profile_section_header *proto;\n+\t\tstruct i40e_profile_tlv_section_record *tlv;\n+\t\tproto = i40e_find_section_in_profile(SECTION_TYPE_PROTO,\n+\t\t\t(struct i40e_profile_segment *)i40e_seg_hdr);\n+\t\tnb_rec = i40e_get_tlv_section_size(proto);\n+\t\tif (info_size < nb_rec) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Invalid information buffer size\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tpinfo = (struct rte_pmd_i40e_proto_info *)info_buff;\n+\t\tfor (i = 0; i < info_size; i++) {\n+\t\t\tpinfo[i].proto_id = RTE_PMD_I40E_PROTO_UNUSED;\n+\t\t\tmemset(pinfo[i].name, 0, RTE_PMD_I40E_DDP_NAME_SIZE);\n+\t\t}\n+\t\tif (nb_rec == 0)\n+\t\t\treturn I40E_SUCCESS;\n+\t\t/* get number of records in the section */\n+\t\tnb_rec = proto->section.size / sizeof(struct i40e_profile_tlv_section_record);\n+\t\ttlv = (struct i40e_profile_tlv_section_record *)&proto[1];\n+\t\tfor (i = j = 0; i < nb_rec; j++) {\n+\t\t\tpinfo[j].proto_id = tlv->data[0];\n+\t\t\tstrncpy(pinfo[j].name, (const char *)&tlv->data[1], I40E_DDP_NAME_SIZE);\n+\t\t\ti += tlv->len;\n+\t\t\ttlv = &tlv[tlv->len];\n+\t\t}\n+\t\treturn I40E_SUCCESS;\n+\t}\n+\n+\t/* get number of packet classification types */\n+\tif (type == RTE_PMD_I40E_PKG_INFO_PCTYPE_NUM) {\n+\t\tstruct i40e_profile_section_header *pctype;\n+\t\tif (info_size < sizeof(uint32_t)) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Invalid information buffer size\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tpctype = i40e_find_section_in_profile(SECTION_TYPE_PCTYPE,\n+\t\t\t(struct i40e_profile_segment *)i40e_seg_hdr);\n+\t\t*(uint32_t *)info_buff = i40e_get_tlv_section_size(pctype);\n+\t\treturn I40E_SUCCESS;\n+\t}\n+\n+\t/* get list of packet classification types */\n+\tif (type == RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST) {\n+\t\tuint32_t i, j, nb_rec;\n+\t\tstruct rte_pmd_i40e_ptype_info *pinfo;\n+\t\tstruct i40e_profile_section_header *pctype;\n+\t\tstruct i40e_profile_tlv_section_record *tlv;\n+\t\tpctype = i40e_find_section_in_profile(SECTION_TYPE_PCTYPE,\n+\t\t\t(struct i40e_profile_segment *)i40e_seg_hdr);\n+\t\tnb_rec = i40e_get_tlv_section_size(pctype);\n+\t\tif (info_size < nb_rec) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Invalid information buffer size\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tpinfo = (struct rte_pmd_i40e_ptype_info *)info_buff;\n+\t\tfor (i = 0; i < info_size; i++)\n+\t\t\tmemset(&pinfo[i], RTE_PMD_I40E_PROTO_UNUSED,\n+\t\t\t\tsizeof(struct rte_pmd_i40e_ptype_info));\n+\n+\t\tif (nb_rec == 0)\n+\t\t\treturn I40E_SUCCESS;\n+\t\t/* get number of records in the section */\n+\t\tnb_rec = pctype->section.size / sizeof(struct i40e_profile_tlv_section_record);\n+\t\ttlv = (struct i40e_profile_tlv_section_record *)&pctype[1];\n+\t\tfor (i = j = 0; i < nb_rec; j++) {\n+\t\t\tpinfo[j].ptype_id = tlv->data[0];\n+\t\t\tmemcpy(&pinfo[j], tlv->data, sizeof(struct rte_pmd_i40e_ptype_info));\n+\t\t\ti += tlv->len;\n+\t\t\ttlv = &tlv[tlv->len];\n+\t\t}\n+\t\treturn I40E_SUCCESS;\n+\t}\n+\n+\t/* get number of packet types */\n+\tif (type == RTE_PMD_I40E_PKG_INFO_PTYPE_NUM) {\n+\t\tstruct i40e_profile_section_header *ptype;\n+\t\tif (info_size < sizeof(uint32_t)) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Invalid information buffer size\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tptype = i40e_find_section_in_profile(SECTION_TYPE_PTYPE,\n+\t\t\t(struct i40e_profile_segment *)i40e_seg_hdr);\n+\t\t*(uint32_t *)info_buff = i40e_get_tlv_section_size(ptype);\n+\t\treturn I40E_SUCCESS;\n+\t}\n+\n+\t/* get list of packet types */\n+\tif (type == RTE_PMD_I40E_PKG_INFO_PTYPE_LIST) {\n+\t\tuint32_t i, nb_rec;\n+\t\tstruct rte_pmd_i40e_ptype_info *pinfo;\n+\t\tstruct i40e_profile_section_header *ptype;\n+\t\tstruct i40e_profile_tlv_section_record *tlv;\n+\t\tptype = i40e_find_section_in_profile(SECTION_TYPE_PTYPE,\n+\t\t\t(struct i40e_profile_segment *)i40e_seg_hdr);\n+\t\tnb_rec = i40e_get_tlv_section_size(ptype);\n+\t\tif (info_size < nb_rec) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Invalid information buffer size\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tpinfo = (struct rte_pmd_i40e_ptype_info *)info_buff;\n+\t\tfor (i = 0; i < info_size; i++)\n+\t\t\tmemset(&pinfo[i], RTE_PMD_I40E_PROTO_UNUSED,\n+\t\t\t\tsizeof(struct rte_pmd_i40e_ptype_info));\n+\n+\t\tif (nb_rec == 0)\n+\t\t\treturn I40E_SUCCESS;\n+\t\t/* get number of records in the section */\n+\t\tnb_rec = ptype->section.size / sizeof(struct i40e_profile_tlv_section_record);\n+\t\tfor (i = 0; i < nb_rec; ) {\n+\t\t\ttlv = (struct i40e_profile_tlv_section_record *)&ptype[1 + i];\n+\t\t\tpinfo[i].ptype_id = tlv->data[0];\n+\t\t\tmemcpy(&pinfo[i], tlv->data, sizeof(struct rte_pmd_i40e_ptype_info));\n+\t\t\ti += tlv->len;\n+\t\t}\n+\t\treturn I40E_SUCCESS;\n+\t}\n+\n \tPMD_DRV_LOG(ERR, \"Info type %u is invalid.\", type);\n \treturn -EINVAL;\n }\ndiff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h\nindex 155b7e8..b631093 100644\n--- a/drivers/net/i40e/rte_pmd_i40e.h\n+++ b/drivers/net/i40e/rte_pmd_i40e.h\n@@ -88,6 +88,12 @@ enum rte_pmd_i40e_package_info {\n \tRTE_PMD_I40E_PKG_INFO_HEADER,\n \tRTE_PMD_I40E_PKG_INFO_DEVID_NUM,\n \tRTE_PMD_I40E_PKG_INFO_DEVID_LIST,\n+\tRTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM,\n+\tRTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST,\n+\tRTE_PMD_I40E_PKG_INFO_PCTYPE_NUM,\n+\tRTE_PMD_I40E_PKG_INFO_PCTYPE_LIST,\n+\tRTE_PMD_I40E_PKG_INFO_PTYPE_NUM,\n+\tRTE_PMD_I40E_PKG_INFO_PTYPE_LIST,\n \tRTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF\n };\n \n@@ -133,6 +139,25 @@ struct rte_pmd_i40e_profile_list {\n \tstruct rte_pmd_i40e_profile_info p_info[1];\n };\n \n+#define RTE_PMD_I40E_PROTO_NUM 6\n+#define RTE_PMD_I40E_PROTO_UNUSED 0xFF\n+\n+/**\n+* Protocols information stored in profile\n+*/\n+struct rte_pmd_i40e_proto_info {\n+\tuint8_t proto_id;\n+\tchar name[RTE_PMD_I40E_DDP_NAME_SIZE];\n+};\n+\n+/**\n+* Packet classification/ packet type information stored in profile\n+*/\n+struct rte_pmd_i40e_ptype_info {\n+\tuint8_t ptype_id;\n+\tuint8_t protocols[RTE_PMD_I40E_PROTO_NUM];\n+};\n+\n /**\n * ptype mapping table only accept RTE_PTYPE_XXX or \"user defined\" ptype.\n * A ptype with MSB set will be regarded as a user defined ptype.\n", "prefixes": [ "dpdk-dev", "1/2" ] }{ "id": 28072, "url": "