sctp: Use frag list abstraction interfaces.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2009-06-09 00:22:35 -07:00
parent 5c313e9a77
commit 1b003be39e
3 changed files with 8 additions and 9 deletions

View file

@ -81,13 +81,13 @@ static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb);
/* Calculate the SCTP checksum of an SCTP packet. */ /* Calculate the SCTP checksum of an SCTP packet. */
static inline int sctp_rcv_checksum(struct sk_buff *skb) static inline int sctp_rcv_checksum(struct sk_buff *skb)
{ {
struct sk_buff *list = skb_shinfo(skb)->frag_list;
struct sctphdr *sh = sctp_hdr(skb); struct sctphdr *sh = sctp_hdr(skb);
__le32 cmp = sh->checksum; __le32 cmp = sh->checksum;
struct sk_buff *list;
__le32 val; __le32 val;
__u32 tmp = sctp_start_cksum((__u8 *)sh, skb_headlen(skb)); __u32 tmp = sctp_start_cksum((__u8 *)sh, skb_headlen(skb));
for (; list; list = list->next) skb_walk_frags(skb, list)
tmp = sctp_update_cksum((__u8 *)list->data, skb_headlen(list), tmp = sctp_update_cksum((__u8 *)list->data, skb_headlen(list),
tmp); tmp);

View file

@ -1881,7 +1881,7 @@ static int sctp_skb_pull(struct sk_buff *skb, int len)
len -= skb_len; len -= skb_len;
__skb_pull(skb, skb_len); __skb_pull(skb, skb_len);
for (list = skb_shinfo(skb)->frag_list; list; list = list->next) { skb_walk_frags(skb, list) {
rlen = sctp_skb_pull(list, len); rlen = sctp_skb_pull(list, len);
skb->len -= (len-rlen); skb->len -= (len-rlen);
skb->data_len -= (len-rlen); skb->data_len -= (len-rlen);
@ -6660,7 +6660,7 @@ static void sctp_sock_rfree_frag(struct sk_buff *skb)
goto done; goto done;
/* Don't forget the fragments. */ /* Don't forget the fragments. */
for (frag = skb_shinfo(skb)->frag_list; frag; frag = frag->next) skb_walk_frags(skb, frag)
sctp_sock_rfree_frag(frag); sctp_sock_rfree_frag(frag);
done: done:
@ -6675,7 +6675,7 @@ static void sctp_skb_set_owner_r_frag(struct sk_buff *skb, struct sock *sk)
goto done; goto done;
/* Don't forget the fragments. */ /* Don't forget the fragments. */
for (frag = skb_shinfo(skb)->frag_list; frag; frag = frag->next) skb_walk_frags(skb, frag)
sctp_skb_set_owner_r_frag(frag, sk); sctp_skb_set_owner_r_frag(frag, sk);
done: done:

View file

@ -976,9 +976,8 @@ static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event,
* In general, the skb passed from IP can have only 1 level of * In general, the skb passed from IP can have only 1 level of
* fragments. But we allow multiple levels of fragments. * fragments. But we allow multiple levels of fragments.
*/ */
for (frag = skb_shinfo(skb)->frag_list; frag; frag = frag->next) { skb_walk_frags(skb, frag)
sctp_ulpevent_receive_data(sctp_skb2event(frag), asoc); sctp_ulpevent_receive_data(sctp_skb2event(frag), asoc);
}
} }
/* Do accounting for bytes just read by user and release the references to /* Do accounting for bytes just read by user and release the references to
@ -1003,7 +1002,7 @@ static void sctp_ulpevent_release_data(struct sctp_ulpevent *event)
goto done; goto done;
/* Don't forget the fragments. */ /* Don't forget the fragments. */
for (frag = skb_shinfo(skb)->frag_list; frag; frag = frag->next) { skb_walk_frags(skb, frag) {
/* NOTE: skb_shinfos are recursive. Although IP returns /* NOTE: skb_shinfos are recursive. Although IP returns
* skb's with only 1 level of fragments, SCTP reassembly can * skb's with only 1 level of fragments, SCTP reassembly can
* increase the levels. * increase the levels.
@ -1026,7 +1025,7 @@ static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event)
goto done; goto done;
/* Don't forget the fragments. */ /* Don't forget the fragments. */
for (frag = skb_shinfo(skb)->frag_list; frag; frag = frag->next) { skb_walk_frags(skb, frag) {
/* NOTE: skb_shinfos are recursive. Although IP returns /* NOTE: skb_shinfos are recursive. Although IP returns
* skb's with only 1 level of fragments, SCTP reassembly can * skb's with only 1 level of fragments, SCTP reassembly can
* increase the levels. * increase the levels.