Skip to content

Commit

Permalink
sk_buff: allow segmenting based on frag sizes
Browse files Browse the repository at this point in the history
This patch allows segmenting a skb based on its frags sizes instead of
based on a fixed value.

Signed-off-by: Marcelo Ricardo Leitner <[email protected]>
Tested-by: Xin Long <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
marceloleitner authored and davem330 committed Jun 3, 2016
1 parent 57c0565 commit 3953c46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 7 additions & 3 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3953c46

Please sign in to comment.