Skip to content

Commit

Permalink
openvswitch: actions: use skb_postpull_rcsum when possible
Browse files Browse the repository at this point in the history
Replace duplicated code by calling skb_postpull_rcsum

Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Nov 21, 2014
1 parent fe15912 commit 1abcd82
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions net/openvswitch/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1abcd82

Please sign in to comment.