From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com
Cc: Sergey Temerkhanov <sergey.temerkhanov@intel.com>,
netdev@vger.kernel.org, anthony.l.nguyen@intel.com,
richardcochran@gmail.com, Gurucharan G <gurucharanx.g@intel.com>
Subject: [PATCH net-next 01/14] ice: Use more generic names for ice_ptp_tx fields
Date: Wed, 30 Nov 2022 11:43:17 -0800 [thread overview]
Message-ID: <20221130194330.3257836-2-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20221130194330.3257836-1-anthony.l.nguyen@intel.com>
From: Sergey Temerkhanov <sergey.temerkhanov@intel.com>
Some supported devices have per-port timestamp memory blocks while
others have shared ones within quads. Rename the struct ice_ptp_tx
fields to reflect the block entities it works with
Signed-off-by: Sergey Temerkhanov <sergey.temerkhanov@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 | 26 ++++++++++++------------
drivers/net/ethernet/intel/ice/ice_ptp.h | 11 +++++-----
2 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 13e75279e71c..f41f4674cadd 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -651,14 +651,14 @@ static bool ice_ptp_tx_tstamp(struct ice_ptp_tx *tx)
for_each_set_bit(idx, tx->in_use, tx->len) {
struct skb_shared_hwtstamps shhwtstamps = {};
- u8 phy_idx = idx + tx->quad_offset;
+ u8 phy_idx = idx + tx->offset;
u64 raw_tstamp, tstamp;
struct sk_buff *skb;
int err;
ice_trace(tx_tstamp_fw_req, tx->tstamps[idx].skb, idx);
- err = ice_read_phy_tstamp(&pf->hw, tx->quad, phy_idx,
+ err = ice_read_phy_tstamp(&pf->hw, tx->block, phy_idx,
&raw_tstamp);
if (err)
continue;
@@ -713,7 +713,7 @@ static bool ice_ptp_tx_tstamp(struct ice_ptp_tx *tx)
* @tx: Tx tracking structure to initialize
*
* Assumes that the length has already been initialized. Do not call directly,
- * use the ice_ptp_init_tx_e822 or ice_ptp_init_tx_e810 instead.
+ * use the ice_ptp_init_tx_* instead.
*/
static int
ice_ptp_alloc_tx_tracker(struct ice_ptp_tx *tx)
@@ -747,7 +747,7 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
u8 idx;
for (idx = 0; idx < tx->len; idx++) {
- u8 phy_idx = idx + tx->quad_offset;
+ u8 phy_idx = idx + tx->offset;
spin_lock(&tx->lock);
if (tx->tstamps[idx].skb) {
@@ -760,7 +760,7 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
/* Clear any potential residual timestamp in the PHY block */
if (!pf->hw.reset_ongoing)
- ice_clear_phy_tstamp(&pf->hw, tx->quad, phy_idx);
+ ice_clear_phy_tstamp(&pf->hw, tx->block, phy_idx);
}
}
@@ -801,9 +801,9 @@ ice_ptp_release_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
static int
ice_ptp_init_tx_e822(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port)
{
- tx->quad = port / ICE_PORTS_PER_QUAD;
- tx->quad_offset = (port % ICE_PORTS_PER_QUAD) * INDEX_PER_PORT;
- tx->len = INDEX_PER_PORT;
+ tx->block = port / ICE_PORTS_PER_QUAD;
+ tx->offset = (port % ICE_PORTS_PER_QUAD) * INDEX_PER_PORT_E822;
+ tx->len = INDEX_PER_PORT_E822;
return ice_ptp_alloc_tx_tracker(tx);
}
@@ -819,9 +819,9 @@ ice_ptp_init_tx_e822(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port)
static int
ice_ptp_init_tx_e810(struct ice_pf *pf, struct ice_ptp_tx *tx)
{
- tx->quad = pf->hw.port_info->lport;
- tx->quad_offset = 0;
- tx->len = INDEX_PER_QUAD;
+ tx->block = pf->hw.port_info->lport;
+ tx->offset = 0;
+ tx->len = INDEX_PER_PORT_E810;
return ice_ptp_alloc_tx_tracker(tx);
}
@@ -854,7 +854,7 @@ static void ice_ptp_tx_tstamp_cleanup(struct ice_pf *pf, struct ice_ptp_tx *tx)
continue;
/* Read tstamp to be able to use this register again */
- ice_read_phy_tstamp(hw, tx->quad, idx + tx->quad_offset,
+ ice_read_phy_tstamp(hw, tx->block, idx + tx->offset,
&raw_tstamp);
spin_lock(&tx->lock);
@@ -2359,7 +2359,7 @@ s8 ice_ptp_request_ts(struct ice_ptp_tx *tx, struct sk_buff *skb)
if (idx >= tx->len)
return -1;
else
- return idx + tx->quad_offset;
+ return idx + tx->offset;
}
/**
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h
index 028349295b71..ca0fbfd71ed2 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.h
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.h
@@ -108,8 +108,8 @@ struct ice_tx_tstamp {
* @lock: lock to prevent concurrent write to in_use bitmap
* @tstamps: array of len to store outstanding requests
* @in_use: bitmap of len to indicate which slots are in use
- * @quad: which quad the timestamps are captured in
- * @quad_offset: offset into timestamp block of the quad to get the real index
+ * @block: which memory block (quad or port) the timestamps are captured in
+ * @offset: offset into timestamp block to get the real index
* @len: length of the tstamps and in_use fields.
* @init: if true, the tracker is initialized;
* @calibrating: if true, the PHY is calibrating the Tx offset. During this
@@ -119,8 +119,8 @@ struct ice_ptp_tx {
spinlock_t lock; /* lock protecting in_use bitmap */
struct ice_tx_tstamp *tstamps;
unsigned long *in_use;
- u8 quad;
- u8 quad_offset;
+ u8 block;
+ u8 offset;
u8 len;
u8 init;
u8 calibrating;
@@ -128,7 +128,8 @@ struct ice_ptp_tx {
/* Quad and port information for initializing timestamp blocks */
#define INDEX_PER_QUAD 64
-#define INDEX_PER_PORT (INDEX_PER_QUAD / ICE_PORTS_PER_QUAD)
+#define INDEX_PER_PORT_E822 16
+#define INDEX_PER_PORT_E810 64
/**
* struct ice_ptp_port - data used to initialize an external port for PTP
--
2.35.1
next prev parent reply other threads:[~2022-11-30 19:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 19:43 [PATCH net-next 00/14][pull request] Intel Wired LAN Driver Updates 2022-11-30 (ice) Tony Nguyen
2022-11-30 19:43 ` Tony Nguyen [this message]
2022-11-30 19:43 ` [PATCH net-next 02/14] ice: Remove the E822 vernier "bypass" logic Tony Nguyen
2022-11-30 19:43 ` [PATCH net-next 03/14] ice: Reset TS memory for all quads Tony Nguyen
2022-11-30 19:43 ` [PATCH net-next 04/14] ice: fix misuse of "link err" with "link status" Tony Nguyen
2022-11-30 19:43 ` [PATCH net-next 05/14] ice: always call ice_ptp_link_change and make it void Tony Nguyen
2022-11-30 19:43 ` [PATCH net-next 06/14] ice: handle discarding old Tx requests in ice_ptp_tx_tstamp Tony Nguyen
2022-12-01 14:58 ` Paolo Abeni
2022-12-01 15:04 ` Paolo Abeni
2022-12-02 17:59 ` Jacob Keller
2022-11-30 19:43 ` [PATCH net-next 07/14] ice: check Tx timestamp memory register for ready timestamps Tony Nguyen
2022-11-30 19:43 ` [PATCH net-next 08/14] ice: protect init and calibrating fields with spinlock Tony Nguyen
2022-12-01 9:18 ` Leon Romanovsky
2022-12-02 18:36 ` Jacob Keller
2022-12-02 23:07 ` Jacob Keller
2022-12-04 13:30 ` Leon Romanovsky
2022-12-05 19:57 ` Jacob Keller
2022-11-30 19:43 ` [PATCH net-next 09/14] ice: disable Tx timestamps while link is down Tony Nguyen
2022-11-30 19:43 ` [PATCH net-next 10/14] ice: cleanup allocations in ice_ptp_alloc_tx_tracker Tony Nguyen
2022-11-30 19:43 ` [PATCH net-next 11/14] ice: handle flushing stale Tx timestamps in ice_ptp_tx_tstamp Tony Nguyen
2022-11-30 19:43 ` [PATCH net-next 12/14] ice: only check set bits in ice_ptp_flush_tx_tracker Tony Nguyen
2022-11-30 19:43 ` [PATCH net-next 13/14] ice: make Tx and Rx vernier offset calibration independent Tony Nguyen
2022-11-30 19:43 ` [PATCH net-next 14/14] 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=20221130194330.3257836-2-anthony.l.nguyen@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gurucharanx.g@intel.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=sergey.temerkhanov@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.