Commit d5eb4faf authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

[ATM]: assorted atm patches

parent b4ad7122
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
4096 supported 'connections' 4096 supported 'connections'
group 0 is used for all traffic group 0 is used for all traffic
interrupt queue 0 is used for all interrupts interrupt queue 0 is used for all interrupts
aal0 support for receive only aal0 support (based on work from ulrich.u.muller@nokia.com)
*/ */
...@@ -114,16 +114,13 @@ void sn_delete_polled_interrupt(int irq); ...@@ -114,16 +114,13 @@ void sn_delete_polled_interrupt(int irq);
#include <linux/atm_he.h> #include <linux/atm_he.h>
#define hprintk(fmt,args...) printk(DEV_LABEL "%d: " fmt, he_dev->number, args) #define hprintk(fmt,args...) printk(KERN_ERR DEV_LABEL "%d: " fmt, he_dev->number, ##args)
#define hprintk1(fmt) printk(DEV_LABEL "%d: " fmt, he_dev->number)
#undef DEBUG #undef DEBUG
#ifdef DEBUG #ifdef DEBUG
#define HPRINTK(fmt,args...) hprintk(fmt,args) #define HPRINTK(fmt,args...) hprintk(fmt,args)
#define HPRINTK1(fmt) hprintk1(fmt)
#else #else
#define HPRINTK(fmt,args...) #define HPRINTK(fmt,args...) do { } while(0)
#define HPRINTK1(fmt,args...)
#endif /* DEBUG */ #endif /* DEBUG */
...@@ -131,10 +128,6 @@ void sn_delete_polled_interrupt(int irq); ...@@ -131,10 +128,6 @@ void sn_delete_polled_interrupt(int irq);
static char *version = "$Id: he.c,v 1.18 2003/05/06 22:57:15 chas Exp $"; static char *version = "$Id: he.c,v 1.18 2003/05/06 22:57:15 chas Exp $";
/* defines */
#define ALIGN_ADDRESS(addr, alignment) \
((((unsigned long) (addr)) + (((unsigned long) (alignment)) - 1)) & ~(((unsigned long) (alignment)) - 1))
/* declarations */ /* declarations */
static int he_open(struct atm_vcc *vcc, short vpi, int vci); static int he_open(struct atm_vcc *vcc, short vpi, int vci);
...@@ -555,7 +548,7 @@ he_init_tpdrq(struct he_dev *he_dev) ...@@ -555,7 +548,7 @@ he_init_tpdrq(struct he_dev *he_dev)
CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), &he_dev->tpdrq_phys); CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), &he_dev->tpdrq_phys);
if (he_dev->tpdrq_base == NULL) if (he_dev->tpdrq_base == NULL)
{ {
hprintk1("failed to alloc tpdrq\n"); hprintk("failed to alloc tpdrq\n");
return -ENOMEM; return -ENOMEM;
} }
memset(he_dev->tpdrq_base, 0, memset(he_dev->tpdrq_base, 0,
...@@ -799,14 +792,14 @@ he_init_group(struct he_dev *he_dev, int group) ...@@ -799,14 +792,14 @@ he_init_group(struct he_dev *he_dev, int group)
#endif #endif
if (he_dev->rbps_pool == NULL) if (he_dev->rbps_pool == NULL)
{ {
hprintk1("unable to create rbps pages\n"); hprintk("unable to create rbps pages\n");
return -ENOMEM; return -ENOMEM;
} }
#else /* !USE_RBPS_POOL */ #else /* !USE_RBPS_POOL */
he_dev->rbps_pages = pci_alloc_consistent(he_dev->pci_dev, he_dev->rbps_pages = pci_alloc_consistent(he_dev->pci_dev,
CONFIG_RBPS_SIZE * CONFIG_RBPS_BUFSIZE, &he_dev->rbps_pages_phys); CONFIG_RBPS_SIZE * CONFIG_RBPS_BUFSIZE, &he_dev->rbps_pages_phys);
if (he_dev->rbps_pages == NULL) { if (he_dev->rbps_pages == NULL) {
hprintk1("unable to create rbps page pool\n"); hprintk("unable to create rbps page pool\n");
return -ENOMEM; return -ENOMEM;
} }
#endif /* USE_RBPS_POOL */ #endif /* USE_RBPS_POOL */
...@@ -815,7 +808,7 @@ he_init_group(struct he_dev *he_dev, int group) ...@@ -815,7 +808,7 @@ he_init_group(struct he_dev *he_dev, int group)
CONFIG_RBPS_SIZE * sizeof(struct he_rbp), &he_dev->rbps_phys); CONFIG_RBPS_SIZE * sizeof(struct he_rbp), &he_dev->rbps_phys);
if (he_dev->rbps_base == NULL) if (he_dev->rbps_base == NULL)
{ {
hprintk1("failed to alloc rbps\n"); hprintk("failed to alloc rbps\n");
return -ENOMEM; return -ENOMEM;
} }
memset(he_dev->rbps_base, 0, CONFIG_RBPS_SIZE * sizeof(struct he_rbp)); memset(he_dev->rbps_base, 0, CONFIG_RBPS_SIZE * sizeof(struct he_rbp));
...@@ -871,7 +864,7 @@ he_init_group(struct he_dev *he_dev, int group) ...@@ -871,7 +864,7 @@ he_init_group(struct he_dev *he_dev, int group)
#endif #endif
if (he_dev->rbpl_pool == NULL) if (he_dev->rbpl_pool == NULL)
{ {
hprintk1("unable to create rbpl pool\n"); hprintk("unable to create rbpl pool\n");
return -ENOMEM; return -ENOMEM;
} }
#else /* !USE_RBPL_POOL */ #else /* !USE_RBPL_POOL */
...@@ -879,7 +872,7 @@ he_init_group(struct he_dev *he_dev, int group) ...@@ -879,7 +872,7 @@ he_init_group(struct he_dev *he_dev, int group)
CONFIG_RBPL_SIZE * CONFIG_RBPL_BUFSIZE, &he_dev->rbpl_pages_phys); CONFIG_RBPL_SIZE * CONFIG_RBPL_BUFSIZE, &he_dev->rbpl_pages_phys);
if (he_dev->rbpl_pages == NULL) if (he_dev->rbpl_pages == NULL)
{ {
hprintk1("unable to create rbpl pages\n"); hprintk("unable to create rbpl pages\n");
return -ENOMEM; return -ENOMEM;
} }
#endif /* USE_RBPL_POOL */ #endif /* USE_RBPL_POOL */
...@@ -888,7 +881,7 @@ he_init_group(struct he_dev *he_dev, int group) ...@@ -888,7 +881,7 @@ he_init_group(struct he_dev *he_dev, int group)
CONFIG_RBPL_SIZE * sizeof(struct he_rbp), &he_dev->rbpl_phys); CONFIG_RBPL_SIZE * sizeof(struct he_rbp), &he_dev->rbpl_phys);
if (he_dev->rbpl_base == NULL) if (he_dev->rbpl_base == NULL)
{ {
hprintk1("failed to alloc rbpl\n"); hprintk("failed to alloc rbpl\n");
return -ENOMEM; return -ENOMEM;
} }
memset(he_dev->rbpl_base, 0, CONFIG_RBPL_SIZE * sizeof(struct he_rbp)); memset(he_dev->rbpl_base, 0, CONFIG_RBPL_SIZE * sizeof(struct he_rbp));
...@@ -932,7 +925,7 @@ he_init_group(struct he_dev *he_dev, int group) ...@@ -932,7 +925,7 @@ he_init_group(struct he_dev *he_dev, int group)
CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), &he_dev->rbrq_phys); CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), &he_dev->rbrq_phys);
if (he_dev->rbrq_base == NULL) if (he_dev->rbrq_base == NULL)
{ {
hprintk1("failed to allocate rbrq\n"); hprintk("failed to allocate rbrq\n");
return -ENOMEM; return -ENOMEM;
} }
memset(he_dev->rbrq_base, 0, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq)); memset(he_dev->rbrq_base, 0, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq));
...@@ -945,7 +938,7 @@ he_init_group(struct he_dev *he_dev, int group) ...@@ -945,7 +938,7 @@ he_init_group(struct he_dev *he_dev, int group)
G0_RBRQ_Q + (group * 16)); G0_RBRQ_Q + (group * 16));
if (irq_coalesce) if (irq_coalesce)
{ {
hprintk1("coalescing interrupts\n"); hprintk("coalescing interrupts\n");
he_writel(he_dev, RBRQ_TIME(768) | RBRQ_COUNT(7), he_writel(he_dev, RBRQ_TIME(768) | RBRQ_COUNT(7),
G0_RBRQ_I + (group * 16)); G0_RBRQ_I + (group * 16));
} }
...@@ -959,7 +952,7 @@ he_init_group(struct he_dev *he_dev, int group) ...@@ -959,7 +952,7 @@ he_init_group(struct he_dev *he_dev, int group)
CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), &he_dev->tbrq_phys); CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), &he_dev->tbrq_phys);
if (he_dev->tbrq_base == NULL) if (he_dev->tbrq_base == NULL)
{ {
hprintk1("failed to allocate tbrq\n"); hprintk("failed to allocate tbrq\n");
return -ENOMEM; return -ENOMEM;
} }
memset(he_dev->tbrq_base, 0, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq)); memset(he_dev->tbrq_base, 0, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq));
...@@ -986,7 +979,7 @@ he_init_irq(struct he_dev *he_dev) ...@@ -986,7 +979,7 @@ he_init_irq(struct he_dev *he_dev)
(CONFIG_IRQ_SIZE+1) * sizeof(struct he_irq), &he_dev->irq_phys); (CONFIG_IRQ_SIZE+1) * sizeof(struct he_irq), &he_dev->irq_phys);
if (he_dev->irq_base == NULL) if (he_dev->irq_base == NULL)
{ {
hprintk1("failed to allocate irq\n"); hprintk("failed to allocate irq\n");
return -ENOMEM; return -ENOMEM;
} }
he_dev->irq_tailoffset = (unsigned *) he_dev->irq_tailoffset = (unsigned *)
...@@ -1074,32 +1067,32 @@ he_start(struct atm_dev *dev) ...@@ -1074,32 +1067,32 @@ he_start(struct atm_dev *dev)
/* 4.3 pci bus controller-specific initialization */ /* 4.3 pci bus controller-specific initialization */
if (pci_read_config_dword(pci_dev, GEN_CNTL_0, &gen_cntl_0) != 0) if (pci_read_config_dword(pci_dev, GEN_CNTL_0, &gen_cntl_0) != 0)
{ {
hprintk1("can't read GEN_CNTL_0\n"); hprintk("can't read GEN_CNTL_0\n");
return -EINVAL; return -EINVAL;
} }
gen_cntl_0 |= (MRL_ENB | MRM_ENB | IGNORE_TIMEOUT); gen_cntl_0 |= (MRL_ENB | MRM_ENB | IGNORE_TIMEOUT);
if (pci_write_config_dword(pci_dev, GEN_CNTL_0, gen_cntl_0) != 0) if (pci_write_config_dword(pci_dev, GEN_CNTL_0, gen_cntl_0) != 0)
{ {
hprintk1("can't write GEN_CNTL_0.\n"); hprintk("can't write GEN_CNTL_0.\n");
return -EINVAL; return -EINVAL;
} }
if (pci_read_config_word(pci_dev, PCI_COMMAND, &command) != 0) if (pci_read_config_word(pci_dev, PCI_COMMAND, &command) != 0)
{ {
hprintk1("can't read PCI_COMMAND.\n"); hprintk("can't read PCI_COMMAND.\n");
return -EINVAL; return -EINVAL;
} }
command |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE); command |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
if (pci_write_config_word(pci_dev, PCI_COMMAND, command) != 0) if (pci_write_config_word(pci_dev, PCI_COMMAND, command) != 0)
{ {
hprintk1("can't enable memory.\n"); hprintk("can't enable memory.\n");
return -EINVAL; return -EINVAL;
} }
if (pci_read_config_byte(pci_dev, PCI_CACHE_LINE_SIZE, &cache_size)) if (pci_read_config_byte(pci_dev, PCI_CACHE_LINE_SIZE, &cache_size))
{ {
hprintk1("can't read cache line size?\n"); hprintk("can't read cache line size?\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1112,7 +1105,7 @@ he_start(struct atm_dev *dev) ...@@ -1112,7 +1105,7 @@ he_start(struct atm_dev *dev)
if (pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &timer)) if (pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &timer))
{ {
hprintk1("can't read latency timer?\n"); hprintk("can't read latency timer?\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1134,7 +1127,7 @@ he_start(struct atm_dev *dev) ...@@ -1134,7 +1127,7 @@ he_start(struct atm_dev *dev)
} }
if (!(he_dev->membase = (unsigned long) ioremap(he_dev->membase, HE_REGMAP_SIZE))) { if (!(he_dev->membase = (unsigned long) ioremap(he_dev->membase, HE_REGMAP_SIZE))) {
hprintk1("can't set up page mapping\n"); hprintk("can't set up page mapping\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1146,7 +1139,7 @@ he_start(struct atm_dev *dev) ...@@ -1146,7 +1139,7 @@ he_start(struct atm_dev *dev)
status = he_readl(he_dev, RESET_CNTL); status = he_readl(he_dev, RESET_CNTL);
if ((status & BOARD_RST_STATUS) == 0) if ((status & BOARD_RST_STATUS) == 0)
{ {
hprintk1("reset failed\n"); hprintk("reset failed\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1159,11 +1152,11 @@ he_start(struct atm_dev *dev) ...@@ -1159,11 +1152,11 @@ he_start(struct atm_dev *dev)
if (disable64 == 1) if (disable64 == 1)
{ {
hprintk1("disabling 64-bit pci bus transfers\n"); hprintk("disabling 64-bit pci bus transfers\n");
gen_cntl_0 &= ~ENBL_64; gen_cntl_0 &= ~ENBL_64;
} }
if (gen_cntl_0 & ENBL_64) hprintk1("64-bit transfers enabled\n"); if (gen_cntl_0 & ENBL_64) hprintk("64-bit transfers enabled\n");
pci_write_config_dword(pci_dev, GEN_CNTL_0, gen_cntl_0); pci_write_config_dword(pci_dev, GEN_CNTL_0, gen_cntl_0);
...@@ -1535,7 +1528,7 @@ he_start(struct atm_dev *dev) ...@@ -1535,7 +1528,7 @@ he_start(struct atm_dev *dev)
#endif #endif
if (he_dev->tpd_pool == NULL) if (he_dev->tpd_pool == NULL)
{ {
hprintk1("unable to create tpd pci_pool\n"); hprintk("unable to create tpd pci_pool\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -1592,7 +1585,7 @@ he_start(struct atm_dev *dev) ...@@ -1592,7 +1585,7 @@ he_start(struct atm_dev *dev)
sizeof(struct he_hsp), &he_dev->hsp_phys); sizeof(struct he_hsp), &he_dev->hsp_phys);
if (he_dev->hsp == NULL) if (he_dev->hsp == NULL)
{ {
hprintk1("failed to allocate host status page\n"); hprintk("failed to allocate host status page\n");
return -ENOMEM; return -ENOMEM;
} }
memset(he_dev->hsp, 0, sizeof(struct he_hsp)); memset(he_dev->hsp, 0, sizeof(struct he_hsp));
...@@ -1632,7 +1625,7 @@ he_start(struct atm_dev *dev) ...@@ -1632,7 +1625,7 @@ he_start(struct atm_dev *dev)
(1 << (he_dev->vcibits + he_dev->vpibits)), GFP_KERNEL); (1 << (he_dev->vcibits + he_dev->vpibits)), GFP_KERNEL);
if (he_dev->he_vcc_table == NULL) if (he_dev->he_vcc_table == NULL)
{ {
hprintk1("failed to alloc he_vcc_table\n"); hprintk("failed to alloc he_vcc_table\n");
return -ENOMEM; return -ENOMEM;
} }
memset(he_dev->he_vcc_table, 0, sizeof(struct he_vcc_table) * memset(he_dev->he_vcc_table, 0, sizeof(struct he_vcc_table) *
...@@ -1868,7 +1861,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) ...@@ -1868,7 +1861,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
struct sk_buff *skb; struct sk_buff *skb;
struct atm_vcc *vcc = NULL; struct atm_vcc *vcc = NULL;
struct he_vcc *he_vcc; struct he_vcc *he_vcc;
struct iovec *iov; struct he_iovec *iov;
int pdus_assembled = 0; int pdus_assembled = 0;
int updated = 0; int updated = 0;
...@@ -1934,7 +1927,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) ...@@ -1934,7 +1927,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
goto return_host_buffers; goto return_host_buffers;
} }
he_vcc->iov_tail->iov_base = (void *) RBRQ_ADDR(he_dev->rbrq_head); he_vcc->iov_tail->iov_base = RBRQ_ADDR(he_dev->rbrq_head);
he_vcc->iov_tail->iov_len = buf_len; he_vcc->iov_tail->iov_len = buf_len;
he_vcc->pdu_len += buf_len; he_vcc->pdu_len += buf_len;
++he_vcc->iov_tail; ++he_vcc->iov_tail;
...@@ -1948,7 +1941,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) ...@@ -1948,7 +1941,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
} }
#ifdef notdef #ifdef notdef
if (he_vcc->iov_tail - he_vcc->iov_head > 32) if ((he_vcc->iov_tail - he_vcc->iov_head) > HE_MAXIOV)
{ {
hprintk("iovec full! cid 0x%x\n", cid); hprintk("iovec full! cid 0x%x\n", cid);
goto return_host_buffers; goto return_host_buffers;
...@@ -2000,7 +1993,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) ...@@ -2000,7 +1993,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
iov < he_vcc->iov_tail; ++iov) iov < he_vcc->iov_tail; ++iov)
{ {
#ifdef USE_RBPS #ifdef USE_RBPS
if ((u32)iov->iov_base & RBP_SMALLBUF) if (iov->iov_base & RBP_SMALLBUF)
memcpy(skb_put(skb, iov->iov_len), memcpy(skb_put(skb, iov->iov_len),
he_dev->rbps_virt[RBP_INDEX(iov->iov_base)].virt, iov->iov_len); he_dev->rbps_virt[RBP_INDEX(iov->iov_base)].virt, iov->iov_len);
else else
...@@ -2055,7 +2048,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) ...@@ -2055,7 +2048,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
iov < he_vcc->iov_tail; ++iov) iov < he_vcc->iov_tail; ++iov)
{ {
#ifdef USE_RBPS #ifdef USE_RBPS
if ((u32)iov->iov_base & RBP_SMALLBUF) if (iov->iov_base & RBP_SMALLBUF)
rbp = &he_dev->rbps_base[RBP_INDEX(iov->iov_base)]; rbp = &he_dev->rbps_base[RBP_INDEX(iov->iov_base)];
else else
#endif #endif
...@@ -2309,13 +2302,13 @@ he_tasklet(unsigned long data) ...@@ -2309,13 +2302,13 @@ he_tasklet(unsigned long data)
he_dev->atm_dev->phy->interrupt(he_dev->atm_dev); he_dev->atm_dev->phy->interrupt(he_dev->atm_dev);
HE_SPIN_LOCK(he_dev, flags); HE_SPIN_LOCK(he_dev, flags);
#endif #endif
HPRINTK1("phy interrupt\n"); HPRINTK("phy interrupt\n");
break; break;
case ITYPE_OTHER: case ITYPE_OTHER:
switch (type|group) switch (type|group)
{ {
case ITYPE_PARITY: case ITYPE_PARITY:
hprintk1("parity error\n"); hprintk("parity error\n");
break; break;
case ITYPE_ABORT: case ITYPE_ABORT:
hprintk("abort 0x%x\n", he_readl(he_dev, ABORT_ADDR)); hprintk("abort 0x%x\n", he_readl(he_dev, ABORT_ADDR));
...@@ -2387,7 +2380,7 @@ he_irq_handler(int irq, void *dev_id, struct pt_regs *regs) ...@@ -2387,7 +2380,7 @@ he_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
if (he_dev->irq_tail == he_dev->irq_head) if (he_dev->irq_tail == he_dev->irq_head)
{ {
HPRINTK1("tailoffset not updated?\n"); HPRINTK("tailoffset not updated?\n");
he_dev->irq_tail = (struct he_irq *) ((unsigned long)he_dev->irq_base | he_dev->irq_tail = (struct he_irq *) ((unsigned long)he_dev->irq_base |
((he_readl(he_dev, IRQ0_BASE) & IRQ_MASK) << 2)); ((he_readl(he_dev, IRQ0_BASE) & IRQ_MASK) << 2));
(void) he_readl(he_dev, INT_FIFO); /* 8.1.2 controller errata */ (void) he_readl(he_dev, INT_FIFO); /* 8.1.2 controller errata */
...@@ -2395,7 +2388,7 @@ he_irq_handler(int irq, void *dev_id, struct pt_regs *regs) ...@@ -2395,7 +2388,7 @@ he_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
#ifdef DEBUG #ifdef DEBUG
if (he_dev->irq_head == he_dev->irq_tail /* && !IRQ_PENDING */) if (he_dev->irq_head == he_dev->irq_tail /* && !IRQ_PENDING */)
hprintk1("spurious (or shared) interrupt?\n"); hprintk("spurious (or shared) interrupt?\n");
#endif #endif
if (he_dev->irq_head != he_dev->irq_tail) if (he_dev->irq_head != he_dev->irq_tail)
...@@ -2527,7 +2520,7 @@ he_open(struct atm_vcc *vcc, short vpi, int vci) ...@@ -2527,7 +2520,7 @@ he_open(struct atm_vcc *vcc, short vpi, int vci)
he_vcc = (struct he_vcc *) kmalloc(sizeof(struct he_vcc), GFP_ATOMIC); he_vcc = (struct he_vcc *) kmalloc(sizeof(struct he_vcc), GFP_ATOMIC);
if (he_vcc == NULL) if (he_vcc == NULL)
{ {
hprintk1("unable to allocate he_vcc during open\n"); hprintk("unable to allocate he_vcc during open\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -2987,7 +2980,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -2987,7 +2980,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
#ifndef USE_SCATTERGATHER #ifndef USE_SCATTERGATHER
if (skb_shinfo(skb)->nr_frags) if (skb_shinfo(skb)->nr_frags)
{ {
hprintk1("no scatter/gather support\n"); hprintk("no scatter/gather support\n");
if (vcc->pop) if (vcc->pop)
vcc->pop(vcc, skb); vcc->pop(vcc, skb);
else else
......
...@@ -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;
......
...@@ -2023,7 +2023,7 @@ idt77252_send_oam(struct atm_vcc *vcc, void *cell, int flags) ...@@ -2023,7 +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; ATM_SKB(skb)->iovcnt = 0;
memcpy(skb_put(skb, 52), cell, 52); memcpy(skb_put(skb, 52), cell, 52);
......
...@@ -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],
......
...@@ -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 *******************************************************************/
......
...@@ -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;
}; };
...@@ -421,19 +412,19 @@ static __inline__ int atm_guess_pdu2truesize(int pdu_size) ...@@ -421,19 +412,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);
} }
......
...@@ -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);
...@@ -412,13 +409,11 @@ int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, ...@@ -412,13 +409,11 @@ int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
el -= (iov->iov_len > el)?el:iov->iov_len; el -= (iov->iov_len > el)?el:iov->iov_len;
iov++; iov++;
} }
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;
} }
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 +445,7 @@ int atm_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, ...@@ -450,7 +445,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;
...@@ -502,8 +497,7 @@ unsigned int atm_poll(struct file *file,struct socket *sock,poll_table *wait) ...@@ -502,8 +497,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 +564,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg) ...@@ -570,7 +564,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:
......
...@@ -715,6 +715,7 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -715,6 +715,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);
} }
} }
......
...@@ -732,6 +732,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -732,6 +732,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 +864,7 @@ static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -863,7 +864,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");
......
...@@ -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;
......
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