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

Function update_pkt_header

dpdk/app/test-pmd/txonly.c:160–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160static inline void
161update_pkt_header(struct rte_mbuf *pkt, uint32_t total_pkt_len)
162{
163 struct rte_ipv4_hdr *ip_hdr;
164 struct rte_udp_hdr *udp_hdr;
165 uint16_t pkt_data_len;
166 uint16_t pkt_len;
167
168 pkt_data_len = (uint16_t) (total_pkt_len - (
169 sizeof(struct rte_ether_hdr) +
170 sizeof(struct rte_ipv4_hdr) +
171 sizeof(struct rte_udp_hdr)));
172 /* update UDP packet length */
173 udp_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_udp_hdr *,
174 sizeof(struct rte_ether_hdr) +
175 sizeof(struct rte_ipv4_hdr));
176 pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr));
177 udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt_len);
178
179 /* update IP packet length and checksum */
180 ip_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *,
181 sizeof(struct rte_ether_hdr));
182 ip_hdr->hdr_checksum = 0;
183 pkt_len = (uint16_t) (pkt_len + sizeof(struct rte_ipv4_hdr));
184 ip_hdr->total_length = RTE_CPU_TO_BE_16(pkt_len);
185 ip_hdr->hdr_checksum = rte_ipv4_cksum(ip_hdr);
186}
187
188static inline bool
189pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp,

Callers 1

pkt_burst_prepareFunction · 0.85

Calls 1

rte_ipv4_cksumFunction · 0.85

Tested by

no test coverage detected