Make an IP packet consisting of chain of one packets */
| 65 | |
| 66 | /* Make an IP packet consisting of chain of one packets */ |
| 67 | static void |
| 68 | mbuf1_prepare(struct dummy_mbuf *dm, uint32_t plen) |
| 69 | { |
| 70 | struct { |
| 71 | struct rte_ether_hdr eth; |
| 72 | struct rte_ipv4_hdr ip; |
| 73 | struct rte_udp_hdr udp; |
| 74 | } pkt = { |
| 75 | .eth = { |
| 76 | .dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", |
| 77 | .ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4), |
| 78 | }, |
| 79 | .ip = { |
| 80 | .version_ihl = RTE_IPV4_VHL_DEF, |
| 81 | .time_to_live = 1, |
| 82 | .next_proto_id = IPPROTO_UDP, |
| 83 | .src_addr = rte_cpu_to_be_32(RTE_IPV4_LOOPBACK), |
| 84 | .dst_addr = rte_cpu_to_be_32(RTE_IPV4_BROADCAST), |
| 85 | }, |
| 86 | .udp = { |
| 87 | .dst_port = rte_cpu_to_be_16(9), /* Discard port */ |
| 88 | }, |
| 89 | }; |
| 90 | |
| 91 | memset(dm, 0, sizeof(*dm)); |
| 92 | dummy_mbuf_prep(&dm->mb[0], dm->buf[0], sizeof(dm->buf[0]), plen); |
| 93 | |
| 94 | rte_eth_random_addr(pkt.eth.src_addr.addr_bytes); |
| 95 | plen -= sizeof(struct rte_ether_hdr); |
| 96 | |
| 97 | pkt.ip.total_length = rte_cpu_to_be_16(plen); |
| 98 | pkt.ip.hdr_checksum = rte_ipv4_cksum(&pkt.ip); |
| 99 | |
| 100 | plen -= sizeof(struct rte_ipv4_hdr); |
| 101 | pkt.udp.src_port = rte_rand(); |
| 102 | pkt.udp.dgram_len = rte_cpu_to_be_16(plen); |
| 103 | |
| 104 | memcpy(rte_pktmbuf_mtod(dm->mb, void *), &pkt, sizeof(pkt)); |
| 105 | |
| 106 | /* Idea here is to create mbuf chain big enough that after mbuf deep copy they won't be |
| 107 | * compressed into single mbuf to properly test store of chained mbufs |
| 108 | */ |
| 109 | dummy_mbuf_prep(&dm->mb[1], dm->buf[1], sizeof(dm->buf[1]), pkt_len); |
| 110 | dummy_mbuf_prep(&dm->mb[2], dm->buf[2], sizeof(dm->buf[2]), pkt_len); |
| 111 | rte_pktmbuf_chain(&dm->mb[0], &dm->mb[1]); |
| 112 | rte_pktmbuf_chain(&dm->mb[0], &dm->mb[2]); |
| 113 | } |
| 114 | |
| 115 | static int |
| 116 | test_setup(void) |
no test coverage detected