mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
net: alacritech: Use u64_stats_t with u64_stats_sync properly
On 64bit arches, struct u64_stats_sync is empty and provides no help against load/store tearing. Convert to u64_stats_t to ensure atomic operations. Signed-off-by: David Yang <mmyangfl@gmail.com> Link: https://patch.msgid.link/20260122185113.2760355-1-mmyangfl@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
3da35aa8af
commit
6e9674a980
|
|
@ -284,7 +284,7 @@
|
|||
#define SLIC_INC_STATS_COUNTER(st, counter) \
|
||||
do { \
|
||||
u64_stats_update_begin(&(st)->syncp); \
|
||||
(st)->counter++; \
|
||||
u64_stats_inc(&(st)->counter); \
|
||||
u64_stats_update_end(&(st)->syncp); \
|
||||
} while (0)
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ do { \
|
|||
unsigned int start; \
|
||||
do { \
|
||||
start = u64_stats_fetch_begin(&(st)->syncp); \
|
||||
newst = (st)->counter; \
|
||||
newst = u64_stats_read(&(st)->counter); \
|
||||
} while (u64_stats_fetch_retry(&(st)->syncp, start)); \
|
||||
}
|
||||
|
||||
|
|
@ -407,34 +407,34 @@ struct slic_oasis_eeprom {
|
|||
};
|
||||
|
||||
struct slic_stats {
|
||||
u64 rx_packets;
|
||||
u64 rx_bytes;
|
||||
u64 rx_mcasts;
|
||||
u64 rx_errors;
|
||||
u64 tx_packets;
|
||||
u64 tx_bytes;
|
||||
u64_stats_t rx_packets;
|
||||
u64_stats_t rx_bytes;
|
||||
u64_stats_t rx_mcasts;
|
||||
u64_stats_t rx_errors;
|
||||
u64_stats_t tx_packets;
|
||||
u64_stats_t tx_bytes;
|
||||
/* HW STATS */
|
||||
u64 rx_buff_miss;
|
||||
u64 tx_dropped;
|
||||
u64 irq_errs;
|
||||
u64_stats_t rx_buff_miss;
|
||||
u64_stats_t tx_dropped;
|
||||
u64_stats_t irq_errs;
|
||||
/* transport layer */
|
||||
u64 rx_tpcsum;
|
||||
u64 rx_tpoflow;
|
||||
u64 rx_tphlen;
|
||||
u64_stats_t rx_tpcsum;
|
||||
u64_stats_t rx_tpoflow;
|
||||
u64_stats_t rx_tphlen;
|
||||
/* ip layer */
|
||||
u64 rx_ipcsum;
|
||||
u64 rx_iplen;
|
||||
u64 rx_iphlen;
|
||||
u64_stats_t rx_ipcsum;
|
||||
u64_stats_t rx_iplen;
|
||||
u64_stats_t rx_iphlen;
|
||||
/* link layer */
|
||||
u64 rx_early;
|
||||
u64 rx_buffoflow;
|
||||
u64 rx_lcode;
|
||||
u64 rx_drbl;
|
||||
u64 rx_crc;
|
||||
u64 rx_oflow802;
|
||||
u64 rx_uflow802;
|
||||
u64_stats_t rx_early;
|
||||
u64_stats_t rx_buffoflow;
|
||||
u64_stats_t rx_lcode;
|
||||
u64_stats_t rx_drbl;
|
||||
u64_stats_t rx_crc;
|
||||
u64_stats_t rx_oflow802;
|
||||
u64_stats_t rx_uflow802;
|
||||
/* oasis only */
|
||||
u64 tx_carrier;
|
||||
u64_stats_t tx_carrier;
|
||||
struct u64_stats_sync syncp;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -378,8 +378,8 @@ static void slic_xmit_complete(struct slic_device *sdev)
|
|||
smp_wmb();
|
||||
|
||||
u64_stats_update_begin(&sdev->stats.syncp);
|
||||
sdev->stats.tx_bytes += bytes;
|
||||
sdev->stats.tx_packets += frames;
|
||||
u64_stats_add(&sdev->stats.tx_bytes, bytes);
|
||||
u64_stats_add(&sdev->stats.tx_packets, frames);
|
||||
u64_stats_update_end(&sdev->stats.syncp);
|
||||
|
||||
netif_tx_lock(dev);
|
||||
|
|
@ -615,8 +615,8 @@ static void slic_handle_receive(struct slic_device *sdev, unsigned int todo,
|
|||
}
|
||||
|
||||
u64_stats_update_begin(&sdev->stats.syncp);
|
||||
sdev->stats.rx_bytes += bytes;
|
||||
sdev->stats.rx_packets += frames;
|
||||
u64_stats_add(&sdev->stats.rx_bytes, bytes);
|
||||
u64_stats_add(&sdev->stats.rx_packets, frames);
|
||||
u64_stats_update_end(&sdev->stats.syncp);
|
||||
|
||||
slic_refill_rx_queue(sdev, GFP_ATOMIC);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user