| 1202 | } |
| 1203 | |
| 1204 | static void virtio_tx_offload(struct rte_mbuf *m) |
| 1205 | { |
| 1206 | struct rte_net_hdr_lens hdr_lens; |
| 1207 | struct rte_ipv4_hdr *ipv4_hdr; |
| 1208 | struct rte_tcp_hdr *tcp_hdr; |
| 1209 | uint32_t ptype; |
| 1210 | void *l3_hdr; |
| 1211 | |
| 1212 | ptype = rte_net_get_ptype(m, &hdr_lens, RTE_PTYPE_ALL_MASK); |
| 1213 | m->l2_len = hdr_lens.l2_len; |
| 1214 | m->l3_len = hdr_lens.l3_len; |
| 1215 | m->l4_len = hdr_lens.l4_len; |
| 1216 | |
| 1217 | l3_hdr = rte_pktmbuf_mtod_offset(m, void *, m->l2_len); |
| 1218 | tcp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_tcp_hdr *, |
| 1219 | m->l2_len + m->l3_len); |
| 1220 | |
| 1221 | m->ol_flags |= RTE_MBUF_F_TX_TCP_SEG; |
| 1222 | if ((ptype & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4) { |
| 1223 | m->ol_flags |= RTE_MBUF_F_TX_IPV4; |
| 1224 | m->ol_flags |= RTE_MBUF_F_TX_IP_CKSUM; |
| 1225 | ipv4_hdr = l3_hdr; |
| 1226 | ipv4_hdr->hdr_checksum = 0; |
| 1227 | tcp_hdr->cksum = rte_ipv4_phdr_cksum(l3_hdr, m->ol_flags); |
| 1228 | } else { /* assume ethertype == RTE_ETHER_TYPE_IPV6 */ |
| 1229 | m->ol_flags |= RTE_MBUF_F_TX_IPV6; |
| 1230 | tcp_hdr->cksum = rte_ipv6_phdr_cksum(l3_hdr, m->ol_flags); |
| 1231 | } |
| 1232 | } |
| 1233 | |
| 1234 | static __rte_always_inline void |
| 1235 | do_drain_mbuf_table(struct mbuf_table *tx_q) |
no test coverage detected