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 {
struct atm_vcc {
unsigned long flags; /* VCC flags (ATM_VF_*) */
unsigned char family; /* address family; 0 if unused */
short vpi; /* VPI and VCI (types must be equal */
/* with sockaddr) */
int vci;
......@@ -286,7 +285,6 @@ struct atm_vcc {
struct atm_dev *dev; /* device back pointer */
struct atm_qos qos; /* QOS */
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 (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
struct sk_buff *(*alloc_tx)(struct atm_vcc *vcc,unsigned int size);
......@@ -297,7 +295,6 @@ struct atm_vcc {
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
void *dev_data; /* per-device 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 */
wait_queue_head_t sleep; /* if socket is busy */
struct sock *sk; /* socket backpointer */
......@@ -346,7 +343,7 @@ struct atm_dev {
struct proc_dir_entry *proc_entry; /* proc entry */
char *proc_name; /* proc entry name */
#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)
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)
{
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)
{
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 @@
int atm_charge(struct atm_vcc *vcc,int 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);
atomic_inc(&vcc->stats->rx_drop);
return 0;
......@@ -29,11 +29,11 @@ struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
int guess = atm_guess_pdu2truesize(pdu_size);
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);
if (skb) {
atomic_add(skb->truesize-guess,&vcc->rx_inuse);
atomic_add(skb->truesize-guess,&vcc->sk->rmem_alloc);
return skb;
}
}
......
......@@ -63,7 +63,7 @@ static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip)
ctrl->itf_num = itf;
ctrl->ip = ip;
atm_force_charge(atmarpd,skb->truesize);
skb_queue_tail(&atmarpd->recvq,skb);
skb_queue_tail(&atmarpd->sk->receive_queue,skb);
wake_up(&atmarpd->sleep);
return 0;
}
......@@ -426,7 +426,7 @@ static int clip_start_xmit(struct sk_buff *skb,struct net_device *dev)
memcpy(here,llc_oui,sizeof(llc_oui));
((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)->atm_options = vcc->atm_options;
entry->vccs->last_use = jiffies;
......@@ -485,7 +485,7 @@ int clip_mkip(struct atm_vcc *vcc,int timeout)
vcc->push = clip_push;
vcc->pop = clip_pop;
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 */
while ((skb = skb_dequeue(&copy)))
if (!clip_devs) {
......@@ -691,10 +691,10 @@ static void atmarpd_close(struct atm_vcc *vcc)
barrier();
unregister_inetaddr_notifier(&clip_inet_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 "
"pending\n");
skb_queue_purge(&vcc->recvq);
skb_queue_purge(&vcc->sk->receive_queue);
DPRINTK("(done)\n");
}
......
......@@ -85,14 +85,14 @@ static struct sk_buff *alloc_tx(struct atm_vcc *vcc,unsigned int size)
{
struct sk_buff *skb;
if (atomic_read(&vcc->tx_inuse) && !atm_may_send(vcc,size)) {
DPRINTK("Sorry: tx_inuse = %d, size = %d, sndbuf = %d\n",
atomic_read(&vcc->tx_inuse),size,vcc->sk->sndbuf);
if (atomic_read(&vcc->sk->wmem_alloc) && !atm_may_send(vcc,size)) {
DPRINTK("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n",
atomic_read(&vcc->sk->wmem_alloc),size,vcc->sk->sndbuf);
return NULL;
}
while (!(skb = alloc_skb(size,GFP_KERNEL))) schedule();
DPRINTK("AlTx %d += %d\n",atomic_read(&vcc->tx_inuse),skb->truesize);
atomic_add(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse);
DPRINTK("AlTx %d += %d\n",atomic_read(&vcc->sk->wmem_alloc),skb->truesize);
atomic_add(skb->truesize+ATM_PDU_OVHD,&vcc->sk->wmem_alloc);
return skb;
}
......@@ -108,21 +108,19 @@ int atm_create(struct socket *sock,int protocol,int family)
vcc = atm_sk(sk);
memset(&vcc->flags,0,sizeof(vcc->flags));
vcc->dev = NULL;
vcc->family = sock->ops->family;
vcc->alloc_tx = alloc_tx;
vcc->callback = NULL;
memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc));
memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc));
vcc->qos.txtp.max_sdu = 1 << 16; /* for meta VCs */
atomic_set(&vcc->tx_inuse,0);
atomic_set(&vcc->rx_inuse,0);
atomic_set(&vcc->sk->wmem_alloc,0);
atomic_set(&vcc->sk->rmem_alloc,0);
vcc->push = NULL;
vcc->pop = NULL;
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);
skb_queue_head_init(&vcc->recvq);
skb_queue_head_init(&vcc->listenq);
sk->sleep = &vcc->sleep;
sock->sk = sk;
......@@ -139,7 +137,7 @@ void atm_release_vcc_sk(struct sock *sk,int free_sk)
if (vcc->dev) {
if (vcc->dev->ops->close) vcc->dev->ops->close(vcc);
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);
if (vcc->dev->ops->free_rx_skb)
vcc->dev->ops->free_rx_skb(vcc,skb);
......@@ -147,10 +145,10 @@ void atm_release_vcc_sk(struct sock *sk,int free_sk)
}
spin_lock (&atm_dev_lock);
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 ... "
"rx_inuse == %d after closing\n",
atomic_read(&vcc->rx_inuse));
"rmem_alloc == %d after closing\n",
atomic_read(&vcc->sk->rmem_alloc));
bind_vcc(vcc,NULL);
} else
spin_lock (&atm_dev_lock);
......@@ -305,11 +303,15 @@ int atm_connect_vcc(struct atm_vcc *vcc,int itf,short vpi,int vci)
if (error) return error;
}
else {
struct atm_dev *dev;
struct atm_dev *dev = NULL;
struct list_head *p;
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;
dev = NULL;
}
spin_unlock (&atm_dev_lock);
if (!dev) return -ENODEV;
}
......@@ -354,7 +356,7 @@ int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
add_wait_queue(&vcc->sleep,&wait);
set_current_state(TASK_INTERRUPTIBLE);
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) ||
test_bit(ATM_VF_CLOSE,&vcc->flags)) {
error = vcc->reply;
......@@ -385,7 +387,7 @@ int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
if (vcc->dev->ops->feedback)
vcc->dev->ops->feedback(vcc,skb,(unsigned long) skb->data,
(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);
if (ATM_SKB(skb)->iovcnt) { /* @@@ hack */
/* iovcnt set, use scatter-gather for receive */
......@@ -488,14 +490,14 @@ unsigned int atm_poll(struct file *file,struct socket *sock,poll_table *wait)
vcc = ATM_SD(sock);
poll_wait(file,&vcc->sleep,wait);
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;
if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
test_bit(ATM_VF_CLOSE,&vcc->flags))
mask |= POLLHUP;
if (sock->state != SS_CONNECTING) {
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)
mask |= POLLOUT | POLLWRNORM;
}
......@@ -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)
{
struct atm_dev *dev;
struct list_head *p;
struct atm_vcc *vcc;
int *tmp_buf, *tmp_p;
void *buf;
......@@ -562,7 +565,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
goto done;
}
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;
goto done;
case SIOCINQ:
......@@ -573,7 +576,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
ret_val = -EINVAL;
goto done;
}
skb = skb_peek(&vcc->recvq);
skb = skb_peek(&vcc->sk->receive_queue);
ret_val = put_user(skb ? skb->len : 0,(int *) arg)
? -EFAULT : 0;
goto done;
......@@ -590,7 +593,7 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
goto done;
}
size = 0;
for (dev = atm_devs; dev; dev = dev->next)
list_for_each(p, &atm_devs)
size += sizeof(int);
if (size > len) {
ret_val = -E2BIG;
......@@ -602,8 +605,10 @@ int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg)
goto done;
}
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;
}
ret_val = ((copy_to_user(buf, tmp_buf, size)) ||
put_user(size, &((struct atm_iobuf *) arg)->length)
) ? -EFAULT : 0;
......@@ -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) return error;
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 svc_change_qos(vcc,qos);
}
......
......@@ -125,7 +125,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->recvq, skb2);
skb_queue_tail(&priv->lecd->sk->receive_queue, skb2);
wake_up(&priv->lecd->sleep);
}
......@@ -202,7 +202,7 @@ static __inline__ void
lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv)
{
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)->iovcnt = 0;
ATM_SKB(skb)->atm_options = vcc->atm_options;
......@@ -399,7 +399,7 @@ lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
int i;
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;
tmp = skb->data;
tmp += sizeof(struct atmlec_msg);
......@@ -505,7 +505,7 @@ lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
skb2->len = sizeof(struct atmlec_msg);
memcpy(skb2->data, mesg, sizeof(struct atmlec_msg));
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);
}
if (f != NULL) br_fdb_put_hook(f);
......@@ -534,10 +534,10 @@ lec_atm_close(struct atm_vcc *vcc)
netif_stop_queue(dev);
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",
dev->name);
while ((skb = skb_dequeue(&vcc->recvq))) {
while ((skb = skb_dequeue(&vcc->sk->receive_queue))) {
atm_return(vcc, skb->truesize);
dev_kfree_skb(skb);
}
......@@ -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);
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);
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->recvq, data);
skb_queue_tail(&priv->lecd->sk->receive_queue, data);
wake_up(&priv->lecd->sleep);
}
......@@ -683,7 +683,7 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
#endif /* DUMP_PACKETS > 0 */
if (memcmp(skb->data, lec_ctrl_magic, 4) ==0) { /* Control frame, to daemon*/
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);
} else { /* Data frame, queue to protocol handlers */
unsigned char *dst;
......
......@@ -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));
}
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)->atm_options = entry->shortcut->atm_options;
entry->shortcut->send(entry->shortcut, skb);
......@@ -665,7 +665,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
skb->dev = dev;
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);
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);
return;
}
......@@ -841,7 +841,7 @@ static void mpoad_close(struct atm_vcc *vcc)
mpc->in_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);
kfree_skb(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 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) {
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)
skb_put(skb, sizeof(struct k_message));
memcpy(skb->data, mesg, sizeof(struct k_message));
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);
return 0;
......@@ -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;
atm_force_charge(vcc, skb->truesize);
skb_queue_tail(&vcc->recvq, skb);
skb_queue_tail(&vcc->sk->receive_queue, skb);
wake_up(&vcc->sleep);
dprintk("mpoa: purge_egress_shortcut: exiting:\n");
......
......@@ -135,7 +135,7 @@ static void atmarp_info(struct net_device *dev,struct atmarp_entry *entry,
unsigned char *ip;
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",
!clip_vcc || clip_vcc->encap ? "LLC" : "NULL",
(jiffies-(clip_vcc ? clip_vcc->last_use : entry->neigh->used))/
......@@ -210,7 +210,7 @@ static void vc_info(struct atm_vcc *vcc,char *buf)
if (!vcc->dev) here += sprintf(here,"Unassigned ");
else here += sprintf(here,"%3d %3d %5d ",vcc->dev->number,vcc->vpi,
vcc->vci);
switch (vcc->family) {
switch (vcc->sk->family) {
case AF_ATMPVC:
here += sprintf(here,"PVC");
break;
......@@ -218,12 +218,12 @@ static void vc_info(struct atm_vcc *vcc,char *buf)
here += sprintf(here,"SVC");
break;
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,
vcc->reply,
atomic_read(&vcc->tx_inuse),vcc->sk->sndbuf,
atomic_read(&vcc->rx_inuse),vcc->sk->rcvbuf);
atomic_read(&vcc->sk->wmem_alloc),vcc->sk->sndbuf,
atomic_read(&vcc->sk->rmem_alloc),vcc->sk->rcvbuf);
}
......@@ -303,6 +303,7 @@ lec_info(struct lec_arp_table *entry, char *buf)
static int atm_devices_info(loff_t pos,char *buf)
{
struct atm_dev *dev;
struct list_head *p;
int left;
if (!pos) {
......@@ -310,10 +311,14 @@ static int atm_devices_info(loff_t pos,char *buf)
"AAL(TX,err,RX,err,drop) ...\n");
}
left = pos-1;
for (dev = atm_devs; dev && left; dev = dev->next) left--;
if (!dev) return 0;
list_for_each(p, &atm_devs) {
dev = list_entry(p, struct atm_dev, dev_list);
if (left-- == 0) {
dev_info(dev,buf);
return strlen(buf);
}
}
return 0;
}
/*
......@@ -324,6 +329,7 @@ static int atm_devices_info(loff_t pos,char *buf)
static int atm_pvc_info(loff_t pos,char *buf)
{
struct atm_dev *dev;
struct list_head *p;
struct atm_vcc *vcc;
int left;
......@@ -332,13 +338,15 @@ static int atm_pvc_info(loff_t pos,char *buf)
"TX(PCR,Class)\n");
}
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)
if (vcc->family == PF_ATMPVC &&
if (vcc->sk->family == PF_ATMPVC &&
vcc->dev && !left--) {
pvc_info(vcc,buf);
return strlen(buf);
}
}
return 0;
}
......@@ -346,6 +354,7 @@ static int atm_pvc_info(loff_t pos,char *buf)
static int atm_vc_info(loff_t pos,char *buf)
{
struct atm_dev *dev;
struct list_head *p;
struct atm_vcc *vcc;
int left;
......@@ -354,12 +363,14 @@ static int atm_vc_info(loff_t pos,char *buf)
"Address"," Itf VPI VCI Fam Flags Reply Send buffer"
" Recv buffer\n");
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)
if (!left--) {
vc_info(vcc,buf);
return strlen(buf);
}
}
for (vcc = nodev_vccs; vcc; vcc = vcc->next)
if (!left--) {
vc_info(vcc,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)
{
struct atm_dev *dev;
struct list_head *p;
struct atm_vcc *vcc;
int left;
if (!pos)
return sprintf(buf,"Itf VPI VCI State Remote\n");
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)
if (vcc->family == PF_ATMSVC && !left--) {
if (vcc->sk->family == PF_ATMSVC && !left--) {
svc_info(vcc,buf);
return strlen(buf);
}
}
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);
return strlen(buf);
}
......
......@@ -28,7 +28,7 @@
void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
{
if (skb) {
skb_queue_tail(&vcc->recvq,skb);
skb_queue_tail(&vcc->sk->receive_queue,skb);
wake_up(&vcc->sleep);
}
}
......@@ -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)
{
DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->tx_inuse,skb->truesize);
atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse);
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);
dev_kfree_skb_any(skb);
wake_up(&vcc->sleep);
}
......
......@@ -26,8 +26,7 @@
#endif
struct atm_dev *atm_devs = NULL;
static struct atm_dev *last_dev = NULL;
LIST_HEAD(atm_devs);
struct atm_vcc *nodev_vccs = NULL;
extern spinlock_t atm_dev_lock;
......@@ -43,15 +42,7 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
dev->type = type;
dev->signal = ATM_PHY_SIG_UNKNOWN;
dev->link_rate = ATM_OC3_PCR;
dev->next = NULL;
dev->prev = last_dev;
if (atm_devs)
last_dev->next = dev;
else
atm_devs = dev;
last_dev = dev;
list_add_tail(&dev->dev_list, &atm_devs);
return dev;
}
......@@ -59,14 +50,7 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
/* Caller must hold atm_dev_lock. */
static void __free_atm_dev(struct atm_dev *dev)
{
if (dev->prev)
dev->prev->next = dev->next;
else
atm_devs = dev->next;
if (dev->next)
dev->next->prev = dev->prev;
else
last_dev = dev->prev;
list_del(&dev->dev_list);
kfree(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 *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)
return dev;
}
return NULL;
}
......
......@@ -10,7 +10,7 @@
#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 */
......
......@@ -61,7 +61,7 @@ static void sigd_put_skb(struct sk_buff *skb)
}
#endif
atm_force_charge(sigd,skb->truesize);
skb_queue_tail(&sigd->recvq,skb);
skb_queue_tail(&sigd->sk->receive_queue,skb);
wake_up(&sigd->sleep);
}
......@@ -98,7 +98,7 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb)
struct atm_vcc *session_vcc;
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,
(unsigned long) msg->vcc);
vcc = *(struct atm_vcc **) &msg->vcc;
......@@ -198,7 +198,7 @@ void sigd_enq(struct atm_vcc *vcc,enum atmsvc_msg_type type,
static void purge_vccs(struct atm_vcc *vcc)
{
while (vcc) {
if (vcc->family == PF_ATMSVC &&
if (vcc->sk->family == PF_ATMSVC &&
!test_bit(ATM_VF_META,&vcc->flags)) {
set_bit(ATM_VF_RELEASED,&vcc->flags);
vcc->reply = -EUNATCH;
......@@ -212,16 +212,20 @@ static void purge_vccs(struct atm_vcc *vcc)
static void sigd_close(struct atm_vcc *vcc)
{
struct atm_dev *dev;
struct list_head *p;
DPRINTK("sigd_close\n");
sigd = NULL;
if (skb_peek(&vcc->recvq))
if (skb_peek(&vcc->sk->receive_queue))
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);
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);
}
......
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