* Extract VLAN tag information into mbuf * * Software version of VLAN stripping * * @param m * The packet mbuf. * @return * - 0: Success * - 1: not a vlan packet */
| 342 | * - 1: not a vlan packet |
| 343 | */ |
| 344 | static 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. |
no test coverage detected