Re: [PATCH net-next 08/12] r8152: support TSO

From: Eric Dumazet
Date: Tue Mar 04 2014 - 11:11:32 EST


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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/