public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, Jacob Keller <jacob.e.keller@intel.com>,
	netdev@vger.kernel.org, richardcochran@gmail.com,
	leon@kernel.org, Gurucharan G <gurucharanx.g@intel.com>
Subject: Re: [PATCH net-next v2 10/15] ice: disable Tx timestamps while link is down
Date: Wed, 7 Dec 2022 15:46:44 -0800	[thread overview]
Message-ID: <Y5El5C8EFQhU+Ukd@x130> (raw)
In-Reply-To: <20221207210937.1099650-11-anthony.l.nguyen@intel.com>

On 07 Dec 13:09, Tony Nguyen wrote:
>From: Jacob Keller <jacob.e.keller@intel.com>
>
>Introduce a new link_down field for the Tx tracker which indicates whether
>the link is down for a given port.
>
>Use this bit to prevent any Tx timestamp requests from starting while link
Can tx timestamp requests be generated in a context other than the xmit ndo
? how ?

why not just use the same sync mechanisms we have for tx queues, 
carrier_down etc ..? 

Anyway I'm just curious.. 

>is down. This ensures that we do not try to start new timestamp requests
>until after link has been restored.
>
>Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
>Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
>Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
>---
> drivers/net/ethernet/intel/ice/ice_ptp.c | 11 ++++++++++-
> drivers/net/ethernet/intel/ice/ice_ptp.h |  2 ++
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
>index 481492d84e0e..dffcd50bac3f 100644
>--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
>+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
>@@ -613,7 +613,7 @@ ice_ptp_is_tx_tracker_up(struct ice_ptp_tx *tx)
> {
> 	lockdep_assert_held(&tx->lock);
>
>-	return tx->init && !tx->calibrating;
>+	return tx->init && !tx->calibrating && !tx->link_down;
> }
>
> /**
>@@ -806,6 +806,8 @@ ice_ptp_alloc_tx_tracker(struct ice_ptp_tx *tx)
> 	}
>
> 	tx->init = 1;
>+	tx->link_down = 0;
>+	tx->calibrating = 0;
>
> 	spin_lock_init(&tx->lock);
>
>@@ -1396,6 +1398,13 @@ void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
> 	/* Update cached link status for this port immediately */
> 	ptp_port->link_up = linkup;
>
>+	/* Set the link status of the Tx tracker. While link is down, all Tx
>+	 * timestamp requests will be ignored.
>+	 */
>+	spin_lock(&ptp_port->tx.lock);
>+	ptp_port->tx.link_down = !linkup;
>+	spin_unlock(&ptp_port->tx.lock);
>+
> 	/* E810 devices do not need to reconfigure the PHY */
> 	if (ice_is_e810(&pf->hw))
> 		return;
>diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h
>index 0bfafaaab6c7..75dcab8e1124 100644
>--- a/drivers/net/ethernet/intel/ice/ice_ptp.h
>+++ b/drivers/net/ethernet/intel/ice/ice_ptp.h
>@@ -119,6 +119,7 @@ struct ice_tx_tstamp {
>  * @init: if true, the tracker is initialized;
>  * @calibrating: if true, the PHY is calibrating the Tx offset. During this
>  *               window, timestamps are temporarily disabled.
>+ * @link_down: if true, the link is down and timestamp requests are disabled
>  * @verify_cached: if true, verify new timestamp differs from last read value
>  */
> struct ice_ptp_tx {
>@@ -130,6 +131,7 @@ struct ice_ptp_tx {
> 	u8 len;
> 	u8 init : 1;
> 	u8 calibrating : 1;
>+	u8 link_down : 1;
> 	u8 verify_cached : 1;
> };
>
>-- 
>2.35.1
>

  reply	other threads:[~2022-12-07 23:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 21:09 [PATCH net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2022-12-07 (ice) Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 01/15] ice: Use more generic names for ice_ptp_tx fields Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 02/15] ice: Remove the E822 vernier "bypass" logic Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 03/15] ice: Reset TS memory for all quads Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 04/15] ice: fix misuse of "link err" with "link status" Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 05/15] ice: always call ice_ptp_link_change and make it void Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 06/15] ice: handle discarding old Tx requests in ice_ptp_tx_tstamp Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 07/15] ice: check Tx timestamp memory register for ready timestamps Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 08/15] ice: synchronize the misc IRQ when tearing down Tx tracker Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 09/15] ice: protect init and calibrating check in ice_ptp_request_ts Tony Nguyen
2022-12-07 23:36   ` Saeed Mahameed
2022-12-08  0:29     ` Jacob Keller
2022-12-08 19:48     ` Jacob Keller
2022-12-08  9:22   ` Leon Romanovsky
2022-12-07 21:09 ` [PATCH net-next v2 10/15] ice: disable Tx timestamps while link is down Tony Nguyen
2022-12-07 23:46   ` Saeed Mahameed [this message]
2022-12-08  1:15     ` Jacob Keller
2022-12-08 18:17     ` Jacob Keller
2022-12-07 21:09 ` [PATCH net-next v2 11/15] ice: cleanup allocations in ice_ptp_alloc_tx_tracker Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 12/15] ice: handle flushing stale Tx timestamps in ice_ptp_tx_tstamp Tony Nguyen
2022-12-07 23:56   ` Saeed Mahameed
2022-12-08  1:12     ` Jacob Keller
2022-12-07 21:09 ` [PATCH net-next v2 13/15] ice: only check set bits in ice_ptp_flush_tx_tracker Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 14/15] ice: make Tx and Rx vernier offset calibration independent Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 15/15] ice: reschedule ice_ptp_wait_for_offset_valid during reset Tony Nguyen

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=Y5El5C8EFQhU+Ukd@x130 \
    --to=saeed@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gurucharanx.g@intel.com \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=leon@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