diff options
author | Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> | 2016-06-02 18:05:40 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-03 23:37:21 (GMT) |
commit | 3953c46c3ac7eef31a9935427371c6f54a22f1ba (patch) | |
tree | c23e5494771fbe5c54057d767addbf54c9f880ca | |
parent | 57c05650394b384605f5183747991d19ee543759 (diff) | |
download | linux-3953c46c3ac7eef31a9935427371c6f54a22f1ba.tar.xz |
sk_buff: allow segmenting based on frag sizes
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/skbuff.h | 5 | ||||
-rw-r--r-- | 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 ee38a41..329a0a9 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 4724bcf..97c32c7 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) |