1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
8 #include "macswap_common.h"
11 do_macswap(struct rte_mbuf *pkts[], uint16_t nb,
14 struct rte_ether_hdr *eth_hdr;
16 struct rte_ether_addr addr;
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);
24 for (i = 0; i < nb; i++) {
25 if (likely(i < nb - 1))
26 rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *));
29 eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *);
31 /* Swap dest and src mac addresses. */
32 rte_ether_addr_copy(ð_hdr->dst_addr, &addr);
33 rte_ether_addr_copy(ð_hdr->src_addr, ð_hdr->dst_addr);
34 rte_ether_addr_copy(&addr, ð_hdr->src_addr);
36 mbuf_field_set(mb, ol_flags);
40 #endif /* _MACSWAP_H_ */