Skip to content

Commit b88a762

Browse files
ralfbaechledavem330
authored andcommitted
[NETROM]: Introduct stuct nr_private
NET/ROM's virtual interfaces don't have a proper private data structure yet. Create struct nr_private and put the statistics there. Signed-off-by: Ralf Baechle DL5RB <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e21ce8c commit b88a762

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

‎include/net/netrom.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#ifndef _NETROM_H
88
#define _NETROM_H
9+
910
#include <linux/netrom.h>
1011
#include <linux/list.h>
1112
#include <net/sock.h>
@@ -58,6 +59,10 @@ enum {
5859
#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */
5960
#define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */
6061

62+
struct nr_private {
63+
struct net_device_stats stats;
64+
};
65+
6166
struct nr_sock {
6267
struct sock sock;
6368
ax25_address user_addr, source_addr, dest_addr;

‎net/netrom/af_netrom.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,7 @@ static int __init nr_proto_init(void)
13921392
struct net_device *dev;
13931393

13941394
sprintf(name, "nr%d", i);
1395-
dev = alloc_netdev(sizeof(struct net_device_stats), name,
1396-
nr_setup);
1395+
dev = alloc_netdev(sizeof(struct nr_private), name, nr_setup);
13971396
if (!dev) {
13981397
printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n");
13991398
goto fail;

‎net/netrom/nr_dev.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,9 @@ static int nr_close(struct net_device *dev)
160160

161161
static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
162162
{
163-
struct net_device_stats *stats = netdev_priv(dev);
164-
unsigned int len;
165-
166-
len = skb->len;
163+
struct nr_private *nr = netdev_priv(dev);
164+
struct net_device_stats *stats = &nr->stats;
165+
unsigned int len = skb->len;
167166

168167
if (!nr_route_frame(skb, NULL)) {
169168
kfree_skb(skb);
@@ -179,7 +178,9 @@ static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
179178

180179
static struct net_device_stats *nr_get_stats(struct net_device *dev)
181180
{
182-
return netdev_priv(dev);
181+
struct nr_private *nr = netdev_priv(dev);
182+
183+
return &nr->stats;
183184
}
184185

185186
void nr_setup(struct net_device *dev)

0 commit comments

Comments
 (0)