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

Function do_macfwd

dpdk/app/test-pmd/macfwd.h:8–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#define _MACFWD_H_
7
8static inline void
9do_macfwd(struct rte_mbuf *pkts_burst[], uint16_t nb_rx,
10 struct fwd_stream *fs)
11{
12 struct rte_ether_hdr *eth_hdr;
13 uint64_t ol_flags = 0;
14 uint64_t tx_offloads;
15 struct rte_mbuf *mb;
16 struct rte_port *txp = &ports[fs->tx_port];
17 uint16_t i;
18
19 tx_offloads = txp->dev_conf.txmode.offloads;
20 if (tx_offloads & RTE_ETH_TX_OFFLOAD_VLAN_INSERT)
21 ol_flags = RTE_MBUF_F_TX_VLAN;
22 if (tx_offloads & RTE_ETH_TX_OFFLOAD_QINQ_INSERT)
23 ol_flags |= RTE_MBUF_F_TX_QINQ;
24 if (tx_offloads & RTE_ETH_TX_OFFLOAD_MACSEC_INSERT)
25 ol_flags |= RTE_MBUF_F_TX_MACSEC;
26 for (i = 0; i < nb_rx; i++) {
27 if (likely(i < nb_rx - 1))
28 rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1],
29 void *));
30 mb = pkts_burst[i];
31 eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *);
32 rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
33 &eth_hdr->dst_addr);
34 rte_ether_addr_copy(&ports[fs->tx_port].eth_addr,
35 &eth_hdr->src_addr);
36 mb->ol_flags &= RTE_MBUF_F_INDIRECT | RTE_MBUF_F_EXTERNAL;
37 mb->ol_flags |= ol_flags;
38 mb->l2_len = sizeof(struct rte_ether_hdr);
39 mb->l3_len = sizeof(struct rte_ipv4_hdr);
40 mb->vlan_tci = txp->tx_vlan_id;
41 mb->vlan_tci_outer = txp->tx_vlan_id_outer;
42 }
43}
44
45#endif /* _MACFWD_H_ */

Callers 2

pkt_burst_mac_forwardFunction · 0.85
pkt_burst_macFunction · 0.85

Calls 2

rte_ether_addr_copyFunction · 0.85
rte_prefetch0Function · 0.50

Tested by

no test coverage detected