All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
To: dev@dpdk.org
Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>
Subject: [PATCH 03/16] e1000/base: try more times to get HW mailbox lock
Date: Wed, 23 Nov 2016 12:22:47 -0500	[thread overview]
Message-ID: <1479921780-9813-4-git-send-email-wenzhuo.lu@intel.com> (raw)
In-Reply-To: <1479921780-9813-1-git-send-email-wenzhuo.lu@intel.com>

The driver shouldn't just give up if it fails to get the
hardware mailbox lock. This can happen in a situation
where the PF-VF communication channel is heavily loaded
and causes complete communications failure between the PF
and VF drivers.

Add a counter and a delay. The driver will now retry ten
times, waiting one millsecond between retries.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/e1000/base/e1000_mbx.c | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/drivers/net/e1000/base/e1000_mbx.c b/drivers/net/e1000/base/e1000_mbx.c
index 6daf16b..a92fd22 100644
--- a/drivers/net/e1000/base/e1000_mbx.c
+++ b/drivers/net/e1000/base/e1000_mbx.c
@@ -430,15 +430,21 @@ STATIC s32 e1000_check_for_rst_vf(struct e1000_hw *hw,
 STATIC s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw)
 {
 	s32 ret_val = -E1000_ERR_MBX;
+	int count = 10;
 
 	DEBUGFUNC("e1000_obtain_mbx_lock_vf");
 
-	/* Take ownership of the buffer */
-	E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_VFU);
+	do {
+		/* Take ownership of the buffer */
+		E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_VFU);
 
-	/* reserve mailbox for vf use */
-	if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU)
-		ret_val = E1000_SUCCESS;
+		/* reserve mailbox for vf use */
+		if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU) {
+			ret_val = E1000_SUCCESS;
+			break;
+		}
+		usec_delay(1000);
+	} while (count-- > 0);
 
 	return ret_val;
 }
@@ -645,18 +651,26 @@ STATIC s32 e1000_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
 {
 	s32 ret_val = -E1000_ERR_MBX;
 	u32 p2v_mailbox;
+	int count = 10;
 
 	DEBUGFUNC("e1000_obtain_mbx_lock_pf");
 
-	/* Take ownership of the buffer */
-	E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU);
+	do {
+		/* Take ownership of the buffer */
+		E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number),
+				E1000_P2VMAILBOX_PFU);
 
-	/* reserve mailbox for vf use */
-	p2v_mailbox = E1000_READ_REG(hw, E1000_P2VMAILBOX(vf_number));
-	if (p2v_mailbox & E1000_P2VMAILBOX_PFU)
-		ret_val = E1000_SUCCESS;
+		/* reserve mailbox for pf use */
+		p2v_mailbox = E1000_READ_REG(hw, E1000_P2VMAILBOX(vf_number));
+		if (p2v_mailbox & E1000_P2VMAILBOX_PFU) {
+			ret_val = E1000_SUCCESS;
+			break;
+		}
+		usec_delay(1000);
+	} while (count-- > 0);
 
 	return ret_val;
+
 }
 
 /**
-- 
1.9.3

  parent reply	other threads:[~2016-11-24  1:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23 17:22 [PATCH 00/16] e1000 base code update Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 01/16] e1000/base: increased ULP timer Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 02/16] e1000/base: increase PHY PLL clock gate timing Wenzhuo Lu
2016-11-23 17:22 ` Wenzhuo Lu [this message]
2016-11-23 17:22 ` [PATCH 04/16] e1000/base: add getting HW version support for i354 Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 05/16] e1000/base: expose e1000_write_vfta_i350 Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 06/16] e1000/base: add max RX jumbo frame define Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 07/16] e1000/base: restore link speed after ULP exit Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 08/16] e1000/base: clear ULP configuration register on " Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 09/16] e1000/base: increase LANPHYPC low duration Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 10/16] e1000/base: workaround for ULP entry flow Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 11/16] e1000/base: enable new i219 devices Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 12/16] e1000/base: always request clock during K1 at 1G link speed Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 13/16] e1000/base: ability to force K1-off disabled Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 14/16] e1000/base: support more i219 devices Wenzhuo Lu
2016-11-23 17:22 ` [PATCH 15/16] e1000/base: update readme Wenzhuo Lu
2016-11-23 17:23 ` [PATCH 16/16] e1000: add new i219 devices Wenzhuo Lu
2016-11-25 12:54 ` [PATCH 00/16] e1000 base code update Ferruh Yigit
2016-11-28  1:15   ` Lu, Wenzhuo
2016-11-25 12:58 ` Ferruh Yigit
2016-11-28  1:16   ` Lu, Wenzhuo
2016-11-28 11:33   ` Thomas Monjalon
2016-11-29  0:30     ` Lu, Wenzhuo
2016-11-29  9:28       ` Thomas Monjalon

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=1479921780-9813-4-git-send-email-wenzhuo.lu@intel.com \
    --to=wenzhuo.lu@intel.com \
    --cc=dev@dpdk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.