fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / wan / syncppp.c
index 8cceec1..218f7b5 100644 (file)
@@ -37,7 +37,6 @@
  */
 #undef DEBUG
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -50,6 +49,7 @@
 #include <linux/random.h>
 #include <linux/pkt_sched.h>
 #include <linux/spinlock.h>
+#include <linux/rcupdate.h>
 
 #include <net/syncppp.h>
 
@@ -130,7 +130,7 @@ struct cisco_packet {
 
 static struct sppp *spppq;
 static struct timer_list sppp_keepalive_timer;
-static spinlock_t spppq_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(spppq_lock);
 
 /* global xmit queue for sending packets while spinlock is held */
 static struct sk_buff_head tx_queue;
@@ -220,7 +220,7 @@ static void sppp_clear_timeout(struct sppp *p)
  *     here.
  */
  
-void sppp_input (struct net_device *dev, struct sk_buff *skb)
+static void sppp_input (struct net_device *dev, struct sk_buff *skb)
 {
        struct ppp_header *h;
        struct sppp *sp = (struct sppp *)sppp_of(dev);
@@ -354,8 +354,6 @@ done:
        return;
 }
 
-EXPORT_SYMBOL(sppp_input);
-
 /*
  *     Handle transmit packets.
  */
@@ -471,7 +469,7 @@ static void sppp_lcp_input (struct sppp *sp, struct sk_buff *skb)
        struct net_device *dev = sp->pp_if;
        int len = skb->len;
        u8 *p, opt[6];
-       u32 rmagic;
+       u32 rmagic = 0;
 
        if (!pskb_may_pull(skb, sizeof(struct lcp_header))) {
                if (sp->pp_flags & PP_DEBUG)
@@ -643,7 +641,7 @@ badreq:
        case LCP_TERM_REQ:
                sppp_clear_timeout (sp);
                /* Send Terminate-Ack packet. */
-               sppp_cp_send (sp, PPP_LCP, LCP_TERM_ACK, h->ident, 0, 0);
+               sppp_cp_send (sp, PPP_LCP, LCP_TERM_ACK, h->ident, 0, NULL);
                /* Go to closed state. */
                sp->lcp.state = LCP_STATE_CLOSED;
                sp->ipcp.state = IPCP_STATE_CLOSED;
@@ -765,11 +763,11 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
                {
                struct in_device *in_dev;
                struct in_ifaddr *ifa;
-               u32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */
+               __be32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */
 #ifdef CONFIG_INET
-               if ((in_dev=in_dev_get(dev)) != NULL)
+               rcu_read_lock();
+               if ((in_dev = __in_dev_get_rcu(dev)) != NULL)
                {
-                       read_lock(&in_dev->lock);
                        for (ifa=in_dev->ifa_list; ifa != NULL;
                                ifa=ifa->ifa_next) {
                                if (strcmp(dev->name, ifa->ifa_label) == 0) 
@@ -779,9 +777,8 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
                                        break;
                                }
                        }
-                       read_unlock(&in_dev->lock);
-                       in_dev_put(in_dev);
                }
+               rcu_read_unlock();
 #endif         
                /* I hope both addr and mask are in the net order */
                sppp_cisco_send (sp, CISCO_ADDR_REPLY, addr, mask);
@@ -990,7 +987,7 @@ EXPORT_SYMBOL(sppp_reopen);
  *     the mtu is out of range.
  */
  
-int sppp_change_mtu(struct net_device *dev, int new_mtu)
+static int sppp_change_mtu(struct net_device *dev, int new_mtu)
 {
        if(new_mtu<128||new_mtu>PPP_MTU||(dev->flags&IFF_UP))
                return -EINVAL;
@@ -998,8 +995,6 @@ int sppp_change_mtu(struct net_device *dev, int new_mtu)
        return 0;
 }
 
-EXPORT_SYMBOL(sppp_change_mtu);
-
 /**
  *     sppp_do_ioctl - Ioctl handler for ppp/hdlc
  *     @dev: Device subject to ioctl
@@ -1262,7 +1257,7 @@ static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *skb)
                } else {
                        /* Send Configure-Ack packet. */
                        sppp_cp_send (sp, PPP_IPCP, IPCP_CONF_ACK, h->ident,
-                               0, 0);
+                               0, NULL);
                        /* Change the state. */
                        if (sp->ipcp.state == IPCP_STATE_ACK_RCVD)
                                sp->ipcp.state = IPCP_STATE_OPENED;
@@ -1297,7 +1292,7 @@ static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *skb)
                break;
        case IPCP_TERM_REQ:
                /* Send Terminate-Ack packet. */
-               sppp_cp_send (sp, PPP_IPCP, IPCP_TERM_ACK, h->ident, 0, 0);
+               sppp_cp_send (sp, PPP_IPCP, IPCP_TERM_ACK, h->ident, 0, NULL);
                /* Go to closed state. */
                sp->ipcp.state = IPCP_STATE_CLOSED;
                /* Initiate renegotiation. */
@@ -1332,7 +1327,7 @@ static void sppp_lcp_open (struct sppp *sp)
 static void sppp_ipcp_open (struct sppp *sp)
 {
        sp->ipcp.confid = ++sp->pp_seq;
-       sppp_cp_send (sp, PPP_IPCP, IPCP_CONF_REQ, sp->ipcp.confid, 0, 0);
+       sppp_cp_send (sp, PPP_IPCP, IPCP_CONF_REQ, sp->ipcp.confid, 0, NULL);
        sppp_set_timeout (sp, 2);
 }
 
@@ -1440,6 +1435,7 @@ static void sppp_print_bytes (u_char *p, u16 len)
  *     @skb:   The buffer to process
  *     @dev:   The device it arrived on
  *     @p: Unused
+ *     @orig_dev: Unused
  *
  *     Protocol glue. This drives the deferred processing mode the poorer
  *     cards use. This can be called directly by cards that do not have
@@ -1447,7 +1443,7 @@ static void sppp_print_bytes (u_char *p, u16 len)
  *     after interrupt servicing to process frames queued via netif_rx.
  */
 
-static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p)
+static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev)
 {
        if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
                return NET_RX_DROP;
@@ -1455,7 +1451,7 @@ static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_t
        return 0;
 }
 
-struct packet_type sppp_packet_type = {
+static struct packet_type sppp_packet_type = {
        .type   = __constant_htons(ETH_P_WAN_PPP),
        .func   = sppp_rcv,
 };
@@ -1483,6 +1479,6 @@ static void __exit sync_ppp_cleanup(void)
 
 module_init(sync_ppp_init);
 module_exit(sync_ppp_cleanup);
-MODULE_PARM(debug,"1i");
+module_param(debug, int, 0);
 MODULE_LICENSE("GPL");