gro.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef _NET_GRO_H
  3. #define _NET_GRO_H
  4. #include <linux/indirect_call_wrapper.h>
  5. #include <linux/ip.h>
  6. #include <linux/ipv6.h>
  7. #include <net/ip6_checksum.h>
  8. #include <linux/skbuff.h>
  9. #include <net/udp.h>
  10. #include <net/hotdata.h>
  11. /* This should be increased if a protocol with a bigger head is added. */
  12. #define GRO_MAX_HEAD (MAX_HEADER + 128)
  13. struct napi_gro_cb {
  14. union {
  15. struct {
  16. /* Virtual address of skb_shinfo(skb)->frags[0].page + offset. */
  17. void *frag0;
  18. /* Length of frag0. */
  19. unsigned int frag0_len;
  20. };
  21. struct {
  22. /* used in skb_gro_receive() slow path */
  23. struct sk_buff *last;
  24. /* jiffies when first packet was created/queued */
  25. unsigned long age;
  26. };
  27. };
  28. /* This indicates where we are processing relative to skb->data. */
  29. int data_offset;
  30. /* This is non-zero if the packet cannot be merged with the new skb. */
  31. u16 flush;
  32. /* Number of segments aggregated. */
  33. u16 count;
  34. /* Used in ipv6_gro_receive() and foo-over-udp and esp-in-udp */
  35. u16 proto;
  36. u16 pad;
  37. /* Used in napi_gro_cb::free */
  38. #define NAPI_GRO_FREE 1
  39. #define NAPI_GRO_FREE_STOLEN_HEAD 2
  40. /* portion of the cb set to zero at every gro iteration */
  41. struct_group(zeroed,
  42. /* Start offset for remote checksum offload */
  43. u16 gro_remcsum_start;
  44. /* This is non-zero if the packet may be of the same flow. */
  45. u8 same_flow:1;
  46. /* Used in tunnel GRO receive */
  47. u8 encap_mark:1;
  48. /* GRO checksum is valid */
  49. u8 csum_valid:1;
  50. /* Number of checksums via CHECKSUM_UNNECESSARY */
  51. u8 csum_cnt:3;
  52. /* Free the skb? */
  53. u8 free:2;
  54. /* Used in GRE, set in fou/gue_gro_receive */
  55. u8 is_fou:1;
  56. /* Used to determine if ipid_offset can be ignored */
  57. u8 ip_fixedid:2;
  58. /* Number of gro_receive callbacks this packet already went through */
  59. u8 recursion_counter:4;
  60. /* GRO is done by frag_list pointer chaining. */
  61. u8 is_flist:1;
  62. );
  63. /* used to support CHECKSUM_COMPLETE for tunneling protocols */
  64. __wsum csum;
  65. /* L3 offsets */
  66. union {
  67. struct {
  68. u16 network_offset;
  69. u16 inner_network_offset;
  70. };
  71. u16 network_offsets[2];
  72. };
  73. };
  74. #define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
  75. #define GRO_RECURSION_LIMIT 15
  76. static inline int gro_recursion_inc_test(struct sk_buff *skb)
  77. {
  78. return ++NAPI_GRO_CB(skb)->recursion_counter == GRO_RECURSION_LIMIT;
  79. }
  80. typedef struct sk_buff *(*gro_receive_t)(struct list_head *, struct sk_buff *);
  81. static inline struct sk_buff *call_gro_receive(gro_receive_t cb,
  82. struct list_head *head,
  83. struct sk_buff *skb)
  84. {
  85. if (unlikely(gro_recursion_inc_test(skb))) {
  86. NAPI_GRO_CB(skb)->flush |= 1;
  87. return NULL;
  88. }
  89. return cb(head, skb);
  90. }
  91. typedef struct sk_buff *(*gro_receive_sk_t)(struct sock *, struct list_head *,
  92. struct sk_buff *);
  93. static inline struct sk_buff *call_gro_receive_sk(gro_receive_sk_t cb,
  94. struct sock *sk,
  95. struct list_head *head,
  96. struct sk_buff *skb)
  97. {
  98. if (unlikely(gro_recursion_inc_test(skb))) {
  99. NAPI_GRO_CB(skb)->flush |= 1;
  100. return NULL;
  101. }
  102. return cb(sk, head, skb);
  103. }
  104. static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
  105. {
  106. return NAPI_GRO_CB(skb)->data_offset;
  107. }
  108. static inline unsigned int skb_gro_len(const struct sk_buff *skb)
  109. {
  110. return skb->len - NAPI_GRO_CB(skb)->data_offset;
  111. }
  112. static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
  113. {
  114. NAPI_GRO_CB(skb)->data_offset += len;
  115. }
  116. static inline void *skb_gro_header_fast(const struct sk_buff *skb,
  117. unsigned int offset)
  118. {
  119. return NAPI_GRO_CB(skb)->frag0 + offset;
  120. }
  121. static inline bool skb_gro_may_pull(const struct sk_buff *skb,
  122. unsigned int hlen)
  123. {
  124. return likely(hlen <= NAPI_GRO_CB(skb)->frag0_len);
  125. }
  126. static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
  127. unsigned int offset)
  128. {
  129. if (!pskb_may_pull(skb, hlen))
  130. return NULL;
  131. return skb->data + offset;
  132. }
  133. static inline void *skb_gro_header(struct sk_buff *skb, unsigned int hlen,
  134. unsigned int offset)
  135. {
  136. void *ptr;
  137. ptr = skb_gro_header_fast(skb, offset);
  138. if (!skb_gro_may_pull(skb, hlen))
  139. ptr = skb_gro_header_slow(skb, hlen, offset);
  140. return ptr;
  141. }
  142. static inline int skb_gro_receive_network_offset(const struct sk_buff *skb)
  143. {
  144. return NAPI_GRO_CB(skb)->network_offsets[NAPI_GRO_CB(skb)->encap_mark];
  145. }
  146. static inline void *skb_gro_network_header(const struct sk_buff *skb)
  147. {
  148. if (skb_gro_may_pull(skb, skb_gro_offset(skb)))
  149. return skb_gro_header_fast(skb, skb_gro_receive_network_offset(skb));
  150. return skb->data + skb_gro_receive_network_offset(skb);
  151. }
  152. static inline __wsum inet_gro_compute_pseudo(const struct sk_buff *skb,
  153. int proto)
  154. {
  155. const struct iphdr *iph = skb_gro_network_header(skb);
  156. return csum_tcpudp_nofold(iph->saddr, iph->daddr,
  157. skb_gro_len(skb), proto, 0);
  158. }
  159. static inline void skb_gro_postpull_rcsum(struct sk_buff *skb,
  160. const void *start, unsigned int len)
  161. {
  162. if (NAPI_GRO_CB(skb)->csum_valid)
  163. NAPI_GRO_CB(skb)->csum = wsum_negate(csum_partial(start, len,
  164. wsum_negate(NAPI_GRO_CB(skb)->csum)));
  165. }
  166. /* GRO checksum functions. These are logical equivalents of the normal
  167. * checksum functions (in skbuff.h) except that they operate on the GRO
  168. * offsets and fields in sk_buff.
  169. */
  170. __sum16 __skb_gro_checksum_complete(struct sk_buff *skb);
  171. static inline bool skb_at_gro_remcsum_start(struct sk_buff *skb)
  172. {
  173. return (NAPI_GRO_CB(skb)->gro_remcsum_start == skb_gro_offset(skb));
  174. }
  175. static inline bool __skb_gro_checksum_validate_needed(struct sk_buff *skb,
  176. bool zero_okay,
  177. __sum16 check)
  178. {
  179. return ((skb->ip_summed != CHECKSUM_PARTIAL ||
  180. skb_checksum_start_offset(skb) <
  181. skb_gro_offset(skb)) &&
  182. !skb_at_gro_remcsum_start(skb) &&
  183. NAPI_GRO_CB(skb)->csum_cnt == 0 &&
  184. (!zero_okay || check));
  185. }
  186. static inline __sum16 __skb_gro_checksum_validate_complete(struct sk_buff *skb,
  187. __wsum psum)
  188. {
  189. if (NAPI_GRO_CB(skb)->csum_valid &&
  190. !csum_fold(csum_add(psum, NAPI_GRO_CB(skb)->csum)))
  191. return 0;
  192. NAPI_GRO_CB(skb)->csum = psum;
  193. return __skb_gro_checksum_complete(skb);
  194. }
  195. static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
  196. {
  197. if (NAPI_GRO_CB(skb)->csum_cnt > 0) {
  198. /* Consume a checksum from CHECKSUM_UNNECESSARY */
  199. NAPI_GRO_CB(skb)->csum_cnt--;
  200. } else {
  201. /* Update skb for CHECKSUM_UNNECESSARY and csum_level when we
  202. * verified a new top level checksum or an encapsulated one
  203. * during GRO. This saves work if we fallback to normal path.
  204. */
  205. __skb_incr_checksum_unnecessary(skb);
  206. }
  207. }
  208. #define __skb_gro_checksum_validate(skb, proto, zero_okay, check, \
  209. compute_pseudo) \
  210. ({ \
  211. __sum16 __ret = 0; \
  212. if (__skb_gro_checksum_validate_needed(skb, zero_okay, check)) \
  213. __ret = __skb_gro_checksum_validate_complete(skb, \
  214. compute_pseudo(skb, proto)); \
  215. if (!__ret) \
  216. skb_gro_incr_csum_unnecessary(skb); \
  217. __ret; \
  218. })
  219. #define skb_gro_checksum_validate(skb, proto, compute_pseudo) \
  220. __skb_gro_checksum_validate(skb, proto, false, 0, compute_pseudo)
  221. #define skb_gro_checksum_validate_zero_check(skb, proto, check, \
  222. compute_pseudo) \
  223. __skb_gro_checksum_validate(skb, proto, true, check, compute_pseudo)
  224. #define skb_gro_checksum_simple_validate(skb) \
  225. __skb_gro_checksum_validate(skb, 0, false, 0, null_compute_pseudo)
  226. static inline bool __skb_gro_checksum_convert_check(struct sk_buff *skb)
  227. {
  228. return (NAPI_GRO_CB(skb)->csum_cnt == 0 &&
  229. !NAPI_GRO_CB(skb)->csum_valid);
  230. }
  231. static inline void __skb_gro_checksum_convert(struct sk_buff *skb,
  232. __wsum pseudo)
  233. {
  234. NAPI_GRO_CB(skb)->csum = ~pseudo;
  235. NAPI_GRO_CB(skb)->csum_valid = 1;
  236. }
  237. #define skb_gro_checksum_try_convert(skb, proto, compute_pseudo) \
  238. do { \
  239. if (__skb_gro_checksum_convert_check(skb)) \
  240. __skb_gro_checksum_convert(skb, \
  241. compute_pseudo(skb, proto)); \
  242. } while (0)
  243. struct gro_remcsum {
  244. int offset;
  245. __wsum delta;
  246. };
  247. static inline void skb_gro_remcsum_init(struct gro_remcsum *grc)
  248. {
  249. grc->offset = 0;
  250. grc->delta = 0;
  251. }
  252. static inline void *skb_gro_remcsum_process(struct sk_buff *skb, void *ptr,
  253. unsigned int off, size_t hdrlen,
  254. int start, int offset,
  255. struct gro_remcsum *grc,
  256. bool nopartial)
  257. {
  258. __wsum delta;
  259. size_t plen = hdrlen + max_t(size_t, offset + sizeof(u16), start);
  260. BUG_ON(!NAPI_GRO_CB(skb)->csum_valid);
  261. if (!nopartial) {
  262. NAPI_GRO_CB(skb)->gro_remcsum_start = off + hdrlen + start;
  263. return ptr;
  264. }
  265. ptr = skb_gro_header(skb, off + plen, off);
  266. if (!ptr)
  267. return NULL;
  268. delta = remcsum_adjust(ptr + hdrlen, NAPI_GRO_CB(skb)->csum,
  269. start, offset);
  270. /* Adjust skb->csum since we changed the packet */
  271. NAPI_GRO_CB(skb)->csum = csum_add(NAPI_GRO_CB(skb)->csum, delta);
  272. grc->offset = off + hdrlen + offset;
  273. grc->delta = delta;
  274. return ptr;
  275. }
  276. static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb,
  277. struct gro_remcsum *grc)
  278. {
  279. void *ptr;
  280. size_t plen = grc->offset + sizeof(u16);
  281. if (!grc->delta)
  282. return;
  283. ptr = skb_gro_header(skb, plen, grc->offset);
  284. if (!ptr)
  285. return;
  286. remcsum_unadjust((__sum16 *)ptr, grc->delta);
  287. }
  288. #ifdef CONFIG_XFRM_OFFLOAD
  289. static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff *pp, int flush)
  290. {
  291. if (PTR_ERR(pp) != -EINPROGRESS)
  292. NAPI_GRO_CB(skb)->flush |= flush;
  293. }
  294. static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb,
  295. struct sk_buff *pp,
  296. int flush,
  297. struct gro_remcsum *grc)
  298. {
  299. if (PTR_ERR(pp) != -EINPROGRESS) {
  300. NAPI_GRO_CB(skb)->flush |= flush;
  301. skb_gro_remcsum_cleanup(skb, grc);
  302. skb->remcsum_offload = 0;
  303. }
  304. }
  305. #else
  306. static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff *pp, int flush)
  307. {
  308. NAPI_GRO_CB(skb)->flush |= flush;
  309. }
  310. static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb,
  311. struct sk_buff *pp,
  312. int flush,
  313. struct gro_remcsum *grc)
  314. {
  315. NAPI_GRO_CB(skb)->flush |= flush;
  316. skb_gro_remcsum_cleanup(skb, grc);
  317. skb->remcsum_offload = 0;
  318. }
  319. #endif
  320. INDIRECT_CALLABLE_DECLARE(struct sk_buff *ipv6_gro_receive(struct list_head *,
  321. struct sk_buff *));
  322. INDIRECT_CALLABLE_DECLARE(int ipv6_gro_complete(struct sk_buff *, int));
  323. INDIRECT_CALLABLE_DECLARE(struct sk_buff *inet_gro_receive(struct list_head *,
  324. struct sk_buff *));
  325. INDIRECT_CALLABLE_DECLARE(int inet_gro_complete(struct sk_buff *, int));
  326. INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp4_gro_receive(struct list_head *,
  327. struct sk_buff *));
  328. INDIRECT_CALLABLE_DECLARE(int udp4_gro_complete(struct sk_buff *, int));
  329. struct sk_buff *udp6_gro_receive(struct list_head *, struct sk_buff *);
  330. int udp6_gro_complete(struct sk_buff *, int);
  331. #define indirect_call_gro_receive_inet(cb, f2, f1, head, skb) \
  332. ({ \
  333. unlikely(gro_recursion_inc_test(skb)) ? \
  334. NAPI_GRO_CB(skb)->flush |= 1, NULL : \
  335. INDIRECT_CALL_INET(cb, f2, f1, head, skb); \
  336. })
  337. struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb,
  338. struct udphdr *uh, struct sock *sk);
  339. int udp_gro_complete(struct sk_buff *skb, int nhoff, udp_lookup_t lookup);
  340. static inline struct udphdr *udp_gro_udphdr(struct sk_buff *skb)
  341. {
  342. struct udphdr *uh;
  343. unsigned int hlen, off;
  344. off = skb_gro_offset(skb);
  345. hlen = off + sizeof(*uh);
  346. uh = skb_gro_header(skb, hlen, off);
  347. return uh;
  348. }
  349. static inline __wsum ip6_gro_compute_pseudo(const struct sk_buff *skb,
  350. int proto)
  351. {
  352. const struct ipv6hdr *iph = skb_gro_network_header(skb);
  353. return ~csum_unfold(csum_ipv6_magic(&iph->saddr, &iph->daddr,
  354. skb_gro_len(skb), proto, 0));
  355. }
  356. static inline int inet_gro_flush(const struct iphdr *iph, const struct iphdr *iph2,
  357. struct sk_buff *p, bool inner)
  358. {
  359. const u32 id = ntohl(*(__be32 *)&iph->id);
  360. const u32 id2 = ntohl(*(__be32 *)&iph2->id);
  361. const u16 ipid_offset = (id >> 16) - (id2 >> 16);
  362. const u16 count = NAPI_GRO_CB(p)->count;
  363. /* All fields must match except length and checksum. */
  364. if ((iph->ttl ^ iph2->ttl) | (iph->tos ^ iph2->tos) | ((id ^ id2) & IP_DF))
  365. return true;
  366. /* When we receive our second frame we can make a decision on if we
  367. * continue this flow as an atomic flow with a fixed ID or if we use
  368. * an incrementing ID.
  369. */
  370. if (count == 1 && !ipid_offset)
  371. NAPI_GRO_CB(p)->ip_fixedid |= 1 << inner;
  372. return ipid_offset ^ (count * !(NAPI_GRO_CB(p)->ip_fixedid & (1 << inner)));
  373. }
  374. static inline int ipv6_gro_flush(const struct ipv6hdr *iph, const struct ipv6hdr *iph2)
  375. {
  376. /* <Version:4><Traffic_Class:8><Flow_Label:20> */
  377. __be32 first_word = *(__be32 *)iph ^ *(__be32 *)iph2;
  378. /* Flush if Traffic Class fields are different. */
  379. return !!((first_word & htonl(0x0FF00000)) |
  380. (__force __be32)(iph->hop_limit ^ iph2->hop_limit));
  381. }
  382. static inline int __gro_receive_network_flush(const void *th, const void *th2,
  383. struct sk_buff *p, const u16 diff,
  384. bool inner)
  385. {
  386. const void *nh = th - diff;
  387. const void *nh2 = th2 - diff;
  388. if (((struct iphdr *)nh)->version == 6)
  389. return ipv6_gro_flush(nh, nh2);
  390. else
  391. return inet_gro_flush(nh, nh2, p, inner);
  392. }
  393. static inline int gro_receive_network_flush(const void *th, const void *th2,
  394. struct sk_buff *p)
  395. {
  396. int off = skb_transport_offset(p);
  397. int flush;
  398. flush = __gro_receive_network_flush(th, th2, p, off - NAPI_GRO_CB(p)->network_offset, false);
  399. if (NAPI_GRO_CB(p)->encap_mark)
  400. flush |= __gro_receive_network_flush(th, th2, p, off - NAPI_GRO_CB(p)->inner_network_offset, true);
  401. return flush;
  402. }
  403. int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
  404. int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb);
  405. void __gro_flush(struct gro_node *gro, bool flush_old);
  406. static inline void gro_flush(struct gro_node *gro, bool flush_old)
  407. {
  408. if (!gro->bitmask)
  409. return;
  410. __gro_flush(gro, flush_old);
  411. }
  412. static inline void napi_gro_flush(struct napi_struct *napi, bool flush_old)
  413. {
  414. gro_flush(&napi->gro, flush_old);
  415. }
  416. /* Pass the currently batched GRO_NORMAL SKBs up to the stack. */
  417. static inline void gro_normal_list(struct gro_node *gro)
  418. {
  419. if (!gro->rx_count)
  420. return;
  421. netif_receive_skb_list_internal(&gro->rx_list);
  422. INIT_LIST_HEAD(&gro->rx_list);
  423. gro->rx_count = 0;
  424. }
  425. static inline void gro_flush_normal(struct gro_node *gro, bool flush_old)
  426. {
  427. gro_flush(gro, flush_old);
  428. gro_normal_list(gro);
  429. }
  430. /* Queue one GRO_NORMAL SKB up for list processing. If batch size exceeded,
  431. * pass the whole batch up to the stack.
  432. */
  433. static inline void gro_normal_one(struct gro_node *gro, struct sk_buff *skb,
  434. int segs)
  435. {
  436. list_add_tail(&skb->list, &gro->rx_list);
  437. gro->rx_count += segs;
  438. if (gro->rx_count >= READ_ONCE(net_hotdata.gro_normal_batch))
  439. gro_normal_list(gro);
  440. }
  441. void gro_init(struct gro_node *gro);
  442. void gro_cleanup(struct gro_node *gro);
  443. /* This function is the alternative of 'inet_iif' and 'inet_sdif'
  444. * functions in case we can not rely on fields of IPCB.
  445. *
  446. * The caller must verify skb_valid_dst(skb) is false and skb->dev is initialized.
  447. * The caller must hold the RCU read lock.
  448. */
  449. static inline void inet_get_iif_sdif(const struct sk_buff *skb, int *iif, int *sdif)
  450. {
  451. *iif = inet_iif(skb) ?: skb->dev->ifindex;
  452. *sdif = 0;
  453. #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)
  454. if (netif_is_l3_slave(skb->dev)) {
  455. struct net_device *master = netdev_master_upper_dev_get_rcu(skb->dev);
  456. *sdif = *iif;
  457. *iif = master ? master->ifindex : 0;
  458. }
  459. #endif
  460. }
  461. /* This function is the alternative of 'inet6_iif' and 'inet6_sdif'
  462. * functions in case we can not rely on fields of IP6CB.
  463. *
  464. * The caller must verify skb_valid_dst(skb) is false and skb->dev is initialized.
  465. * The caller must hold the RCU read lock.
  466. */
  467. static inline void inet6_get_iif_sdif(const struct sk_buff *skb, int *iif, int *sdif)
  468. {
  469. /* using skb->dev->ifindex because skb_dst(skb) is not initialized */
  470. *iif = skb->dev->ifindex;
  471. *sdif = 0;
  472. #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)
  473. if (netif_is_l3_slave(skb->dev)) {
  474. struct net_device *master = netdev_master_upper_dev_get_rcu(skb->dev);
  475. *sdif = *iif;
  476. *iif = master ? master->ifindex : 0;
  477. }
  478. #endif
  479. }
  480. struct packet_offload *gro_find_receive_by_type(__be16 type);
  481. struct packet_offload *gro_find_complete_by_type(__be16 type);
  482. static inline struct tcphdr *tcp_gro_pull_header(struct sk_buff *skb)
  483. {
  484. unsigned int thlen, hlen, off;
  485. struct tcphdr *th;
  486. off = skb_gro_offset(skb);
  487. hlen = off + sizeof(*th);
  488. th = skb_gro_header(skb, hlen, off);
  489. if (unlikely(!th))
  490. return NULL;
  491. thlen = th->doff * 4;
  492. if (unlikely(thlen < sizeof(*th)))
  493. return NULL;
  494. hlen = off + thlen;
  495. if (!skb_gro_may_pull(skb, hlen)) {
  496. th = skb_gro_header_slow(skb, hlen, off);
  497. if (unlikely(!th))
  498. return NULL;
  499. }
  500. skb_gro_pull(skb, thlen);
  501. return th;
  502. }
  503. #endif /* _NET_GRO_H */