Skip to content

Commit

Permalink
xfrm: Use frag list abstraction interfaces.
Browse files Browse the repository at this point in the history
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jun 9, 2009
1 parent 1b003be commit d4fd3bc
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions net/xfrm/xfrm_algo.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,9 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc,
{
int start = skb_headlen(skb);
int i, copy = start - offset;
int err;
struct sk_buff *frag_iter;
struct scatterlist sg;
int err;

/* Checksum header. */
if (copy > 0) {
Expand Down Expand Up @@ -742,28 +743,24 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc,
start = end;
}

if (skb_shinfo(skb)->frag_list) {
struct sk_buff *list = skb_shinfo(skb)->frag_list;

for (; list; list = list->next) {
int end;

WARN_ON(start > offset + len);

end = start + list->len;
if ((copy = end - offset) > 0) {
if (copy > len)
copy = len;
err = skb_icv_walk(list, desc, offset-start,
copy, icv_update);
if (unlikely(err))
return err;
if ((len -= copy) == 0)
return 0;
offset += copy;
}
start = end;
skb_walk_frags(skb, frag_iter) {
int end;

WARN_ON(start > offset + len);

end = start + frag_iter->len;
if ((copy = end - offset) > 0) {
if (copy > len)
copy = len;
err = skb_icv_walk(frag_iter, desc, offset-start,
copy, icv_update);
if (unlikely(err))
return err;
if ((len -= copy) == 0)
return 0;
offset += copy;
}
start = end;
}
BUG_ON(len);
return 0;
Expand Down

0 comments on commit d4fd3bc

Please sign in to comment.