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

[ATM]: Clip locking and more atmvcc cleanup.

parent a6f426f6
...@@ -306,9 +306,6 @@ struct atm_vcc { ...@@ -306,9 +306,6 @@ struct atm_vcc {
struct sockaddr_atmsvc local; struct sockaddr_atmsvc local;
struct sockaddr_atmsvc remote; struct sockaddr_atmsvc remote;
void (*callback)(struct atm_vcc *vcc); void (*callback)(struct atm_vcc *vcc);
struct sk_buff_head listenq;
int backlog_quota; /* number of connection requests we */
/* can still accept */
int reply; /* also used by ATMTCP */ int reply; /* also used by ATMTCP */
/* Multipoint part ------------------------------------------------- */ /* Multipoint part ------------------------------------------------- */
struct atm_vcc *session; /* session VCC descriptor */ struct atm_vcc *session; /* session VCC descriptor */
......
...@@ -127,6 +127,8 @@ static void idle_timer_check(unsigned long dummy) ...@@ -127,6 +127,8 @@ static void idle_timer_check(unsigned long dummy)
struct atmarp_entry *entry = NEIGH2ENTRY(n); struct atmarp_entry *entry = NEIGH2ENTRY(n);
struct clip_vcc *clip_vcc; struct clip_vcc *clip_vcc;
write_lock(&n->lock);
for (clip_vcc = entry->vccs; clip_vcc; for (clip_vcc = entry->vccs; clip_vcc;
clip_vcc = clip_vcc->next) clip_vcc = clip_vcc->next)
if (clip_vcc->idle_timeout && if (clip_vcc->idle_timeout &&
...@@ -141,6 +143,7 @@ static void idle_timer_check(unsigned long dummy) ...@@ -141,6 +143,7 @@ static void idle_timer_check(unsigned long dummy)
if (entry->vccs || if (entry->vccs ||
time_before(jiffies, entry->expires)) { time_before(jiffies, entry->expires)) {
np = &n->next; np = &n->next;
write_unlock(&n->lock);
continue; continue;
} }
if (atomic_read(&n->refcnt) > 1) { if (atomic_read(&n->refcnt) > 1) {
...@@ -152,11 +155,13 @@ static void idle_timer_check(unsigned long dummy) ...@@ -152,11 +155,13 @@ static void idle_timer_check(unsigned long dummy)
NULL) NULL)
dev_kfree_skb(skb); dev_kfree_skb(skb);
np = &n->next; np = &n->next;
write_unlock(&n->lock);
continue; continue;
} }
*np = n->next; *np = n->next;
DPRINTK("expired neigh %p\n",n); DPRINTK("expired neigh %p\n",n);
n->dead = 1; n->dead = 1;
write_unlock(&n->lock);
neigh_release(n); neigh_release(n);
} }
} }
......
...@@ -127,7 +127,6 @@ int atm_create(struct socket *sock,int protocol,int family) ...@@ -127,7 +127,6 @@ int atm_create(struct socket *sock,int protocol,int family)
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->listenq);
sk->sleep = &vcc->sleep; sk->sleep = &vcc->sleep;
sock->sk = sk; sock->sk = sk;
return 0; return 0;
...@@ -496,7 +495,7 @@ unsigned int atm_poll(struct file *file,struct socket *sock,poll_table *wait) ...@@ -496,7 +495,7 @@ 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->sk->receive_queue) || skb_peek(&vcc->listenq)) if (skb_peek(&vcc->sk->receive_queue))
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))
......
...@@ -129,12 +129,12 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb) ...@@ -129,12 +129,12 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb)
case as_indicate: case as_indicate:
vcc = *(struct atm_vcc **) &msg->listen_vcc; vcc = *(struct atm_vcc **) &msg->listen_vcc;
DPRINTK("as_indicate!!!\n"); DPRINTK("as_indicate!!!\n");
if (!vcc->backlog_quota) { if (vcc->sk->ack_backlog == vcc->sk->max_ack_backlog) {
sigd_enq(0,as_reject,vcc,NULL,NULL); sigd_enq(0,as_reject,vcc,NULL,NULL);
return 0; return 0;
} }
vcc->backlog_quota--; vcc->sk->ack_backlog++;
skb_queue_tail(&vcc->listenq,skb); skb_queue_tail(&vcc->sk->receive_queue,skb);
if (vcc->callback) { if (vcc->callback) {
DPRINTK("waking vcc->sleep 0x%p\n", DPRINTK("waking vcc->sleep 0x%p\n",
&vcc->sleep); &vcc->sleep);
......
...@@ -74,7 +74,7 @@ static void svc_disconnect(struct atm_vcc *vcc) ...@@ -74,7 +74,7 @@ static void svc_disconnect(struct atm_vcc *vcc)
} }
/* beware - socket is still in use by atmsigd until the last /* beware - socket is still in use by atmsigd until the last
as_indicate has been answered */ as_indicate has been answered */
while ((skb = skb_dequeue(&vcc->listenq))) { while ((skb = skb_dequeue(&vcc->sk->receive_queue))) {
DPRINTK("LISTEN REL\n"); DPRINTK("LISTEN REL\n");
sigd_enq2(NULL,as_reject,vcc,NULL,NULL,&vcc->qos,0); sigd_enq2(NULL,as_reject,vcc,NULL,NULL,&vcc->qos,0);
dev_kfree_skb(skb); dev_kfree_skb(skb);
...@@ -253,7 +253,7 @@ static int svc_listen(struct socket *sock,int backlog) ...@@ -253,7 +253,7 @@ static int svc_listen(struct socket *sock,int backlog)
remove_wait_queue(&vcc->sleep,&wait); remove_wait_queue(&vcc->sleep,&wait);
if (!sigd) return -EUNATCH; if (!sigd) return -EUNATCH;
set_bit(ATM_VF_LISTEN,&vcc->flags); set_bit(ATM_VF_LISTEN,&vcc->flags);
vcc->backlog_quota = backlog > 0 ? backlog : ATM_BACKLOG_DEFAULT; vcc->sk->max_ack_backlog = backlog > 0 ? backlog : ATM_BACKLOG_DEFAULT;
return vcc->reply; return vcc->reply;
} }
...@@ -277,7 +277,7 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags) ...@@ -277,7 +277,7 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags)
DECLARE_WAITQUEUE(wait,current); DECLARE_WAITQUEUE(wait,current);
add_wait_queue(&old_vcc->sleep,&wait); add_wait_queue(&old_vcc->sleep,&wait);
while (!(skb = skb_dequeue(&old_vcc->listenq)) && sigd) { while (!(skb = skb_dequeue(&old_vcc->sk->receive_queue)) && sigd) {
if (test_bit(ATM_VF_RELEASED,&old_vcc->flags)) break; if (test_bit(ATM_VF_RELEASED,&old_vcc->flags)) break;
if (test_bit(ATM_VF_CLOSE,&old_vcc->flags)) { if (test_bit(ATM_VF_CLOSE,&old_vcc->flags)) {
error = old_vcc->reply; error = old_vcc->reply;
...@@ -306,7 +306,7 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags) ...@@ -306,7 +306,7 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags)
error = atm_connect(newsock,msg->pvc.sap_addr.itf, error = atm_connect(newsock,msg->pvc.sap_addr.itf,
msg->pvc.sap_addr.vpi,msg->pvc.sap_addr.vci); msg->pvc.sap_addr.vpi,msg->pvc.sap_addr.vci);
dev_kfree_skb(skb); dev_kfree_skb(skb);
old_vcc->backlog_quota++; old_vcc->sk->ack_backlog--;
if (error) { if (error) {
sigd_enq2(NULL,as_reject,old_vcc,NULL,NULL, sigd_enq2(NULL,as_reject,old_vcc,NULL,NULL,
&old_vcc->qos,error); &old_vcc->qos,error);
......
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