Commit 3953c46c authored by Marcelo Ricardo Leitner's avatar Marcelo Ricardo Leitner Committed by David S. Miller

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: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Tested-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 57c05650
...@@ -301,6 +301,11 @@ struct sk_buff; ...@@ -301,6 +301,11 @@ struct sk_buff;
#endif #endif
extern int sysctl_max_skb_frags; 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; typedef struct skb_frag_struct skb_frag_t;
struct skb_frag_struct { struct skb_frag_struct {
......
...@@ -3116,9 +3116,13 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, ...@@ -3116,9 +3116,13 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
int hsize; int hsize;
int size; int size;
len = head_skb->len - offset; if (unlikely(mss == GSO_BY_FRAGS)) {
if (len > mss) len = list_skb->len;
len = mss; } else {
len = head_skb->len - offset;
if (len > mss)
len = mss;
}
hsize = skb_headlen(head_skb) - offset; hsize = skb_headlen(head_skb) - offset;
if (hsize < 0) if (hsize < 0)
......
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