Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57a7744e authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller
Browse files

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: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 85dcce7a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -435,9 +435,9 @@ static inline uint64_t blkg_stat_read(struct blkg_stat *stat)
	uint64_t v;

	do {
		start = u64_stats_fetch_begin_bh(&stat->syncp);
		start = u64_stats_fetch_begin_irq(&stat->syncp);
		v = stat->cnt;
	} while (u64_stats_fetch_retry_bh(&stat->syncp, start));
	} while (u64_stats_fetch_retry_irq(&stat->syncp, start));

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

	do {
		start = u64_stats_fetch_begin_bh(&rwstat->syncp);
		start = u64_stats_fetch_begin_irq(&rwstat->syncp);
		tmp = *rwstat;
	} while (u64_stats_fetch_retry_bh(&rwstat->syncp, start));
	} while (u64_stats_fetch_retry_irq(&rwstat->syncp, start));

	return tmp;
}
+2 −2
Original line number Diff line number Diff line
@@ -63,10 +63,10 @@ static struct rtnl_link_stats64 *dummy_get_stats64(struct net_device *dev,

		dstats = per_cpu_ptr(dev->dstats, i);
		do {
			start = u64_stats_fetch_begin_bh(&dstats->syncp);
			start = u64_stats_fetch_begin_irq(&dstats->syncp);
			tbytes = dstats->tx_bytes;
			tpackets = dstats->tx_packets;
		} while (u64_stats_fetch_retry_bh(&dstats->syncp, start));
		} while (u64_stats_fetch_retry_irq(&dstats->syncp, start));
		stats->tx_bytes += tbytes;
		stats->tx_packets += tpackets;
	}
+4 −4
Original line number Diff line number Diff line
@@ -1685,7 +1685,7 @@ static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev,
	unsigned int start;

	do {
		start = u64_stats_fetch_begin_bh(&hwstat->syncp);
		start = u64_stats_fetch_begin_irq(&hwstat->syncp);

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

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

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

	} while (u64_stats_fetch_retry_bh(&hwstat->syncp, start));
	} while (u64_stats_fetch_retry_irq(&hwstat->syncp, start));
}

static void b44_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+6 −6
Original line number Diff line number Diff line
@@ -357,10 +357,10 @@ be_get_ethtool_stats(struct net_device *netdev,
		struct be_rx_stats *stats = rx_stats(rxo);

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

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

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

		do {
			start = u64_stats_fetch_begin_bh(&stats->sync);
			start = u64_stats_fetch_begin_irq(&stats->sync);
			for (i = 1; i < ETHTOOL_TXSTATS_NUM; i++) {
				p = (u8 *)stats + et_tx_stats[i].offset;
				data[base + i] =
					(et_tx_stats[i].size == sizeof(u64)) ?
						*(u64 *)p : *(u32 *)p;
			}
		} while (u64_stats_fetch_retry_bh(&stats->sync, start));
		} while (u64_stats_fetch_retry_irq(&stats->sync, start));
		base += ETHTOOL_TXSTATS_NUM;
	}
}
+8 −8
Original line number Diff line number Diff line
@@ -591,10 +591,10 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
	for_all_rx_queues(adapter, rxo, i) {
		const struct be_rx_stats *rx_stats = rx_stats(rxo);
		do {
			start = u64_stats_fetch_begin_bh(&rx_stats->sync);
			start = u64_stats_fetch_begin_irq(&rx_stats->sync);
			pkts = rx_stats(rxo)->rx_pkts;
			bytes = rx_stats(rxo)->rx_bytes;
		} while (u64_stats_fetch_retry_bh(&rx_stats->sync, start));
		} while (u64_stats_fetch_retry_irq(&rx_stats->sync, start));
		stats->rx_packets += pkts;
		stats->rx_bytes += bytes;
		stats->multicast += rx_stats(rxo)->rx_mcast_pkts;
@@ -605,10 +605,10 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
	for_all_tx_queues(adapter, txo, i) {
		const struct be_tx_stats *tx_stats = tx_stats(txo);
		do {
			start = u64_stats_fetch_begin_bh(&tx_stats->sync);
			start = u64_stats_fetch_begin_irq(&tx_stats->sync);
			pkts = tx_stats(txo)->tx_pkts;
			bytes = tx_stats(txo)->tx_bytes;
		} while (u64_stats_fetch_retry_bh(&tx_stats->sync, start));
		} while (u64_stats_fetch_retry_irq(&tx_stats->sync, start));
		stats->tx_packets += pkts;
		stats->tx_bytes += bytes;
	}
@@ -1408,15 +1408,15 @@ static void be_eqd_update(struct be_adapter *adapter)

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

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


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