提交 b88a762b 编写于 作者: R Ralf Baechle 提交者: David S. Miller

[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: NRalf Baechle DL5RB <ralf@linux-mips.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e21ce8c7
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#ifndef _NETROM_H #ifndef _NETROM_H
#define _NETROM_H #define _NETROM_H
#include <linux/netrom.h> #include <linux/netrom.h>
#include <linux/list.h> #include <linux/list.h>
#include <net/sock.h> #include <net/sock.h>
...@@ -58,6 +59,10 @@ enum { ...@@ -58,6 +59,10 @@ enum {
#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */ #define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */
#define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */ #define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */
struct nr_private {
struct net_device_stats stats;
};
struct nr_sock { struct nr_sock {
struct sock sock; struct sock sock;
ax25_address user_addr, source_addr, dest_addr; ax25_address user_addr, source_addr, dest_addr;
......
...@@ -1392,8 +1392,7 @@ static int __init nr_proto_init(void) ...@@ -1392,8 +1392,7 @@ static int __init nr_proto_init(void)
struct net_device *dev; struct net_device *dev;
sprintf(name, "nr%d", i); sprintf(name, "nr%d", i);
dev = alloc_netdev(sizeof(struct net_device_stats), name, dev = alloc_netdev(sizeof(struct nr_private), name, nr_setup);
nr_setup);
if (!dev) { if (!dev) {
printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n"); printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n");
goto fail; goto fail;
......
...@@ -160,10 +160,9 @@ static int nr_close(struct net_device *dev) ...@@ -160,10 +160,9 @@ static int nr_close(struct net_device *dev)
static int nr_xmit(struct sk_buff *skb, struct net_device *dev) static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct net_device_stats *stats = netdev_priv(dev); struct nr_private *nr = netdev_priv(dev);
unsigned int len; struct net_device_stats *stats = &nr->stats;
unsigned int len = skb->len;
len = skb->len;
if (!nr_route_frame(skb, NULL)) { if (!nr_route_frame(skb, NULL)) {
kfree_skb(skb); kfree_skb(skb);
...@@ -179,7 +178,9 @@ static int nr_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -179,7 +178,9 @@ static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
static struct net_device_stats *nr_get_stats(struct net_device *dev) static struct net_device_stats *nr_get_stats(struct net_device *dev)
{ {
return netdev_priv(dev); struct nr_private *nr = netdev_priv(dev);
return &nr->stats;
} }
void nr_setup(struct net_device *dev) void nr_setup(struct net_device *dev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册