Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/134877/?format=api
http://patches.dpdk.org/api/patches/134877/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231205102828.1446631-1-mingjinx.ye@intel.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": "<20231205102828.1446631-1-mingjinx.ye@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20231205102828.1446631-1-mingjinx.ye@intel.com", "date": "2023-12-05T10:28:28", "name": "net/iavf: fix no polling mode switch", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "9431802e83129b78da4e33c20b309adf154e30e6", "submitter": { "id": 2862, "url": "http://patches.dpdk.org/api/people/2862/?format=api", "name": "Mingjin Ye", "email": "mingjinx.ye@intel.com" }, "delegate": { "id": 1540, "url": "http://patches.dpdk.org/api/users/1540/?format=api", "username": "qzhan15", "first_name": "Qi", "last_name": "Zhang", "email": "qi.z.zhang@intel.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231205102828.1446631-1-mingjinx.ye@intel.com/mbox/", "series": [ { "id": 30455, "url": "http://patches.dpdk.org/api/series/30455/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30455", "date": "2023-12-05T10:28:28", "name": "net/iavf: fix no polling mode switch", "version": 1, "mbox": "http://patches.dpdk.org/series/30455/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/134877/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/134877/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 CA37A43676;\n\tTue, 5 Dec 2023 11:43:32 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2EB7942E2F;\n\tTue, 5 Dec 2023 11:43:32 +0100 (CET)", "from mgamail.intel.com (mgamail.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 6CA5140275;\n Tue, 5 Dec 2023 11:43:30 +0100 (CET)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 05 Dec 2023 02:43:29 -0800", "from unknown (HELO localhost.localdomain) ([10.239.252.253])\n by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 05 Dec 2023 02:43:27 -0800" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1701773010; x=1733309010;\n h=from:to:cc:subject:date:message-id:mime-version:\n content-transfer-encoding;\n bh=/iqJ8jC97b9Of+8xCWSB6a7fAjtFh+qnenKJJ7rawQY=;\n b=jkb8V8mf5UyXTq+6Oxnq8Rf5bf3OE3jcaecCbX8P13eisUz8d7sB9zBa\n 85U8SHtqjLg6NqW3sVDm8Eph3OCf7KXxNF7srSCD7/xN9wfIdNQ1Q7NNk\n j03qCpEKS2ggLRxOZn1AdXB1b8UujpYNLLGCn8IxOa67wjAHGj3VHdKUl\n 1UioyK5wUaA9hI4ZJCU3M4J8MKguLalpzBLRQFun2q52hskYgsmQj82dc\n E0X10mBHwQaKB6ak5c1qwxbK/ugU1Ac5EGavxvFYD8Tpgu41MYM4tYPXp\n aJbeED70LF0nG0+62sqOxPa1Srxh5D48bs2IZp6P73BYuALxPBN+Y8oX/ Q==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10914\"; a=\"393609572\"", "E=Sophos;i=\"6.04,251,1695711600\"; d=\"scan'208\";a=\"393609572\"", "E=McAfee;i=\"6600,9927,10914\"; a=\"914758234\"", "E=Sophos;i=\"6.04,251,1695711600\"; d=\"scan'208\";a=\"914758234\"" ], "X-ExtLoop1": "1", "From": "Mingjin Ye <mingjinx.ye@intel.com>", "To": "dev@dpdk.org", "Cc": "qiming.yang@intel.com, Mingjin Ye <mingjinx.ye@intel.com>,\n stable@dpdk.org,\n Jingjing Wu <jingjing.wu@intel.com>, Beilei Xing <beilei.xing@intel.com>", "Subject": "[PATCH] net/iavf: fix no polling mode switch", "Date": "Tue, 5 Dec 2023 10:28:28 +0000", "Message-Id": "<20231205102828.1446631-1-mingjinx.ye@intel.com>", "X-Mailer": "git-send-email 2.25.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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" }, "content": "PMD does not switch to no polling mode when the PF triggers a reset event\nor the watchdog detects a reset event. In this scenario, data path will\naccess the freed resources and cause a core dump.\n\nThis patch fixes this issue by automatically switching modes on VF reset.\n\nFixes: 5b3124a0a6ef (\"net/iavf: support no polling when link down\")\nCc: stable@dpdk.org\n\nSigned-off-by: Mingjin Ye <mingjinx.ye@intel.com>\n---\n drivers/net/iavf/iavf.h | 1 +\n drivers/net/iavf/iavf_ethdev.c | 27 +++++++++++++++++++++++----\n drivers/net/iavf/iavf_vchnl.c | 24 ++++++++++--------------\n 3 files changed, 34 insertions(+), 18 deletions(-)", "diff": "diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h\nindex 10868f2c30..18d39ee652 100644\n--- a/drivers/net/iavf/iavf.h\n+++ b/drivers/net/iavf/iavf.h\n@@ -512,4 +512,5 @@ int iavf_flow_sub_check(struct iavf_adapter *adapter,\n void iavf_dev_watchdog_enable(struct iavf_adapter *adapter);\n void iavf_dev_watchdog_disable(struct iavf_adapter *adapter);\n int iavf_handle_hw_reset(struct rte_eth_dev *dev);\n+void iavf_set_no_poll(struct iavf_adapter *adapter, bool link_change);\n #endif /* _IAVF_ETHDEV_H_ */\ndiff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c\nindex d1edb0dd5c..0952998304 100644\n--- a/drivers/net/iavf/iavf_ethdev.c\n+++ b/drivers/net/iavf/iavf_ethdev.c\n@@ -296,6 +296,7 @@ iavf_dev_watchdog(void *cb_arg)\n \t\t\tPMD_DRV_LOG(INFO, \"VF \\\"%s\\\" reset has completed\",\n \t\t\t\tadapter->vf.eth_dev->data->name);\n \t\t\tadapter->vf.vf_reset = false;\n+\t\t\tiavf_set_no_poll(adapter, false);\n \t\t}\n \t/* If not in reset then poll vfr_inprogress register for VFLR event */\n \t} else {\n@@ -308,6 +309,7 @@ iavf_dev_watchdog(void *cb_arg)\n \n \t\t\t/* enter reset state with VFLR event */\n \t\t\tadapter->vf.vf_reset = true;\n+\t\t\tiavf_set_no_poll(adapter, false);\n \t\t\tadapter->vf.link_up = false;\n \n \t\t\tiavf_dev_event_post(adapter->vf.eth_dev, RTE_ETH_EVENT_INTR_RESET,\n@@ -2916,8 +2918,10 @@ iavf_dev_close(struct rte_eth_dev *dev)\n \t * effect.\n \t */\n out:\n-\tif (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true))\n+\tif (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true)) {\n \t\tvf->vf_reset = false;\n+\t\tiavf_set_no_poll(adapter, false);\n+\t}\n \n \t/* disable watchdog */\n \tiavf_dev_watchdog_disable(adapter);\n@@ -2948,6 +2952,8 @@ static int\n iavf_dev_reset(struct rte_eth_dev *dev)\n {\n \tint ret;\n+\tstruct iavf_adapter *adapter =\n+\t\tIAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);\n \tstruct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);\n \n@@ -2962,6 +2968,7 @@ iavf_dev_reset(struct rte_eth_dev *dev)\n \t\treturn ret;\n \t}\n \tvf->vf_reset = false;\n+\tiavf_set_no_poll(adapter, false);\n \n \tPMD_DRV_LOG(DEBUG, \"Start dev_reset ...\\n\");\n \tret = iavf_dev_uninit(dev);\n@@ -2977,10 +2984,13 @@ iavf_dev_reset(struct rte_eth_dev *dev)\n int\n iavf_handle_hw_reset(struct rte_eth_dev *dev)\n {\n+\tstruct iavf_adapter *adapter =\n+\t\tIAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);\n \tstruct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);\n \tint ret;\n \n \tvf->in_reset_recovery = true;\n+\tiavf_set_no_poll(adapter, false);\n \n \tret = iavf_dev_reset(dev);\n \tif (ret)\n@@ -2998,16 +3008,25 @@ iavf_handle_hw_reset(struct rte_eth_dev *dev)\n \tif (ret)\n \t\tgoto error;\n \tdev->data->dev_started = 1;\n-\n-\tvf->in_reset_recovery = false;\n-\treturn 0;\n+\tgoto exit;\n \n error:\n \tPMD_DRV_LOG(DEBUG, \"RESET recover with error code=%d\\n\", ret);\n+exit:\n \tvf->in_reset_recovery = false;\n+\tiavf_set_no_poll(adapter, false);\n \treturn ret;\n }\n \n+void\n+iavf_set_no_poll(struct iavf_adapter *adapter, bool link_change)\n+{\n+\tstruct iavf_info *vf = &adapter->vf;\n+\n+\tadapter->no_poll = (link_change & !vf->link_up) ||\n+\t\tvf->vf_reset || vf->in_reset_recovery;\n+}\n+\n static int\n iavf_dcf_cap_check_handler(__rte_unused const char *key,\n \t\t\t const char *value, __rte_unused void *opaque)\ndiff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c\nindex 0a3e1d082c..1111d30f57 100644\n--- a/drivers/net/iavf/iavf_vchnl.c\n+++ b/drivers/net/iavf/iavf_vchnl.c\n@@ -273,20 +273,18 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,\n \t\t\t\t\tiavf_dev_watchdog_enable(adapter);\n \t\t\t}\n \t\t\tif (adapter->devargs.no_poll_on_link_down) {\n-\t\t\t\tif (vf->link_up && adapter->no_poll) {\n-\t\t\t\t\tadapter->no_poll = false;\n-\t\t\t\t\tPMD_DRV_LOG(DEBUG, \"VF no poll turned off\");\n-\t\t\t\t}\n-\t\t\t\tif (!vf->link_up) {\n-\t\t\t\t\tadapter->no_poll = true;\n+\t\t\t\tiavf_set_no_poll(adapter, true);\n+\t\t\t\tif (adapter->no_poll)\n \t\t\t\t\tPMD_DRV_LOG(DEBUG, \"VF no poll turned on\");\n-\t\t\t\t}\n+\t\t\t\telse\n+\t\t\t\t\tPMD_DRV_LOG(DEBUG, \"VF no poll turned off\");\n \t\t\t}\n \t\t\tPMD_DRV_LOG(INFO, \"Link status update:%s\",\n \t\t\t\t\tvf->link_up ? \"up\" : \"down\");\n \t\t\tbreak;\n \t\tcase VIRTCHNL_EVENT_RESET_IMPENDING:\n \t\t\tvf->vf_reset = true;\n+\t\t\tiavf_set_no_poll(adapter, false);\n \t\t\tPMD_DRV_LOG(INFO, \"VF is resetting\");\n \t\t\tbreak;\n \t\tcase VIRTCHNL_EVENT_PF_DRIVER_CLOSE:\n@@ -462,6 +460,7 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg,\n \t\tvf->link_up = false;\n \t\tif (!vf->vf_reset) {\n \t\t\tvf->vf_reset = true;\n+\t\t\tiavf_set_no_poll(adapter, false);\n \t\t\tiavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_RESET,\n \t\t\t\tNULL, 0);\n \t\t}\n@@ -485,14 +484,11 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg,\n \t\t\t\tiavf_dev_watchdog_enable(adapter);\n \t\t}\n \t\tif (adapter->devargs.no_poll_on_link_down) {\n-\t\t\tif (vf->link_up && adapter->no_poll) {\n-\t\t\t\tadapter->no_poll = false;\n-\t\t\t\tPMD_DRV_LOG(DEBUG, \"VF no poll turned off\");\n-\t\t\t}\n-\t\t\tif (!vf->link_up) {\n-\t\t\t\tadapter->no_poll = true;\n+\t\t\tiavf_set_no_poll(adapter, true);\n+\t\t\tif (adapter->no_poll)\n \t\t\t\tPMD_DRV_LOG(DEBUG, \"VF no poll turned on\");\n-\t\t\t}\n+\t\t\telse\n+\t\t\t\tPMD_DRV_LOG(DEBUG, \"VF no poll turned off\");\n \t\t}\n \t\tiavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_LSC, NULL, 0);\n \t\tbreak;\n", "prefixes": [] }{ "id": 134877, "url": "