aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-01-07 20:22:19 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-07 20:22:19 -0500
commit43a67304a3e882ec297e08159f8698be59a235fe (patch)
treec287f437f10a0375819765795a6964160512c101 /drivers
parent03b35ccb7c41ccc256631ff33e6887b7be88137b (diff)
appletalk: convert ipddp to net_device_ops
Use internal element in network device for stats as well. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/appletalk/ipddp.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c
index 9a0be9b2eaad..da64ba88d7f8 100644
--- a/drivers/net/appletalk/ipddp.c
+++ b/drivers/net/appletalk/ipddp.c
@@ -48,12 +48,18 @@ static int ipddp_mode = IPDDP_DECAP;
48 48
49/* Index to functions, as function prototypes. */ 49/* Index to functions, as function prototypes. */
50static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev); 50static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev);
51static struct net_device_stats *ipddp_get_stats(struct net_device *dev);
52static int ipddp_create(struct ipddp_route *new_rt); 51static int ipddp_create(struct ipddp_route *new_rt);
53static int ipddp_delete(struct ipddp_route *rt); 52static int ipddp_delete(struct ipddp_route *rt);
54static struct ipddp_route* ipddp_find_route(struct ipddp_route *rt); 53static struct ipddp_route* ipddp_find_route(struct ipddp_route *rt);
55static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 54static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
56 55
56static const struct net_device_ops ipddp_netdev_ops = {
57 .ndo_start_xmit = ipddp_xmit,
58 .ndo_do_ioctl = ipddp_ioctl,
59 .ndo_change_mtu = eth_change_mtu,
60 .ndo_set_mac_address = eth_mac_addr,
61 .ndo_validate_addr = eth_validate_addr,
62};
57 63
58static struct net_device * __init ipddp_init(void) 64static struct net_device * __init ipddp_init(void)
59{ 65{
@@ -61,7 +67,7 @@ static struct net_device * __init ipddp_init(void)
61 struct net_device *dev; 67 struct net_device *dev;
62 int err; 68 int err;
63 69
64 dev = alloc_etherdev(sizeof(struct net_device_stats)); 70 dev = alloc_etherdev(0);
65 if (!dev) 71 if (!dev)
66 return ERR_PTR(-ENOMEM); 72 return ERR_PTR(-ENOMEM);
67 73
@@ -71,9 +77,7 @@ static struct net_device * __init ipddp_init(void)
71 printk(version); 77 printk(version);
72 78
73 /* Initalize the device structure. */ 79 /* Initalize the device structure. */
74 dev->hard_start_xmit = ipddp_xmit; 80 dev->netdev_ops = &ipddp_netdev_ops;
75 dev->get_stats = ipddp_get_stats;
76 dev->do_ioctl = ipddp_ioctl;
77 81
78 dev->type = ARPHRD_IPDDP; /* IP over DDP tunnel */ 82 dev->type = ARPHRD_IPDDP; /* IP over DDP tunnel */
79 dev->mtu = 585; 83 dev->mtu = 585;
@@ -103,13 +107,6 @@ static struct net_device * __init ipddp_init(void)
103 return dev; 107 return dev;
104} 108}
105 109
106/*
107 * Get the current statistics. This may be called with the card open or closed.
108 */
109static struct net_device_stats *ipddp_get_stats(struct net_device *dev)
110{
111 return netdev_priv(dev);
112}
113 110
114/* 111/*
115 * Transmit LLAP/ELAP frame using aarp_send_ddp. 112 * Transmit LLAP/ELAP frame using aarp_send_ddp.
@@ -170,8 +167,8 @@ static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
170 167
171 skb->protocol = htons(ETH_P_ATALK); /* Protocol has changed */ 168 skb->protocol = htons(ETH_P_ATALK); /* Protocol has changed */
172 169
173 ((struct net_device_stats *) netdev_priv(dev))->tx_packets++; 170 dev->stats.tx_packets++;
174 ((struct net_device_stats *) netdev_priv(dev))->tx_bytes += skb->len; 171 dev->stats.tx_bytes += skb->len;
175 172
176 if(aarp_send_ddp(rt->dev, skb, &rt->at, NULL) < 0) 173 if(aarp_send_ddp(rt->dev, skb, &rt->at, NULL) < 0)
177 dev_kfree_skb(skb); 174 dev_kfree_skb(skb);