All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, "Eric Dumazet" <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Florian Westphal" <fw@strlen.de>
Subject: [PATCH 3.2 07/18] net: add and use skb_gso_transport_seglen()
Date: Mon, 07 Apr 2014 00:35:48 +0100	[thread overview]
Message-ID: <lsq.1396827348.427414191@decadent.org.uk> (raw)
In-Reply-To: <lsq.1396827347.462803115@decadent.org.uk>

3.2.57-rc1 review patch.  If anyone has any objections, please let me know.

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

From: Florian Westphal <fw@strlen.de>

commit de960aa9ab4decc3304959f69533eef64d05d8e8 upstream.

[ no skb_gso_seglen helper in 3.4, leave tbf alone ]

This moves part of Eric Dumazets skb_gso_seglen helper from tbf sched to
skbuff core so it may be reused by upcoming ip forwarding path patch.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 include/linux/skbuff.h |  2 ++
 net/core/skbuff.c      | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2143,6 +2143,8 @@ extern int	       skb_shift(struct sk_bu
 
 extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features);
 
+unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
+
 static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
 				       int len, void *buffer)
 {
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -45,6 +45,8 @@
 #include <linux/in.h>
 #include <linux/inet.h>
 #include <linux/slab.h>
+#include <linux/tcp.h>
+#include <linux/udp.h>
 #include <linux/netdevice.h>
 #ifdef CONFIG_NET_CLS_ACT
 #include <net/pkt_sched.h>
@@ -3181,3 +3183,26 @@ void __skb_warn_lro_forwarding(const str
 			   " while LRO is enabled\n", skb->dev->name);
 }
 EXPORT_SYMBOL(__skb_warn_lro_forwarding);
+
+/**
+ * skb_gso_transport_seglen - Return length of individual segments of a gso packet
+ *
+ * @skb: GSO skb
+ *
+ * skb_gso_transport_seglen is used to determine the real size of the
+ * individual segments, including Layer4 headers (TCP/UDP).
+ *
+ * The MAC/L2 or network (IP, IPv6) headers are not accounted for.
+ */
+unsigned int skb_gso_transport_seglen(const struct sk_buff *skb)
+{
+	const struct skb_shared_info *shinfo = skb_shinfo(skb);
+	unsigned int hdr_len;
+
+	if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
+		hdr_len = tcp_hdrlen(skb);
+	else
+		hdr_len = sizeof(struct udphdr);
+	return hdr_len + shinfo->gso_size;
+}
+EXPORT_SYMBOL_GPL(skb_gso_transport_seglen);


  parent reply	other threads:[~2014-04-06 23:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-06 23:35 [PATCH 3.2 00/18] 3.2.57-rc1 review Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 01/18] Input: synaptics - add manual min/max quirk Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 02/18] Input: synaptics - add manual min/max quirk for ThinkPad X240 Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 14/18] net: asix: add missing flag to struct driver_info Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 10/18] deb-pkg: Fix building for MIPS big-endian or ARM OABI Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 04/18] ext4: atomically set inode->i_flags in ext4_set_inode_flags() Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 17/18] cifs: ensure that uncached writes handle unmapped areas correctly Ben Hutchings
2014-04-07  1:41   ` Ben Hutchings
2014-04-07 13:45     ` Raphael Geissert
2014-04-07 19:14       ` Ben Hutchings
2014-04-06 23:35 ` Ben Hutchings [this message]
2014-04-06 23:35 ` [PATCH 3.2 12/18] asix: asix_rx_fixup surgery to reduce skb truesizes Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 18/18] s390: fix kernel crash due to linkage stack instructions Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 03/18] staging: speakup: Prefix set_mask_bits() symbol Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 13/18] net: asix: handle packets crossing URB boundaries Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 06/18] ipc/msg: fix race around refcount Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 05/18] netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 16/18] KVM: VMX: fix use after free of vmx->loaded_vmcs Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 09/18] deb-pkg: use KCONFIG_CONFIG instead of .config file directly Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 11/18] deb-pkg: Fix cross-building linux-headers package Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 15/18] KVM: MMU: handle invalid root_hpa at __direct_map Ben Hutchings
2014-04-06 23:35 ` [PATCH 3.2 08/18] net: ip, ipv6: handle gso skbs in forwarding path Ben Hutchings
2014-04-07  1:42 ` [PATCH 3.2 00/18] 3.2.57-rc1 review Ben Hutchings
2014-04-07  3:55 ` Guenter Roeck
2014-04-07 12:30   ` Ben Hutchings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lsq.1396827348.427414191@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.