Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/88456/?format=api
http://patches.dpdk.org/api/patches/88456/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1614843894-43845-13-git-send-email-oulijun@huawei.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": "<1614843894-43845-13-git-send-email-oulijun@huawei.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1614843894-43845-13-git-send-email-oulijun@huawei.com", "date": "2021-03-04T07:44:52", "name": "[V3,12/14] net/hns3: fix memory leakage for mbuf", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "234c9f12b0e433496174dedde5a3cff198ee2d43", "submitter": { "id": 1675, "url": "http://patches.dpdk.org/api/people/1675/?format=api", "name": "Lijun Ou", "email": "oulijun@huawei.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/1614843894-43845-13-git-send-email-oulijun@huawei.com/mbox/", "series": [ { "id": 15486, "url": "http://patches.dpdk.org/api/series/15486/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15486", "date": "2021-03-04T07:44:40", "name": "Features and bugfixes for hns3", "version": 3, "mbox": "http://patches.dpdk.org/series/15486/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/88456/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/88456/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 DFFFFA0561;\n\tThu, 4 Mar 2021 08:45:51 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id CCE8622A32D;\n\tThu, 4 Mar 2021 08:44:31 +0100 (CET)", "from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190])\n by mails.dpdk.org (Postfix) with ESMTP id DFFFE40F35\n for <dev@dpdk.org>; Thu, 4 Mar 2021 08:44:17 +0100 (CET)", "from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60])\n by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DrjW20HsMzlSTK;\n Thu, 4 Mar 2021 15:42:06 +0800 (CST)", "from localhost.localdomain (10.69.192.56) by\n DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id\n 14.3.498.0; Thu, 4 Mar 2021 15:44:12 +0800" ], "From": "Lijun Ou <oulijun@huawei.com>", "To": "<ferruh.yigit@intel.com>", "CC": "<dev@dpdk.org>, <linuxarm@openeuler.org>", "Date": "Thu, 4 Mar 2021 15:44:52 +0800", "Message-ID": "<1614843894-43845-13-git-send-email-oulijun@huawei.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1614843894-43845-1-git-send-email-oulijun@huawei.com>", "References": "<1614693534-27620-1-git-send-email-oulijun@huawei.com>\n <1614843894-43845-1-git-send-email-oulijun@huawei.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[10.69.192.56]", "X-CFilter-Loop": "Reflected", "Subject": "[dpdk-dev] [PATCH V3 12/14] net/hns3: fix memory leakage for mbuf", "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>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: Huisong Li <lihuisong@huawei.com>\n\nThe mbufs of rx queue will be allocated in \"hns3_do_start\" function.\nBut these mbufs are not released when \"hns3_dev_start\" executes\nfailed.\n\nFixes: c4ae39b2cfc5 (\"net/hns3: fix Rx interrupt after reset\")\nCc: stable@dpdk.org\n\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\nSigned-off-by: Lijun Ou <oulijun@huawei.com>\n---\n drivers/net/hns3/hns3_ethdev.c | 45 ++++++++++++++++++++++++---------------\n drivers/net/hns3/hns3_ethdev_vf.c | 43 ++++++++++++++++++++++---------------\n 2 files changed, 54 insertions(+), 34 deletions(-)", "diff": "diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex 21c3c59..8300fea 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -102,6 +102,7 @@ static int hns3_remove_mc_addr(struct hns3_hw *hw,\n \t\t\t struct rte_ether_addr *mac_addr);\n static int hns3_restore_fec(struct hns3_hw *hw);\n static int hns3_query_dev_fec_info(struct hns3_hw *hw);\n+static int hns3_do_stop(struct hns3_adapter *hns);\n \n void hns3_ether_format_addr(char *buf, uint16_t size,\n \t\t\t const struct rte_ether_addr *ether_addr)\n@@ -5133,11 +5134,8 @@ hns3_dev_start(struct rte_eth_dev *dev)\n \t\treturn ret;\n \t}\n \tret = hns3_map_rx_interrupt(dev);\n-\tif (ret) {\n-\t\thw->adapter_state = HNS3_NIC_CONFIGURED;\n-\t\trte_spinlock_unlock(&hw->lock);\n-\t\treturn ret;\n-\t}\n+\tif (ret)\n+\t\tgoto map_rx_inter_err;\n \n \t/*\n \t * There are three register used to control the status of a TQP\n@@ -5151,19 +5149,12 @@ hns3_dev_start(struct rte_eth_dev *dev)\n \t * status of queue in the dpdk framework.\n \t */\n \tret = hns3_start_all_txqs(dev);\n-\tif (ret) {\n-\t\thw->adapter_state = HNS3_NIC_CONFIGURED;\n-\t\trte_spinlock_unlock(&hw->lock);\n-\t\treturn ret;\n-\t}\n+\tif (ret)\n+\t\tgoto map_rx_inter_err;\n \n \tret = hns3_start_all_rxqs(dev);\n-\tif (ret) {\n-\t\thns3_stop_all_txqs(dev);\n-\t\thw->adapter_state = HNS3_NIC_CONFIGURED;\n-\t\trte_spinlock_unlock(&hw->lock);\n-\t\treturn ret;\n-\t}\n+\tif (ret)\n+\t\tgoto start_all_rxqs_fail;\n \n \thw->adapter_state = HNS3_NIC_STARTED;\n \trte_spinlock_unlock(&hw->lock);\n@@ -5187,7 +5178,17 @@ hns3_dev_start(struct rte_eth_dev *dev)\n \thns3_tm_dev_start_proc(hw);\n \n \thns3_info(hw, \"hns3 dev start successful!\");\n+\n \treturn 0;\n+\n+start_all_rxqs_fail:\n+\thns3_stop_all_txqs(dev);\n+map_rx_inter_err:\n+\t(void)hns3_do_stop(hns);\n+\thw->adapter_state = HNS3_NIC_CONFIGURED;\n+\trte_spinlock_unlock(&hw->lock);\n+\n+\treturn ret;\n }\n \n static int\n@@ -5196,6 +5197,17 @@ hns3_do_stop(struct hns3_adapter *hns)\n \tstruct hns3_hw *hw = &hns->hw;\n \tint ret;\n \n+\t/*\n+\t * The \"hns3_do_stop\" function will also be called by .stop_service to\n+\t * prepare reset. At the time of global or IMP reset, the command cannot\n+\t * be sent to stop the tx/rx queues. The mbuf in Tx/Rx queues may be\n+\t * accessed during the reset process. So the mbuf can not be released\n+\t * during reset and is required to be released after the reset is\n+\t * completed.\n+\t */\n+\tif (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0)\n+\t\thns3_dev_release_mbufs(hns);\n+\n \tret = hns3_cfg_mac_mode(hw, false);\n \tif (ret)\n \t\treturn ret;\n@@ -5273,7 +5285,6 @@ hns3_dev_stop(struct rte_eth_dev *dev)\n \t\thns3_stop_tqps(hw);\n \t\thns3_do_stop(hns);\n \t\thns3_unmap_rx_interrupt(dev);\n-\t\thns3_dev_release_mbufs(hns);\n \t\thw->adapter_state = HNS3_NIC_CONFIGURED;\n \t}\n \thns3_rx_scattered_reset(dev);\ndiff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c\nindex e7f6974..fd20c52 100644\n--- a/drivers/net/hns3/hns3_ethdev_vf.c\n+++ b/drivers/net/hns3/hns3_ethdev_vf.c\n@@ -1941,6 +1941,17 @@ hns3vf_do_stop(struct hns3_adapter *hns)\n \n \thw->mac.link_status = ETH_LINK_DOWN;\n \n+\t/*\n+\t * The \"hns3vf_do_stop\" function will also be called by .stop_service to\n+\t * prepare reset. At the time of global or IMP reset, the command cannot\n+\t * be sent to stop the tx/rx queues. The mbuf in Tx/Rx queues may be\n+\t * accessed during the reset process. So the mbuf can not be released\n+\t * during reset and is required to be released after the reset is\n+\t * completed.\n+\t */\n+\tif (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0)\n+\t\thns3_dev_release_mbufs(hns);\n+\n \tif (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED) == 0) {\n \t\thns3vf_configure_mac_addr(hns, true);\n \t\tret = hns3_reset_all_tqps(hns);\n@@ -2010,7 +2021,6 @@ hns3vf_dev_stop(struct rte_eth_dev *dev)\n \t\thns3_stop_tqps(hw);\n \t\thns3vf_do_stop(hns);\n \t\thns3vf_unmap_rx_interrupt(dev);\n-\t\thns3_dev_release_mbufs(hns);\n \t\thw->adapter_state = HNS3_NIC_CONFIGURED;\n \t}\n \thns3_rx_scattered_reset(dev);\n@@ -2253,11 +2263,8 @@ hns3vf_dev_start(struct rte_eth_dev *dev)\n \t\treturn ret;\n \t}\n \tret = hns3vf_map_rx_interrupt(dev);\n-\tif (ret) {\n-\t\thw->adapter_state = HNS3_NIC_CONFIGURED;\n-\t\trte_spinlock_unlock(&hw->lock);\n-\t\treturn ret;\n-\t}\n+\tif (ret)\n+\t\tgoto map_rx_inter_err;\n \n \t/*\n \t * There are three register used to control the status of a TQP\n@@ -2271,19 +2278,12 @@ hns3vf_dev_start(struct rte_eth_dev *dev)\n \t * status of queue in the dpdk framework.\n \t */\n \tret = hns3_start_all_txqs(dev);\n-\tif (ret) {\n-\t\thw->adapter_state = HNS3_NIC_CONFIGURED;\n-\t\trte_spinlock_unlock(&hw->lock);\n-\t\treturn ret;\n-\t}\n+\tif (ret)\n+\t\tgoto map_rx_inter_err;\n \n \tret = hns3_start_all_rxqs(dev);\n-\tif (ret) {\n-\t\thns3_stop_all_txqs(dev);\n-\t\thw->adapter_state = HNS3_NIC_CONFIGURED;\n-\t\trte_spinlock_unlock(&hw->lock);\n-\t\treturn ret;\n-\t}\n+\tif (ret)\n+\t\tgoto start_all_rxqs_fail;\n \n \thw->adapter_state = HNS3_NIC_STARTED;\n \trte_spinlock_unlock(&hw->lock);\n@@ -2305,6 +2305,15 @@ hns3vf_dev_start(struct rte_eth_dev *dev)\n \thns3_start_tqps(hw);\n \n \treturn ret;\n+\n+start_all_rxqs_fail:\n+\thns3_stop_all_txqs(dev);\n+map_rx_inter_err:\n+\t(void)hns3vf_do_stop(hns);\n+\thw->adapter_state = HNS3_NIC_CONFIGURED;\n+\trte_spinlock_unlock(&hw->lock);\n+\n+\treturn ret;\n }\n \n static bool\n", "prefixes": [ "V3", "12/14" ] }{ "id": 88456, "url": "