Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/83968/?format=api
http://patches.dpdk.org/api/patches/83968/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201111064936.768604-28-jiawenwu@trustnetic.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": "<20201111064936.768604-28-jiawenwu@trustnetic.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20201111064936.768604-28-jiawenwu@trustnetic.com", "date": "2020-11-11T06:49:26", "name": "[v2,27/37] net/txgbe: add TM configuration init and uninit", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "44821e93ee31855f6756b2dee79e0a8ec9937846", "submitter": { "id": 1932, "url": "http://patches.dpdk.org/api/people/1932/?format=api", "name": "Jiawen Wu", "email": "jiawenwu@trustnetic.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/20201111064936.768604-28-jiawenwu@trustnetic.com/mbox/", "series": [ { "id": 13798, "url": "http://patches.dpdk.org/api/series/13798/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=13798", "date": "2020-11-11T06:49:00", "name": "net: add txgbe PMD part 2", "version": 2, "mbox": "http://patches.dpdk.org/series/13798/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/83968/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/83968/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 1D710A09D2;\n\tWed, 11 Nov 2020 07:56:48 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E43BBC800;\n\tWed, 11 Nov 2020 07:48:16 +0100 (CET)", "from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166])\n by dpdk.org (Postfix) with ESMTP id 4579FBE49\n for <dev@dpdk.org>; Wed, 11 Nov 2020 07:48:00 +0100 (CET)", "from localhost.localdomain.com (unknown [183.129.236.74])\n by esmtp10.qq.com (ESMTP) with\n id ; Wed, 11 Nov 2020 14:47:54 +0800 (CST)" ], "X-QQ-mid": "bizesmtp27t1605077275taf2s526", "X-QQ-SSF": "01400000000000C0C000B00A0000000", "X-QQ-FEAT": "ZKIMeMUzsiP911fc70jlxHbkDy87GuVlmJXIz6JQzwQDMY9eaX81Ul6szaKHq\n 6lWuHB9+ox2CEGeZg9js9GvcRWAAxBhTNM36Yz1QIPH5PqW3iAJ5xgmMTWcuFSzznUT4jrf\n sM+LcNy4tp1EykU8fKW1V8DPyLr7F8Xdwt9+Xf1oqWpLMIl5/kZFwFjNNGxoGGzZQwX5HTx\n w4L6hNO4erGNBy/Jr68RUUaRL0jao6UBrfBWcMtwwB6txdi17u2SfSogxfVywg0NbhDPs6g\n whjzORG2MV9pffiXno8Ofz76C0STRkEHBc5lR3qlgqslrSbypE/JlJTYfSGzhBD2/FUPmlS\n iLYXmsKdTbHyEAXalkUGry6HbJmia1qp6svPvzf", "X-QQ-GoodBg": "2", "From": "Jiawen Wu <jiawenwu@trustnetic.com>", "To": "dev@dpdk.org", "Cc": "Jiawen Wu <jiawenwu@trustnetic.com>", "Date": "Wed, 11 Nov 2020 14:49:26 +0800", "Message-Id": "<20201111064936.768604-28-jiawenwu@trustnetic.com>", "X-Mailer": "git-send-email 2.18.4", "In-Reply-To": "<20201111064936.768604-1-jiawenwu@trustnetic.com>", "References": "<20201111064936.768604-1-jiawenwu@trustnetic.com>", "X-QQ-SENDSIZE": "520", "Feedback-ID": "bizesmtp:trustnetic.com:qybgforeign:qybgforeign5", "X-QQ-Bgrelay": "1", "Subject": "[dpdk-dev] [PATCH v2 27/37] net/txgbe: add TM configuration init\n\tand uninit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Add traffic manager configuration init and uninit operations.\n\nSigned-off-by: Jiawen Wu <jiawenwu@trustnetic.com>\n---\n drivers/net/txgbe/meson.build | 1 +\n drivers/net/txgbe/txgbe_ethdev.c | 16 +++++++++\n drivers/net/txgbe/txgbe_ethdev.h | 60 ++++++++++++++++++++++++++++++++\n drivers/net/txgbe/txgbe_tm.c | 57 ++++++++++++++++++++++++++++++\n 4 files changed, 134 insertions(+)\n create mode 100644 drivers/net/txgbe/txgbe_tm.c", "diff": "diff --git a/drivers/net/txgbe/meson.build b/drivers/net/txgbe/meson.build\nindex bb1683631..352baad8b 100644\n--- a/drivers/net/txgbe/meson.build\n+++ b/drivers/net/txgbe/meson.build\n@@ -11,6 +11,7 @@ sources = files(\n \t'txgbe_ptypes.c',\n \t'txgbe_pf.c',\n \t'txgbe_rxtx.c',\n+\t'txgbe_tm.c',\n )\n \n deps += ['hash']\ndiff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c\nindex 5eaeaa0a9..6a4bff0e5 100644\n--- a/drivers/net/txgbe/txgbe_ethdev.c\n+++ b/drivers/net/txgbe/txgbe_ethdev.c\n@@ -704,6 +704,9 @@ eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)\n \t/* initialize bandwidth configuration info */\n \tmemset(bw_conf, 0, sizeof(struct txgbe_bw_conf));\n \n+\t/* initialize Traffic Manager configuration */\n+\ttxgbe_tm_conf_init(eth_dev);\n+\n \treturn 0;\n }\n \n@@ -1545,6 +1548,7 @@ txgbe_dev_start(struct rte_eth_dev *dev)\n \tint status;\n \tuint16_t vf, idx;\n \tuint32_t *link_speeds;\n+\tstruct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);\n \n \tPMD_INIT_FUNC_TRACE();\n \n@@ -1748,6 +1752,11 @@ txgbe_dev_start(struct rte_eth_dev *dev)\n \ttxgbe_l2_tunnel_conf(dev);\n \ttxgbe_filter_restore(dev);\n \n+\tif (tm_conf->root && !tm_conf->committed)\n+\t\tPMD_DRV_LOG(WARNING,\n+\t\t\t \"please call hierarchy_commit() \"\n+\t\t\t \"before starting the port\");\n+\n \t/*\n \t * Update link status right before return, because it may\n \t * start link configuration process in a separate thread.\n@@ -1780,6 +1789,7 @@ txgbe_dev_stop(struct rte_eth_dev *dev)\n \tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n \tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n \tint vf;\n+\tstruct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);\n \n \tif (hw->adapter_stopped)\n \t\treturn 0;\n@@ -1832,6 +1842,9 @@ txgbe_dev_stop(struct rte_eth_dev *dev)\n \t\tintr_handle->intr_vec = NULL;\n \t}\n \n+\t/* reset hierarchy commit */\n+\ttm_conf->committed = false;\n+\n \tadapter->rss_reta_updated = 0;\n \twr32m(hw, TXGBE_LEDCTL, 0xFFFFFFFF, TXGBE_LEDCTL_SEL_MASK);\n \n@@ -1947,6 +1960,9 @@ txgbe_dev_close(struct rte_eth_dev *dev)\n \t/* clear all the filters list */\n \ttxgbe_filterlist_flush();\n \n+\t/* Remove all Traffic Manager configuration */\n+\ttxgbe_tm_conf_uninit(dev);\n+\n \treturn ret;\n }\n \ndiff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h\nindex e743a8129..828cdadc5 100644\n--- a/drivers/net/txgbe/txgbe_ethdev.h\n+++ b/drivers/net/txgbe/txgbe_ethdev.h\n@@ -14,6 +14,7 @@\n #include <rte_hash.h>\n #include <rte_hash_crc.h>\n #include <rte_ethdev.h>\n+#include <rte_tm_driver.h>\n \n /* need update link, bit flag */\n #define TXGBE_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)\n@@ -273,6 +274,60 @@ struct txgbe_bw_conf {\n \tuint8_t tc_num; /* Number of TCs. */\n };\n \n+/* Struct to store Traffic Manager shaper profile. */\n+struct txgbe_tm_shaper_profile {\n+\tTAILQ_ENTRY(txgbe_tm_shaper_profile) node;\n+\tuint32_t shaper_profile_id;\n+\tuint32_t reference_count;\n+\tstruct rte_tm_shaper_params profile;\n+};\n+\n+TAILQ_HEAD(txgbe_shaper_profile_list, txgbe_tm_shaper_profile);\n+\n+/* Struct to store Traffic Manager node configuration. */\n+struct txgbe_tm_node {\n+\tTAILQ_ENTRY(txgbe_tm_node) node;\n+\tuint32_t id;\n+\tuint32_t priority;\n+\tuint32_t weight;\n+\tuint32_t reference_count;\n+\tuint16_t no;\n+\tstruct txgbe_tm_node *parent;\n+\tstruct txgbe_tm_shaper_profile *shaper_profile;\n+\tstruct rte_tm_node_params params;\n+};\n+\n+TAILQ_HEAD(txgbe_tm_node_list, txgbe_tm_node);\n+\n+/* The configuration of Traffic Manager */\n+struct txgbe_tm_conf {\n+\tstruct txgbe_shaper_profile_list shaper_profile_list;\n+\tstruct txgbe_tm_node *root; /* root node - port */\n+\tstruct txgbe_tm_node_list tc_list; /* node list for all the TCs */\n+\tstruct txgbe_tm_node_list queue_list; /* node list for all the queues */\n+\t/**\n+\t * The number of added TC nodes.\n+\t * It should be no more than the TC number of this port.\n+\t */\n+\tuint32_t nb_tc_node;\n+\t/**\n+\t * The number of added queue nodes.\n+\t * It should be no more than the queue number of this port.\n+\t */\n+\tuint32_t nb_queue_node;\n+\t/**\n+\t * This flag is used to check if APP can change the TM node\n+\t * configuration.\n+\t * When it's true, means the configuration is applied to HW,\n+\t * APP should not change the configuration.\n+\t * As we don't support on-the-fly configuration, when starting\n+\t * the port, APP should call the hierarchy_commit API to set this\n+\t * flag to true. When stopping the port, this flag should be set\n+\t * to false.\n+\t */\n+\tbool committed;\n+};\n+\n /*\n * Structure to store private data for each driver instance (for each port).\n */\n@@ -295,6 +350,7 @@ struct txgbe_adapter {\n \tstruct rte_timecounter systime_tc;\n \tstruct rte_timecounter rx_tstamp_tc;\n \tstruct rte_timecounter tx_tstamp_tc;\n+\tstruct txgbe_tm_conf tm_conf;\n \n \t/* For RSS reta table update */\n \tuint8_t rss_reta_updated;\n@@ -345,6 +401,8 @@ struct txgbe_adapter {\n #define TXGBE_DEV_BW_CONF(dev) \\\n \t(&((struct txgbe_adapter *)(dev)->data->dev_private)->bw_conf)\n \n+#define TXGBE_DEV_TM_CONF(dev) \\\n+\t(&((struct txgbe_adapter *)(dev)->data->dev_private)->tm_conf)\n \n /*\n * RX/TX function prototypes\n@@ -499,6 +557,8 @@ int txgbe_clear_all_l2_tn_filter(struct rte_eth_dev *dev);\n \n int txgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,\n \t\t\t uint16_t tx_rate, uint64_t q_msk);\n+void txgbe_tm_conf_init(struct rte_eth_dev *dev);\n+void txgbe_tm_conf_uninit(struct rte_eth_dev *dev);\n int txgbe_set_queue_rate_limit(struct rte_eth_dev *dev, uint16_t queue_idx,\n \t\t\t uint16_t tx_rate);\n int txgbe_rss_conf_init(struct txgbe_rte_flow_rss_conf *out,\ndiff --git a/drivers/net/txgbe/txgbe_tm.c b/drivers/net/txgbe/txgbe_tm.c\nnew file mode 100644\nindex 000000000..78f426964\n--- /dev/null\n+++ b/drivers/net/txgbe/txgbe_tm.c\n@@ -0,0 +1,57 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2015-2020\n+ */\n+\n+#include <rte_malloc.h>\n+\n+#include \"txgbe_ethdev.h\"\n+\n+void\n+txgbe_tm_conf_init(struct rte_eth_dev *dev)\n+{\n+\tstruct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);\n+\n+\t/* initialize shaper profile list */\n+\tTAILQ_INIT(&tm_conf->shaper_profile_list);\n+\n+\t/* initialize node configuration */\n+\ttm_conf->root = NULL;\n+\tTAILQ_INIT(&tm_conf->queue_list);\n+\tTAILQ_INIT(&tm_conf->tc_list);\n+\ttm_conf->nb_tc_node = 0;\n+\ttm_conf->nb_queue_node = 0;\n+\ttm_conf->committed = false;\n+}\n+\n+void\n+txgbe_tm_conf_uninit(struct rte_eth_dev *dev)\n+{\n+\tstruct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);\n+\tstruct txgbe_tm_shaper_profile *shaper_profile;\n+\tstruct txgbe_tm_node *tm_node;\n+\n+\t/* clear node configuration */\n+\twhile ((tm_node = TAILQ_FIRST(&tm_conf->queue_list))) {\n+\t\tTAILQ_REMOVE(&tm_conf->queue_list, tm_node, node);\n+\t\trte_free(tm_node);\n+\t}\n+\ttm_conf->nb_queue_node = 0;\n+\twhile ((tm_node = TAILQ_FIRST(&tm_conf->tc_list))) {\n+\t\tTAILQ_REMOVE(&tm_conf->tc_list, tm_node, node);\n+\t\trte_free(tm_node);\n+\t}\n+\ttm_conf->nb_tc_node = 0;\n+\tif (tm_conf->root) {\n+\t\trte_free(tm_conf->root);\n+\t\ttm_conf->root = NULL;\n+\t}\n+\n+\t/* Remove all shaper profiles */\n+\twhile ((shaper_profile =\n+\t TAILQ_FIRST(&tm_conf->shaper_profile_list))) {\n+\t\tTAILQ_REMOVE(&tm_conf->shaper_profile_list,\n+\t\t\t shaper_profile, node);\n+\t\trte_free(shaper_profile);\n+\t}\n+}\n+\n", "prefixes": [ "v2", "27/37" ] }{ "id": 83968, "url": "