205-skb_padding.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --- a/include/linux/skbuff.h
  2. +++ b/include/linux/skbuff.h
  3. @@ -1372,11 +1372,18 @@ static inline int skb_network_offset(con
  4. *
  5. * Various parts of the networking layer expect at least 32 bytes of
  6. * headroom, you should not reduce this.
  7. + *
  8. + * This has been changed to 64 to acommodate for routing between ethernet
  9. + * and wireless, but only for new allocations
  10. */
  11. #ifndef NET_SKB_PAD
  12. #define NET_SKB_PAD 32
  13. #endif
  14. +#ifndef NET_SKB_PAD_ALLOC
  15. +#define NET_SKB_PAD_ALLOC 64
  16. +#endif
  17. +
  18. extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
  19. static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
  20. @@ -1466,9 +1473,9 @@ static inline void __skb_queue_purge(str
  21. static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
  22. gfp_t gfp_mask)
  23. {
  24. - struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
  25. + struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD_ALLOC, gfp_mask);
  26. if (likely(skb))
  27. - skb_reserve(skb, NET_SKB_PAD);
  28. + skb_reserve(skb, NET_SKB_PAD_ALLOC);
  29. return skb;
  30. }
  31. @@ -1551,7 +1558,7 @@ static inline int __skb_cow(struct sk_bu
  32. delta = headroom - skb_headroom(skb);
  33. if (delta || cloned)
  34. - return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0,
  35. + return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD_ALLOC), 0,
  36. GFP_ATOMIC);
  37. return 0;
  38. }
  39. --- a/net/core/skbuff.c
  40. +++ b/net/core/skbuff.c
  41. @@ -339,9 +339,9 @@ struct sk_buff *__netdev_alloc_skb(struc
  42. int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1;
  43. struct sk_buff *skb;
  44. - skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node);
  45. + skb = __alloc_skb(length + NET_SKB_PAD_ALLOC, gfp_mask, 0, node);
  46. if (likely(skb)) {
  47. - skb_reserve(skb, NET_SKB_PAD);
  48. + skb_reserve(skb, NET_SKB_PAD_ALLOC);
  49. skb->dev = dev;
  50. }
  51. return skb;