538da7a1ca
Add 'rte_' prefix to functions: - rename is_same_ether_addr() as rte_is_same_ether_addr(). - rename is_zero_ether_addr() as rte_is_zero_ether_addr(). - rename is_unicast_ether_addr() as rte_is_unicast_ether_addr(). - rename is_multicast_ether_addr() as rte_is_multicast_ether_addr(). - rename is_broadcast_ether_addr() as rte_is_broadcast_ether_addr(). - rename is_universal_ether_addr() as rte_is_universal_ether_addr(). - rename is_local_admin_ether_addr() as rte_is_local_admin_ether_addr(). - rename is_valid_assigned_ether_addr() as rte_is_valid_assigned_ether_addr(). - rename eth_random_addr() as rte_eth_random_addr(). - rename ether_addr_copy() as rte_ether_addr_copy(). - rename ether_format_addr() as rte_ether_format_addr(). Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
41 lines
944 B
C
41 lines
944 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright(c) 2018 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _MACSWAP_H_
|
|
#define _MACSWAP_H_
|
|
|
|
#include "macswap_common.h"
|
|
|
|
static inline void
|
|
do_macswap(struct rte_mbuf *pkts[], uint16_t nb,
|
|
struct rte_port *txp)
|
|
{
|
|
struct rte_ether_hdr *eth_hdr;
|
|
struct rte_mbuf *mb;
|
|
struct rte_ether_addr addr;
|
|
uint64_t ol_flags;
|
|
int i;
|
|
|
|
ol_flags = ol_flags_init(txp->dev_conf.txmode.offloads);
|
|
vlan_qinq_set(pkts, nb, ol_flags,
|
|
txp->tx_vlan_id, txp->tx_vlan_id_outer);
|
|
|
|
for (i = 0; i < nb; i++) {
|
|
if (likely(i < nb - 1))
|
|
rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *));
|
|
mb = pkts[i];
|
|
|
|
eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *);
|
|
|
|
/* Swap dest and src mac addresses. */
|
|
rte_ether_addr_copy(ð_hdr->d_addr, &addr);
|
|
rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr);
|
|
rte_ether_addr_copy(&addr, ð_hdr->s_addr);
|
|
|
|
mbuf_field_set(mb, ol_flags);
|
|
}
|
|
}
|
|
|
|
#endif /* _MACSWAP_H_ */
|