| 158 | } |
| 159 | |
| 160 | static inline void |
| 161 | update_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 | |
| 188 | static inline bool |
| 189 | pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, |
no test coverage detected