linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / net / wan / sdla_fr.c
index 2efccb0..7f1ce9d 100644 (file)
 #include <asm/io.h>            /* for inb(), outb(), etc. */
 #include <linux/time.h>                /* for do_gettimeofday */       
 #include <linux/in.h>          /* sockaddr_in */
+#include <linux/jiffies.h>     /* time_after() macro */
 #include <asm/errno.h>
 
 #include <linux/ip.h>
@@ -444,7 +445,7 @@ void        s508_s514_unlock(sdla_t *card, unsigned long *smp_flags);
 void   s508_s514_lock(sdla_t *card, unsigned long *smp_flags);
 
 unsigned short calc_checksum (char *, int);
-static int setup_fr_header(struct sk_buff** skb,
+static int setup_fr_header(struct sk_buff *skb,
                           struct net_device* dev, char op_mode);
 
 
@@ -773,7 +774,7 @@ static int update(struct wan_device* wandev)
                for(;;) {
                if(card->u.f.update_comms_stats == 0)
                        break;
-                if ((jiffies - timeout) > (1 * HZ)){
+                if (time_after(jiffies, timeout + 1 * HZ)){
                        card->u.f.update_comms_stats = 0;
                        return -EAGAIN;
                }
@@ -821,7 +822,7 @@ static int new_if(struct wan_device* wandev, struct net_device* dev,
        chan->card = card;
 
        /* verify media address */
-       if (is_digit(conf->addr[0])) {
+       if (isdigit(conf->addr[0])) {
 
                dlci = dec_to_uint(conf->addr, 0);
 
@@ -1371,7 +1372,7 @@ static int if_send(struct sk_buff* skb, struct net_device* dev)
        /* Move the if_header() code to here. By inserting frame
         * relay header in if_header() we would break the
         * tcpdump and other packet sniffers */
-       chan->fr_header_len = setup_fr_header(&skb,dev,chan->common.usedby);
+       chan->fr_header_len = setup_fr_header(skb,dev,chan->common.usedby);
        if (chan->fr_header_len < 0 ){
                ++chan->ifstats.tx_dropped;
                ++card->wandev.stats.tx_dropped;
@@ -1596,8 +1597,6 @@ static int setup_for_delayed_transmit(struct net_device* dev,
                return 1;
        }
 
-       skb_unlink(skb);
-       
         chan->transmit_length = len;
        chan->delay_skb = skb;
         
@@ -3457,7 +3456,7 @@ static unsigned int dec_to_uint (unsigned char* str, int len)
        if (!len) 
                len = strlen(str);
 
-       for (val = 0; len && is_digit(*str); ++str, --len)
+       for (val = 0; len && isdigit(*str); ++str, --len)
                val = (val * 10) + (*str - (unsigned)'0');
 
        return val;
@@ -4799,7 +4798,7 @@ static void trigger_unconfig_fr(struct net_device *dev)
 {
        fr_channel_t *chan = dev->priv;
        volatile sdla_t *card = chan->card;
-       u32 timeout;
+       unsigned long timeout;
        fr508_flags_t* flags = card->flags;
        int reset_critical=0;
        
@@ -4821,7 +4820,7 @@ static void trigger_unconfig_fr(struct net_device *dev)
                if(!(card->u.f.timer_int_enabled & TMR_INT_ENABLED_UNCONFIG))
                        break;
 
-               if ((jiffies - timeout) > (1 * HZ)){
+               if (time_after(jiffies, timeout + 1 * HZ)){
                        card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UNCONFIG;
                        printk(KERN_INFO "%s: Failed to delete DLCI %i\n",
                                card->devname,chan->dlci);
@@ -4870,18 +4869,15 @@ static void unconfig_fr (sdla_t *card)
        }
 }
 
-static int setup_fr_header(struct sk_buff **skb_orig, struct net_device* dev,
+static int setup_fr_header(struct sk_buff *skb, struct net_device* dev,
                           char op_mode)
 {
-       struct sk_buff *skb = *skb_orig;
        fr_channel_t *chan=dev->priv;
 
-       if (op_mode == WANPIPE){
-
+       if (op_mode == WANPIPE) {
                chan->fr_header[0]=Q922_UI;
                
                switch (htons(skb->protocol)){
-                       
                case ETH_P_IP:
                        chan->fr_header[1]=NLPID_IP;
                        break;
@@ -4893,16 +4889,14 @@ static int setup_fr_header(struct sk_buff **skb_orig, struct net_device* dev,
        }
 
        /* If we are in bridging mode, we must apply
-        * an Ethernet header */
-       if (op_mode == BRIDGE || op_mode == BRIDGE_NODE){
-
-
+        * an Ethernet header
+        */
+       if (op_mode == BRIDGE || op_mode == BRIDGE_NODE) {
                /* Encapsulate the packet as a bridged Ethernet frame. */
 #ifdef DEBUG
                printk(KERN_INFO "%s: encapsulating skb for frame relay\n", 
                        dev->name);
 #endif
-               
                chan->fr_header[0] = 0x03;
                chan->fr_header[1] = 0x00;
                chan->fr_header[2] = 0x80;
@@ -4915,7 +4909,6 @@ static int setup_fr_header(struct sk_buff **skb_orig, struct net_device* dev,
                /* Yuck. */
                skb->protocol = ETH_P_802_3;
                return 8;
-
        }
                
        return 0;