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

[ATM]: Obsolete some atm_vcc members.

parent b8c86835
...@@ -277,7 +277,6 @@ enum { ...@@ -277,7 +277,6 @@ enum {
struct atm_vcc { struct atm_vcc {
unsigned long flags; /* VCC flags (ATM_VF_*) */ unsigned long flags; /* VCC flags (ATM_VF_*) */
unsigned char family; /* address family; 0 if unused */
short vpi; /* VPI and VCI (types must be equal */ short vpi; /* VPI and VCI (types must be equal */
/* with sockaddr) */ /* with sockaddr) */
int vci; int vci;
...@@ -286,7 +285,6 @@ struct atm_vcc { ...@@ -286,7 +285,6 @@ struct atm_vcc {
struct atm_dev *dev; /* device back pointer */ struct atm_dev *dev; /* device back pointer */
struct atm_qos qos; /* QOS */ struct atm_qos qos; /* QOS */
struct atm_sap sap; /* SAP */ struct atm_sap sap; /* SAP */
atomic_t tx_inuse,rx_inuse; /* buffer space in use */
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); struct sk_buff *(*alloc_tx)(struct atm_vcc *vcc,unsigned int size);
...@@ -297,7 +295,6 @@ struct atm_vcc { ...@@ -297,7 +295,6 @@ struct atm_vcc {
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 */
void *proto_data; /* per-protocol data */ void *proto_data; /* per-protocol data */
struct sk_buff_head recvq; /* receive queue */
struct k_atm_aal_stats *stats; /* pointer to AAL stats group */ struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
wait_queue_head_t sleep; /* if socket is busy */ wait_queue_head_t sleep; /* if socket is busy */
struct sock *sk; /* socket backpointer */ struct sock *sk; /* socket backpointer */
...@@ -346,7 +343,7 @@ struct atm_dev { ...@@ -346,7 +343,7 @@ struct atm_dev {
struct proc_dir_entry *proc_entry; /* proc entry */ struct proc_dir_entry *proc_entry; /* proc entry */
char *proc_name; /* proc entry name */ char *proc_name; /* proc entry name */
#endif #endif
struct atm_dev *prev,*next; /* linkage */ struct list_head dev_list; /* linkage */
}; };
...@@ -425,19 +422,19 @@ static __inline__ int atm_guess_pdu2truesize(int pdu_size) ...@@ -425,19 +422,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->rx_inuse); atomic_add(truesize+ATM_PDU_OVHD,&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->rx_inuse); atomic_sub(truesize+ATM_PDU_OVHD,&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->tx_inuse)+ATM_PDU_OVHD < vcc->sk->sndbuf; return size+atomic_read(&vcc->sk->wmem_alloc)+ATM_PDU_OVHD < vcc->sk->sndbuf;
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
int atm_charge(struct atm_vcc *vcc,int truesize) int atm_charge(struct atm_vcc *vcc,int truesize)
{ {
atm_force_charge(vcc,truesize); atm_force_charge(vcc,truesize);
if (atomic_read(&vcc->rx_inuse) <= vcc->sk->rcvbuf) return 1; if (atomic_read(&vcc->sk->rmem_alloc) <= vcc->sk->rcvbuf) return 1;
atm_return(vcc,truesize); atm_return(vcc,truesize);
atomic_inc(&vcc->stats->rx_drop); atomic_inc(&vcc->stats->rx_drop);
return 0; return 0;
...@@ -29,11 +29,11 @@ struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, ...@@ -29,11 +29,11 @@ struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
int guess = atm_guess_pdu2truesize(pdu_size); int guess = atm_guess_pdu2truesize(pdu_size);
atm_force_charge(vcc,guess); atm_force_charge(vcc,guess);
if (atomic_read(&vcc->rx_inuse) <= vcc->sk->rcvbuf) { if (atomic_read(&vcc->sk->rmem_alloc) <= vcc->sk->rcvbuf) {
struct sk_buff *skb = alloc_skb(pdu_size,gfp_flags); struct sk_buff *skb = alloc_skb(pdu_size,gfp_flags);
if (skb) { if (skb) {
atomic_add(skb->truesize-guess,&vcc->rx_inuse); atomic_add(skb->truesize-guess,&vcc->sk->rmem_alloc);
return skb; return skb;
} }
} }
......
...@@ -63,7 +63,7 @@ static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip) ...@@ -63,7 +63,7 @@ static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip)
ctrl->itf_num = itf; ctrl->itf_num = itf;
ctrl->ip = ip; ctrl->ip = ip;
atm_force_charge(atmarpd,skb->truesize); atm_force_charge(atmarpd,skb->truesize);
skb_queue_tail(&atmarpd->recvq,skb); skb_queue_tail(&atmarpd->sk->receive_queue,skb);
wake_up(&atmarpd->sleep); wake_up(&atmarpd->sleep);
return 0; return 0;
} }
...@@ -426,7 +426,7 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev) ...@@ -426,7 +426,7 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
memcpy(here,llc_oui,sizeof(llc_oui)); memcpy(here,llc_oui,sizeof(llc_oui));
((u16 *) here)[3] = skb->protocol; ((u16 *) here)[3] = skb->protocol;
} }
atomic_add(skb->truesize,&vcc->tx_inuse); atomic_add(skb->truesize,&vcc->sk->wmem_alloc);
ATM_SKB(skb)->iovcnt = 0; 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;
...@@ -485,7 +485,7 @@ int clip_mkip(struct atm_vcc *vcc,int timeout) ...@@ -485,7 +485,7 @@ int clip_mkip(struct atm_vcc *vcc,int timeout)
vcc->push = clip_push; vcc->push = clip_push;
vcc->pop = clip_pop; vcc->pop = clip_pop;
skb_queue_head_init(&copy); skb_queue_head_init(&copy);
skb_migrate(&vcc->recvq,&copy); skb_migrate(&vcc->sk->receive_queue,&copy);
/* re-process everything received between connection setup and MKIP */ /* re-process everything received between connection setup and MKIP */
while ((skb = skb_dequeue(&copy))) while ((skb = skb_dequeue(&copy)))
if (!clip_devs) { if (!clip_devs) {
...@@ -691,10 +691,10 @@ static void atmarpd_close(struct atm_vcc *vcc) ...@@ -691,10 +691,10 @@ static void atmarpd_close(struct atm_vcc *vcc)
barrier(); barrier();
unregister_inetaddr_notifier(&clip_inet_notifier); unregister_inetaddr_notifier(&clip_inet_notifier);
unregister_netdevice_notifier(&clip_dev_notifier); unregister_netdevice_notifier(&clip_dev_notifier);
if (skb_peek(&vcc->recvq)) if (skb_peek(&vcc->sk->receive_queue))
printk(KERN_ERR "atmarpd_close: closing with requests " printk(KERN_ERR "atmarpd_close: closing with requests "
"pending\n"); "pending\n");
skb_queue_purge(&vcc->recvq); skb_queue_purge(&vcc->sk->receive_queue);
DPRINTK("(done)\n"); DPRINTK("(done)\n");
} }
......
...@@ -85,14 +85,14 @@ static struct sk_buff *alloc_tx(struct atm_vcc *vcc,unsigned int size) ...@@ -85,14 +85,14 @@ static struct sk_buff *alloc_tx(struct atm_vcc *vcc,unsigned int size)
{ {
struct sk_buff *skb; struct sk_buff *skb;
if (atomic_read(&vcc->tx_inuse) && !atm_may_send(vcc,size)) { if (atomic_read(&vcc->sk->wmem_alloc) && !atm_may_send(vcc,size)) {
DPRINTK("Sorry: tx_inuse = %d, size = %d, sndbuf = %d\n", DPRINTK("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n",
atomic_read(&vcc->tx_inuse),size,vcc->sk->sndbuf); atomic_read(&vcc->sk->wmem_alloc),size,vcc->sk->sndbuf);
return NULL; return NULL;
} }
while (!(skb = alloc_skb(size,GFP_KERNEL))) schedule(); while (!(skb = alloc_skb(size,GFP_KERNEL))) schedule();
DPRINTK("AlTx %d += %d\n",atomic_read(&vcc->tx_inuse),skb->truesize); DPRINTK("AlTx %d += %d\n",atomic_read(&vcc->sk->wmem_alloc),skb->truesize);
atomic_add(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse); atomic_add(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc);
return skb; return skb;
} }
...@@ -108,21 +108,19 @@ int atm_create(struct socket *sock,int protocol,int family) ...@@ -108,21 +108,19 @@ 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->family = sock->ops->family;
vcc->alloc_tx = alloc_tx; 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));
vcc->qos.txtp.max_sdu = 1 << 16; /* for meta VCs */ vcc->qos.txtp.max_sdu = 1 << 16; /* for meta VCs */
atomic_set(&vcc->tx_inuse,0); atomic_set(&vcc->sk->wmem_alloc,0);
atomic_set(&vcc->rx_inuse,0); atomic_set(&vcc->sk->rmem_alloc,0);
vcc->push = NULL; vcc->push = NULL;
vcc->pop = NULL; vcc->pop = NULL;
vcc->push_oam = NULL; vcc->push_oam = NULL;
vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */ vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */
vcc->atm_options = vcc->aal_options = 0; vcc->atm_options = vcc->aal_options = 0;
init_waitqueue_head(&vcc->sleep); init_waitqueue_head(&vcc->sleep);
skb_queue_head_init(&vcc->recvq);
skb_queue_head_init(&vcc->listenq); skb_queue_head_init(&vcc->listenq);
sk->sleep = &vcc->sleep; sk->sleep = &vcc->sleep;
sock->sk = sk; sock->sk = sk;
...@@ -139,7 +137,7 @@ void atm_release_vcc_sk(struct sock *sk,int free_sk) ...@@ -139,7 +137,7 @@ void atm_release_vcc_sk(struct sock *sk,int free_sk)
if (vcc->dev) { if (vcc->dev) {
if (vcc->dev->ops->close) vcc->dev->ops->close(vcc); if (vcc->dev->ops->close) vcc->dev->ops->close(vcc);
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->recvq))) { 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) if (vcc->dev->ops->free_rx_skb)
vcc->dev->ops->free_rx_skb(vcc,skb); vcc->dev->ops->free_rx_skb(vcc,skb);
...@@ -147,10 +145,10 @@ void atm_release_vcc_sk(struct sock *sk,int free_sk) ...@@ -147,10 +145,10 @@ void atm_release_vcc_sk(struct sock *sk,int free_sk)
} }
spin_lock (&atm_dev_lock); spin_lock (&atm_dev_lock);
fops_put (vcc->dev->ops); fops_put (vcc->dev->ops);
if (atomic_read(&vcc->rx_inuse)) if (atomic_read(&vcc->sk->rmem_alloc))
printk(KERN_WARNING "atm_release_vcc: strange ... " printk(KERN_WARNING "atm_release_vcc: strange ... "
"rx_inuse == %d after closing\n", "rmem_alloc == %d after closing\n",
atomic_read(&vcc->rx_inuse)); atomic_read(&vcc->sk->rmem_alloc));
bind_vcc(vcc,NULL); bind_vcc(vcc,NULL);
} else } else
spin_lock (&atm_dev_lock); spin_lock (&atm_dev_lock);
...@@ -305,11 +303,15 @@ int atm_connect_vcc(struct atm_vcc *vcc,int itf,short vpi,int vci) ...@@ -305,11 +303,15 @@ int atm_connect_vcc(struct atm_vcc *vcc,int itf,short vpi,int vci)
if (error) return error; if (error) return error;
} }
else { else {
struct atm_dev *dev; struct atm_dev *dev = NULL;
struct list_head *p;
spin_lock (&atm_dev_lock); spin_lock (&atm_dev_lock);
for (dev = atm_devs; dev; dev = dev->next) list_for_each(p, &atm_devs) {
dev = list_entry(p, struct atm_dev, dev_list);
if (!atm_do_connect_dev(vcc,dev,vpi,vci)) break; if (!atm_do_connect_dev(vcc,dev,vpi,vci)) break;
dev = NULL;
}
spin_unlock (&atm_dev_lock); spin_unlock (&atm_dev_lock);
if (!dev) return -ENODEV; if (!dev) return -ENODEV;
} }
...@@ -354,7 +356,7 @@ int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, ...@@ -354,7 +356,7 @@ int atm_recvmsg(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 = 1; /* <= 0 is error */ error = 1; /* <= 0 is error */
while (!(skb = skb_dequeue(&vcc->recvq))) { while (!(skb = skb_dequeue(&vcc->sk->receive_queue))) {
if (test_bit(ATM_VF_RELEASED,&vcc->flags) || if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
test_bit(ATM_VF_CLOSE,&vcc->flags)) { test_bit(ATM_VF_CLOSE,&vcc->flags)) {
error = vcc->reply; error = vcc->reply;
...@@ -385,7 +387,7 @@ int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, ...@@ -385,7 +387,7 @@ int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
if (vcc->dev->ops->feedback) if (vcc->dev->ops->feedback)
vcc->dev->ops->feedback(vcc,skb,(unsigned long) skb->data, vcc->dev->ops->feedback(vcc,skb,(unsigned long) skb->data,
(unsigned long) buff,eff_len); (unsigned long) buff,eff_len);
DPRINTK("RcvM %d -= %d\n",atomic_read(&vcc->rx_inuse),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 */ if (ATM_SKB(skb)->iovcnt) { /* @@@ hack */
/* iovcnt set, use scatter-gather for receive */ /* iovcnt set, use scatter-gather for receive */
...@@ -488,14 +490,14 @@ unsigned int atm_poll(struct file *file,struct socket *sock,poll_table *wait) ...@@ -488,14 +490,14 @@ unsigned int atm_poll(struct file *file,struct socket *sock,poll_table *wait)
vcc = ATM_SD(sock); vcc = ATM_SD(sock);
poll_wait(file,&vcc->sleep,wait); poll_wait(file,&vcc->sleep,wait);
mask = 0; mask = 0;
if (skb_peek(&vcc->recvq) || skb_peek(&vcc->listenq)) if (skb_peek(&vcc->sk->receive_queue) || skb_peek(&vcc->listenq))
mask |= POLLIN | POLLRDNORM; mask |= POLLIN | POLLRDNORM;
if (test_bit(ATM_VF_RELEASED,&vcc->flags) || if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
test_bit(ATM_VF_CLOSE,&vcc->flags)) test_bit(ATM_VF_CLOSE,&vcc->flags))
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->tx_inuse)+ vcc->qos.txtp.max_sdu+atomic_read(&vcc->sk->wmem_alloc)+
ATM_PDU_OVHD <= vcc->sk->sndbuf) ATM_PDU_OVHD <= vcc->sk->sndbuf)
mask |= POLLOUT | POLLWRNORM; mask |= POLLOUT | POLLWRNORM;
} }
...@@ -546,6 +548,7 @@ static int fetch_stats(struct atm_dev *dev,struct atm_dev_stats *arg,int zero) ...@@ -546,6 +548,7 @@ static int fetch_stats(struct atm_dev *dev,struct atm_dev_stats *arg,int zero)
int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg) int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
{ {
struct atm_dev *dev; struct atm_dev *dev;
struct list_head *p;
struct atm_vcc *vcc; struct atm_vcc *vcc;
int *tmp_buf, *tmp_p; int *tmp_buf, *tmp_p;
void *buf; void *buf;
...@@ -562,7 +565,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg) ...@@ -562,7 +565,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->tx_inuse)-ATM_PDU_OVHD, atomic_read(&vcc->sk->wmem_alloc)-ATM_PDU_OVHD,
(int *) arg) ? -EFAULT : 0; (int *) arg) ? -EFAULT : 0;
goto done; goto done;
case SIOCINQ: case SIOCINQ:
...@@ -573,7 +576,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg) ...@@ -573,7 +576,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
ret_val = -EINVAL; ret_val = -EINVAL;
goto done; goto done;
} }
skb = skb_peek(&vcc->recvq); skb = skb_peek(&vcc->sk->receive_queue);
ret_val = put_user(skb ? skb->len : 0,(int *) arg) ret_val = put_user(skb ? skb->len : 0,(int *) arg)
? -EFAULT : 0; ? -EFAULT : 0;
goto done; goto done;
...@@ -590,7 +593,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg) ...@@ -590,7 +593,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
goto done; goto done;
} }
size = 0; size = 0;
for (dev = atm_devs; dev; dev = dev->next) list_for_each(p, &atm_devs)
size += sizeof(int); size += sizeof(int);
if (size > len) { if (size > len) {
ret_val = -E2BIG; ret_val = -E2BIG;
...@@ -602,8 +605,10 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg) ...@@ -602,8 +605,10 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
goto done; goto done;
} }
tmp_p = tmp_buf; tmp_p = tmp_buf;
for (dev = atm_devs; dev; dev = dev->next) list_for_each(p, &atm_devs) {
dev = list_entry(p, struct atm_dev, dev_list);
*tmp_p++ = dev->number; *tmp_p++ = dev->number;
}
ret_val = ((copy_to_user(buf, tmp_buf, size)) || ret_val = ((copy_to_user(buf, tmp_buf, size)) ||
put_user(size, &((struct atm_iobuf *) arg)->length) put_user(size, &((struct atm_iobuf *) arg)->length)
) ? -EFAULT : 0; ) ? -EFAULT : 0;
...@@ -963,7 +968,7 @@ static int atm_change_qos(struct atm_vcc *vcc,struct atm_qos *qos) ...@@ -963,7 +968,7 @@ static int atm_change_qos(struct atm_vcc *vcc,struct atm_qos *qos)
if (!error) error = adjust_tp(&qos->rxtp,qos->aal); if (!error) error = adjust_tp(&qos->rxtp,qos->aal);
if (error) return error; if (error) return error;
if (!vcc->dev->ops->change_qos) return -EOPNOTSUPP; if (!vcc->dev->ops->change_qos) return -EOPNOTSUPP;
if (vcc->family == AF_ATMPVC) if (vcc->sk->family == AF_ATMPVC)
return vcc->dev->ops->change_qos(vcc,qos,ATM_MF_SET); return vcc->dev->ops->change_qos(vcc,qos,ATM_MF_SET);
return svc_change_qos(vcc,qos); return svc_change_qos(vcc,qos);
} }
......
...@@ -125,7 +125,7 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev) ...@@ -125,7 +125,7 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev)
priv = (struct lec_priv *)dev->priv; priv = (struct lec_priv *)dev->priv;
atm_force_charge(priv->lecd, skb2->truesize); atm_force_charge(priv->lecd, skb2->truesize);
skb_queue_tail(&priv->lecd->recvq, skb2); skb_queue_tail(&priv->lecd->sk->receive_queue, skb2);
wake_up(&priv->lecd->sleep); wake_up(&priv->lecd->sleep);
} }
...@@ -202,7 +202,7 @@ static __inline__ void ...@@ -202,7 +202,7 @@ static __inline__ void
lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv) 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->tx_inuse); 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)->iovcnt = 0;
ATM_SKB(skb)->atm_options = vcc->atm_options; ATM_SKB(skb)->atm_options = vcc->atm_options;
...@@ -399,7 +399,7 @@ lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -399,7 +399,7 @@ lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
int i; int i;
char *tmp; /* FIXME */ char *tmp; /* FIXME */
atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->tx_inuse); atomic_sub(skb->truesize+ATM_PDU_OVHD, &vcc->sk->wmem_alloc);
mesg = (struct atmlec_msg *)skb->data; mesg = (struct atmlec_msg *)skb->data;
tmp = skb->data; tmp = skb->data;
tmp += sizeof(struct atmlec_msg); tmp += sizeof(struct atmlec_msg);
...@@ -505,7 +505,7 @@ lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -505,7 +505,7 @@ lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
skb2->len = sizeof(struct atmlec_msg); skb2->len = sizeof(struct atmlec_msg);
memcpy(skb2->data, mesg, sizeof(struct atmlec_msg)); memcpy(skb2->data, mesg, sizeof(struct atmlec_msg));
atm_force_charge(priv->lecd, skb2->truesize); atm_force_charge(priv->lecd, skb2->truesize);
skb_queue_tail(&priv->lecd->recvq, skb2); skb_queue_tail(&priv->lecd->sk->receive_queue, skb2);
wake_up(&priv->lecd->sleep); wake_up(&priv->lecd->sleep);
} }
if (f != NULL) br_fdb_put_hook(f); if (f != NULL) br_fdb_put_hook(f);
...@@ -534,10 +534,10 @@ lec_atm_close(struct atm_vcc *vcc) ...@@ -534,10 +534,10 @@ lec_atm_close(struct atm_vcc *vcc)
netif_stop_queue(dev); netif_stop_queue(dev);
lec_arp_destroy(priv); lec_arp_destroy(priv);
if (skb_peek(&vcc->recvq)) if (skb_peek(&vcc->sk->receive_queue))
printk("%s lec_atm_close: closing with messages pending\n", printk("%s lec_atm_close: closing with messages pending\n",
dev->name); dev->name);
while ((skb = skb_dequeue(&vcc->recvq))) { while ((skb = skb_dequeue(&vcc->sk->receive_queue))) {
atm_return(vcc, skb->truesize); atm_return(vcc, skb->truesize);
dev_kfree_skb(skb); dev_kfree_skb(skb);
} }
...@@ -595,13 +595,13 @@ send_to_lecd(struct lec_priv *priv, atmlec_msg_type type, ...@@ -595,13 +595,13 @@ send_to_lecd(struct lec_priv *priv, atmlec_msg_type type,
memcpy(&mesg->content.normal.atm_addr, atm_addr, ATM_ESA_LEN); memcpy(&mesg->content.normal.atm_addr, atm_addr, ATM_ESA_LEN);
atm_force_charge(priv->lecd, skb->truesize); atm_force_charge(priv->lecd, skb->truesize);
skb_queue_tail(&priv->lecd->recvq, skb); skb_queue_tail(&priv->lecd->sk->receive_queue, skb);
wake_up(&priv->lecd->sleep); wake_up(&priv->lecd->sleep);
if (data != NULL) { if (data != NULL) {
DPRINTK("lec: about to send %d bytes of data\n", data->len); DPRINTK("lec: about to send %d bytes of data\n", data->len);
atm_force_charge(priv->lecd, data->truesize); atm_force_charge(priv->lecd, data->truesize);
skb_queue_tail(&priv->lecd->recvq, data); skb_queue_tail(&priv->lecd->sk->receive_queue, data);
wake_up(&priv->lecd->sleep); wake_up(&priv->lecd->sleep);
} }
...@@ -683,7 +683,7 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -683,7 +683,7 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
#endif /* DUMP_PACKETS > 0 */ #endif /* DUMP_PACKETS > 0 */
if (memcmp(skb->data, lec_ctrl_magic, 4) ==0) { /* Control frame, to daemon*/ if (memcmp(skb->data, lec_ctrl_magic, 4) ==0) { /* Control frame, to daemon*/
DPRINTK("%s: To daemon\n",dev->name); DPRINTK("%s: To daemon\n",dev->name);
skb_queue_tail(&vcc->recvq, skb); skb_queue_tail(&vcc->sk->receive_queue, skb);
wake_up(&vcc->sleep); wake_up(&vcc->sleep);
} else { /* Data frame, queue to protocol handlers */ } else { /* Data frame, queue to protocol handlers */
unsigned char *dst; unsigned char *dst;
......
...@@ -520,7 +520,7 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) ...@@ -520,7 +520,7 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc)
memcpy(skb->data, &llc_snap_mpoa_data, sizeof(struct llc_snap_hdr)); memcpy(skb->data, &llc_snap_mpoa_data, sizeof(struct llc_snap_hdr));
} }
atomic_add(skb->truesize, &entry->shortcut->tx_inuse); atomic_add(skb->truesize, &entry->shortcut->sk->wmem_alloc);
ATM_SKB(skb)->iovcnt = 0; /* just to be safe ... */ 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);
...@@ -665,7 +665,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -665,7 +665,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
skb->dev = dev; skb->dev = dev;
if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) { if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) {
dprintk("mpoa: (%s) mpc_push: control packet arrived\n", dev->name); dprintk("mpoa: (%s) mpc_push: control packet arrived\n", dev->name);
skb_queue_tail(&vcc->recvq, skb); /* Pass control packets to daemon */ skb_queue_tail(&vcc->sk->receive_queue, skb); /* Pass control packets to daemon */
wake_up(&vcc->sleep); wake_up(&vcc->sleep);
return; return;
} }
...@@ -841,7 +841,7 @@ static void mpoad_close(struct atm_vcc *vcc) ...@@ -841,7 +841,7 @@ static void mpoad_close(struct atm_vcc *vcc)
mpc->in_ops->destroy_cache(mpc); mpc->in_ops->destroy_cache(mpc);
mpc->eg_ops->destroy_cache(mpc); mpc->eg_ops->destroy_cache(mpc);
while ( (skb = skb_dequeue(&vcc->recvq)) ){ while ( (skb = skb_dequeue(&vcc->sk->receive_queue)) ){
atm_return(vcc, skb->truesize); atm_return(vcc, skb->truesize);
kfree_skb(skb); kfree_skb(skb);
} }
...@@ -861,7 +861,7 @@ static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -861,7 +861,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->tx_inuse); atomic_sub(skb->truesize+ATM_PDU_OVHD, &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");
...@@ -938,7 +938,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc) ...@@ -938,7 +938,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc)
skb_put(skb, sizeof(struct k_message)); skb_put(skb, sizeof(struct k_message));
memcpy(skb->data, mesg, sizeof(struct k_message)); memcpy(skb->data, mesg, sizeof(struct k_message));
atm_force_charge(mpc->mpoad_vcc, skb->truesize); atm_force_charge(mpc->mpoad_vcc, skb->truesize);
skb_queue_tail(&mpc->mpoad_vcc->recvq, skb); skb_queue_tail(&mpc->mpoad_vcc->sk->receive_queue, skb);
wake_up(&mpc->mpoad_vcc->sleep); wake_up(&mpc->mpoad_vcc->sleep);
return 0; return 0;
...@@ -1215,7 +1215,7 @@ static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry) ...@@ -1215,7 +1215,7 @@ static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry)
purge_msg->content.eg_info = entry->ctrl_info; purge_msg->content.eg_info = entry->ctrl_info;
atm_force_charge(vcc, skb->truesize); atm_force_charge(vcc, skb->truesize);
skb_queue_tail(&vcc->recvq, skb); skb_queue_tail(&vcc->sk->receive_queue, skb);
wake_up(&vcc->sleep); wake_up(&vcc->sleep);
dprintk("mpoa: purge_egress_shortcut: exiting:\n"); dprintk("mpoa: purge_egress_shortcut: exiting:\n");
......
...@@ -135,7 +135,7 @@ static void atmarp_info(struct net_device *dev,struct atmarp_entry *entry, ...@@ -135,7 +135,7 @@ static void atmarp_info(struct net_device *dev,struct atmarp_entry *entry,
unsigned char *ip; unsigned char *ip;
int svc,off,ip_len; int svc,off,ip_len;
svc = !clip_vcc || clip_vcc->vcc->family == AF_ATMSVC; svc = !clip_vcc || clip_vcc->vcc->sk->family == AF_ATMSVC;
off = sprintf(buf,"%-6s%-4s%-4s%5ld ",dev->name,svc ? "SVC" : "PVC", off = sprintf(buf,"%-6s%-4s%-4s%5ld ",dev->name,svc ? "SVC" : "PVC",
!clip_vcc || clip_vcc->encap ? "LLC" : "NULL", !clip_vcc || clip_vcc->encap ? "LLC" : "NULL",
(jiffies-(clip_vcc ? clip_vcc->last_use : entry->neigh->used))/ (jiffies-(clip_vcc ? clip_vcc->last_use : entry->neigh->used))/
...@@ -210,7 +210,7 @@ static void vc_info(struct atm_vcc *vcc,char *buf) ...@@ -210,7 +210,7 @@ static void vc_info(struct atm_vcc *vcc,char *buf)
if (!vcc->dev) here += sprintf(here,"Unassigned "); if (!vcc->dev) here += sprintf(here,"Unassigned ");
else here += sprintf(here,"%3d %3d %5d ",vcc->dev->number,vcc->vpi, else here += sprintf(here,"%3d %3d %5d ",vcc->dev->number,vcc->vpi,
vcc->vci); vcc->vci);
switch (vcc->family) { switch (vcc->sk->family) {
case AF_ATMPVC: case AF_ATMPVC:
here += sprintf(here,"PVC"); here += sprintf(here,"PVC");
break; break;
...@@ -218,12 +218,12 @@ static void vc_info(struct atm_vcc *vcc,char *buf) ...@@ -218,12 +218,12 @@ static void vc_info(struct atm_vcc *vcc,char *buf)
here += sprintf(here,"SVC"); here += sprintf(here,"SVC");
break; break;
default: default:
here += sprintf(here,"%3d",vcc->family); here += sprintf(here,"%3d",vcc->sk->family);
} }
here += sprintf(here," %04lx %5d %7d/%7d %7d/%7d\n",vcc->flags, here += sprintf(here," %04lx %5d %7d/%7d %7d/%7d\n",vcc->flags,
vcc->reply, vcc->reply,
atomic_read(&vcc->tx_inuse),vcc->sk->sndbuf, atomic_read(&vcc->sk->wmem_alloc),vcc->sk->sndbuf,
atomic_read(&vcc->rx_inuse),vcc->sk->rcvbuf); atomic_read(&vcc->sk->rmem_alloc),vcc->sk->rcvbuf);
} }
...@@ -303,6 +303,7 @@ lec_info(struct lec_arp_table *entry, char *buf) ...@@ -303,6 +303,7 @@ lec_info(struct lec_arp_table *entry, char *buf)
static int atm_devices_info(loff_t pos,char *buf) static int atm_devices_info(loff_t pos,char *buf)
{ {
struct atm_dev *dev; struct atm_dev *dev;
struct list_head *p;
int left; int left;
if (!pos) { if (!pos) {
...@@ -310,10 +311,14 @@ static int atm_devices_info(loff_t pos,char *buf) ...@@ -310,10 +311,14 @@ static int atm_devices_info(loff_t pos,char *buf)
"AAL(TX,err,RX,err,drop) ...\n"); "AAL(TX,err,RX,err,drop) ...\n");
} }
left = pos-1; left = pos-1;
for (dev = atm_devs; dev && left; dev = dev->next) left--; list_for_each(p, &atm_devs) {
if (!dev) return 0; dev = list_entry(p, struct atm_dev, dev_list);
if (left-- == 0) {
dev_info(dev,buf); dev_info(dev,buf);
return strlen(buf); return strlen(buf);
}
}
return 0;
} }
/* /*
...@@ -324,6 +329,7 @@ static int atm_devices_info(loff_t pos,char *buf) ...@@ -324,6 +329,7 @@ static int atm_devices_info(loff_t pos,char *buf)
static int atm_pvc_info(loff_t pos,char *buf) static int atm_pvc_info(loff_t pos,char *buf)
{ {
struct atm_dev *dev; struct atm_dev *dev;
struct list_head *p;
struct atm_vcc *vcc; struct atm_vcc *vcc;
int left; int left;
...@@ -332,13 +338,15 @@ static int atm_pvc_info(loff_t pos,char *buf) ...@@ -332,13 +338,15 @@ static int atm_pvc_info(loff_t pos,char *buf)
"TX(PCR,Class)\n"); "TX(PCR,Class)\n");
} }
left = pos-1; left = pos-1;
for (dev = atm_devs; dev; dev = dev->next) list_for_each(p, &atm_devs) {
dev = list_entry(p, struct atm_dev, dev_list);
for (vcc = dev->vccs; vcc; vcc = vcc->next) for (vcc = dev->vccs; vcc; vcc = vcc->next)
if (vcc->family == PF_ATMPVC && if (vcc->sk->family == PF_ATMPVC &&
vcc->dev && !left--) { vcc->dev && !left--) {
pvc_info(vcc,buf); pvc_info(vcc,buf);
return strlen(buf); return strlen(buf);
} }
}
return 0; return 0;
} }
...@@ -346,6 +354,7 @@ static int atm_pvc_info(loff_t pos,char *buf) ...@@ -346,6 +354,7 @@ static int atm_pvc_info(loff_t pos,char *buf)
static int atm_vc_info(loff_t pos,char *buf) static int atm_vc_info(loff_t pos,char *buf)
{ {
struct atm_dev *dev; struct atm_dev *dev;
struct list_head *p;
struct atm_vcc *vcc; struct atm_vcc *vcc;
int left; int left;
...@@ -354,12 +363,14 @@ static int atm_vc_info(loff_t pos,char *buf) ...@@ -354,12 +363,14 @@ static int atm_vc_info(loff_t pos,char *buf)
"Address"," Itf VPI VCI Fam Flags Reply Send buffer" "Address"," Itf VPI VCI Fam Flags Reply Send buffer"
" Recv buffer\n"); " Recv buffer\n");
left = pos-1; left = pos-1;
for (dev = atm_devs; dev; dev = dev->next) list_for_each(p, &atm_devs) {
dev = list_entry(p, struct atm_dev, dev_list);
for (vcc = dev->vccs; vcc; vcc = vcc->next) for (vcc = dev->vccs; vcc; vcc = vcc->next)
if (!left--) { if (!left--) {
vc_info(vcc,buf); vc_info(vcc,buf);
return strlen(buf); return strlen(buf);
} }
}
for (vcc = nodev_vccs; vcc; vcc = vcc->next) for (vcc = nodev_vccs; vcc; vcc = vcc->next)
if (!left--) { if (!left--) {
vc_info(vcc,buf); vc_info(vcc,buf);
...@@ -373,20 +384,23 @@ static int atm_vc_info(loff_t pos,char *buf) ...@@ -373,20 +384,23 @@ static int atm_vc_info(loff_t pos,char *buf)
static int atm_svc_info(loff_t pos,char *buf) static int atm_svc_info(loff_t pos,char *buf)
{ {
struct atm_dev *dev; struct atm_dev *dev;
struct list_head *p;
struct atm_vcc *vcc; struct atm_vcc *vcc;
int left; int left;
if (!pos) if (!pos)
return sprintf(buf,"Itf VPI VCI State Remote\n"); return sprintf(buf,"Itf VPI VCI State Remote\n");
left = pos-1; left = pos-1;
for (dev = atm_devs; dev; dev = dev->next) list_for_each(p, &atm_devs) {
dev = list_entry(p, struct atm_dev, dev_list);
for (vcc = dev->vccs; vcc; vcc = vcc->next) for (vcc = dev->vccs; vcc; vcc = vcc->next)
if (vcc->family == PF_ATMSVC && !left--) { if (vcc->sk->family == PF_ATMSVC && !left--) {
svc_info(vcc,buf); svc_info(vcc,buf);
return strlen(buf); return strlen(buf);
} }
}
for (vcc = nodev_vccs; vcc; vcc = vcc->next) for (vcc = nodev_vccs; vcc; vcc = vcc->next)
if (vcc->family == PF_ATMSVC && !left--) { if (vcc->sk->family == PF_ATMSVC && !left--) {
svc_info(vcc,buf); svc_info(vcc,buf);
return strlen(buf); return strlen(buf);
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb) void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
{ {
if (skb) { if (skb) {
skb_queue_tail(&vcc->recvq,skb); skb_queue_tail(&vcc->sk->receive_queue,skb);
wake_up(&vcc->sleep); wake_up(&vcc->sleep);
} }
} }
...@@ -36,8 +36,8 @@ void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb) ...@@ -36,8 +36,8 @@ 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->tx_inuse,skb->truesize); DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->sk->wmem_alloc,skb->truesize);
atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse); atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
wake_up(&vcc->sleep); wake_up(&vcc->sleep);
} }
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
#endif #endif
struct atm_dev *atm_devs = NULL; LIST_HEAD(atm_devs);
static struct atm_dev *last_dev = NULL;
struct atm_vcc *nodev_vccs = NULL; struct atm_vcc *nodev_vccs = NULL;
extern spinlock_t atm_dev_lock; extern spinlock_t atm_dev_lock;
...@@ -43,15 +42,7 @@ static struct atm_dev *__alloc_atm_dev(const char *type) ...@@ -43,15 +42,7 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
dev->type = type; dev->type = type;
dev->signal = ATM_PHY_SIG_UNKNOWN; dev->signal = ATM_PHY_SIG_UNKNOWN;
dev->link_rate = ATM_OC3_PCR; dev->link_rate = ATM_OC3_PCR;
dev->next = NULL; list_add_tail(&dev->dev_list, &atm_devs);
dev->prev = last_dev;
if (atm_devs)
last_dev->next = dev;
else
atm_devs = dev;
last_dev = dev;
return dev; return dev;
} }
...@@ -59,14 +50,7 @@ static struct atm_dev *__alloc_atm_dev(const char *type) ...@@ -59,14 +50,7 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
/* Caller must hold atm_dev_lock. */ /* Caller must hold atm_dev_lock. */
static void __free_atm_dev(struct atm_dev *dev) static void __free_atm_dev(struct atm_dev *dev)
{ {
if (dev->prev) list_del(&dev->dev_list);
dev->prev->next = dev->next;
else
atm_devs = dev->next;
if (dev->next)
dev->next->prev = dev->prev;
else
last_dev = dev->prev;
kfree(dev); kfree(dev);
} }
...@@ -74,10 +58,13 @@ static void __free_atm_dev(struct atm_dev *dev) ...@@ -74,10 +58,13 @@ static void __free_atm_dev(struct atm_dev *dev)
struct atm_dev *atm_find_dev(int number) struct atm_dev *atm_find_dev(int number)
{ {
struct atm_dev *dev; struct atm_dev *dev;
struct list_head *p;
for (dev = atm_devs; dev; dev = dev->next) list_for_each(p, &atm_devs) {
dev = list_entry(p, struct atm_dev, dev_list);
if (dev->ops && dev->number == number) if (dev->ops && dev->number == number)
return dev; return dev;
}
return NULL; return NULL;
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <linux/atmdev.h> #include <linux/atmdev.h>
extern struct atm_dev *atm_devs; extern struct list_head atm_devs;
extern struct atm_vcc *nodev_vccs; /* VCCs not linked to any device */ extern struct atm_vcc *nodev_vccs; /* VCCs not linked to any device */
......
...@@ -61,7 +61,7 @@ static void sigd_put_skb(struct sk_buff *skb) ...@@ -61,7 +61,7 @@ static void sigd_put_skb(struct sk_buff *skb)
} }
#endif #endif
atm_force_charge(sigd,skb->truesize); atm_force_charge(sigd,skb->truesize);
skb_queue_tail(&sigd->recvq,skb); skb_queue_tail(&sigd->sk->receive_queue,skb);
wake_up(&sigd->sleep); wake_up(&sigd->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->tx_inuse); atomic_sub(skb->truesize+ATM_PDU_OVHD,&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;
...@@ -198,7 +198,7 @@ void sigd_enq(struct atm_vcc *vcc,enum atmsvc_msg_type type, ...@@ -198,7 +198,7 @@ void sigd_enq(struct atm_vcc *vcc,enum atmsvc_msg_type type,
static void purge_vccs(struct atm_vcc *vcc) static void purge_vccs(struct atm_vcc *vcc)
{ {
while (vcc) { while (vcc) {
if (vcc->family == PF_ATMSVC && if (vcc->sk->family == PF_ATMSVC &&
!test_bit(ATM_VF_META,&vcc->flags)) { !test_bit(ATM_VF_META,&vcc->flags)) {
set_bit(ATM_VF_RELEASED,&vcc->flags); set_bit(ATM_VF_RELEASED,&vcc->flags);
vcc->reply = -EUNATCH; vcc->reply = -EUNATCH;
...@@ -212,16 +212,20 @@ static void purge_vccs(struct atm_vcc *vcc) ...@@ -212,16 +212,20 @@ static void purge_vccs(struct atm_vcc *vcc)
static void sigd_close(struct atm_vcc *vcc) static void sigd_close(struct atm_vcc *vcc)
{ {
struct atm_dev *dev; struct atm_dev *dev;
struct list_head *p;
DPRINTK("sigd_close\n"); DPRINTK("sigd_close\n");
sigd = NULL; sigd = NULL;
if (skb_peek(&vcc->recvq)) if (skb_peek(&vcc->sk->receive_queue))
printk(KERN_ERR "sigd_close: closing with requests pending\n"); printk(KERN_ERR "sigd_close: closing with requests pending\n");
skb_queue_purge(&vcc->recvq); skb_queue_purge(&vcc->sk->receive_queue);
purge_vccs(nodev_vccs); purge_vccs(nodev_vccs);
spin_lock (&atm_dev_lock); spin_lock (&atm_dev_lock);
for (dev = atm_devs; dev; dev = dev->next) purge_vccs(dev->vccs); list_for_each(p, &atm_devs) {
dev = list_entry(p, struct atm_dev, dev_list);
purge_vccs(dev->vccs);
}
spin_unlock (&atm_dev_lock); spin_unlock (&atm_dev_lock);
} }
......
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