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

Function update_ipv4_tcp_headers

dpdk/lib/gso/gso_tcp4.c:8–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include "gso_tcp4.h"
7
8static void
9update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta,
10 struct rte_mbuf **segs, uint16_t nb_segs)
11{
12 struct rte_ipv4_hdr *ipv4_hdr;
13 struct rte_tcp_hdr *tcp_hdr;
14 uint32_t sent_seq;
15 uint16_t id, tail_idx, i;
16 uint16_t l3_offset = pkt->l2_len;
17 uint16_t l4_offset = l3_offset + pkt->l3_len;
18
19 ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) +
20 l3_offset);
21 tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len);
22 id = rte_be_to_cpu_16(ipv4_hdr->packet_id);
23 sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq);
24 tail_idx = nb_segs - 1;
25
26 for (i = 0; i < nb_segs; i++) {
27 update_ipv4_header(segs[i], l3_offset, id);
28 update_tcp_header(segs[i], l4_offset, sent_seq, i < tail_idx);
29 id += ipid_delta;
30 sent_seq += (segs[i]->pkt_len - segs[i]->data_len);
31 }
32}
33
34int
35gso_tcp4_segment(struct rte_mbuf *pkt,

Callers 1

gso_tcp4_segmentFunction · 0.85

Calls 2

update_ipv4_headerFunction · 0.85
update_tcp_headerFunction · 0.85

Tested by

no test coverage detected