#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/ptp_mock.h>
-#include <linux/u64_stats_sync.h>
#include <net/devlink.h>
#include <net/udp_tunnel.h>
#include <net/xdp.h>
int rq_reset_mode;
struct {
- u64_stats_t rx_packets;
- u64_stats_t rx_bytes;
- u64_stats_t tx_packets;
- u64_stats_t tx_bytes;
- struct u64_stats_sync syncp;
+ atomic64_t rx_packets;
+ atomic64_t rx_bytes;
+ atomic64_t tx_packets;
+ atomic64_t tx_bytes;
struct psp_dev __rcu *dev;
struct dentry *rereg;
struct mutex rereg_lock;
}
psp_len = skb->len - skb_inner_transport_offset(skb);
- u64_stats_update_begin(&ns->psp.syncp);
- u64_stats_inc(&ns->psp.tx_packets);
- u64_stats_add(&ns->psp.tx_bytes, psp_len);
- u64_stats_update_end(&ns->psp.syncp);
+ atomic64_inc(&ns->psp.tx_packets);
+ atomic64_add(psp_len, &ns->psp.tx_bytes);
/* Now pretend we just received this frame */
peer_psd = rcu_dereference(peer_ns->psp.dev);
refcount_inc(&(*psp_ext)->refcnt);
skb->decrypted = 1;
- u64_stats_update_begin(&peer_ns->psp.syncp);
- u64_stats_inc(&peer_ns->psp.rx_packets);
- u64_stats_add(&peer_ns->psp.rx_bytes, psp_len);
- u64_stats_update_end(&peer_ns->psp.syncp);
+ atomic64_inc(&peer_ns->psp.rx_packets);
+ atomic64_add(psp_len, &peer_ns->psp.rx_bytes);
} else {
struct ipv6hdr *ip6h __maybe_unused;
struct iphdr *iph;
static void nsim_get_stats(struct psp_dev *psd, struct psp_dev_stats *stats)
{
struct netdevsim *ns = psd->drv_priv;
- unsigned int start;
/* WARNING: do *not* blindly zero stats in real drivers!
* All required stats must be reported by the device!
*/
memset(stats, 0, sizeof(struct psp_dev_stats));
- do {
- start = u64_stats_fetch_begin(&ns->psp.syncp);
- stats->rx_bytes = u64_stats_read(&ns->psp.rx_bytes);
- stats->rx_packets = u64_stats_read(&ns->psp.rx_packets);
- stats->tx_bytes = u64_stats_read(&ns->psp.tx_bytes);
- stats->tx_packets = u64_stats_read(&ns->psp.tx_packets);
- } while (u64_stats_fetch_retry(&ns->psp.syncp, start));
+ stats->rx_bytes = atomic64_read(&ns->psp.rx_bytes);
+ stats->rx_packets = atomic64_read(&ns->psp.rx_packets);
+ stats->tx_bytes = atomic64_read(&ns->psp.tx_bytes);
+ stats->tx_packets = atomic64_read(&ns->psp.tx_packets);
}
static struct psp_dev_ops nsim_psp_ops = {