X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fatm%2Fatmtcp.c;h=436b83a1b61873b6777f854885461a942faef1d4;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=0572f724bc5007aede4de27b0b6d2272d471f4f0;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c index 0572f724b..436b83a1b 100644 --- a/drivers/atm/atmtcp.c +++ b/drivers/atm/atmtcp.c @@ -271,6 +271,28 @@ static void atmtcp_c_close(struct atm_vcc *vcc) } } read_unlock(&vcc_sklist_lock); + module_put(THIS_MODULE); +} + + +static struct atm_vcc *find_vcc(struct atm_dev *dev, short vpi, int vci) +{ + struct hlist_head *head; + struct atm_vcc *vcc; + struct hlist_node *node; + struct sock *s; + + head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; + + sk_for_each(s, node, head) { + vcc = atm_sk(s); + if (vcc->dev == dev && + vcc->vci == vci && vcc->vpi == vpi && + vcc->qos.rxtp.traffic_class != ATM_NONE) { + return vcc; + } + } + return NULL; } @@ -278,11 +300,9 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb) { struct atm_dev *dev; struct atmtcp_hdr *hdr; - struct sock *s; - struct hlist_node *node; - struct atm_vcc *out_vcc = NULL; + struct atm_vcc *out_vcc; struct sk_buff *new_skb; - int i, result = 0; + int result = 0; if (!skb->len) return 0; dev = vcc->dev_data; @@ -293,19 +313,7 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb) goto done; } read_lock(&vcc_sklist_lock); - for(i = 0; i < VCC_HTABLE_SIZE; ++i) { - struct hlist_head *head = &vcc_hash[i]; - - sk_for_each(s, node, head) { - out_vcc = atm_sk(s); - 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; - } - } + out_vcc = find_vcc(dev, ntohs(hdr->vpi), ntohs(hdr->vci)); read_unlock(&vcc_sklist_lock); if (!out_vcc) { atomic_inc(&vcc->stats->tx_err); @@ -388,7 +396,7 @@ static int atmtcp_create(int itf,int persist,struct atm_dev **result) } -int atmtcp_attach(struct atm_vcc *vcc,int itf) +static int atmtcp_attach(struct atm_vcc *vcc,int itf) { struct atm_dev *dev; @@ -419,13 +427,13 @@ int atmtcp_attach(struct atm_vcc *vcc,int itf) } -int atmtcp_create_persistent(int itf) +static int atmtcp_create_persistent(int itf) { return atmtcp_create(itf,1,NULL); } -int atmtcp_remove_persistent(int itf) +static int atmtcp_remove_persistent(int itf) { struct atm_dev *dev; struct atmtcp_dev_data *dev_data;