Skip to content

Commit 3303680

Browse files
Eric DumazetDavid S. Miller
authored andcommitted
[NET]: loopback driver can use loopback_dev integrated net_device_stats
Rusty added a new 'stats' field to struct net_device. loopback driver can use it instead of declaring another struct net_device_stats This saves some memory. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 87a596e commit 3303680

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

‎drivers/net/loopback.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,9 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
164164
return 0;
165165
}
166166

167-
static struct net_device_stats loopback_stats;
168-
169167
static struct net_device_stats *get_stats(struct net_device *dev)
170168
{
171-
struct net_device_stats *stats = &loopback_stats;
169+
struct net_device_stats *stats = &dev->stats;
172170
unsigned long bytes = 0;
173171
unsigned long packets = 0;
174172
int i;
@@ -208,7 +206,6 @@ static const struct ethtool_ops loopback_ethtool_ops = {
208206
struct net_device loopback_dev = {
209207
.name = "lo",
210208
.get_stats = &get_stats,
211-
.priv = &loopback_stats,
212209
.mtu = (16 * 1024) + 20 + 20 + 12,
213210
.hard_start_xmit = loopback_xmit,
214211
.hard_header = eth_header,

0 commit comments

Comments
 (0)