From bed53bd12b41d0c3684d05da8fe584053bc58724 Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Thu, 10 Nov 2011 19:31:24 -0800 Subject: [PATCH] datapath: Use skb_copy_and_csum_dev() to csum upcall packet. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- datapath/datapath.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 5660f2d6..6ebe7a05 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -335,21 +335,6 @@ out: write_seqcount_end(&stats->seqlock); } -static void copy_and_csum_skb(struct sk_buff *skb, void *to) -{ - u16 csum_start, csum_offset; - __wsum csum; - - get_skb_csum_pointers(skb, &csum_start, &csum_offset); - csum_start -= skb_headroom(skb); - - skb_copy_bits(skb, 0, to, csum_start); - - csum = skb_copy_and_csum_bits(skb, csum_start, to + csum_start, - skb->len - csum_start, 0); - *(__sum16 *)(to + csum_start + csum_offset) = csum_fold(csum); -} - static struct genl_family dp_packet_genl_family = { .id = GENL_ID_GENERATE, .hdrsize = sizeof(struct ovs_header), @@ -481,10 +466,8 @@ static int queue_userspace_packet(int dp_ifindex, struct sk_buff *skb, nla_get_u64(upcall_info->userdata)); nla = __nla_reserve(user_skb, OVS_PACKET_ATTR_PACKET, skb->len); - if (skb->ip_summed == CHECKSUM_PARTIAL) - copy_and_csum_skb(skb, nla_data(nla)); - else - skb_copy_bits(skb, 0, nla_data(nla), skb->len); + + skb_copy_and_csum_dev(skb, nla_data(nla)); return genlmsg_unicast(&init_net, user_skb, upcall_info->pid); } -- 2.30.2