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

Function pipeline_tx_first

dpdk/app/test-eventdev/test_pipeline_common.c:131–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131static void
132pipeline_tx_first(struct test_pipeline *t, struct evt_options *opt)
133{
134#define TX_DEF_PACKET_LEN 64
135 uint16_t eth_port_id = 0;
136 uint16_t pkt_sz, rc;
137 uint32_t i;
138
139 pkt_sz = opt->tx_pkt_sz;
140 if (pkt_sz > opt->max_pkt_sz)
141 pkt_sz = opt->max_pkt_sz;
142 if (!pkt_sz)
143 pkt_sz = TX_DEF_PACKET_LEN;
144
145 RTE_ETH_FOREACH_DEV(eth_port_id) {
146 struct rte_ether_addr src_mac;
147 struct rte_ether_addr dst_mac;
148 struct rte_ether_hdr eth_hdr;
149
150 /* Send to the same dest.mac as port mac */
151 rte_eth_macaddr_get(eth_port_id, &dst_mac);
152 rte_eth_random_addr((uint8_t *)&src_mac);
153
154 rte_ether_addr_copy(&dst_mac, &eth_hdr.dst_addr);
155 rte_ether_addr_copy(&src_mac, &eth_hdr.src_addr);
156 eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
157
158 for (i = 0; i < opt->tx_first; i++) {
159 struct rte_udp_hdr *pkt_udp_hdr;
160 struct rte_ipv4_hdr ip_hdr;
161 struct rte_udp_hdr udp_hdr;
162 struct rte_mbuf *mbuf;
163
164 mbuf = rte_pktmbuf_alloc(
165 opt->per_port_pool ? t->pool[i] : t->pool[0]);
166 if (mbuf == NULL)
167 continue;
168
169 setup_pkt_udp_ip_headers(
170 &ip_hdr, &udp_hdr,
171 pkt_sz - sizeof(struct rte_ether_hdr) -
172 sizeof(struct rte_ipv4_hdr) -
173 sizeof(struct rte_udp_hdr),
174 eth_port_id, i);
175 mbuf->port = eth_port_id;
176 mbuf->data_len = pkt_sz;
177 mbuf->pkt_len = pkt_sz;
178
179 /* Copy Ethernet header */
180 rte_memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, 0),
181 &eth_hdr, sizeof(struct rte_ether_hdr));
182
183 /* Copy Ipv4 header */
184 rte_memcpy(rte_pktmbuf_mtod_offset(
185 mbuf, char *,
186 sizeof(struct rte_ether_hdr)),
187 &ip_hdr, sizeof(struct rte_ipv4_hdr));
188

Callers 1

pipeline_launch_lcoresFunction · 0.85

Calls 7

rte_eth_macaddr_getFunction · 0.85
rte_eth_random_addrFunction · 0.85
rte_ether_addr_copyFunction · 0.85
rte_pktmbuf_allocFunction · 0.85
rte_eth_tx_burstFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
setup_pkt_udp_ip_headersFunction · 0.70

Tested by

no test coverage detected