linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-sctp@vger.kernel.org, Xin Long <lucien.xin@gmail.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	David Laight <David.Laight@ACULAB.COM>,
	Vlad Yasevich <vyasevich@gmail.com>,
	Alexander Duyck <alexander.duyck@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Florian Westphal <fw@strlen.de>,
	Eric Dumazet <eric.dumazet@gmail.com>
Subject: [PATCH v2 3/7] sk_buff: allow segmenting based on frag sizes
Date: Tue, 31 May 2016 18:55:46 +0000	[thread overview]
Message-ID: <e5c12d2bba1cb7f1c199c04d52e481cdd39107e7.1464718103.git.marcelo.leitner@gmail.com> (raw)
In-Reply-To: <cover.1464718103.git.marcelo.leitner@gmail.com>

This patch allows segmenting a skb based on its frags sizes instead of
based on a fixed value.

Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Tested-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/skbuff.h |  5 +++++
 net/core/skbuff.c      | 10 +++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c413c588a24f854be9e4df78d8a6872b6b1ff9f3..1f713541cb2fc232cb0e8417232cb9942409c9fc 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -301,6 +301,11 @@ struct sk_buff;
 #endif
 extern int sysctl_max_skb_frags;
 
+/* Set skb_shinfo(skb)->gso_size to this in case you want skb_segment to
+ * segment using its current segmentation instead.
+ */
+#define GSO_BY_FRAGS	0xFFFF
+
 typedef struct skb_frag_struct skb_frag_t;
 
 struct skb_frag_struct {
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4724bcf9b0cae1cecbe5bc2c04e308bb70b3232a..97c32c75e704af1f31b064e8f1e0475ff1505d67 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3116,9 +3116,13 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
 		int hsize;
 		int size;
 
-		len = head_skb->len - offset;
-		if (len > mss)
-			len = mss;
+		if (unlikely(mss = GSO_BY_FRAGS)) {
+			len = list_skb->len;
+		} else {
+			len = head_skb->len - offset;
+			if (len > mss)
+				len = mss;
+		}
 
 		hsize = skb_headlen(head_skb) - offset;
 		if (hsize < 0)
-- 
2.5.5


  parent reply	other threads:[~2016-05-31 18:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 18:55 [PATCH v2 0/7] sctp: Add GSO support Marcelo Ricardo Leitner
2016-05-31 18:55 ` [PATCH v2 1/7] loopback: make use of NETIF_F_GSO_SOFTWARE Marcelo Ricardo Leitner
2016-05-31 18:55 ` [PATCH v2 2/7] skbuff: export skb_gro_receive Marcelo Ricardo Leitner
2016-05-31 18:55 ` Marcelo Ricardo Leitner [this message]
2016-05-31 18:55 ` [PATCH v2 4/7] skbuff: introduce skb_gso_validate_mtu Marcelo Ricardo Leitner
2016-05-31 19:07   ` Alexander Duyck
2016-05-31 19:54     ` Marcelo Ricardo Leitner
2016-05-31 20:47       ` Alexander Duyck
2016-05-31 18:55 ` [PATCH v2 5/7] sctp: delay as much as possible skb_linearize Marcelo Ricardo Leitner
2016-05-31 18:55 ` [PATCH v2 6/7] sctp: Add GSO support Marcelo Ricardo Leitner
2016-05-31 18:55 ` [PATCH v2 7/7] sctp: improve debug message to also log curr pkt and new chunk size Marcelo Ricardo Leitner

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=e5c12d2bba1cb7f1c199c04d52e481cdd39107e7.1464718103.git.marcelo.leitner@gmail.com \
    --to=marcelo.leitner@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=alexander.duyck@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fw@strlen.de \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=vyasevich@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).