aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2014-11-19 08:04:55 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-21 14:20:16 -0500
commit1abcd82c20e7cbfd2b89d834b24ff68feae158ec (patch)
tree761effa3c9f8091efcb2e4377e677ca309ad3d59 /net/openvswitch
parentfe1591224a1c454f4344d59e11ccd44577c00508 (diff)
openvswitch: actions: use skb_postpull_rcsum when possible
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>
Diffstat (limited to 'net/openvswitch')
-rw-r--r--net/openvswitch/actions.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 394efa67934e..749a30163071 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,
175 if (unlikely(err)) 175 if (unlikely(err))
176 return err; 176 return err;
177 177
178 if (skb->ip_summed == CHECKSUM_COMPLETE) 178 skb_postpull_rcsum(skb, skb_mpls_header(skb), MPLS_HLEN);
179 skb->csum = csum_sub(skb->csum,
180 csum_partial(skb_mpls_header(skb),
181 MPLS_HLEN, 0));
182 179
183 memmove(skb_mac_header(skb) + MPLS_HLEN, skb_mac_header(skb), 180 memmove(skb_mac_header(skb) + MPLS_HLEN, skb_mac_header(skb),
184 skb->mac_len); 181 skb->mac_len);
@@ -230,9 +227,7 @@ static int __pop_vlan_tci(struct sk_buff *skb, __be16 *current_tci)
230 if (unlikely(err)) 227 if (unlikely(err))
231 return err; 228 return err;
232 229
233 if (skb->ip_summed == CHECKSUM_COMPLETE) 230 skb_postpull_rcsum(skb, skb->data + (2 * ETH_ALEN), VLAN_HLEN);
234 skb->csum = csum_sub(skb->csum, csum_partial(skb->data
235 + (2 * ETH_ALEN), VLAN_HLEN, 0));
236 231
237 vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN); 232 vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN);
238 *current_tci = vhdr->h_vlan_TCI; 233 *current_tci = vhdr->h_vlan_TCI;