diff mbox series

[net-next,01/15] ice: Use more generic names for ice_ptp_tx fields

Message ID 20221101225240.421525-2-jacob.e.keller@intel.com
State Changes Requested
Headers show
Series ice: improve Tx timestamp corner cases | expand

Commit Message

Keller, Jacob E Nov. 1, 2022, 10:52 p.m. UTC
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>
---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 26 ++++++++++++------------
 drivers/net/ethernet/intel/ice/ice_ptp.h | 12 ++++++-----
 2 files changed, 20 insertions(+), 18 deletions(-)

Comments

Tony Nguyen Nov. 3, 2022, 8:44 p.m. UTC | #1
On 11/1/2022 3:52 PM, Jacob Keller wrote:

<snip>

> @@ -128,7 +128,9 @@ 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
> +#define INDEX_PER_PORT_ETH56G		64

I believe this is an extra define (INDEX_PER_PORT_ETH56G)? I'm not 
seeing it used anywhere.

>   
>   /**
>    * struct ice_ptp_port - data used to initialize an external port for PTP
Temerkhanov, Sergey Nov. 3, 2022, 8:50 p.m. UTC | #2
We might want to move it to a different patch, it is used in ETH56G support code.

Regards,
Sergey

-----Original Message-----
From: Nguyen, Anthony L <anthony.l.nguyen@intel.com> 
Sent: Thursday, November 3, 2022 9:44 PM
To: Keller, Jacob E <jacob.e.keller@intel.com>; Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
Cc: Temerkhanov, Sergey <sergey.temerkhanov@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH net-next 01/15] ice: Use more generic names for ice_ptp_tx fields

On 11/1/2022 3:52 PM, Jacob Keller wrote:

<snip>

> @@ -128,7 +128,9 @@ 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
> +#define INDEX_PER_PORT_ETH56G		64

I believe this is an extra define (INDEX_PER_PORT_ETH56G)? I'm not seeing it used anywhere.

>   
>   /**
>    * struct ice_ptp_port - data used to initialize an external port 
> for PTP
---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
Keller, Jacob E Nov. 3, 2022, 8:53 p.m. UTC | #3
On 11/3/2022 1:44 PM, Tony Nguyen wrote:
> On 11/1/2022 3:52 PM, Jacob Keller wrote:
> 
> <snip>
> 
>> @@ -128,7 +128,9 @@ 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
>> +#define INDEX_PER_PORT_ETH56G        64
> 
> I believe this is an extra define (INDEX_PER_PORT_ETH56G)? I'm not 
> seeing it used anywhere.
> 

Yea, we're not ready to send ETH56G support yet.


>>   /**
>>    * struct ice_ptp_port - data used to initialize an external port 
>> for PTP
Keller, Jacob E Nov. 3, 2022, 8:54 p.m. UTC | #4
On 11/3/2022 1:50 PM, Temerkhanov, Sergey wrote:
> We might want to move it to a different patch, it is used in ETH56G support code.
> 
> Regards,
> Sergey
> 

Yea, I'm going to drop it from this we can send it up when ETH56G stuff 
is ready to upstream.

Thanks,
Jake
G, GurucharanX Nov. 17, 2022, 10:40 a.m. UTC | #5
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Jacob Keller
> Sent: Wednesday, November 2, 2022 4:22 AM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Cc: Temerkhanov, Sergey <sergey.temerkhanov@intel.com>
> Subject: [Intel-wired-lan] [PATCH net-next 01/15] ice: Use more generic
> names for ice_ptp_tx fields
> 
> 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>
> ---
>  drivers/net/ethernet/intel/ice/ice_ptp.c | 26 ++++++++++++------------
> drivers/net/ethernet/intel/ice/ice_ptp.h | 12 ++++++-----
>  2 files changed, 20 insertions(+), 18 deletions(-)
> 

Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index ba2758449183..b3bd73714291 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -648,14 +648,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;
@@ -710,7 +710,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)
@@ -744,7 +744,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) {
@@ -757,7 +757,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);
 	}
 }
 
@@ -798,9 +798,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);
 }
@@ -816,9 +816,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);
 }
@@ -851,7 +851,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);
@@ -2401,7 +2401,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..5250ff29a574 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,9 @@  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
+#define INDEX_PER_PORT_ETH56G		64
 
 /**
  * struct ice_ptp_port - data used to initialize an external port for PTP