Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/115677/?format=api
https://patches.dpdk.org/api/patches/115677/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1661899911-13086-13-git-send-email-longli@linuxonhyperv.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": "<1661899911-13086-13-git-send-email-longli@linuxonhyperv.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1661899911-13086-13-git-send-email-longli@linuxonhyperv.com", "date": "2022-08-30T22:51:45", "name": "[v6,12/18] net/mana: add function to start/stop TX queues", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "826853a689f0923b5e934d9deda2bba0154440cb", "submitter": { "id": 1784, "url": "https://patches.dpdk.org/api/people/1784/?format=api", "name": "Long Li", "email": "longli@linuxonhyperv.com" }, "delegate": { "id": 319, "url": "https://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1661899911-13086-13-git-send-email-longli@linuxonhyperv.com/mbox/", "series": [ { "id": 24471, "url": "https://patches.dpdk.org/api/series/24471/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24471", "date": "2022-08-30T22:51:33", "name": "Introduce Microsoft Azure Network Adatper (MANA) PMD", "version": 6, "mbox": "https://patches.dpdk.org/series/24471/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/115677/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/115677/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 49ADFA00C5;\n\tWed, 31 Aug 2022 00:53:11 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1F98D42B98;\n\tWed, 31 Aug 2022 00:52:10 +0200 (CEST)", "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id 0494442B78\n for <dev@dpdk.org>; Wed, 31 Aug 2022 00:52:05 +0200 (CEST)", "by linux.microsoft.com (Postfix, from userid 1004)\n id 6AD6B2045E1E; Tue, 30 Aug 2022 15:52:04 -0700 (PDT)" ], "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 6AD6B2045E1E", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com;\n s=default; t=1661899924;\n bh=fX86bCnzumxLnMYkz/+co0WrkicntHrRlBL/Z9l7ygc=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From;\n b=NrqNQZsr57csbyDH5mRdLqsAm+0Th1YSeh5aiWNK0iqT+HS7upqK3P2f9llqZujH8\n AvS42HfXeI4FwJR/de7eNoMRmturxJXmZa4qBw6swaOYY4cUNp7JaiJa6CmoCpXbbE\n Oe/0eaEL6rzaYNwVCvviRiTOfWHqugew9pntfUzg=", "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 v6 12/18] net/mana: add function to start/stop TX queues", "Date": "Tue, 30 Aug 2022 15:51:45 -0700", "Message-Id": "<1661899911-13086-13-git-send-email-longli@linuxonhyperv.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1661899911-13086-1-git-send-email-longli@linuxonhyperv.com>", "References": "<1661899911-13086-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.\n\n doc/guides/nics/features/mana.ini | 1 +\n drivers/net/mana/mana.h | 4 +\n drivers/net/mana/meson.build | 1 +\n drivers/net/mana/tx.c | 163 ++++++++++++++++++++++++++++++\n 4 files changed, 169 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 d87358ab15..3613ba7ca2 100644\n--- a/drivers/net/mana/mana.h\n+++ b/drivers/net/mana/mana.h\n@@ -379,6 +379,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 364d57a619..031f443d16 100644\n--- a/drivers/net/mana/meson.build\n+++ b/drivers/net/mana/meson.build\n@@ -11,6 +11,7 @@ deps += ['pci', 'bus_pci', 'net', 'eal', 'kvargs']\n \n sources += files(\n \t'mana.c',\n+\t'tx.c',\n \t'mr.c',\n \t'gdma.c',\n \t'mp.c',\ndiff --git a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c\nnew file mode 100644\nindex 0000000000..fbeea40ef2\n--- /dev/null\n+++ b/drivers/net/mana/tx.c\n@@ -0,0 +1,163 @@\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 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 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 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": [ "v6", "12/18" ] }{ "id": 115677, "url": "