From: Daniel Vacek <neelx@redhat.com>
To: Jesse Brandeburg <jesse.brandeburg@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Richard Cochran <richardcochran@gmail.com>
Cc: Daniel Vacek <neelx@redhat.com>,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] ice/ptp: fix the PTP worker retrying indefinitely if the link went down
Date: Tue, 17 Jan 2023 19:15:32 +0100 [thread overview]
Message-ID: <20230117181533.2350335-1-neelx@redhat.com> (raw)
When the link goes down the ice_ptp_tx_tstamp_work() may loop forever trying
to process the packets. In this case it makes sense to just drop them.
Signed-off-by: Daniel Vacek <neelx@redhat.com>
---
drivers/net/ethernet/intel/ice/ice_ptp.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index d63161d73eb16..c313177ba6676 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -680,6 +680,7 @@ static bool ice_ptp_tx_tstamp(struct ice_ptp_tx *tx)
struct ice_pf *pf;
struct ice_hw *hw;
u64 tstamp_ready;
+ bool link_up;
int err;
u8 idx;
@@ -695,6 +696,8 @@ static bool ice_ptp_tx_tstamp(struct ice_ptp_tx *tx)
if (err)
return false;
+ link_up = hw->port_info->phy.link_info.link_info & ICE_AQ_LINK_UP;
+
for_each_set_bit(idx, tx->in_use, tx->len) {
struct skb_shared_hwtstamps shhwtstamps = {};
u8 phy_idx = idx + tx->offset;
@@ -702,6 +705,12 @@ static bool ice_ptp_tx_tstamp(struct ice_ptp_tx *tx)
bool drop_ts = false;
struct sk_buff *skb;
+ /* Drop packets if the link went down */
+ if (!link_up) {
+ drop_ts = true;
+ goto skip_ts_read;
+ }
+
/* Drop packets which have waited for more than 2 seconds */
if (time_is_before_jiffies(tx->tstamps[idx].start + 2 * HZ)) {
drop_ts = true;
--
2.39.0
next reply other threads:[~2023-01-17 18:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 18:15 Daniel Vacek [this message]
2023-01-17 18:46 ` [Intel-wired-lan] " Jacob Keller
2023-01-18 15:14 ` Daniel Vacek
2023-01-18 20:59 ` Jacob Keller
2023-01-18 22:11 ` Daniel Vacek
2023-01-18 22:22 ` Jacob Keller
2023-01-19 9:38 ` Daniel Vacek
2023-01-19 19:24 ` Jacob Keller
2023-01-19 20:08 ` Daniel Vacek
2023-01-22 17:44 ` D H, Siddaraju
2023-01-19 20:23 ` [PATCH v3] " Daniel Vacek
2023-01-23 19:15 ` Jacob Keller
2023-01-31 4:20 ` [Intel-wired-lan] " G, GurucharanX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230117181533.2350335-1-neelx@redhat.com \
--to=neelx@redhat.com \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®