From 84d137d14d4b66993eee2dfe04e8518b627de52d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 20 Mar 2021 11:52:43 +0100 Subject: [PATCH] 4.9-stable patches added patches: ixgbe-check-for-tx-timestamp-timeouts-during-watchdog.patch ixgbe-prevent-ptp_rx_hang-from-running-when-in-filter_all-mode.patch --- ...x-timestamp-timeouts-during-watchdog.patch | 91 +++++++++++++++++++ ...from-running-when-in-filter_all-mode.patch | 48 ++++++++++ queue-4.9/series | 2 + 3 files changed, 141 insertions(+) create mode 100644 queue-4.9/ixgbe-check-for-tx-timestamp-timeouts-during-watchdog.patch create mode 100644 queue-4.9/ixgbe-prevent-ptp_rx_hang-from-running-when-in-filter_all-mode.patch diff --git a/queue-4.9/ixgbe-check-for-tx-timestamp-timeouts-during-watchdog.patch b/queue-4.9/ixgbe-check-for-tx-timestamp-timeouts-during-watchdog.patch new file mode 100644 index 00000000000..edaad6832c6 --- /dev/null +++ b/queue-4.9/ixgbe-check-for-tx-timestamp-timeouts-during-watchdog.patch @@ -0,0 +1,91 @@ +From 622a2ef538fb3ca8eccf49716aba8267d6e95a47 Mon Sep 17 00:00:00 2001 +From: Jacob Keller +Date: Wed, 3 May 2017 10:29:04 -0700 +Subject: ixgbe: check for Tx timestamp timeouts during watchdog + +From: Jacob Keller + +commit 622a2ef538fb3ca8eccf49716aba8267d6e95a47 upstream. + +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 +Tested-by: Andrew Bowers +Signed-off-by: Jeff Kirsher +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 27 ++++++++++++++++++++++++++ + 3 files changed, 29 insertions(+) + +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h +@@ -991,6 +991,7 @@ void ixgbe_ptp_suspend(struct ixgbe_adap + 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, +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +@@ -7258,6 +7258,7 @@ static void ixgbe_service_task(struct wo + 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); +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +@@ -663,6 +663,33 @@ static void ixgbe_ptp_clear_tx_timestamp + } + + /** ++ * 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 + * diff --git a/queue-4.9/ixgbe-prevent-ptp_rx_hang-from-running-when-in-filter_all-mode.patch b/queue-4.9/ixgbe-prevent-ptp_rx_hang-from-running-when-in-filter_all-mode.patch new file mode 100644 index 00000000000..c000efca9c0 --- /dev/null +++ b/queue-4.9/ixgbe-prevent-ptp_rx_hang-from-running-when-in-filter_all-mode.patch @@ -0,0 +1,48 @@ +From 6704a3abf4cf4181a1ee64f5db4969347b88ca1d Mon Sep 17 00:00:00 2001 +From: Jacob Keller +Date: Mon, 29 Jan 2018 15:57:48 -0800 +Subject: ixgbe: prevent ptp_rx_hang from running when in FILTER_ALL mode + +From: Jacob Keller + +commit 6704a3abf4cf4181a1ee64f5db4969347b88ca1d upstream. + +On hardware which supports timestamping all packets, the timestamps are +recorded in the packet buffer, and the driver no longer uses or reads +the registers. This makes the logic for checking and clearing Rx +timestamp hangs meaningless. + +If we run the ixgbe_ptp_rx_hang() function in this case, then the driver +will continuously spam the log output with "Clearing Rx timestamp hang". +These messages are spurious, and confusing to end users. + +The original code in commit a9763f3cb54c ("ixgbe: Update PTP to support +X550EM_x devices", 2015-12-03) did have a flag PTP_RX_TIMESTAMP_IN_REGISTER +which was intended to be used to avoid the Rx timestamp hang check, +however it did not actually check the flag before calling the function. + +Do so now in order to stop the checks and prevent the spurious log +messages. + +Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices", 2015-12-03) +Signed-off-by: Jacob Keller +Tested-by: Andrew Bowers +Signed-off-by: Jeff Kirsher +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Wen Yang +--- + drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +@@ -7257,7 +7257,8 @@ static void ixgbe_service_task(struct wo + + if (test_bit(__IXGBE_PTP_RUNNING, &adapter->state)) { + ixgbe_ptp_overflow_check(adapter); +- ixgbe_ptp_rx_hang(adapter); ++ if (adapter->flags & IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER) ++ ixgbe_ptp_rx_hang(adapter); + ixgbe_ptp_tx_hang(adapter); + } + diff --git a/queue-4.9/series b/queue-4.9/series index bfcb9056de1..f5c0cbcc6ba 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -2,3 +2,5 @@ ext4-handle-error-of-ext4_setup_system_zone-on-remount.patch ext4-don-t-allow-overlapping-system-zones.patch ext4-check-journal-inode-extents-more-carefully.patch net-dsa-b53-support-setting-learning-on-port.patch +ixgbe-check-for-tx-timestamp-timeouts-during-watchdog.patch +ixgbe-prevent-ptp_rx_hang-from-running-when-in-filter_all-mode.patch -- 2.47.3