patch-2.4.23 linux-2.4.23/drivers/atm/atmtcp.c
Next file: linux-2.4.23/drivers/atm/eni.c
Previous file: linux-2.4.23/drivers/atm/Makefile
Back to the patch index
Back to the overall index
- Lines: 132
- Date:
2003-11-28 10:26:19.000000000 -0800
- Orig file:
linux-2.4.22/drivers/atm/atmtcp.c
- Orig date:
2003-08-25 04:44:41.000000000 -0700
diff -urN linux-2.4.22/drivers/atm/atmtcp.c linux-2.4.23/drivers/atm/atmtcp.c
@@ -153,9 +153,9 @@
static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
{
- unsigned long flags;
struct atm_cirange ci;
struct atm_vcc *vcc;
+ struct sock *s;
if (cmd != ATM_SETCIRANGE) return -ENOIOCTLCMD;
if (copy_from_user(&ci,(void *) arg,sizeof(ci))) return -EFAULT;
@@ -163,14 +163,18 @@
if (ci.vci_bits == ATM_CI_MAX) ci.vci_bits = MAX_VCI_BITS;
if (ci.vpi_bits > MAX_VPI_BITS || ci.vpi_bits < 0 ||
ci.vci_bits > MAX_VCI_BITS || ci.vci_bits < 0) return -EINVAL;
- spin_lock_irqsave(&dev->lock, flags);
- for (vcc = dev->vccs; vcc; vcc = vcc->next)
+ read_lock(&vcc_sklist_lock);
+ for (s = vcc_sklist; s; s = s->next) {
+ vcc = s->protinfo.af_atm;
+ if (vcc->dev != dev)
+ continue;
if ((vcc->vpi >> ci.vpi_bits) ||
(vcc->vci >> ci.vci_bits)) {
- spin_unlock_irqrestore(&dev->lock, flags);
+ read_unlock(&vcc_sklist_lock);
return -EBUSY;
}
- spin_unlock_irqrestore(&dev->lock, flags);
+ }
+ read_unlock(&vcc_sklist_lock);
dev->ci_range = ci;
return 0;
}
@@ -233,9 +237,9 @@
static void atmtcp_c_close(struct atm_vcc *vcc)
{
- unsigned long flags;
struct atm_dev *atmtcp_dev;
struct atmtcp_dev_data *dev_data;
+ struct sock *s;
struct atm_vcc *walk;
atmtcp_dev = (struct atm_dev *) vcc->dev_data;
@@ -246,19 +250,23 @@
kfree(dev_data);
shutdown_atm_dev(atmtcp_dev);
vcc->dev_data = NULL;
- spin_lock_irqsave(&atmtcp_dev->lock, flags);
- for (walk = atmtcp_dev->vccs; walk; walk = walk->next)
+ read_lock(&vcc_sklist_lock);
+ for (s = vcc_sklist; s; s = s->next) {
+ walk = s->protinfo.af_atm;
+ if (walk->dev != atmtcp_dev)
+ continue;
wake_up(&walk->sleep);
- spin_unlock_irqrestore(&atmtcp_dev->lock, flags);
+ }
+ read_unlock(&vcc_sklist_lock);
}
static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb)
{
- unsigned long flags;
struct atm_dev *dev;
struct atmtcp_hdr *hdr;
- struct atm_vcc *out_vcc;
+ struct sock *s;
+ struct atm_vcc *out_vcc = NULL;
struct sk_buff *new_skb;
int result = 0;
@@ -270,13 +278,17 @@
(struct atmtcp_control *) skb->data);
goto done;
}
- spin_lock_irqsave(&dev->lock, flags);
- for (out_vcc = dev->vccs; out_vcc; out_vcc = out_vcc->next)
+ read_lock(&vcc_sklist_lock);
+ for (s = vcc_sklist; s; s = s->next) {
+ out_vcc = s->protinfo.af_atm;
+ if (out_vcc->dev != dev)
+ continue;
if (out_vcc->vpi == ntohs(hdr->vpi) &&
out_vcc->vci == ntohs(hdr->vci) &&
out_vcc->qos.rxtp.traffic_class != ATM_NONE)
break;
- spin_unlock_irqrestore(&dev->lock, flags);
+ }
+ read_unlock(&vcc_sklist_lock);
if (!out_vcc) {
atomic_inc(&vcc->stats->tx_err);
goto done;
@@ -366,7 +378,7 @@
if (itf != -1) dev = atm_dev_lookup(itf);
if (dev) {
if (dev->ops != &atmtcp_v_dev_ops) {
- atm_dev_release(dev);
+ atm_dev_put(dev);
return -EMEDIUMTYPE;
}
if (PRIV(dev)->vcc) return -EBUSY;
@@ -378,7 +390,8 @@
if (error) return error;
}
PRIV(dev)->vcc = vcc;
- bind_vcc(vcc,&atmtcp_control_dev);
+ vcc->dev = &atmtcp_control_dev;
+ vcc_insert_socket(vcc->sk);
set_bit(ATM_VF_META,&vcc->flags);
set_bit(ATM_VF_READY,&vcc->flags);
vcc->dev_data = dev;
@@ -402,7 +415,7 @@
dev = atm_dev_lookup(itf);
if (!dev) return -ENODEV;
if (dev->ops != &atmtcp_v_dev_ops) {
- atm_dev_release(dev);
+ atm_dev_put(dev);
return -EMEDIUMTYPE;
}
dev_data = PRIV(dev);
@@ -410,7 +423,7 @@
dev_data->persist = 0;
if (PRIV(dev)->vcc) return 0;
kfree(dev_data);
- atm_dev_release(dev);
+ atm_dev_put(dev);
shutdown_atm_dev(dev);
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)