1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
5 #ifndef _MACSWAP_COMMON_H_
6 #define _MACSWAP_COMMON_H_
9 ol_flags_init(uint64_t tx_offload)
11 uint64_t ol_flags = 0;
13 ol_flags |= (tx_offload & DEV_TX_OFFLOAD_VLAN_INSERT) ?
15 ol_flags |= (tx_offload & DEV_TX_OFFLOAD_QINQ_INSERT) ?
17 ol_flags |= (tx_offload & DEV_TX_OFFLOAD_MACSEC_INSERT) ?
24 vlan_qinq_set(struct rte_mbuf *pkts[], uint16_t nb,
25 uint64_t ol_flags, uint16_t vlan, uint16_t outer_vlan)
29 if (ol_flags & PKT_TX_VLAN)
30 for (i = 0; i < nb; i++)
31 pkts[i]->vlan_tci = vlan;
32 if (ol_flags & PKT_TX_QINQ)
33 for (i = 0; i < nb; i++)
34 pkts[i]->vlan_tci_outer = outer_vlan;
38 mbuf_field_set(struct rte_mbuf *mb, uint64_t ol_flags)
40 mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF;
41 mb->ol_flags |= ol_flags;
42 mb->l2_len = sizeof(struct rte_ether_hdr);
43 mb->l3_len = sizeof(struct rte_ipv4_hdr);
46 #endif /* _MACSWAP_COMMON_H_ */