Skip to content

Commit 66f7602

Browse files
committed
igc: Correct the launchtime offset
Author: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com> 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 helps to reduce the latency for each of the link speed. Before: 10Mbps : 11000 - 13800 nanosecond 100Mbps : 1300 - 1700 nanosecond 1000Mbps : 190 - 600 nanosecond 2500Mbps : 1400 - 1700 nanosecond After: 10Mbps : less than 750 nanosecond 100Mbps : less than 192 nanosecond 1000Mbps : less than 128 nanosecond 2500Mbps : less than 128 nanosecond Test Setup: Talker : Use l2_tai.c to generate the launchtime into packet payload. Listener: Use timedump.c to compute the delta between packet arrival and LaunchTime packet payload. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com> Acked-by: Sasha Neftin <sasha.neftin@intel.com> Acked-by: Paul Menzel <pmenzel@molgen.mpg.de> Tested-by: Naama Meir <naamax.meir@linux.intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> (cherry picked from commit 790835f) Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2104471 Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
1 parent e0508b4 commit 66f7602

File tree

5 files changed

+48
-0
lines changed

5 files changed

+48
-0
lines changed

drivers/net/ethernet/intel/igc/igc_defines.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,15 @@
400400
#define IGC_DTXMXPKTSZ_TSN 0x19 /* 1600 bytes of max TX DMA packet size */
401401
#define IGC_DTXMXPKTSZ_DEFAULT 0x98 /* 9728-byte Jumbo frames */
402402

403+
/* Transmit Scheduling Latency */
404+
/* Latency between transmission scheduling (LaunchTime) and the time
405+
* the packet is transmitted to the network in nanosecond.
406+
*/
407+
#define IGC_TXOFFSET_SPEED_10 0x000034BC
408+
#define IGC_TXOFFSET_SPEED_100 0x00000578
409+
#define IGC_TXOFFSET_SPEED_1000 0x0000012C
410+
#define IGC_TXOFFSET_SPEED_2500 0x00000578
411+
403412
/* Time Sync Interrupt Causes */
404413
#define IGC_TSICR_SYS_WRAP BIT(0) /* SYSTIM Wrap around. */
405414
#define IGC_TSICR_TXTS BIT(1) /* Transmit Timestamp. */

drivers/net/ethernet/intel/igc/igc_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5381,6 +5381,13 @@ static void igc_watchdog_task(struct work_struct *work)
53815381
break;
53825382
}
53835383

5384+
/* Once the launch time has been set on the wire, there
5385+
* is a delay before the link speed can be determined
5386+
* based on link-up activity. Write into the register
5387+
* as soon as we know the correct link speed.
5388+
*/
5389+
igc_tsn_adjust_txtime_offset(adapter);
5390+
53845391
if (adapter->link_speed != SPEED_1000)
53855392
goto no_wait;
53865393

drivers/net/ethernet/intel/igc/igc_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@
224224
/* Transmit Scheduling Registers */
225225
#define IGC_TQAVCTRL 0x3570
226226
#define IGC_TXQCTL(_n) (0x3344 + 0x4 * (_n))
227+
#define IGC_GTXOFFSET 0x3310
227228
#define IGC_BASET_L 0x3314
228229
#define IGC_BASET_H 0x3318
229230
#define IGC_QBVCYCLET 0x331C

drivers/net/ethernet/intel/igc/igc_tsn.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,35 @@ static unsigned int igc_tsn_new_flags(struct igc_adapter *adapter)
4848
return new_flags;
4949
}
5050

51+
void igc_tsn_adjust_txtime_offset(struct igc_adapter *adapter)
52+
{
53+
struct igc_hw *hw = &adapter->hw;
54+
u16 txoffset;
55+
56+
if (!is_any_launchtime(adapter))
57+
return;
58+
59+
switch (adapter->link_speed) {
60+
case SPEED_10:
61+
txoffset = IGC_TXOFFSET_SPEED_10;
62+
break;
63+
case SPEED_100:
64+
txoffset = IGC_TXOFFSET_SPEED_100;
65+
break;
66+
case SPEED_1000:
67+
txoffset = IGC_TXOFFSET_SPEED_1000;
68+
break;
69+
case SPEED_2500:
70+
txoffset = IGC_TXOFFSET_SPEED_2500;
71+
break;
72+
default:
73+
txoffset = 0;
74+
break;
75+
}
76+
77+
wr32(IGC_GTXOFFSET, txoffset);
78+
}
79+
5180
/* Returns the TSN specific registers to their default values after
5281
* the adapter is reset.
5382
*/
@@ -57,6 +86,7 @@ static int igc_tsn_disable_offload(struct igc_adapter *adapter)
5786
u32 tqavctrl;
5887
int i;
5988

89+
wr32(IGC_GTXOFFSET, 0);
6090
wr32(IGC_TXPBS, I225_TXPBSIZE_DEFAULT);
6191
wr32(IGC_DTXMXPKTSZ, IGC_DTXMXPKTSZ_DEFAULT);
6292

drivers/net/ethernet/intel/igc/igc_tsn.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66

77
int igc_tsn_offload_apply(struct igc_adapter *adapter);
88
int igc_tsn_reset(struct igc_adapter *adapter);
9+
void igc_tsn_adjust_txtime_offset(struct igc_adapter *adapter);
910

1011
#endif /* _IGC_BASE_H */

0 commit comments

Comments
 (0)