Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1401956

[PATCH 4.5 009/101] net: use skb_postpush_rcsum instead of own implementations

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.5 009/101] net: use skb_postpush_rcsum instead of own implementations
Date 2016-05-17 03:50 +0200
Message-ID <rzCj1-6q8-29@gated-at.bofh.it> (permalink)
References <rzBZD-6iF-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.5-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <daniel@iogearbox.net>

[ Upstream commit 6b83d28a55a891a9d70fc61ccb1c138e47dcbe74 ]

Replace individual implementations with the recently introduced
skb_postpush_rcsum() helper.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Tom Herbert <tom@herbertland.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/skbuff.c              |    4 +---
 net/ipv6/reassembly.c          |    6 ++----
 net/openvswitch/actions.c      |    8 +++-----
 net/openvswitch/vport-netdev.c |    2 +-
 net/openvswitch/vport.h        |    7 -------
 5 files changed, 7 insertions(+), 20 deletions(-)

--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4433,9 +4433,7 @@ int skb_vlan_push(struct sk_buff *skb, _
 		skb->mac_len += VLAN_HLEN;
 		__skb_pull(skb, offset);
 
-		if (skb->ip_summed == CHECKSUM_COMPLETE)
-			skb->csum = csum_add(skb->csum, csum_partial(skb->data
-					+ (2 * ETH_ALEN), VLAN_HLEN, 0));
+		skb_postpush_rcsum(skb, skb->data + (2 * ETH_ALEN), VLAN_HLEN);
 	}
 	__vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);
 	return 0;
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -496,10 +496,8 @@ static int ip6_frag_reasm(struct frag_qu
 	IP6CB(head)->flags |= IP6SKB_FRAGMENTED;
 
 	/* Yes, and fold redundant checksum back. 8) */
-	if (head->ip_summed == CHECKSUM_COMPLETE)
-		head->csum = csum_partial(skb_network_header(head),
-					  skb_network_header_len(head),
-					  head->csum);
+	skb_postpush_rcsum(head, skb_network_header(head),
+			   skb_network_header_len(head));
 
 	rcu_read_lock();
 	IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMOKS);
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -158,9 +158,7 @@ static int push_mpls(struct sk_buff *skb
 	new_mpls_lse = (__be32 *)skb_mpls_header(skb);
 	*new_mpls_lse = mpls->mpls_lse;
 
-	if (skb->ip_summed == CHECKSUM_COMPLETE)
-		skb->csum = csum_add(skb->csum, csum_partial(new_mpls_lse,
-							     MPLS_HLEN, 0));
+	skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN);
 
 	hdr = eth_hdr(skb);
 	hdr->h_proto = mpls->mpls_ethertype;
@@ -280,7 +278,7 @@ static int set_eth_addr(struct sk_buff *
 	ether_addr_copy_masked(eth_hdr(skb)->h_dest, key->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.dst, eth_hdr(skb)->h_dest);
@@ -639,7 +637,7 @@ static int ovs_vport_output(struct net *
 	/* Reconstruct the MAC header.  */
 	skb_push(skb, 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);
 
 	ovs_vport_send(vport, skb);
--- a/net/openvswitch/vport-netdev.c
+++ b/net/openvswitch/vport-netdev.c
@@ -58,7 +58,7 @@ static void netdev_port_receive(struct s
 		return;
 
 	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));
 	return;
 error:
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -185,13 +185,6 @@ static inline struct vport *vport_from_p
 int ovs_vport_receive(struct vport *, struct sk_buff *,
 		      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)
 {
 	return vport->dev->name;

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.5 000/101] 4.5.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 051/101] crypto: testmgr - Use kmalloc memory for RSA input Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 005/101] net: sched: do not requeue a NULL skb Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 047/101] mm: thp: calculate the mapcount correctly for THP pages during WP faults Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 060/101] pinctrl: at91-pio4: fix pull-up/down logic Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 002/101] decnet: Do not build routes to devices without decnet private data. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 019/101] net/mlx4_en: fix spurious timestamping callbacks Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 009/101] net: use skb_postpush_rcsum instead of own implementations Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 053/101] ALSA: usb-audio: Yet another Phoneix Audio device quirk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 057/101] spi: pxa2xx: Do not detect number of enabled chip selects on Intel SPT Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 048/101] crypto: qat - fix invalid pf2vf_resp_wq logic Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 055/101] ALSA: hda - Fix white noise on Asus UX501VW headset Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 045/101] ocfs2: fix posix_acl_create deadlock Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 064/101] vfs: add vfs_select_inode() helper Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 062/101] perf diff: Fix duplicated output column Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 046/101] zsmalloc: fix zs_can_compact() integer overflow Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 052/101] ALSA: usb-audio: Quirk for yet another Phoenix Audio devices (v2) Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 023/101] samples/bpf: fix trace_output example Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 041/101] net: thunderx: avoid exposing kernel stack Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 016/101] net/mlx5e: Fix minimum MTU Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 050/101] crypto: hash - Fix page length clamping in hash walk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 043/101] net/route: enforce hoplimit max value Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 024/101] net: Implement net_dbg_ratelimited() for CONFIG_DYNAMIC_DEBUG case Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 061/101] regmap: spmi: Fix regmap_spmi_ext_read in multi-byte case Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 029/101] sch_dsmark: update backlog as well Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 021/101] bpf: fix refcnt overflow Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  [PATCH 4.5 049/101] crypto: qat - fix adf_ctl_drv.c:undefined reference to adf_init_pf_wq Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:50 +0200
  Re: [PATCH 4.5 000/101] 4.5.5-stable review Guenter Roeck <linux@roeck-us.net> - 2016-05-17 19:30 +0200
  Re: [PATCH 4.5 000/101] 4.5.5-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2016-05-17 19:30 +0200

csiph-web