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

Function do_macswap

dpdk/app/test-pmd/macswap.h:10–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "macswap_common.h"
9
10static inline void
11do_macswap(struct rte_mbuf *pkts[], uint16_t nb,
12 struct rte_port *txp)
13{
14 struct rte_ether_hdr *eth_hdr;
15 struct rte_mbuf *mb;
16 struct rte_ether_addr addr;
17 uint64_t ol_flags;
18 int i;
19
20 ol_flags = ol_flags_init(txp->dev_conf.txmode.offloads);
21 vlan_qinq_set(pkts, nb, ol_flags,
22 txp->tx_vlan_id, txp->tx_vlan_id_outer);
23
24 for (i = 0; i < nb; i++) {
25 if (likely(i < nb - 1))
26 rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *));
27 mb = pkts[i];
28
29 eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *);
30
31 /* Swap dest and src mac addresses. */
32 rte_ether_addr_copy(&eth_hdr->dst_addr, &addr);
33 rte_ether_addr_copy(&eth_hdr->src_addr, &eth_hdr->dst_addr);
34 rte_ether_addr_copy(&addr, &eth_hdr->src_addr);
35
36 mbuf_field_set(mb, ol_flags);
37 }
38}
39
40#endif /* _MACSWAP_H_ */

Callers 2

pkt_burst_mac_swapFunction · 0.70
pkt_burst_macswapFunction · 0.70

Calls 5

ol_flags_initFunction · 0.85
vlan_qinq_setFunction · 0.85
rte_ether_addr_copyFunction · 0.85
mbuf_field_setFunction · 0.85
rte_prefetch0Function · 0.50

Tested by

no test coverage detected