}
/* Combine the packet header write. VLAN is not consider here */
- mb->pkt.l2_len = l2_len;
- mb->pkt.l3_len = l3_len;
+ mb->pkt.vlan_macip.f.l2_len = l2_len;
+ mb->pkt.vlan_macip.f.l3_len = l3_len;
mb->ol_flags = ol_flags;
}
nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
ether_addr_copy(&ports[fs->tx_port].eth_addr,
ð_hdr->s_addr);
mb->ol_flags = txp->tx_ol_flags;
- mb->pkt.l2_len = sizeof(struct ether_hdr);
- mb->pkt.l3_len = sizeof(struct ipv4_hdr);
- mb->pkt.vlan_tci = txp->tx_vlan_id;
+ mb->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+ mb->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
+ mb->pkt.vlan_macip.f.vlan_tci = txp->tx_vlan_id;
}
nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
fs->tx_packets += nb_tx;
printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
mb->pkt.hash.fdir.hash, mb->pkt.hash.fdir.id);
if (ol_flags & PKT_RX_VLAN_PKT)
- printf(" - VLAN tci=0x%x", mb->pkt.vlan_tci);
+ printf(" - VLAN tci=0x%x",
+ mb->pkt.vlan_macip.f.vlan_tci);
printf("\n");
if (ol_flags != 0) {
int rxf;
mb->ol_flags = 0;
mb->pkt.data = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;
mb->pkt.nb_segs = 1;
- mb->pkt.l2_len = 0;
- mb->pkt.l3_len = 0;
- mb->pkt.vlan_tci = 0;
+ mb->pkt.vlan_macip.data = 0;
mb->pkt.hash.rss = 0;
}
pkt->pkt.nb_segs = tx_pkt_nb_segs;
pkt->pkt.pkt_len = tx_pkt_length;
pkt->ol_flags = ol_flags;
- pkt->pkt.vlan_tci = vlan_tci;
- pkt->pkt.l2_len = sizeof(struct ether_hdr);
- pkt->pkt.l3_len = sizeof(struct ipv4_hdr);
+ pkt->pkt.vlan_macip.f.vlan_tci = vlan_tci;
+ pkt->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
+ pkt->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
pkts_burst[nb_pkt] = pkt;
}
nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt);
rte_panic("No headroom in mbuf.\n");
}
- m->pkt.l2_len = sizeof(struct ether_hdr);
+ m->pkt.vlan_macip.f.l2_len = sizeof(struct ether_hdr);
ether_addr_copy(&remote_eth_addr, ð_hdr->d_addr);
ether_addr_copy(&ports_eth_addr[port_out], ð_hdr->s_addr);
out_pkt->pkt.pkt_len - sizeof(struct ipv4_hdr));
out_pkt->ol_flags |= PKT_TX_IP_CKSUM;
- out_pkt->pkt.l3_len = sizeof(struct ipv4_hdr);
+ out_pkt->pkt.vlan_macip.f.l3_len = sizeof(struct ipv4_hdr);
/* Write the fragment to the output list */
pkts_out[out_pkt_pos] = out_pkt;
/* copy metadata from source packet*/
hdr->pkt.in_port = pkt->pkt.in_port;
- hdr->pkt.vlan_tci = pkt->pkt.vlan_tci;
- hdr->pkt.l2_len = pkt->pkt.l2_len;
- hdr->pkt.l3_len = pkt->pkt.l3_len;
+ hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
hdr->pkt.hash = pkt->pkt.hash;
hdr->ol_flags = pkt->ol_flags;
*/
#define PKT_TX_OFFLOAD_MASK (PKT_TX_VLAN_PKT | PKT_TX_IP_CKSUM | PKT_TX_L4_MASK)
-/* Compare mask for vlan_macip_lens, used for context build up */
+/** Offload features */
+union rte_vlan_macip {
+ uint32_t data;
+ struct {
+ uint16_t l3_len:9; /**< L3 (IP) Header Length. */
+ uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
+ uint16_t vlan_tci;
+ /**< VLAN Tag Control Identifier (CPU order). */
+ } f;
+};
+
+/*
+ * Compare mask for vlan_macip_len.data,
+ * should be in sync with rte_vlan_macip.f layout.
+ * */
#define TX_VLAN_CMP_MASK 0xFFFF0000 /**< VLAN length - 16-bits. */
#define TX_MAC_LEN_CMP_MASK 0x0000FE00 /**< MAC length - 7-bits. */
#define TX_IP_LEN_CMP_MASK 0x000001FF /**< IP length - 9-bits. */
-/** MAC+IP length. */
-#define TX_MACIP_LEN_CMP_MASK (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
+/**< MAC+IP length. */
+#define TX_MACIP_LEN_CMP_MASK (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
/**
* A packet message buffer.
uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */
/* offload features */
- uint16_t vlan_tci; /**< VLAN Tag Control Identifier (CPU order). */
- uint16_t l2_len:7; /**< L2 (MAC) Header Length. */
- uint16_t l3_len:9; /**< L3 (IP) Header Length. */
+ union rte_vlan_macip vlan_macip;
union {
uint32_t rss; /**< RSS hash result if RSS enabled */
struct {
m->pkt.next = NULL;
m->pkt.pkt_len = 0;
- m->pkt.l2_len = 0;
- m->pkt.l3_len = 0;
- m->pkt.vlan_tci = 0;
+ m->pkt.vlan_macip.data = 0;
m->pkt.nb_segs = 1;
m->pkt.in_port = 0xff;