Commit 99bb573c authored by David S. Miller's avatar David S. Miller

Merge nuts.ninka.net:/home/davem/src/BK/network-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents 438ea4e5 53ec4969
...@@ -1100,9 +1100,9 @@ static enum enq_res do_tx(struct sk_buff *skb) ...@@ -1100,9 +1100,9 @@ static enum enq_res do_tx(struct sk_buff *skb)
dma_rd = eni_in(MID_DMA_RD_TX); dma_rd = eni_in(MID_DMA_RD_TX);
dma_size = 3; /* JK for descriptor and final fill, plus final size dma_size = 3; /* JK for descriptor and final fill, plus final size
mis-alignment fix */ mis-alignment fix */
DPRINTK("iovcnt = %d\n",ATM_SKB(skb)->iovcnt); DPRINTK("iovcnt = %d\n",skb_shinfo(skb)->nr_frags);
if (!ATM_SKB(skb)->iovcnt) dma_size += 5; if (!skb_shinfo(skb)->nr_frags) dma_size += 5;
else dma_size += 5*ATM_SKB(skb)->iovcnt; else dma_size += 5*(skb_shinfo(skb)->nr_frags+1);
if (dma_size > TX_DMA_BUF) { if (dma_size > TX_DMA_BUF) {
printk(KERN_CRIT DEV_LABEL "(itf %d): needs %d DMA entries " printk(KERN_CRIT DEV_LABEL "(itf %d): needs %d DMA entries "
"(got only %d)\n",vcc->dev->number,dma_size,TX_DMA_BUF); "(got only %d)\n",vcc->dev->number,dma_size,TX_DMA_BUF);
...@@ -1123,15 +1123,20 @@ DPRINTK("iovcnt = %d\n",ATM_SKB(skb)->iovcnt); ...@@ -1123,15 +1123,20 @@ DPRINTK("iovcnt = %d\n",ATM_SKB(skb)->iovcnt);
MID_DMA_COUNT_SHIFT) | (tx->index << MID_DMA_CHAN_SHIFT) | MID_DMA_COUNT_SHIFT) | (tx->index << MID_DMA_CHAN_SHIFT) |
MID_DT_JK; MID_DT_JK;
j++; j++;
if (!ATM_SKB(skb)->iovcnt) if (!skb_shinfo(skb)->nr_frags)
if (aal5) put_dma(tx->index,eni_dev->dma,&j,paddr,skb->len); if (aal5) put_dma(tx->index,eni_dev->dma,&j,paddr,skb->len);
else put_dma(tx->index,eni_dev->dma,&j,paddr+4,skb->len-4); else put_dma(tx->index,eni_dev->dma,&j,paddr+4,skb->len-4);
else { else {
DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */ DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */
for (i = 0; i < ATM_SKB(skb)->iovcnt; i++) for (i = -1; i < skb_shinfo(skb)->nr_frags; i++)
put_dma(tx->index,eni_dev->dma,&j,(unsigned long) if (i == -1)
((struct iovec *) skb->data)[i].iov_base, put_dma(tx->index,eni_dev->dma,&j,(unsigned long)
((struct iovec *) skb->data)[i].iov_len); skb->data,
skb->len - skb->data_len);
else
put_dma(tx->index,eni_dev->dma,&j,(unsigned long)
skb_shinfo(skb)->frags[i].page + skb_shinfo(skb)->frags[i].page_offset,
skb_shinfo(skb)->frags[i].size);
} }
if (skb->len & 3) if (skb->len & 3)
put_dma(tx->index,eni_dev->dma,&j,zeroes,4-(skb->len & 3)); put_dma(tx->index,eni_dev->dma,&j,zeroes,4-(skb->len & 3));
......
This diff is collapsed.
...@@ -355,10 +355,18 @@ struct he_dev { ...@@ -355,10 +355,18 @@ struct he_dev {
struct he_dev *next; struct he_dev *next;
}; };
struct he_iovec
{
u32 iov_base;
u32 iov_len;
};
#define HE_MAXIOV 20
struct he_vcc struct he_vcc
{ {
struct iovec iov_head[32]; struct he_iovec iov_head[HE_MAXIOV];
struct iovec *iov_tail; struct he_iovec *iov_tail;
int pdu_len; int pdu_len;
int rc_index; int rc_index;
......
...@@ -1768,17 +1768,20 @@ static int hrz_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) { ...@@ -1768,17 +1768,20 @@ static int hrz_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) {
{ {
unsigned int tx_len = skb->len; unsigned int tx_len = skb->len;
unsigned int tx_iovcnt = ATM_SKB(skb)->iovcnt; unsigned int tx_iovcnt = skb_shinfo(skb)->nr_frags;
// remember this so we can free it later // remember this so we can free it later
dev->tx_skb = skb; dev->tx_skb = skb;
if (tx_iovcnt) { if (tx_iovcnt) {
// scatter gather transfer // scatter gather transfer
dev->tx_regions = tx_iovcnt; dev->tx_regions = tx_iovcnt;
dev->tx_iovec = (struct iovec *) skb->data; dev->tx_iovec = 0; /* @@@ needs rewritten */
dev->tx_bytes = 0; dev->tx_bytes = 0;
PRINTD (DBG_TX|DBG_BUS, "TX start scatter-gather transfer (iovec %p, len %d)", PRINTD (DBG_TX|DBG_BUS, "TX start scatter-gather transfer (iovec %p, len %d)",
skb->data, tx_len); skb->data, tx_len);
tx_release (dev);
hrz_kfree_skb (skb);
return -EIO;
} else { } else {
// simple transfer // simple transfer
dev->tx_regions = 0; dev->tx_regions = 0;
......
...@@ -1986,7 +1986,7 @@ idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam) ...@@ -1986,7 +1986,7 @@ idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam)
return -EINVAL; return -EINVAL;
} }
if (ATM_SKB(skb)->iovcnt != 0) { if (skb_shinfo(skb)->nr_frags != 0) {
printk("%s: No scatter-gather yet.\n", card->name); printk("%s: No scatter-gather yet.\n", card->name);
atomic_inc(&vcc->stats->tx_err); atomic_inc(&vcc->stats->tx_err);
dev_kfree_skb(skb); dev_kfree_skb(skb);
...@@ -2023,8 +2023,7 @@ idt77252_send_oam(struct atm_vcc *vcc, void *cell, int flags) ...@@ -2023,8 +2023,7 @@ idt77252_send_oam(struct atm_vcc *vcc, void *cell, int flags)
atomic_inc(&vcc->stats->tx_err); atomic_inc(&vcc->stats->tx_err);
return -ENOMEM; return -ENOMEM;
} }
atomic_add(skb->truesize + ATM_PDU_OVHD, &vcc->sk->wmem_alloc); atomic_add(skb->truesize, &vcc->sk->wmem_alloc);
ATM_SKB(skb)->iovcnt = 0;
memcpy(skb_put(skb, 52), cell, 52); memcpy(skb_put(skb, 52), cell, 52);
......
...@@ -1167,7 +1167,6 @@ static int rx_pkt(struct atm_dev *dev) ...@@ -1167,7 +1167,6 @@ static int rx_pkt(struct atm_dev *dev)
skb_put(skb,len); skb_put(skb,len);
// pwang_test // pwang_test
ATM_SKB(skb)->vcc = vcc; ATM_SKB(skb)->vcc = vcc;
ATM_SKB(skb)->iovcnt = 0;
ATM_DESC(skb) = desc; ATM_DESC(skb) = desc;
skb_queue_tail(&iadev->rx_dma_q, skb); skb_queue_tail(&iadev->rx_dma_q, skb);
......
...@@ -2846,7 +2846,6 @@ static const struct atmdev_ops ops = { ...@@ -2846,7 +2846,6 @@ static const struct atmdev_ops ops = {
.phy_get = NULL, .phy_get = NULL,
.feedback = NULL, .feedback = NULL,
.change_qos = lanai_change_qos, .change_qos = lanai_change_qos,
.free_rx_skb = NULL,
.proc_read = lanai_proc_read .proc_read = lanai_proc_read
}; };
......
...@@ -882,9 +882,14 @@ static int __init ns_init_card(int i, struct pci_dev *pcidev) ...@@ -882,9 +882,14 @@ static int __init ns_init_card(int i, struct pci_dev *pcidev)
return error; return error;
} }
if (ns_parse_mac(mac[i], card->atmdev->esi)) if (ns_parse_mac(mac[i], card->atmdev->esi)) {
nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET, nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET,
card->atmdev->esi, 6); card->atmdev->esi, 6);
if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) == 0) {
nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET_ALT,
card->atmdev->esi, 6);
}
}
printk("nicstar%d: MAC address %02X:%02X:%02X:%02X:%02X:%02X\n", i, printk("nicstar%d: MAC address %02X:%02X:%02X:%02X:%02X:%02X\n", i,
card->atmdev->esi[0], card->atmdev->esi[1], card->atmdev->esi[2], card->atmdev->esi[0], card->atmdev->esi[1], card->atmdev->esi[2],
...@@ -1601,9 +1606,9 @@ static void ns_close(struct atm_vcc *vcc) ...@@ -1601,9 +1606,9 @@ static void ns_close(struct atm_vcc *vcc)
card->index); card->index);
iovb = vc->rx_iov; iovb = vc->rx_iov;
recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data,
ATM_SKB(iovb)->iovcnt); NS_SKB(iovb)->iovcnt);
ATM_SKB(iovb)->iovcnt = 0; NS_SKB(iovb)->iovcnt = 0;
ATM_SKB(iovb)->vcc = NULL; NS_SKB(iovb)->vcc = NULL;
ns_grab_int_lock(card, flags); ns_grab_int_lock(card, flags);
recycle_iov_buf(card, iovb); recycle_iov_buf(card, iovb);
spin_unlock_irqrestore(&card->int_lock, flags); spin_unlock_irqrestore(&card->int_lock, flags);
...@@ -1801,7 +1806,7 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -1801,7 +1806,7 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
return -EINVAL; return -EINVAL;
} }
if (ATM_SKB(skb)->iovcnt != 0) if (skb_shinfo(skb)->nr_frags != 0)
{ {
printk("nicstar%d: No scatter-gather yet.\n", card->index); printk("nicstar%d: No scatter-gather yet.\n", card->index);
atomic_inc(&vcc->stats->tx_err); atomic_inc(&vcc->stats->tx_err);
...@@ -2226,30 +2231,30 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) ...@@ -2226,30 +2231,30 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
} }
} }
vc->rx_iov = iovb; vc->rx_iov = iovb;
ATM_SKB(iovb)->iovcnt = 0; NS_SKB(iovb)->iovcnt = 0;
iovb->len = 0; iovb->len = 0;
iovb->tail = iovb->data = iovb->head; iovb->tail = iovb->data = iovb->head;
ATM_SKB(iovb)->vcc = vcc; NS_SKB(iovb)->vcc = vcc;
/* IMPORTANT: a pointer to the sk_buff containing the small or large /* IMPORTANT: a pointer to the sk_buff containing the small or large
buffer is stored as iovec base, NOT a pointer to the buffer is stored as iovec base, NOT a pointer to the
small or large buffer itself. */ small or large buffer itself. */
} }
else if (ATM_SKB(iovb)->iovcnt >= NS_MAX_IOVECS) else if (NS_SKB(iovb)->iovcnt >= NS_MAX_IOVECS)
{ {
printk("nicstar%d: received too big AAL5 SDU.\n", card->index); printk("nicstar%d: received too big AAL5 SDU.\n", card->index);
atomic_inc(&vcc->stats->rx_err); atomic_inc(&vcc->stats->rx_err);
recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, NS_MAX_IOVECS); recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, NS_MAX_IOVECS);
ATM_SKB(iovb)->iovcnt = 0; NS_SKB(iovb)->iovcnt = 0;
iovb->len = 0; iovb->len = 0;
iovb->tail = iovb->data = iovb->head; iovb->tail = iovb->data = iovb->head;
ATM_SKB(iovb)->vcc = vcc; NS_SKB(iovb)->vcc = vcc;
} }
iov = &((struct iovec *) iovb->data)[ATM_SKB(iovb)->iovcnt++]; iov = &((struct iovec *) iovb->data)[NS_SKB(iovb)->iovcnt++];
iov->iov_base = (void *) skb; iov->iov_base = (void *) skb;
iov->iov_len = ns_rsqe_cellcount(rsqe) * 48; iov->iov_len = ns_rsqe_cellcount(rsqe) * 48;
iovb->len += iov->iov_len; iovb->len += iov->iov_len;
if (ATM_SKB(iovb)->iovcnt == 1) if (NS_SKB(iovb)->iovcnt == 1)
{ {
if (skb->list != &card->sbpool.queue) if (skb->list != &card->sbpool.queue)
{ {
...@@ -2263,7 +2268,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) ...@@ -2263,7 +2268,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
return; return;
} }
} }
else /* ATM_SKB(iovb)->iovcnt >= 2 */ else /* NS_SKB(iovb)->iovcnt >= 2 */
{ {
if (skb->list != &card->lbpool.queue) if (skb->list != &card->lbpool.queue)
{ {
...@@ -2272,7 +2277,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) ...@@ -2272,7 +2277,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
which_list(card, skb); which_list(card, skb);
atomic_inc(&vcc->stats->rx_err); atomic_inc(&vcc->stats->rx_err);
recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data,
ATM_SKB(iovb)->iovcnt); NS_SKB(iovb)->iovcnt);
vc->rx_iov = NULL; vc->rx_iov = NULL;
recycle_iov_buf(card, iovb); recycle_iov_buf(card, iovb);
return; return;
...@@ -2296,7 +2301,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) ...@@ -2296,7 +2301,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
printk(".\n"); printk(".\n");
atomic_inc(&vcc->stats->rx_err); atomic_inc(&vcc->stats->rx_err);
recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data,
ATM_SKB(iovb)->iovcnt); NS_SKB(iovb)->iovcnt);
vc->rx_iov = NULL; vc->rx_iov = NULL;
recycle_iov_buf(card, iovb); recycle_iov_buf(card, iovb);
return; return;
...@@ -2304,7 +2309,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) ...@@ -2304,7 +2309,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
/* By this point we (hopefully) have a complete SDU without errors. */ /* By this point we (hopefully) have a complete SDU without errors. */
if (ATM_SKB(iovb)->iovcnt == 1) /* Just a small buffer */ if (NS_SKB(iovb)->iovcnt == 1) /* Just a small buffer */
{ {
/* skb points to a small buffer */ /* skb points to a small buffer */
if (!atm_charge(vcc, skb->truesize)) if (!atm_charge(vcc, skb->truesize))
...@@ -2326,7 +2331,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) ...@@ -2326,7 +2331,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
atomic_inc(&vcc->stats->rx); atomic_inc(&vcc->stats->rx);
} }
} }
else if (ATM_SKB(iovb)->iovcnt == 2) /* One small plus one large buffer */ else if (NS_SKB(iovb)->iovcnt == 2) /* One small plus one large buffer */
{ {
struct sk_buff *sb; struct sk_buff *sb;
...@@ -2403,7 +2408,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) ...@@ -2403,7 +2408,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
printk("nicstar%d: Out of huge buffers.\n", card->index); printk("nicstar%d: Out of huge buffers.\n", card->index);
atomic_inc(&vcc->stats->rx_drop); atomic_inc(&vcc->stats->rx_drop);
recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data,
ATM_SKB(iovb)->iovcnt); NS_SKB(iovb)->iovcnt);
vc->rx_iov = NULL; vc->rx_iov = NULL;
recycle_iov_buf(card, iovb); recycle_iov_buf(card, iovb);
return; return;
...@@ -2441,7 +2446,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) ...@@ -2441,7 +2446,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
if (!atm_charge(vcc, hb->truesize)) if (!atm_charge(vcc, hb->truesize))
{ {
recycle_iovec_rx_bufs(card, iov, ATM_SKB(iovb)->iovcnt); recycle_iovec_rx_bufs(card, iov, NS_SKB(iovb)->iovcnt);
if (card->hbpool.count < card->hbnr.max) if (card->hbpool.count < card->hbnr.max)
{ {
skb_queue_tail(&card->hbpool.queue, hb); skb_queue_tail(&card->hbpool.queue, hb);
...@@ -2464,7 +2469,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) ...@@ -2464,7 +2469,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
0, 0); 0, 0);
/* Copy all large buffers to the huge buffer and free them */ /* Copy all large buffers to the huge buffer and free them */
for (j = 1; j < ATM_SKB(iovb)->iovcnt; j++) for (j = 1; j < NS_SKB(iovb)->iovcnt; j++)
{ {
lb = (struct sk_buff *) iov->iov_base; lb = (struct sk_buff *) iov->iov_base;
tocopy = MIN(remaining, iov->iov_len); tocopy = MIN(remaining, iov->iov_len);
......
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
/* ESI stuff ******************************************************************/ /* ESI stuff ******************************************************************/
#define NICSTAR_EPROM_MAC_ADDR_OFFSET 0x6C #define NICSTAR_EPROM_MAC_ADDR_OFFSET 0x6C
#define NICSTAR_EPROM_MAC_ADDR_OFFSET_ALT 0xF6
/* #defines *******************************************************************/ /* #defines *******************************************************************/
...@@ -749,6 +750,15 @@ typedef struct vc_map ...@@ -749,6 +750,15 @@ typedef struct vc_map
} vc_map; } vc_map;
struct ns_skb_data
{
struct atm_vcc *vcc;
int iovcnt;
};
#define NS_SKB(skb) (((struct ns_skb_data *) (skb)->cb))
typedef struct ns_dev typedef struct ns_dev
{ {
int index; /* Card ID to the device driver */ int index; /* Card ID to the device driver */
......
...@@ -827,10 +827,10 @@ static int do_tx(struct sk_buff *skb) ...@@ -827,10 +827,10 @@ static int do_tx(struct sk_buff *skb)
vcc = ATM_SKB(skb)->vcc; vcc = ATM_SKB(skb)->vcc;
zatm_dev = ZATM_DEV(vcc->dev); zatm_dev = ZATM_DEV(vcc->dev);
zatm_vcc = ZATM_VCC(vcc); zatm_vcc = ZATM_VCC(vcc);
EVENT("iovcnt=%d\n",ATM_SKB(skb)->iovcnt,0); EVENT("iovcnt=%d\n",skb_shinfo(skb)->nr_frags,0);
save_flags(flags); save_flags(flags);
cli(); cli();
if (!ATM_SKB(skb)->iovcnt) { if (!skb_shinfo(skb)->nr_frags) {
if (zatm_vcc->txing == RING_ENTRIES-1) { if (zatm_vcc->txing == RING_ENTRIES-1) {
restore_flags(flags); restore_flags(flags);
return RING_BUSY; return RING_BUSY;
......
...@@ -1871,7 +1871,9 @@ static void ace_watchdog(struct net_device *data) ...@@ -1871,7 +1871,9 @@ static void ace_watchdog(struct net_device *data)
} else { } else {
printk(KERN_DEBUG "%s: BUG... transmitter died. Kicking it.\n", printk(KERN_DEBUG "%s: BUG... transmitter died. Kicking it.\n",
dev->name); dev->name);
#if 0
netif_wake_queue(dev); netif_wake_queue(dev);
#endif
} }
} }
......
...@@ -30,9 +30,6 @@ ...@@ -30,9 +30,6 @@
#define ATM_DS3_PCR (8000*12) #define ATM_DS3_PCR (8000*12)
/* DS3: 12 cells in a 125 usec time slot */ /* DS3: 12 cells in a 125 usec time slot */
#define ATM_PDU_OVHD 0 /* number of bytes to charge against buffer
quota per PDU */
#define atm_sk(__sk) ((struct atm_vcc *)(__sk)->protinfo) #define atm_sk(__sk) ((struct atm_vcc *)(__sk)->protinfo)
#define ATM_SD(s) (atm_sk((s)->sk)) #define ATM_SD(s) (atm_sk((s)->sk))
...@@ -289,10 +286,6 @@ struct atm_vcc { ...@@ -289,10 +286,6 @@ struct atm_vcc {
struct atm_sap sap; /* SAP */ struct atm_sap sap; /* SAP */
void (*push)(struct atm_vcc *vcc,struct sk_buff *skb); void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */ void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
struct sk_buff *(*alloc_tx)(struct atm_vcc *vcc,unsigned int size);
/* TX allocation routine - can be */
/* modified by protocol or by driver.*/
/* NOTE: this interface will change */
int (*push_oam)(struct atm_vcc *vcc,void *cell); int (*push_oam)(struct atm_vcc *vcc,void *cell);
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb); int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
void *dev_data; /* per-device data */ void *dev_data; /* per-device data */
...@@ -378,8 +371,6 @@ struct atmdev_ops { /* only send is required */ ...@@ -378,8 +371,6 @@ struct atmdev_ops { /* only send is required */
void (*feedback)(struct atm_vcc *vcc,struct sk_buff *skb, void (*feedback)(struct atm_vcc *vcc,struct sk_buff *skb,
unsigned long start,unsigned long dest,int len); unsigned long start,unsigned long dest,int len);
int (*change_qos)(struct atm_vcc *vcc,struct atm_qos *qos,int flags); int (*change_qos)(struct atm_vcc *vcc,struct atm_qos *qos,int flags);
void (*free_rx_skb)(struct atm_vcc *vcc, struct sk_buff *skb);
/* @@@ temporary hack */
int (*proc_read)(struct atm_dev *dev,loff_t *pos,char *page); int (*proc_read)(struct atm_dev *dev,loff_t *pos,char *page);
struct module *owner; struct module *owner;
}; };
...@@ -394,7 +385,6 @@ struct atmphy_ops { ...@@ -394,7 +385,6 @@ struct atmphy_ops {
struct atm_skb_data { struct atm_skb_data {
struct atm_vcc *vcc; /* ATM VCC */ struct atm_vcc *vcc; /* ATM VCC */
int iovcnt; /* 0 for "normal" operation */
unsigned long atm_options; /* ATM layer options */ unsigned long atm_options; /* ATM layer options */
}; };
...@@ -421,19 +411,19 @@ static __inline__ int atm_guess_pdu2truesize(int pdu_size) ...@@ -421,19 +411,19 @@ static __inline__ int atm_guess_pdu2truesize(int pdu_size)
static __inline__ void atm_force_charge(struct atm_vcc *vcc,int truesize) static __inline__ void atm_force_charge(struct atm_vcc *vcc,int truesize)
{ {
atomic_add(truesize+ATM_PDU_OVHD,&vcc->sk->rmem_alloc); atomic_add(truesize, &vcc->sk->rmem_alloc);
} }
static __inline__ void atm_return(struct atm_vcc *vcc,int truesize) static __inline__ void atm_return(struct atm_vcc *vcc,int truesize)
{ {
atomic_sub(truesize+ATM_PDU_OVHD,&vcc->sk->rmem_alloc); atomic_sub(truesize, &vcc->sk->rmem_alloc);
} }
static __inline__ int atm_may_send(struct atm_vcc *vcc,unsigned int size) static __inline__ int atm_may_send(struct atm_vcc *vcc,unsigned int size)
{ {
return size+atomic_read(&vcc->sk->wmem_alloc)+ATM_PDU_OVHD < vcc->sk->sndbuf; return (size + atomic_read(&vcc->sk->wmem_alloc)) < vcc->sk->sndbuf;
} }
......
...@@ -481,6 +481,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb) ...@@ -481,6 +481,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
} }
brdev->stats.rx_packets++; brdev->stats.rx_packets++;
brdev->stats.rx_bytes += skb->len; brdev->stats.rx_bytes += skb->len;
memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
netif_rx(skb); netif_rx(skb);
} }
......
...@@ -223,6 +223,7 @@ void clip_push(struct atm_vcc *vcc,struct sk_buff *skb) ...@@ -223,6 +223,7 @@ void clip_push(struct atm_vcc *vcc,struct sk_buff *skb)
clip_vcc->last_use = jiffies; clip_vcc->last_use = jiffies;
PRIV(skb->dev)->stats.rx_packets++; PRIV(skb->dev)->stats.rx_packets++;
PRIV(skb->dev)->stats.rx_bytes += skb->len; PRIV(skb->dev)->stats.rx_bytes += skb->len;
memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
netif_rx(skb); netif_rx(skb);
} }
...@@ -432,7 +433,6 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev) ...@@ -432,7 +433,6 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
((u16 *) here)[3] = skb->protocol; ((u16 *) here)[3] = skb->protocol;
} }
atomic_add(skb->truesize,&vcc->sk->wmem_alloc); atomic_add(skb->truesize,&vcc->sk->wmem_alloc);
ATM_SKB(skb)->iovcnt = 0;
ATM_SKB(skb)->atm_options = vcc->atm_options; ATM_SKB(skb)->atm_options = vcc->atm_options;
entry->vccs->last_use = jiffies; entry->vccs->last_use = jiffies;
DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n",skb,vcc,vcc->dev); DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n",skb,vcc,vcc->dev);
......
...@@ -98,7 +98,7 @@ static struct sk_buff *alloc_tx(struct atm_vcc *vcc,unsigned int size) ...@@ -98,7 +98,7 @@ static struct sk_buff *alloc_tx(struct atm_vcc *vcc,unsigned int size)
} }
while (!(skb = alloc_skb(size,GFP_KERNEL))) schedule(); while (!(skb = alloc_skb(size,GFP_KERNEL))) schedule();
DPRINTK("AlTx %d += %d\n",atomic_read(&vcc->sk->wmem_alloc),skb->truesize); DPRINTK("AlTx %d += %d\n",atomic_read(&vcc->sk->wmem_alloc),skb->truesize);
atomic_add(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc); atomic_add(skb->truesize, &vcc->sk->wmem_alloc);
return skb; return skb;
} }
...@@ -114,7 +114,6 @@ int atm_create(struct socket *sock,int protocol,int family) ...@@ -114,7 +114,6 @@ int atm_create(struct socket *sock,int protocol,int family)
vcc = atm_sk(sk); vcc = atm_sk(sk);
memset(&vcc->flags,0,sizeof(vcc->flags)); memset(&vcc->flags,0,sizeof(vcc->flags));
vcc->dev = NULL; vcc->dev = NULL;
vcc->alloc_tx = alloc_tx;
vcc->callback = NULL; vcc->callback = NULL;
memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc)); memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc));
memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc)); memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc));
...@@ -144,9 +143,7 @@ void atm_release_vcc_sk(struct sock *sk,int free_sk) ...@@ -144,9 +143,7 @@ void atm_release_vcc_sk(struct sock *sk,int free_sk)
if (vcc->push) vcc->push(vcc,NULL); /* atmarpd has no push */ if (vcc->push) vcc->push(vcc,NULL); /* atmarpd has no push */
while ((skb = skb_dequeue(&vcc->sk->receive_queue))) { while ((skb = skb_dequeue(&vcc->sk->receive_queue))) {
atm_return(vcc,skb->truesize); atm_return(vcc,skb->truesize);
if (vcc->dev->ops->free_rx_skb) kfree_skb(skb);
vcc->dev->ops->free_rx_skb(vcc,skb);
else kfree_skb(skb);
} }
spin_lock (&atm_dev_lock); spin_lock (&atm_dev_lock);
fops_put (vcc->dev->ops); fops_put (vcc->dev->ops);
...@@ -394,31 +391,8 @@ int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, ...@@ -394,31 +391,8 @@ int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
(unsigned long) buff,eff_len); (unsigned long) buff,eff_len);
DPRINTK("RcvM %d -= %d\n",atomic_read(&vcc->sk->rmem_alloc),skb->truesize); DPRINTK("RcvM %d -= %d\n",atomic_read(&vcc->sk->rmem_alloc),skb->truesize);
atm_return(vcc,skb->truesize); atm_return(vcc,skb->truesize);
if (ATM_SKB(skb)->iovcnt) { /* @@@ hack */
/* iovcnt set, use scatter-gather for receive */
int el, cnt;
struct iovec *iov = (struct iovec *)skb->data;
unsigned char *p = (unsigned char *)buff;
el = eff_len;
error = 0;
for (cnt = 0; (cnt < ATM_SKB(skb)->iovcnt) && el; cnt++) {
/*printk("s-g???: %p -> %p (%d)\n",iov->iov_base,p,iov->iov_len);*/
error = copy_to_user(p,iov->iov_base,
(iov->iov_len > el) ? el : iov->iov_len) ?
-EFAULT : 0;
if (error) break;
p += iov->iov_len;
el -= (iov->iov_len > el)?el:iov->iov_len;
iov++;
}
if (!vcc->dev->ops->free_rx_skb) kfree_skb(skb);
else vcc->dev->ops->free_rx_skb(vcc, skb);
return error ? error : eff_len;
}
error = copy_to_user(buff,skb->data,eff_len) ? -EFAULT : 0; error = copy_to_user(buff,skb->data,eff_len) ? -EFAULT : 0;
if (!vcc->dev->ops->free_rx_skb) kfree_skb(skb); kfree_skb(skb);
else vcc->dev->ops->free_rx_skb(vcc, skb);
return error ? error : eff_len; return error ? error : eff_len;
} }
...@@ -450,7 +424,7 @@ int atm_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, ...@@ -450,7 +424,7 @@ int atm_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
add_wait_queue(&vcc->sleep,&wait); add_wait_queue(&vcc->sleep,&wait);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
error = 0; error = 0;
while (!(skb = vcc->alloc_tx(vcc,eff))) { while (!(skb = alloc_tx(vcc,eff))) {
if (m->msg_flags & MSG_DONTWAIT) { if (m->msg_flags & MSG_DONTWAIT) {
error = -EAGAIN; error = -EAGAIN;
break; break;
...@@ -475,7 +449,6 @@ int atm_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, ...@@ -475,7 +449,6 @@ int atm_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
remove_wait_queue(&vcc->sleep,&wait); remove_wait_queue(&vcc->sleep,&wait);
if (error) return error; if (error) return error;
skb->dev = NULL; /* for paths shared with net_device interfaces */ skb->dev = NULL; /* for paths shared with net_device interfaces */
ATM_SKB(skb)->iovcnt = 0;
ATM_SKB(skb)->atm_options = vcc->atm_options; ATM_SKB(skb)->atm_options = vcc->atm_options;
if (copy_from_user(skb_put(skb,size),buff,size)) { if (copy_from_user(skb_put(skb,size),buff,size)) {
kfree_skb(skb); kfree_skb(skb);
...@@ -502,8 +475,7 @@ unsigned int atm_poll(struct file *file,struct socket *sock,poll_table *wait) ...@@ -502,8 +475,7 @@ unsigned int atm_poll(struct file *file,struct socket *sock,poll_table *wait)
mask |= POLLHUP; mask |= POLLHUP;
if (sock->state != SS_CONNECTING) { if (sock->state != SS_CONNECTING) {
if (vcc->qos.txtp.traffic_class != ATM_NONE && if (vcc->qos.txtp.traffic_class != ATM_NONE &&
vcc->qos.txtp.max_sdu+atomic_read(&vcc->sk->wmem_alloc)+ vcc->qos.txtp.max_sdu+atomic_read(&vcc->sk->wmem_alloc) <= vcc->sk->sndbuf)
ATM_PDU_OVHD <= vcc->sk->sndbuf)
mask |= POLLOUT | POLLWRNORM; mask |= POLLOUT | POLLWRNORM;
} }
else if (vcc->reply != WAITING) { else if (vcc->reply != WAITING) {
...@@ -570,7 +542,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg) ...@@ -570,7 +542,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
goto done; goto done;
} }
ret_val = put_user(vcc->sk->sndbuf- ret_val = put_user(vcc->sk->sndbuf-
atomic_read(&vcc->sk->wmem_alloc)-ATM_PDU_OVHD, atomic_read(&vcc->sk->wmem_alloc),
(int *) arg) ? -EFAULT : 0; (int *) arg) ? -EFAULT : 0;
goto done; goto done;
case SIOCINQ: case SIOCINQ:
......
...@@ -204,7 +204,6 @@ lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv) ...@@ -204,7 +204,6 @@ lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv)
if (atm_may_send(vcc, skb->len)) { if (atm_may_send(vcc, skb->len)) {
atomic_add(skb->truesize, &vcc->sk->wmem_alloc); atomic_add(skb->truesize, &vcc->sk->wmem_alloc);
ATM_SKB(skb)->vcc = vcc; ATM_SKB(skb)->vcc = vcc;
ATM_SKB(skb)->iovcnt = 0;
ATM_SKB(skb)->atm_options = vcc->atm_options; ATM_SKB(skb)->atm_options = vcc->atm_options;
priv->stats.tx_packets++; priv->stats.tx_packets++;
priv->stats.tx_bytes += skb->len; priv->stats.tx_bytes += skb->len;
...@@ -715,6 +714,7 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -715,6 +714,7 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
priv->stats.rx_packets++; priv->stats.rx_packets++;
priv->stats.rx_bytes += skb->len; priv->stats.rx_bytes += skb->len;
memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
netif_rx(skb); netif_rx(skb);
} }
} }
......
...@@ -523,7 +523,6 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) ...@@ -523,7 +523,6 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc)
} }
atomic_add(skb->truesize, &entry->shortcut->sk->wmem_alloc); atomic_add(skb->truesize, &entry->shortcut->sk->wmem_alloc);
ATM_SKB(skb)->iovcnt = 0; /* just to be safe ... */
ATM_SKB(skb)->atm_options = entry->shortcut->atm_options; ATM_SKB(skb)->atm_options = entry->shortcut->atm_options;
entry->shortcut->send(entry->shortcut, skb); entry->shortcut->send(entry->shortcut, skb);
entry->packets_fwded++; entry->packets_fwded++;
...@@ -732,6 +731,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -732,6 +731,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
eg->packets_rcvd++; eg->packets_rcvd++;
mpc->eg_ops->put(eg); mpc->eg_ops->put(eg);
memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
netif_rx(new_skb); netif_rx(new_skb);
return; return;
...@@ -863,7 +863,7 @@ static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -863,7 +863,7 @@ static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb)
struct mpoa_client *mpc = find_mpc_by_vcc(vcc); struct mpoa_client *mpc = find_mpc_by_vcc(vcc);
struct k_message *mesg = (struct k_message*)skb->data; struct k_message *mesg = (struct k_message*)skb->data;
atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->sk->wmem_alloc); atomic_sub(skb->truesize, &vcc->sk->wmem_alloc);
if (mpc == NULL) { if (mpc == NULL) {
printk("mpoa: msg_from_mpoad: no mpc found\n"); printk("mpoa: msg_from_mpoad: no mpc found\n");
......
...@@ -232,7 +232,6 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) ...@@ -232,7 +232,6 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb)
return 1; return 1;
} }
atomic_add(skb->truesize, &ATM_SKB(skb)->vcc->sk->wmem_alloc); atomic_add(skb->truesize, &ATM_SKB(skb)->vcc->sk->wmem_alloc);
ATM_SKB(skb)->iovcnt = 0;
ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options; ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options;
DPRINTK("(unit %d): atm_skb(%p)->vcc(%p)->dev(%p)\n", DPRINTK("(unit %d): atm_skb(%p)->vcc(%p)->dev(%p)\n",
pvcc->chan.unit, skb, ATM_SKB(skb)->vcc, pvcc->chan.unit, skb, ATM_SKB(skb)->vcc,
......
...@@ -37,7 +37,7 @@ void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb) ...@@ -37,7 +37,7 @@ void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb) static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb)
{ {
DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->sk->wmem_alloc,skb->truesize); DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->sk->wmem_alloc,skb->truesize);
atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc); atomic_sub(skb->truesize, &vcc->sk->wmem_alloc);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
wake_up(&vcc->sleep); wake_up(&vcc->sleep);
} }
......
...@@ -98,7 +98,7 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb) ...@@ -98,7 +98,7 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb)
struct atm_vcc *session_vcc; struct atm_vcc *session_vcc;
msg = (struct atmsvc_msg *) skb->data; msg = (struct atmsvc_msg *) skb->data;
atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc); atomic_sub(skb->truesize, &vcc->sk->wmem_alloc);
DPRINTK("sigd_send %d (0x%lx)\n",(int) msg->type, DPRINTK("sigd_send %d (0x%lx)\n",(int) msg->type,
(unsigned long) msg->vcc); (unsigned long) msg->vcc);
vcc = *(struct atm_vcc **) &msg->vcc; vcc = *(struct atm_vcc **) &msg->vcc;
......
...@@ -218,7 +218,7 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct ...@@ -218,7 +218,7 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct
if (!(dev->flags&IFF_UP)) if (!(dev->flags&IFF_UP))
return -ENETDOWN; return -ENETDOWN;
nh->nh_dev = dev; nh->nh_dev = dev;
atomic_inc(&dev->refcnt); dev_hold(dev);
nh->nh_scope = RT_SCOPE_LINK; nh->nh_scope = RT_SCOPE_LINK;
return 0; return 0;
} }
...@@ -242,7 +242,7 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct ...@@ -242,7 +242,7 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct
nh->nh_dev = DN_FIB_RES_DEV(res); nh->nh_dev = DN_FIB_RES_DEV(res);
if (nh->nh_dev == NULL) if (nh->nh_dev == NULL)
goto out; goto out;
atomic_inc(&nh->nh_dev->refcnt); dev_hold(nh->nh_dev);
err = -ENETDOWN; err = -ENETDOWN;
if (!(nh->nh_dev->flags & IFF_UP)) if (!(nh->nh_dev->flags & IFF_UP))
goto out; goto out;
...@@ -262,7 +262,7 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct ...@@ -262,7 +262,7 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct
if (!(dev->flags&IFF_UP)) if (!(dev->flags&IFF_UP))
return -ENETDOWN; return -ENETDOWN;
nh->nh_dev = dev; nh->nh_dev = dev;
atomic_inc(&nh->nh_dev->refcnt); dev_hold(nh->nh_dev);
nh->nh_scope = RT_SCOPE_HOST; nh->nh_scope = RT_SCOPE_HOST;
} }
......
...@@ -325,7 +325,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -325,7 +325,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
{ {
/* Real hardware Econet. We're not worthy etc. */ /* Real hardware Econet. We're not worthy etc. */
#ifdef CONFIG_ECONET_NATIVE #ifdef CONFIG_ECONET_NATIVE
atomic_inc(&dev->refcnt); dev_hold(dev);
skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15, skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15,
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT, &err);
......
...@@ -431,16 +431,17 @@ static __inline__ int rt_valuable(struct rtable *rth) ...@@ -431,16 +431,17 @@ static __inline__ int rt_valuable(struct rtable *rth)
rth->u.dst.expires; rth->u.dst.expires;
} }
static int rt_may_expire(struct rtable *rth, int tmo1, int tmo2) static int rt_may_expire(struct rtable *rth, unsigned long tmo1, unsigned long tmo2)
{ {
int age; unsigned long age;
int ret = 0; int ret = 0;
if (atomic_read(&rth->u.dst.__refcnt)) if (atomic_read(&rth->u.dst.__refcnt))
goto out; goto out;
ret = 1; ret = 1;
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))
goto out; goto out;
age = jiffies - rth->u.dst.lastuse; age = jiffies - rth->u.dst.lastuse;
...@@ -462,7 +463,7 @@ static void SMP_TIMER_NAME(rt_check_expire)(unsigned long dummy) ...@@ -462,7 +463,7 @@ static void SMP_TIMER_NAME(rt_check_expire)(unsigned long dummy)
for (t = ip_rt_gc_interval << rt_hash_log; t >= 0; for (t = ip_rt_gc_interval << rt_hash_log; t >= 0;
t -= ip_rt_gc_timeout) { t -= ip_rt_gc_timeout) {
unsigned tmo = ip_rt_gc_timeout; unsigned long tmo = ip_rt_gc_timeout;
i = (i + 1) & rt_hash_mask; i = (i + 1) & rt_hash_mask;
rthp = &rt_hash_table[i].chain; rthp = &rt_hash_table[i].chain;
...@@ -471,7 +472,7 @@ static void SMP_TIMER_NAME(rt_check_expire)(unsigned long dummy) ...@@ -471,7 +472,7 @@ static void SMP_TIMER_NAME(rt_check_expire)(unsigned long dummy)
while ((rth = *rthp) != NULL) { while ((rth = *rthp) != NULL) {
if (rth->u.dst.expires) { if (rth->u.dst.expires) {
/* Entry is expired even if it is in use */ /* Entry is expired even if it is in use */
if ((long)(now - rth->u.dst.expires) <= 0) { if (time_after_eq(now, rth->u.dst.expires)) {
tmo >>= 1; tmo >>= 1;
rthp = &rth->u.rt_next; rthp = &rth->u.rt_next;
continue; continue;
...@@ -489,7 +490,7 @@ static void SMP_TIMER_NAME(rt_check_expire)(unsigned long dummy) ...@@ -489,7 +490,7 @@ static void SMP_TIMER_NAME(rt_check_expire)(unsigned long dummy)
spin_unlock(&rt_hash_table[i].lock); spin_unlock(&rt_hash_table[i].lock);
/* Fallback loop breaker. */ /* Fallback loop breaker. */
if ((jiffies - now) > 0) if (time_after(jiffies, now))
break; break;
} }
rover = i; rover = i;
...@@ -591,7 +592,7 @@ static void rt_secret_rebuild(unsigned long dummy) ...@@ -591,7 +592,7 @@ static void rt_secret_rebuild(unsigned long dummy)
static int rt_garbage_collect(void) static int rt_garbage_collect(void)
{ {
static unsigned expire = RT_GC_TIMEOUT; static unsigned long expire = RT_GC_TIMEOUT;
static unsigned long last_gc; static unsigned long last_gc;
static int rover; static int rover;
static int equilibrium; static int equilibrium;
...@@ -643,7 +644,7 @@ static int rt_garbage_collect(void) ...@@ -643,7 +644,7 @@ static int rt_garbage_collect(void)
int i, k; int i, k;
for (i = rt_hash_mask, k = rover; i >= 0; i--) { for (i = rt_hash_mask, k = rover; i >= 0; i--) {
unsigned tmo = expire; unsigned long tmo = expire;
k = (k + 1) & rt_hash_mask; k = (k + 1) & rt_hash_mask;
rthp = &rt_hash_table[k].chain; rthp = &rt_hash_table[k].chain;
...@@ -689,7 +690,7 @@ static int rt_garbage_collect(void) ...@@ -689,7 +690,7 @@ static int rt_garbage_collect(void)
if (atomic_read(&ipv4_dst_ops.entries) < ip_rt_max_size) if (atomic_read(&ipv4_dst_ops.entries) < ip_rt_max_size)
goto out; goto out;
} while (!in_softirq() && jiffies - now < 1); } while (!in_softirq() && time_before_eq(jiffies, now));
if (atomic_read(&ipv4_dst_ops.entries) < ip_rt_max_size) if (atomic_read(&ipv4_dst_ops.entries) < ip_rt_max_size)
goto out; goto out;
...@@ -1067,7 +1068,7 @@ void ip_rt_send_redirect(struct sk_buff *skb) ...@@ -1067,7 +1068,7 @@ void ip_rt_send_redirect(struct sk_buff *skb)
/* No redirected packets during ip_rt_redirect_silence; /* No redirected packets during ip_rt_redirect_silence;
* reset the algorithm. * reset the algorithm.
*/ */
if (jiffies - rt->u.dst.rate_last > ip_rt_redirect_silence) if (time_after(jiffies, rt->u.dst.rate_last + ip_rt_redirect_silence))
rt->u.dst.rate_tokens = 0; rt->u.dst.rate_tokens = 0;
/* Too many ignored redirects; do not send anything /* Too many ignored redirects; do not send anything
...@@ -1081,8 +1082,9 @@ void ip_rt_send_redirect(struct sk_buff *skb) ...@@ -1081,8 +1082,9 @@ void ip_rt_send_redirect(struct sk_buff *skb)
/* Check for load limit; set rate_last to the latest sent /* Check for load limit; set rate_last to the latest sent
* redirect. * redirect.
*/ */
if (jiffies - rt->u.dst.rate_last > if (time_after(jiffies,
(ip_rt_redirect_load << rt->u.dst.rate_tokens)) { (rt->u.dst.rate_last +
(ip_rt_redirect_load << rt->u.dst.rate_tokens)))) {
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, rt->rt_gateway); icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, rt->rt_gateway);
rt->u.dst.rate_last = jiffies; rt->u.dst.rate_last = jiffies;
++rt->u.dst.rate_tokens; ++rt->u.dst.rate_tokens;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* liability nor provide warranty for any of this software. This material * liability nor provide warranty for any of this software. This material
* is provided as is and at no charge. * is provided as is and at no charge.
* *
* Portions Copyright (c) 2000-2002 Conectiva, Inc. <acme@conectiva.com.br> * Portions Copyright (c) 2000-2003 Conectiva, Inc. <acme@conectiva.com.br>
* Neither Arnaldo Carvalho de Melo nor Conectiva, Inc. admit liability nor * Neither Arnaldo Carvalho de Melo nor Conectiva, Inc. admit liability nor
* provide warranty for any of this software. This material is provided * provide warranty for any of this software. This material is provided
* "AS-IS" and at no charge. * "AS-IS" and at no charge.
...@@ -371,6 +371,7 @@ static void __ipxitf_down(struct ipx_interface *intrfc) ...@@ -371,6 +371,7 @@ static void __ipxitf_down(struct ipx_interface *intrfc)
if (intrfc->if_dev) if (intrfc->if_dev)
dev_put(intrfc->if_dev); dev_put(intrfc->if_dev);
kfree(intrfc); kfree(intrfc);
module_put(THIS_MODULE);
} }
static void ipxitf_down(struct ipx_interface *intrfc) static void ipxitf_down(struct ipx_interface *intrfc)
...@@ -936,6 +937,7 @@ static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum, ...@@ -936,6 +937,7 @@ static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum,
intrfc->if_sklist = NULL; intrfc->if_sklist = NULL;
atomic_set(&intrfc->refcnt, 1); atomic_set(&intrfc->refcnt, 1);
spin_lock_init(&intrfc->if_sklist_lock); spin_lock_init(&intrfc->if_sklist_lock);
__module_get(THIS_MODULE);
} }
return intrfc; return intrfc;
...@@ -2260,9 +2262,9 @@ extern void destroy_8023_client(struct datalink_proto *); ...@@ -2260,9 +2262,9 @@ extern void destroy_8023_client(struct datalink_proto *);
static unsigned char ipx_8022_type = 0xE0; static unsigned char ipx_8022_type = 0xE0;
static unsigned char ipx_snap_id[5] = { 0x0, 0x0, 0x0, 0x81, 0x37 }; static unsigned char ipx_snap_id[5] = { 0x0, 0x0, 0x0, 0x81, 0x37 };
static char ipx_banner[] __initdata = static char ipx_banner[] __initdata =
KERN_INFO "NET4: Linux IPX 0.50 for NET4.0\n" KERN_INFO "NET4: Linux IPX 0.51 for NET4.0\n"
KERN_INFO "IPX Portions Copyright (c) 1995 Caldera, Inc.\n" \ KERN_INFO "IPX Portions Copyright (c) 1995 Caldera, Inc.\n" \
KERN_INFO "IPX Portions Copyright (c) 2000-2002 Conectiva, Inc.\n"; KERN_INFO "IPX Portions Copyright (c) 2000-2003 Conectiva, Inc.\n";
static char ipx_EII_err_msg[] __initdata = static char ipx_EII_err_msg[] __initdata =
KERN_CRIT "IPX: Unable to register with Ethernet II\n"; KERN_CRIT "IPX: Unable to register with Ethernet II\n";
static char ipx_8023_err_msg[] __initdata = static char ipx_8023_err_msg[] __initdata =
...@@ -2310,6 +2312,10 @@ static void __exit ipx_proto_finito(void) ...@@ -2310,6 +2312,10 @@ static void __exit ipx_proto_finito(void)
* when a interface is created we increment the module usage count, so * when a interface is created we increment the module usage count, so
* the module will only be unloaded when there are no more interfaces * the module will only be unloaded when there are no more interfaces
*/ */
if (unlikely(!list_empty(&ipx_interfaces)))
BUG();
if (unlikely(!list_empty(&ipx_routes)))
BUG();
ipx_proc_exit(); ipx_proc_exit();
ipx_unregister_sysctl(); ipx_unregister_sysctl();
......
...@@ -509,7 +509,6 @@ static void sch_atm_dequeue(unsigned long data) ...@@ -509,7 +509,6 @@ static void sch_atm_dequeue(unsigned long data)
memcpy(skb_push(skb,flow->hdr_len),flow->hdr, memcpy(skb_push(skb,flow->hdr_len),flow->hdr,
flow->hdr_len); flow->hdr_len);
atomic_add(skb->truesize,&flow->vcc->sk->wmem_alloc); atomic_add(skb->truesize,&flow->vcc->sk->wmem_alloc);
ATM_SKB(skb)->iovcnt = 0;
/* atm.atm_options are already set by atm_tc_enqueue */ /* atm.atm_options are already set by atm_tc_enqueue */
(void) flow->vcc->send(flow->vcc,skb); (void) flow->vcc->send(flow->vcc,skb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment