提交 d3fd6548 编写于 作者: H Heiner Kallweit 提交者: Jakub Kicinski

net: core: add dev_sw_netstats_tx_add

Add dev_sw_netstats_tx_add(), complementing already existing
dev_sw_netstats_rx_add(). Other than dev_sw_netstats_rx_add allow to
pass the number of packets as function argument.
Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 4e5d79bb
...@@ -2557,6 +2557,18 @@ static inline void dev_sw_netstats_rx_add(struct net_device *dev, unsigned int l ...@@ -2557,6 +2557,18 @@ static inline void dev_sw_netstats_rx_add(struct net_device *dev, unsigned int l
u64_stats_update_end(&tstats->syncp); u64_stats_update_end(&tstats->syncp);
} }
static inline void dev_sw_netstats_tx_add(struct net_device *dev,
unsigned int packets,
unsigned int len)
{
struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
u64_stats_update_begin(&tstats->syncp);
tstats->tx_bytes += len;
tstats->tx_packets += packets;
u64_stats_update_end(&tstats->syncp);
}
static inline void dev_lstats_add(struct net_device *dev, unsigned int len) static inline void dev_lstats_add(struct net_device *dev, unsigned int len)
{ {
struct pcpu_lstats *lstats = this_cpu_ptr(dev->lstats); struct pcpu_lstats *lstats = this_cpu_ptr(dev->lstats);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册