get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1229963/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1229963,
    "url": "http://patchwork.ozlabs.org/api/patches/1229963/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200127085927.13999-2-anthony.l.nguyen@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20200127085927.13999-2-anthony.l.nguyen@intel.com>",
    "list_archive_url": null,
    "date": "2020-01-27T08:59:14",
    "name": "[S39,02/15] ice: update malicious driver detection event handling",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "b51c71bc987ba4f93891dbac60d2cb57d87f22e6",
    "submitter": {
        "id": 68875,
        "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api",
        "name": "Tony Nguyen",
        "email": "anthony.l.nguyen@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200127085927.13999-2-anthony.l.nguyen@intel.com/mbox/",
    "series": [
        {
            "id": 155506,
            "url": "http://patchwork.ozlabs.org/api/series/155506/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=155506",
            "date": "2020-01-27T08:59:25",
            "name": "[S39,01/15] ice: Validate config for SW DCB map",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/155506/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1229963/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1229963/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.137;\n\thelo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 485xdj3b8Tz9sRW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 28 Jan 2020 04:32:25 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 0DC6584806;\n\tMon, 27 Jan 2020 17:32:24 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id dBSPB0Dp-Et6; Mon, 27 Jan 2020 17:32:22 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id ABBBB8517E;\n\tMon, 27 Jan 2020 17:32:22 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 97C271BF283\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jan 2020 17:32:18 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 8EE58879F0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jan 2020 17:32:18 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 4CQ0HD0AVZUH for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jan 2020 17:32:17 +0000 (UTC)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 15BE0879CC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jan 2020 17:32:17 +0000 (UTC)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Jan 2020 09:32:09 -0800",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby fmsmga005.fm.intel.com with ESMTP; 27 Jan 2020 09:32:09 -0800"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.70,370,1574150400\"; d=\"scan'208\";a=\"427350638\"",
        "From": "Tony Nguyen <anthony.l.nguyen@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Mon, 27 Jan 2020 00:59:14 -0800",
        "Message-Id": "<20200127085927.13999-2-anthony.l.nguyen@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20200127085927.13999-1-anthony.l.nguyen@intel.com>",
        "References": "<20200127085927.13999-1-anthony.l.nguyen@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH S39 02/15] ice: update malicious driver\n\tdetection event handling",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Paul Greenwalt <paul.greenwalt@intel.com>\n\nUpdate the PF VFs MDD event message to rate limit once per second and\nreport the total number Rx|Tx event count. Add support to print pending\nMDD events that occur during the rate limit. The use of net_ratelimit did\nnot allow for per VF Rx|Tx granularity.\n\nAdditional PF MDD log messages are guarded by netif_msg_[rx|tx]_err().\n\nSince VF RX MDD events disable the queue, add ethtool private flag\nmdd-auto-reset-vf to configure VF reset to re-enable the queue.\n\nDisable anti-spoof detection interrupt to prevent spurious events\nduring a function reset.\n\nTo avoid race condition do not make PF MDD register reads conditional\non global MDD result.\n\nSigned-off-by: Paul Greenwalt <paul.greenwalt@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice.h          |   4 +\n drivers/net/ethernet/intel/ice/ice_ethtool.c  |   1 +\n .../net/ethernet/intel/ice/ice_hw_autogen.h   |   2 +\n drivers/net/ethernet/intel/ice/ice_main.c     | 126 ++++++++++--------\n .../net/ethernet/intel/ice/ice_virtchnl_pf.c  |  54 +++++++-\n .../net/ethernet/intel/ice/ice_virtchnl_pf.h  |  20 ++-\n 6 files changed, 148 insertions(+), 59 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex 8b33fe62198f..92e44a87f905 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -216,6 +216,7 @@ enum ice_state {\n \t__ICE_SERVICE_SCHED,\n \t__ICE_SERVICE_DIS,\n \t__ICE_OICR_INTR_DIS,\t\t/* Global OICR interrupt disabled */\n+\t__ICE_MDD_VF_PRINT_PENDING,\t/* set when MDD event handle */\n \t__ICE_STATE_NBITS\t\t/* must be last */\n };\n \n@@ -347,6 +348,7 @@ enum ice_pf_flags {\n \tICE_FLAG_FW_LLDP_AGENT,\n \tICE_FLAG_ETHTOOL_CTXT,\t\t/* set when ethtool holds RTNL lock */\n \tICE_FLAG_LEGACY_RX,\n+\tICE_FLAG_MDD_AUTO_RESET_VF,\n \tICE_PF_FLAGS_NBITS\t\t/* must be last */\n };\n \n@@ -370,6 +372,8 @@ struct ice_pf {\n \tu16 num_vfs_supported;\t\t/* num VFs supported for this PF */\n \tu16 num_vf_qps;\t\t\t/* num queue pairs per VF */\n \tu16 num_vf_msix;\t\t/* num vectors per VF */\n+\t/* used to ratelimit the MDD event logging */\n+\tunsigned long last_printed_mdd_jiffies;\n \tDECLARE_BITMAP(state, __ICE_STATE_NBITS);\n \tDECLARE_BITMAP(flags, ICE_PF_FLAGS_NBITS);\n \tunsigned long *avail_txqs;\t/* bitmap to track PF Tx queue usage */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c\nindex 7b34c7c04547..db14ec2e0b46 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c\n@@ -157,6 +157,7 @@ struct ice_priv_flag {\n static const struct ice_priv_flag ice_gstrings_priv_flags[] = {\n \tICE_PRIV_FLAG(\"link-down-on-close\", ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA),\n \tICE_PRIV_FLAG(\"fw-lldp-agent\", ICE_FLAG_FW_LLDP_AGENT),\n+\tICE_PRIV_FLAG(\"mdd-auto-reset-vf\", ICE_FLAG_MDD_AUTO_RESET_VF),\n \tICE_PRIV_FLAG(\"legacy-rx\", ICE_FLAG_LEGACY_RX),\n };\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\nindex d767c398ac71..57f1c4513c0b 100644\n--- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\n+++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\n@@ -218,6 +218,8 @@\n #define VPLAN_TX_QBASE_VFNUMQ_M\t\t\tICE_M(0xFF, 16)\n #define VPLAN_TXQ_MAPENA(_VF)\t\t\t(0x00073800 + ((_VF) * 4))\n #define VPLAN_TXQ_MAPENA_TX_ENA_M\t\tBIT(0)\n+#define GL_MDCK_TX_TDPU\t\t\t\t0x00049348\n+#define GL_MDCK_TX_TDPU_RCU_ANTISPOOF_ITR_DIS_M BIT(1)\n #define GL_MDET_RX\t\t\t\t0x00294C00\n #define GL_MDET_RX_QNUM_S\t\t\t0\n #define GL_MDET_RX_QNUM_M\t\t\tICE_M(0x7FFF, 0)\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 3857e3f7a3f2..bbc428c4ec07 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -1190,20 +1190,28 @@ static void ice_service_timer(struct timer_list *t)\n  * ice_handle_mdd_event - handle malicious driver detect event\n  * @pf: pointer to the PF structure\n  *\n- * Called from service task. OICR interrupt handler indicates MDD event\n+ * Called from service task. OICR interrupt handler indicates MDD event.\n+ * VF MDD logging is guarded by net_ratelimit. Additional PF and VF log\n+ * messages are wrapped by netif_msg_[rx|tx]_err. Since VF Rx MDD events\n+ * disable the queue, the PF can be configured to reset the VF using ethtool\n+ * private flag mdd-auto-reset-vf.\n  */\n static void ice_handle_mdd_event(struct ice_pf *pf)\n {\n \tstruct device *dev = ice_pf_to_dev(pf);\n \tstruct ice_hw *hw = &pf->hw;\n-\tbool mdd_detected = false;\n \tu32 reg;\n \tint i;\n \n-\tif (!test_and_clear_bit(__ICE_MDD_EVENT_PENDING, pf->state))\n+\tif (!test_and_clear_bit(__ICE_MDD_EVENT_PENDING, pf->state)) {\n+\t\t/* Since the VF MDD event logging is rate limited, check if\n+\t\t * there are pending MDD events.\n+\t\t */\n+\t\tice_print_vfs_mdd_events(pf);\n \t\treturn;\n+\t}\n \n-\t/* find what triggered the MDD event */\n+\t/* find what triggered an MDD event */\n \treg = rd32(hw, GL_MDET_TX_PQM);\n \tif (reg & GL_MDET_TX_PQM_VALID_M) {\n \t\tu8 pf_num = (reg & GL_MDET_TX_PQM_PF_NUM_M) >>\n@@ -1219,7 +1227,6 @@ static void ice_handle_mdd_event(struct ice_pf *pf)\n \t\t\tdev_info(dev, \"Malicious Driver Detection event %d on TX queue %d PF# %d VF# %d\\n\",\n \t\t\t\t event, queue, pf_num, vf_num);\n \t\twr32(hw, GL_MDET_TX_PQM, 0xffffffff);\n-\t\tmdd_detected = true;\n \t}\n \n \treg = rd32(hw, GL_MDET_TX_TCLAN);\n@@ -1237,7 +1244,6 @@ static void ice_handle_mdd_event(struct ice_pf *pf)\n \t\t\tdev_info(dev, \"Malicious Driver Detection event %d on TX queue %d PF# %d VF# %d\\n\",\n \t\t\t\t event, queue, pf_num, vf_num);\n \t\twr32(hw, GL_MDET_TX_TCLAN, 0xffffffff);\n-\t\tmdd_detected = true;\n \t}\n \n \treg = rd32(hw, GL_MDET_RX);\n@@ -1255,85 +1261,85 @@ static void ice_handle_mdd_event(struct ice_pf *pf)\n \t\t\tdev_info(dev, \"Malicious Driver Detection event %d on RX queue %d PF# %d VF# %d\\n\",\n \t\t\t\t event, queue, pf_num, vf_num);\n \t\twr32(hw, GL_MDET_RX, 0xffffffff);\n-\t\tmdd_detected = true;\n \t}\n \n-\tif (mdd_detected) {\n-\t\tbool pf_mdd_detected = false;\n-\n-\t\treg = rd32(hw, PF_MDET_TX_PQM);\n-\t\tif (reg & PF_MDET_TX_PQM_VALID_M) {\n-\t\t\twr32(hw, PF_MDET_TX_PQM, 0xFFFF);\n-\t\t\tdev_info(dev, \"TX driver issue detected, PF reset issued\\n\");\n-\t\t\tpf_mdd_detected = true;\n-\t\t}\n+\t/* check to see if this PF caused an MDD event */\n+\treg = rd32(hw, PF_MDET_TX_PQM);\n+\tif (reg & PF_MDET_TX_PQM_VALID_M) {\n+\t\twr32(hw, PF_MDET_TX_PQM, 0xFFFF);\n+\t\tif (netif_msg_tx_err(pf))\n+\t\t\tdev_info(dev, \"Malicious Driver Detection event TX_PQM detected on PF\\n\");\n+\t}\n \n-\t\treg = rd32(hw, PF_MDET_TX_TCLAN);\n-\t\tif (reg & PF_MDET_TX_TCLAN_VALID_M) {\n-\t\t\twr32(hw, PF_MDET_TX_TCLAN, 0xFFFF);\n-\t\t\tdev_info(dev, \"TX driver issue detected, PF reset issued\\n\");\n-\t\t\tpf_mdd_detected = true;\n-\t\t}\n+\treg = rd32(hw, PF_MDET_TX_TCLAN);\n+\tif (reg & PF_MDET_TX_TCLAN_VALID_M) {\n+\t\twr32(hw, PF_MDET_TX_TCLAN, 0xFFFF);\n+\t\tif (netif_msg_tx_err(pf))\n+\t\t\tdev_info(dev, \"Malicious Driver Detection event TX_TCLAN detected on PF\\n\");\n+\t}\n \n-\t\treg = rd32(hw, PF_MDET_RX);\n-\t\tif (reg & PF_MDET_RX_VALID_M) {\n-\t\t\twr32(hw, PF_MDET_RX, 0xFFFF);\n-\t\t\tdev_info(dev, \"RX driver issue detected, PF reset issued\\n\");\n-\t\t\tpf_mdd_detected = true;\n-\t\t}\n-\t\t/* Queue belongs to the PF initiate a reset */\n-\t\tif (pf_mdd_detected) {\n-\t\t\tset_bit(__ICE_NEEDS_RESTART, pf->state);\n-\t\t\tice_service_task_schedule(pf);\n-\t\t}\n+\treg = rd32(hw, PF_MDET_RX);\n+\tif (reg & PF_MDET_RX_VALID_M) {\n+\t\twr32(hw, PF_MDET_RX, 0xFFFF);\n+\t\tif (netif_msg_rx_err(pf))\n+\t\t\tdev_info(dev, \"Malicious Driver Detection event RX detected on PF\\n\");\n \t}\n \n-\t/* check to see if one of the VFs caused the MDD */\n+\t/* Check to see if one of the VFs caused an MDD event, and then\n+\t * increment counters and set print pending\n+\t */\n \tice_for_each_vf(pf, i) {\n \t\tstruct ice_vf *vf = &pf->vf[i];\n \n-\t\tbool vf_mdd_detected = false;\n-\n \t\treg = rd32(hw, VP_MDET_TX_PQM(i));\n \t\tif (reg & VP_MDET_TX_PQM_VALID_M) {\n \t\t\twr32(hw, VP_MDET_TX_PQM(i), 0xFFFF);\n-\t\t\tvf_mdd_detected = true;\n-\t\t\tdev_info(dev, \"TX driver issue detected on VF %d\\n\",\n-\t\t\t\t i);\n+\t\t\tvf->mdd_tx_events.count++;\n+\t\t\tset_bit(__ICE_MDD_VF_PRINT_PENDING, pf->state);\n+\t\t\tif (netif_msg_tx_err(pf))\n+\t\t\t\tdev_info(dev, \"Malicious Driver Detection event TX_PQM detected on VF %d\\n\",\n+\t\t\t\t\t i);\n \t\t}\n \n \t\treg = rd32(hw, VP_MDET_TX_TCLAN(i));\n \t\tif (reg & VP_MDET_TX_TCLAN_VALID_M) {\n \t\t\twr32(hw, VP_MDET_TX_TCLAN(i), 0xFFFF);\n-\t\t\tvf_mdd_detected = true;\n-\t\t\tdev_info(dev, \"TX driver issue detected on VF %d\\n\",\n-\t\t\t\t i);\n+\t\t\tvf->mdd_tx_events.count++;\n+\t\t\tset_bit(__ICE_MDD_VF_PRINT_PENDING, pf->state);\n+\t\t\tif (netif_msg_tx_err(pf))\n+\t\t\t\tdev_info(dev, \"Malicious Driver Detection event TX_TCLAN detected on VF %d\\n\",\n+\t\t\t\t\t i);\n \t\t}\n \n \t\treg = rd32(hw, VP_MDET_TX_TDPU(i));\n \t\tif (reg & VP_MDET_TX_TDPU_VALID_M) {\n \t\t\twr32(hw, VP_MDET_TX_TDPU(i), 0xFFFF);\n-\t\t\tvf_mdd_detected = true;\n-\t\t\tdev_info(dev, \"TX driver issue detected on VF %d\\n\",\n-\t\t\t\t i);\n+\t\t\tvf->mdd_tx_events.count++;\n+\t\t\tset_bit(__ICE_MDD_VF_PRINT_PENDING, pf->state);\n+\t\t\tif (netif_msg_tx_err(pf))\n+\t\t\t\tdev_info(dev, \"Malicious Driver Detection event TX_TDPU detected on VF %d\\n\",\n+\t\t\t\t\t i);\n \t\t}\n \n \t\treg = rd32(hw, VP_MDET_RX(i));\n \t\tif (reg & VP_MDET_RX_VALID_M) {\n \t\t\twr32(hw, VP_MDET_RX(i), 0xFFFF);\n-\t\t\tvf_mdd_detected = true;\n-\t\t\tdev_info(dev, \"RX driver issue detected on VF %d\\n\",\n-\t\t\t\t i);\n-\t\t}\n-\n-\t\tif (vf_mdd_detected) {\n-\t\t\tvf->num_mdd_events++;\n-\t\t\tif (vf->num_mdd_events &&\n-\t\t\t    vf->num_mdd_events <= ICE_MDD_EVENTS_THRESHOLD)\n-\t\t\t\tdev_info(dev, \"VF %d has had %llu MDD events since last boot, Admin might need to reload AVF driver with this number of events\\n\",\n-\t\t\t\t\t i, vf->num_mdd_events);\n+\t\t\tvf->mdd_rx_events.count++;\n+\t\t\tset_bit(__ICE_MDD_VF_PRINT_PENDING, pf->state);\n+\t\t\tif (netif_msg_rx_err(pf))\n+\t\t\t\tdev_info(dev, \"Malicious Driver Detection event RX detected on VF %d\\n\",\n+\t\t\t\t\t i);\n+\n+\t\t\t/* Since the queue is disabled on VF Rx MDD events, the\n+\t\t\t * PF can be configured to reset the VF through ethtool\n+\t\t\t * private flag mdd-auto-reset-vf.\n+\t\t\t */\n+\t\t\tif (test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags))\n+\t\t\t\tice_reset_vf(&pf->vf[i], false);\n \t\t}\n \t}\n+\n+\tice_print_vfs_mdd_events(pf);\n }\n \n /**\n@@ -2001,6 +2007,14 @@ static void ice_ena_misc_vector(struct ice_pf *pf)\n \tstruct ice_hw *hw = &pf->hw;\n \tu32 val;\n \n+\t/* Disable anti-spoof detection interrupt to prevent spurious event\n+\t * interrupts during a function reset. Anti-spoof functionally is\n+\t * still supported.\n+\t */\n+\tval = rd32(hw, GL_MDCK_TX_TDPU);\n+\tval |= GL_MDCK_TX_TDPU_RCU_ANTISPOOF_ITR_DIS_M;\n+\twr32(hw, GL_MDCK_TX_TDPU, val);\n+\n \t/* clear things first */\n \twr32(hw, PFINT_OICR_ENA, 0);\t/* disable all */\n \trd32(hw, PFINT_OICR);\t\t/* read to clear */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex 7d778b3d5d5a..c84ac00a316e 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -171,6 +171,11 @@ static void ice_free_vf_res(struct ice_vf *vf)\n \t}\n \n \tlast_vector_idx = vf->first_vector_idx + pf->num_vf_msix - 1;\n+\n+\t/* clear VF MDD event information */\n+\tmemset(&vf->mdd_tx_events, 0, sizeof(vf->mdd_tx_events));\n+\tmemset(&vf->mdd_rx_events, 0, sizeof(vf->mdd_rx_events));\n+\n \t/* Disable interrupts so that VF starts in a known state */\n \tfor (i = vf->first_vector_idx; i <= last_vector_idx; i++) {\n \t\twr32(&pf->hw, GLINT_DYN_CTL(i), GLINT_DYN_CTL_CLEARPBA_M);\n@@ -1175,7 +1180,7 @@ static bool ice_is_vf_disabled(struct ice_vf *vf)\n  *\n  * Returns true if the VF is reset, false otherwise.\n  */\n-static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)\n+bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)\n {\n \tstruct ice_pf *pf = vf->pf;\n \tstruct ice_vsi *vsi;\n@@ -3538,3 +3543,50 @@ int ice_get_vf_stats(struct net_device *netdev, int vf_id,\n \n \treturn 0;\n }\n+\n+/**\n+ * ice_print_vfs_mdd_event - print VFs malicious driver detect event\n+ * @pf: pointer to the PF structure\n+ *\n+ * Called from ice_handle_mdd_event to rate limit and print VFs MDD events.\n+ */\n+void ice_print_vfs_mdd_events(struct ice_pf *pf)\n+{\n+\tstruct device *dev = ice_pf_to_dev(pf);\n+\tstruct ice_hw *hw = &pf->hw;\n+\tint i;\n+\n+\t/* check that there are pending MDD events to print */\n+\tif (!test_and_clear_bit(__ICE_MDD_VF_PRINT_PENDING, pf->state))\n+\t\treturn;\n+\n+\t/* VF MDD event logs are rate limited to one second intervals */\n+\tif (time_is_after_jiffies(pf->last_printed_mdd_jiffies + HZ * 1))\n+\t\treturn;\n+\n+\tpf->last_printed_mdd_jiffies = jiffies;\n+\n+\tice_for_each_vf(pf, i) {\n+\t\tstruct ice_vf *vf = &pf->vf[i];\n+\n+\t\t/* only print Rx MDD event message if there are new events */\n+\t\tif (vf->mdd_rx_events.count != vf->mdd_rx_events.last_printed) {\n+\t\t\tvf->mdd_rx_events.last_printed =\n+\t\t\t\t\t\t\tvf->mdd_rx_events.count;\n+\n+\t\t\tdev_info(dev, \"%d Rx Malicious Driver Detection events detected on PF %d VF %d. mdd-auto-reset-vfs=%s\\n\",\n+\t\t\t\t vf->mdd_rx_events.count, hw->pf_id, i,\n+\t\t\t\t test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)\n+\t\t\t\t\t  ? \"on\" : \"off\");\n+\t\t}\n+\n+\t\t/* only print Tx MDD event message if there are new events */\n+\t\tif (vf->mdd_tx_events.count != vf->mdd_tx_events.last_printed) {\n+\t\t\tvf->mdd_tx_events.last_printed =\n+\t\t\t\t\t\t\tvf->mdd_tx_events.count;\n+\n+\t\t\tdev_info(dev, \"%d Tx Malicious Driver Detection events detected on PF %d VF %d.\\n\",\n+\t\t\t\t vf->mdd_tx_events.count, hw->pf_id, i);\n+\t\t}\n+\t}\n+}\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\nindex 474b2613f09c..656f1909b38f 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\n@@ -55,6 +55,13 @@ enum ice_virtchnl_cap {\n \tICE_VIRTCHNL_VF_CAP_PRIVILEGE,\n };\n \n+/* VF MDD events print structure */\n+struct ice_mdd_vf_events {\n+\tu16 count;\t\t\t/* total count of Rx|Tx events */\n+\t/* count number of the last printed event */\n+\tu16 last_printed;\n+};\n+\n /* VF information structure */\n struct ice_vf {\n \tstruct ice_pf *pf;\n@@ -83,13 +90,14 @@ struct ice_vf {\n \tunsigned int tx_rate;\t\t/* Tx bandwidth limit in Mbps */\n \tDECLARE_BITMAP(vf_states, ICE_VF_STATES_NBITS);\t/* VF runtime states */\n \n-\tu64 num_mdd_events;\t\t/* number of MDD events detected */\n \tu64 num_inval_msgs;\t\t/* number of continuous invalid msgs */\n \tu64 num_valid_msgs;\t\t/* number of valid msgs detected */\n \tunsigned long vf_caps;\t\t/* VF's adv. capabilities */\n \tu8 num_req_qs;\t\t\t/* num of queue pairs requested by VF */\n \tu16 num_mac;\n \tu16 num_vf_qs;\t\t\t/* num of queue configured per VF */\n+\tstruct ice_mdd_vf_events mdd_rx_events;\n+\tstruct ice_mdd_vf_events mdd_tx_events;\n };\n \n #ifdef CONFIG_PCI_IOV\n@@ -104,6 +112,7 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event);\n void ice_vc_notify_link_state(struct ice_pf *pf);\n void ice_vc_notify_reset(struct ice_pf *pf);\n bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr);\n+bool ice_reset_vf(struct ice_vf *vf, bool is_vflr);\n \n int\n ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,\n@@ -123,7 +132,7 @@ ice_get_vf_stats(struct net_device *netdev, int vf_id,\n \t\t struct ifla_vf_stats *vf_stats);\n void\n ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);\n-\n+void ice_print_vfs_mdd_events(struct ice_pf *pf);\n #else /* CONFIG_PCI_IOV */\n #define ice_process_vflr_event(pf) do {} while (0)\n #define ice_free_vfs(pf) do {} while (0)\n@@ -132,6 +141,7 @@ ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);\n #define ice_vc_notify_reset(pf) do {} while (0)\n #define ice_set_vf_state_qs_dis(vf) do {} while (0)\n #define ice_vf_lan_overflow_event(pf, event) do {} while (0)\n+#define ice_print_vfs_mdd_events(pf) do {} while (0)\n \n static inline bool\n ice_reset_all_vfs(struct ice_pf __always_unused *pf,\n@@ -140,6 +150,12 @@ ice_reset_all_vfs(struct ice_pf __always_unused *pf,\n \treturn true;\n }\n \n+static inline bool\n+ice_reset_vf(struct ice_vf __always_unused *vf, bool __always_unused is_vflr)\n+{\n+\treturn true;\n+}\n+\n static inline int\n ice_sriov_configure(struct pci_dev __always_unused *pdev,\n \t\t    int __always_unused num_vfs)\n",
    "prefixes": [
        "S39",
        "02/15"
    ]
}