On Tue, 2014-03-04 at 20:01 +0800, Hayes Wang wrote:

> +static u32 r8152_xmit_frags(struct r8152 *tp, struct sk_buff *skb, u8 *data)
> +{
> +     struct skb_shared_info *info = skb_shinfo(skb);
> +     unsigned int cur_frag;
> +     u32 total = skb_headlen(skb);
> +
> +     memcpy(data, skb->data, total);
> +     data += total;
> +
> +     for (cur_frag = 0; cur_frag < info->nr_frags; cur_frag++) {
> +             const skb_frag_t *frag = info->frags + cur_frag;
> +             void *addr;
> +             u32 len;
> +
> +             len = skb_frag_size(frag);
> +             addr = skb_frag_address(frag);
> +             memcpy(data, addr, len);
> +             data += len;
> +             total += len;
>       }
> +
> +     return total;
>  }
>  

I would rather use skb_copy_bits(), because it correctly handles
kmap() case. (If a frag resides in high memory)



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to