Commit 6b83d28a authored by Daniel Borkmann's avatar Daniel Borkmann Committed by David S. Miller

net: use skb_postpush_rcsum instead of own implementations

Replace individual implementations with the recently introduced
skb_postpush_rcsum() helper.
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarTom Herbert <tom@herbertland.com>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 321b4d4b
...@@ -4496,9 +4496,7 @@ int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci) ...@@ -4496,9 +4496,7 @@ int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci)
skb->mac_len += VLAN_HLEN; skb->mac_len += VLAN_HLEN;
__skb_pull(skb, offset); __skb_pull(skb, offset);
if (skb->ip_summed == CHECKSUM_COMPLETE) skb_postpush_rcsum(skb, skb->data + (2 * ETH_ALEN), VLAN_HLEN);
skb->csum = csum_add(skb->csum, csum_partial(skb->data
+ (2 * ETH_ALEN), VLAN_HLEN, 0));
} }
__vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci); __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);
return 0; return 0;
......
...@@ -496,10 +496,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, ...@@ -496,10 +496,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
IP6CB(head)->flags |= IP6SKB_FRAGMENTED; IP6CB(head)->flags |= IP6SKB_FRAGMENTED;
/* Yes, and fold redundant checksum back. 8) */ /* Yes, and fold redundant checksum back. 8) */
if (head->ip_summed == CHECKSUM_COMPLETE) skb_postpush_rcsum(head, skb_network_header(head),
head->csum = csum_partial(skb_network_header(head), skb_network_header_len(head));
skb_network_header_len(head),
head->csum);
rcu_read_lock(); rcu_read_lock();
IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMOKS); IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMOKS);
......
...@@ -158,9 +158,7 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key, ...@@ -158,9 +158,7 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key,
new_mpls_lse = (__be32 *)skb_mpls_header(skb); new_mpls_lse = (__be32 *)skb_mpls_header(skb);
*new_mpls_lse = mpls->mpls_lse; *new_mpls_lse = mpls->mpls_lse;
if (skb->ip_summed == CHECKSUM_COMPLETE) skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN);
skb->csum = csum_add(skb->csum, csum_partial(new_mpls_lse,
MPLS_HLEN, 0));
hdr = eth_hdr(skb); hdr = eth_hdr(skb);
hdr->h_proto = mpls->mpls_ethertype; hdr->h_proto = mpls->mpls_ethertype;
...@@ -280,7 +278,7 @@ static int set_eth_addr(struct sk_buff *skb, struct sw_flow_key *flow_key, ...@@ -280,7 +278,7 @@ static int set_eth_addr(struct sk_buff *skb, struct sw_flow_key *flow_key,
ether_addr_copy_masked(eth_hdr(skb)->h_dest, key->eth_dst, ether_addr_copy_masked(eth_hdr(skb)->h_dest, key->eth_dst,
mask->eth_dst); mask->eth_dst);
ovs_skb_postpush_rcsum(skb, eth_hdr(skb), ETH_ALEN * 2); skb_postpush_rcsum(skb, eth_hdr(skb), ETH_ALEN * 2);
ether_addr_copy(flow_key->eth.src, eth_hdr(skb)->h_source); ether_addr_copy(flow_key->eth.src, eth_hdr(skb)->h_source);
ether_addr_copy(flow_key->eth.dst, eth_hdr(skb)->h_dest); ether_addr_copy(flow_key->eth.dst, eth_hdr(skb)->h_dest);
...@@ -639,7 +637,7 @@ static int ovs_vport_output(struct net *net, struct sock *sk, struct sk_buff *sk ...@@ -639,7 +637,7 @@ static int ovs_vport_output(struct net *net, struct sock *sk, struct sk_buff *sk
/* Reconstruct the MAC header. */ /* Reconstruct the MAC header. */
skb_push(skb, data->l2_len); skb_push(skb, data->l2_len);
memcpy(skb->data, &data->l2_data, data->l2_len); memcpy(skb->data, &data->l2_data, data->l2_len);
ovs_skb_postpush_rcsum(skb, skb->data, data->l2_len); skb_postpush_rcsum(skb, skb->data, data->l2_len);
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
ovs_vport_send(vport, skb); ovs_vport_send(vport, skb);
......
...@@ -58,7 +58,7 @@ static void netdev_port_receive(struct sk_buff *skb) ...@@ -58,7 +58,7 @@ static void netdev_port_receive(struct sk_buff *skb)
return; return;
skb_push(skb, ETH_HLEN); skb_push(skb, ETH_HLEN);
ovs_skb_postpush_rcsum(skb, skb->data, ETH_HLEN); skb_postpush_rcsum(skb, skb->data, ETH_HLEN);
ovs_vport_receive(vport, skb, skb_tunnel_info(skb)); ovs_vport_receive(vport, skb, skb_tunnel_info(skb));
return; return;
error: error:
......
...@@ -185,13 +185,6 @@ static inline struct vport *vport_from_priv(void *priv) ...@@ -185,13 +185,6 @@ static inline struct vport *vport_from_priv(void *priv)
int ovs_vport_receive(struct vport *, struct sk_buff *, int ovs_vport_receive(struct vport *, struct sk_buff *,
const struct ip_tunnel_info *); const struct ip_tunnel_info *);
static inline void ovs_skb_postpush_rcsum(struct sk_buff *skb,
const void *start, unsigned int len)
{
if (skb->ip_summed == CHECKSUM_COMPLETE)
skb->csum = csum_add(skb->csum, csum_partial(start, len, 0));
}
static inline const char *ovs_vport_name(struct vport *vport) static inline const char *ovs_vport_name(struct vport *vport)
{ {
return vport->dev->name; return vport->dev->name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment