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

Function rte_vlan_strip

dpdk/lib/net/rte_ether.h:344–362  ·  view source on GitHub ↗

* Extract VLAN tag information into mbuf * * Software version of VLAN stripping * * @param m * The packet mbuf. * @return * - 0: Success * - 1: not a vlan packet */

Source from the content-addressed store, hash-verified

342 * - 1: not a vlan packet
343 */
344static inline int rte_vlan_strip(struct rte_mbuf *m)
345{
346 struct rte_ether_hdr *eh
347 = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
348 struct rte_vlan_hdr *vh;
349
350 if (eh->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN))
351 return -1;
352
353 vh = (struct rte_vlan_hdr *)(eh + 1);
354 m->ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
355 m->vlan_tci = rte_be_to_cpu_16(vh->vlan_tci);
356
357 /* Copy ether header over rather than moving whole packet */
358 memmove(rte_pktmbuf_adj(m, sizeof(struct rte_vlan_hdr)),
359 eh, 2 * RTE_ETHER_ADDR_LEN);
360
361 return 0;
362}
363
364/**
365 * Insert VLAN tag into mbuf.

Callers 8

virtio_recv_pktsFunction · 0.85
virtio_recv_pkts_packedFunction · 0.85
virtio_recv_pkts_inorderFunction · 0.85
dpaa2_dev_prefetch_rxFunction · 0.85
dpaa2_dev_rxFunction · 0.85
eth_vhost_rxFunction · 0.85

Calls 2

rte_pktmbuf_adjFunction · 0.85
memmoveFunction · 0.50

Tested by

no test coverage detected