get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 116792,
    "url": "http://patches.dpdk.org/api/patches/116792/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1663987546-15982-13-git-send-email-longli@linuxonhyperv.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": "<1663987546-15982-13-git-send-email-longli@linuxonhyperv.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1663987546-15982-13-git-send-email-longli@linuxonhyperv.com",
    "date": "2022-09-24T02:45:40",
    "name": "[v9,12/18] net/mana: start/stop Tx queues",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "bec06b22cec21a2cd9a65b645553f57d37020309",
    "submitter": {
        "id": 1784,
        "url": "http://patches.dpdk.org/api/people/1784/?format=api",
        "name": "Long Li",
        "email": "longli@linuxonhyperv.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/1663987546-15982-13-git-send-email-longli@linuxonhyperv.com/mbox/",
    "series": [
        {
            "id": 24807,
            "url": "http://patches.dpdk.org/api/series/24807/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=24807",
            "date": "2022-09-24T02:45:28",
            "name": "Introduce Microsoft Azure Network Adatper (MANA) PMD",
            "version": 9,
            "mbox": "http://patches.dpdk.org/series/24807/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/116792/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/116792/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 7127CA054F;\n\tSat, 24 Sep 2022 04:47:02 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1B9CB42C16;\n\tSat, 24 Sep 2022 04:46:12 +0200 (CEST)",
            "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id 85BEE400D4\n for <dev@dpdk.org>; Sat, 24 Sep 2022 04:45:58 +0200 (CEST)",
            "by linux.microsoft.com (Postfix, from userid 1004)\n id 40D0B20C32BB; Fri, 23 Sep 2022 19:45:58 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 40D0B20C32BB",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com;\n s=default; t=1663987558;\n bh=jE/godG3QjroPJPU0A+yPE7Sy/9YiFr/o7Vd7xtRZso=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From;\n b=H3jSUNAfza+8K3ss8AlfuLapzwoCk9msHzofQ/ypTTsCUpWIvT8uV85BPegMo9ZBG\n 2/RMWFoljxvSV9Pv93Agy/0+mMLIPNos8tGUezJ/ElwqFSkB74LJFwe5Bl+YrCFCtT\n o8WxFPHpWWA7EJ4+HmsYFzSD4GdPDd2mZq7SSxyM=",
        "From": "longli@linuxonhyperv.com",
        "To": "Ferruh Yigit <ferruh.yigit@xilinx.com>",
        "Cc": "dev@dpdk.org, Ajay Sharma <sharmaajay@microsoft.com>,\n Stephen Hemminger <sthemmin@microsoft.com>, Long Li <longli@microsoft.com>",
        "Subject": "[Patch v9 12/18] net/mana: start/stop Tx queues",
        "Date": "Fri, 23 Sep 2022 19:45:40 -0700",
        "Message-Id": "<1663987546-15982-13-git-send-email-longli@linuxonhyperv.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1663987546-15982-1-git-send-email-longli@linuxonhyperv.com>",
        "References": "<1662674189-29524-1-git-send-email-longli@linuxonhyperv.com>\n <1663987546-15982-1-git-send-email-longli@linuxonhyperv.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>",
        "Reply-To": "longli@microsoft.com",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "From: Long Li <longli@microsoft.com>\n\nMANA allocate device queues through the IB layer when starting Tx queues.\nWhen device is stopped all the queues are unmapped and freed.\n\nSigned-off-by: Long Li <longli@microsoft.com>\n---\nChange log:\nv2:\nAdd prefix mana_ to all function names.\nRemove unused header files.\nv8:\nfix coding style to function definitions.\nv9:\nmove some data definitions from earlier patch.\n\n doc/guides/nics/features/mana.ini |   1 +\n drivers/net/mana/mana.h           |  11 ++\n drivers/net/mana/meson.build      |   1 +\n drivers/net/mana/tx.c             | 166 ++++++++++++++++++++++++++++++\n 4 files changed, 179 insertions(+)\n create mode 100644 drivers/net/mana/tx.c",
    "diff": "diff --git a/doc/guides/nics/features/mana.ini b/doc/guides/nics/features/mana.ini\nindex a59c21cc10..821443b292 100644\n--- a/doc/guides/nics/features/mana.ini\n+++ b/doc/guides/nics/features/mana.ini\n@@ -7,6 +7,7 @@\n Link status          = P\n Linux                = Y\n Multiprocess aware   = Y\n+Queue start/stop     = Y\n Removal event        = Y\n RSS hash             = Y\n Speed capabilities   = P\ndiff --git a/drivers/net/mana/mana.h b/drivers/net/mana/mana.h\nindex f4fb6e8a37..0b0c6ad122 100644\n--- a/drivers/net/mana/mana.h\n+++ b/drivers/net/mana/mana.h\n@@ -293,6 +293,13 @@ struct mana_gdma_queue {\n struct mana_txq {\n \tstruct mana_priv *priv;\n \tuint32_t num_desc;\n+\tstruct ibv_cq *cq;\n+\tstruct ibv_qp *qp;\n+\n+\tstruct mana_gdma_queue gdma_sq;\n+\tstruct mana_gdma_queue gdma_cq;\n+\n+\tuint32_t tx_vp_offset;\n \n \t/* For storing pending requests */\n \tstruct mana_txq_desc *desc_ring;\n@@ -354,6 +361,10 @@ uint16_t mana_tx_burst_removed(void *dpdk_rxq, struct rte_mbuf **pkts,\n int gdma_poll_completion_queue(struct mana_gdma_queue *cq,\n \t\t\t       struct gdma_comp *comp);\n \n+int mana_start_tx_queues(struct rte_eth_dev *dev);\n+\n+int mana_stop_tx_queues(struct rte_eth_dev *dev);\n+\n struct mana_mr_cache *mana_find_pmd_mr(struct mana_mr_btree *local_tree,\n \t\t\t\t       struct mana_priv *priv,\n \t\t\t\t       struct rte_mbuf *mbuf);\ndiff --git a/drivers/net/mana/meson.build b/drivers/net/mana/meson.build\nindex dea8b97afb..2ffb76a36a 100644\n--- a/drivers/net/mana/meson.build\n+++ b/drivers/net/mana/meson.build\n@@ -14,6 +14,7 @@ sources += files(\n         'mana.c',\n         'mp.c',\n         'mr.c',\n+        'tx.c',\n )\n \n libnames = ['ibverbs', 'mana' ]\ndiff --git a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c\nnew file mode 100644\nindex 0000000000..e4ff0fbf56\n--- /dev/null\n+++ b/drivers/net/mana/tx.c\n@@ -0,0 +1,166 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2022 Microsoft Corporation\n+ */\n+\n+#include <ethdev_driver.h>\n+\n+#include <infiniband/verbs.h>\n+#include <infiniband/manadv.h>\n+\n+#include \"mana.h\"\n+\n+int\n+mana_stop_tx_queues(struct rte_eth_dev *dev)\n+{\n+\tstruct mana_priv *priv = dev->data->dev_private;\n+\tint i, ret;\n+\n+\tfor (i = 0; i < priv->num_queues; i++) {\n+\t\tstruct mana_txq *txq = dev->data->tx_queues[i];\n+\n+\t\tif (txq->qp) {\n+\t\t\tret = ibv_destroy_qp(txq->qp);\n+\t\t\tif (ret)\n+\t\t\t\tDRV_LOG(ERR, \"tx_queue destroy_qp failed %d\",\n+\t\t\t\t\tret);\n+\t\t\ttxq->qp = NULL;\n+\t\t}\n+\n+\t\tif (txq->cq) {\n+\t\t\tret = ibv_destroy_cq(txq->cq);\n+\t\t\tif (ret)\n+\t\t\t\tDRV_LOG(ERR, \"tx_queue destroy_cp failed %d\",\n+\t\t\t\t\tret);\n+\t\t\ttxq->cq = NULL;\n+\t\t}\n+\n+\t\t/* Drain and free posted WQEs */\n+\t\twhile (txq->desc_ring_tail != txq->desc_ring_head) {\n+\t\t\tstruct mana_txq_desc *desc =\n+\t\t\t\t&txq->desc_ring[txq->desc_ring_tail];\n+\n+\t\t\trte_pktmbuf_free(desc->pkt);\n+\n+\t\t\ttxq->desc_ring_tail =\n+\t\t\t\t(txq->desc_ring_tail + 1) % txq->num_desc;\n+\t\t}\n+\t\ttxq->desc_ring_head = 0;\n+\t\ttxq->desc_ring_tail = 0;\n+\n+\t\tmemset(&txq->gdma_sq, 0, sizeof(txq->gdma_sq));\n+\t\tmemset(&txq->gdma_cq, 0, sizeof(txq->gdma_cq));\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int\n+mana_start_tx_queues(struct rte_eth_dev *dev)\n+{\n+\tstruct mana_priv *priv = dev->data->dev_private;\n+\tint ret, i;\n+\n+\t/* start TX queues */\n+\tfor (i = 0; i < priv->num_queues; i++) {\n+\t\tstruct mana_txq *txq;\n+\t\tstruct ibv_qp_init_attr qp_attr = { 0 };\n+\t\tstruct manadv_obj obj = {};\n+\t\tstruct manadv_qp dv_qp;\n+\t\tstruct manadv_cq dv_cq;\n+\n+\t\ttxq = dev->data->tx_queues[i];\n+\n+\t\tmanadv_set_context_attr(priv->ib_ctx,\n+\t\t\tMANADV_CTX_ATTR_BUF_ALLOCATORS,\n+\t\t\t(void *)((uintptr_t)&(struct manadv_ctx_allocators){\n+\t\t\t\t.alloc = &mana_alloc_verbs_buf,\n+\t\t\t\t.free = &mana_free_verbs_buf,\n+\t\t\t\t.data = (void *)(uintptr_t)txq->socket,\n+\t\t\t}));\n+\n+\t\ttxq->cq = ibv_create_cq(priv->ib_ctx, txq->num_desc,\n+\t\t\t\t\tNULL, NULL, 0);\n+\t\tif (!txq->cq) {\n+\t\t\tDRV_LOG(ERR, \"failed to create cq queue index %d\", i);\n+\t\t\tret = -errno;\n+\t\t\tgoto fail;\n+\t\t}\n+\n+\t\tqp_attr.send_cq = txq->cq;\n+\t\tqp_attr.recv_cq = txq->cq;\n+\t\tqp_attr.cap.max_send_wr = txq->num_desc;\n+\t\tqp_attr.cap.max_send_sge = priv->max_send_sge;\n+\n+\t\t/* Skip setting qp_attr.cap.max_inline_data */\n+\n+\t\tqp_attr.qp_type = IBV_QPT_RAW_PACKET;\n+\t\tqp_attr.sq_sig_all = 0;\n+\n+\t\ttxq->qp = ibv_create_qp(priv->ib_parent_pd, &qp_attr);\n+\t\tif (!txq->qp) {\n+\t\t\tDRV_LOG(ERR, \"Failed to create qp queue index %d\", i);\n+\t\t\tret = -errno;\n+\t\t\tgoto fail;\n+\t\t}\n+\n+\t\t/* Get the addresses of CQ, QP and DB */\n+\t\tobj.qp.in = txq->qp;\n+\t\tobj.qp.out = &dv_qp;\n+\t\tobj.cq.in = txq->cq;\n+\t\tobj.cq.out = &dv_cq;\n+\t\tret = manadv_init_obj(&obj, MANADV_OBJ_QP | MANADV_OBJ_CQ);\n+\t\tif (ret) {\n+\t\t\tDRV_LOG(ERR, \"Failed to get manadv objects\");\n+\t\t\tgoto fail;\n+\t\t}\n+\n+\t\ttxq->gdma_sq.buffer = obj.qp.out->sq_buf;\n+\t\ttxq->gdma_sq.count = obj.qp.out->sq_count;\n+\t\ttxq->gdma_sq.size = obj.qp.out->sq_size;\n+\t\ttxq->gdma_sq.id = obj.qp.out->sq_id;\n+\n+\t\ttxq->tx_vp_offset = obj.qp.out->tx_vp_offset;\n+\t\tpriv->db_page = obj.qp.out->db_page;\n+\t\tDRV_LOG(INFO, \"txq sq id %u vp_offset %u db_page %p \"\n+\t\t\t\t\" buf %p count %u size %u\",\n+\t\t\t\ttxq->gdma_sq.id, txq->tx_vp_offset,\n+\t\t\t\tpriv->db_page,\n+\t\t\t\ttxq->gdma_sq.buffer, txq->gdma_sq.count,\n+\t\t\t\ttxq->gdma_sq.size);\n+\n+\t\ttxq->gdma_cq.buffer = obj.cq.out->buf;\n+\t\ttxq->gdma_cq.count = obj.cq.out->count;\n+\t\ttxq->gdma_cq.size = txq->gdma_cq.count * COMP_ENTRY_SIZE;\n+\t\ttxq->gdma_cq.id = obj.cq.out->cq_id;\n+\n+\t\t/* CQ head starts with count (not 0) */\n+\t\ttxq->gdma_cq.head = txq->gdma_cq.count;\n+\n+\t\tDRV_LOG(INFO, \"txq cq id %u buf %p count %u size %u head %u\",\n+\t\t\ttxq->gdma_cq.id, txq->gdma_cq.buffer,\n+\t\t\ttxq->gdma_cq.count, txq->gdma_cq.size,\n+\t\t\ttxq->gdma_cq.head);\n+\t}\n+\n+\treturn 0;\n+\n+fail:\n+\tmana_stop_tx_queues(dev);\n+\treturn ret;\n+}\n+\n+static inline uint16_t\n+get_vsq_frame_num(uint32_t vsq)\n+{\n+\tunion {\n+\t\tuint32_t gdma_txq_id;\n+\t\tstruct {\n+\t\t\tuint32_t reserved1\t: 10;\n+\t\t\tuint32_t vsq_frame\t: 14;\n+\t\t\tuint32_t reserved2\t: 8;\n+\t\t};\n+\t} v;\n+\n+\tv.gdma_txq_id = vsq;\n+\treturn v.vsq_frame;\n+}\n",
    "prefixes": [
        "v9",
        "12/18"
    ]
}