]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ixgbe: check for Tx timestamp timeouts during watchdog
authorJacob Keller <jacob.e.keller@intel.com>
Wed, 3 May 2017 17:29:04 +0000 (10:29 -0700)
committerJack Vogel <jack.vogel@oracle.com>
Fri, 13 Oct 2017 02:43:48 +0000 (19:43 -0700)
The ixgbe 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 ixgbe_ptp_tx_hang() function similar to the already existing
ixgbe_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>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Orabug: 26785078
(cherry picked from commit 622a2ef538fb3ca8eccf49716aba8267d6e95a47)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Ethan Zhao <ethan.zhao@oracle.com>
drivers/net/ethernet/intel/ixgbe/ixgbe.h
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c

index c500419fd4177a144abfae05a9eeaa7988dada24..546f78fc9acafb57c9d9bb39d345642fe240adde 100644 (file)
@@ -1005,6 +1005,7 @@ void ixgbe_ptp_suspend(struct ixgbe_adapter *adapter);
 void ixgbe_ptp_stop(struct ixgbe_adapter *adapter);
 void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter);
 void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter);
+void ixgbe_ptp_tx_hang(struct ixgbe_adapter *adapter);
 void ixgbe_ptp_rx_pktstamp(struct ixgbe_q_vector *, struct sk_buff *);
 void ixgbe_ptp_rx_rgtstamp(struct ixgbe_q_vector *, struct sk_buff *skb);
 static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring,
index 51725bb4ab1380a734fa6197a844b4a3a48b9dd7..f2bc27c44123923b84a011281a7792da6b1e1ecb 100644 (file)
@@ -7403,6 +7403,7 @@ static void ixgbe_service_task(struct work_struct *work)
        if (test_bit(__IXGBE_PTP_RUNNING, &adapter->state)) {
                ixgbe_ptp_overflow_check(adapter);
                ixgbe_ptp_rx_hang(adapter);
+               ixgbe_ptp_tx_hang(adapter);
        }
 
        ixgbe_service_event_complete(adapter);
index 6af957313799b27bdc2c64f526408f8a32c64349..b12e0f670ddef0cf9b9802f24c86a512780bf75c 100644 (file)
@@ -662,6 +662,33 @@ static void ixgbe_ptp_clear_tx_timestamp(struct ixgbe_adapter *adapter)
        clear_bit_unlock(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state);
 }
 
+/**
+ * ixgbe_ptp_tx_hang - detect error case where Tx timestamp never finishes
+ * @adapter: private network adapter structure
+ */
+void ixgbe_ptp_tx_hang(struct ixgbe_adapter *adapter)
+{
+       bool timeout = time_is_before_jiffies(adapter->ptp_tx_start +
+                                             IXGBE_PTP_TX_TIMEOUT);
+
+       if (!adapter->ptp_tx_skb)
+               return;
+
+       if (!test_bit(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state))
+               return;
+
+       /* If we haven't received a timestamp within the timeout, it is
+        * reasonable to assume that it will never occur, so we can unlock the
+        * timestamp bit when this occurs.
+        */
+       if (timeout) {
+               cancel_work_sync(&adapter->ptp_tx_work);
+               ixgbe_ptp_clear_tx_timestamp(adapter);
+               adapter->tx_hwtstamp_timeouts++;
+               e_warn(drv, "clearing Tx timestamp hang\n");
+       }
+}
+
 /**
  * ixgbe_ptp_tx_hwtstamp - utility function which checks for TX time stamp
  * @adapter: the private adapter struct