struct sk_buff *skb;
struct sock *sk = sk_atm(vcc);
- if (atomic_read(&sk->sk_wmem_alloc) && !atm_may_send(vcc, size)) {
+ if (sk_wmem_alloc_get(sk) && !atm_may_send(vcc, size)) {
pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n",
- atomic_read(&sk->sk_wmem_alloc), size,
+ sk_wmem_alloc_get(sk), size,
sk->sk_sndbuf);
return NULL;
}
- while (!(skb = alloc_skb(size,GFP_KERNEL))) schedule();
- pr_debug("AlTx %d += %d\n", atomic_read(&sk->sk_wmem_alloc),
- skb->truesize);
+ while (!(skb = alloc_skb(size, GFP_KERNEL)))
+ schedule();
+ pr_debug("AlTx %d += %d\n", sk_wmem_alloc_get(sk), skb->truesize);
atomic_add(skb->truesize, &sk->sk_wmem_alloc);
return skb;
}
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(&sk->sk_wmem_alloc, 0);
+ atomic_set(&sk->sk_wmem_alloc, 1);
atomic_set(&sk->sk_rmem_alloc, 0);
vcc->push = NULL;
vcc->pop = NULL;
error = -EINVAL;
goto done;
}
- error = put_user(sk->sk_sndbuf -
- atomic_read(&sk->sk_wmem_alloc),
+ error = put_user(sk->sk_sndbuf - sk_wmem_alloc_get(sk),
(int __user *) argp) ? -EFAULT : 0;
goto done;
case SIOCINQ:
seq_printf(seq, "%3d", sk->sk_family);
}
seq_printf(seq, " %04lx %5d %7d/%7d %7d/%7d [%d]\n", vcc->flags, sk->sk_err,
- atomic_read(&sk->sk_wmem_alloc), sk->sk_sndbuf,
- atomic_read(&sk->sk_rmem_alloc), sk->sk_rcvbuf,
+ sk_wmem_alloc_get(sk), sk->sk_sndbuf,
+ sk_rmem_alloc_get(sk), sk->sk_rcvbuf,
atomic_read(&sk->sk_refcnt));
}
struct sock *sk = sk_atm(vcc);
pr_debug("APopR (%d) %d -= %d\n", vcc->vci,
- atomic_read(&sk->sk_wmem_alloc), skb->truesize);
+ sk_wmem_alloc_get(sk), skb->truesize);
atomic_sub(skb->truesize, &sk->sk_wmem_alloc);
dev_kfree_skb_any(skb);
sk->sk_write_space(sk);