igb/igbvf: don't give up
Subsystems (2)
PATCH 1/1 igb/igbvf: don't give up
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.
--- drivers/net/ethernet/intel/igb/e1000_mbx.c | 18 ++++++++++++------ drivers/net/ethernet/intel/igbvf/mbx.c | 20 +++++++++++++------- 2 files changed, 25 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/igb/e1000_mbx.c +12 -6
@@ -322,14 +322,20 @@ static s32 igb_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number) {s32 ret_val = -E1000_ERR_MBX ;u32 p2v_mailbox; +int count =10 ; -/* Take ownership of the buffer */ -wr32 (E1000_P2VMAILBOX (vf_number),E1000_P2VMAILBOX_PFU ); +do { +/* Take ownership of the buffer */ +wr32 (E1000_P2VMAILBOX (vf_number),E1000_P2VMAILBOX_PFU ); -/* reserve mailbox for vf use */ - p2v_mailbox =rd32 (E1000_P2VMAILBOX (vf_number)); -if (p2v_mailbox &E1000_P2VMAILBOX_PFU ) - ret_val =0 ; +/* reserve mailbox for vf use */ + p2v_mailbox =rd32 (E1000_P2VMAILBOX (vf_number)); +if (p2v_mailbox &E1000_P2VMAILBOX_PFU ) { + ret_val =0 ; +break ; + } +udelay (1000 ); + }while (count-- >0 );return ret_val; }
drivers/net/ethernet/intel/igbvf/mbx.c +13 -7
@@ -234,13 +234,19 @@ 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 ; - -/* Take ownership of the buffer */ -ew32 (V2PMAILBOX (0 ),E1000_V2PMAILBOX_VFU ); - -/* reserve mailbox for VF use */ -if (e1000_read_v2p_mailbox (hw) &E1000_V2PMAILBOX_VFU ) - ret_val =E1000_SUCCESS ; +int count =10 ; + +do { +/* Take ownership of the buffer */ +ew32 (V2PMAILBOX (0 ),E1000_V2PMAILBOX_VFU ); + +/* reserve mailbox for VF use */ +if (e1000_read_v2p_mailbox (hw) &E1000_V2PMAILBOX_VFU ) { + ret_val =0 ; +break ; + } +udelay (1000 ); + }while (count-- >0 );return ret_val; }
Signature · 1 line
2.5.0
Brown
PATCH 1/1 igb/igbvf: don't give up
Quoted 10 lines
From: Intel-wired-lan [intel-wired-lan-bounces at lists.osuosl.org] on behalf of Mitch Williams [mitch.a.williams at intel.com]
Sent: Friday, December 11, 2015 4:45 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH] igb/igbvf: don't give upThe 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.
Quoted 8 lines
Add a counter and a delay. The driver will now retry ten times, waiting one millsecond between retries.
Signed-off-by Mitch Williams <[email protected]>--- drivers/net/ethernet/intel/igb/e1000_mbx.c | 18 ++++++++++++------ drivers/net/ethernet/intel/igbvf/mbx.c | 20 +++++++++++++------- 2 files changed, 25 insertions(+), 13 deletions(-)
This is getting flagged by checkpatch for using udelay rather than usleep_range. But it does not seem to be considering it an error or even a warning, rather it just seems to come up as a "CHECK:".
Is there any reason not to use usleep_range here?
--------------------------------------------------------------------------------------------
u1458:[1]/usr/src/kernels/next-queue> git format-patch $item -1 --stdout|./scripts/checkpatch.pl -
CHECK: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt #46: FILE: drivers/net/ethernet/intel/igb/e1000_mbx.c:337:
+ udelay(1000);
CHECK: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt #77: FILE: drivers/net/ethernet/intel/igbvf/mbx.c:248:
+ udelay(1000);
total: 0 errors, 0 warnings, 2 checks, 52 lines checked
Your patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
u1458:[1]/usr/src/kernels/next-queue>
Rustad
PATCH 1/1 igb/igbvf: don't give up
Quoted 1 line · Aaron F
Is there any reason not to use
usleep_rangehere?
Can the routines ever be called from any atomic context, such as an interrupt or while a lock is held? If so, you can't use any form of sleep.
--
Mark Rustad, Networking Division, Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20151218/22af9160/attachment.asc>
Williams
PATCH 1/1 igb/igbvf: don't give up
Yes, these are called from interrupt context. So they can't sleep, no matter how tired they get. -Mitch
Quoted 16 lines
-----Original Message-----
From: Rustad, Mark D
Sent: Thursday, December 17, 2015 5:57 PM
To: Brown, Aaron F
Cc: Williams, Mitch A; intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [next PATCH] igb/igbvf: don't give upQuoted 1 line · Aaron F
Is there any reason not to use
usleep_rangehere?Can the routines ever be called from any atomic context, such as an interrupt or while a lock is held? If so, you can't use any form of sleep.
--
Mark Rustad, Networking Division, Intel Corporation
Brown
PATCH 1/1 igb/igbvf: don't give up
Quoted 8 lines
From: Williams, Mitch A
Sent: Friday, December 18, 2015 8:42 AM
To: Rustad, Mark D; Brown, Aaron F
Cc: intel-wired-lan at lists.osuosl.org
Subject: RE: [Intel-wired-lan] [next PATCH] igb/igbvf: don't give upYes, these are called from interrupt context. So they can't sleep, no matter how tired they get. -Mitch
No matter HOW tired, bummer! Cause for me, sometimes I just can't stay awake another millisecond :)
Quoted 16 lines
Quoted 16 lines
-----Original Message-----
From: Rustad, Mark D
Sent: Thursday, December 17, 2015 5:57 PM
To: Brown, Aaron F
Cc: Williams, Mitch A; intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [next PATCH] igb/igbvf: don't give upQuoted 1 line · Aaron F
Is there any reason not to use
usleep_rangehere?Can the routines ever be called from any atomic context, such as an interrupt or while a lock is held? If so, you can't use any form of sleep.
--
Mark Rustad, Networking Division, Intel Corporation