|
69 | 69 | #include <net/dst.h>
|
70 | 70 | #include <net/sock.h>
|
71 | 71 | #include <net/checksum.h>
|
| 72 | +#include <net/gro.h> |
72 | 73 | #include <net/gso.h>
|
73 | 74 | #include <net/hotdata.h>
|
74 | 75 | #include <net/ip6_checksum.h>
|
|
95 | 96 | static struct kmem_cache *skbuff_ext_cache __ro_after_init;
|
96 | 97 | #endif
|
97 | 98 |
|
98 |
| -#define SKB_SMALL_HEAD_SIZE SKB_HEAD_ALIGN(MAX_TCP_HEADER) |
| 99 | +#define GRO_MAX_HEAD_PAD (GRO_MAX_HEAD + NET_SKB_PAD + NET_IP_ALIGN) |
| 100 | +#define SKB_SMALL_HEAD_SIZE SKB_HEAD_ALIGN(max(MAX_TCP_HEADER, \ |
| 101 | + GRO_MAX_HEAD_PAD)) |
99 | 102 |
|
100 | 103 | /* We want SKB_SMALL_HEAD_CACHE_SIZE to not be a power of two.
|
101 | 104 | * This should ensure that SKB_SMALL_HEAD_HEADROOM is a unique
|
@@ -736,7 +739,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len,
|
736 | 739 | /* If requested length is either too small or too big,
|
737 | 740 | * we use kmalloc() for skb->head allocation.
|
738 | 741 | */
|
739 |
| - if (len <= SKB_WITH_OVERHEAD(1024) || |
| 742 | + if (len <= SKB_WITH_OVERHEAD(SKB_SMALL_HEAD_CACHE_SIZE) || |
740 | 743 | len > SKB_WITH_OVERHEAD(PAGE_SIZE) ||
|
741 | 744 | (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) {
|
742 | 745 | skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE);
|
@@ -816,7 +819,8 @@ struct sk_buff *napi_alloc_skb(struct napi_struct *napi, unsigned int len)
|
816 | 819 | * When the small frag allocator is available, prefer it over kmalloc
|
817 | 820 | * for small fragments
|
818 | 821 | */
|
819 |
| - if ((!NAPI_HAS_SMALL_PAGE_FRAG && len <= SKB_WITH_OVERHEAD(1024)) || |
| 822 | + if ((!NAPI_HAS_SMALL_PAGE_FRAG && |
| 823 | + len <= SKB_WITH_OVERHEAD(SKB_SMALL_HEAD_CACHE_SIZE)) || |
820 | 824 | len > SKB_WITH_OVERHEAD(PAGE_SIZE) ||
|
821 | 825 | (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) {
|
822 | 826 | skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX | SKB_ALLOC_NAPI,
|
|
0 commit comments