drivers/net/ovpn/stats.h

Source file repositories/reference/linux-study-clean/drivers/net/ovpn/stats.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ovpn/stats.h
Extension
.h
Size
1409 bytes
Lines
64
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ovpn_peer_stat {
	atomic64_t bytes;
	atomic64_t packets;
};

/* rx and tx stats combined */
struct ovpn_peer_stats {
	struct ovpn_peer_stat rx;
	struct ovpn_peer_stat tx;
};

void ovpn_peer_stats_init(struct ovpn_peer_stats *ps);

static inline void ovpn_peer_stats_increment(struct ovpn_peer_stat *stat,
					     const unsigned int n)
{
	atomic64_add(n, &stat->bytes);
	atomic64_inc(&stat->packets);
}

static inline void ovpn_peer_stats_increment_rx(struct ovpn_peer_stats *stats,
						const unsigned int n)
{
	ovpn_peer_stats_increment(&stats->rx, n);
}

static inline void ovpn_peer_stats_increment_tx(struct ovpn_peer_stats *stats,
						const unsigned int n)
{
	ovpn_peer_stats_increment(&stats->tx, n);
}

static inline void ovpn_dev_dstats_tx_dropped(struct net_device *dev)
{
	local_bh_disable();
	dev_dstats_tx_dropped(dev);
	local_bh_enable();
}

static inline void ovpn_dev_dstats_rx_dropped(struct net_device *dev)
{
	local_bh_disable();
	dev_dstats_rx_dropped(dev);
	local_bh_enable();
}

#endif /* _NET_OVPN_OVPNSTATS_H_ */

Annotation

Implementation Notes