Skip to content

Commit 57a7744

Browse files
ebiedermdavem330
authored andcommitted
net: Replace u64_stats_fetch_begin_bh to u64_stats_fetch_begin_irq
Replace the bh safe variant with the hard irq safe variant. We need a hard irq safe variant to deal with netpoll transmitting packets from hard irq context, and we need it in most if not all of the places using the bh safe variant. Except on 32bit uni-processor the code is exactly the same so don't bother with a bh variant, just have a hard irq safe variant that everyone can use. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 85dcce7 commit 57a7744

38 files changed

Lines changed: 132 additions & 132 deletions

‎block/blk-cgroup.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,9 @@ static inline uint64_t blkg_stat_read(struct blkg_stat *stat)
435435
uint64_t v;
436436

437437
do {
438-
start = u64_stats_fetch_begin_bh(&stat->syncp);
438+
start = u64_stats_fetch_begin_irq(&stat->syncp);
439439
v = stat->cnt;
440-
} while (u64_stats_fetch_retry_bh(&stat->syncp, start));
440+
} while (u64_stats_fetch_retry_irq(&stat->syncp, start));
441441

442442
return v;
443443
}
@@ -508,9 +508,9 @@ static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat)
508508
struct blkg_rwstat tmp;
509509

510510
do {
511-
start = u64_stats_fetch_begin_bh(&rwstat->syncp);
511+
start = u64_stats_fetch_begin_irq(&rwstat->syncp);
512512
tmp = *rwstat;
513-
} while (u64_stats_fetch_retry_bh(&rwstat->syncp, start));
513+
} while (u64_stats_fetch_retry_irq(&rwstat->syncp, start));
514514

515515
return tmp;
516516
}

‎drivers/net/dummy.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ static struct rtnl_link_stats64 *dummy_get_stats64(struct net_device *dev,
6363

6464
dstats = per_cpu_ptr(dev->dstats, i);
6565
do {
66-
start = u64_stats_fetch_begin_bh(&dstats->syncp);
66+
start = u64_stats_fetch_begin_irq(&dstats->syncp);
6767
tbytes = dstats->tx_bytes;
6868
tpackets = dstats->tx_packets;
69-
} while (u64_stats_fetch_retry_bh(&dstats->syncp, start));
69+
} while (u64_stats_fetch_retry_irq(&dstats->syncp, start));
7070
stats->tx_bytes += tbytes;
7171
stats->tx_packets += tpackets;
7272
}

‎drivers/net/ethernet/broadcom/b44.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev,
16851685
unsigned int start;
16861686

16871687
do {
1688-
start = u64_stats_fetch_begin_bh(&hwstat->syncp);
1688+
start = u64_stats_fetch_begin_irq(&hwstat->syncp);
16891689

16901690
/* Convert HW stats into rtnl_link_stats64 stats. */
16911691
nstat->rx_packets = hwstat->rx_pkts;
@@ -1719,7 +1719,7 @@ static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev,
17191719
/* Carrier lost counter seems to be broken for some devices */
17201720
nstat->tx_carrier_errors = hwstat->tx_carrier_lost;
17211721
#endif
1722-
} while (u64_stats_fetch_retry_bh(&hwstat->syncp, start));
1722+
} while (u64_stats_fetch_retry_irq(&hwstat->syncp, start));
17231723

17241724
return nstat;
17251725
}
@@ -2073,12 +2073,12 @@ static void b44_get_ethtool_stats(struct net_device *dev,
20732073
do {
20742074
data_src = &hwstat->tx_good_octets;
20752075
data_dst = data;
2076-
start = u64_stats_fetch_begin_bh(&hwstat->syncp);
2076+
start = u64_stats_fetch_begin_irq(&hwstat->syncp);
20772077

20782078
for (i = 0; i < ARRAY_SIZE(b44_gstrings); i++)
20792079
*data_dst++ = *data_src++;
20802080

2081-
} while (u64_stats_fetch_retry_bh(&hwstat->syncp, start));
2081+
} while (u64_stats_fetch_retry_irq(&hwstat->syncp, start));
20822082
}
20832083

20842084
static void b44_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)

‎drivers/net/ethernet/emulex/benet/be_ethtool.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,10 @@ be_get_ethtool_stats(struct net_device *netdev,
357357
struct be_rx_stats *stats = rx_stats(rxo);
358358

359359
do {
360-
start = u64_stats_fetch_begin_bh(&stats->sync);
360+
start = u64_stats_fetch_begin_irq(&stats->sync);
361361
data[base] = stats->rx_bytes;
362362
data[base + 1] = stats->rx_pkts;
363-
} while (u64_stats_fetch_retry_bh(&stats->sync, start));
363+
} while (u64_stats_fetch_retry_irq(&stats->sync, start));
364364

365365
for (i = 2; i < ETHTOOL_RXSTATS_NUM; i++) {
366366
p = (u8 *)stats + et_rx_stats[i].offset;
@@ -373,19 +373,19 @@ be_get_ethtool_stats(struct net_device *netdev,
373373
struct be_tx_stats *stats = tx_stats(txo);
374374

375375
do {
376-
start = u64_stats_fetch_begin_bh(&stats->sync_compl);
376+
start = u64_stats_fetch_begin_irq(&stats->sync_compl);
377377
data[base] = stats->tx_compl;
378-
} while (u64_stats_fetch_retry_bh(&stats->sync_compl, start));
378+
} while (u64_stats_fetch_retry_irq(&stats->sync_compl, start));
379379

380380
do {
381-
start = u64_stats_fetch_begin_bh(&stats->sync);
381+
start = u64_stats_fetch_begin_irq(&stats->sync);
382382
for (i = 1; i < ETHTOOL_TXSTATS_NUM; i++) {
383383
p = (u8 *)stats + et_tx_stats[i].offset;
384384
data[base + i] =
385385
(et_tx_stats[i].size == sizeof(u64)) ?
386386
*(u64 *)p : *(u32 *)p;
387387
}
388-
} while (u64_stats_fetch_retry_bh(&stats->sync, start));
388+
} while (u64_stats_fetch_retry_irq(&stats->sync, start));
389389
base += ETHTOOL_TXSTATS_NUM;
390390
}
391391
}

‎drivers/net/ethernet/emulex/benet/be_main.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -591,10 +591,10 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
591591
for_all_rx_queues(adapter, rxo, i) {
592592
const struct be_rx_stats *rx_stats = rx_stats(rxo);
593593
do {
594-
start = u64_stats_fetch_begin_bh(&rx_stats->sync);
594+
start = u64_stats_fetch_begin_irq(&rx_stats->sync);
595595
pkts = rx_stats(rxo)->rx_pkts;
596596
bytes = rx_stats(rxo)->rx_bytes;
597-
} while (u64_stats_fetch_retry_bh(&rx_stats->sync, start));
597+
} while (u64_stats_fetch_retry_irq(&rx_stats->sync, start));
598598
stats->rx_packets += pkts;
599599
stats->rx_bytes += bytes;
600600
stats->multicast += rx_stats(rxo)->rx_mcast_pkts;
@@ -605,10 +605,10 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
605605
for_all_tx_queues(adapter, txo, i) {
606606
const struct be_tx_stats *tx_stats = tx_stats(txo);
607607
do {
608-
start = u64_stats_fetch_begin_bh(&tx_stats->sync);
608+
start = u64_stats_fetch_begin_irq(&tx_stats->sync);
609609
pkts = tx_stats(txo)->tx_pkts;
610610
bytes = tx_stats(txo)->tx_bytes;
611-
} while (u64_stats_fetch_retry_bh(&tx_stats->sync, start));
611+
} while (u64_stats_fetch_retry_irq(&tx_stats->sync, start));
612612
stats->tx_packets += pkts;
613613
stats->tx_bytes += bytes;
614614
}
@@ -1408,15 +1408,15 @@ static void be_eqd_update(struct be_adapter *adapter)
14081408

14091409
rxo = &adapter->rx_obj[eqo->idx];
14101410
do {
1411-
start = u64_stats_fetch_begin_bh(&rxo->stats.sync);
1411+
start = u64_stats_fetch_begin_irq(&rxo->stats.sync);
14121412
rx_pkts = rxo->stats.rx_pkts;
1413-
} while (u64_stats_fetch_retry_bh(&rxo->stats.sync, start));
1413+
} while (u64_stats_fetch_retry_irq(&rxo->stats.sync, start));
14141414

14151415
txo = &adapter->tx_obj[eqo->idx];
14161416
do {
1417-
start = u64_stats_fetch_begin_bh(&txo->stats.sync);
1417+
start = u64_stats_fetch_begin_irq(&txo->stats.sync);
14181418
tx_pkts = txo->stats.tx_reqs;
1419-
} while (u64_stats_fetch_retry_bh(&txo->stats.sync, start));
1419+
} while (u64_stats_fetch_retry_irq(&txo->stats.sync, start));
14201420

14211421

14221422
/* Skip, if wrapped around or first calculation */

‎drivers/net/ethernet/intel/i40e/i40e_ethtool.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,18 +653,18 @@ static void i40e_get_ethtool_stats(struct net_device *netdev,
653653

654654
/* process Tx ring statistics */
655655
do {
656-
start = u64_stats_fetch_begin_bh(&tx_ring->syncp);
656+
start = u64_stats_fetch_begin_irq(&tx_ring->syncp);
657657
data[i] = tx_ring->stats.packets;
658658
data[i + 1] = tx_ring->stats.bytes;
659-
} while (u64_stats_fetch_retry_bh(&tx_ring->syncp, start));
659+
} while (u64_stats_fetch_retry_irq(&tx_ring->syncp, start));
660660

661661
/* Rx ring is the 2nd half of the queue pair */
662662
rx_ring = &tx_ring[1];
663663
do {
664-
start = u64_stats_fetch_begin_bh(&rx_ring->syncp);
664+
start = u64_stats_fetch_begin_irq(&rx_ring->syncp);
665665
data[i + 2] = rx_ring->stats.packets;
666666
data[i + 3] = rx_ring->stats.bytes;
667-
} while (u64_stats_fetch_retry_bh(&rx_ring->syncp, start));
667+
} while (u64_stats_fetch_retry_irq(&rx_ring->syncp, start));
668668
}
669669
rcu_read_unlock();
670670
if (vsi == pf->vsi[pf->lan_vsi]) {

‎drivers/net/ethernet/intel/i40e/i40e_main.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,20 +376,20 @@ static struct rtnl_link_stats64 *i40e_get_netdev_stats_struct(
376376
continue;
377377

378378
do {
379-
start = u64_stats_fetch_begin_bh(&tx_ring->syncp);
379+
start = u64_stats_fetch_begin_irq(&tx_ring->syncp);
380380
packets = tx_ring->stats.packets;
381381
bytes = tx_ring->stats.bytes;
382-
} while (u64_stats_fetch_retry_bh(&tx_ring->syncp, start));
382+
} while (u64_stats_fetch_retry_irq(&tx_ring->syncp, start));
383383

384384
stats->tx_packets += packets;
385385
stats->tx_bytes += bytes;
386386
rx_ring = &tx_ring[1];
387387

388388
do {
389-
start = u64_stats_fetch_begin_bh(&rx_ring->syncp);
389+
start = u64_stats_fetch_begin_irq(&rx_ring->syncp);
390390
packets = rx_ring->stats.packets;
391391
bytes = rx_ring->stats.bytes;
392-
} while (u64_stats_fetch_retry_bh(&rx_ring->syncp, start));
392+
} while (u64_stats_fetch_retry_irq(&rx_ring->syncp, start));
393393

394394
stats->rx_packets += packets;
395395
stats->rx_bytes += bytes;
@@ -770,10 +770,10 @@ void i40e_update_stats(struct i40e_vsi *vsi)
770770
p = ACCESS_ONCE(vsi->tx_rings[q]);
771771

772772
do {
773-
start = u64_stats_fetch_begin_bh(&p->syncp);
773+
start = u64_stats_fetch_begin_irq(&p->syncp);
774774
packets = p->stats.packets;
775775
bytes = p->stats.bytes;
776-
} while (u64_stats_fetch_retry_bh(&p->syncp, start));
776+
} while (u64_stats_fetch_retry_irq(&p->syncp, start));
777777
tx_b += bytes;
778778
tx_p += packets;
779779
tx_restart += p->tx_stats.restart_queue;
@@ -782,10 +782,10 @@ void i40e_update_stats(struct i40e_vsi *vsi)
782782
/* Rx queue is part of the same block as Tx queue */
783783
p = &p[1];
784784
do {
785-
start = u64_stats_fetch_begin_bh(&p->syncp);
785+
start = u64_stats_fetch_begin_irq(&p->syncp);
786786
packets = p->stats.packets;
787787
bytes = p->stats.bytes;
788-
} while (u64_stats_fetch_retry_bh(&p->syncp, start));
788+
} while (u64_stats_fetch_retry_irq(&p->syncp, start));
789789
rx_b += bytes;
790790
rx_p += packets;
791791
rx_buf += p->rx_stats.alloc_buff_failed;

‎drivers/net/ethernet/intel/igb/igb_ethtool.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,29 +2273,29 @@ static void igb_get_ethtool_stats(struct net_device *netdev,
22732273

22742274
ring = adapter->tx_ring[j];
22752275
do {
2276-
start = u64_stats_fetch_begin_bh(&ring->tx_syncp);
2276+
start = u64_stats_fetch_begin_irq(&ring->tx_syncp);
22772277
data[i] = ring->tx_stats.packets;
22782278
data[i+1] = ring->tx_stats.bytes;
22792279
data[i+2] = ring->tx_stats.restart_queue;
2280-
} while (u64_stats_fetch_retry_bh(&ring->tx_syncp, start));
2280+
} while (u64_stats_fetch_retry_irq(&ring->tx_syncp, start));
22812281
do {
2282-
start = u64_stats_fetch_begin_bh(&ring->tx_syncp2);
2282+
start = u64_stats_fetch_begin_irq(&ring->tx_syncp2);
22832283
restart2 = ring->tx_stats.restart_queue2;
2284-
} while (u64_stats_fetch_retry_bh(&ring->tx_syncp2, start));
2284+
} while (u64_stats_fetch_retry_irq(&ring->tx_syncp2, start));
22852285
data[i+2] += restart2;
22862286

22872287
i += IGB_TX_QUEUE_STATS_LEN;
22882288
}
22892289
for (j = 0; j < adapter->num_rx_queues; j++) {
22902290
ring = adapter->rx_ring[j];
22912291
do {
2292-
start = u64_stats_fetch_begin_bh(&ring->rx_syncp);
2292+
start = u64_stats_fetch_begin_irq(&ring->rx_syncp);
22932293
data[i] = ring->rx_stats.packets;
22942294
data[i+1] = ring->rx_stats.bytes;
22952295
data[i+2] = ring->rx_stats.drops;
22962296
data[i+3] = ring->rx_stats.csum_err;
22972297
data[i+4] = ring->rx_stats.alloc_failed;
2298-
} while (u64_stats_fetch_retry_bh(&ring->rx_syncp, start));
2298+
} while (u64_stats_fetch_retry_irq(&ring->rx_syncp, start));
22992299
i += IGB_RX_QUEUE_STATS_LEN;
23002300
}
23012301
spin_unlock(&adapter->stats64_lock);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5168,10 +5168,10 @@ void igb_update_stats(struct igb_adapter *adapter,
51685168
}
51695169

51705170
do {
5171-
start = u64_stats_fetch_begin_bh(&ring->rx_syncp);
5171+
start = u64_stats_fetch_begin_irq(&ring->rx_syncp);
51725172
_bytes = ring->rx_stats.bytes;
51735173
_packets = ring->rx_stats.packets;
5174-
} while (u64_stats_fetch_retry_bh(&ring->rx_syncp, start));
5174+
} while (u64_stats_fetch_retry_irq(&ring->rx_syncp, start));
51755175
bytes += _bytes;
51765176
packets += _packets;
51775177
}
@@ -5184,10 +5184,10 @@ void igb_update_stats(struct igb_adapter *adapter,
51845184
for (i = 0; i < adapter->num_tx_queues; i++) {
51855185
struct igb_ring *ring = adapter->tx_ring[i];
51865186
do {
5187-
start = u64_stats_fetch_begin_bh(&ring->tx_syncp);
5187+
start = u64_stats_fetch_begin_irq(&ring->tx_syncp);
51885188
_bytes = ring->tx_stats.bytes;
51895189
_packets = ring->tx_stats.packets;
5190-
} while (u64_stats_fetch_retry_bh(&ring->tx_syncp, start));
5190+
} while (u64_stats_fetch_retry_irq(&ring->tx_syncp, start));
51915191
bytes += _bytes;
51925192
packets += _packets;
51935193
}

‎drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,10 +1128,10 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
11281128
}
11291129

11301130
do {
1131-
start = u64_stats_fetch_begin_bh(&ring->syncp);
1131+
start = u64_stats_fetch_begin_irq(&ring->syncp);
11321132
data[i] = ring->stats.packets;
11331133
data[i+1] = ring->stats.bytes;
1134-
} while (u64_stats_fetch_retry_bh(&ring->syncp, start));
1134+
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
11351135
i += 2;
11361136
#ifdef BP_EXTENDED_STATS
11371137
data[i] = ring->stats.yields;
@@ -1156,10 +1156,10 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
11561156
}
11571157

11581158
do {
1159-
start = u64_stats_fetch_begin_bh(&ring->syncp);
1159+
start = u64_stats_fetch_begin_irq(&ring->syncp);
11601160
data[i] = ring->stats.packets;
11611161
data[i+1] = ring->stats.bytes;
1162-
} while (u64_stats_fetch_retry_bh(&ring->syncp, start));
1162+
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
11631163
i += 2;
11641164
#ifdef BP_EXTENDED_STATS
11651165
data[i] = ring->stats.yields;

0 commit comments

Comments
 (0)