On 2012-10-17 17:59, Sven Eckelmann wrote:
+__be32 batadv_crc32(const struct sk_buff *skb, u8 *payload_ptr) +{
- u32 crc = 0;
- struct sk_buff *iter;
- size_t skip_len, read_len;
- const skb_frag_t *f;
- int i;
- skip_len = payload_ptr - skb->data;
- read_len = skb_headlen(skb) - skip_len;
- if (read_len)
crc = crc32c(crc, payload_ptr, read_len);
- for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
f = &skb_shinfo(skb)->frags[i];
crc = crc32c(crc, skb_frag_address(f), skb_frag_size(f));
- }
- skb_walk_frags(skb, iter)
crc = crc32c(crc, iter->data, skb_headlen(iter));
- return htonl(crc);
+}
I tested the crc'ing of non-linear skb buffers and can confirm that it works as expected, so:
Tested-by: Martin Hundebøll martin@hundeboll.net
... at least for batadv_crc32() :)