get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1124831/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1124831,
    "url": "http://patchwork.ozlabs.org/api/patches/1124831/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190629185405.1601-7-shiraz.saleem@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20190629185405.1601-7-shiraz.saleem@intel.com>",
    "list_archive_url": null,
    "date": "2019-06-29T18:53:54",
    "name": "[rdma-next,06/17] RDMA/irdma: Add QoS definitions",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": false,
    "hash": "026fbcb25a28e6d71658548a0e83ee8ab393ed19",
    "submitter": {
        "id": 69500,
        "url": "http://patchwork.ozlabs.org/api/people/69500/?format=api",
        "name": "Saleem, Shiraz",
        "email": "shiraz.saleem@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190629185405.1601-7-shiraz.saleem@intel.com/mbox/",
    "series": [
        {
            "id": 116886,
            "url": "http://patchwork.ozlabs.org/api/series/116886/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=116886",
            "date": "2019-06-29T18:53:48",
            "name": "Add unified Intel Ethernet RDMA driver (irdma)",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/116886/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1124831/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1124831/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 45bjVF08qFz9s3Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 30 Jun 2019 04:54:28 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 3802D86B1C;\n\tSat, 29 Jun 2019 18:54:27 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 6JbEcBAskC4W; Sat, 29 Jun 2019 18:54:20 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 9E45786B43;\n\tSat, 29 Jun 2019 18:54:20 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id C0FB61BF3AD\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 29 Jun 2019 18:54:19 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id BD5D787D7C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 29 Jun 2019 18:54:19 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id cbQa+LwaXNmx for <intel-wired-lan@lists.osuosl.org>;\n\tSat, 29 Jun 2019 18:54:18 +0000 (UTC)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id B3F2B878F1\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 29 Jun 2019 18:54:18 +0000 (UTC)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jun 2019 11:54:18 -0700",
            "from ssaleem-mobl.amr.corp.intel.com ([10.254.177.95])\n\tby fmsmga004.fm.intel.com with ESMTP; 29 Jun 2019 11:54:18 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.63,432,1557212400\"; d=\"scan'208\";a=\"185972867\"",
        "From": "Shiraz Saleem <shiraz.saleem@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Sat, 29 Jun 2019 13:53:54 -0500",
        "Message-Id": "<20190629185405.1601-7-shiraz.saleem@intel.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190629185405.1601-1-shiraz.saleem@intel.com>",
        "References": "<20190629185405.1601-1-shiraz.saleem@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH rdma-next 06/17] RDMA/irdma: Add QoS\n\tdefinitions",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "Mustafa Ismail <mustafa.ismail@intel.com>,\n\tShiraz Saleem <shiraz.saleem@intel.com>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Mustafa Ismail <mustafa.ismail@intel.com>\n\nAdd definitions for managing the RDMA HW work scheduler (WS) tree.\n\nA WS node is created via a control QP operation with the bandwidth\nallocation, arbitration scheme, and traffic class of the QP specified.\nThe Qset handle returned associates the QoS parameters for the QP.\nThe Qset is registered with the LAN and a equivalent node is created\nin the LAN packet scheduler tree.\n\nSigned-off-by: Mustafa Ismail <mustafa.ismail@intel.com>\nSigned-off-by: Shiraz Saleem <shiraz.saleem@intel.com>\n---\n drivers/infiniband/hw/irdma/ws.c | 396 +++++++++++++++++++++++++++++++++++++++\n drivers/infiniband/hw/irdma/ws.h |  40 ++++\n 2 files changed, 436 insertions(+)\n create mode 100644 drivers/infiniband/hw/irdma/ws.c\n create mode 100644 drivers/infiniband/hw/irdma/ws.h",
    "diff": "diff --git a/drivers/infiniband/hw/irdma/ws.c b/drivers/infiniband/hw/irdma/ws.c\nnew file mode 100644\nindex 0000000..8ecebc1\n--- /dev/null\n+++ b/drivers/infiniband/hw/irdma/ws.c\n@@ -0,0 +1,396 @@\n+// SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB\n+/* Copyright (c) 2019, Intel Corporation. */\n+\n+#include \"osdep.h\"\n+#include \"status.h\"\n+#include \"hmc.h\"\n+#include \"defs.h\"\n+#include \"type.h\"\n+#include \"protos.h\"\n+\n+#include \"ws.h\"\n+\n+/**\n+ * irdma_alloc_node - Allocate a WS node and init\n+ * @vsi: vsi pointer\n+ * @user_pri: user priority\n+ * @node_type: Type of node, leaf or parent\n+ * @parent: parent node pointer\n+ */\n+static struct irdma_ws_node *irdma_alloc_node(struct irdma_sc_vsi *vsi,\n+\t\t\t\t\t      u8 user_pri,\n+\t\t\t\t\t      enum irdma_ws_node_type node_type,\n+\t\t\t\t\t      struct irdma_ws_node *parent)\n+{\n+\tstruct irdma_virt_mem ws_mem;\n+\tstruct irdma_ws_node *node;\n+\tu16 node_index = 0;\n+\n+\tws_mem.size = sizeof(struct irdma_ws_node);\n+\tws_mem.va = kzalloc(ws_mem.size, GFP_ATOMIC);\n+\tif (!ws_mem.va)\n+\t\treturn NULL;\n+\n+\tif (parent || vsi->vm_vf_type == IRDMA_VF_TYPE) {\n+\t\tnode_index = irdma_alloc_ws_node_id(vsi->dev);\n+\t\tif (node_index == IRDMA_WS_NODE_INVALID) {\n+\t\t\tkfree(ws_mem.va);\n+\t\t\treturn NULL;\n+\t\t}\n+\t}\n+\n+\tnode = ws_mem.va;\n+\tnode->index = node_index;\n+\tnode->vsi_index = vsi->vsi_idx;\n+\tINIT_LIST_HEAD(&node->child_list_head);\n+\tif (node_type == WS_NODE_TYPE_LEAF) {\n+\t\tnode->type_leaf = true;\n+\t\tnode->traffic_class = vsi->qos[user_pri].traffic_class;\n+\t\tnode->user_pri = user_pri;\n+\t\tnode->rel_bw = vsi->qos[user_pri].rel_bw;\n+\t\tif (!node->rel_bw)\n+\t\t\tnode->rel_bw = 1;\n+\n+\t\tnode->lan_qs_handle = vsi->qos[user_pri].lan_qos_handle;\n+\t\tnode->prio_type = IRDMA_PRIO_WEIGHTED_RR;\n+\t} else {\n+\t\tnode->rel_bw = 1;\n+\t\tnode->prio_type = IRDMA_PRIO_WEIGHTED_RR;\n+\t}\n+\n+\tnode->parent = parent;\n+\n+\treturn node;\n+}\n+\n+/**\n+ * irdma_free_node - Free a WS node\n+ * @vsi: VSI stricture of device\n+ * @node: Pointer to node to free\n+ */\n+static void irdma_free_node(struct irdma_sc_vsi *vsi,\n+\t\t\t    struct irdma_ws_node *node)\n+{\n+\tstruct irdma_virt_mem ws_mem;\n+\n+\tif (node->index)\n+\t\tirdma_free_ws_node_id(vsi->dev, node->index);\n+\n+\tws_mem.va = node;\n+\tws_mem.size = sizeof(struct irdma_ws_node);\n+\tkfree(ws_mem.va);\n+}\n+\n+/**\n+ * irdma_ws_cqp_cmd - Post CQP work scheduler node cmd\n+ * @vsi: vsi pointer\n+ * @node: pointer to node\n+ * @cmd: add, remove or modify\n+ */\n+static enum irdma_status_code\n+irdma_ws_cqp_cmd(struct irdma_sc_vsi *vsi, struct irdma_ws_node *node, u8 cmd)\n+{\n+\tstruct irdma_ws_node_info node_info = {};\n+\n+\tnode_info.id = node->index;\n+\tnode_info.vsi = node->vsi_index;\n+\tif (node->parent)\n+\t\tnode_info.parent_id = node->parent->index;\n+\telse\n+\t\tnode_info.parent_id = node_info.id;\n+\n+\tnode_info.weight = node->rel_bw;\n+\tnode_info.tc = node->traffic_class;\n+\tnode_info.prio_type = node->prio_type;\n+\tnode_info.type_leaf = node->type_leaf;\n+\tnode_info.enable = node->enable;\n+\tif (irdma_cqp_ws_node_cmd(vsi->dev, cmd, &node_info)) {\n+\t\tdev_dbg(rfdev_to_dev(vsi->dev), \"WS: CQP WS CMD failed\\n\");\n+\t\treturn IRDMA_ERR_NO_MEMORY;\n+\t}\n+\n+\tif (node->type_leaf && cmd == IRDMA_OP_WS_ADD_NODE) {\n+\t\tnode->qs_handle = node_info.qs_handle;\n+\t\tvsi->qos[node->user_pri].qs_handle = node_info.qs_handle;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * ws_find_node - Find SC WS node based on VSI id or TC\n+ * @parent: parent node of First VSI or TC node\n+ * @match_val: value to match\n+ * @type: match type VSI/TC\n+ */\n+static struct irdma_ws_node *ws_find_node(struct irdma_ws_node *parent,\n+\t\t\t\t\t  u16 match_val,\n+\t\t\t\t\t  enum irdma_ws_match_type type)\n+{\n+\tstruct irdma_ws_node *node;\n+\n+\tswitch (type) {\n+\tcase WS_MATCH_TYPE_VSI:\n+\t\tlist_for_each_entry(node, &parent->child_list_head, siblings) {\n+\t\t\tif (node->vsi_index == match_val)\n+\t\t\t\treturn node;\n+\t\t}\n+\t\tbreak;\n+\tcase WS_MATCH_TYPE_TC:\n+\t\tlist_for_each_entry(node, &parent->child_list_head, siblings) {\n+\t\t\tif (node->traffic_class == match_val)\n+\t\t\t\treturn node;\n+\t\t}\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+\n+\treturn NULL;\n+}\n+\n+/**\n+ * irdma_tc_in_use - Checks to see if a leaf node is in use\n+ * @vsi: vsi pointer\n+ * @user_pri: user priority\n+ */\n+static bool irdma_tc_in_use(struct irdma_sc_vsi *vsi, u8 user_pri)\n+{\n+\tunsigned long flags;\n+\tint i;\n+\n+\tspin_lock_irqsave(&vsi->qos[user_pri].lock, flags);\n+\tif (!list_empty(&vsi->qos[user_pri].qplist)) {\n+\t\tspin_unlock_irqrestore(&vsi->qos[user_pri].lock, flags);\n+\t\treturn true;\n+\t}\n+\n+\t/* Check if the traffic class associated with the given user priority\n+\t * is in use by any other user priority. If so, nothing left to do\n+\t */\n+\tfor (i = 0; i < IRDMA_MAX_USER_PRIORITY; i++) {\n+\t\tif (vsi->qos[i].traffic_class == vsi->qos[user_pri].traffic_class &&\n+\t\t    !list_empty(&vsi->qos[i].qplist)) {\n+\t\t\tspin_unlock_irqrestore(&vsi->qos[user_pri].lock, flags);\n+\t\t\treturn true;\n+\t\t}\n+\t}\n+\tspin_unlock_irqrestore(&vsi->qos[user_pri].lock, flags);\n+\n+\treturn false;\n+}\n+\n+/**\n+ * irdma_remove_leaf - Remove leaf node unconditionally\n+ * @vsi: vsi pointer\n+ * @user_pri: user priority\n+ */\n+static void irdma_remove_leaf(struct irdma_sc_vsi *vsi, u8 user_pri)\n+{\n+\tstruct irdma_ws_node *ws_tree_root, *vsi_node, *tc_node;\n+\n+\tws_tree_root = vsi->dev->ws_tree_root;\n+\tif (!ws_tree_root)\n+\t\treturn;\n+\n+\tvsi_node = ws_find_node(ws_tree_root, vsi->vsi_idx,\n+\t\t\t\tWS_MATCH_TYPE_VSI);\n+\tif (!vsi_node)\n+\t\treturn;\n+\n+\ttc_node = ws_find_node(vsi_node,\n+\t\t\t       vsi->qos[user_pri].traffic_class,\n+\t\t\t       WS_MATCH_TYPE_TC);\n+\tif (!tc_node)\n+\t\treturn;\n+\n+\tirdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_DELETE_NODE);\n+\tirdma_lan_unregister_qset(vsi, tc_node);\n+\tlist_del(&tc_node->siblings);\n+\tirdma_free_node(vsi, tc_node);\n+\t/* Check if VSI node can be freed */\n+\tif (list_empty(&vsi_node->child_list_head)) {\n+\t\tirdma_ws_cqp_cmd(vsi, vsi_node, IRDMA_OP_WS_DELETE_NODE);\n+\t\tlist_del(&vsi_node->siblings);\n+\t\tirdma_free_node(vsi, vsi_node);\n+\t\t/* Free head node there are no remaining VSI nodes */\n+\t\tif (list_empty(&ws_tree_root->child_list_head)) {\n+\t\t\tirdma_ws_cqp_cmd(vsi, ws_tree_root,\n+\t\t\t\t\t IRDMA_OP_WS_DELETE_NODE);\n+\t\t\tirdma_free_node(vsi, ws_tree_root);\n+\t\t\tvsi->dev->ws_tree_root = NULL;\n+\t\t}\n+\t}\n+}\n+\n+/**\n+ * irdma_ws_add - Build work scheduler tree, set RDMA qs_handle\n+ * @vsi: vsi pointer\n+ * @user_pri: user priority\n+ */\n+enum irdma_status_code irdma_ws_add(struct irdma_sc_vsi *vsi, u8 user_pri)\n+{\n+\tstruct irdma_ws_node *ws_tree_root;\n+\tstruct irdma_ws_node *vsi_node;\n+\tstruct irdma_ws_node *tc_node;\n+\tu16 traffic_class;\n+\tenum irdma_status_code ret = 0;\n+\tint i;\n+\n+\tmutex_lock(&vsi->dev->ws_mutex);\n+\tif (vsi->tc_change_pending) {\n+\t\tret = IRDMA_ERR_NOT_READY;\n+\t\tgoto exit;\n+\t}\n+\n+\tws_tree_root = vsi->dev->ws_tree_root;\n+\tif (!ws_tree_root) {\n+\t\tdev_dbg(rfdev_to_dev(vsi->dev), \"WS: Creating root node\\n\");\n+\t\tws_tree_root = irdma_alloc_node(vsi, user_pri,\n+\t\t\t\t\t\tWS_NODE_TYPE_PARENT, NULL);\n+\t\tif (!ws_tree_root) {\n+\t\t\tret = IRDMA_ERR_NO_MEMORY;\n+\t\t\tgoto exit;\n+\t\t}\n+\n+\t\tret = irdma_ws_cqp_cmd(vsi, ws_tree_root, IRDMA_OP_WS_ADD_NODE);\n+\t\tif (ret) {\n+\t\t\tirdma_free_node(vsi, ws_tree_root);\n+\t\t\tgoto exit;\n+\t\t}\n+\n+\t\tvsi->dev->ws_tree_root = ws_tree_root;\n+\t}\n+\n+\t/* Find a second tier node that matches the VSI */\n+\tvsi_node = ws_find_node(ws_tree_root, vsi->vsi_idx,\n+\t\t\t\tWS_MATCH_TYPE_VSI);\n+\n+\t/* If VSI node doesn't exist, add one */\n+\tif (!vsi_node) {\n+\t\tdev_dbg(rfdev_to_dev(vsi->dev),\n+\t\t\t\"WS: Node not found matching VSI %d\\n\", vsi->vsi_idx);\n+\t\tvsi_node = irdma_alloc_node(vsi, user_pri, WS_NODE_TYPE_PARENT,\n+\t\t\t\t\t    ws_tree_root);\n+\t\tif (!vsi_node) {\n+\t\t\tret = IRDMA_ERR_NO_MEMORY;\n+\t\t\tgoto vsi_add_err;\n+\t\t}\n+\n+\t\tret = irdma_ws_cqp_cmd(vsi, vsi_node, IRDMA_OP_WS_ADD_NODE);\n+\t\tif (ret) {\n+\t\t\tirdma_free_node(vsi, vsi_node);\n+\t\t\tgoto vsi_add_err;\n+\t\t}\n+\n+\t\tlist_add(&vsi_node->siblings, &ws_tree_root->child_list_head);\n+\t}\n+\n+\tdev_dbg(rfdev_to_dev(vsi->dev),\n+\t\t\"WS: Using node %d which represents VSI %d\\n\",\n+\t\tvsi_node->index, vsi->vsi_idx);\n+\ttraffic_class = vsi->qos[user_pri].traffic_class;\n+\ttc_node = ws_find_node(vsi_node, traffic_class,\n+\t\t\t       WS_MATCH_TYPE_TC);\n+\tif (!tc_node) {\n+\t\t/* Add leaf node */\n+\t\tdev_dbg(rfdev_to_dev(vsi->dev),\n+\t\t\t\"WS: Node not found matching VSI %d and TC %d\\n\",\n+\t\t\tvsi->vsi_idx, traffic_class);\n+\t\ttc_node = irdma_alloc_node(vsi, user_pri, WS_NODE_TYPE_LEAF,\n+\t\t\t\t\t   vsi_node);\n+\t\tif (!tc_node) {\n+\t\t\tret = IRDMA_ERR_NO_MEMORY;\n+\t\t\tgoto leaf_add_err;\n+\t\t}\n+\n+\t\tret = irdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_ADD_NODE);\n+\t\tif (ret) {\n+\t\t\tirdma_free_node(vsi, tc_node);\n+\t\t\tgoto leaf_add_err;\n+\t\t}\n+\n+\t\tlist_add(&tc_node->siblings, &vsi_node->child_list_head);\n+\t\t/*\n+\t\t * callback to LAN to update the LAN tree with our node\n+\t\t */\n+\t\tret = irdma_lan_register_qset(vsi, tc_node);\n+\t\tif (ret)\n+\t\t\tgoto reg_err;\n+\n+\t\ttc_node->enable = true;\n+\t\tret = irdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_MODIFY_NODE);\n+\t\tif (ret)\n+\t\t\tgoto reg_err;\n+\t}\n+\tdev_dbg(rfdev_to_dev(vsi->dev),\n+\t\t\"WS: Using node %d which represents VSI %d TC %d\\n\",\n+\t\ttc_node->index, vsi->vsi_idx, traffic_class);\n+\t/*\n+\t * Iterate through other UPs and update the QS handle if they have\n+\t * a matching traffic class.\n+\t */\n+\tfor (i = 0; i < IRDMA_MAX_USER_PRIORITY; i++) {\n+\t\tif (vsi->qos[i].traffic_class == traffic_class) {\n+\t\t\tvsi->qos[i].qs_handle = tc_node->qs_handle;\n+\t\t\tvsi->qos[i].lan_qos_handle = tc_node->lan_qs_handle;\n+\t\t\tvsi->qos[i].l2_sched_node_id = tc_node->l2_sched_node_id;\n+\t\t}\n+\t}\n+\tgoto exit;\n+\n+leaf_add_err:\n+\tif (list_empty(&vsi_node->child_list_head)) {\n+\t\tif (irdma_ws_cqp_cmd(vsi, vsi_node, IRDMA_OP_WS_DELETE_NODE))\n+\t\t\tgoto exit;\n+\t\tlist_del(&vsi_node->siblings);\n+\t\tirdma_free_node(vsi, vsi_node);\n+\t}\n+\n+vsi_add_err:\n+\t/* Free head node there are no remaining VSI nodes */\n+\tif (list_empty(&ws_tree_root->child_list_head)) {\n+\t\tirdma_ws_cqp_cmd(vsi, ws_tree_root, IRDMA_OP_WS_DELETE_NODE);\n+\t\tvsi->dev->ws_tree_root = NULL;\n+\t\tirdma_free_node(vsi, ws_tree_root);\n+\t}\n+\n+exit:\n+\tmutex_unlock(&vsi->dev->ws_mutex);\n+\treturn ret;\n+\n+reg_err:\n+\tmutex_unlock(&vsi->dev->ws_mutex);\n+\tirdma_ws_remove(vsi, user_pri);\n+\treturn ret;\n+}\n+\n+/**\n+ * irdma_ws_remove - Free WS scheduler node, update WS tree\n+ * @vsi: vsi pointer\n+ * @user_pri: user priority\n+ */\n+void irdma_ws_remove(struct irdma_sc_vsi *vsi, u8 user_pri)\n+{\n+\tmutex_lock(&vsi->dev->ws_mutex);\n+\tif (irdma_tc_in_use(vsi, user_pri))\n+\t\tgoto exit;\n+\n+\tirdma_remove_leaf(vsi, user_pri);\n+exit:\n+\tmutex_unlock(&vsi->dev->ws_mutex);\n+}\n+\n+/**\n+ * irdma_ws_reset - Reset entire WS tree\n+ * @vsi: vsi pointer\n+ */\n+void irdma_ws_reset(struct irdma_sc_vsi *vsi)\n+{\n+\tu8 i;\n+\n+\tmutex_lock(&vsi->dev->ws_mutex);\n+\tfor (i = 0; i < IRDMA_MAX_USER_PRIORITY; ++i)\n+\t\tirdma_remove_leaf(vsi, i);\n+\tmutex_unlock(&vsi->dev->ws_mutex);\n+}\ndiff --git a/drivers/infiniband/hw/irdma/ws.h b/drivers/infiniband/hw/irdma/ws.h\nnew file mode 100644\nindex 0000000..664c9f3\n--- /dev/null\n+++ b/drivers/infiniband/hw/irdma/ws.h\n@@ -0,0 +1,40 @@\n+/* SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB */\n+/* Copyright (c) 2019, Intel Corporation. */\n+\n+#ifndef IRDMA_WS_H\n+#define IRDMA_WS_H\n+\n+#include \"osdep.h\"\n+\n+enum irdma_ws_node_type {\n+\tWS_NODE_TYPE_PARENT,\n+\tWS_NODE_TYPE_LEAF,\n+};\n+\n+enum irdma_ws_match_type {\n+\tWS_MATCH_TYPE_VSI,\n+\tWS_MATCH_TYPE_TC,\n+};\n+\n+struct irdma_ws_node {\n+\tstruct list_head siblings;\n+\tstruct list_head child_list_head;\n+\tstruct irdma_ws_node *parent;\n+\tu64 lan_qs_handle; /* opaque handle used by LAN */\n+\tu32 l2_sched_node_id;\n+\tu16 index;\n+\tu16 qs_handle;\n+\tu16 vsi_index;\n+\tu8 traffic_class;\n+\tu8 user_pri;\n+\tu8 rel_bw;\n+\tu8 abstraction_layer; /* used for splitting a TC */\n+\tu8 prio_type;\n+\tbool type_leaf;\n+\tbool enable;\n+};\n+\n+enum irdma_status_code irdma_ws_add(struct irdma_sc_vsi *vsi, u8 user_pri);\n+void irdma_ws_remove(struct irdma_sc_vsi *vsi, u8 user_pri);\n+void irdma_ws_reset(struct irdma_sc_vsi *vsi);\n+#endif /* IRDMA_WS_H */\n",
    "prefixes": [
        "rdma-next",
        "06/17"
    ]
}