Skip to content

Commit ab044f8

Browse files
tklausersimonwunderlich
authored andcommitted
batman-adv: Use net_device_stats from struct net_device
Instead of using a private copy of struct net_device_stats in struct batadv_priv, use stats from struct net_device. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
1 parent 5405e19 commit ab044f8

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

net/batman-adv/distributed-arp-table.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
10031003
bool ret = false;
10041004
struct batadv_dat_entry *dat_entry = NULL;
10051005
struct sk_buff *skb_new;
1006+
struct net_device *soft_iface = bat_priv->soft_iface;
10061007
int hdr_size = 0;
10071008
unsigned short vid;
10081009

@@ -1061,10 +1062,10 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
10611062
if (!skb_new)
10621063
goto out;
10631064

1064-
skb_new->protocol = eth_type_trans(skb_new,
1065-
bat_priv->soft_iface);
1066-
bat_priv->stats.rx_packets++;
1067-
bat_priv->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size;
1065+
skb_new->protocol = eth_type_trans(skb_new, soft_iface);
1066+
1067+
soft_iface->stats.rx_packets++;
1068+
soft_iface->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size;
10681069

10691070
netif_rx(skb_new);
10701071
batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n");

net/batman-adv/soft-interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static u64 batadv_sum_counter(struct batadv_priv *bat_priv, size_t idx)
118118
static struct net_device_stats *batadv_interface_stats(struct net_device *dev)
119119
{
120120
struct batadv_priv *bat_priv = netdev_priv(dev);
121-
struct net_device_stats *stats = &bat_priv->stats;
121+
struct net_device_stats *stats = &dev->stats;
122122

123123
stats->tx_packets = batadv_sum_counter(bat_priv, BATADV_CNT_TX);
124124
stats->tx_bytes = batadv_sum_counter(bat_priv, BATADV_CNT_TX_BYTES);

net/batman-adv/types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,6 @@ struct batadv_priv_bat_v {
10001000
* struct batadv_priv - per mesh interface data
10011001
* @mesh_state: current status of the mesh (inactive/active/deactivating)
10021002
* @soft_iface: net device which holds this struct as private data
1003-
* @stats: structure holding the data for the ndo_get_stats() call
10041003
* @bat_counters: mesh internal traffic statistic counters (see batadv_counters)
10051004
* @aggregated_ogms: bool indicating whether OGM aggregation is enabled
10061005
* @bonding: bool indicating whether traffic bonding is enabled
@@ -1055,7 +1054,6 @@ struct batadv_priv_bat_v {
10551054
struct batadv_priv {
10561055
atomic_t mesh_state;
10571056
struct net_device *soft_iface;
1058-
struct net_device_stats stats;
10591057
u64 __percpu *bat_counters; /* Per cpu counters */
10601058
atomic_t aggregated_ogms;
10611059
atomic_t bonding;

0 commit comments

Comments
 (0)