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

Function gso_udp4_segment

dpdk/lib/gso/gso_udp4.c:37–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37int
38gso_udp4_segment(struct rte_mbuf *pkt,
39 uint16_t gso_size,
40 struct rte_mempool *direct_pool,
41 struct rte_mempool *indirect_pool,
42 struct rte_mbuf **pkts_out,
43 uint16_t nb_pkts_out)
44{
45 struct rte_ipv4_hdr *ipv4_hdr;
46 uint16_t pyld_unit_size, hdr_offset;
47 uint16_t frag_off;
48 int ret;
49
50 /* Don't process the fragmented packet */
51 ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *,
52 pkt->l2_len);
53 frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset);
54 if (unlikely(IS_FRAGMENTED(frag_off))) {
55 return 0;
56 }
57
58 /*
59 * UDP fragmentation is the same as IP fragmentation.
60 * Except the first one, other output packets just have l2
61 * and l3 headers.
62 */
63 hdr_offset = pkt->l2_len + pkt->l3_len;
64
65 /* Don't process the packet without data. */
66 if (unlikely(hdr_offset + pkt->l4_len >= pkt->pkt_len)) {
67 return 0;
68 }
69
70 /* pyld_unit_size must be a multiple of 8 because frag_off
71 * uses 8 bytes as unit.
72 */
73 pyld_unit_size = (gso_size - hdr_offset) & ~7U;
74
75 /* Segment the payload */
76 ret = gso_do_segment(pkt, hdr_offset, pyld_unit_size, direct_pool,
77 indirect_pool, pkts_out, nb_pkts_out);
78 if (ret > 1)
79 update_ipv4_udp_headers(pkt, pkts_out, ret);
80
81 return ret;
82}

Callers 1

rte_gso_segmentFunction · 0.85

Calls 2

gso_do_segmentFunction · 0.85
update_ipv4_udp_headersFunction · 0.85

Tested by

no test coverage detected