Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/76654/?format=api
http://patches.dpdk.org/api/patches/76654/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200907090825.1761-3-huwei013@chinasoftinc.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": "<20200907090825.1761-3-huwei013@chinasoftinc.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200907090825.1761-3-huwei013@chinasoftinc.com", "date": "2020-09-07T09:08:19", "name": "[2/8] net/hns3: reduce address calculation in Rx", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "95d6c8f8a739ecdfe3fc6728716fd1c1d756da69", "submitter": { "id": 1537, "url": "http://patches.dpdk.org/api/people/1537/?format=api", "name": "Wei Hu (Xavier)", "email": "huwei013@chinasoftinc.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/20200907090825.1761-3-huwei013@chinasoftinc.com/mbox/", "series": [ { "id": 11986, "url": "http://patches.dpdk.org/api/series/11986/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11986", "date": "2020-09-07T09:08:17", "name": "net/hns3: updates for Rx Tx", "version": 1, "mbox": "http://patches.dpdk.org/series/11986/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/76654/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/76654/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 23558A04B9;\n\tMon, 7 Sep 2020 11:09:21 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id BD6D01C0DC;\n\tMon, 7 Sep 2020 11:09:08 +0200 (CEST)", "from mail.chinasoftinc.com (unknown [114.113.233.8])\n by dpdk.org (Postfix) with ESMTP id 9B76C1C0D2\n for <dev@dpdk.org>; Mon, 7 Sep 2020 11:09:06 +0200 (CEST)", "from localhost.localdomain (65.49.108.226) by INCCAS002.ito.icss\n (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Mon, 7 Sep 2020\n 17:09:03 +0800" ], "From": "\"Wei Hu (Xavier)\" <huwei013@chinasoftinc.com>", "To": "<dev@dpdk.org>", "CC": "<xavier.huwei@huawei.com>", "Date": "Mon, 7 Sep 2020 17:08:19 +0800", "Message-ID": "<20200907090825.1761-3-huwei013@chinasoftinc.com>", "X-Mailer": "git-send-email 2.9.5", "In-Reply-To": "<20200907090825.1761-1-huwei013@chinasoftinc.com>", "References": "<20200907090825.1761-1-huwei013@chinasoftinc.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[65.49.108.226]", "Subject": "[dpdk-dev] [PATCH 2/8] net/hns3: reduce address calculation in Rx", "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": "From: \"Wei Hu (Xavier)\" <xavier.huwei@huawei.com>\n\nThis patch adds the internal function named hns3_write_reg_opt to avoid\nperformance loss from address calculation during register access in the\n'.rx_pkt_burst' ops implementation function named hns3_recv_pkts.\n\nIn addition, because hardware always access register in little-endian mode\nbased on hns3 network engine, so driver should also call rte_cpu_to_le_32\nto convert data in little-endian mode before writing register and call\nrte_le_to_cpu_32 to convert data after reading from register. Here the\ndriver encapsulates the data conversion operation in the register\nread/write operation function as below:\n hns3_write_reg\n hns3_write_reg_opt\n hns3_read_reg\nTherefore, when calling these functions, conversion is not required again.\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\nSigned-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>\n---\n drivers/net/hns3/hns3_ethdev.h | 29 +++++++++++++++++++++++++++--\n drivers/net/hns3/hns3_rxtx.c | 14 +++-----------\n drivers/net/hns3/hns3_rxtx.h | 1 +\n 3 files changed, 31 insertions(+), 13 deletions(-)", "diff": "diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h\nindex 9e49e28..3cb0535 100644\n--- a/drivers/net/hns3/hns3_ethdev.h\n+++ b/drivers/net/hns3/hns3_ethdev.h\n@@ -708,14 +708,39 @@ struct hns3_adapter {\n \n #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))\n \n+/*\n+ * Because hardware always access register in little-endian mode based on hns3\n+ * network engine, so driver should also call rte_cpu_to_le_32 to convert data\n+ * in little-endian mode before writing register and call rte_le_to_cpu_32 to\n+ * convert data after reading from register.\n+ *\n+ * Here the driver encapsulates the data conversion operation in the register\n+ * read/write operation function as below:\n+ * hns3_write_reg\n+ * hns3_write_reg_opt\n+ * hns3_read_reg\n+ * Therefore, when calling these functions, conversion is not required again.\n+ */\n static inline void hns3_write_reg(void *base, uint32_t reg, uint32_t value)\n {\n-\trte_write32(value, (volatile void *)((char *)base + reg));\n+\trte_write32(rte_cpu_to_le_32(value),\n+\t\t (volatile void *)((char *)base + reg));\n+}\n+\n+/*\n+ * The optimized function for writing registers used in the '.rx_pkt_burst' and\n+ * '.tx_pkt_burst' ops implementation function.\n+ */\n+static inline void hns3_write_reg_opt(volatile void *addr, uint32_t value)\n+{\n+\trte_io_wmb();\n+\trte_write32_relaxed(rte_cpu_to_le_32(value), addr);\n }\n \n static inline uint32_t hns3_read_reg(void *base, uint32_t reg)\n {\n-\treturn rte_read32((volatile void *)((char *)base + reg));\n+\tuint32_t read_val = rte_read32((volatile void *)((char *)base + reg));\n+\treturn rte_le_to_cpu_32(read_val);\n }\n \n #define hns3_write_dev(a, reg, value) \\\ndiff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c\nindex fe2a7a4..703b12a 100644\n--- a/drivers/net/hns3/hns3_rxtx.c\n+++ b/drivers/net/hns3/hns3_rxtx.c\n@@ -1323,6 +1323,8 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,\n \trxq->configured = true;\n \trxq->io_base = (void *)((char *)hw->io_base + HNS3_TQP_REG_OFFSET +\n \t\t\t\tidx * HNS3_TQP_REG_SIZE);\n+\trxq->io_head_reg = (volatile void *)((char *)rxq->io_base +\n+\t\t\t HNS3_RING_RX_HEAD_REG);\n \trxq->rx_buf_len = rx_buf_size;\n \trxq->l2_errors = 0;\n \trxq->pkt_len_errors = 0;\n@@ -1472,16 +1474,6 @@ hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev)\n \treturn NULL;\n }\n \n-static void\n-hns3_clean_rx_buffers(struct hns3_rx_queue *rxq, int count)\n-{\n-\trxq->next_to_use += count;\n-\tif (rxq->next_to_use >= rxq->nb_rx_desc)\n-\t\trxq->next_to_use -= rxq->nb_rx_desc;\n-\n-\thns3_write_dev(rxq, HNS3_RING_RX_HEAD_REG, count);\n-}\n-\n static int\n hns3_handle_bdinfo(struct hns3_rx_queue *rxq, struct rte_mbuf *rxm,\n \t\t uint32_t bd_base_info, uint32_t l234_info,\n@@ -1844,7 +1836,7 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \n \trxq->rx_free_hold += nb_rx_bd;\n \tif (rxq->rx_free_hold > rxq->rx_free_thresh) {\n-\t\thns3_clean_rx_buffers(rxq, rxq->rx_free_hold);\n+\t\thns3_write_reg_opt(rxq->io_head_reg, rxq->rx_free_hold);\n \t\trxq->rx_free_hold = 0;\n \t}\n \ndiff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h\nindex a2d6514..c1a34e2 100644\n--- a/drivers/net/hns3/hns3_rxtx.h\n+++ b/drivers/net/hns3/hns3_rxtx.h\n@@ -231,6 +231,7 @@ struct hns3_entry {\n \n struct hns3_rx_queue {\n \tvoid *io_base;\n+\tvolatile void *io_head_reg;\n \tstruct hns3_adapter *hns;\n \tstruct rte_mempool *mb_pool;\n \tstruct hns3_desc *rx_ring;\n", "prefixes": [ "2/8" ] }{ "id": 76654, "url": "