diff -ur --new-file old/linux/drivers/atm/eni.c new/linux/drivers/atm/eni.c --- old/linux/drivers/atm/eni.c Wed Dec 1 03:48:08 1999 +++ new/linux/drivers/atm/eni.c Wed Dec 1 03:49:36 1999 @@ -1151,7 +1151,8 @@ if (tx->send) while ((skb = skb_dequeue(&tx->backlog))) { res = do_tx(skb); - if (res != enq_ok) { + if (res == enq_ok) tx->backlog_len--; + else { DPRINTK("re-queuing TX PDU\n"); skb_queue_head(&tx->backlog,skb); requeued++; @@ -1287,6 +1288,7 @@ tx->send = mem; tx->words = size >> 2; skb_queue_head_init(&tx->backlog); + tx->backlog_len = 0; for (order = 0; size > (1 << (order+10)); order++); eni_out((order << MID_SIZE_SHIFT) | ((tx->send-eni_dev->ram) >> (MID_LOC_SKIP+2)), @@ -2012,7 +2014,8 @@ cli(); /* brute force */ if (skb_peek(&ENI_VCC(vcc)->tx->backlog) || do_tx(skb)) { skb_queue_tail(&ENI_VCC(vcc)->tx->backlog,skb); - backlogged++; + ENI_VCC(vcc)->tx->backlog_len++; +backlogged++; } restore_flags(flags); return 0; @@ -2101,13 +2104,17 @@ struct eni_tx *tx = eni_dev->tx+i; if (!tx->send) continue; + if (!--left) { + return sprintf(page,"tx[%d]: 0x%06lx-0x%06lx " + "(%6ld bytes), rsv %d cps, shp %d cps%s\n",i, + tx->send-eni_dev->ram, + tx->send-eni_dev->ram+tx->words*4-1,tx->words*4, + tx->reserved,tx->shaping, + tx == eni_dev->ubr ? " (UBR)" : ""); + } if (--left) continue; - return sprintf(page,"tx[%d]: 0x%06lx-0x%06lx (%6ld bytes), " - "rsv %d cps, shp %d cps%s\n",i, - tx->send-eni_dev->ram, - tx->send-eni_dev->ram+tx->words*4-1,tx->words*4, - tx->reserved,tx->shaping, - tx == eni_dev->ubr ? " (UBR)" : ""); + return sprintf(page,"%10sbacklog %d bytes\n","", + tx->backlog_len); } for (vcc = dev->vccs; vcc; vcc = vcc->next) { struct eni_vcc *eni_vcc = ENI_VCC(vcc); @@ -2124,8 +2131,8 @@ if (eni_vcc->tx) length += sprintf(page+length,", "); } if (eni_vcc->tx) - length += sprintf(page+length,"tx[%d]", - eni_vcc->tx->index); + length += sprintf(page+length,"tx[%d], txing %d bytes", + eni_vcc->tx->index,eni_vcc->txing); page[length] = '\n'; return length+1; } diff -ur --new-file old/linux/drivers/atm/zatm.c new/linux/drivers/atm/zatm.c --- old/linux/drivers/atm/zatm.c Wed Dec 1 03:48:09 1999 +++ new/linux/drivers/atm/zatm.c Wed Dec 1 03:49:36 1999 @@ -729,9 +729,6 @@ zpokel(zatm_dev,(zpeekl(zatm_dev,pos) & ~(0xffff << shift)) | ((zatm_vcc->rx_chan | uPD98401_RXLT_ENBL) << shift),pos); restore_flags(flags); -/* Ugly hack to ensure that ttcp_atm will work with the current allocation - scheme. @@@ */ -if (vcc->rx_quota < 200000) vcc->rx_quota = 200000; return 0; } diff -ur --new-file old/linux/include/linux/atmapi.h new/linux/include/linux/atmapi.h --- old/linux/include/linux/atmapi.h Wed Dec 1 03:48:09 1999 +++ new/linux/include/linux/atmapi.h Wed Dec 1 03:49:36 1999 @@ -7,10 +7,16 @@ #define _LINUX_ATMAPI_H #ifdef __sparc_v9__ -#define __ATM_API_ALIGN __attribute__((aligned(8))) +typedef unsigned long atm_kptr_int_t; +#else typedef unsigned long long atm_kptr_int_t; +#endif + +#ifdef __sparc__ +/* such alignment is not required on 32 bit sparcs, but we can't + figure that we are on a sparc64 while compiling user-space programs. */ +#define __ATM_API_ALIGN __attribute__((aligned(8))) #else -typedef unsigned long atm_kptr_int_t; #define __ATM_API_ALIGN #endif diff -ur --new-file old/linux/include/linux/atmdev.h new/linux/include/linux/atmdev.h --- old/linux/include/linux/atmdev.h Wed Dec 1 03:48:09 1999 +++ new/linux/include/linux/atmdev.h Wed Dec 1 03:49:36 1999 @@ -9,6 +9,7 @@ #include #include +#include #include @@ -124,6 +125,12 @@ #define ATM_VS2TXT_MAP \ "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" +#define ATM_VF2TXT_MAP \ + "ADDR", "READY", "PARTIAL", "REGIS", \ + "RELEASED", "HASQOS", "LISTEN", "META", \ + "256", "512", "1024", "2048", \ + "SESSION", "HASSAP", "BOUND", "CLOSE" + #ifdef __KERNEL__ @@ -133,6 +140,7 @@ #include /* struct sk_buff */ #include #include +#include #include #ifdef CONFIG_PROC_FS @@ -157,10 +165,10 @@ #define ATM_VF_META 128 /* SVC socket isn't used for normal data traffic and doesn't depend on signaling to be available */ -#define ATM_VF_AQREL 256 /* Arequipa VC is being released */ -#define ATM_VF_AQDANG 512 /* VC is in Arequipa's dangling list */ -#define ATM_VF_SCRX ATM_SC_RX /* 1024; allow single-copy in the RX dir. */ -#define ATM_VF_SCTX ATM_SC_TX /* 2048; allow single-copy in the TX dir. */ + /* 256; unused */ + /* 512; unused */ + /* 1024; unused */ + /* 2048; unused */ #define ATM_VF_SESSION 4096 /* VCC is p2mp session control descriptor */ #define ATM_VF_HASSAP 8192 /* SAP has been set */ #define ATM_VF_CLOSE 32768 /* asynchronous close - treat like VF_RELEASED*/ @@ -192,7 +200,6 @@ struct atm_dev *dev; /* device back pointer */ struct atm_qos qos; /* QOS */ struct atm_sap sap; /* SAP */ - unsigned long tx_quota,rx_quota; /* buffer quotas */ atomic_t tx_inuse,rx_inuse; /* buffer space in use */ void (*push)(struct atm_vcc *vcc,struct sk_buff *skb); void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */ @@ -208,6 +215,7 @@ struct atm_aal_stats *stats; /* pointer to AAL stats group */ wait_queue_head_t sleep; /* if socket is busy */ wait_queue_head_t wsleep; /* if waiting for write buffer space */ + struct sock *sk; /* socket backpointer */ struct atm_vcc *prev,*next; /* SVC part --- may move later ------------------------------------- */ short itf; /* interface number */ @@ -221,7 +229,9 @@ /* Multipoint part ------------------------------------------------- */ struct atm_vcc *session; /* session VCC descriptor */ /* Other stuff ----------------------------------------------------- */ - void *user_back; /* user backlink - not touched */ + void *user_back; /* user backlink - not touched by */ + /* native ATM stack. Currently used */ + /* by CLIP and sch_atm. */ }; @@ -336,6 +346,12 @@ static __inline__ void atm_return(struct atm_vcc *vcc,int truesize) { atomic_sub(truesize+ATM_PDU_OVHD,&vcc->rx_inuse); +} + + +static __inline__ int atm_may_send(struct atm_vcc *vcc,unsigned int size) +{ + return size+atomic_read(&vcc->tx_inuse)+ATM_PDU_OVHD < vcc->sk->sndbuf; } diff -ur --new-file old/linux/include/net/atmclip.h new/linux/include/net/atmclip.h --- old/linux/include/net/atmclip.h Fri Nov 12 20:30:01 1999 +++ new/linux/include/net/atmclip.h Wed Dec 1 03:49:36 1999 @@ -1,6 +1,6 @@ /* net/atm/atmarp.h - RFC1577 ATM ARP */ -/* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */ +/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ #ifndef _ATMCLIP_H @@ -26,7 +26,9 @@ unsigned long last_use; /* last send or receive operation */ unsigned long idle_timeout; /* keep open idle for so many jiffies*/ void (*old_push)(struct atm_vcc *vcc,struct sk_buff *skb); - /* keep old push fn for detaching */ + /* keep old push fn for chaining */ + void (*old_pop)(struct atm_vcc *vcc,struct sk_buff *skb); + /* keep old pop fn for chaining */ struct clip_vcc *next; /* next VCC */ }; diff -ur --new-file old/linux/net/atm/atm_misc.c new/linux/net/atm/atm_misc.c --- old/linux/net/atm/atm_misc.c Wed Sep 8 20:14:32 1999 +++ new/linux/net/atm/atm_misc.c Wed Dec 1 03:49:36 1999 @@ -10,13 +10,11 @@ #include #include -#include "tunable.h" - int atm_charge(struct atm_vcc *vcc,int truesize) { atm_force_charge(vcc,truesize); - if (atomic_read(&vcc->rx_inuse) <= vcc->rx_quota) return 1; + if (atomic_read(&vcc->rx_inuse) <= vcc->sk->rcvbuf) return 1; atm_return(vcc,truesize); vcc->stats->rx_drop++; return 0; @@ -29,7 +27,7 @@ int guess = atm_guess_pdu2truesize(pdu_size); atm_force_charge(vcc,guess); - if (atomic_read(&vcc->rx_inuse) <= vcc->rx_quota) { + if (atomic_read(&vcc->rx_inuse) <= vcc->sk->rcvbu .