netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next v2 1/4] openvswitch: actions: use skb_postpull_rcsum when possible
@ 2014-11-12 14:52 Jiri Pirko
  2014-11-12 14:52 ` [patch net-next v2 2/4] net: move make_writable helper into common code Jiri Pirko
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Jiri Pirko @ 2014-11-12 14:52 UTC (permalink / raw)
  To: netdev
  Cc: davem, jhs, pshelar, therbert, edumazet, willemb, dborkman, mst,
	fw, Paul.Durrant, tgraf

Replace duplicated code by calling skb_postpull_rcsum

Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 net/openvswitch/actions.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 394efa6..749a301 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -175,10 +175,7 @@ static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key,
 	if (unlikely(err))
 		return err;
 
-	if (skb->ip_summed == CHECKSUM_COMPLETE)
-		skb->csum = csum_sub(skb->csum,
-				     csum_partial(skb_mpls_header(skb),
-						  MPLS_HLEN, 0));
+	skb_postpull_rcsum(skb, skb_mpls_header(skb), MPLS_HLEN);
 
 	memmove(skb_mac_header(skb) + MPLS_HLEN, skb_mac_header(skb),
 		skb->mac_len);
@@ -230,9 +227,7 @@ static int __pop_vlan_tci(struct sk_buff *skb, __be16 *current_tci)
 	if (unlikely(err))
 		return err;
 
-	if (skb->ip_summed == CHECKSUM_COMPLETE)
-		skb->csum = csum_sub(skb->csum, csum_partial(skb->data
-					+ (2 * ETH_ALEN), VLAN_HLEN, 0));
+	skb_postpull_rcsum(skb, skb->data + (2 * ETH_ALEN), VLAN_HLEN);
 
 	vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN);
 	*current_tci = vhdr->h_vlan_TCI;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread
[parent not found: <reply-to=1415700789-9171-2-git-send-email-jiri@resnulli.us>]

end of thread, other threads:[~2014-11-18 20:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-12 14:52 [patch net-next v2 1/4] openvswitch: actions: use skb_postpull_rcsum when possible Jiri Pirko
2014-11-12 14:52 ` [patch net-next v2 2/4] net: move make_writable helper into common code Jiri Pirko
2014-11-12 19:15   ` Pravin Shelar
2014-11-12 14:52 ` [patch net-next v2 3/4] net: move vlan pop/push functions " Jiri Pirko
2014-11-12 19:17   ` Pravin Shelar
2014-11-12 14:52 ` [patch net-next v2 4/4] sched: introduce vlan action Jiri Pirko
2014-11-12 14:55   ` [patch iproute2] tc: add support for vlan tc action Jiri Pirko
2014-11-16 20:19     ` Jamal Hadi Salim
2014-11-18 20:48       ` Jiri Pirko
2014-11-13 17:07   ` [patch net-next v2 4/4] sched: introduce vlan action Cong Wang
2014-11-12 19:13 ` [patch net-next v2 1/4] openvswitch: actions: use skb_postpull_rcsum when possible Pravin Shelar
     [not found] <reply-to=1415700789-9171-2-git-send-email-jiri@resnulli.us>
2014-11-11 10:16 ` [patch iproute2] tc: add support for vlan tc action Jiri Pirko
2014-11-11 12:35   ` Jamal Hadi Salim
2014-11-11 13:36   ` Jamal Hadi Salim
2014-11-11 13:46     ` Jiri Pirko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).