Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / net / rose / rose_dev.c
index d779e07..7c279e2 100644 (file)
@@ -6,7 +6,6 @@
  *
  * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
  */
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/proc_fs.h>
 #include <linux/kernel.h>
 #include <net/ax25.h>
 #include <net/rose.h>
 
-/*
- *     Only allow IP over ROSE frames through if the netrom device is up.
- */
-
-int rose_rx_ip(struct sk_buff *skb, struct net_device *dev)
-{
-       struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
-
-#ifdef CONFIG_INET
-       if (!netif_running(dev)) {
-               stats->rx_errors++;
-               return 0;
-       }
-
-       stats->rx_packets++;
-       stats->rx_bytes += skb->len;
-
-       skb->protocol = htons(ETH_P_IP);
-
-       /* Spoof incoming device */
-       skb->dev      = dev;
-       skb->h.raw    = skb->data;
-       skb->nh.raw   = skb->data;
-       skb->pkt_type = PACKET_HOST;
-
-       ip_rcv(skb, skb->dev, NULL);
-#else
-       kfree_skb(skb);
-#endif
-       return 1;
-}
-
 static int rose_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
        void *daddr, void *saddr, unsigned len)
 {
@@ -89,9 +56,10 @@ static int rose_header(struct sk_buff *skb, struct net_device *dev, unsigned sho
 static int rose_rebuild_header(struct sk_buff *skb)
 {
        struct net_device *dev = skb->dev;
-       struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+       struct net_device_stats *stats = netdev_priv(dev);
        unsigned char *bp = (unsigned char *)skb->data;
        struct sk_buff *skbn;
+       unsigned int len;
 
 #ifdef CONFIG_INET
        if (arp_find(bp + 7, skb)) {
@@ -108,6 +76,8 @@ static int rose_rebuild_header(struct sk_buff *skb)
 
        kfree_skb(skb);
 
+       len = skbn->len;
+
        if (!rose_route_frame(skbn, NULL)) {
                kfree_skb(skbn);
                stats->tx_errors++;
@@ -115,7 +85,7 @@ static int rose_rebuild_header(struct sk_buff *skb)
        }
 
        stats->tx_packets++;
-       stats->tx_bytes += skbn->len;
+       stats->tx_bytes += len;
 #endif
        return 1;
 }
@@ -149,7 +119,7 @@ static int rose_close(struct net_device *dev)
 
 static int rose_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-       struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+       struct net_device_stats *stats = netdev_priv(dev);
 
        if (!netif_running(dev)) {
                printk(KERN_ERR "ROSE: rose_xmit - called when iface is down\n");
@@ -162,12 +132,11 @@ static int rose_xmit(struct sk_buff *skb, struct net_device *dev)
 
 static struct net_device_stats *rose_get_stats(struct net_device *dev)
 {
-       return (struct net_device_stats *)dev->priv;
+       return netdev_priv(dev);
 }
 
 void rose_setup(struct net_device *dev)
 {
-       SET_MODULE_OWNER(dev);
        dev->mtu                = ROSE_MAX_PACKET_SIZE - 2;
        dev->hard_start_xmit    = rose_xmit;
        dev->open               = rose_open;
@@ -181,6 +150,6 @@ void rose_setup(struct net_device *dev)
        dev->set_mac_address    = rose_set_mac_address;
 
        /* New-style flags. */
-       dev->flags              = 0;
+       dev->flags              = IFF_NOARP;
        dev->get_stats = rose_get_stats;
 }