diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-06-17 22:06:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-18 03:29:12 -0400 |
commit | 81e2a3d5b75cbf0b42428b9d5a7cc7c85be9e7a7 (patch) | |
tree | cac92ad222a84f30e129b569cb489652a0ca44ef | |
parent | 31e6d363abcd0d05766c82f1a9c905a4c974a199 (diff) |
atm: sk_wmem_alloc initial value is one
commit 2b85a34e911bf483c27cfdd124aeb1605145dc80
(net: No more expensive sock_hold()/sock_put() on each tx)
changed initial sk_wmem_alloc value.
This broke net/atm since this protocol assumed a null
initial value. This patch makes necessary changes.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/atm/common.c | 12 | ||||
-rw-r--r-- | net/atm/ioctl.c | 3 | ||||
-rw-r--r-- | net/atm/proc.c | 4 | ||||
-rw-r--r-- | net/atm/raw.c | 2 |
4 files changed, 10 insertions, 11 deletions
diff --git a/net/atm/common.c b/net/atm/common.c index d34edbe754c8..c1c97936192c 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -62,15 +62,15 @@ static struct sk_buff *alloc_tx(struct atm_vcc *vcc,unsigned int size) | |||
62 | struct sk_buff *skb; | 62 | struct sk_buff *skb; |
63 | struct sock *sk = sk_atm(vcc); | 63 | struct sock *sk = sk_atm(vcc); |
64 | 64 | ||
65 | if (atomic_read(&sk->sk_wmem_alloc) && !atm_may_send(vcc, size)) { | 65 | if (sk_wmem_alloc_get(sk) && !atm_may_send(vcc, size)) { |
66 | pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n", | 66 | pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n", |
67 | atomic_read(&sk->sk_wmem_alloc), size, | 67 | sk_wmem_alloc_get(sk), size, |
68 | sk->sk_sndbuf); | 68 | sk->sk_sndbuf); |
69 | return NULL; | 69 | return NULL; |
70 | } | 70 | } |
71 | while (!(skb = alloc_skb(size,GFP_KERNEL))) schedule(); | 71 | while (!(skb = alloc_skb(size, GFP_KERNEL))) |
72 | pr_debug("AlTx %d += %d\n", atomic_read(&sk->sk_wmem_alloc), | 72 | schedule(); |
73 | skb->truesize); | 73 | pr_debug("AlTx %d += %d\n", sk_wmem_alloc_get(sk), skb->truesize); |
74 | atomic_add(skb->truesize, &sk->sk_wmem_alloc); | 74 | atomic_add(skb->truesize, &sk->sk_wmem_alloc); |
75 | return skb; | 75 | return skb; |
76 | } | 76 | } |
@@ -145,7 +145,7 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family) | |||
145 | memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc)); | 145 | memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc)); |
146 | memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc)); | 146 | memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc)); |
147 | vcc->qos.txtp.max_sdu = 1 << 16; /* for meta VCs */ | 147 | vcc->qos.txtp.max_sdu = 1 << 16; /* for meta VCs */ |
148 | atomic_set(&sk->sk_wmem_alloc, 0); | 148 | atomic_set(&sk->sk_wmem_alloc, 1); |
149 | atomic_set(&sk->sk_rmem_alloc, 0); | 149 | atomic_set(&sk->sk_rmem_alloc, 0); |
150 | vcc->push = NULL; | 150 | vcc->push = NULL; |
151 | vcc->pop = NULL; | 151 | vcc->pop = NULL; |
diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c index 76ed3c8d26e6..4da8892ced5f 100644 --- a/net/atm/ioctl.c +++ b/net/atm/ioctl.c | |||
@@ -63,8 +63,7 @@ static int do_vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg | |||
63 | error = -EINVAL; | 63 | error = -EINVAL; |
64 | goto done; | 64 | goto done; |
65 | } | 65 | } |
66 | error = put_user(sk->sk_sndbuf - | 66 | error = put_user(sk->sk_sndbuf - sk_wmem_alloc_get(sk), |
67 | atomic_read(&sk->sk_wmem_alloc), | ||
68 | (int __user *) argp) ? -EFAULT : 0; | 67 | (int __user *) argp) ? -EFAULT : 0; |
69 | goto done; | 68 | goto done; |
70 | case SIOCINQ: | 69 | case SIOCINQ: |
diff --git a/net/atm/proc.c b/net/atm/proc.c index e7b3b273907d..38de5ff61ecd 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c | |||
@@ -204,8 +204,8 @@ static void vcc_info(struct seq_file *seq, struct atm_vcc *vcc) | |||
204 | seq_printf(seq, "%3d", sk->sk_family); | 204 | seq_printf(seq, "%3d", sk->sk_family); |
205 | } | 205 | } |
206 | seq_printf(seq, " %04lx %5d %7d/%7d %7d/%7d [%d]\n", vcc->flags, sk->sk_err, | 206 | seq_printf(seq, " %04lx %5d %7d/%7d %7d/%7d [%d]\n", vcc->flags, sk->sk_err, |
207 | atomic_read(&sk->sk_wmem_alloc), sk->sk_sndbuf, | 207 | sk_wmem_alloc_get(sk), sk->sk_sndbuf, |
208 | atomic_read(&sk->sk_rmem_alloc), sk->sk_rcvbuf, | 208 | sk_rmem_alloc_get(sk), sk->sk_rcvbuf, |
209 | atomic_read(&sk->sk_refcnt)); | 209 | atomic_read(&sk->sk_refcnt)); |
210 | } | 210 | } |
211 | 211 | ||
diff --git a/net/atm/raw.c b/net/atm/raw.c index b0a2d8cb6744..cbfcc71a17b1 100644 --- a/net/atm/raw.c +++ b/net/atm/raw.c | |||
@@ -33,7 +33,7 @@ static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb) | |||
33 | struct sock *sk = sk_atm(vcc); | 33 | struct sock *sk = sk_atm(vcc); |
34 | 34 | ||
35 | pr_debug("APopR (%d) %d -= %d\n", vcc->vci, | 35 | pr_debug("APopR (%d) %d -= %d\n", vcc->vci, |
36 | atomic_read(&sk->sk_wmem_alloc), skb->truesize); | 36 | sk_wmem_alloc_get(sk), skb->truesize); |
37 | atomic_sub(skb->truesize, &sk->sk_wmem_alloc); | 37 | atomic_sub(skb->truesize, &sk->sk_wmem_alloc); |
38 | dev_kfree_skb_any(skb); | 38 | dev_kfree_skb_any(skb); |
39 | sk->sk_write_space(sk); | 39 | sk->sk_write_space(sk); |