Commit 072a9d39 authored by Chas Williams's avatar Chas Williams Committed by Hideaki Yoshifuji

[ATM]: Eliminate vcc->sleep in favor of sk->sk_sleep.

parent 999fdfc4
......@@ -66,7 +66,7 @@ static int atmtcp_send_control(struct atm_vcc *vcc,int type,
*(struct atm_vcc **) &new_msg->vcc = vcc;
old_test = test_bit(flag,&vcc->flags);
out_vcc->push(out_vcc,skb);
add_wait_queue(&vcc->sleep,&wait);
add_wait_queue(vcc->sk->sk_sleep, &wait);
while (test_bit(flag,&vcc->flags) == old_test) {
mb();
out_vcc = PRIV(vcc->dev) ? PRIV(vcc->dev)->vcc : NULL;
......@@ -78,7 +78,7 @@ static int atmtcp_send_control(struct atm_vcc *vcc,int type,
schedule();
}
current->state = TASK_RUNNING;
remove_wait_queue(&vcc->sleep,&wait);
remove_wait_queue(vcc->sk->sk_sleep, &wait);
return error;
}
......@@ -103,7 +103,7 @@ static int atmtcp_recv_control(const struct atmtcp_control *msg)
msg->type);
return -EINVAL;
}
wake_up(&vcc->sleep);
wake_up(vcc->sk->sk_sleep);
return 0;
}
......@@ -257,7 +257,7 @@ static void atmtcp_c_close(struct atm_vcc *vcc)
walk = atm_sk(s);
if (walk->dev != atmtcp_dev)
continue;
wake_up(&walk->sleep);
wake_up(walk->sk->sk_sleep);
}
read_unlock(&vcc_sklist_lock);
}
......
......@@ -291,7 +291,6 @@ struct atm_vcc {
void *dev_data; /* per-device data */
void *proto_data; /* per-protocol data */
struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
wait_queue_head_t sleep; /* if socket is busy */
struct sock *sk; /* socket backpointer */
/* SVC part --- may move later ------------------------------------- */
short itf; /* interface number */
......
......@@ -67,7 +67,7 @@ static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip)
ctrl->ip = ip;
atm_force_charge(atmarpd,skb->truesize);
skb_queue_tail(&atmarpd->sk->sk_receive_queue, skb);
wake_up(&atmarpd->sleep);
wake_up(atmarpd->sk->sk_sleep);
return 0;
}
......
......@@ -255,7 +255,7 @@ int vcc_create(struct socket *sock, int protocol, int family)
sk = sk_alloc(family, GFP_KERNEL, 1, NULL);
if (!sk)
return -ENOMEM;
sock_init_data(NULL, sk);
sock_init_data(sock, sk);
sk->sk_state_change = vcc_def_wakeup;
vcc = atm_sk(sk) = kmalloc(sizeof(*vcc), GFP_KERNEL);
......@@ -277,8 +277,6 @@ int vcc_create(struct socket *sock, int protocol, int family)
vcc->push_oam = NULL;
vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */
vcc->atm_options = vcc->aal_options = 0;
init_waitqueue_head(&vcc->sleep);
sk->sk_sleep = &vcc->sleep;
sk->sk_destruct = vcc_sock_destruct;
sock->sk = sk;
return 0;
......@@ -330,7 +328,7 @@ void vcc_release_async(struct atm_vcc *vcc, int reply)
set_bit(ATM_VF_CLOSE, &vcc->flags);
vcc->reply = reply;
vcc->sk->sk_err = -reply;
wake_up(&vcc->sleep);
wake_up(vcc->sk->sk_sleep);
}
......@@ -577,7 +575,7 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
}
/* verify_area is done by net/socket.c */
eff = (size+3) & ~3; /* align to word boundary */
prepare_to_wait(&vcc->sleep, &wait, TASK_INTERRUPTIBLE);
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
error = 0;
while (!(skb = alloc_tx(vcc,eff))) {
if (m->msg_flags & MSG_DONTWAIT) {
......@@ -598,9 +596,9 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
error = -EPIPE;
break;
}
prepare_to_wait(&vcc->sleep, &wait, TASK_INTERRUPTIBLE);
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
}
finish_wait(&vcc->sleep, &wait);
finish_wait(sk->sk_sleep, &wait);
if (error)
goto out;
skb->dev = NULL; /* for paths shared with net_device interfaces */
......@@ -625,7 +623,7 @@ unsigned int atm_poll(struct file *file,struct socket *sock,poll_table *wait)
unsigned int mask;
vcc = ATM_SD(sock);
poll_wait(file,&vcc->sleep,wait);
poll_wait(file, vcc->sk->sk_sleep, wait);
mask = 0;
if (skb_peek(&vcc->sk->sk_receive_queue))
mask |= POLLIN | POLLRDNORM;
......
......@@ -134,7 +134,7 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev)
priv = (struct lec_priv *)dev->priv;
atm_force_charge(priv->lecd, skb2->truesize);
skb_queue_tail(&priv->lecd->sk->sk_receive_queue, skb2);
wake_up(&priv->lecd->sleep);
wake_up(priv->lecd->sk->sk_sleep);
}
return;
......@@ -513,7 +513,7 @@ lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
memcpy(skb2->data, mesg, sizeof(struct atmlec_msg));
atm_force_charge(priv->lecd, skb2->truesize);
skb_queue_tail(&priv->lecd->sk->sk_receive_queue, skb2);
wake_up(&priv->lecd->sleep);
wake_up(priv->lecd->sk->sk_sleep);
}
if (f != NULL) br_fdb_put_hook(f);
#endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
......@@ -598,13 +598,13 @@ send_to_lecd(struct lec_priv *priv, atmlec_msg_type type,
atm_force_charge(priv->lecd, skb->truesize);
skb_queue_tail(&priv->lecd->sk->sk_receive_queue, skb);
wake_up(&priv->lecd->sleep);
wake_up(priv->lecd->sk->sk_sleep);
if (data != NULL) {
DPRINTK("lec: about to send %d bytes of data\n", data->len);
atm_force_charge(priv->lecd, data->truesize);
skb_queue_tail(&priv->lecd->sk->sk_receive_queue, data);
wake_up(&priv->lecd->sleep);
wake_up(priv->lecd->sk->sk_sleep);
}
return 0;
......@@ -686,7 +686,7 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
if (memcmp(skb->data, lec_ctrl_magic, 4) ==0) { /* Control frame, to daemon*/
DPRINTK("%s: To daemon\n",dev->name);
skb_queue_tail(&vcc->sk->sk_receive_queue, skb);
wake_up(&vcc->sleep);
wake_up(vcc->sk->sk_sleep);
} else { /* Data frame, queue to protocol handlers */
unsigned char *dst;
......
......@@ -669,7 +669,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
dprintk("mpoa: (%s) mpc_push: control packet arrived\n", dev->name);
/* Pass control packets to daemon */
skb_queue_tail(&vcc->sk->sk_receive_queue, skb);
wake_up(&vcc->sleep);
wake_up(vcc->sk->sk_sleep);
return;
}
......@@ -947,7 +947,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc)
memcpy(skb->data, mesg, sizeof(struct k_message));
atm_force_charge(mpc->mpoad_vcc, skb->truesize);
skb_queue_tail(&mpc->mpoad_vcc->sk->sk_receive_queue, skb);
wake_up(&mpc->mpoad_vcc->sleep);
wake_up(mpc->mpoad_vcc->sk->sk_sleep);
return 0;
}
......@@ -1226,7 +1226,7 @@ static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry)
atm_force_charge(vcc, skb->truesize);
skb_queue_tail(&vcc->sk->sk_receive_queue, skb);
wake_up(&vcc->sleep);
wake_up(vcc->sk->sk_sleep);
dprintk("mpoa: purge_egress_shortcut: exiting:\n");
return;
......
......@@ -29,7 +29,7 @@ void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
{
if (skb) {
skb_queue_tail(&vcc->sk->sk_receive_queue, skb);
wake_up(&vcc->sleep);
wake_up(vcc->sk->sk_sleep);
}
}
......@@ -40,7 +40,7 @@ static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb)
skb->truesize);
atomic_sub(skb->truesize, &vcc->sk->sk_wmem_alloc);
dev_kfree_skb_any(skb);
wake_up(&vcc->sleep);
wake_up(vcc->sk->sk_sleep);
}
......
......@@ -61,7 +61,7 @@ static void sigd_put_skb(struct sk_buff *skb)
#endif
atm_force_charge(sigd,skb->truesize);
skb_queue_tail(&sigd->sk->sk_receive_queue,skb);
wake_up(&sigd->sleep);
wake_up(sigd->sk->sk_sleep);
}
......@@ -137,7 +137,7 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb)
}
vcc->sk->sk_ack_backlog++;
skb_queue_tail(&vcc->sk->sk_receive_queue, skb);
DPRINTK("waking vcc->sleep 0x%p\n", &vcc->sleep);
DPRINTK("waking vcc->sk->sk_sleep 0x%p\n", vcc->sk->sk_sleep);
vcc->sk->sk_state_change(vcc->sk);
as_indicate_complete:
release_sock(vcc->sk);
......@@ -204,7 +204,7 @@ static void purge_vcc(struct atm_vcc *vcc)
set_bit(ATM_VF_RELEASED,&vcc->flags);
vcc->reply = -EUNATCH;
vcc->sk->sk_err = EUNATCH;
wake_up(&vcc->sleep);
wake_up(vcc->sk->sk_sleep);
}
}
......
......@@ -56,13 +56,13 @@ static void svc_disconnect(struct atm_vcc *vcc)
DPRINTK("svc_disconnect %p\n",vcc);
if (test_bit(ATM_VF_REGIS,&vcc->flags)) {
prepare_to_wait(&vcc->sleep, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
sigd_enq(vcc,as_close,NULL,NULL,NULL);
while (!test_bit(ATM_VF_RELEASED,&vcc->flags) && sigd) {
schedule();
prepare_to_wait(&vcc->sleep, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
}
finish_wait(&vcc->sleep, &wait);
finish_wait(vcc->sk->sk_sleep, &wait);
}
/* beware - socket is still in use by atmsigd until the last
as_indicate has been answered */
......@@ -138,13 +138,13 @@ static int svc_bind(struct socket *sock,struct sockaddr *sockaddr,
}
vcc->local = *addr;
vcc->reply = WAITING;
prepare_to_wait(&vcc->sleep, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
sigd_enq(vcc,as_bind,NULL,NULL,&vcc->local);
while (vcc->reply == WAITING && sigd) {
schedule();
prepare_to_wait(&vcc->sleep, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
}
finish_wait(&vcc->sleep, &wait);
finish_wait(sk->sk_sleep, &wait);
clear_bit(ATM_VF_REGIS,&vcc->flags); /* doesn't count */
if (!sigd) {
error = -EUNATCH;
......@@ -219,10 +219,10 @@ static int svc_connect(struct socket *sock,struct sockaddr *sockaddr,
}
vcc->remote = *addr;
vcc->reply = WAITING;
prepare_to_wait(&vcc->sleep, &wait, TASK_INTERRUPTIBLE);
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
sigd_enq(vcc,as_connect,NULL,NULL,&vcc->remote);
if (flags & O_NONBLOCK) {
finish_wait(&vcc->sleep, &wait);
finish_wait(sk->sk_sleep, &wait);
sock->state = SS_CONNECTING;
error = -EINPROGRESS;
goto out;
......@@ -231,7 +231,7 @@ static int svc_connect(struct socket *sock,struct sockaddr *sockaddr,
while (vcc->reply == WAITING && sigd) {
schedule();
if (!signal_pending(current)) {
prepare_to_wait(&vcc->sleep, &wait, TASK_INTERRUPTIBLE);
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
continue;
}
DPRINTK("*ABORT*\n");
......@@ -249,13 +249,13 @@ static int svc_connect(struct socket *sock,struct sockaddr *sockaddr,
*/
sigd_enq(vcc,as_close,NULL,NULL,NULL);
while (vcc->reply == WAITING && sigd) {
prepare_to_wait(&vcc->sleep, &wait, TASK_INTERRUPTIBLE);
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
schedule();
}
if (!vcc->reply)
while (!test_bit(ATM_VF_RELEASED,&vcc->flags)
&& sigd) {
prepare_to_wait(&vcc->sleep, &wait, TASK_INTERRUPTIBLE);
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
schedule();
}
clear_bit(ATM_VF_REGIS,&vcc->flags);
......@@ -265,7 +265,7 @@ static int svc_connect(struct socket *sock,struct sockaddr *sockaddr,
error = -EINTR;
break;
}
finish_wait(&vcc->sleep, &wait);
finish_wait(sk->sk_sleep, &wait);
if (error)
goto out;
if (!sigd) {
......@@ -312,13 +312,13 @@ static int svc_listen(struct socket *sock,int backlog)
goto out;
}
vcc->reply = WAITING;
prepare_to_wait(&vcc->sleep, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
sigd_enq(vcc,as_listen,NULL,NULL,&vcc->local);
while (vcc->reply == WAITING && sigd) {
schedule();
prepare_to_wait(&vcc->sleep, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
}
finish_wait(&vcc->sleep, &wait);
finish_wait(sk->sk_sleep, &wait);
if (!sigd) {
error = -EUNATCH;
goto out;
......@@ -354,7 +354,7 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags)
while (1) {
DEFINE_WAIT(wait);
prepare_to_wait(&old_vcc->sleep, &wait, TASK_INTERRUPTIBLE);
prepare_to_wait(old_vcc->sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
while (!(skb = skb_dequeue(&old_vcc->sk->sk_receive_queue)) &&
sigd) {
if (test_bit(ATM_VF_RELEASED,&old_vcc->flags)) break;
......@@ -373,9 +373,9 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags)
error = -ERESTARTSYS;
break;
}
prepare_to_wait(&old_vcc->sleep, &wait, TASK_INTERRUPTIBLE);
prepare_to_wait(old_vcc->sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
}
finish_wait(&old_vcc->sleep, &wait);
finish_wait(old_vcc->sk->sk_sleep, &wait);
if (error)
goto out;
if (!skb) {
......@@ -400,15 +400,15 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags)
}
/* wait should be short, so we ignore the non-blocking flag */
new_vcc->reply = WAITING;
prepare_to_wait(&new_vcc->sleep, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(new_vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
sigd_enq(new_vcc,as_accept,old_vcc,NULL,NULL);
while (new_vcc->reply == WAITING && sigd) {
release_sock(sk);
schedule();
lock_sock(sk);
prepare_to_wait(&new_vcc->sleep, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(new_vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
}
finish_wait(&new_vcc->sleep, &wait);
finish_wait(new_vcc->sk->sk_sleep, &wait);
if (!sigd) {
error = -EUNATCH;
goto out;
......@@ -444,14 +444,14 @@ int svc_change_qos(struct atm_vcc *vcc,struct atm_qos *qos)
DEFINE_WAIT(wait);
vcc->reply = WAITING;
prepare_to_wait(&vcc->sleep, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
sigd_enq2(vcc,as_modify,NULL,NULL,&vcc->local,qos,0);
while (vcc->reply == WAITING && !test_bit(ATM_VF_RELEASED,&vcc->flags)
&& sigd) {
schedule();
prepare_to_wait(&vcc->sleep, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
}
finish_wait(&vcc->sleep, &wait);
finish_wait(vcc->sk->sk_sleep, &wait);
if (!sigd) return -EUNATCH;
return vcc->reply;
}
......
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