igc: Correct the launchtime offset
Subsystems (2)
PATCH v2 1/1 igc: Correct the launchtime offset
The launchtime offset should be corrected according to sections 7.5.2.6 Transmit Scheduling Latency of the Intel Ethernet I225/I226 Software User Manual.
Software can compensate the latency between the transmission scheduling and the time that packet is transmitted to the network by setting this GTxOffset register. Without setting this register, there may be a significant delay between the packet scheduling and the network point.
This patch help to reduce the latency for each of the link speed.
--- drivers/net/ethernet/intel/igc/igc_defines.h | 6 ++++ drivers/net/ethernet/intel/igc/igc_main.c | 6 ++++ drivers/net/ethernet/intel/igc/igc_regs.h | 1 + drivers/net/ethernet/intel/igc/igc_tsn.c | 30 ++++++++++++++++++++ drivers/net/ethernet/intel/igc/igc_tsn.h | 1 + 5 files changed, 44 insertions(+)
drivers/net/ethernet/intel/igc/igc_defines.h +6 -0
@@ -400,6 +400,12 @@#define IGC_DTXMXPKTSZ_TSN 0x19/* 1600 bytes of max TX DMA packet size */ #define IGC_DTXMXPKTSZ_DEFAULT 0x98/* 9728-byte Jumbo frames */ +/* Transmit Scheduling Latency */ +#define IGC_TXOFFSET_SPEED_10 0x000034BC +#define IGC_TXOFFSET_SPEED_100 0x00000578 +#define IGC_TXOFFSET_SPEED_1000 0x0000012C +#define IGC_TXOFFSET_SPEED_2500 0x00000578 +/* Time Sync Interrupt Causes */ #define IGC_TSICR_SYS_WRAP BIT(0)/* SYSTIM Wrap around. */ #define IGC_TSICR_TXTS BIT(1)/* Transmit Timestamp. */
drivers/net/ethernet/intel/igc/igc_main.c +6 -0
@@ -5382,6 +5382,12 @@ static void igc_watchdog_task(struct work_struct *work)break ; } +/* Once the launch time has been set on the wire, there is a delay +* before the link speed can be determined based on link up activity. +* Write into the register as soon as we know the correct link speed. +*/ +igc_tsn_adjust_txtime_offset (adapter); +if (adapter->link_speed !=SPEED_1000 ) goto no_wait;
drivers/net/ethernet/intel/igc/igc_regs.h +1 -0
@@ -224,6 +224,7 @@/* Transmit Scheduling Registers */ #define IGC_TQAVCTRL 0x3570#define IGC_TXQCTL (_n) (0x3344 + 0x4 * (_n)) +#define IGC_GTXOFFSET 0x3310#define IGC_BASET_L 0x3314#define IGC_BASET_H 0x3318#define IGC_QBVCYCLET 0x331C
drivers/net/ethernet/intel/igc/igc_tsn.c +30 -0
@@ -48,6 +48,35 @@ static unsigned int igc_tsn_new_flags(struct igc_adapter *adapter)return new_flags; } +void igc_tsn_adjust_txtime_offset (struct igc_adapter *adapter) +{ +struct igc_hw *hw = &adapter->hw; +u16 txoffset; + +if (!is_any_launchtime (adapter)) +return ; + +switch (adapter->link_speed) { +case SPEED_10 : + txoffset =IGC_TXOFFSET_SPEED_10 ; +break ; +case SPEED_100 : + txoffset =IGC_TXOFFSET_SPEED_100 ; +break ; +case SPEED_1000 : + txoffset =IGC_TXOFFSET_SPEED_1000 ; +break ; +case SPEED_2500 : + txoffset =IGC_TXOFFSET_SPEED_2500 ; +break ; +default : + txoffset =0 ; +break ; + } + +wr32 (IGC_GTXOFFSET , txoffset); +} +/* Returns the TSN specific registers to their default values after * the adapter is reset. */
@@ -57,6 +86,7 @@ static int igc_tsn_disable_offload(struct igc_adapter *adapter)u32 tqavctrl;int i; +wr32 (IGC_GTXOFFSET ,0 );wr32 (IGC_TXPBS ,I225_TXPBSIZE_DEFAULT );wr32 (IGC_DTXMXPKTSZ ,IGC_DTXMXPKTSZ_DEFAULT );
drivers/net/ethernet/intel/igc/igc_tsn.h +1 -0
@@ -6,5 +6,6 @@int igc_tsn_offload_apply (struct igc_adapter *adapter);int igc_tsn_reset (struct igc_adapter *adapter); +void igc_tsn_adjust_txtime_offset (struct igc_adapter *adapter);#endif /* _IGC_BASE_H */
Signature · 6 lines
2.17.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Dear Muhammad,
Thank you for the patch.
Am 17.09.22 um 06:58 schrieb Muhammad Husaini Zulkifli:
Quoted 3 lines
The launchtime offset should be corrected according to sections 7.5.2.6 Transmit Scheduling Latency of the Intel Ethernet I225/I226 Software User Manual.
Please mention describe the current state. What is the current launchtime offset, and what problems does it cause.
Quoted 4 lines
Software can compensate the latency between the transmission scheduling and the time that packet is transmitted to the network by setting this GTxOffset register. Without setting this register, there may be a significant delay between the packet scheduling and the network point.
Please document the test setup and numbers in the commit message.
Quoted 1 line
This patch help to reduce the latency for each of the link speed.
help*s*
Quoted 15 lines
Signed-off-by Vinicius Costa Gomes <[email protected]>Signed-off-by Muhammad Husaini Zulkifli <[email protected]>--- drivers/net/ethernet/intel/igc/igc_defines.h | 6 ++++ drivers/net/ethernet/intel/igc/igc_main.c | 6 ++++ drivers/net/ethernet/intel/igc/igc_regs.h | 1 + drivers/net/ethernet/intel/igc/igc_tsn.c | 30 ++++++++++++++++++++ drivers/net/ethernet/intel/igc/igc_tsn.h | 1 + 5 files changed, 44 insertions(+)drivers/net/ethernet/intel/igc/igc_defines.h +0
-0
drivers/net/ethernet/intel/igc/igc_defines.h line 408
Quoted 9 lines
drivers/net/ethernet/intel/igc/igc_defines.h +6
-0@@ -400,6 +400,12 @@#define IGC_DTXMXPKTSZ_TSN 0x19/* 1600 bytes of max TX DMA packet size */ #define IGC_DTXMXPKTSZ_DEFAULT 0x98/* 9728-byte Jumbo frames */ +/* Transmit Scheduling Latency */ +#define IGC_TXOFFSET_SPEED_10 0x000034BC +#define IGC_TXOFFSET_SPEED_100 0x00000578 +#define IGC_TXOFFSET_SPEED_1000 0x0000012C +#define IGC_TXOFFSET_SPEED_2500 0x00000578 +
Latency sounds like a time value. Can a unit be added to the macros? Maybe add as a comment, what latency it actually is.
drivers/net/ethernet/intel/igc/igc_main.c static void igc_watchdog_task(struct work_struct *work) · line 5386
Quoted 13 lines
drivers/net/ethernet/intel/igc/igc_defines.h +0
-0/* Time Sync Interrupt Causes */ #define IGC_TSICR_SYS_WRAP BIT(0)/* SYSTIM Wrap around. */ #define IGC_TSICR_TXTS BIT(1)/* Transmit Timestamp. */ drivers/net/ethernet/intel/igc/igc_main.c +2
-0@@ -5382,6 +5382,12 @@ static void igc_watchdog_task(struct work_struct *work)break ; } +/* Once the launch time has been set on the wire, there is a delay +* before the link speed can be determined based on link up activity.
link-up or linkup?
Quoted 44 lines
drivers/net/ethernet/intel/igc/igc_main.c +4
-0+* Write into the register as soon as we know the correct link speed. +*/ +igc_tsn_adjust_txtime_offset (adapter); +if (adapter->link_speed !=SPEED_1000 ) goto no_wait;drivers/net/ethernet/intel/igc/igc_regs.h +1
-0@@ -224,6 +224,7 @@/* Transmit Scheduling Registers */ #define IGC_TQAVCTRL 0x3570#define IGC_TXQCTL (_n) (0x3344 + 0x4 * (_n)) +#define IGC_GTXOFFSET 0x3310#define IGC_BASET_L 0x3314#define IGC_BASET_H 0x3318#define IGC_QBVCYCLET 0x331Cdrivers/net/ethernet/intel/igc/igc_tsn.c +17
-0@@ -48,6 +48,35 @@ static unsigned int igc_tsn_new_flags(struct igc_adapter *adapter)return new_flags; } +void igc_tsn_adjust_txtime_offset (struct igc_adapter *adapter) +{ +struct igc_hw *hw = &adapter->hw; +u16 txoffset; + +if (!is_any_launchtime (adapter)) +return ; + +switch (adapter->link_speed) { +case SPEED_10 : + txoffset =IGC_TXOFFSET_SPEED_10 ; +break ; +case SPEED_100 : + txoffset =IGC_TXOFFSET_SPEED_100 ; +break ; +case SPEED_1000 : + txoffset =IGC_TXOFFSET_SPEED_1000 ;
drivers/net/ethernet/intel/igc/igc_tsn.c static unsigned int igc_tsn_new_flags(struct igc_adapter *adapter) · line 77
Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +10
-0+break ; +case SPEED_2500 : + txoffset =IGC_TXOFFSET_SPEED_2500 ; +break ; +default : + txoffset =0 ; +break ; + } + +wr32 (IGC_GTXOFFSET , txoffset);
Shouldn’t txoffset be u32 then?
Quoted 18 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +3
-0+} +/* Returns the TSN specific registers to their default values after * the adapter is reset. */ @@ -57,6 +86,7 @@ static int igc_tsn_disable_offload(struct igc_adapter *adapter)u32 tqavctrl;int i; +wr32 (IGC_GTXOFFSET ,0 );wr32 (IGC_TXPBS ,I225_TXPBSIZE_DEFAULT );wr32 (IGC_DTXMXPKTSZ ,IGC_DTXMXPKTSZ_DEFAULT );drivers/net/ethernet/intel/igc/igc_tsn.h +0
-0
drivers/net/ethernet/intel/igc/igc_tsn.h line 11
Quoted 6 lines
drivers/net/ethernet/intel/igc/igc_tsn.h +1
-0@@ -6,5 +6,6 @@int igc_tsn_offload_apply (struct igc_adapter *adapter);int igc_tsn_reset (struct igc_adapter *adapter); +void igc_tsn_adjust_txtime_offset (struct igc_adapter *adapter);#endif /* _IGC_BASE_H */
Kind regards,
Paul
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Hi Paul,
Thanks for the review.
Quoted 12 lines
-----Original Message-----
From: Paul Menzel <[email protected]>
Sent: Saturday, 17 September, 2022 10:56 PM
To: Zulkifli, Muhammad Husaini <[email protected]>
Cc: [email protected]; Gomes, Vinicius <[email protected]>
Subject: Re: [PATCH v2] igc: Correct the launchtime offsetDear Muhammad,
Thank you for the patch.
Quoted 7 lines
Am 17.09.22 um 06:58 schrieb Muhammad Husaini Zulkifli:
Quoted 3 lines
The launchtime offset should be corrected according to sections 7.5.2.6 Transmit Scheduling Latency of the Intel Ethernet I225/I226 Software User Manual.
Please mention describe the current state. What is the current launchtime offset, and what problems does it cause.
Noted. Will add this.
Quoted 8 lines
Quoted 5 lines
Software can compensate the latency between the transmission scheduling and the time that packet is transmitted to the network by setting this GTxOffset register. Without setting this register, there may be a significant delay between the packet scheduling and the network
point.
Please document the test setup and numbers in the commit message.
Same as above.
Quoted 4 lines
Quoted 2 lines
This patch help to reduce the latency for each of the link speed.
help*s*
Noted. Will update this.
Quoted 22 lines
Quoted 18 lines
Signed-off-by Vinicius Costa Gomes <[email protected]>Signed-off-by Muhammad Husaini Zulkifli--- drivers/net/ethernet/intel/igc/igc_defines.h | 6 ++++ drivers/net/ethernet/intel/igc/igc_main.c | 6 ++++ drivers/net/ethernet/intel/igc/igc_regs.h | 1 + drivers/net/ethernet/intel/igc/igc_tsn.c | 30 ++++++++++++++++++++ drivers/net/ethernet/intel/igc/igc_tsn.h | 1 + 5 files changed, 44 insertions(+)drivers/net/ethernet/intel/igc/igc_defines.h +0
-0drivers/net/ethernet/intel/igc/igc_defines.h line 400
Quoted 1 line
drivers/net/ethernet/intel/igc/igc_defines.h +0
-0@@ -400,6 +400,12 @@#define IGC_DTXMXPKTSZ_TSN 0x19/* 1600 bytes of max TX DMA packet size */
Quoted 2 lines
drivers/net/ethernet/intel/igc/igc_defines.h +0
-0#define IGC_DTXMXPKTSZ_DEFAULT 0x98/* 9728-byte Jumbo frames */
Quoted 9 lines
drivers/net/ethernet/intel/igc/igc_defines.h line 408
Quoted 6 lines
drivers/net/ethernet/intel/igc/igc_defines.h +6
-0+/* Transmit Scheduling Latency */ +#define IGC_TXOFFSET_SPEED_10 0x000034BC +#define IGC_TXOFFSET_SPEED_100 0x00000578 +#define IGC_TXOFFSET_SPEED_1000 0x0000012C +#define IGC_TXOFFSET_SPEED_2500 0x00000578 +Latency sounds like a time value. Can a unit be added to the macros? Maybe add as a comment, what latency it actually is.
Will add the comment like this "Latency between transmission scheduling (launch time) and the time the packet is transmitted to the network in Nano Seconds". Will remain the macros as it is if possible without the unit.
Quoted 14 lines
drivers/net/ethernet/intel/igc/igc_main.c static void igc_watchdog_task(struct
Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_defines.h +0
-0/* Time Sync Interrupt Causes */ #define IGC_TSICR_SYS_WRAP BIT(0)/* SYSTIM Wrap around. */ #define IGC_TSICR_TXTS BIT(1)/* Transmit Timestamp. */ drivers/net/ethernet/intel/igc/igc_main.c +0
-0@@ -5382,6 +5382,12 @@ static void igc_watchdog_task(struct
work_struct*work)Quoted 3 lines
drivers/net/ethernet/intel/igc/igc_main.c +0
-0break ; }
Quoted 6 lines
drivers/net/ethernet/intel/igc/igc_main.c static void igc_watchdog_task(struct · line 5385
Quoted 1 line
drivers/net/ethernet/intel/igc/igc_main.c +1
-0+/* Once the launch time has been set on the wire, there is a delay
drivers/net/ethernet/intel/igc/igc_main.c static void igc_watchdog_task(struct · line 5386
Quoted 1 line
drivers/net/ethernet/intel/igc/igc_main.c +1
-0+* before the link speed can be determined based on link up activity.
link-up or linkup?
Will change to link-up. Thanks!
Quoted 52 lines
drivers/net/ethernet/intel/igc/igc_main.c static void igc_watchdog_task(struct · line 5387
Quoted 2 lines
drivers/net/ethernet/intel/igc/igc_main.c +1
-0+* Write into the register as soon as we know the correct link speed.
drivers/net/ethernet/intel/igc/igc_tsn.c static unsigned int igc_tsn_new_flags(struct
Quoted 25 lines
drivers/net/ethernet/intel/igc/igc_main.c +3
-0+*/ +igc_tsn_adjust_txtime_offset (adapter); +if (adapter->link_speed !=SPEED_1000 ) goto no_wait;drivers/net/ethernet/intel/igc/igc_regs.h +1
-0@@ -224,6 +224,7 @@/* Transmit Scheduling Registers */ #define IGC_TQAVCTRL 0x3570#define IGC_TXQCTL (_n) (0x3344 + 0x4 * (_n)) +#define IGC_GTXOFFSET 0x3310#define IGC_BASET_L 0x3314#define IGC_BASET_H 0x3318#define IGC_QBVCYCLET 0x331Cdrivers/net/ethernet/intel/igc/igc_tsn.c +0
-0@@ -48,6 +48,35 @@ static unsigned int igc_tsn_new_flags(struct
igc_adapter*adapter)Quoted 23 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +20
-0return new_flags; } +void igc_tsn_adjust_txtime_offset (struct igc_adapter *adapter) { +struct igc_hw *hw = &adapter->hw; +u16 txoffset; + +if (!is_any_launchtime (adapter)) +return ; + +switch (adapter->link_speed) { +case SPEED_10 : + txoffset =IGC_TXOFFSET_SPEED_10 ; +break ; +case SPEED_100 : + txoffset =IGC_TXOFFSET_SPEED_100 ; +break ; +case SPEED_1000 : + txoffset =IGC_TXOFFSET_SPEED_1000 ; +break ; +case SPEED_2500 : + txoffset =IGC_TXOFFSET_SPEED_2500 ; +break ;
Quoted 8 lines
drivers/net/ethernet/intel/igc/igc_tsn.c static unsigned int igc_tsn_new_flags(struct igc_adapter *adapter) · line 77
Quoted 6 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +6
-0+default : + txoffset =0 ; +break ; + } + +wr32 (IGC_GTXOFFSET , txoffset);Shouldn’t txoffset be u32 then?
I accidentally replied 2 message previously. Txoffset should be 16 bit only. That is the reason I used u16.
Quoted 26 lines
drivers/net/ethernet/intel/igc/igc_tsn.c static int igc_tsn_disable_offload(struct igc_adapter
Quoted 7 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +2
-0+} +/* Returns the TSN specific registers to their default values after * the adapter is reset. */ @@ -57,6 +86,7 @@ static int igc_tsn_disable_offload(struct igc_adapter*adapter)
Quoted 18 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +1
-0u32 tqavctrl;int i; +wr32 (IGC_GTXOFFSET ,0 );wr32 (IGC_TXPBS ,I225_TXPBSIZE_DEFAULT );wr32 (IGC_DTXMXPKTSZ ,IGC_DTXMXPKTSZ_DEFAULT );drivers/net/ethernet/intel/igc/igc_tsn.h +1
-0@@ -6,5 +6,6 @@int igc_tsn_offload_apply (struct igc_adapter *adapter);int igc_tsn_reset (struct igc_adapter *adapter); +void igc_tsn_adjust_txtime_offset (struct igc_adapter *adapter);
Quoted 6 lines
drivers/net/ethernet/intel/igc/igc_tsn.h line 11
Quoted 1 line
drivers/net/ethernet/intel/igc/igc_tsn.h +0
-0#endif /* _IGC_BASE_H */ Kind regards,
Paul
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan