Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/63664/?format=api
https://patches.dpdk.org/api/patches/63664/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20191209135928.31697-1-taox.zhu@intel.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": "<20191209135928.31697-1-taox.zhu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20191209135928.31697-1-taox.zhu@intel.com", "date": "2019-12-09T13:59:28", "name": "net/i40e: add PF MDD event handler", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "c543efc5c32976b4bec11272f4d042483623ae03", "submitter": { "id": 1368, "url": "https://patches.dpdk.org/api/people/1368/?format=api", "name": "Zhu, TaoX", "email": "taox.zhu@intel.com" }, "delegate": { "id": 31221, "url": "https://patches.dpdk.org/api/users/31221/?format=api", "username": "yexl", "first_name": "xiaolong", "last_name": "ye", "email": "xiaolong.ye@intel.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20191209135928.31697-1-taox.zhu@intel.com/mbox/", "series": [ { "id": 7753, "url": "https://patches.dpdk.org/api/series/7753/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=7753", "date": "2019-12-09T13:59:28", "name": "net/i40e: add PF MDD event handler", "version": 1, "mbox": "https://patches.dpdk.org/series/7753/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/63664/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/63664/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 7A553A04F1;\n\tMon, 9 Dec 2019 06:35:25 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id AC4662C12;\n\tMon, 9 Dec 2019 06:35:24 +0100 (CET)", "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by dpdk.org (Postfix) with ESMTP id 4DCED23D\n for <dev@dpdk.org>; Mon, 9 Dec 2019 06:35:21 +0100 (CET)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 08 Dec 2019 21:35:20 -0800", "from unknown (HELO localhost.localdomain) ([10.240.176.181])\n by fmsmga001.fm.intel.com with ESMTP; 08 Dec 2019 21:35:19 -0800" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.69,294,1571727600\"; d=\"scan'208\";a=\"219908215\"", "From": "taox.zhu@intel.com", "To": "beilei.xing@intel.com,\n\tqi.z.zhang@intel.com", "Cc": "dev@dpdk.org,\n\tZhu Tao <taox.zhu@intel.com>", "Date": "Mon, 9 Dec 2019 21:59:28 +0800", "Message-Id": "<20191209135928.31697-1-taox.zhu@intel.com>", "X-Mailer": "git-send-email 2.17.1", "Subject": "[dpdk-dev] [PATCH] net/i40e: add PF MDD event handler", "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: Zhu Tao <taox.zhu@intel.com>\n\nThis patch adds a handler for malicious driver detection event.\nWe just gave a warning log and a statistical count on the PF.\n\nSigned-off-by: Zhu Tao <taox.zhu@intel.com>\n---\n doc/guides/nics/i40e.rst | 1 +\n doc/guides/rel_notes/release_20_02.rst | 4 ++\n drivers/net/i40e/i40e_ethdev.c | 87 +++++++++++++++++++++++++-\n drivers/net/i40e/i40e_ethdev.h | 1 +\n 4 files changed, 91 insertions(+), 2 deletions(-)", "diff": "diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst\nindex 38acf5906..539ea5c57 100644\n--- a/doc/guides/nics/i40e.rst\n+++ b/doc/guides/nics/i40e.rst\n@@ -43,6 +43,7 @@ Features of the i40e PMD are:\n - Dynamic Device Personalization (DDP)\n - Queue region configuration\n - Virtual Function Port Representors\n+- Malicious Device Drive event catch and notify\n \n Prerequisites\n -------------\ndiff --git a/doc/guides/rel_notes/release_20_02.rst b/doc/guides/rel_notes/release_20_02.rst\nindex 0eaa45a76..5f39006a4 100644\n--- a/doc/guides/rel_notes/release_20_02.rst\n+++ b/doc/guides/rel_notes/release_20_02.rst\n@@ -56,6 +56,10 @@ New Features\n Also, make sure to start the actual text at the margin.\n =========================================================\n \n+* **Updated the Intel i40e driver.**\n+\n+ Added PF support Malicious Device Drive event catch and notify.\n+\n \n Removed Items\n -------------\ndiff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex 5999c964b..87e638196 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -6760,6 +6760,85 @@ i40e_dev_handle_aq_msg(struct rte_eth_dev *dev)\n \trte_free(info.msg_buf);\n }\n \n+static void\n+i40e_handle_mdd_event(struct rte_eth_dev *dev)\n+{\n+\tstruct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tstruct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n+\tbool mdd_detected = false;\n+\tstruct i40e_pf_vf *vf;\n+\tuint32_t reg;\n+\tint i;\n+\n+\t/* find what triggered the MDD event */\n+\treg = I40E_READ_REG(hw, I40E_GL_MDET_TX);\n+\tif (reg & I40E_GL_MDET_TX_VALID_MASK) {\n+\t\tuint8_t pf_num = (reg & I40E_GL_MDET_TX_PF_NUM_MASK) >>\n+\t\t\t\tI40E_GL_MDET_TX_PF_NUM_SHIFT;\n+\t\tuint16_t vf_num = (reg & I40E_GL_MDET_TX_VF_NUM_MASK) >>\n+\t\t\t\tI40E_GL_MDET_TX_VF_NUM_SHIFT;\n+\t\tuint8_t event = (reg & I40E_GL_MDET_TX_EVENT_MASK) >>\n+\t\t\t\tI40E_GL_MDET_TX_EVENT_SHIFT;\n+\t\tuint16_t queue = ((reg & I40E_GL_MDET_TX_QUEUE_MASK) >>\n+\t\t\t\tI40E_GL_MDET_TX_QUEUE_SHIFT) -\n+\t\t\t\t\thw->func_caps.base_queue;\n+\t\tPMD_DRV_LOG(WARNING, \"Malicious Driver Detection event 0x%02x on TX \"\n+\t\t\t\"queue %d PF number 0x%02x VF number 0x%02x device %s\\n\",\n+\t\t\t\tevent, queue, pf_num, vf_num, dev->data->name);\n+\t\tI40E_WRITE_REG(hw, I40E_GL_MDET_TX, 0xffffffff);\n+\t\tmdd_detected = true;\n+\t}\n+\treg = I40E_READ_REG(hw, I40E_GL_MDET_RX);\n+\tif (reg & I40E_GL_MDET_RX_VALID_MASK) {\n+\t\tuint8_t func = (reg & I40E_GL_MDET_RX_FUNCTION_MASK) >>\n+\t\t\t\tI40E_GL_MDET_RX_FUNCTION_SHIFT;\n+\t\tuint8_t event = (reg & I40E_GL_MDET_RX_EVENT_MASK) >>\n+\t\t\t\tI40E_GL_MDET_RX_EVENT_SHIFT;\n+\t\tuint16_t queue = ((reg & I40E_GL_MDET_RX_QUEUE_MASK) >>\n+\t\t\t\tI40E_GL_MDET_RX_QUEUE_SHIFT) -\n+\t\t\t\t\thw->func_caps.base_queue;\n+\n+\t\tPMD_DRV_LOG(WARNING, \"Malicious Driver Detection event 0x%02x on RX \"\n+\t\t\t\t\"queue %d of function 0x%02x device %s\\n\",\n+\t\t\t\t\tevent, queue, func, dev->data->name);\n+\t\tI40E_WRITE_REG(hw, I40E_GL_MDET_RX, 0xffffffff);\n+\t\tmdd_detected = true;\n+\t}\n+\n+\tif (mdd_detected) {\n+\t\treg = I40E_READ_REG(hw, I40E_PF_MDET_TX);\n+\t\tif (reg & I40E_PF_MDET_TX_VALID_MASK) {\n+\t\t\tI40E_WRITE_REG(hw, I40E_PF_MDET_TX, 0xFFFF);\n+\t\t\tPMD_DRV_LOG(WARNING, \"TX driver issue detected on PF\\n\");\n+\t\t}\n+\t\treg = I40E_READ_REG(hw, I40E_PF_MDET_RX);\n+\t\tif (reg & I40E_PF_MDET_RX_VALID_MASK) {\n+\t\t\tI40E_WRITE_REG(hw, I40E_PF_MDET_RX, 0xFFFF);\n+\t\t\tPMD_DRV_LOG(WARNING, \"RX driver issue detected on PF\\n\");\n+\t\t}\n+\t}\n+\n+\t/* see if one of the VFs needs its hand slapped */\n+\tfor (i = 0; i < pf->vf_num && mdd_detected; i++) {\n+\t\tvf = &pf->vfs[i];\n+\t\treg = I40E_READ_REG(hw, I40E_VP_MDET_TX(i));\n+\t\tif (reg & I40E_VP_MDET_TX_VALID_MASK) {\n+\t\t\tI40E_WRITE_REG(hw, I40E_VP_MDET_TX(i), 0xFFFF);\n+\t\t\tvf->num_mdd_events++;\n+\t\t\tPMD_DRV_LOG(WARNING, \"TX driver issue detected on VF %d %lu times\\n\",\n+\t\t\t\t\ti, vf->num_mdd_events);\n+\t\t}\n+\n+\t\treg = I40E_READ_REG(hw, I40E_VP_MDET_RX(i));\n+\t\tif (reg & I40E_VP_MDET_RX_VALID_MASK) {\n+\t\t\tI40E_WRITE_REG(hw, I40E_VP_MDET_RX(i), 0xFFFF);\n+\t\t\tvf->num_mdd_events++;\n+\t\t\tPMD_DRV_LOG(WARNING, \"RX driver issue detected on VF %d %lu times\\n\",\n+\t\t\t\t\ti, vf->num_mdd_events);\n+\t\t}\n+\t}\n+}\n+\n /**\n * Interrupt handler triggered by NIC for handling\n * specific interrupt.\n@@ -6792,8 +6871,10 @@ i40e_dev_interrupt_handler(void *param)\n \t}\n \tif (icr0 & I40E_PFINT_ICR0_ECC_ERR_MASK)\n \t\tPMD_DRV_LOG(ERR, \"ICR0: unrecoverable ECC error\");\n-\tif (icr0 & I40E_PFINT_ICR0_MAL_DETECT_MASK)\n+\tif (icr0 & I40E_PFINT_ICR0_MAL_DETECT_MASK) {\n \t\tPMD_DRV_LOG(ERR, \"ICR0: malicious programming detected\");\n+\t\ti40e_handle_mdd_event(dev);\n+\t}\n \tif (icr0 & I40E_PFINT_ICR0_GRST_MASK)\n \t\tPMD_DRV_LOG(INFO, \"ICR0: global reset requested\");\n \tif (icr0 & I40E_PFINT_ICR0_PCI_EXCEPTION_MASK)\n@@ -6837,8 +6918,10 @@ i40e_dev_alarm_handler(void *param)\n \t\tgoto done;\n \tif (icr0 & I40E_PFINT_ICR0_ECC_ERR_MASK)\n \t\tPMD_DRV_LOG(ERR, \"ICR0: unrecoverable ECC error\");\n-\tif (icr0 & I40E_PFINT_ICR0_MAL_DETECT_MASK)\n+\tif (icr0 & I40E_PFINT_ICR0_MAL_DETECT_MASK) {\n \t\tPMD_DRV_LOG(ERR, \"ICR0: malicious programming detected\");\n+\t\ti40e_handle_mdd_event(dev);\n+\t}\n \tif (icr0 & I40E_PFINT_ICR0_GRST_MASK)\n \t\tPMD_DRV_LOG(INFO, \"ICR0: global reset requested\");\n \tif (icr0 & I40E_PFINT_ICR0_PCI_EXCEPTION_MASK)\ndiff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h\nindex 295ad593b..b14521017 100644\n--- a/drivers/net/i40e/i40e_ethdev.h\n+++ b/drivers/net/i40e/i40e_ethdev.h\n@@ -426,6 +426,7 @@ struct i40e_pf_vf {\n \t/* version of the virtchnl from VF */\n \tstruct virtchnl_version_info version;\n \tuint32_t request_caps; /* offload caps requested from VF */\n+\tuint64_t num_mdd_events; /* num of mdd events detected */\n \n \t/*\n \t * Variables for store the arrival timestamp of VF messages.\n", "prefixes": [] }{ "id": 63664, "url": "