From: Jeff Kirsher <hidden> Date: 2017-05-31 10:49:00
This series contains updates to i40e and i40evf only.
Jesse provides a couple of fixes, starting with cleaning up duplicate
lines of code. Fixed a missing line which enables RSS as a negotiated
feature. Since the VF does not have any way of reporting FCoE enabled,
so just force the code to always report FCoE as disabled.
Jake provides several fixes and changes, starting with fixing a race
condition in i40e. The hardware has a limitation on transmit PTP packets,
which requires us to limit the driver to timestamping a single packet at
once. This is done using a state bitlock which enforces that only one
timestamp request is honored at a time, unfortunately this suffers from
a race condition. Fixed a corner case where we failed to cleanup the
bit lock after a failed transmit, and resulted in a state bit being
locked forever. Added a new statistic which tracks when a transmit
timestamp request is skipped/ignored, since the driver can only handle
one transmit timestamp request at a time.
Christophe Jaillet fixes a NULL pointer dereference if kzalloc fails.
The following are changes since commit ffe406457753a7ca2061ecc8c4d3971623066911:
bnxt_en: Fix xmit_more with BQL.
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue 40GbE
Christophe Jaillet (1):
i40e: Check for memory allocation failure
Jacob Keller (5):
i40e: fix race condition with PTP_TX_IN_PROGRESS bits
i40e: avoid permanent lock of *_PTP_TX_IN_PROGRESS
i40e: add statistic indicating number of skipped Tx timestamps
i40e: use pf data structure directly in i40e_ptp_rx_hang
i40e: check for Tx timestamp timeouts during watchdog
Jesse Brandeburg (3):
i40evf: fix duplicate lines
i40evf: fix merge error in older patch
i40evf: disable unused flags
drivers/net/ethernet/intel/i40e/i40e.h | 5 ++-
drivers/net/ethernet/intel/i40e/i40e_client.c | 2 +
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 +
drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +-
drivers/net/ethernet/intel/i40e/i40e_ptp.c | 48 +++++++++++++++++++---
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 28 ++++++++++---
drivers/net/ethernet/intel/i40evf/i40e_common.c | 3 +-
drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 3 +-
.../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 3 +-
9 files changed, 77 insertions(+), 19 deletions(-)
--
2.12.2
From: Jeff Kirsher <hidden> Date: 2017-05-31 10:49:01
From: Jesse Brandeburg <redacted>
This patch fixes a missing line that was missed while merging,
which results in a driver feature in the VF not working to
enable RSS as a negotiated feature.
Fixes: 43a3d9ba34c9c ("i40evf: Allow PF driver to configure RSS")
Signed-off-by: Jesse Brandeburg <redacted>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 1 +
1 file changed, 1 insertion(+)
From: Jeff Kirsher <hidden> Date: 2017-05-31 10:49:01
From: Jesse Brandeburg <redacted>
The i40evf hardware doesn't have any way to ever report FCoE enabled
so just force the code to always report FCoE is disabled, remove the
unused defines, and mark the OP as reserved.
Signed-off-by: Jesse Brandeburg <redacted>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40evf/i40e_common.c | 3 +--
drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
From: Jeff Kirsher <hidden> Date: 2017-05-31 10:49:02
From: Jacob Keller <jacob.e.keller@intel.com>
Hardware related to the i40e driver has a limitation on Tx PTP packets.
This requires us to limit the driver to timestamping a single packet at
once. This is done using a state bitlock which enforces that only one
timestamp request is honored at a time.
Unfortunately this suffers from a race condition. The bit lock is not
cleared until after skb_tstamp_tx() is called notifying applications of
a new Tx timestamp. Even a well behaved application sending only one
packet at a time and waiting for a response can wake up and send a new
timestamped packet request before the bit lock is cleared. This results
in needlessly dropping some Tx timestamp requests.
We can fix this by unlocking the state bit as soon as we read the
Timestamp register, as this is the first point at which it is safe to
timestamp another packet.
To avoid issues with the skb pointer, we'll use a copy of the pointer
and set the global variable in the driver structure to NULL first. This
ensures that the next timestamp request does not modify our local copy
of the skb pointer.
Now, a well behaved application which has at most one outstanding
timestamp request will not accidentally race with the driver unlock bit.
Obviously an application attempting to timestamp faster than one request
at a time will have some timestamp requests skipped. Unfortunately there
is nothing we can do about that.
Reported-by: David Mirabito <redacted>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e_ptp.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
@@ -353,12 +354,19 @@ void i40e_ptp_tx_hwtstamp(struct i40e_pf *pf)hi=rd32(hw,I40E_PRTTSYN_TXTIME_H);ns=(((u64)hi)<<32)|lo;-i40e_ptp_convert_to_hwtstamp(&shhwtstamps,ns);-skb_tstamp_tx(pf->ptp_tx_skb,&shhwtstamps);-dev_kfree_skb_any(pf->ptp_tx_skb);++/* Clear the bit lock as soon as possible after reading the register,+*andpriortonotifyingthestackviaskb_tstamp_tx().Otherwise+*applicationsmightwakeupandattempttorequestanothertransmit+*timestamppriortothebitlockbeingcleared.+*/pf->ptp_tx_skb=NULL;clear_bit_unlock(__I40E_PTP_TX_IN_PROGRESS,pf->state);++/* Notify the stack and free the skb after we've unlocked */+skb_tstamp_tx(skb,&shhwtstamps);+dev_kfree_skb_any(skb);}/**
From: Jeff Kirsher <hidden> Date: 2017-05-31 10:49:02
From: Jacob Keller <jacob.e.keller@intel.com>
The i40e driver can only handle one Tx timestamp request at a time.
This means it is possible for an application timestamp request to be
ignored.
There is no easy way for an administrator to determine if this occurred.
Add a new statistic which tracks this, tx_hwtstamp_skipped.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e.h | 1 +
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 +
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 1 +
3 files changed, 3 insertions(+)
@@ -506,6 +506,7 @@ struct i40e_pf {structmutextmreg_lock;/* Used to protect the SYSTIME registers. */u64ptp_base_adj;u32tx_hwtstamp_timeouts;+u32tx_hwtstamp_skipped;u32rx_hwtstamp_cleared;u32latch_event_flags;spinlock_tptp_rx_lock;/* Used to protect Rx timestamp registers. */
From: Jeff Kirsher <hidden> Date: 2017-05-31 10:49:02
From: Jacob Keller <jacob.e.keller@intel.com>
The i40e driver uses a bit lock to indicate when a Tx timestamp is in
progress to avoid attempting to timestamp multiple packets at once. This
is required because hardware only has registers to handle one request at
a time.
There is a corner case where we failed to cleanup the bit lock after
a failed transmit. This can potentially result in a state bit being
locked forever.
Add some cleanup code to i40e_xmit_frame_ring to check and make sure we
cleanup incase of these failures. We also modify i40e_tx_map to return
an error code indication DMA failure.
Reported-by: Reported-by: David Mirabito <redacted>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
From: Jeff Kirsher <hidden> Date: 2017-05-31 10:49:03
From: Jacob Keller <jacob.e.keller@intel.com>
The i40e driver has logic to handle only one Tx timestamp at a time,
using a state bit lock to avoid multiple requests at once.
It may be possible, if incredibly unlikely, that a Tx timestamp event is
requested but never completes. Since we use an interrupt scheme to
determine when the Tx timestamp occurred we would never clear the state
bit in this case.
Add an i40e_ptp_tx_hang() function similar to the already existing
i40e_ptp_rx_hang() function. This function runs in the watchdog routine
and makes sure we eventually recover from this case instead of
permanently disabling Tx timestamps.
Note: there is no currently known way to cause this without hacking the
driver code to force it.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e.h | 2 ++
drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
drivers/net/ethernet/intel/i40e/i40e_ptp.c | 30 +++++++++++++++++++++++++++++
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 1 +
4 files changed, 34 insertions(+)
@@ -502,6 +502,7 @@ struct i40e_pf {structptp_clock*ptp_clock;structptp_clock_infoptp_caps;structsk_buff*ptp_tx_skb;+unsignedlongptp_tx_start;structhwtstamp_configtstamp_config;structmutextmreg_lock;/* Used to protect the SYSTIME registers. */u64ptp_base_adj;
@@ -328,6 +328,36 @@ void i40e_ptp_rx_hang(struct i40e_pf *pf)}/**+*i40e_ptp_tx_hang-DetecterrorcasewhenTxtimestampregisterishung+*@pf:ThePFprivatedatastructure+*+*ThiswatchdogtaskisrunperiodicallytomakesurethatwecleartheTx+*timestamplogicifwedon'tobtainatimestampinareasonableamountof+*time.Itisunexpectedinthenormalcasebutifitoccursitresultsin+*permanentlypreventtimestampsoffuturepackets+**/+voidi40e_ptp_tx_hang(structi40e_pf*pf)+{+if(!(pf->flags&I40E_FLAG_PTP)||!pf->ptp_tx)+return;++/* Nothing to do if we're not already waiting for a timestamp */+if(!test_bit(__I40E_PTP_TX_IN_PROGRESS,pf->state))+return;++/* We already have a handler routine which is run when we are notified+*ofaTxtimestampinthehardware.Ifwedon'tgetaninterrupt+*withinaseconditisreasonabletoassumethatweneverwill.+*/+if(time_is_before_jiffies(pf->ptp_tx_start+HZ)){+dev_kfree_skb_any(pf->ptp_tx_skb);+pf->ptp_tx_skb=NULL;+clear_bit_unlock(__I40E_PTP_TX_IN_PROGRESS,pf->state);+pf->tx_hwtstamp_timeouts++;+}+}++/***i40e_ptp_tx_hwtstamp-UtilityfunctionwhichreturnstheTxtimestamp*@pf:Boardprivatestructure*
From: Jeff Kirsher <hidden> Date: 2017-05-31 10:49:03
From: Jacob Keller <jacob.e.keller@intel.com>
There's no reason to pass a *vsi pointer if we already have the *pf
pointer in the only location where we call this function. Lets update
the signature and directly pass the *pf data structure pointer.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e.h | 2 +-
drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
drivers/net/ethernet/intel/i40e/i40e_ptp.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
From: David Miller <davem@davemloft.net> Date: 2017-05-31 21:54:22
From: Jeff Kirsher <redacted>
Date: Wed, 31 May 2017 03:48:47 -0700
This series contains updates to i40e and i40evf only.
Jesse provides a couple of fixes, starting with cleaning up duplicate
lines of code. Fixed a missing line which enables RSS as a negotiated
feature. Since the VF does not have any way of reporting FCoE enabled,
so just force the code to always report FCoE as disabled.
Jake provides several fixes and changes, starting with fixing a race
condition in i40e. The hardware has a limitation on transmit PTP packets,
which requires us to limit the driver to timestamping a single packet at
once. This is done using a state bitlock which enforces that only one
timestamp request is honored at a time, unfortunately this suffers from
a race condition. Fixed a corner case where we failed to cleanup the
bit lock after a failed transmit, and resulted in a state bit being
locked forever. Added a new statistic which tracks when a transmit
timestamp request is skipped/ignored, since the driver can only handle
one transmit timestamp request at a time.
Christophe Jaillet fixes a NULL pointer dereference if kzalloc fails.