diff mbox series

[iwl-net-next,v4] igc: Add TransmissionOverrun counter

Message ID 20230614024225.13652-1-muhammad.husaini.zulkifli@intel.com
State Accepted
Delegated to: Anthony Nguyen
Headers show
Series [iwl-net-next,v4] igc: Add TransmissionOverrun counter | expand

Commit Message

Zulkifli, Muhammad Husaini June 14, 2023, 2:42 a.m. UTC
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_queue_stats(), now
driver also report the tx_overruns counter per traffic class.

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

Test Result (Before):
class mq :1 root
 Sent 1289 bytes 20 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
class mq :2 root
 Sent 124 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
class mq :3 root
 Sent 46028 bytes 86 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
class mq :4 root
 Sent 2596 bytes 14 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0

Test Result (After):
class taprio 100:1 root
 Sent 8491 bytes 38 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
 Transmit overruns: 0
class taprio 100:2 root
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
 Transmit overruns: 0
class taprio 100:3 root
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
 Transmit overruns: 0
class taprio 100:4 root
 Sent 994 bytes 11 pkt (dropped 0, overlimits 0 requeues 1)
 backlog 0b 0p requeues 1
 Transmit overruns: 0

Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
---
V3 -> V4: Rework Vladimir's and Anthony's comments to remove the constant
counter from the driver's ring data structure and ethtool statistic
implementation.
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_main.c | 26 +++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

Vladimir Oltean June 14, 2023, 7:39 p.m. UTC | #1
On Wed, Jun 14, 2023 at 10:42:25AM +0800, Muhammad Husaini Zulkifli wrote:
> 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_queue_stats(), now
> driver also report the tx_overruns counter per traffic class.
> 
> User can get this counter by using below command:
> 1) tc -s qdisc show dev <interface> root
> 2) tc -s class show dev <interface>
> 
> Test Result (Before):
> class mq :1 root
>  Sent 1289 bytes 20 pkt (dropped 0, overlimits 0 requeues 0)
>  backlog 0b 0p requeues 0
> class mq :2 root
>  Sent 124 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)
>  backlog 0b 0p requeues 0
> class mq :3 root
>  Sent 46028 bytes 86 pkt (dropped 0, overlimits 0 requeues 0)
>  backlog 0b 0p requeues 0
> class mq :4 root
>  Sent 2596 bytes 14 pkt (dropped 0, overlimits 0 requeues 0)
>  backlog 0b 0p requeues 0
> 
> Test Result (After):
> class taprio 100:1 root
>  Sent 8491 bytes 38 pkt (dropped 0, overlimits 0 requeues 0)
>  backlog 0b 0p requeues 0
>  Transmit overruns: 0
> class taprio 100:2 root
>  Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
>  backlog 0b 0p requeues 0
>  Transmit overruns: 0
> class taprio 100:3 root
>  Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
>  backlog 0b 0p requeues 0
>  Transmit overruns: 0
> class taprio 100:4 root
>  Sent 994 bytes 11 pkt (dropped 0, overlimits 0 requeues 1)
>  backlog 0b 0p requeues 1
>  Transmit overruns: 0

I'm not sure that the full output is really necessary, especially when
it fills half a screen with mostly unrelated text. Also, be aware that
the name of the counter changed in the merged version of the iproute2
patch.

You could modify the commit message to just say: $command | grep tx_overruns.

> 
> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
> ---

Otherwise:

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Zulkifli, Muhammad Husaini June 14, 2023, 11:36 p.m. UTC | #2
> -----Original Message-----
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> Sent: Thursday, 15 June, 2023 3:40 AM
> To: Zulkifli, Muhammad Husaini <muhammad.husaini.zulkifli@intel.com>
> Cc: intel-wired-lan@osuosl.org; Gomes, Vinicius <vinicius.gomes@intel.com>;
> Neftin, Sasha <sasha.neftin@intel.com>; tee.min.tan@linux.intel.com;
> naamax.meir@linux.intel.com; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>
> Subject: Re: [PATCH iwl-net-next v4] igc: Add TransmissionOverrun counter
> 
> On Wed, Jun 14, 2023 at 10:42:25AM +0800, Muhammad Husaini Zulkifli
> wrote:
> > 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_queue_stats(), now
> > driver also report the tx_overruns counter per traffic class.
> >
> > User can get this counter by using below command:
> > 1) tc -s qdisc show dev <interface> root
> > 2) tc -s class show dev <interface>
> >
> > Test Result (Before):
> > class mq :1 root
> >  Sent 1289 bytes 20 pkt (dropped 0, overlimits 0 requeues 0)  backlog
> > 0b 0p requeues 0 class mq :2 root  Sent 124 bytes 2 pkt (dropped 0,
> > overlimits 0 requeues 0)  backlog 0b 0p requeues 0 class mq :3 root
> > Sent 46028 bytes 86 pkt (dropped 0, overlimits 0 requeues 0)  backlog
> > 0b 0p requeues 0 class mq :4 root  Sent 2596 bytes 14 pkt (dropped 0,
> > overlimits 0 requeues 0)  backlog 0b 0p requeues 0
> >
> > Test Result (After):
> > class taprio 100:1 root
> >  Sent 8491 bytes 38 pkt (dropped 0, overlimits 0 requeues 0)  backlog
> > 0b 0p requeues 0  Transmit overruns: 0 class taprio 100:2 root  Sent 0
> > bytes 0 pkt (dropped 0, overlimits 0 requeues 0)  backlog 0b 0p
> > requeues 0  Transmit overruns: 0 class taprio 100:3 root  Sent 0 bytes
> > 0 pkt (dropped 0, overlimits 0 requeues 0)  backlog 0b 0p requeues 0
> > Transmit overruns: 0 class taprio 100:4 root  Sent 994 bytes 11 pkt
> > (dropped 0, overlimits 0 requeues 1)  backlog 0b 0p requeues 1
> > Transmit overruns: 0
> 
> I'm not sure that the full output is really necessary, especially when it fills half a
> screen with mostly unrelated text. Also, be aware that the name of the counter
> changed in the merged version of the iproute2 patch.

Thank you for the heads-up 😊

> 
> You could modify the commit message to just say: $command | grep
> tx_overruns.
> 
> >
> > Signed-off-by: Muhammad Husaini Zulkifli
> > <muhammad.husaini.zulkifli@intel.com>
> > ---
> 
> Otherwise:
> 
> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Thanks!
naamax.meir June 28, 2023, 9:49 a.m. UTC | #3
On 6/14/2023 05:42, Muhammad Husaini Zulkifli wrote:
> 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_queue_stats(), now
> driver also report the tx_overruns counter per traffic class.
> 
> User can get this counter by using below command:
> 1) tc -s qdisc show dev <interface> root
> 2) tc -s class show dev <interface>
> 
> Test Result (Before):
> class mq :1 root
>   Sent 1289 bytes 20 pkt (dropped 0, overlimits 0 requeues 0)
>   backlog 0b 0p requeues 0
> class mq :2 root
>   Sent 124 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)
>   backlog 0b 0p requeues 0
> class mq :3 root
>   Sent 46028 bytes 86 pkt (dropped 0, overlimits 0 requeues 0)
>   backlog 0b 0p requeues 0
> class mq :4 root
>   Sent 2596 bytes 14 pkt (dropped 0, overlimits 0 requeues 0)
>   backlog 0b 0p requeues 0
> 
> Test Result (After):
> class taprio 100:1 root
>   Sent 8491 bytes 38 pkt (dropped 0, overlimits 0 requeues 0)
>   backlog 0b 0p requeues 0
>   Transmit overruns: 0
> class taprio 100:2 root
>   Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
>   backlog 0b 0p requeues 0
>   Transmit overruns: 0
> class taprio 100:3 root
>   Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
>   backlog 0b 0p requeues 0
>   Transmit overruns: 0
> class taprio 100:4 root
>   Sent 994 bytes 11 pkt (dropped 0, overlimits 0 requeues 1)
>   backlog 0b 0p requeues 1
>   Transmit overruns: 0
> 
> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
> ---
> V3 -> V4: Rework Vladimir's and Anthony's comments to remove the constant
> counter from the driver's ring data structure and ethtool statistic
> implementation.
> 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_main.c | 26 +++++++++++++++++++++++
>   1 file changed, 26 insertions(+)

Tested-by: Naama Meir <naamax.meir@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index e6a44980d0aa4..8a9c61a997832 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -6115,6 +6115,26 @@  static int igc_tsn_clear_schedule(struct igc_adapter *adapter)
 	return 0;
 }
 
+static void igc_taprio_stats(struct net_device *dev,
+			     struct tc_taprio_qopt_stats *stats)
+{
+	/* When Strict_End is enabled, the tx_overruns counter
+	 * will always be zero.
+	 */
+	stats->tx_overruns = 0;
+}
+
+static void igc_taprio_queue_stats(struct net_device *dev,
+				   struct tc_taprio_qopt_queue_stats  *queue_stats)
+{
+	struct tc_taprio_qopt_stats *stats = &queue_stats->stats;
+
+	/* When Strict_End is enabled, the tx_overruns counter
+	 * will always be zero.
+	 */
+	stats->tx_overruns = 0;
+}
+
 static int igc_save_qbv_schedule(struct igc_adapter *adapter,
 				 struct tc_taprio_qopt_offload *qopt)
 {
@@ -6132,6 +6152,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_QUEUE_STATS:
+		igc_taprio_queue_stats(adapter->netdev, &qopt->queue_stats);
+		return 0;
 	default:
 		return -EOPNOTSUPP;
 	}