Skip to content

Commit 244ae99

Browse files
vcgomesanguy11
authored andcommitted
igc: Fix missing time sync events
Fix "double" clearing of interrupts, which can cause external events or timestamps to be missed. The IGC_TSIRC Time Sync Interrupt Cause register can be cleared in two ways, by either reading it or by writing '1' into the specific cause bit. This is documented in section 8.16.1. The following flow was used: 1. read IGC_TSIRC into 'tsicr'; 2. handle the interrupts present in 'tsirc' and mark them in 'ack'; 3. write 'ack' into IGC_TSICR; As both (1) and (3) will clear the interrupt cause, if the same interrupt happens again between (1) and (3) it will be ignored, causing events to be missed. Remove the extra clear in (3). Fixes: 2c344ae ("igc: Add support for TX timestamping") Reviewed-by: Kurt Kanzenbach <[email protected]> Tested-by: Kurt Kanzenbach <[email protected]> # Intel i225 Signed-off-by: Vinicius Costa Gomes <[email protected]> Tested-by: Naama Meir <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent c055fc0 commit 244ae99

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5302,25 +5302,22 @@ igc_features_check(struct sk_buff *skb, struct net_device *dev,
53025302

53035303
static void igc_tsync_interrupt(struct igc_adapter *adapter)
53045304
{
5305-
u32 ack, tsauxc, sec, nsec, tsicr;
53065305
struct igc_hw *hw = &adapter->hw;
5306+
u32 tsauxc, sec, nsec, tsicr;
53075307
struct ptp_clock_event event;
53085308
struct timespec64 ts;
53095309

53105310
tsicr = rd32(IGC_TSICR);
5311-
ack = 0;
53125311

53135312
if (tsicr & IGC_TSICR_SYS_WRAP) {
53145313
event.type = PTP_CLOCK_PPS;
53155314
if (adapter->ptp_caps.pps)
53165315
ptp_clock_event(adapter->ptp_clock, &event);
5317-
ack |= IGC_TSICR_SYS_WRAP;
53185316
}
53195317

53205318
if (tsicr & IGC_TSICR_TXTS) {
53215319
/* retrieve hardware timestamp */
53225320
igc_ptp_tx_tstamp_event(adapter);
5323-
ack |= IGC_TSICR_TXTS;
53245321
}
53255322

53265323
if (tsicr & IGC_TSICR_TT0) {
@@ -5334,7 +5331,6 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter)
53345331
wr32(IGC_TSAUXC, tsauxc);
53355332
adapter->perout[0].start = ts;
53365333
spin_unlock(&adapter->tmreg_lock);
5337-
ack |= IGC_TSICR_TT0;
53385334
}
53395335

53405336
if (tsicr & IGC_TSICR_TT1) {
@@ -5348,7 +5344,6 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter)
53485344
wr32(IGC_TSAUXC, tsauxc);
53495345
adapter->perout[1].start = ts;
53505346
spin_unlock(&adapter->tmreg_lock);
5351-
ack |= IGC_TSICR_TT1;
53525347
}
53535348

53545349
if (tsicr & IGC_TSICR_AUTT0) {
@@ -5358,7 +5353,6 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter)
53585353
event.index = 0;
53595354
event.timestamp = sec * NSEC_PER_SEC + nsec;
53605355
ptp_clock_event(adapter->ptp_clock, &event);
5361-
ack |= IGC_TSICR_AUTT0;
53625356
}
53635357

53645358
if (tsicr & IGC_TSICR_AUTT1) {
@@ -5368,11 +5362,7 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter)
53685362
event.index = 1;
53695363
event.timestamp = sec * NSEC_PER_SEC + nsec;
53705364
ptp_clock_event(adapter->ptp_clock, &event);
5371-
ack |= IGC_TSICR_AUTT1;
53725365
}
5373-
5374-
/* acknowledge the interrupts */
5375-
wr32(IGC_TSICR, ack);
53765366
}
53775367

53785368
/**

0 commit comments

Comments
 (0)