aboutsummaryrefslogtreecommitdiffstats
path: root/net/appletalk/ddp.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-09-08 20:55:21 -0400
committerDan Williams <dan.j.williams@intel.com>2009-09-08 20:55:21 -0400
commitbbb20089a3275a19e475dbc21320c3742e3ca423 (patch)
tree216fdc1cbef450ca688135c5b8969169482d9a48 /net/appletalk/ddp.c
parent3e48e656903e9fd8bc805c6a2c4264d7808d315b (diff)
parent657a77fa7284d8ae28dfa48f1dc5d919bf5b2843 (diff)
Merge branch 'dmaengine' into async-tx-next
Conflicts: crypto/async_tx/async_xor.c drivers/dma/ioat/dma_v2.h drivers/dma/ioat/pci.c drivers/md/raid5.c
Diffstat (limited to 'net/appletalk/ddp.c')
-rw-r--r--net/appletalk/ddp.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index d6a9243641af..590b83963622 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -162,8 +162,7 @@ static void atalk_destroy_timer(unsigned long data)
162{ 162{
163 struct sock *sk = (struct sock *)data; 163 struct sock *sk = (struct sock *)data;
164 164
165 if (atomic_read(&sk->sk_wmem_alloc) || 165 if (sk_has_allocations(sk)) {
166 atomic_read(&sk->sk_rmem_alloc)) {
167 sk->sk_timer.expires = jiffies + SOCK_DESTROY_TIME; 166 sk->sk_timer.expires = jiffies + SOCK_DESTROY_TIME;
168 add_timer(&sk->sk_timer); 167 add_timer(&sk->sk_timer);
169 } else 168 } else
@@ -175,8 +174,7 @@ static inline void atalk_destroy_socket(struct sock *sk)
175 atalk_remove_socket(sk); 174 atalk_remove_socket(sk);
176 skb_queue_purge(&sk->sk_receive_queue); 175 skb_queue_purge(&sk->sk_receive_queue);
177 176
178 if (atomic_read(&sk->sk_wmem_alloc) || 177 if (sk_has_allocations(sk)) {
179 atomic_read(&sk->sk_rmem_alloc)) {
180 setup_timer(&sk->sk_timer, atalk_destroy_timer, 178 setup_timer(&sk->sk_timer, atalk_destroy_timer,
181 (unsigned long)sk); 179 (unsigned long)sk);
182 sk->sk_timer.expires = jiffies + SOCK_DESTROY_TIME; 180 sk->sk_timer.expires = jiffies + SOCK_DESTROY_TIME;
@@ -939,6 +937,7 @@ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset,
939 int len, unsigned long sum) 937 int len, unsigned long sum)
940{ 938{
941 int start = skb_headlen(skb); 939 int start = skb_headlen(skb);
940 struct sk_buff *frag_iter;
942 int i, copy; 941 int i, copy;
943 942
944 /* checksum stuff in header space */ 943 /* checksum stuff in header space */
@@ -977,26 +976,22 @@ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset,
977 start = end; 976 start = end;
978 } 977 }
979 978
980 if (skb_shinfo(skb)->frag_list) { 979 skb_walk_frags(skb, frag_iter) {
981 struct sk_buff *list = skb_shinfo(skb)->frag_list; 980 int end;
982
983 for (; list; list = list->next) {
984 int end;
985 981
986 WARN_ON(start > offset + len); 982 WARN_ON(start > offset + len);
987 983
988 end = start + list->len; 984 end = start + frag_iter->len;
989 if ((copy = end - offset) > 0) { 985 if ((copy = end - offset) > 0) {
990 if (copy > len) 986 if (copy > len)
991 copy = len; 987 copy = len;
992 sum = atalk_sum_skb(list, offset - start, 988 sum = atalk_sum_skb(frag_iter, offset - start,
993 copy, sum); 989 copy, sum);
994 if ((len -= copy) == 0) 990 if ((len -= copy) == 0)
995 return sum; 991 return sum;
996 offset += copy; 992 offset += copy;
997 }
998 start = end;
999 } 993 }
994 start = end;
1000 } 995 }
1001 996
1002 BUG_ON(len > 0); 997 BUG_ON(len > 0);
@@ -1753,8 +1748,7 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1753 switch (cmd) { 1748 switch (cmd) {
1754 /* Protocol layer */ 1749 /* Protocol layer */
1755 case TIOCOUTQ: { 1750 case TIOCOUTQ: {
1756 long amount = sk->sk_sndbuf - 1751 long amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
1757 atomic_read(&sk->sk_wmem_alloc);
1758 1752
1759 if (amount < 0) 1753 if (amount < 0)
1760 amount = 0; 1754 amount = 0;