netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Neerav Parikh <neerav.parikh@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 03/14] i40e: Add PF reset when Malicious driver event for PF
Date: Mon, 23 Jun 2014 17:47:27 -0700	[thread overview]
Message-ID: <1403570858-13548-4-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1403570858-13548-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Neerav Parikh <neerav.parikh@intel.com>

As per the spec when the PF driver receives a Malicious driver event
the queue that caused the event is already stopped and it is expected
that the function that owns the queue will reset the queue.
In some cases it may not be possible to determine the queue and it is
suggested to reset the whole function.

This patch takes the later approach when the event is owned by the PF
that owns it.

Change-ID: I40f9764a6a5e068c0ef8438db00c5aa9c2c6c1c8
Signed-off-by: Neerav Parikh <neerav.parikh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 0a68065..b751258 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -5828,6 +5828,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = &pf->hw;
 	bool mdd_detected = false;
+	bool pf_mdd_detected = false;
 	struct i40e_vf *vf;
 	u32 reg;
 	int i;
@@ -5867,6 +5868,30 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
 		mdd_detected = true;
 	}
 
+	if (mdd_detected) {
+		reg = rd32(hw, I40E_PF_MDET_TX);
+		if (reg & I40E_PF_MDET_TX_VALID_MASK) {
+			wr32(hw, I40E_PF_MDET_TX, 0xFFFF);
+			dev_info(&pf->pdev->dev,
+				 "MDD TX event is for this function 0x%08x requesting PF reset.\n",
+				 reg);
+			pf_mdd_detected = true;
+		}
+		reg = rd32(hw, I40E_PF_MDET_RX);
+		if (reg & I40E_PF_MDET_RX_VALID_MASK) {
+			wr32(hw, I40E_PF_MDET_RX, 0xFFFF);
+			dev_info(&pf->pdev->dev,
+				 "MDD RX event is for this function 0x%08x requesting PF reset.\n",
+				 reg);
+			pf_mdd_detected = true;
+		}
+		/* Queue belongs to the PF initiate a reset */
+		if (pf_mdd_detected) {
+			set_bit(__I40E_PF_RESET_REQUESTED, &pf->state);
+			i40e_service_event_schedule(pf);
+		}
+	}
+
 	/* see if one of the VFs needs its hand slapped */
 	for (i = 0; i < pf->num_alloc_vfs && mdd_detected; i++) {
 		vf = &(pf->vf[i]);
-- 
1.9.3

  parent reply	other threads:[~2014-06-24  0:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24  0:47 [net-next 00/14][pull request] Intel Wired LAN Driver Updates 2014-06-23 Jeff Kirsher
2014-06-24  0:47 ` [net-next 01/14] i40e: Stop the VF device after setting its MAC address Jeff Kirsher
2014-06-24  0:47 ` [net-next 02/14] i40e: make prep_for_reset void Jeff Kirsher
2014-06-24 14:03   ` Sergei Shtylyov
2014-06-24  0:47 ` Jeff Kirsher [this message]
2014-06-24 14:11   ` [net-next 03/14] i40e: Add PF reset when Malicious driver event for PF Sergei Shtylyov
2014-06-24  0:47 ` [net-next 04/14] i40e: warn on newer/older firmware API rev Jeff Kirsher
2014-06-24  0:47 ` [net-next 05/14] i40e: fix a stray print message Jeff Kirsher
2014-06-24  0:47 ` [net-next 06/14] i40e: Fix ethtool coalesce settings Jeff Kirsher
2014-06-24  0:47 ` [net-next 07/14] i40e/i40evf: remove reserved type Jeff Kirsher
2014-06-24  0:47 ` [net-next 08/14] i40e: Add ablitity to enable/disable link from set_link_restart_an Jeff Kirsher
2014-06-24  0:47 ` [net-next 09/14] i40e: use WoL flag when setting LAA Jeff Kirsher
2014-06-24  0:47 ` [net-next 10/14] i40e: allow user to set LAA again Jeff Kirsher
2014-06-24  0:47 ` [net-next 11/14] i40e: reapply LAA after reset Jeff Kirsher
2014-06-24  0:47 ` [net-next 12/14] i40e: no pf reset at pci remove Jeff Kirsher
2014-06-24  0:47 ` [net-next 13/14] i40e: Bypass timeout recovery level 0 so as to not cause MDD Jeff Kirsher
2014-06-24  0:47 ` [net-next 14/14] i40e/i40evf: Bump i40e to 0.4.17 and i40evf to 0.9.36 Jeff Kirsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403570858-13548-4-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=neerav.parikh@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).