Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

l2tp: Handle eth stats using NETDEV_PCPU_STAT_DSTATS.

l2tp_eth uses the TSTATS infrastructure (dev_sw_netstats_*()) for RX
and TX packet counters and DEV_STATS_INC for dropped counters.

Consolidate that using the DSTATS infrastructure, which can
handle both packet counters and packet drops. Statistics that don't
fit DSTATS are still updated atomically with DEV_STATS_INC().

This change is inspired by the introduction of DSTATS helpers and
their use in other udp tunnel drivers:
Link: https://lore.kernel.org/all/cover.1733313925.git.gnault@redhat.com/

Signed-off-by: James Chapman <jchapman@katalix.com>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

James Chapman and committed by
David S. Miller
c0b8980e 54d39705

+4 -5
+4 -5
net/l2tp/l2tp_eth.c
··· 73 73 int ret = l2tp_xmit_skb(session, skb); 74 74 75 75 if (likely(ret == NET_XMIT_SUCCESS)) 76 - dev_sw_netstats_tx_add(dev, 1, len); 76 + dev_dstats_tx_add(dev, len); 77 77 else 78 - DEV_STATS_INC(dev, tx_dropped); 78 + dev_dstats_tx_dropped(dev); 79 79 80 80 return NETDEV_TX_OK; 81 81 } ··· 84 84 .ndo_init = l2tp_eth_dev_init, 85 85 .ndo_uninit = l2tp_eth_dev_uninit, 86 86 .ndo_start_xmit = l2tp_eth_dev_xmit, 87 - .ndo_get_stats64 = dev_get_tstats64, 88 87 .ndo_set_mac_address = eth_mac_addr, 89 88 }; 90 89 ··· 99 100 dev->lltx = true; 100 101 dev->netdev_ops = &l2tp_eth_netdev_ops; 101 102 dev->needs_free_netdev = true; 102 - dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; 103 + dev->pcpu_stat_type = NETDEV_PCPU_STAT_DSTATS; 103 104 } 104 105 105 106 static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len) ··· 127 128 goto error_rcu; 128 129 129 130 if (dev_forward_skb(dev, skb) == NET_RX_SUCCESS) 130 - dev_sw_netstats_rx_add(dev, data_len); 131 + dev_dstats_rx_add(dev, data_len); 131 132 else 132 133 DEV_STATS_INC(dev, rx_errors); 133 134