mbuf: group fields in vlan_macip union
Signed-off-by: Intel
This commit is contained in:
parent
4ef869927e
commit
42d7141686
@ -413,8 +413,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
@ -117,9 +117,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
|
||||
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;
|
||||
|
@ -164,7 +164,8 @@ pkt_burst_receive(struct fwd_stream *fs)
|
||||
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;
|
||||
|
@ -331,9 +331,7 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -266,9 +266,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
|
||||
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);
|
||||
|
@ -287,7 +287,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t port_in)
|
||||
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);
|
||||
|
@ -239,7 +239,7 @@ static inline int32_t rte_ipv4_fragmentation(struct rte_mbuf *pkt_in,
|
||||
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;
|
||||
|
@ -341,9 +341,7 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
|
||||
|
||||
/* 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;
|
||||
|
@ -115,12 +115,26 @@ struct rte_ctrlmbuf {
|
||||
*/
|
||||
#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.
|
||||
@ -137,9 +151,7 @@ struct rte_pktmbuf {
|
||||
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 {
|
||||
@ -543,9 +555,7 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
|
||||
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user