summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/i40e/i40e_ptp.c
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2014-12-14 01:55:09 +0000
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-01-16 03:56:54 -0800
commit22b4777da2b34e3e4e886c6eec866a9e43852357 (patch)
treeaa7c317877c270fcfd21f17678818d51ba106af0 /drivers/net/ethernet/intel/i40e/i40e_ptp.c
parentab437b5a0fd4534c68933671a2a44c5ca0e75479 (diff)
i40e: check I40E_FLAG_PTP before handling Tx or Rx timestamps
We should not be doing Tx or Rx timestamps if we do not have PTP enabled. Add checks to ensure that we don't attempt to handle any PTP related timestamping code if we have not enabled PTP on that PF. Change-ID: I4335942ae2d5c5f91abfdbeeea02bcace49e7677 Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_ptp.c')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ptp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
index 6d1ec926aa37..a15287845570 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
@@ -305,6 +305,13 @@ void i40e_ptp_tx_hwtstamp(struct i40e_pf *pf)
u32 hi, lo;
u64 ns;
+ if (!(pf->flags & I40E_FLAG_PTP) || !pf->ptp_tx)
+ return;
+
+ /* don't attempt to timestamp if we don't have an skb */
+ if (!pf->ptp_tx_skb)
+ return;
+
lo = rd32(hw, I40E_PRTTSYN_TXTIME_L);
hi = rd32(hw, I40E_PRTTSYN_TXTIME_H);
@@ -338,7 +345,7 @@ void i40e_ptp_rx_hwtstamp(struct i40e_pf *pf, struct sk_buff *skb, u8 index)
/* Since we cannot turn off the Rx timestamp logic if the device is
* doing Tx timestamping, check if Rx timestamping is configured.
*/
- if (!pf->ptp_rx)
+ if (!(pf->flags & I40E_FLAG_PTP) || !pf->ptp_rx)
return;
hw = &pf->hw;