diff -urN pre7-8/drivers/net/3c523.c pre7-8.jw/drivers/net/3c523.c --- pre7-8/drivers/net/3c523.c Wed May 10 01:58:11 2000 +++ pre7-8.jw/drivers/net/3c523.c Wed May 10 05:05:49 2000 @@ -617,7 +617,7 @@ s = jiffies; /* warning: only active with interrupts on !! */ while (!(cfg_cmd->cmd_status & STAT_COMPL)) { - if (jiffies - s > 30*HZ/100) + if (time_after(jiffies, s + 30*HZ/100)) break; } @@ -643,7 +643,7 @@ s = jiffies; while (!(ias_cmd->cmd_status & STAT_COMPL)) { - if (jiffies - s > 30*HZ/100) + if (time_after(jiffies, s + 30*HZ/100)) break; } @@ -668,7 +668,7 @@ s = jiffies; while (!(tdr_cmd->cmd_status & STAT_COMPL)) { - if (jiffies - s > 30*HZ/100) { + if (time_after(jiffies, s + 30*HZ/100)) { printk(KERN_WARNING "%s: %d Problems while running the TDR.\n", dev->name, __LINE__); result = 1; break; @@ -757,7 +757,7 @@ elmc_id_attn586(); s = jiffies; while (!(mc_cmd->cmd_status & STAT_COMPL)) { - if (jiffies - s > 30*HZ/100) + if (time_after(jiffies, s + 30*HZ/100)) break; } if (!(mc_cmd->cmd_status & STAT_COMPL)) { diff -urN pre7-8/drivers/net/8390.c pre7-8.jw/drivers/net/8390.c --- pre7-8/drivers/net/8390.c Wed Apr 12 12:38:53 2000 +++ pre7-8.jw/drivers/net/8390.c Wed May 10 04:18:13 2000 @@ -223,7 +223,7 @@ /* Do timeouts, just like the 8003 driver. */ int txsr; int isr; - int tickssofar = jiffies - dev->trans_start; + int tickssofar = jiffies - dev->trans_start; /* wrap unsafe */ /* * Need the page lock. Now see what went wrong. This bit is diff -urN pre7-8/drivers/net/apne.c pre7-8.jw/drivers/net/apne.c --- pre7-8/drivers/net/apne.c Wed Aug 18 14:36:41 1999 +++ pre7-8.jw/drivers/net/apne.c Wed May 10 04:51:53 2000 @@ -198,7 +198,7 @@ writeb(readb(ioaddr + NE_RESET), ioaddr + NE_RESET); while ((readb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0) - if (jiffies - reset_start_time > 2*HZ/100) { + if (time_after(jiffies, reset_start_time + 2*HZ/100)) { printk(" not found (no reset ack).\n"); return -ENODEV; } @@ -373,7 +373,7 @@ /* This check _should_not_ be necessary, omit eventually. */ while ((readb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0) - if (jiffies - reset_start_time > 2*HZ/100) { + if (time_after(jiffies, reset_start_time + 2*HZ/100)) { printk("%s: ne_reset_8390() did not complete.\n", dev->name); break; } @@ -525,7 +525,7 @@ dma_start = jiffies; while ((readb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) - if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ + if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ printk("%s: timeout waiting for Tx RDC.\n", dev->name); apne_reset_8390(dev); NS8390_init(dev,1); diff -urN pre7-8/drivers/net/ariadne.c pre7-8.jw/drivers/net/ariadne.c --- pre7-8/drivers/net/ariadne.c Sun Feb 13 14:21:42 2000 +++ pre7-8.jw/drivers/net/ariadne.c Wed May 10 05:20:26 2000 @@ -548,8 +548,7 @@ /* Transmitter timeout, serious problems. */ if (dev->tbusy) { - int tickssofar = jiffies - dev->trans_start; - if (tickssofar < 20) + if (time_before(jiffies, dev->trans_start + 20)) return(1); lance->RAP = CSR0; /* PCnet-ISA Controller Status */ printk("%s: transmit timed out, status %4.4x, resetting.\n", dev->name, diff -urN pre7-8/drivers/net/atarilance.c pre7-8.jw/drivers/net/atarilance.c --- pre7-8/drivers/net/atarilance.c Wed Aug 18 14:36:41 1999 +++ pre7-8.jw/drivers/net/atarilance.c Wed May 10 05:20:54 2000 @@ -723,8 +723,7 @@ /* Transmitter timeout, serious problems. */ if (dev->tbusy) { - int tickssofar = jiffies - dev->trans_start; - if (tickssofar < 20) + if (time_before(jiffies, dev->trans_start + 20)) return( 1 ); AREG = CSR0; DPRINTK( 1, ( "%s: transmit timed out, status %04x, resetting.\n", diff -urN pre7-8/drivers/net/atp.c pre7-8.jw/drivers/net/atp.c --- pre7-8/drivers/net/atp.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/atp.c Wed May 10 04:24:58 2000 @@ -548,7 +548,7 @@ } num_tx_since_rx++; } else if (num_tx_since_rx > 8 - && jiffies - dev->last_rx > 100) { + && time_after(jiffies, dev->last_rx + 100)) { if (net_debug > 2) printk("%s: Missed packet? No Rx after %d Tx and %ld jiffies" " status %02x CMR1 %02x.\n", dev->name, diff -urN pre7-8/drivers/net/cs89x0.c pre7-8.jw/drivers/net/cs89x0.c --- pre7-8/drivers/net/cs89x0.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/cs89x0.c Wed May 10 04:24:05 2000 @@ -285,7 +285,7 @@ just in case EEPROM is ready when SI_BUSY in the PP_SelfST is clear */ while(readreg(dev, PP_SelfST) & SI_BUSY) - if (jiffies - timeout >= 40) + if (time_after_eq(jiffies, timeout + 40)) return -1; return 0; } @@ -730,8 +730,8 @@ } /* Wait until the chip is reset */ reset_start_time = jiffies; - while( (readreg(dev, PP_SelfST) & INIT_DONE) == 0 && jiffies - reset_start_time < 2) - ; + while( (readreg(dev, PP_SelfST) & INIT_DONE) == 0 && time_before(jiffies, reset_start_time + 2)) + /* nothing */; } @@ -751,8 +751,8 @@ writereg(dev, PP_SelfCTL, selfcontrol); /* Wait for the DC/DC converter to power up - 500ms */ - while (jiffies - timenow < HZ) - ; + while (time_before(jiffies, timenow + HZ)) + /* nothing */; } @@ -780,8 +780,8 @@ control_dc_dc(dev, 0); /* Delay for the hardware to work out if the TP cable is present - 150ms */ - for (timenow = jiffies; jiffies - timenow < 15; ) - ; + for (timenow = jiffies; time_before(jiffies, timenow + 15); ) + /* nothing */; if ((readreg(dev, PP_LineST) & LINK_OK) == 0) return DETECTED_NONE; @@ -822,7 +822,7 @@ if ((lp->auto_neg_cnf & AUTO_NEG_BITS) == AUTO_NEG_ENABLE) { printk(KERN_INFO "%s: negotiating duplex...\n",dev->name); while (readreg(dev, PP_AutoNegST) & AUTO_NEG_BUSY) { - if (jiffies - timenow > 4000) { + if (time_after(jiffies, timenow + 4000)) { printk(KERN_ERR "**** Full / half duplex auto-negotiation timed out ****\n"); break; } @@ -855,10 +855,10 @@ writeword(dev, TX_LEN_PORT, ETH_ZLEN); /* Test to see if the chip has allocated memory for the packet */ - while (jiffies - timenow < 5) + while (time_before(jiffies, timenow + 5)) if (readreg(dev, PP_BusST) & READY_FOR_TX_NOW) break; - if (jiffies - timenow >= 5) + if (time_after_eq(jiffies, timenow + 5)) return 0; /* this shouldn't happen */ /* Write the contents of the packet */ @@ -866,7 +866,7 @@ if (net_debug > 1) printk("Sending test packet "); /* wait a couple of jiffies for packet to be received */ - for (timenow = jiffies; jiffies - timenow < 3; ) + for (timenow = jiffies; time_before(jiffies, timenow + 3); ) ; if ((readreg(dev, PP_TxEvent) & TX_SEND_OK_BITS) == TX_OK) { if (net_debug > 1) printk("succeeded\n"); diff -urN pre7-8/drivers/net/de600.c pre7-8.jw/drivers/net/de600.c --- pre7-8/drivers/net/de600.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/de600.c Wed May 10 04:49:50 2000 @@ -401,19 +401,16 @@ unsigned long flags; int transmit_from; int len; - int tickssofar; byte *buffer = skb->data; if (free_tx_pages <= 0) { /* Do timeouts, to avoid hangs. */ - tickssofar = jiffies - dev->trans_start; - - if (tickssofar < 5) + if (time_before(jiffies, dev->trans_start + 5)) return 1; /* else */ printk("%s: transmit timed out (%d), %s?\n", dev->name, - tickssofar, + jiffies - dev->trans_start, "network cable problem" ); /* Restart the adapter. */ diff -urN pre7-8/drivers/net/eexpress.c pre7-8.jw/drivers/net/eexpress.c --- pre7-8/drivers/net/eexpress.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/eexpress.c Wed May 10 04:47:19 2000 @@ -504,7 +504,7 @@ if (lp->started) { - if ((jiffies - dev->trans_start)>50) + if (time_after(jiffies, dev->trans_start + 50)) { if (lp->tx_link==lp->last_tx_restart) { @@ -560,7 +560,7 @@ } else { - if ((jiffies-lp->init_time)>10) + if (time_after(jiffies, lp->init_time + 10)) { unsigned short status = scb_status(dev); printk(KERN_WARNING "%s: i82586 startup timed out, status %04x, resetting...\n", @@ -726,7 +726,7 @@ static void eexp_cmd_clear(struct net_device *dev) { unsigned long int oldtime = jiffies; - while (scb_rdcmd(dev) && ((jiffies-oldtime)<10)); + while (scb_rdcmd(dev) && time_before(jiffies, oldtime + 10)); if (scb_rdcmd(dev)) { printk("%s: command didn't clear\n", dev->name); } @@ -1605,7 +1605,7 @@ #endif oj = jiffies; while ((SCB_CUstat(scb_status(dev)) == 2) && - ((jiffies-oj) < 2000)); + time_before(jiffies, oj + 2000)); if (SCB_CUstat(scb_status(dev)) == 2) printk("%s: warning, CU didn't stop\n", dev->name); lp->started &= ~(STARTED_CU); diff -urN pre7-8/drivers/net/eth16i.c pre7-8.jw/drivers/net/eth16i.c --- pre7-8/drivers/net/eth16i.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/eth16i.c Wed May 10 05:07:13 2000 @@ -757,7 +757,7 @@ outb(TX_START | 1, ioaddr + TRANSMIT_START_REG); while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) { - if( (jiffies - starttime) > TX_TIMEOUT) { + if(time_after(jiffies, starttime + TX_TIMEOUT)) { return -1; } } @@ -772,13 +772,13 @@ starttime = jiffies; while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) { - if( (jiffies - starttime) > TX_TIMEOUT) { + if(time_after(jiffies, starttime + TX_TIMEOUT)) { if(eth16i_debug > 1) printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n"); starttime = jiffies; while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) { - if( (jiffies - starttime) > TX_TIMEOUT) { + if(time_after(jiffies, starttime + TX_TIMEOUT)) { if(eth16i_debug > 1) printk(KERN_DEBUG "Timeout occurred waiting receive packet\n"); return -1; diff -urN pre7-8/drivers/net/hamradio/baycom_epp.c pre7-8.jw/drivers/net/hamradio/baycom_epp.c --- pre7-8/drivers/net/hamradio/baycom_epp.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/hamradio/baycom_epp.c Wed May 10 05:18:25 2000 @@ -356,7 +356,7 @@ * measure the interrupt frequency */ bc->debug_vals.cur_intcnt++; - if ((cur_jiffies - bc->debug_vals.last_jiffies) >= HZ) { + if (time_after_eq(cur_jiffies, bc->debug_vals.last_jiffies + 1*HZ)) { bc->debug_vals.last_jiffies = cur_jiffies; bc->debug_vals.last_intcnt = bc->debug_vals.cur_intcnt; bc->debug_vals.cur_intcnt = 0; @@ -1078,7 +1078,7 @@ /* autoprobe baud rate */ tstart = jiffies; i = 0; - while ((signed)(jiffies-tstart-HZ/3) < 0) { + while (time_before(jiffies, tstart - HZ/3)) { if (pp->ops->epp_read_addr(pp, &stat, 1, 0) != 1) goto epptimeout; if ((stat & (EPP_NRAEF|EPP_NRHF)) == EPP_NRHF) { diff -urN pre7-8/drivers/net/hamradio/baycom_par.c pre7-8.jw/drivers/net/hamradio/baycom_par.c --- pre7-8/drivers/net/hamradio/baycom_par.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/hamradio/baycom_par.c Wed May 10 05:08:36 2000 @@ -169,7 +169,7 @@ * measure the interrupt frequency */ bc->debug_vals.cur_intcnt++; - if ((cur_jiffies - bc->debug_vals.last_jiffies) >= HZ) { + if (time_after_eq(cur_jiffies, bc->debug_vals.last_jiffies + HZ)) { bc->debug_vals.last_jiffies = cur_jiffies; bc->debug_vals.last_intcnt = bc->debug_vals.cur_intcnt; bc->debug_vals.cur_intcnt = 0; diff -urN pre7-8/drivers/net/hamradio/baycom_ser_fdx.c pre7-8.jw/drivers/net/hamradio/baycom_ser_fdx.c --- pre7-8/drivers/net/hamradio/baycom_ser_fdx.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/hamradio/baycom_ser_fdx.c Wed May 10 05:09:02 2000 @@ -164,7 +164,7 @@ * measure the interrupt frequency */ bc->debug_vals.cur_intcnt++; - if ((cur_jiffies - bc->debug_vals.last_jiffies) >= HZ) { + if (time_after_eq(cur_jiffies, bc->debug_vals.last_jiffies + HZ)) { bc->debug_vals.last_jiffies = cur_jiffies; bc->debug_vals.last_intcnt = bc->debug_vals.cur_intcnt; bc->debug_vals.cur_intcnt = 0; diff -urN pre7-8/drivers/net/hamradio/baycom_ser_hdx.c pre7-8.jw/drivers/net/hamradio/baycom_ser_hdx.c --- pre7-8/drivers/net/hamradio/baycom_ser_hdx.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/hamradio/baycom_ser_hdx.c Wed May 10 05:09:31 2000 @@ -155,7 +155,7 @@ * measure the interrupt frequency */ bc->debug_vals.cur_intcnt++; - if ((cur_jiffies - bc->debug_vals.last_jiffies) >= HZ) { + if (time_after(cur_jiffies, bc->debug_vals.last_jiffies + HZ)) { bc->debug_vals.last_jiffies = cur_jiffies; bc->debug_vals.last_intcnt = bc->debug_vals.cur_intcnt; bc->debug_vals.cur_intcnt = 0; diff -urN pre7-8/drivers/net/hamradio/dmascc.c pre7-8.jw/drivers/net/hamradio/dmascc.c --- pre7-8/drivers/net/hamradio/dmascc.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/hamradio/dmascc.c Wed May 10 05:17:20 2000 @@ -99,24 +99,24 @@ /* Number of buffers per channel */ -#define NUM_TX_BUF 2 /* NUM_TX_BUF >= 1 (2 recommended) */ -#define NUM_RX_BUF 2 /* NUM_RX_BUF >= 1 (2 recommended) */ -#define BUF_SIZE 2016 +#define NUM_TX_BUF 2 /* NUM_TX_BUF >= 1 (2 recommended) */ +#define NUM_RX_BUF 2 /* NUM_RX_BUF >= 1 (2 recommended) */ +#define BUF_SIZE 2016 /* Cards supported */ -#define HW_PI { "Ottawa PI", 0x300, 0x20, 0x10, 8, \ - 0, 8, 1843200, 3686400 } -#define HW_PI2 { "Ottawa PI2", 0x300, 0x20, 0x10, 8, \ +#define HW_PI { "Ottawa PI", 0x300, 0x20, 0x10, 8, \ + 0, 8, 1843200, 3686400 } +#define HW_PI2 { "Ottawa PI2", 0x300, 0x20, 0x10, 8, \ 0, 8, 3686400, 7372800 } -#define HW_TWIN { "Gracilis PackeTwin", 0x200, 0x10, 0x10, 32, \ +#define HW_TWIN { "Gracilis PackeTwin", 0x200, 0x10, 0x10, 32, \ 0, 4, 6144000, 6144000 } -#define HARDWARE { HW_PI, HW_PI2, HW_TWIN } +#define HARDWARE { HW_PI, HW_PI2, HW_TWIN } -#define TYPE_PI 0 -#define TYPE_PI2 1 +#define TYPE_PI 0 +#define TYPE_PI2 1 #define TYPE_TWIN 2 #define NUM_TYPES 3 @@ -125,9 +125,9 @@ /* SCC chips supported */ -#define Z8530 0 -#define Z85C30 1 -#define Z85230 2 +#define Z8530 0 +#define Z85C30 1 +#define Z85230 2 #define CHIPNAMES { "Z8530", "Z85C30", "Z85230" } @@ -135,16 +135,16 @@ /* I/O registers */ /* 8530 registers relative to card base */ -#define SCCB_CMD 0x00 +#define SCCB_CMD 0x00 #define SCCB_DATA 0x01 -#define SCCA_CMD 0x02 +#define SCCA_CMD 0x02 #define SCCA_DATA 0x03 /* 8253/8254 registers relative to card base */ -#define TMR_CNT0 0x00 -#define TMR_CNT1 0x01 -#define TMR_CNT2 0x02 -#define TMR_CTRL 0x03 +#define TMR_CNT0 0x00 +#define TMR_CNT1 0x01 +#define TMR_CNT2 0x02 +#define TMR_CTRL 0x03 /* Additional PI/PI2 registers relative to card base */ #define PI_DREQ_MASK 0x04 @@ -175,7 +175,7 @@ #define TWIN_EXTCLKB 0x08 #define TWIN_LOOPA_ON 0x10 #define TWIN_LOOPB_ON 0x20 -#define TWIN_EI 0x80 +#define TWIN_EI 0x80 /* DMA_CFG */ #define TWIN_DMA_HDX_T1 0x08 @@ -420,7 +420,7 @@ udelay(2000000/TMR_0_HZ); /* Timing loop */ - while (jiffies - time < 13) { + while (time_before(jiffies, time + 13)) { for (i = 0; i < hw[h].num_devs; i++) if (base[i] && counting[i]) { /* Read back Timer 1: latch; read LSB; read MSB */ @@ -511,7 +511,9 @@ outb_p(1, tmr + TMR_CNT1); outb_p(0, tmr + TMR_CNT1); /* Wait and detect IRQ */ - time = jiffies; while (jiffies - time < 2 + HZ / TMR_0_HZ); + time = jiffies; + while (time_before(jiffies, time + 2 + HZ/TMR_0_HZ)) + /* nothing */; irq = probe_irq_off(irqs); /* Clear pending interrupt, disable interrupts */ @@ -963,7 +965,7 @@ } else if (rc & END_FR) { /* End of frame. Get byte count */ if (dev->dma) { - flags=claim_dma_lock(); + flags=claim_dma_lock(); disable_dma(dev->dma); clear_dma_ff(dev->dma); cb = BUF_SIZE - get_dma_residue(dev->dma) - 2; @@ -1127,9 +1129,9 @@ priv->tx_tail = (i + 1) % NUM_TX_BUF; priv->tx_count--; /* Check if another frame is available and we are allowed to transmit */ - if (priv->tx_count && (jiffies - priv->tx_start) < priv->param.txtime) { + if (priv->tx_count && time_before(jiffies, priv->tx_start + priv->param.txtime)) { if (dev->dma) { - flags=claim_dma_lock(); + flags=claim_dma_lock(); set_dma_addr(dev->dma, (int) priv->tx_buf[priv->tx_tail]); set_dma_count(dev->dma, priv->tx_len[priv->tx_tail]); enable_dma(dev->dma); diff -urN pre7-8/drivers/net/hamradio/mkiss.c pre7-8.jw/drivers/net/hamradio/mkiss.c --- pre7-8/drivers/net/hamradio/mkiss.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/hamradio/mkiss.c Wed May 10 05:09:57 2000 @@ -489,7 +489,7 @@ * May be we must check transmitter timeout here ? * 14 Oct 1994 Dmitry Gorodchanin. */ - if (jiffies - dev->trans_start < 20 * HZ) { + if (time_before(jiffies, dev->trans_start + 20*HZ)) { /* 20 sec timeout not reached */ return 1; } diff -urN pre7-8/drivers/net/hamradio/soundmodem/sm.c pre7-8.jw/drivers/net/hamradio/soundmodem/sm.c --- pre7-8/drivers/net/hamradio/soundmodem/sm.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/hamradio/soundmodem/sm.c Wed May 10 05:10:45 2000 @@ -241,7 +241,7 @@ return 0; timeout = jiffies + (HZ / 100); while (inb(MIDI_STATUS(iobase)) & MIDI_WRITE_EMPTY) - if ((signed)(jiffies - timeout) > 0) + if (time_after(jiffies, timeout)) return 0; save_flags(flags); cli(); @@ -251,7 +251,7 @@ if (!(b & MIDI_WRITE_EMPTY)) return 0; while (inb(MIDI_STATUS(iobase)) & MIDI_WRITE_EMPTY) - if ((signed)(jiffies - timeout) > 0) + if (time_after(jiffies, timeout)) return 0; return 1; } diff -urN pre7-8/drivers/net/hamradio/soundmodem/sm.h pre7-8.jw/drivers/net/hamradio/soundmodem/sm.h --- pre7-8/drivers/net/hamradio/soundmodem/sm.h Wed Aug 18 14:38:50 1999 +++ pre7-8.jw/drivers/net/hamradio/soundmodem/sm.h Wed May 10 05:11:49 2000 @@ -376,7 +376,7 @@ * measure the interrupt frequency */ sm->debug_vals.cur_intcnt++; - if ((cur_jiffies - sm->debug_vals.last_jiffies) >= HZ) { + if (time_after_eq(cur_jiffies, sm->debug_vals.last_jiffies + HZ)) { sm->debug_vals.last_jiffies = cur_jiffies; sm->debug_vals.last_intcnt = sm->debug_vals.cur_intcnt; sm->debug_vals.cur_intcnt = 0; diff -urN pre7-8/drivers/net/hamradio/soundmodem/sm_wss.c pre7-8.jw/drivers/net/hamradio/soundmodem/sm_wss.c --- pre7-8/drivers/net/hamradio/soundmodem/sm_wss.c Mon Mar 13 12:50:16 2000 +++ pre7-8.jw/drivers/net/hamradio/soundmodem/sm_wss.c Wed May 10 05:14:02 2000 @@ -190,9 +190,10 @@ */ sti(); time = jiffies + HZ/4; - while ((read_codec(dev, 0x0b) & 0x20) && ((signed)(jiffies - time) < 0)); + while ((read_codec(dev, 0x0b) & 0x20) && time_before(jiffies, time)) + /* nothing */; restore_flags(flags); - if ((signed)(jiffies - time) >= 0) { + if (time_after_eq(jiffies, time)) { printk(KERN_WARNING "%s: ad1848 auto calibration timed out (2)\n", sm_drvname); return -1; diff -urN pre7-8/drivers/net/hp100.c pre7-8.jw/drivers/net/hp100.c --- pre7-8/drivers/net/hp100.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/hp100.c Wed May 10 04:53:24 2000 @@ -1664,7 +1664,7 @@ printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name); #endif /* not waited long enough since last tx? */ - if ( jiffies - dev->trans_start < HZ ) return -EAGAIN; + if ( time_before(jiffies, dev->trans_start + 1*HZ )) return -EAGAIN; if ( lp->lan_type < 0 ) /* no LAN type detected yet? */ { @@ -1856,7 +1856,7 @@ printk( "hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i ); #endif /* not waited long enough since last failed tx try? */ - if ( jiffies - dev->trans_start < HZ ) + if ( time_before(jiffies, dev->trans_start + 1*HZ )) { #ifdef HP100_DEBUG printk("hp100: %s: trans_start timing problem\n", dev->name); diff -urN pre7-8/drivers/net/hydra.c pre7-8.jw/drivers/net/hydra.c --- pre7-8/drivers/net/hydra.c Sun Feb 13 14:21:42 2000 +++ pre7-8.jw/drivers/net/hydra.c Wed May 10 05:19:12 2000 @@ -441,8 +441,7 @@ if(dev->tbusy) { - int tickssofar = jiffies - dev->trans_start; - if(tickssofar < 20) + if(time_before(jiffies, dev->trans_start + 20)) return(1); WRITE_REG(NIC_CR, CR_STOP); printk("%s: transmit timed out, status %4.4x, resetting.\n", dev->name, 0); diff -urN pre7-8/drivers/net/ne.c pre7-8.jw/drivers/net/ne.c --- pre7-8/drivers/net/ne.c Wed May 10 01:58:12 2000 +++ pre7-8.jw/drivers/net/ne.c Wed May 10 04:20:49 2000 @@ -358,7 +358,7 @@ outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET); while ((inb_p(ioaddr + EN0_ISR) & ENISR_RESET) == 0) - if (jiffies - reset_start_time > 2*HZ/100) { + if (time_after(jiffies, reset_start_time + 2*HZ/100)) { if (bad_card) { printk(" (warning: no reset ack)"); break; @@ -586,7 +586,7 @@ /* This check _should_not_ be necessary, omit eventually. */ while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) - if (jiffies - reset_start_time > 2*HZ/100) { + if (time_after(jiffies, reset_start_time + 2*HZ/100)) { printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name); break; } @@ -791,7 +791,7 @@ #endif while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) - if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ + if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); ne_reset_8390(dev); NS8390_init(dev,1); diff -urN pre7-8/drivers/net/seeq8005.c pre7-8.jw/drivers/net/seeq8005.c --- pre7-8/drivers/net/seeq8005.c Mon Feb 28 10:16:54 2000 +++ pre7-8.jw/drivers/net/seeq8005.c Wed May 10 05:04:30 2000 @@ -681,7 +681,7 @@ /* drain FIFO */ tmp = jiffies; - while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && (jiffies - tmp < HZ)) + while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && time_before(jiffies, tmp + 1*HZ)) mb(); /* doit ! */ diff -urN pre7-8/drivers/net/shaper.c pre7-8.jw/drivers/net/shaper.c --- pre7-8/drivers/net/shaper.c Wed May 10 01:58:15 2000 +++ pre7-8.jw/drivers/net/shaper.c Wed May 10 05:44:21 2000 @@ -193,7 +193,7 @@ while(ptr && ptr!=(struct sk_buff *)&shaper->sendq) { if(ptr->pripri - && jiffies - SHAPERCB(ptr)->shapeclock < SHAPER_MAXSLIP) + && time_before(jiffies, SHAPERCB(ptr)->shapeclock + SHAPER_MAXSLIP)) { struct sk_buff *tmp=ptr->prev; @@ -244,9 +244,9 @@ tmp!=(struct sk_buff *)&shaper->sendq; tmp=tmp->next) SHAPERCB(skb)->shapeclock+=SHAPERCB(tmp)->shapelen; /* - * Queue over time. Spill packet. + * Queue over time. Spill packet. wrap unsafe */ - if(SHAPERCB(skb)->shapeclock-jiffies > SHAPER_LATENCY) { + if(SHAPERCB(skb)->shapeclock - jiffies > SHAPER_LATENCY) { dev_kfree_skb(skb); shaper->stats.tx_dropped++; } else diff -urN pre7-8/drivers/net/slip.c pre7-8.jw/drivers/net/slip.c --- pre7-8/drivers/net/slip.c Wed May 10 01:58:15 2000 +++ pre7-8.jw/drivers/net/slip.c Wed May 10 04:19:17 2000 @@ -481,7 +481,7 @@ * 14 Oct 1994 Dmitry Gorodchanin. */ #ifdef SL_CHECK_TRANSMIT - if (jiffies - dev->trans_start < 20 * HZ) { + if (time_before(jiffies, dev->trans_start + 20 * HZ)) { /* 20 sec timeout not reached */ goto out; } @@ -1409,7 +1409,7 @@ spin_unlock(&slc->ctrl.lock); } local_bh_enable(); - } while (busy && jiffies - start < 1*HZ); + } while (busy && time_before(jiffies, start + 1*HZ)); busy = 0; for (i = 0; i < slip_maxdev; i++) { diff -urN pre7-8/drivers/net/strip.c pre7-8.jw/drivers/net/strip.c --- pre7-8/drivers/net/strip.c Wed May 10 01:58:15 2000 +++ pre7-8.jw/drivers/net/strip.c Wed May 10 04:28:43 2000 @@ -1496,8 +1496,8 @@ { MetricomAddress haddr; unsigned char *ptr = strip_info->tx_buff; - int doreset = (long)jiffies - strip_info->watchdog_doreset >= 0; - int doprobe = (long)jiffies - strip_info->watchdog_doprobe >= 0 && !doreset; + int doreset = time_after_eq(jiffies, strip_info->watchdog_doreset); + int doprobe = time_after_eq(jiffies, strip_info->watchdog_doprobe) && !doreset; u32 addr, brd; /* @@ -1611,7 +1611,7 @@ * being sent, when in fact they are not, because they are all being dropped * in the strip_make_packet routine. */ - if (strip_info->working && (long)jiffies - strip_info->gratuitous_arp >= 0 && + if (strip_info->working && time_after_eq(jiffies, strip_info->gratuitous_arp) && memcmp(strip_info->dev.dev_addr, zero_address.c, sizeof(zero_address)) && arp_query(haddr.c, brd, &strip_info->dev)) { @@ -1657,7 +1657,7 @@ if (strip_info->mtu != strip_info->dev.mtu) strip_changedmtu(strip_info); - if (jiffies - strip_info->pps_timer > HZ) + if (time_after(jiffies, strip_info->pps_timer + 1*HZ)) { unsigned long t = jiffies - strip_info->pps_timer; unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t/2) / t; diff -urN pre7-8/drivers/net/tlan.c pre7-8.jw/drivers/net/tlan.c --- pre7-8/drivers/net/tlan.c Wed Mar 22 12:38:14 2000 +++ pre7-8.jw/drivers/net/tlan.c Wed May 10 04:45:36 2000 @@ -1489,7 +1489,6 @@ { struct net_device *dev = (struct net_device *) data; TLanPrivateInfo *priv = (TLanPrivateInfo *) dev->priv; - u32 elapsed; unsigned long flags = 0; priv->timer.function = NULL; @@ -1516,8 +1515,7 @@ case TLAN_TIMER_ACTIVITY: spin_lock_irqsave(&priv->lock, flags); if ( priv->timer.function == NULL ) { - elapsed = jiffies - priv->timerSetAt; - if ( elapsed >= TLAN_TIMER_ACT_DELAY ) { + if ( time_after_eq(jiffies, priv->timerSetAt + TLAN_TIMER_ACT_DELAY )) { TLan_DioWrite8( dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK ); } else { priv->timer.function = &TLan_Timer; diff -urN pre7-8/drivers/net/tokenring/lanstreamer.c pre7-8.jw/drivers/net/tokenring/lanstreamer.c --- pre7-8/drivers/net/tokenring/lanstreamer.c Tue Mar 21 17:43:39 2000 +++ pre7-8.jw/drivers/net/tokenring/lanstreamer.c Wed May 10 05:07:42 2000 @@ -348,7 +348,7 @@ while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) { current->state = TASK_INTERRUPTIBLE; schedule_timeout(HZ/10); - if (jiffies - t > 40 * HZ) { + if (time_after(jiffies, t + 40*HZ)) { printk(KERN_ERR "IBM PCI tokenring card not responding\n"); release_region(dev->base_addr, STREAMER_IO_SPACE); diff -urN pre7-8/drivers/net/wan/lmc/lmc_main.c pre7-8.jw/drivers/net/wan/lmc/lmc_main.c --- pre7-8/drivers/net/wan/lmc/lmc_main.c Wed May 10 01:58:15 2000 +++ pre7-8.jw/drivers/net/wan/lmc/lmc_main.c Wed May 10 05:03:04 2000 @@ -1662,7 +1662,7 @@ printk("%s: Xmitter busy|\n", dev->name); sc->stats.tx_tbusy_calls++ ; - if (jiffies - dev->trans_start < TX_TIMEOUT) { + if (time_before(jiffies, dev->trans_start + TX_TIMEOUT)) { ret = 1; goto lmc_start_xmit_bug_out; } @@ -2429,7 +2429,7 @@ printk("%s: Xmitter busy|\n", dev->name); sc->stats.tx_tbusy_calls++ ; - if (jiffies - dev->trans_start < TX_TIMEOUT) { + if (time_before(jiffies, dev->trans_start + TX_TIMEOUT)) { goto bug_out; } diff -urN pre7-8/drivers/net/wan/sdla_chdlc.c pre7-8.jw/drivers/net/wan/sdla_chdlc.c --- pre7-8/drivers/net/wan/sdla_chdlc.c Wed May 10 01:58:15 2000 +++ pre7-8.jw/drivers/net/wan/sdla_chdlc.c Wed May 10 05:02:11 2000 @@ -277,7 +277,7 @@ timeout = jiffies; while (mb->return_code != 'I') /* Wait 1s for board to initialize */ - if ((jiffies - timeout) > 1*HZ) break; + if (time_after(jiffies, timeout + 1*HZ)) break; if (mb->return_code != 'I') { printk(KERN_INFO @@ -464,7 +464,7 @@ for(;;) { if(chdlc_priv_area->update_comms_stats == 0) break; - if ((jiffies - timeout) > (1 * HZ)){ + if (time_after(jiffies, timeout + 1*HZ)) { chdlc_priv_area->update_comms_stats = 0; chdlc_priv_area->timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE; diff -urN pre7-8/drivers/net/wan/sdla_fr.c pre7-8.jw/drivers/net/wan/sdla_fr.c --- pre7-8/drivers/net/wan/sdla_fr.c Wed May 10 01:58:15 2000 +++ pre7-8.jw/drivers/net/wan/sdla_fr.c Wed May 10 04:54:46 2000 @@ -641,7 +641,7 @@ 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; } @@ -1975,7 +1975,7 @@ chan->state == WAN_CONNECTED) { num_remaining++; - if ((jiffies - chan->inarp_tick) > (chan->inarp_interval * HZ)) { + if (time_after(jiffies, chan->inarp_tick + (chan->inarp_interval*HZ)) { send_inarp_request(card,dev); chan->inarp_tick = jiffies; } diff -urN pre7-8/drivers/net/wan/sdla_ppp.c pre7-8.jw/drivers/net/wan/sdla_ppp.c --- pre7-8/drivers/net/wan/sdla_ppp.c Wed May 10 01:58:15 2000 +++ pre7-8.jw/drivers/net/wan/sdla_ppp.c Wed May 10 04:55:41 2000 @@ -404,7 +404,7 @@ if(ppp_priv_area->update_comms_stats == 0){ break; } - if ((jiffies - timeout) > (1 * HZ)){ + if (time_after(jiffies, timeout + 1*HZ)){ ppp_priv_area->update_comms_stats = 0; ppp_priv_area->timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE; @@ -2011,7 +2011,7 @@ struct net_device *dev = card->wandev.dev; if (dev && netif_running(dev) && - ((jiffies - card->state_tick) > HOLD_DOWN_TIME)) { + time_after(jiffies, card->state_tick + HOLD_DOWN_TIME)) { wanpipe_set_state(card, WAN_CONNECTING); diff -urN pre7-8/drivers/net/wan/sdla_x25.c pre7-8.jw/drivers/net/wan/sdla_x25.c --- pre7-8/drivers/net/wan/sdla_x25.c Wed May 10 01:58:15 2000 +++ pre7-8.jw/drivers/net/wan/sdla_x25.c Wed May 10 05:01:26 2000 @@ -706,7 +706,7 @@ if (dev->tbusy) { ++chan->ifstats.rx_dropped; - if ((jiffies - chan->tick_counter) < (5*HZ)) + if (time_before(jiffies, chan->tick_counter + 5*HZ)) { return dev->tbusy; } @@ -1155,7 +1155,7 @@ x25_set_intr_mode(card, 0x83); /* enable Rx interrupts */ status->imask &= ~0x2; /* mask Tx interupts */ } - else if ((jiffies - card->state_tick) > CONNECT_TIMEOUT) + else if (time_after(jiffies, card->state_tick + CONNECT_TIMEOUT)) disconnect(card); } @@ -1166,7 +1166,7 @@ */ static void poll_disconnected (sdla_t* card) { - if (card->open_cnt && ((jiffies - card->state_tick) > HOLD_DOWN_TIME)) + if (card->open_cnt && time_after(jiffies, card->state_tick + HOLD_DOWN_TIME)) connect(card); } @@ -1203,7 +1203,7 @@ if(( chan->svc )&&( chan->state == WAN_CONNECTED )) { - if( (jiffies - chan->i_timeout_sofar) / HZ > chan->idle_timeout ) + if( time_after(jiffies, chan->i_timeout_sofar + chan->idle_timeout*HZ )) { /* Close svc */ printk(KERN_INFO "%s: Closing down Idle link %s on LCN %d\n",card->devname,chan->name,chan->lcn); diff -urN pre7-8/fs/autofs/dirhash.c pre7-8.jw/fs/autofs/dirhash.c --- pre7-8/fs/autofs/dirhash.c Wed May 10 01:58:18 2000 +++ pre7-8.jw/fs/autofs/dirhash.c Wed May 10 02:46:47 2000 @@ -47,7 +47,7 @@ return NULL; /* No entries */ /* We keep the list sorted by last_usage and want old stuff */ ent = list_entry(dh->expiry_head.next, struct autofs_dir_ent, exp); - if (jiffies - ent->last_usage < timeout) + if (time_before(jiffies, ent->last_usage + timeout)) break; /* Move to end of list in case expiry isn't desirable */ autofs_update_usage(dh, ent); diff -urN pre7-8/fs/coda/upcall.c pre7-8.jw/fs/coda/upcall.c --- pre7-8/fs/coda/upcall.c Thu Feb 10 15:16:58 2000 +++ pre7-8.jw/fs/coda/upcall.c Wed May 10 02:48:44 2000 @@ -641,7 +641,7 @@ break; /* signal is present: after timeout always return really smart idea, probably useless ... */ - if ( jiffies - vmp->uc_posttime > coda_timeout * HZ ) + if ( time_after(jiffies, vmp->uc_posttime + coda_timeout * HZ )) break; } schedule(); diff -urN pre7-8/fs/ncpfs/dir.c pre7-8.jw/fs/ncpfs/dir.c --- pre7-8/fs/ncpfs/dir.c Wed Mar 8 12:04:09 2000 +++ pre7-8.jw/fs/ncpfs/dir.c Wed May 10 02:45:20 2000 @@ -455,7 +455,7 @@ goto init_cache; if (filp->f_pos == 2) { - if (jiffies - ctl.head.time >= NCP_MAX_AGE(server)) + if (time_after_eq(jiffies, ctl.head.time+NCP_MAX_AGE(server)) goto init_cache; mtime = ncp_obtain_mtime(dentry); diff -urN pre7-8/fs/nfsd/nfscache.c pre7-8.jw/fs/nfsd/nfscache.c --- pre7-8/fs/nfsd/nfscache.c Wed May 10 01:58:19 2000 +++ pre7-8.jw/fs/nfsd/nfscache.c Wed May 10 02:47:38 2000 @@ -235,7 +235,7 @@ lru_put_front(rp); /* Request being processed or excessive rexmits */ - if (rp->c_state == RC_INPROG || age < RC_DELAY) + if (rp->c_state == RC_INPROG || time_before(age, RC_DELAY)) return RC_DROPIT; /* From the hall of fame of impractical attacks: diff -urN pre7-8/fs/smbfs/dir.c pre7-8.jw/fs/smbfs/dir.c --- pre7-8/fs/smbfs/dir.c Wed Mar 8 12:04:09 2000 +++ pre7-8.jw/fs/smbfs/dir.c Wed May 10 02:43:26 2000 @@ -152,8 +152,7 @@ */ if (server->opt.protocol < SMB_PROTOCOL_LANMAN2) { - unsigned long age = jiffies - dir->u.smbfs_i.oldmtime; - if (age > 2*HZ) + if (time_after(jiffies,dir->u.smbfs_i.oldmtime + 2*HZ)) smb_invalid_dir_cache(dir); } @@ -193,7 +192,7 @@ * we believe in dentries for 5 seconds. (But each * successful server lookup renews the timestamp.) */ - valid = (age <= SMBFS_MAX_AGE); + valid = time_before_eq(age,SMBFS_MAX_AGE); #ifdef SMBFS_DEBUG_VERBOSE if (!valid) printk("smb_lookup_validate: %s/%s not valid, age=%lu\n", Binary files pre7-8/include/linux/.timer.h.swp and pre7-8.jw/include/linux/.timer.h.swp differ diff -urN pre7-8/include/linux/parport.h pre7-8.jw/include/linux/parport.h --- pre7-8/include/linux/parport.h Wed Apr 26 18:31:16 2000 +++ pre7-8.jw/include/linux/parport.h Wed May 10 02:53:44 2000 @@ -402,8 +402,7 @@ **/ extern __inline__ int parport_yield(struct pardevice *dev) { - unsigned long int timeslip = (jiffies - dev->time); - if ((dev->port->waithead == NULL) || (timeslip < dev->timeslice)) + if ((dev->port->waithead == NULL) || time_before(jiffies, dev->time + dev->timeslice)) return 0; parport_release(dev); return parport_claim(dev); @@ -420,8 +419,7 @@ **/ extern __inline__ int parport_yield_blocking(struct pardevice *dev) { - unsigned long int timeslip = (jiffies - dev->time); - if ((dev->port->waithead == NULL) || (timeslip < dev->timeslice)) + if ((dev->port->waithead == NULL) || time_before(jiffies, dev->time + dev->timeslice)) return 0; parport_release(dev); return parport_claim_or_block(dev); diff -urN pre7-8/kernel/timer.c pre7-8.jw/kernel/timer.c --- pre7-8/kernel/timer.c Wed May 10 01:58:23 2000 +++ pre7-8.jw/kernel/timer.c Wed May 10 02:51:40 2000 @@ -273,7 +273,7 @@ static inline void run_timer_list(void) { spin_lock_irq(&timerlist_lock); - while ((long)(jiffies - timer_jiffies) >= 0) { + while (time_after_eq(jiffies, timer_jiffies)) { struct list_head *head, *curr; if (!tv1.index) { int n = 1; diff -urN pre7-8/net/core/dev.c pre7-8.jw/net/core/dev.c --- pre7-8/net/core/dev.c Wed May 10 01:58:25 2000 +++ pre7-8.jw/net/core/dev.c Wed May 10 02:56:02 2000 @@ -1193,7 +1193,7 @@ kfree_skb(skb); } - if (bugdet-- < 0 || jiffies - start_time > 1) + if (bugdet-- < 0 || time_after(jiffies, start_time + 1)) goto softnet_break; } br_read_unlock(BR_NETPROTO_LOCK); @@ -2290,14 +2290,14 @@ now = jiffies; while (atomic_read(&dev->refcnt) != 1) { - if ((jiffies - now) > 1*HZ) { + if (time_after(jiffies, now + 1*HZ)) { /* Rebroadcast unregister notification */ notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); } current->state = TASK_INTERRUPTIBLE; schedule_timeout(HZ/4); current->state = TASK_RUNNING; - if ((jiffies - now) > 10*HZ) + if (time_after(jiffies, now + 10*HZ)) break; } diff -urN pre7-8/net/core/neighbour.c pre7-8.jw/net/core/neighbour.c --- pre7-8/net/core/neighbour.c Fri Apr 21 19:08:45 2000 +++ pre7-8.jw/net/core/neighbour.c Wed May 10 02:56:46 2000 @@ -136,7 +136,7 @@ if (atomic_read(&n->refcnt) == 1 && !(n->nud_state&NUD_PERMANENT) && (n->nud_state != NUD_INCOMPLETE || - jiffies - n->used > n->parms->retrans_time)) { + time_after(jiffies, n->used + n->parms->retrans_time))) { *np = n->next; n->dead = 1; shrunk = 1; diff -urN pre7-8/net/decnet/af_decnet.c pre7-8.jw/net/decnet/af_decnet.c --- pre7-8/net/decnet/af_decnet.c Mon Apr 24 16:43:04 2000 +++ pre7-8.jw/net/decnet/af_decnet.c Wed May 10 04:06:36 2000 @@ -513,7 +513,7 @@ return 0; dn_stop_fast_timer(sk); /* unlikely, but possible that this is runninng */ - if ((jiffies - scp->stamp) >= (HZ * decnet_time_wait)) { + if (time_after_eq(jiffies, scp->stamp + decnet_time_wait*HZ)) { dn_unhash_sock(sk); sock_put(sk); return 1; diff -urN pre7-8/net/decnet/dn_dev.c pre7-8.jw/net/decnet/dn_dev.c --- pre7-8/net/decnet/dn_dev.c Wed Feb 9 23:08:09 2000 +++ pre7-8.jw/net/decnet/dn_dev.c Wed May 10 04:07:04 2000 @@ -736,7 +736,7 @@ static int dn_am_i_a_router(struct dn_neigh *dn, struct dn_dev *dn_db) { /* First check time since device went up */ - if ((jiffies - dn_db->uptime) < DRDELAY) + if (time_before(jiffies, dn_db->uptime + DRDELAY)) return 0; /* If there is no router, then yes... */ diff -urN pre7-8/net/decnet/dn_nsp_out.c pre7-8.jw/net/decnet/dn_nsp_out.c --- pre7-8/net/decnet/dn_nsp_out.c Mon Mar 27 13:35:56 2000 +++ pre7-8.jw/net/decnet/dn_nsp_out.c Wed May 10 04:08:05 2000 @@ -321,7 +321,7 @@ * Slow start: If we have been idle for more than * one RTT, then reset window to min size. */ - if ((jiffies - scp->stamp) > t) + if (time_after(jiffies, scp->stamp + t)) scp->snd_window = NSP_MIN_WINDOW; /* printk(KERN_DEBUG "Window: %lu\n", scp->snd_window); */ diff -urN pre7-8/net/decnet/dn_route.c pre7-8.jw/net/decnet/dn_route.c --- pre7-8/net/decnet/dn_route.c Wed May 10 01:58:25 2000 +++ pre7-8.jw/net/decnet/dn_route.c Wed May 10 04:08:41 2000 @@ -152,7 +152,7 @@ } write_unlock(&dn_rt_hash_table[i].lock); - if ((jiffies - now) > 0) + if (time_after(jiffies, now)) break; } diff -urN pre7-8/net/decnet/dn_timer.c pre7-8.jw/net/decnet/dn_timer.c --- pre7-8/net/decnet/dn_timer.c Wed May 10 01:58:25 2000 +++ pre7-8.jw/net/decnet/dn_timer.c Wed May 10 04:09:16 2000 @@ -97,7 +97,7 @@ * since the last successful transmission. */ if (scp->keepalive && scp->keepalive_fxn && (scp->state == DN_RUN)) { - if ((jiffies - scp->stamp) >= scp->keepalive) + if (time_after_eq(jiffies, scp->stamp + scp->keepalive)) scp->keepalive_fxn(sk); } diff -urN pre7-8/net/econet/af_econet.c pre7-8.jw/net/econet/af_econet.c --- pre7-8/net/econet/af_econet.c Mon Apr 24 16:43:04 2000 +++ pre7-8.jw/net/econet/af_econet.c Wed May 10 04:12:18 2000 @@ -964,7 +964,7 @@ { struct sk_buff *newskb = skb->next; struct ec_cb *eb = (struct ec_cb *)&skb->cb; - if ((jiffies - eb->start) > eb->timeout) + if (time_after(jiffies, eb->start + eb->timeout)) { tx_result(skb->sk, eb->cookie, ECTYPE_TRANSMIT_NOT_PRESENT); diff -urN pre7-8/net/ipv4/arp.c pre7-8.jw/net/ipv4/arp.c --- pre7-8/net/ipv4/arp.c Wed Apr 26 15:13:17 2000 +++ pre7-8.jw/net/ipv4/arp.c Wed May 10 02:57:12 2000 @@ -771,7 +771,7 @@ agents are active. Taking the first reply prevents arp trashing and chooses the fastest router. */ - if (jiffies - n->updated >= n->parms->locktime) + if (time_after_eq(jiffies, n->updated + n->parms->locktime)) override = 1; /* Broadcast replies and request packets diff -urN pre7-8/net/ipv4/igmp.c pre7-8.jw/net/ipv4/igmp.c --- pre7-8/net/ipv4/igmp.c Sun Feb 27 00:33:30 2000 +++ pre7-8.jw/net/ipv4/igmp.c Wed May 10 03:08:22 2000 @@ -121,7 +121,7 @@ * contradict to specs provided this delay is small enough. */ -#define IGMP_V1_SEEN(in_dev) ((in_dev)->mr_v1_seen && (long)(jiffies - (in_dev)->mr_v1_seen) < 0) +#define IGMP_V1_SEEN(in_dev) ((in_dev)->mr_v1_seen && time_before(jiffies, (in_dev)->mr_v1_seen)) #endif @@ -166,7 +166,7 @@ spin_lock_bh(&im->lock); im->unsolicit_count = 0; if (del_timer(&im->timer)) { - if ((long)(im->timer.expires-jiffies) < max_delay) { + if (time_before(im->timer.expires - jiffies, max_delay)) { add_timer(&im->timer); im->tm_running=1; spin_unlock_bh(&im->lock); diff -urN pre7-8/net/ipv4/ip_gre.c pre7-8.jw/net/ipv4/ip_gre.c --- pre7-8/net/ipv4/ip_gre.c Wed May 10 01:58:25 2000 +++ pre7-8.jw/net/ipv4/ip_gre.c Wed May 10 03:09:59 2000 @@ -387,7 +387,7 @@ if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) goto out; - if (jiffies - t->err_time < IPTUNNEL_ERR_TIMEO) + if (time_before(jiffies, t->err_time + IPTUNNEL_ERR_TIMEO)) t->err_count++; else t->err_count = 1; @@ -741,7 +741,7 @@ #endif if (tunnel->err_count > 0) { - if (jiffies - tunnel->err_time < IPTUNNEL_ERR_TIMEO) { + if (time_before(jiffies, tunnel->err_time + IPTUNNEL_ERR_TIMEO)) { tunnel->err_count--; dst_link_failure(skb); diff -urN pre7-8/net/ipv4/ipconfig.c.orig pre7-8.jw/net/ipv4/ipconfig.c.orig --- pre7-8/net/ipv4/ipconfig.c.orig Wed May 10 03:58:43 2000 +++ pre7-8.jw/net/ipv4/ipconfig.c.orig Wed Dec 31 19:00:00 1969 @@ -1,999 +0,0 @@ -/* - * $Id: ipconfig.c,v 1.31 2000/05/03 06:37:06 davem Exp $ - * - * Automatic Configuration of IP -- use BOOTP or RARP or user-supplied - * information to configure own IP address and routes. - * - * Copyright (C) 1996--1998 Martin Mares - * - * Derived from network configuration code in fs/nfs/nfsroot.c, - * originally Copyright (C) 1995, 1996 Gero Kuhlmann and me. - * - * BOOTP rewritten to construct and analyse packets itself instead - * of misusing the IP layer. num_bugs_causing_wrong_arp_replies--; - * -- MJ, December 1998 - * - * Fixed ip_auto_config_setup calling at startup in the new "Linker Magic" - * initialization scheme. - * - Arnaldo Carvalho de Melo , 08/11/1999 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/* Define this to allow debugging output */ -#undef IPCONFIG_DEBUG - -#ifdef IPCONFIG_DEBUG -#define DBG(x) printk x -#else -#define DBG(x) do { } while(0) -#endif - -/* Define the timeout for waiting for a RARP/BOOTP reply */ -#define CONF_BASE_TIMEOUT (HZ*5) /* Initial timeout: 5 seconds */ -#define CONF_RETRIES 10 /* 10 retries */ -#define CONF_TIMEOUT_RANDOM (HZ) /* Maximum amount of randomization */ -#define CONF_TIMEOUT_MULT *5/4 /* Rate of timeout growth */ -#define CONF_TIMEOUT_MAX (HZ*30) /* Maximum allowed timeout */ - -/* IP configuration */ -static char user_dev_name[IFNAMSIZ] __initdata = { 0, };/* Name of user-selected boot device */ -u32 ic_myaddr __initdata = INADDR_NONE; /* My IP address */ -u32 ic_servaddr __initdata = INADDR_NONE; /* Server IP address */ -u32 ic_gateway __initdata = INADDR_NONE; /* Gateway IP address */ -u32 ic_netmask __initdata = INADDR_NONE; /* Netmask for local subnet */ -int ic_enable __initdata = 1; /* Automatic IP configuration enabled */ -int ic_host_name_set __initdata = 0; /* Host name configured manually */ -int ic_set_manually __initdata = 0; /* IPconfig parameters set manually */ - -u32 root_server_addr __initdata = INADDR_NONE; /* Address of boot server */ -u8 root_server_path[256] __initdata = { 0, }; /* Path to mount as root */ - -#if defined(CONFIG_IP_PNP_BOOTP) || defined(CONFIG_IP_PNP_RARP) - -#define CONFIG_IP_PNP_DYNAMIC - -int ic_proto_enabled __initdata = 0 /* Protocols enabled */ -#ifdef CONFIG_IP_PNP_BOOTP - | IC_BOOTP -#endif -#ifdef CONFIG_IP_PNP_RARP - | IC_RARP -#endif - ; -static int ic_got_reply __initdata = 0; /* Protocol(s) we got reply from */ - -#else - -static int ic_proto_enabled __initdata = 0; - -#endif - -static int ic_proto_have_if __initdata = 0; - -/* - * Network devices - */ - -struct ic_device { - struct ic_device *next; - struct net_device *dev; - unsigned short flags; - int able; -}; - -static struct ic_device *ic_first_dev __initdata = NULL;/* List of open device */ -static struct net_device *ic_dev __initdata = NULL; /* Selected device */ - -static int __init ic_open_devs(void) -{ - struct ic_device *d, **last; - struct net_device *dev; - unsigned short oflags; - - last = &ic_first_dev; - rtnl_shlock(); - for (dev = dev_base; dev; dev = dev->next) { - if (user_dev_name[0] ? !strcmp(dev->name, user_dev_name) : - (!(dev->flags & IFF_LOOPBACK) && - (dev->flags & (IFF_POINTOPOINT|IFF_BROADCAST)) && - strncmp(dev->name, "dummy", 5))) { - int able = 0; - if (dev->mtu >= 364) - able |= IC_BOOTP; - else - printk(KERN_WARNING "BOOTP: Ignoring device %s, MTU %d too small", dev->name, dev->mtu); - if (!(dev->flags & IFF_NOARP)) - able |= IC_RARP; - able &= ic_proto_enabled; - if (ic_proto_enabled && !able) - continue; - oflags = dev->flags; - if (dev_change_flags(dev, oflags | IFF_UP) < 0) { - printk(KERN_ERR "IP-Config: Failed to open %s\n", dev->name); - continue; - } - if (!(d = kmalloc(sizeof(struct ic_device), GFP_KERNEL))) - return -1; - d->dev = dev; - *last = d; - last = &d->next; - d->flags = oflags; - d->able = able; - ic_proto_have_if |= able; - DBG(("IP-Config: Opened %s (able=%d)\n", dev->name, able)); - } - } - rtnl_shunlock(); - - *last = NULL; - - if (!ic_first_dev) { - if (user_dev_name[0]) - printk(KERN_ERR "IP-Config: Device `%s' not found.\n", user_dev_name); - else - printk(KERN_ERR "IP-Config: No network devices available.\n"); - return -1; - } - return 0; -} - -static void __init ic_close_devs(void) -{ - struct ic_device *d, *next; - struct net_device *dev; - - next = ic_first_dev; - while ((d = next)) { - next = d->next; - dev = d->dev; - if (dev != ic_dev) { - DBG(("IP-Config: Downing %s\n", dev->name)); - dev_change_flags(dev, d->flags); - } - kfree_s(d, sizeof(struct ic_device)); - } -} - -/* - * Interface to various network functions. - */ - -static inline void -set_sockaddr(struct sockaddr_in *sin, u32 addr, u16 port) -{ - sin->sin_family = AF_INET; - sin->sin_addr.s_addr = addr; - sin->sin_port = port; -} - -static int __init ic_dev_ioctl(unsigned int cmd, struct ifreq *arg) -{ - int res; - - mm_segment_t oldfs = get_fs(); - set_fs(get_ds()); - res = devinet_ioctl(cmd, arg); - set_fs(oldfs); - return res; -} - -static int __init ic_route_ioctl(unsigned int cmd, struct rtentry *arg) -{ - int res; - - mm_segment_t oldfs = get_fs(); - set_fs(get_ds()); - res = ip_rt_ioctl(cmd, arg); - set_fs(oldfs); - return res; -} - -/* - * Set up interface addresses and routes. - */ - -static int __init ic_setup_if(void) -{ - struct ifreq ir; - struct sockaddr_in *sin = (void *) &ir.ifr_ifru.ifru_addr; - int err; - - memset(&ir, 0, sizeof(ir)); - strcpy(ir.ifr_ifrn.ifrn_name, ic_dev->name); - set_sockaddr(sin, ic_myaddr, 0); - if ((err = ic_dev_ioctl(SIOCSIFADDR, &ir)) < 0) { - printk(KERN_ERR "IP-Config: Unable to set interface address (%d).\n", err); - return -1; - } - set_sockaddr(sin, ic_netmask, 0); - if ((err = ic_dev_ioctl(SIOCSIFNETMASK, &ir)) < 0) { - printk(KERN_ERR "IP-Config: Unable to set interface netmask (%d).\n", err); - return -1; - } - set_sockaddr(sin, ic_myaddr | ~ic_netmask, 0); - if ((err = ic_dev_ioctl(SIOCSIFBRDADDR, &ir)) < 0) { - printk(KERN_ERR "IP-Config: Unable to set interface broadcast address (%d).\n", err); - return -1; - } - return 0; -} - -static int __init ic_setup_routes(void) -{ - /* No need to setup device routes, only the default route... */ - - if (ic_gateway != INADDR_NONE) { - struct rtentry rm; - int err; - - memset(&rm, 0, sizeof(rm)); - if ((ic_gateway ^ ic_myaddr) & ic_netmask) { - printk(KERN_ERR "IP-Config: Gateway not on directly connected network.\n"); - return -1; - } - set_sockaddr((struct sockaddr_in *) &rm.rt_dst, 0, 0); - set_sockaddr((struct sockaddr_in *) &rm.rt_genmask, 0, 0); - set_sockaddr((struct sockaddr_in *) &rm.rt_gateway, ic_gateway, 0); - rm.rt_flags = RTF_UP | RTF_GATEWAY; - if ((err = ic_route_ioctl(SIOCADDRT, &rm)) < 0) { - printk(KERN_ERR "IP-Config: Cannot add default route (%d).\n", err); - return -1; - } - } - - return 0; -} - -/* - * Fill in default values for all missing parameters. - */ - -static int __init ic_defaults(void) -{ - /* - * At this point we have no userspace running so need not - * claim locks on system_utsname - */ - - if (!ic_host_name_set) - strcpy(system_utsname.nodename, in_ntoa(ic_myaddr)); - - if (root_server_addr == INADDR_NONE) - root_server_addr = ic_servaddr; - - if (ic_netmask == INADDR_NONE) { - if (IN_CLASSA(ntohl(ic_myaddr))) - ic_netmask = htonl(IN_CLASSA_NET); - else if (IN_CLASSB(ntohl(ic_myaddr))) - ic_netmask = htonl(IN_CLASSB_NET); - else if (IN_CLASSC(ntohl(ic_myaddr))) - ic_netmask = htonl(IN_CLASSC_NET); - else { - printk(KERN_ERR "IP-Config: Unable to guess netmask for address %u.%u.%u.%u\n", - NIPQUAD(ic_myaddr)); - return -1; - } - printk("IP-Config: Guessing netmask %u.%u.%u.%u\n", NIPQUAD(ic_netmask)); - } - - return 0; -} - -/* - * RARP support. - */ - -#ifdef CONFIG_IP_PNP_RARP - -static int ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt); - -static struct packet_type rarp_packet_type __initdata = { - __constant_htons(ETH_P_RARP), - NULL, /* Listen to all devices */ - ic_rarp_recv, - NULL, - NULL -}; - -static inline void ic_rarp_init(void) -{ - dev_add_pack(&rarp_packet_type); -} - -static inline void ic_rarp_cleanup(void) -{ - dev_remove_pack(&rarp_packet_type); -} - -/* - * Process received RARP packet. - */ -static int __init -ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) -{ - struct arphdr *rarp = (struct arphdr *)skb->h.raw; - unsigned char *rarp_ptr = (unsigned char *) (rarp + 1); - unsigned long sip, tip; - unsigned char *sha, *tha; /* s for "source", t for "target" */ - - /* If we already have a reply, just drop the packet */ - if (ic_got_reply) - goto drop; - - /* If this test doesn't pass, it's not IP, or we should ignore it anyway */ - if (rarp->ar_hln != dev->addr_len || dev->type != ntohs(rarp->ar_hrd)) - goto drop; - - /* If it's not a RARP reply, delete it. */ - if (rarp->ar_op != htons(ARPOP_RREPLY)) - goto drop; - - /* If it's not Ethernet, delete it. */ - if (rarp->ar_pro != htons(ETH_P_IP)) - goto drop; - - /* Extract variable-width fields */ - sha = rarp_ptr; - rarp_ptr += dev->addr_len; - memcpy(&sip, rarp_ptr, 4); - rarp_ptr += 4; - tha = rarp_ptr; - rarp_ptr += dev->addr_len; - memcpy(&tip, rarp_ptr, 4); - - /* Discard packets which are not meant for us. */ - if (memcmp(tha, dev->dev_addr, dev->addr_len)) - goto drop; - - /* Discard packets which are not from specified server. */ - if (ic_servaddr != INADDR_NONE && ic_servaddr != sip) - goto drop; - - /* Victory! The packet is what we were looking for! */ - if (!ic_got_reply) { - ic_got_reply = IC_RARP; - ic_dev = dev; - if (ic_myaddr == INADDR_NONE) - ic_myaddr = tip; - ic_servaddr = sip; - } - - /* And throw the packet out... */ -drop: - kfree_skb(skb); - return 0; -} - - -/* - * Send RARP request packet over all devices which allow RARP. - */ -static void __init ic_rarp_send(void) -{ - struct ic_device *d; - - for (d=ic_first_dev; d; d=d->next) - if (d->able & IC_RARP) { - struct net_device *dev = d->dev; - arp_send(ARPOP_RREQUEST, ETH_P_RARP, 0, dev, 0, NULL, - dev->dev_addr, dev->dev_addr); - } -} - -#endif - -/* - * BOOTP support. - */ - -#ifdef CONFIG_IP_PNP_BOOTP - -struct bootp_pkt { /* BOOTP packet format */ - struct iphdr iph; /* IP header */ - struct udphdr udph; /* UDP header */ - u8 op; /* 1=request, 2=reply */ - u8 htype; /* HW address type */ - u8 hlen; /* HW address length */ - u8 hops; /* Used only by gateways */ - u32 xid; /* Transaction ID */ - u16 secs; /* Seconds since we started */ - u16 flags; /* Just what it says */ - u32 client_ip; /* Client's IP address if known */ - u32 your_ip; /* Assigned IP address */ - u32 server_ip; /* Server's IP address */ - u32 relay_ip; /* IP address of BOOTP relay */ - u8 hw_addr[16]; /* Client's HW address */ - u8 serv_name[64]; /* Server host name */ - u8 boot_file[128]; /* Name of boot file */ - u8 vendor_area[128]; /* Area for extensions */ -}; - -#define BOOTP_REQUEST 1 -#define BOOTP_REPLY 2 - -static u32 ic_bootp_xid; - -static int ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt); - -static struct packet_type bootp_packet_type __initdata = { - __constant_htons(ETH_P_IP), - NULL, /* Listen to all devices */ - ic_bootp_recv, - NULL, - NULL -}; - - -/* - * Initialize BOOTP extension fields in the request. - */ -static void __init ic_bootp_init_ext(u8 *e) -{ - *e++ = 99; /* RFC1048 Magic Cookie */ - *e++ = 130; - *e++ = 83; - *e++ = 99; - *e++ = 1; /* Subnet mask request */ - *e++ = 4; - e += 4; - *e++ = 3; /* Default gateway request */ - *e++ = 4; - e += 4; - *e++ = 12; /* Host name request */ - *e++ = 32; - e += 32; - *e++ = 40; /* NIS Domain name request */ - *e++ = 32; - e += 32; - *e++ = 17; /* Boot path */ - *e++ = 32; - e += 32; - *e = 255; /* End of the list */ -} - - -/* - * Initialize the BOOTP mechanism. - */ -static inline void ic_bootp_init(void) -{ - get_random_bytes(&ic_bootp_xid, sizeof(u32)); - DBG(("BOOTP: XID=%08x\n", ic_bootp_xid)); - dev_add_pack(&bootp_packet_type); -} - - -/* - * BOOTP cleanup. - */ -static inline void ic_bootp_cleanup(void) -{ - dev_remove_pack(&bootp_packet_type); -} - - -/* - * Send BOOTP request to single interface. - */ -static void __init ic_bootp_send_if(struct ic_device *d, u32 jiffies) -{ - struct net_device *dev = d->dev; - struct sk_buff *skb; - struct bootp_pkt *b; - int hh_len = (dev->hard_header_len + 15) & ~15; - struct iphdr *h; - - /* Allocate packet */ - skb = alloc_skb(sizeof(struct bootp_pkt) + hh_len + 15, GFP_KERNEL); - if (!skb) - return; - skb_reserve(skb, hh_len); - b = (struct bootp_pkt *) skb_put(skb, sizeof(struct bootp_pkt)); - memset(b, 0, sizeof(struct bootp_pkt)); - - /* Construct IP header */ - skb->nh.iph = h = &b->iph; - h->version = 4; - h->ihl = 5; - h->tot_len = htons(sizeof(struct bootp_pkt)); - h->frag_off = htons(IP_DF); - h->ttl = 64; - h->protocol = IPPROTO_UDP; - h->daddr = INADDR_BROADCAST; - h->check = ip_fast_csum((unsigned char *) h, h->ihl); - - /* Construct UDP header */ - b->udph.source = htons(68); - b->udph.dest = htons(67); - b->udph.len = htons(sizeof(struct bootp_pkt) - sizeof(struct iphdr)); - /* UDP checksum not calculated -- explicitly allowed in BOOTP RFC */ - - /* Construct BOOTP header */ - b->op = BOOTP_REQUEST; - if (dev->type < 256) /* check for false types */ - b->htype = dev->type; - else if (dev->type == ARPHRD_IEEE802_TR) /* fix for token ring */ - b->htype = ARPHRD_IEEE802; - else { - printk("Unknown ARP type 0x%04x for device %s\n", dev->type, dev->name); - b->htype = dev->type; /* can cause undefined behavior */ - } - b->hlen = dev->addr_len; - memcpy(b->hw_addr, dev->dev_addr, dev->addr_len); - b->secs = htons(jiffies / HZ); - b->xid = ic_bootp_xid; - ic_bootp_init_ext(b->vendor_area); - - /* Chain packet down the line... */ - skb->dev = dev; - skb->protocol = __constant_htons(ETH_P_IP); - if ((dev->hard_header && - dev->hard_header(skb, dev, ntohs(skb->protocol), dev->broadcast, dev->dev_addr, skb->len) < 0) || - dev_queue_xmit(skb) < 0) - printk("E"); -} - - -/* - * Send BOOTP requests to all interfaces. - */ -static void __init ic_bootp_send(u32 jiffies) -{ - struct ic_device *d; - - for(d=ic_first_dev; d; d=d->next) - if (d->able & IC_BOOTP) - ic_bootp_send_if(d, jiffies); -} - - -/* - * Copy BOOTP-supplied string if not already set. - */ -static int __init ic_bootp_string(char *dest, char *src, int len, int max) -{ - if (!len) - return 0; - if (len > max-1) - len = max-1; - strncpy(dest, src, len); - dest[len] = '\0'; - return 1; -} - - -/* - * Process BOOTP extension. - */ -static void __init ic_do_bootp_ext(u8 *ext) -{ -#ifdef IPCONFIG_DEBUG - u8 *c; - - printk("BOOTP: Got extension %02x",*ext); - for(c=ext+2; cnh.iph; - struct iphdr *h = &b->iph; - int len; - - /* If we already have a reply, just drop the packet */ - if (ic_got_reply) - goto drop; - - /* Check whether it's a BOOTP packet */ - if (skb->pkt_type == PACKET_OTHERHOST || - skb->len < sizeof(struct udphdr) + sizeof(struct iphdr) || - h->ihl != 5 || - h->version != 4 || - ip_fast_csum((char *) h, h->ihl) != 0 || - skb->len < ntohs(h->tot_len) || - h->protocol != IPPROTO_UDP || - b->udph.source != htons(67) || - b->udph.dest != htons(68) || - ntohs(h->tot_len) < ntohs(b->udph.len) + sizeof(struct iphdr)) - goto drop; - - /* Fragments are not supported */ - if (h->frag_off & htons(IP_OFFSET|IP_MF)) { - printk(KERN_ERR "BOOTP: Ignoring fragmented reply.\n"); - goto drop; - } - - /* Is it a reply to our BOOTP request? */ - len = ntohs(b->udph.len) - sizeof(struct udphdr); - if (len < 300 || /* See RFC 951:2.1 */ - b->op != BOOTP_REPLY || - b->xid != ic_bootp_xid) { - printk("?"); - goto drop; - } - - /* Extract basic fields */ - ic_myaddr = b->your_ip; - ic_servaddr = b->server_ip; - ic_got_reply = IC_BOOTP; - ic_dev = dev; - - /* Parse extensions */ - if (b->vendor_area[0] == 99 && /* Check magic cookie */ - b->vendor_area[1] == 130 && - b->vendor_area[2] == 83 && - b->vendor_area[3] == 99) { - u8 *ext = &b->vendor_area[4]; - u8 *end = (u8 *) b + ntohs(b->iph.tot_len); - while (ext < end && *ext != 0xff) { - if (*ext == 0) /* Padding */ - ext++; - else { - u8 *opt = ext; - ext += ext[1] + 2; - if (ext <= end) - ic_do_bootp_ext(opt); - } - } - } - - if (ic_gateway == INADDR_NONE && b->relay_ip) - ic_gateway = b->relay_ip; - -drop: - kfree_skb(skb); - return 0; -} - - -#endif - - -/* - * Dynamic IP configuration -- BOOTP and RARP. - */ - -#ifdef CONFIG_IP_PNP_DYNAMIC - -static int __init ic_dynamic(void) -{ - int retries; - unsigned long timeout, jiff; - unsigned long start_jiffies; - int do_rarp = ic_proto_have_if & IC_RARP; - int do_bootp = ic_proto_have_if & IC_BOOTP; - - /* - * If neither BOOTP nor RARP was selected, return with an error. This - * routine gets only called when some pieces of information are mis- - * sing, and without BOOTP and RARP we are not able to get that in- - * formation. - */ - if (!ic_proto_enabled) { - printk(KERN_ERR "IP-Config: Incomplete network configuration information.\n"); - return -1; - } - -#ifdef CONFIG_IP_PNP_BOOTP - if ((ic_proto_enabled ^ ic_proto_have_if) & IC_BOOTP) - printk(KERN_ERR "BOOTP: No suitable device found.\n"); -#endif - -#ifdef CONFIG_IP_PNP_RARP - if ((ic_proto_enabled ^ ic_proto_have_if) & IC_RARP) - printk(KERN_ERR "RARP: No suitable device found.\n"); -#endif - - if (!ic_proto_have_if) - /* Error message already printed */ - return -1; - - /* - * Setup RARP and BOOTP protocols - */ -#ifdef CONFIG_IP_PNP_RARP - if (do_rarp) - ic_rarp_init(); -#endif -#ifdef CONFIG_IP_PNP_BOOTP - if (do_bootp) - ic_bootp_init(); -#endif - - /* - * Send requests and wait, until we get an answer. This loop - * seems to be a terrible waste of CPU time, but actually there is - * only one process running at all, so we don't need to use any - * scheduler functions. - * [Actually we could now, but the nothing else running note still - * applies.. - AC] - */ - printk(KERN_NOTICE "Sending %s%s%s requests...", - do_bootp ? "BOOTP" : "", - do_bootp && do_rarp ? " and " : "", - do_rarp ? "RARP" : ""); - start_jiffies = jiffies; - retries = CONF_RETRIES; - get_random_bytes(&timeout, sizeof(timeout)); - timeout = CONF_BASE_TIMEOUT + (timeout % (unsigned) CONF_TIMEOUT_RANDOM); - for(;;) { -#ifdef CONFIG_IP_PNP_BOOTP - if (do_bootp) - ic_bootp_send(jiffies - start_jiffies); -#endif -#ifdef CONFIG_IP_PNP_RARP - if (do_rarp) - ic_rarp_send(); -#endif - printk("."); - jiff = jiffies + timeout; - while (jiffies < jiff && !ic_got_reply) - ; - if (ic_got_reply) { - printk(" OK\n"); - break; - } - if (! --retries) { - printk(" timed out!\n"); - break; - } - timeout = timeout CONF_TIMEOUT_MULT; - if (timeout > CONF_TIMEOUT_MAX) - timeout = CONF_TIMEOUT_MAX; - } - -#ifdef CONFIG_IP_PNP_RARP - if (do_rarp) - ic_rarp_cleanup(); -#endif -#ifdef CONFIG_IP_PNP_BOOTP - if (do_bootp) - ic_bootp_cleanup(); -#endif - - if (!ic_got_reply) - return -1; - - printk("IP-Config: Got %s answer from %u.%u.%u.%u, ", - (ic_got_reply & IC_BOOTP) ? "BOOTP" : "RARP", - NIPQUAD(ic_servaddr)); - printk("my address is %u.%u.%u.%u\n", NIPQUAD(ic_myaddr)); - - return 0; -} - -#endif - -/* - * IP Autoconfig dispatcher. - */ - -static int __init ip_auto_config(void) -{ - if (!ic_enable) - return 0; - - DBG(("IP-Config: Entered.\n")); - - /* Setup all network devices */ - if (ic_open_devs() < 0) - return -1; - - /* - * If the config information is insufficient (e.g., our IP address or - * IP address of the boot server is missing or we have multiple network - * interfaces and no default was set), use BOOTP or RARP to get the - * missing values. - */ - if (ic_myaddr == INADDR_NONE || -#ifdef CONFIG_ROOT_NFS - (root_server_addr == INADDR_NONE && ic_servaddr == INADDR_NONE) || -#endif - ic_first_dev->next) { -#ifdef CONFIG_IP_PNP_DYNAMIC - if (ic_dynamic() < 0) { - printk(KERN_ERR "IP-Config: Auto-configuration of network failed.\n"); - ic_close_devs(); - return -1; - } -#else - printk(KERN_ERR "IP-Config: Incomplete network configuration information.\n"); - ic_close_devs(); - return -1; -#endif - } else { - ic_dev = ic_first_dev->dev; /* Device selected manually or only one device -> use it */ - } - - /* - * Use defaults whereever applicable. - */ - if (ic_defaults() < 0) - return -1; - - /* - * Close all network devices except the device we've - * autoconfigured and set up routes. - */ - ic_close_devs(); - if (ic_setup_if() < 0 || ic_setup_routes() < 0) - return -1; - - DBG(("IP-Config: device=%s, local=%08x, server=%08x, boot=%08x, gw=%08x, mask=%08x\n", - ic_dev->name, ic_myaddr, ic_servaddr, root_server_addr, ic_gateway, ic_netmask)); - DBG(("IP-Config: host=%s, domain=%s, path=`%s'\n", system_utsname.nodename, - system_utsname.domainname, root_server_path)); - return 0; -} - -module_init(ip_auto_config); - - -/* - * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel - * command line parameter. It consists of option fields separated by colons in - * the following order: - * - * :::::: - * - * Any of the fields can be empty which means to use a default value: - * - address given by BOOTP or RARP - * - address of host returning BOOTP or RARP packet - * - none, or the address returned by BOOTP - * - automatically determined from , or the - * one returned by BOOTP - * - in ASCII notation, or the name returned - * by BOOTP - * - use all available devices - * - use both protocols to determine my own address - */ -static int __init ic_proto_name(char *name) -{ - if (!strcmp(name, "off")) { - ic_proto_enabled = 0; - return 1; - } -#ifdef CONFIG_IP_PNP_BOOTP - else if (!strcmp(name, "bootp")) { - ic_proto_enabled &= ~IC_RARP; - return 1; - } -#endif -#ifdef CONFIG_IP_PNP_RARP - else if (!strcmp(name, "rarp")) { - ic_proto_enabled &= ~IC_BOOTP; - return 1; - } -#endif -#ifdef CONFIG_IP_PNP_DYNAMIC - else if (!strcmp(name, "both")) { - return 1; - } -#endif - return 0; -} - -static int __init ip_auto_config_setup(char *addrs) -{ - char *cp, *ip, *dp; - int num = 0; - - ic_set_manually = 1; - if (!strcmp(addrs, "off")) { - ic_enable = 0; - return 1; - } - if (ic_proto_name(addrs)) - return 1; - - /* Parse the whole string */ - ip = addrs; - while (ip && *ip) { - if ((cp = strchr(ip, ':'))) - *cp++ = '\0'; - if (strlen(ip) > 0) { - DBG(("IP-Config: Parameter #%d: `%s'\n", num, ip)); - switch (num) { - case 0: - if ((ic_myaddr = in_aton(ip)) == INADDR_ANY) - ic_myaddr = INADDR_NONE; - break; - case 1: - if ((ic_servaddr = in_aton(ip)) == INADDR_ANY) - ic_servaddr = INADDR_NONE; - break; - case 2: - if ((ic_gateway = in_aton(ip)) == INADDR_ANY) - ic_gateway = INADDR_NONE; - break; - case 3: - if ((ic_netmask = in_aton(ip)) == INADDR_ANY) - ic_netmask = INADDR_NONE; - break; - case 4: - if ((dp = strchr(ip, '.'))) { - *dp++ = '\0'; - strncpy(system_utsname.domainname, dp, __NEW_UTS_LEN); - system_utsname.domainname[__NEW_UTS_LEN] = '\0'; - } - strncpy(system_utsname.nodename, ip, __NEW_UTS_LEN); - system_utsname.nodename[__NEW_UTS_LEN] = '\0'; - ic_host_name_set = 1; - break; - case 5: - strncpy(user_dev_name, ip, IFNAMSIZ); - user_dev_name[IFNAMSIZ-1] = '\0'; - break; - case 6: - ic_proto_name(ip); - break; - } - } - ip = cp; - num++; - } - - return 1; -} - -static int __init nfsaddrs_config_setup(char *addrs) -{ - return ip_auto_config_setup(addrs); -} - -__setup("ip=", ip_auto_config_setup); -__setup("nfsaddrs=", nfsaddrs_config_setup); diff -urN pre7-8/net/ipv4/ipip.c pre7-8.jw/net/ipv4/ipip.c --- pre7-8/net/ipv4/ipip.c Wed May 10 01:58:25 2000 +++ pre7-8.jw/net/ipv4/ipip.c Wed May 10 03:09:20 2000 @@ -337,7 +337,7 @@ if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) goto out; - if (jiffies - t->err_time < IPTUNNEL_ERR_TIMEO) + if (time_before(jiffies, t->err_time + IPTUNNEL_ERR_TIMEO)) t->err_count++; else t->err_count = 1; @@ -570,7 +570,7 @@ } if (tunnel->err_count > 0) { - if (jiffies - tunnel->err_time < IPTUNNEL_ERR_TIMEO) { + if (time_before(jiffies, tunnel->err_time + IPTUNNEL_ERR_TIMEO)) { tunnel->err_count--; dst_link_failure(skb); } else diff -urN pre7-8/net/ipv4/ipmr.c pre7-8.jw/net/ipv4/ipmr.c --- pre7-8/net/ipv4/ipmr.c Wed May 10 01:58:25 2000 +++ pre7-8.jw/net/ipv4/ipmr.c Wed May 10 03:10:39 2000 @@ -1265,7 +1265,7 @@ large chunk of pimd to kernel. Ough... --ANK */ (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) && - jiffies - cache->mfc_un.res.last_assert > MFC_ASSERT_THRESH) { + time_after(jiffies, cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) { cache->mfc_un.res.last_assert = jiffies; ipmr_cache_report(skb, true_vifi, IGMPMSG_WRONGVIF); } diff -urN pre7-8/net/ipv4/route.c pre7-8.jw/net/ipv4/route.c --- pre7-8/net/ipv4/route.c Mon Apr 24 16:59:57 2000 +++ pre7-8.jw/net/ipv4/route.c Wed May 10 03:00:16 2000 @@ -297,13 +297,13 @@ if (atomic_read(&rth->u.dst.__refcnt)) return 0; - if (rth->u.dst.expires && (long)(rth->u.dst.expires - jiffies) <= 0) + if (rth->u.dst.expires && time_after_eq(jiffies, rth->u.dst.expires)) return 1; age = jiffies - rth->u.dst.lastuse; - if (age <= tmo1 && !rt_fast_clean(rth)) + if (time_before_eq(age, tmo1) && !rt_fast_clean(rth)) return 0; - if (age <= tmo2 && rt_valuable(rth)) + if (time_before_eq(age, tmo2) && rt_valuable(rth)) return 0; return 1; } @@ -348,7 +348,7 @@ write_unlock(&rt_hash_table[i].lock); /* Fallback loop breaker. */ - if ((jiffies - now) > 0) + if (time_after(jiffies, now)) break; } rover = i; @@ -529,7 +529,7 @@ if (atomic_read(&ipv4_dst_ops.entries) < ip_rt_max_size) return 0; - } while (!in_softirq() && jiffies - now < 1); + } while (!in_softirq() && time_before(jiffies, now + 1)); if (atomic_read(&ipv4_dst_ops.entries) < ip_rt_max_size) return 0; diff -urN pre7-8/net/ipv4/syncookies.c pre7-8.jw/net/ipv4/syncookies.c --- pre7-8/net/ipv4/syncookies.c Sat Jan 22 14:54:57 2000 +++ pre7-8.jw/net/ipv4/syncookies.c Wed May 10 03:16:44 2000 @@ -84,7 +84,7 @@ __u32 seq; __u32 mssind; - if ((jiffies - tcp_lastsynq_overflow) > TCP_TIMEOUT_INIT) + if (time_after(jiffies, tcp_lastsynq_overflow + TCP_TIMEOUT_INIT)) return 0; seq = ntohl(skb->h.th->seq)-1; diff -urN pre7-8/net/ipv4/tcp_ipv4.c pre7-8.jw/net/ipv4/tcp_ipv4.c --- pre7-8/net/ipv4/tcp_ipv4.c Wed May 10 01:58:26 2000 +++ pre7-8.jw/net/ipv4/tcp_ipv4.c Wed May 10 03:16:06 2000 @@ -1239,7 +1239,7 @@ { static unsigned long warntime; - if (jiffies - warntime > HZ*60) { + if (time_after(jiffies, warntime + HZ*60)) { warntime = jiffies; printk(KERN_INFO "possible SYN flooding on port %d. Sending cookies.\n", diff -urN pre7-8/net/ipv6/sit.c pre7-8.jw/net/ipv6/sit.c --- pre7-8/net/ipv6/sit.c Wed May 10 01:58:26 2000 +++ pre7-8.jw/net/ipv6/sit.c Wed May 10 04:10:27 2000 @@ -274,7 +274,7 @@ if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) goto out; - if (jiffies - t->err_time < IPTUNNEL_ERR_TIMEO) + if (time_before(jiffies, t->err_time + IPTUNNEL_ERR_TIMEO)) t->err_count++; else t->err_count = 1; @@ -494,7 +494,7 @@ } if (tunnel->err_count > 0) { - if (jiffies - tunnel->err_time < IPTUNNEL_ERR_TIMEO) { + if (time_before(jiffies, tunnel->err_time + IPTUNNEL_ERR_TIMEO)) { tunnel->err_count--; dst_link_failure(skb); } else diff -urN pre7-8/net/irda/discovery.c pre7-8.jw/net/irda/discovery.c --- pre7-8/net/irda/discovery.c Tue Dec 21 13:17:58 1999 +++ pre7-8.jw/net/irda/discovery.c Wed May 10 04:14:15 2000 @@ -136,7 +136,7 @@ /* Test if it's time to expire this discovery */ if ((curr->saddr == saddr) && (force || - ((jiffies - curr->timestamp) > DISCOVERY_EXPIRE_TIMEOUT))) + time_after(jiffies, curr->timestamp + DISCOVERY_EXPIRE_TIMEOUT))) { curr = hashbin_remove(log, curr->daddr, NULL); if (curr) diff -urN pre7-8/net/sched/sch_generic.c pre7-8.jw/net/sched/sch_generic.c --- pre7-8/net/sched/sch_generic.c Wed May 10 01:58:26 2000 +++ pre7-8.jw/net/sched/sch_generic.c Wed May 10 04:13:19 2000 @@ -150,7 +150,7 @@ netif_running(dev) && netif_carrier_ok(dev)) { if (netif_queue_stopped(dev) && - (jiffies - dev->trans_start) > dev->watchdog_timeo) { + time_after(jiffies, dev->trans_start + dev->watchdog_timeo)) { printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n", dev->name); dev->tx_timeout(dev); }