Skip to content

Commit 9831e35

Browse files
committed
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2024-03-06 (igc, igb, ice) This series contains updates to igc, igb, and ice drivers. Vinicius removes double clearing of interrupt register which could cause timestamp events to be missed on igc and igb. Przemek corrects calculation of statistics which caused incorrect spikes in reporting for ice driver. * '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: fix stats being updated by way too large values igb: Fix missing time sync events igc: Fix missing time sync events ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents b446631 + 257310e commit 9831e35

File tree

3 files changed

+17
-42
lines changed

3 files changed

+17
-42
lines changed

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6737,6 +6737,7 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
67376737
{
67386738
struct rtnl_link_stats64 *net_stats, *stats_prev;
67396739
struct rtnl_link_stats64 *vsi_stats;
6740+
struct ice_pf *pf = vsi->back;
67406741
u64 pkts, bytes;
67416742
int i;
67426743

@@ -6782,21 +6783,18 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
67826783
net_stats = &vsi->net_stats;
67836784
stats_prev = &vsi->net_stats_prev;
67846785

6785-
/* clear prev counters after reset */
6786-
if (vsi_stats->tx_packets < stats_prev->tx_packets ||
6787-
vsi_stats->rx_packets < stats_prev->rx_packets) {
6788-
stats_prev->tx_packets = 0;
6789-
stats_prev->tx_bytes = 0;
6790-
stats_prev->rx_packets = 0;
6791-
stats_prev->rx_bytes = 0;
6786+
/* Update netdev counters, but keep in mind that values could start at
6787+
* random value after PF reset. And as we increase the reported stat by
6788+
* diff of Prev-Cur, we need to be sure that Prev is valid. If it's not,
6789+
* let's skip this round.
6790+
*/
6791+
if (likely(pf->stat_prev_loaded)) {
6792+
net_stats->tx_packets += vsi_stats->tx_packets - stats_prev->tx_packets;
6793+
net_stats->tx_bytes += vsi_stats->tx_bytes - stats_prev->tx_bytes;
6794+
net_stats->rx_packets += vsi_stats->rx_packets - stats_prev->rx_packets;
6795+
net_stats->rx_bytes += vsi_stats->rx_bytes - stats_prev->rx_bytes;
67926796
}
67936797

6794-
/* update netdev counters */
6795-
net_stats->tx_packets += vsi_stats->tx_packets - stats_prev->tx_packets;
6796-
net_stats->tx_bytes += vsi_stats->tx_bytes - stats_prev->tx_bytes;
6797-
net_stats->rx_packets += vsi_stats->rx_packets - stats_prev->rx_packets;
6798-
net_stats->rx_bytes += vsi_stats->rx_bytes - stats_prev->rx_bytes;
6799-
68006798
stats_prev->tx_packets = vsi_stats->tx_packets;
68016799
stats_prev->tx_bytes = vsi_stats->tx_bytes;
68026800
stats_prev->rx_packets = vsi_stats->rx_packets;

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6985,44 +6985,31 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt)
69856985
static void igb_tsync_interrupt(struct igb_adapter *adapter)
69866986
{
69876987
struct e1000_hw *hw = &adapter->hw;
6988-
u32 ack = 0, tsicr = rd32(E1000_TSICR);
6988+
u32 tsicr = rd32(E1000_TSICR);
69896989
struct ptp_clock_event event;
69906990

69916991
if (tsicr & TSINTR_SYS_WRAP) {
69926992
event.type = PTP_CLOCK_PPS;
69936993
if (adapter->ptp_caps.pps)
69946994
ptp_clock_event(adapter->ptp_clock, &event);
6995-
ack |= TSINTR_SYS_WRAP;
69966995
}
69976996

69986997
if (tsicr & E1000_TSICR_TXTS) {
69996998
/* retrieve hardware timestamp */
70006999
schedule_work(&adapter->ptp_tx_work);
7001-
ack |= E1000_TSICR_TXTS;
70027000
}
70037001

7004-
if (tsicr & TSINTR_TT0) {
7002+
if (tsicr & TSINTR_TT0)
70057003
igb_perout(adapter, 0);
7006-
ack |= TSINTR_TT0;
7007-
}
70087004

7009-
if (tsicr & TSINTR_TT1) {
7005+
if (tsicr & TSINTR_TT1)
70107006
igb_perout(adapter, 1);
7011-
ack |= TSINTR_TT1;
7012-
}
70137007

7014-
if (tsicr & TSINTR_AUTT0) {
7008+
if (tsicr & TSINTR_AUTT0)
70157009
igb_extts(adapter, 0);
7016-
ack |= TSINTR_AUTT0;
7017-
}
70187010

7019-
if (tsicr & TSINTR_AUTT1) {
7011+
if (tsicr & TSINTR_AUTT1)
70207012
igb_extts(adapter, 1);
7021-
ack |= TSINTR_AUTT1;
7022-
}
7023-
7024-
/* acknowledge the interrupts */
7025-
wr32(E1000_TSICR, ack);
70267013
}
70277014

70287015
static irqreturn_t igb_msix_other(int irq, void *data)

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)