MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcp_lro_rx_ipv4

Function tcp_lro_rx_ipv4

freebsd/netinet/tcp_lro.c:399–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397
398#ifdef INET
399static int
400tcp_lro_rx_ipv4(struct lro_ctrl *lc, struct mbuf *m, struct ip *ip4,
401 struct tcphdr **th)
402{
403 int csum_flags;
404 uint16_t csum;
405
406 if (ip4->ip_p != IPPROTO_TCP)
407 return (TCP_LRO_NOT_SUPPORTED);
408
409 /* Ensure there are no options. */
410 if ((ip4->ip_hl << 2) != sizeof (*ip4))
411 return (TCP_LRO_CANNOT);
412
413 /* .. and the packet is not fragmented. */
414 if (ip4->ip_off & htons(IP_MF|IP_OFFMASK))
415 return (TCP_LRO_CANNOT);
416
417 /* Legacy IP has a header checksum that needs to be correct. */
418 csum_flags = m->m_pkthdr.csum_flags;
419 if (csum_flags & CSUM_IP_CHECKED) {
420 if (__predict_false((csum_flags & CSUM_IP_VALID) == 0)) {
421 lc->lro_bad_csum++;
422 return (TCP_LRO_CANNOT);
423 }
424 } else {
425 csum = in_cksum_hdr(ip4);
426 if (__predict_false((csum) != 0)) {
427 lc->lro_bad_csum++;
428 return (TCP_LRO_CANNOT);
429 }
430 }
431 /* Find the TCP header (we assured there are no IP options). */
432 *th = (struct tcphdr *)(ip4 + 1);
433 return (0);
434}
435#endif
436
437static void

Callers 2

tcp_set_le_to_mFunction · 0.85
tcp_lro_rx2Function · 0.85

Calls 1

in_cksum_hdrFunction · 0.50

Tested by

no test coverage detected