Skip to contentSkip to conversation

igc: Add TransmissionOverrun counter

PATCH Superseded Muhammad Husaini Zulkifli 2 participants 10 messages Jun 1, 2023 – Jun 14, 2023

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 igc: Add TransmissionOverrun counter

Add TransmissionOverrun as per defined by IEEE 802.1Q Bridges. TransmissionOverrun counter shall be incremented if the implementation detects that a frame from a given queue is still being transmitted by the MAC when that gate-close event for that queue occurs.

This counter is utilised by the Certification conformance test to inform the user application whether any packets are currently being transmitted on a particular queue during a gate-close event.

Intel Discrete I225/I226 have a mechanism to not transmit a packets if the gate open time is insufficient for the packet transmission by setting the Strict_End bit. Thus, it is expected for this counter to be always zero at this moment.

Inspired from enetc_taprio_stats() and enetc_taprio_tc_stats(), now driver also report the tx_overruns counter per traffic class.

User can get this counter by using below command:
1) ethtool -S <interface> | grep Transmit_overruns
2) tc -s qdisc show dev <interface> root
3) tc -s class show dev <interface>

---
V2 -> V3: Included new infra xstats to report back the counter to qdisc V1 -> V2: Change per-queue stats. Driver still remains adding the
statistic independently.
---

---
 drivers/net/ethernet/intel/igc/igc.h         |  1 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c |  4 ++-
 drivers/net/ethernet/intel/igc/igc_main.c    | 38 ++++++++++++++++++++
 drivers/net/ethernet/intel/igc/igc_tsn.c     | 10 ++++++
 4 files changed, 52 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc.h +1 -0
index cb5751fab03c9..2a13e62b75d60 100644
@@ -46,6 +46,7 @@ struct igc_tx_queue_stats {
 	u64 bytes;
 	u64 restart_queue;
 	u64 restart_queue2;
+	u64 tx_overruns;
 };
 
 struct igc_rx_queue_stats {
drivers/net/ethernet/intel/igc/igc_ethtool.c +3 -1
index 0e2cb00622d1a..6a10ae1474fc5 100644
@@ -112,7 +112,7 @@ static const char igc_gstrings_test[][ETH_GSTRING_LEN] = {
 	(sizeof(igc_gstrings_net_stats) / sizeof(struct igc_stats))
 #define IGC_RX_QUEUE_STATS_LEN \
 	(sizeof(struct igc_rx_queue_stats) / sizeof(u64))
-#define IGC_TX_QUEUE_STATS_LEN 3 /* packets, bytes, restart_queue */
+#define IGC_TX_QUEUE_STATS_LEN 4 /* packets, bytes, restart_queue, tx_overruns */
 #define IGC_QUEUE_STATS_LEN \
 	((((struct igc_adapter *)netdev_priv(netdev))->num_rx_queues * \
 	  IGC_RX_QUEUE_STATS_LEN) + \
@@ -781,6 +781,7 @@ static void igc_ethtool_get_strings(struct net_device *netdev, u32 stringset,
 			ethtool_sprintf(&p, "tx_queue_%u_packets", i);
 			ethtool_sprintf(&p, "tx_queue_%u_bytes", i);
 			ethtool_sprintf(&p, "tx_queue_%u_restart", i);
+			ethtool_sprintf(&p, "tx_queue_%u_Transmit_overruns", i);
 		}
 		for (i = 0; i < adapter->num_rx_queues; i++) {
 			ethtool_sprintf(&p, "rx_queue_%u_packets", i);
@@ -850,6 +851,7 @@ static void igc_ethtool_get_stats(struct net_device *netdev,
 			restart2  = ring->tx_stats.restart_queue2;
 		} while (u64_stats_fetch_retry(&ring->tx_syncp2, start));
 		data[i + 2] += restart2;
+		data[i + 3] = ring->tx_stats.tx_overruns;
 
 		i += IGC_TX_QUEUE_STATS_LEN;
 	}
drivers/net/ethernet/intel/igc/igc_main.c +38 -0
index aa9f23b7f0c1a..056925a7bcdd8 100644
@@ -6109,11 +6109,43 @@ static int igc_tsn_clear_schedule(struct igc_adapter *adapter)
 		ring->start_time = 0;
 		ring->end_time = NSEC_PER_SEC;
 		ring->max_sdu = 0;
+		ring->tx_stats.tx_overruns = 0;
 	}
 
 	return 0;
 }
 
+static void igc_taprio_stats(struct net_device *dev,
+			     struct tc_taprio_qopt_stats *stats)
+{
+	struct igc_adapter *adapter = netdev_priv(dev);
+	u64 tx_overruns = 0;
+	int i;
+
+	for (i = 0; i < adapter->num_tx_queues; i++) {
+		struct igc_ring *tx_ring = adapter->tx_ring[i];
+
+		tx_overruns += tx_ring->tx_stats.tx_overruns;
+	}
+
+	stats->tx_overruns = tx_overruns;
+}
+
+static void igc_taprio_tc_stats(struct net_device *dev,
+				struct tc_taprio_qopt_tc_stats *tc_stats)
+{
+	struct tc_taprio_qopt_stats *stats = &tc_stats->stats;
+	struct igc_adapter *adapter = netdev_priv(dev);
+	struct igc_ring *tx_ring;
+	int tc = tc_stats->tc;
+	int txq;
+
+	txq = dev->tc_to_txq[tc].offset;
+	tx_ring = adapter->tx_ring[txq];
+
+	stats->tx_overruns = tx_ring->tx_stats.tx_overruns;
+}
+
 static int igc_save_qbv_schedule(struct igc_adapter *adapter,
 				 struct tc_taprio_qopt_offload *qopt)
 {
@@ -6130,6 +6162,12 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,
 	case TAPRIO_CMD_DESTROY:
 		adapter->qbv_enable = false;
 		break;
+	case TAPRIO_CMD_STATS:
+		igc_taprio_stats(adapter->netdev, &qopt->stats);
+		return 0;
+	case TAPRIO_CMD_TC_STATS:
+		igc_taprio_tc_stats(adapter->netdev, &qopt->tc_stats);
+		return 0;
 	default:
 		return -EOPNOTSUPP;
 	}
drivers/net/ethernet/intel/igc/igc_tsn.c +10 -0
index 6b299b83e7ef2..342530d11aae9 100644
@@ -136,6 +136,16 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
 		txqctl |= IGC_TXQCTL_STRICT_CYCLE |
 			IGC_TXQCTL_STRICT_END;
 
+		/* If it notices that a frame from a particular queue is still
+		 * being transmitted by MAC, tx_overruns shall be increased.
+		 * But currently driver setting Strict_End bit which indicate
+		 * that packet from the queue can be transmitted only if they
+		 * are expected to be completed before the windows of the
+		 * queue is ended. Thus, this counter will always be zero when
+		 * Strict_End is set.
+		 */
+		ring->tx_stats.tx_overruns  = 0;
+
 		if (ring->launchtime_enable)
 			txqctl |= IGC_TXQCTL_QUEUE_MODE_LAUNCHT;
 
Signature · 6 lines
2.17.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#1 lore raw

Hi,

Quoted 10 lines

-----Original Message-----
From: Zulkifli, Muhammad Husaini <[email protected]>
Sent: Thursday, 1 June, 2023 8:59 AM
To: [email protected]
Cc: Gomes, Vinicius <[email protected]>; Zulkifli, Muhammad Husaini <[email protected]>; Neftin, Sasha <[email protected]>; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>
Subject: [PATCH iwl-net v3] igc: Add TransmissionOverrun counter

Sorry I think I accidentally copy paste wrong subject prefix when generate this V3 patch. It should go to "net-next". My bad.

Quoted 171 lines

Add TransmissionOverrun as per defined by IEEE 802.1Q Bridges. TransmissionOverrun counter shall be incremented if the implementation detects that a frame from a given queue is still being transmitted by the MAC when that gate-close event for that queue occurs.

This counter is utilised by the Certification conformance test to inform the user application whether any packets are currently being transmitted on a particular queue during a gate-close event.

Intel Discrete I225/I226 have a mechanism to not transmit a packets if the gate open time is insufficient for the packet transmission by setting the Strict_End bit. Thus, it is expected for this counter to be always zero at this moment.

Inspired from enetc_taprio_stats() and enetc_taprio_tc_stats(), now driver also report the tx_overruns counter per traffic class.

User can get this counter by using below command:
1) ethtool -S <interface> | grep Transmit_overruns
2) tc -s qdisc show dev <interface> root
3) tc -s class show dev <interface>

Signed-off-by: Muhammad Husaini Zulkifli
<[email protected]>

---
V2 -> V3: Included new infra xstats to report back the counter to qdisc V1 -> V2: Change per-queue stats. Driver still remains adding the
statistic independently.
---

---
 drivers/net/ethernet/intel/igc/igc.h         |  1 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c |  4 ++-
 drivers/net/ethernet/intel/igc/igc_main.c    | 38 ++++++++++++++++++++
 drivers/net/ethernet/intel/igc/igc_tsn.c     | 10 ++++++
 4 files changed, 52 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc.h +1 -0
index cb5751fab03c9..2a13e62b75d60 100644
@@ -46,6 +46,7 @@ struct igc_tx_queue_stats {
 	u64 bytes;
 	u64 restart_queue;
 	u64 restart_queue2;
+	u64 tx_overruns;
 };
 
 struct igc_rx_queue_stats {
drivers/net/ethernet/intel/igc/igc_ethtool.c +0 -0
index 0e2cb00622d1a..6a10ae1474fc5 100644
@@ -112,7 +112,7 @@ static const char
 igc_gstrings_test[][ETH_GSTRING_LEN] = {
 	(sizeof(igc_gstrings_net_stats) / sizeof(struct igc_stats))  #define
 IGC_RX_QUEUE_STATS_LEN \
 	(sizeof(struct igc_rx_queue_stats) / sizeof(u64)) -#define

IGC_TX_QUEUE_STATS_LEN 3 /* packets, bytes, restart_queue */

drivers/net/ethernet/intel/igc/igc_ethtool.c +3 -0
+#define IGC_TX_QUEUE_STATS_LEN 4 /* packets, bytes, restart_queue,
+tx_overruns */
 #define IGC_QUEUE_STATS_LEN \
 	((((struct igc_adapter *)netdev_priv(netdev))->num_rx_queues * \
 	  IGC_RX_QUEUE_STATS_LEN) + \
@@ -781,6 +781,7 @@ static void igc_ethtool_get_strings(struct net_device
 *netdev, u32 stringset,
 			ethtool_sprintf(&p, "tx_queue_%u_packets", i);
 			ethtool_sprintf(&p, "tx_queue_%u_bytes", i);
 			ethtool_sprintf(&p, "tx_queue_%u_restart", i);
+			ethtool_sprintf(&p,
 "tx_queue_%u_Transmit_overruns", i);
 		}
drivers/net/ethernet/intel/igc/igc_ethtool.c +0 -0
 		for (i = 0; i < adapter->num_rx_queues; i++) {
 			ethtool_sprintf(&p, "rx_queue_%u_packets", i); @@ -

850,6 +851,7 @@ static void igc_ethtool_get_stats(struct net_device *netdev,

drivers/net/ethernet/intel/igc/igc_ethtool.c +1 -0
 			restart2  = ring->tx_stats.restart_queue2;
 		} while (u64_stats_fetch_retry(&ring->tx_syncp2, start));
 		data[i + 2] += restart2;
+		data[i + 3] = ring->tx_stats.tx_overruns;
 
 		i += IGC_TX_QUEUE_STATS_LEN;
 	}
drivers/net/ethernet/intel/igc/igc_main.c +29 -0
index aa9f23b7f0c1a..056925a7bcdd8 100644
@@ -6109,11 +6109,43 @@ static int igc_tsn_clear_schedule(struct
 igc_adapter *adapter)
 		ring->start_time = 0;
 		ring->end_time = NSEC_PER_SEC;
 		ring->max_sdu = 0;
+		ring->tx_stats.tx_overruns = 0;
 	}
 
 	return 0;
 }
 
+static void igc_taprio_stats(struct net_device *dev,
+			     struct tc_taprio_qopt_stats *stats) {
+	struct igc_adapter *adapter = netdev_priv(dev);
+	u64 tx_overruns = 0;
+	int i;
+
+	for (i = 0; i < adapter->num_tx_queues; i++) {
+		struct igc_ring *tx_ring = adapter->tx_ring[i];
+
+		tx_overruns += tx_ring->tx_stats.tx_overruns;
+	}
+
+	stats->tx_overruns = tx_overruns;
+}
+
+static void igc_taprio_tc_stats(struct net_device *dev,
+				struct tc_taprio_qopt_tc_stats *tc_stats) {
+	struct tc_taprio_qopt_stats *stats = &tc_stats->stats;
+	struct igc_adapter *adapter = netdev_priv(dev);
+	struct igc_ring *tx_ring;
+	int tc = tc_stats->tc;
+	int txq;
+
+	txq = dev->tc_to_txq[tc].offset;
+	tx_ring = adapter->tx_ring[txq];
+
+	stats->tx_overruns = tx_ring->tx_stats.tx_overruns; }
+
 static int igc_save_qbv_schedule(struct igc_adapter *adapter,
 				 struct tc_taprio_qopt_offload *qopt)  { @@ -

6130,6 +6162,12 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,

drivers/net/ethernet/intel/igc/igc_main.c +6 -0
 	case TAPRIO_CMD_DESTROY:
 		adapter->qbv_enable = false;
 		break;
+	case TAPRIO_CMD_STATS:
+		igc_taprio_stats(adapter->netdev, &qopt->stats);
+		return 0;
+	case TAPRIO_CMD_TC_STATS:
+		igc_taprio_tc_stats(adapter->netdev, &qopt->tc_stats);
+		return 0;
 	default:
 		return -EOPNOTSUPP;
 	}
drivers/net/ethernet/intel/igc/igc_tsn.c +6 -0
index 6b299b83e7ef2..342530d11aae9 100644
@@ -136,6 +136,16 @@ static int igc_tsn_enable_offload(struct igc_adapter
 *adapter)
 		txqctl |= IGC_TXQCTL_STRICT_CYCLE |
 			IGC_TXQCTL_STRICT_END;
 
+		/* If it notices that a frame from a particular queue is still
+		 * being transmitted by MAC, tx_overruns shall be increased.
+		 * But currently driver setting Strict_End bit which indicate
+		 * that packet from the queue can be transmitted only if they
+		 * are expected to be completed before the windows of the
+		 * queue is ended. Thus, this counter will always be zero

when

drivers/net/ethernet/intel/igc/igc_tsn.c +4 -1
+		 * Strict_End is set.
+		 */
+		ring->tx_stats.tx_overruns  = 0;
+
 		if (ring->launchtime_enable)
 			txqctl |= IGC_TXQCTL_QUEUE_MODE_LAUNCHT;
 
--
Quoted 1 line

2.17.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#2 lore raw
In reply to Muhammad Husaini Zulkifli

Hi Husaini,

Quoted 14 lines · Muhammad Husaini Zulkifli

Add TransmissionOverrun as per defined by IEEE 802.1Q Bridges. TransmissionOverrun counter shall be incremented if the implementation detects that a frame from a given queue is still being transmitted by the MAC when that gate-close event for that queue occurs.

This counter is utilised by the Certification conformance test to inform the user application whether any packets are currently being transmitted on a particular queue during a gate-close event.

Intel Discrete I225/I226 have a mechanism to not transmit a packets if the gate open time is insufficient for the packet transmission by setting the Strict_End bit. Thus, it is expected for this counter to be always zero at this moment.

Quoted 5 lines

Inspired from enetc_taprio_stats() and enetc_taprio_tc_stats(), now driver also report the tx_overruns counter per traffic class.

User can get this counter by using below command:
1) ethtool -S <interface> | grep Transmit_overruns

Is the unstructured ethtool -S still a viable reporting mechanism if a standardized place for reporting the counter exists?

Quoted 18 lines

2) tc -s qdisc show dev <interface> root
3) tc -s class show dev <interface>

---
V2 -> V3: Included new infra xstats to report back the counter to qdisc V1 -> V2: Change per-queue stats. Driver still remains adding the
statistic independently.
---
---

drivers/net/ethernet/intel/igc/igc_tsn.c +0 -0
index 6b299b83e7ef2..342530d11aae9 100644
@@ -136,6 +136,16 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
 		txqctl |= IGC_TXQCTL_STRICT_CYCLE |
 			IGC_TXQCTL_STRICT_END;

drivers/net/ethernet/intel/igc/igc_tsn.c static int igc_tsn_enable_offload(struct igc_adapter *adapter) · line 147

Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +9 -0
 
+		/* If it notices that a frame from a particular queue is still
+		 * being transmitted by MAC, tx_overruns shall be increased.
+		 * But currently driver setting Strict_End bit which indicate
+		 * that packet from the queue can be transmitted only if they
+		 * are expected to be completed before the windows of the
+		 * queue is ended. Thus, this counter will always be zero when
+		 * Strict_End is set.
+		 */
+		ring->tx_stats.tx_overruns  = 0;

What is the purpose of keeping a constant (0) in a variable replicated per TX queue? It is a waste of space.

Also, if IGC_TXQCTL_STRICT_END wasn't set, how would the window overruns be counted?

Quoted 7 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +1 -0
+
 		if (ring->launchtime_enable)
 			txqctl |= IGC_TXQCTL_QUEUE_MODE_LAUNCHT;
 
Signature · 1 line
2.17.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#3 lore raw

Hi Vladimir,

Quoted 28 lines

-----Original Message-----
From: Vladimir Oltean <[email protected]>
Sent: Tuesday, 6 June, 2023 10:03 PM
To: Zulkifli, Muhammad Husaini <[email protected]>
Cc: [email protected]; Gomes, Vinicius <[email protected]>; Neftin, Sasha <[email protected]>; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>
Subject: Re: [PATCH iwl-net v3] igc: Add TransmissionOverrun counter

Hi Husaini,

Quoted 14 lines · Muhammad Husaini Zulkifli

Add TransmissionOverrun as per defined by IEEE 802.1Q Bridges. TransmissionOverrun counter shall be incremented if the implementation detects that a frame from a given queue is still being transmitted by the MAC when that gate-close event for that queue occurs.

This counter is utilised by the Certification conformance test to inform the user application whether any packets are currently being transmitted on a particular queue during a gate-close event.

Intel Discrete I225/I226 have a mechanism to not transmit a packets if the gate open time is insufficient for the packet transmission by setting the Strict_End bit. Thus, it is expected for this counter to be always zero at this moment.

Quoted 8 lines
Quoted 5 lines

Inspired from enetc_taprio_stats() and enetc_taprio_tc_stats(), now driver also report the tx_overruns counter per traffic class.

User can get this counter by using below command:
1) ethtool -S <interface> | grep Transmit_overruns

Is the unstructured ethtool -S still a viable reporting mechanism if a standardized place for reporting the counter exists?

This can be remove. I will remove the ethtool reporting mechanism.

Quoted 24 lines

drivers/net/ethernet/intel/igc/igc_tsn.c static int igc_tsn_enable_offload(struct

Quoted 20 lines

2) tc -s qdisc show dev <interface> root
3) tc -s class show dev <interface>

Signed-off-by: Muhammad Husaini Zulkifli
<[email protected]>

---
V2 -> V3: Included new infra xstats to report back the counter to qdisc
V1 -> V2: Change per-queue stats. Driver still remains adding the
statistic independently.
---
---

drivers/net/ethernet/intel/igc/igc_tsn.c +0 -0
index 6b299b83e7ef2..342530d11aae9 100644
@@ -136,6 +136,16 @@ static int igc_tsn_enable_offload(struct

igc_adapter *adapter)

Quoted 3 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +0 -0
 		txqctl |= IGC_TXQCTL_STRICT_CYCLE |
 			IGC_TXQCTL_STRICT_END;
 
Quoted 12 lines

drivers/net/ethernet/intel/igc/igc_tsn.c static int igc_tsn_enable_offload(struct igc_adapter *adapter) · line 147

Quoted 9 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +9 -0
+		/* If it notices that a frame from a particular queue is still
+		 * being transmitted by MAC, tx_overruns shall be increased.
+		 * But currently driver setting Strict_End bit which indicate
+		 * that packet from the queue can be transmitted only if they
+		 * are expected to be completed before the windows of the
+		 * queue is ended. Thus, this counter will always be zero when
+		 * Strict_End is set.
+		 */
+		ring->tx_stats.tx_overruns  = 0;

What is the purpose of keeping a constant (0) in a variable replicated per TX queue? It is a waste of space.

Purpose is for the Certification conformance test.
This is used to notify the application (automated) if any packets are currently being transmitted on a certain queue during a gate-close event. Since we set the Strict_end bit, the value will always be zero.

Quoted 3 lines

Also, if IGC_TXQCTL_STRICT_END wasn't set, how would the window overruns be counted?

Currently, there is no log or statistics about packets taking advantage of STRICT_END not being set.

Thanks,
Husaini

Quoted 8 lines
Quoted 8 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +0 -1
 		if (ring->launchtime_enable)
 			txqctl |= IGC_TXQCTL_QUEUE_MODE_LAUNCHT;
 
--

2.17.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#4 lore raw
Quoted 6 lines · Muhammad Husaini
Quoted 2 lines

What is the purpose of keeping a constant (0) in a variable replicated per TX queue? It is a waste of space.

Purpose is for the Certification conformance test.
This is used to notify the application (automated) if any packets are currently being transmitted on a certain queue during a gate-close event.

I agree with you, but that wasn't the question. The question was "why bother keeping a constant (0) in memory storage whose lifetime is the driver's lifetime, when you can just report those constants in the taprio callbacks, bypassing the driver storage, as long as you're not going to read them from hardware anyway".

Quoted 1 line

Since we set the Strict_end bit, the value will always be zero.

Both statements are true ("we set the Strict_end bit" and "the value will always be zero"), but the deduction is false. That's not why the value is zero, the value is zero because no one sets it to any other value :) If the counter actually monitored a physical event, then I'd have agreed with your statement.

Quoted 5 lines
Quoted 2 lines

Also, if IGC_TXQCTL_STRICT_END wasn't set, how would the window overruns be counted?

Currently, there is no log or statistics about packets taking advantage of STRICT_END not being set.

You may have missed my question here.

Does the hardware have any reporting mechanism for TX overruns? Irrespective of what the current driver has or does not have. I imagine the hardware should have something like this, since IGC_TXQCTL_STRICT_END is an opt-in feature, and there should be something non-zero to count when that bit isn't set.

If it does, wouldn't it be better to query the hardware for this information, regardless of the STRICT_END bit, rather than just assume it will be zero?

Due to things like congestion on memory, I suppose it might be possible for the NIC to start the DMA transfer of a frame in time for its timely transmission, but nonetheless the frame transmission could still overrun the window. Only the hardware could know if that was the case or not (or a hardware TX timestamp adjusted for the frame length). So what I'm saying is that there's value in reading this from value even if you think that STRICT_END should be all that's needed.

For context, on NXP LS1028A, the fact that the hardware (ENETC) doesn't report a TransmitOverrun counter is an erratum, even though ENETC also has logic to stop sending packets early enough so as to not overrun the window.

It's a bit of a leap of faith for the software driver to politically report a counter as zero and for higher layers to trust that as first-hand evidence, and this is why, at least in ENETC, I chose to not report TransmitOverrun rather than be confidently wrong about it.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#5 lore raw

Dear Vladimir,

Quoted 8 lines · Muhammad Husaini
Quoted 6 lines
Quoted 2 lines

What is the purpose of keeping a constant (0) in a variable replicated per TX queue? It is a waste of space.

Purpose is for the Certification conformance test.
This is used to notify the application (automated) if any packets are currently being transmitted on a certain queue during a gate-close event.

Quoted 5 lines

I agree with you, but that wasn't the question. The question was "why bother keeping a constant (0) in memory storage whose lifetime is the driver's lifetime, when you can just report those constants in the taprio callbacks, bypassing the driver storage, as long as you're not going to read them from hardware anyway".

Yeah. You are right. I could just report "0" in the taprio callback. Thanks for the suggestion 😊

Quoted 8 lines
Quoted 2 lines

Since we set the Strict_end bit, the value will always be zero.

Both statements are true ("we set the Strict_end bit" and "the value will always be zero"), but the deduction is false. That's not why the value is zero, the value is zero because no one sets it to any other value :) If the counter actually monitored a physical event, then I'd have agreed with your statement.

It's not like no one changed it. This value should be obtained straight from the HW statistic count register. But yeah... I'll get to that in my subsequent comment.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Also, if IGC_TXQCTL_STRICT_END wasn't set, how would the window overruns be counted?

Currently, there is no log or statistics about packets taking advantage of STRICT_END not being set.

You may have missed my question here.

Sorry my bad.

Quoted 2 lines

Does the hardware have any reporting mechanism for TX overruns?

To be honest, no. ☹

Quoted 4 lines

Irrespective of what the current driver has or does not have. I imagine the hardware should have something like this, since IGC_TXQCTL_STRICT_END is an opt-in feature, and there should be something non-zero to count when that bit isn't set.

There is no HW statistic count for transmission overrun.
I agreed with you, when this bit is not set, there should be non-zero value.

When setting TSN mode, we now make the STRICT_END flag mandatory for QBV operation in the driver code. So that the transmission is only enabled inside the QBV time windows and obeying the STRICT_END parameter of the queue. So we can expect "0" packet overrun when this bit is enabled in our case.

Quoted 11 lines

If it does, wouldn't it be better to query the hardware for this information, regardless of the STRICT_END bit, rather than just assume it will be zero?

Due to things like congestion on memory, I suppose it might be possible for the NIC to start the DMA transfer of a frame in time for its timely transmission, but nonetheless the frame transmission could still overrun the window. Only the hardware could know if that was the case or not (or a hardware TX timestamp adjusted for the frame length). So what I'm saying is that there's value in reading this from value even if you think that STRICT_END should be all that's needed.

Yeah. Only HW could know for sure if the transmission is overrun out of QBV Window or not.....But HW does not give any HW statistic register value for this.

Quoted 9 lines

For context, on NXP LS1028A, the fact that the hardware (ENETC) doesn't report a TransmitOverrun counter is an erratum, even though ENETC also has logic to stop sending packets early enough so as to not overrun the window.

It's a bit of a leap of faith for the software driver to politically report a counter as zero and for higher layers to trust that as first-hand evidence, and this is why, at least in ENETC, I chose to not report TransmitOverrun rather than be confidently wrong about it.

I see what you're saying. However, because I225 HW has this STRIC_END bit option, we can at least guarantee that HW is handling it where packets from the queue can be transmitted only if they are expected to be completed before the window of the Queue is ended.

Thanks,
Husaini
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#6 lore raw
Quoted 7 lines · Muhammad Husaini

There is no HW statistic count for transmission overrun.
I agreed with you, when this bit is not set, there should be non-zero value.

When setting TSN mode, we now make the STRICT_END flag mandatory for QBV operation in the driver code. So that the transmission is only enabled inside the QBV time windows and obeying the STRICT_END parameter of the queue. So we can expect "0" packet overrun when this bit is enabled in our case.

(...)

Quoted 3 lines

Yeah. Only HW could know for sure if the transmission is overrun out of QBV Window or not.....But HW does not give any HW statistic register value for this.

(...)

Quoted 5 lines

I see what you're saying. However, because I225 HW has this STRIC_END bit option, we can at least guarantee that HW is handling it where packets from the queue can be transmitted only if they are expected to be completed before the window of the Queue is ended.

Are the people doing the certification testing aware of the fact that your hardware does not monitor and report transmission overruns, and thus, that the counter of "0" that the driver reports may be confidently wrong? Are they ok with this?
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#7 lore raw

Dear Vladimir,

Quoted 32 lines

-----Original Message-----
From: Vladimir Oltean <[email protected]>
Sent: Monday, 12 June, 2023 10:28 PM
To: Zulkifli, Muhammad Husaini <[email protected]>
Cc: [email protected]; Gomes, Vinicius <[email protected]>; Neftin, Sasha <[email protected]>; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>
Subject: Re: [PATCH iwl-net v3] igc: Add TransmissionOverrun counter

Quoted 7 lines · Muhammad Husaini

There is no HW statistic count for transmission overrun.
I agreed with you, when this bit is not set, there should be non-zero value.

When setting TSN mode, we now make the STRICT_END flag mandatory for QBV operation in the driver code. So that the transmission is only enabled inside the QBV time windows and obeying the STRICT_END parameter of the queue. So we can expect "0" packet overrun when this bit is

enabled in our case.
(...)

Quoted 3 lines

Yeah. Only HW could know for sure if the transmission is overrun out of QBV Window or not.....But HW does not give any HW statistic register value

for this.
(...)

Quoted 5 lines

I see what you're saying. However, because I225 HW has this STRIC_END bit option, we can at least guarantee that HW is handling it where packets from the queue can be transmitted only if they are expected to be completed before the window of the Queue is ended.

Quoted 4 lines

Are the people doing the certification testing aware of the fact that your hardware does not monitor and report transmission overruns, and thus, that the counter of "0" that the driver reports may be confidently wrong? Are they ok with this?

No, they aren't aware of it. They will just query this counter to determine if the value has increased or not. The test plan does not rely entirely on the counter. On the receive side, it will validate all frames for the traffic class involved. Any transmitted frame that is not received or any of the received frame does not fulfil the frameEndTime criteria will cause the test plan to fail before reading the overrun counter again. Since our HW with STRICT_END bit able to fulfill the criteria, we can assume that Counter "0" is valid here.

Unless HW fails to meet the framEndtime criteria and reports a "0" value... However, in this scenario, it will eventually fail the test plan.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#8 lore raw
Quoted 10 lines · Muhammad Husaini

No, they aren't aware of it. They will just query this counter to determine if the value has increased or not. The test plan does not rely entirely on the counter. On the receive side, it will validate all frames for the traffic class involved. Any transmitted frame that is not received or any of the received frame does not fulfil the frameEndTime criteria will cause the test plan to fail before reading the overrun counter again. Since our HW with STRICT_END bit able to fulfill the criteria, we can assume that Counter "0" is valid here.

Unless HW fails to meet the framEndtime criteria and reports a "0" value... However, in this scenario, it will eventually fail the test plan.

Ok, I take back this objection then, only the other one remains in that case, with unnecessarily keeping this constant counter in the driver's ring data structures.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#9 lore raw
Quoted 22 lines

-----Original Message-----
From: Vladimir Oltean <[email protected]>
Sent: Tuesday, 13 June, 2023 11:41 PM
To: Zulkifli, Muhammad Husaini <[email protected]>
Cc: [email protected]; Gomes, Vinicius <[email protected]>; Neftin, Sasha <[email protected]>; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>
Subject: Re: [PATCH iwl-net v3] igc: Add TransmissionOverrun counter

Quoted 2 lines · Muhammad Husaini

No, they aren't aware of it. They will just query this counter to determine if the value has increased or not. The test plan does not rely entirely

on the counter.

Quoted 5 lines

On the receive side, it will validate all frames for the traffic class involved. Any transmitted frame that is not received or any of the received frame does not fulfil the frameEndTime criteria will cause the test plan to fail before reading the overrun counter again. Since our HW with STRICT_END bit able to fulfill the criteria, we can assume that Counter "0"

Quoted 7 lines

is valid here.

Quoted 3 lines

Unless HW fails to meet the framEndtime criteria and reports a "0" value... However, in this scenario, it will eventually fail the test plan.

Ok, I take back this objection then, only the other one remains in that case, with unnecessarily keeping this constant counter in the driver's ring data structures.

Sure. I will remove that one and resend again.
Thanks 😊
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan