mbuf: expand ol_flags field to 64-bits

The offload flags field (ol_flags) was 16-bits and had no further room
for expansion. This patch increases the field size to 64-bits, using up
the remaining reserved space in the single-cache-line mbuf.

NOTE: none of the values for existing flags have been changed, i.e. no
new numbers have been explicitly reserved between existing flag
definitions.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
This commit is contained in:
Bruce Richardson 2014-09-11 14:15:37 +01:00 committed by Thomas Monjalon
parent 21dc08a991
commit 4332beee95
13 changed files with 106 additions and 118 deletions

View File

@ -1714,14 +1714,14 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
} }
void void
tx_cksum_set(portid_t port_id, uint8_t cksum_mask) tx_cksum_set(portid_t port_id, uint64_t ol_flags)
{ {
uint16_t tx_ol_flags; uint64_t tx_ol_flags;
if (port_id_is_invalid(port_id)) if (port_id_is_invalid(port_id))
return; return;
/* Clear last 4 bits and then set L3/4 checksum mask again */ /* Clear last 4 bits and then set L3/4 checksum mask again */
tx_ol_flags = (uint16_t) (ports[port_id].tx_ol_flags & 0xFFF0); tx_ol_flags = ports[port_id].tx_ol_flags & (~0x0Full);
ports[port_id].tx_ol_flags = (uint16_t) ((cksum_mask & 0xf) | tx_ol_flags); ports[port_id].tx_ol_flags = ((ol_flags & 0xf) | tx_ol_flags);
} }
void void

View File

@ -217,9 +217,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
uint16_t nb_rx; uint16_t nb_rx;
uint16_t nb_tx; uint16_t nb_tx;
uint16_t i; uint16_t i;
uint16_t ol_flags; uint64_t ol_flags;
uint16_t pkt_ol_flags; uint64_t pkt_ol_flags;
uint16_t tx_ol_flags; uint64_t tx_ol_flags;
uint16_t l4_proto; uint16_t l4_proto;
uint16_t eth_type; uint16_t eth_type;
uint8_t l2_len; uint8_t l2_len;
@ -261,7 +261,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
mb = pkts_burst[i]; mb = pkts_burst[i];
l2_len = sizeof(struct ether_hdr); l2_len = sizeof(struct ether_hdr);
pkt_ol_flags = mb->ol_flags; pkt_ol_flags = mb->ol_flags;
ol_flags = (uint16_t) (pkt_ol_flags & (~PKT_TX_L4_MASK)); ol_flags = (pkt_ol_flags & (~PKT_TX_L4_MASK));
eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);
eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type);

View File

@ -109,7 +109,7 @@ pkt_burst_receive(struct fwd_stream *fs)
struct rte_mbuf *mb; struct rte_mbuf *mb;
struct ether_hdr *eth_hdr; struct ether_hdr *eth_hdr;
uint16_t eth_type; uint16_t eth_type;
uint16_t ol_flags; uint64_t ol_flags;
uint16_t nb_rx; uint16_t nb_rx;
uint16_t i; uint16_t i;
#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES

View File

@ -141,7 +141,7 @@ struct rte_port {
struct fwd_stream *rx_stream; /**< Port RX stream, if unique */ struct fwd_stream *rx_stream; /**< Port RX stream, if unique */
struct fwd_stream *tx_stream; /**< Port TX stream, if unique */ struct fwd_stream *tx_stream; /**< Port TX stream, if unique */
unsigned int socket_id; /**< For NUMA support */ unsigned int socket_id; /**< For NUMA support */
uint16_t tx_ol_flags;/**< Offload Flags of TX packets. */ uint64_t tx_ol_flags;/**< Offload Flags of TX packets. */
uint16_t tx_vlan_id; /**< Tag Id. in TX VLAN packets. */ uint16_t tx_vlan_id; /**< Tag Id. in TX VLAN packets. */
void *fwd_ctx; /**< Forwarding mode context */ void *fwd_ctx; /**< Forwarding mode context */
uint64_t rx_bad_ip_csum; /**< rx pkts with bad ip checksum */ uint64_t rx_bad_ip_csum; /**< rx pkts with bad ip checksum */
@ -494,7 +494,7 @@ void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value); void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
void tx_cksum_set(portid_t port_id, uint8_t cksum_mask); void tx_cksum_set(portid_t port_id, uint64_t ol_flags);
void set_verbose_level(uint16_t vb_level); void set_verbose_level(uint16_t vb_level);
void set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs); void set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs);

View File

@ -203,7 +203,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
uint16_t nb_tx; uint16_t nb_tx;
uint16_t nb_pkt; uint16_t nb_pkt;
uint16_t vlan_tci; uint16_t vlan_tci;
uint16_t ol_flags; uint64_t ol_flags;
uint8_t i; uint8_t i;
#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
uint64_t start_tsc; uint64_t start_tsc;

View File

@ -112,8 +112,8 @@ struct rte_kni_mbuf {
char pad0[10]; char pad0[10];
uint16_t data_off; /**< Start address of data in segment buffer. */ uint16_t data_off; /**< Start address of data in segment buffer. */
char pad1[4]; char pad1[4];
uint16_t ol_flags; /**< Offload features. */ uint64_t ol_flags; /**< Offload features. */
char pad2[8]; char pad2[2];
uint16_t data_len; /**< Amount of data in segment buffer. */ uint16_t data_len; /**< Amount of data in segment buffer. */
uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */ uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */
char pad3[8]; char pad3[8];

View File

@ -174,7 +174,7 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
fprintf(f, "dump mbuf at 0x%p, phys=%"PRIx64", buf_len=%u\n", fprintf(f, "dump mbuf at 0x%p, phys=%"PRIx64", buf_len=%u\n",
m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len); m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);
fprintf(f, " pkt_len=%"PRIu32", ol_flags=%"PRIx16", nb_segs=%u, " fprintf(f, " pkt_len=%"PRIu32", ol_flags=%"PRIx64", nb_segs=%u, "
"in_port=%u\n", m->pkt_len, m->ol_flags, "in_port=%u\n", m->pkt_len, m->ol_flags,
(unsigned)m->nb_segs, (unsigned)m->port); (unsigned)m->nb_segs, (unsigned)m->port);
nb_segs = m->nb_segs; nb_segs = m->nb_segs;

View File

@ -141,9 +141,7 @@ struct rte_mbuf {
uint8_t nb_segs; /**< Number of segments. */ uint8_t nb_segs; /**< Number of segments. */
uint8_t port; /**< Input port. */ uint8_t port; /**< Input port. */
uint16_t ol_flags; /**< Offload features. */ uint64_t ol_flags; /**< Offload features. */
uint16_t reserved0; /**< Unused field. Required for padding */
uint32_t reserved1; /**< Unused field. Required for padding */
/* remaining bytes are set on RX when pulling packet from descriptor */ /* remaining bytes are set on RX when pulling packet from descriptor */
uint16_t reserved2; /**< Unused field. Required for padding */ uint16_t reserved2; /**< Unused field. Required for padding */

View File

@ -168,7 +168,7 @@ union em_vlan_macip {
* Structure to check if new context need be built * Structure to check if new context need be built
*/ */
struct em_ctx_info { struct em_ctx_info {
uint16_t flags; /**< ol_flags related to context build. */ uint64_t flags; /**< ol_flags related to context build. */
uint32_t cmp_mask; /**< compare mask */ uint32_t cmp_mask; /**< compare mask */
union em_vlan_macip hdrlen; /**< L2 and L3 header lenghts */ union em_vlan_macip hdrlen; /**< L2 and L3 header lenghts */
}; };
@ -238,7 +238,7 @@ struct em_tx_queue {
static inline void static inline void
em_set_xmit_ctx(struct em_tx_queue* txq, em_set_xmit_ctx(struct em_tx_queue* txq,
volatile struct e1000_context_desc *ctx_txd, volatile struct e1000_context_desc *ctx_txd,
uint16_t flags, uint64_t flags,
union em_vlan_macip hdrlen) union em_vlan_macip hdrlen)
{ {
uint32_t cmp_mask, cmd_len; uint32_t cmp_mask, cmd_len;
@ -304,7 +304,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq,
* or create a new context descriptor. * or create a new context descriptor.
*/ */
static inline uint32_t static inline uint32_t
what_ctx_update(struct em_tx_queue *txq, uint16_t flags, what_ctx_update(struct em_tx_queue *txq, uint64_t flags,
union em_vlan_macip hdrlen) union em_vlan_macip hdrlen)
{ {
/* If match with the current context */ /* If match with the current context */
@ -377,7 +377,7 @@ em_xmit_cleanup(struct em_tx_queue *txq)
} }
static inline uint32_t static inline uint32_t
tx_desc_cksum_flags_to_upper(uint16_t ol_flags) tx_desc_cksum_flags_to_upper(uint64_t ol_flags)
{ {
static const uint32_t l4_olinfo[2] = {0, E1000_TXD_POPTS_TXSM << 8}; static const uint32_t l4_olinfo[2] = {0, E1000_TXD_POPTS_TXSM << 8};
static const uint32_t l3_olinfo[2] = {0, E1000_TXD_POPTS_IXSM << 8}; static const uint32_t l3_olinfo[2] = {0, E1000_TXD_POPTS_IXSM << 8};
@ -403,12 +403,12 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint32_t popts_spec; uint32_t popts_spec;
uint32_t cmd_type_len; uint32_t cmd_type_len;
uint16_t slen; uint16_t slen;
uint16_t ol_flags; uint64_t ol_flags;
uint16_t tx_id; uint16_t tx_id;
uint16_t tx_last; uint16_t tx_last;
uint16_t nb_tx; uint16_t nb_tx;
uint16_t nb_used; uint16_t nb_used;
uint16_t tx_ol_req; uint64_t tx_ol_req;
uint32_t ctx; uint32_t ctx;
uint32_t new_ctx; uint32_t new_ctx;
union em_vlan_macip hdrlen; union em_vlan_macip hdrlen;
@ -438,8 +438,7 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
ol_flags = tx_pkt->ol_flags; ol_flags = tx_pkt->ol_flags;
/* If hardware offload required */ /* If hardware offload required */
tx_ol_req = (uint16_t)(ol_flags & (PKT_TX_IP_CKSUM | tx_ol_req = (ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK));
PKT_TX_L4_MASK));
if (tx_ol_req) { if (tx_ol_req) {
hdrlen.f.vlan_tci = tx_pkt->vlan_tci; hdrlen.f.vlan_tci = tx_pkt->vlan_tci;
hdrlen.f.l2_len = tx_pkt->l2_len; hdrlen.f.l2_len = tx_pkt->l2_len;
@ -642,22 +641,21 @@ end_of_tx:
* *
**********************************************************************/ **********************************************************************/
static inline uint16_t static inline uint64_t
rx_desc_status_to_pkt_flags(uint32_t rx_status) rx_desc_status_to_pkt_flags(uint32_t rx_status)
{ {
uint16_t pkt_flags; uint64_t pkt_flags;
/* Check if VLAN present */ /* Check if VLAN present */
pkt_flags = (uint16_t)((rx_status & E1000_RXD_STAT_VP) ? pkt_flags = ((rx_status & E1000_RXD_STAT_VP) ? PKT_RX_VLAN_PKT : 0);
PKT_RX_VLAN_PKT : 0);
return pkt_flags; return pkt_flags;
} }
static inline uint16_t static inline uint64_t
rx_desc_error_to_pkt_flags(uint32_t rx_error) rx_desc_error_to_pkt_flags(uint32_t rx_error)
{ {
uint16_t pkt_flags = 0; uint64_t pkt_flags = 0;
if (rx_error & E1000_RXD_ERR_IPE) if (rx_error & E1000_RXD_ERR_IPE)
pkt_flags |= PKT_RX_IP_CKSUM_BAD; pkt_flags |= PKT_RX_IP_CKSUM_BAD;
@ -801,8 +799,8 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
rxm->port = rxq->port_id; rxm->port = rxq->port_id;
rxm->ol_flags = rx_desc_status_to_pkt_flags(status); rxm->ol_flags = rx_desc_status_to_pkt_flags(status);
rxm->ol_flags = (uint16_t)(rxm->ol_flags | rxm->ol_flags = rxm->ol_flags |
rx_desc_error_to_pkt_flags(rxd.errors)); rx_desc_error_to_pkt_flags(rxd.errors);
/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */ /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
rxm->vlan_tci = rte_le_to_cpu_16(rxd.special); rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);
@ -1027,8 +1025,8 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
first_seg->port = rxq->port_id; first_seg->port = rxq->port_id;
first_seg->ol_flags = rx_desc_status_to_pkt_flags(status); first_seg->ol_flags = rx_desc_status_to_pkt_flags(status);
first_seg->ol_flags = (uint16_t)(first_seg->ol_flags | first_seg->ol_flags = first_seg->ol_flags |
rx_desc_error_to_pkt_flags(rxd.errors)); rx_desc_error_to_pkt_flags(rxd.errors);
/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */ /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
rxm->vlan_tci = rte_le_to_cpu_16(rxd.special); rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);

View File

@ -175,7 +175,7 @@ union igb_vlan_macip {
* Strucutre to check if new context need be built * Strucutre to check if new context need be built
*/ */
struct igb_advctx_info { struct igb_advctx_info {
uint16_t flags; /**< ol_flags related to context build. */ uint64_t flags; /**< ol_flags related to context build. */
uint32_t cmp_mask; /**< compare mask for vlan_macip_lens */ uint32_t cmp_mask; /**< compare mask for vlan_macip_lens */
union igb_vlan_macip vlan_macip_lens; /**< vlan, mac & ip length. */ union igb_vlan_macip vlan_macip_lens; /**< vlan, mac & ip length. */
}; };
@ -243,7 +243,7 @@ struct igb_tx_queue {
static inline void static inline void
igbe_set_xmit_ctx(struct igb_tx_queue* txq, igbe_set_xmit_ctx(struct igb_tx_queue* txq,
volatile struct e1000_adv_tx_context_desc *ctx_txd, volatile struct e1000_adv_tx_context_desc *ctx_txd,
uint16_t ol_flags, uint32_t vlan_macip_lens) uint64_t ol_flags, uint32_t vlan_macip_lens)
{ {
uint32_t type_tucmd_mlhl; uint32_t type_tucmd_mlhl;
uint32_t mss_l4len_idx; uint32_t mss_l4len_idx;
@ -308,7 +308,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq,
* or create a new context descriptor. * or create a new context descriptor.
*/ */
static inline uint32_t static inline uint32_t
what_advctx_update(struct igb_tx_queue *txq, uint16_t flags, what_advctx_update(struct igb_tx_queue *txq, uint64_t flags,
uint32_t vlan_macip_lens) uint32_t vlan_macip_lens)
{ {
/* If match with the current context */ /* If match with the current context */
@ -331,7 +331,7 @@ what_advctx_update(struct igb_tx_queue *txq, uint16_t flags,
} }
static inline uint32_t static inline uint32_t
tx_desc_cksum_flags_to_olinfo(uint16_t ol_flags) tx_desc_cksum_flags_to_olinfo(uint64_t ol_flags)
{ {
static const uint32_t l4_olinfo[2] = {0, E1000_ADVTXD_POPTS_TXSM}; static const uint32_t l4_olinfo[2] = {0, E1000_ADVTXD_POPTS_TXSM};
static const uint32_t l3_olinfo[2] = {0, E1000_ADVTXD_POPTS_IXSM}; static const uint32_t l3_olinfo[2] = {0, E1000_ADVTXD_POPTS_IXSM};
@ -343,7 +343,7 @@ tx_desc_cksum_flags_to_olinfo(uint16_t ol_flags)
} }
static inline uint32_t static inline uint32_t
tx_desc_vlan_flags_to_cmdtype(uint16_t ol_flags) tx_desc_vlan_flags_to_cmdtype(uint64_t ol_flags)
{ {
static uint32_t vlan_cmd[2] = {0, E1000_ADVTXD_DCMD_VLE}; static uint32_t vlan_cmd[2] = {0, E1000_ADVTXD_DCMD_VLE};
return vlan_cmd[(ol_flags & PKT_TX_VLAN_PKT) != 0]; return vlan_cmd[(ol_flags & PKT_TX_VLAN_PKT) != 0];
@ -366,12 +366,12 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint32_t cmd_type_len; uint32_t cmd_type_len;
uint32_t pkt_len; uint32_t pkt_len;
uint16_t slen; uint16_t slen;
uint16_t ol_flags; uint64_t ol_flags;
uint16_t tx_end; uint16_t tx_end;
uint16_t tx_id; uint16_t tx_id;
uint16_t tx_last; uint16_t tx_last;
uint16_t nb_tx; uint16_t nb_tx;
uint16_t tx_ol_req; uint64_t tx_ol_req;
uint32_t new_ctx = 0; uint32_t new_ctx = 0;
uint32_t ctx = 0; uint32_t ctx = 0;
@ -400,7 +400,7 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
ol_flags = tx_pkt->ol_flags; ol_flags = tx_pkt->ol_flags;
vlan_macip_lens.f.vlan_tci = tx_pkt->vlan_tci; vlan_macip_lens.f.vlan_tci = tx_pkt->vlan_tci;
vlan_macip_lens.f.l2_l3_len = tx_pkt->l2_l3_len; vlan_macip_lens.f.l2_l3_len = tx_pkt->l2_l3_len;
tx_ol_req = (uint16_t)(ol_flags & PKT_TX_OFFLOAD_MASK); tx_ol_req = ol_flags & PKT_TX_OFFLOAD_MASK;
/* If a Context Descriptor need be built . */ /* If a Context Descriptor need be built . */
if (tx_ol_req) { if (tx_ol_req) {
@ -587,12 +587,12 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
* RX functions * RX functions
* *
**********************************************************************/ **********************************************************************/
static inline uint16_t static inline uint64_t
rx_desc_hlen_type_rss_to_pkt_flags(uint32_t hl_tp_rs) rx_desc_hlen_type_rss_to_pkt_flags(uint32_t hl_tp_rs)
{ {
uint16_t pkt_flags; uint64_t pkt_flags;
static uint16_t ip_pkt_types_map[16] = { static uint64_t ip_pkt_types_map[16] = {
0, PKT_RX_IPV4_HDR, PKT_RX_IPV4_HDR_EXT, PKT_RX_IPV4_HDR_EXT, 0, PKT_RX_IPV4_HDR, PKT_RX_IPV4_HDR_EXT, PKT_RX_IPV4_HDR_EXT,
PKT_RX_IPV6_HDR, 0, 0, 0, PKT_RX_IPV6_HDR, 0, 0, 0,
PKT_RX_IPV6_HDR_EXT, 0, 0, 0, PKT_RX_IPV6_HDR_EXT, 0, 0, 0,
@ -605,34 +605,32 @@ rx_desc_hlen_type_rss_to_pkt_flags(uint32_t hl_tp_rs)
0, 0, 0, 0, 0, 0, 0, 0,
}; };
pkt_flags = (uint16_t)((hl_tp_rs & E1000_RXDADV_PKTTYPE_ETQF) ? pkt_flags = (hl_tp_rs & E1000_RXDADV_PKTTYPE_ETQF) ?
ip_pkt_etqf_map[(hl_tp_rs >> 4) & 0x07] : ip_pkt_etqf_map[(hl_tp_rs >> 4) & 0x07] :
ip_pkt_types_map[(hl_tp_rs >> 4) & 0x0F]); ip_pkt_types_map[(hl_tp_rs >> 4) & 0x0F];
#else #else
pkt_flags = (uint16_t)((hl_tp_rs & E1000_RXDADV_PKTTYPE_ETQF) ? 0 : pkt_flags = (hl_tp_rs & E1000_RXDADV_PKTTYPE_ETQF) ? 0 :
ip_pkt_types_map[(hl_tp_rs >> 4) & 0x0F]); ip_pkt_types_map[(hl_tp_rs >> 4) & 0x0F];
#endif #endif
return (uint16_t)(pkt_flags | (((hl_tp_rs & 0x0F) == 0) ? return pkt_flags | (((hl_tp_rs & 0x0F) == 0) ? 0 : PKT_RX_RSS_HASH);
0 : PKT_RX_RSS_HASH));
} }
static inline uint16_t static inline uint64_t
rx_desc_status_to_pkt_flags(uint32_t rx_status) rx_desc_status_to_pkt_flags(uint32_t rx_status)
{ {
uint16_t pkt_flags; uint64_t pkt_flags;
/* Check if VLAN present */ /* Check if VLAN present */
pkt_flags = (uint16_t)((rx_status & E1000_RXD_STAT_VP) ? pkt_flags = (rx_status & E1000_RXD_STAT_VP) ? PKT_RX_VLAN_PKT : 0;
PKT_RX_VLAN_PKT : 0);
#if defined(RTE_LIBRTE_IEEE1588) #if defined(RTE_LIBRTE_IEEE1588)
if (rx_status & E1000_RXD_STAT_TMST) if (rx_status & E1000_RXD_STAT_TMST)
pkt_flags = (uint16_t)(pkt_flags | PKT_RX_IEEE1588_TMST); pkt_flags = pkt_flags | PKT_RX_IEEE1588_TMST;
#endif #endif
return pkt_flags; return pkt_flags;
} }
static inline uint16_t static inline uint64_t
rx_desc_error_to_pkt_flags(uint32_t rx_status) rx_desc_error_to_pkt_flags(uint32_t rx_status)
{ {
/* /*
@ -640,7 +638,7 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status)
* Bit 29: L4I, L4I integrity error * Bit 29: L4I, L4I integrity error
*/ */
static uint16_t error_to_pkt_flags_map[4] = { static uint64_t error_to_pkt_flags_map[4] = {
0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD,
PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD
}; };
@ -667,7 +665,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t rx_id; uint16_t rx_id;
uint16_t nb_rx; uint16_t nb_rx;
uint16_t nb_hold; uint16_t nb_hold;
uint16_t pkt_flags; uint64_t pkt_flags;
nb_rx = 0; nb_rx = 0;
nb_hold = 0; nb_hold = 0;
@ -786,10 +784,8 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan); rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss); pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
pkt_flags = (uint16_t)(pkt_flags | pkt_flags = pkt_flags | rx_desc_status_to_pkt_flags(staterr);
rx_desc_status_to_pkt_flags(staterr)); pkt_flags = pkt_flags | rx_desc_error_to_pkt_flags(staterr);
pkt_flags = (uint16_t)(pkt_flags |
rx_desc_error_to_pkt_flags(staterr));
rxm->ol_flags = pkt_flags; rxm->ol_flags = pkt_flags;
/* /*
@ -846,7 +842,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_rx; uint16_t nb_rx;
uint16_t nb_hold; uint16_t nb_hold;
uint16_t data_len; uint16_t data_len;
uint16_t pkt_flags; uint64_t pkt_flags;
nb_rx = 0; nb_rx = 0;
nb_hold = 0; nb_hold = 0;
@ -1022,10 +1018,8 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan); first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data); hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss); pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
pkt_flags = (uint16_t)(pkt_flags | pkt_flags = pkt_flags | rx_desc_status_to_pkt_flags(staterr);
rx_desc_status_to_pkt_flags(staterr)); pkt_flags = pkt_flags | rx_desc_error_to_pkt_flags(staterr);
pkt_flags = (uint16_t)(pkt_flags |
rx_desc_error_to_pkt_flags(staterr));
first_seg->ol_flags = pkt_flags; first_seg->ol_flags = pkt_flags;
/* Prefetch data of first segment, if configured to do so. */ /* Prefetch data of first segment, if configured to do so. */

View File

@ -91,27 +91,27 @@ static uint16_t i40e_xmit_pkts_simple(void *tx_queue,
uint16_t nb_pkts); uint16_t nb_pkts);
/* Translate the rx descriptor status to pkt flags */ /* Translate the rx descriptor status to pkt flags */
static inline uint16_t static inline uint64_t
i40e_rxd_status_to_pkt_flags(uint64_t qword) i40e_rxd_status_to_pkt_flags(uint64_t qword)
{ {
uint16_t flags; uint64_t flags;
/* Check if VLAN packet */ /* Check if VLAN packet */
flags = (uint16_t)(qword & (1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ? flags = qword & (1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ?
PKT_RX_VLAN_PKT : 0); PKT_RX_VLAN_PKT : 0;
/* Check if RSS_HASH */ /* Check if RSS_HASH */
flags |= (uint16_t)((((qword >> I40E_RX_DESC_STATUS_FLTSTAT_SHIFT) & flags |= (((qword >> I40E_RX_DESC_STATUS_FLTSTAT_SHIFT) &
I40E_RX_DESC_FLTSTAT_RSS_HASH) == I40E_RX_DESC_FLTSTAT_RSS_HASH) ==
I40E_RX_DESC_FLTSTAT_RSS_HASH) ? PKT_RX_RSS_HASH : 0); I40E_RX_DESC_FLTSTAT_RSS_HASH) ? PKT_RX_RSS_HASH : 0;
return flags; return flags;
} }
static inline uint16_t static inline uint64_t
i40e_rxd_error_to_pkt_flags(uint64_t qword) i40e_rxd_error_to_pkt_flags(uint64_t qword)
{ {
uint16_t flags = 0; uint64_t flags = 0;
uint64_t error_bits = (qword >> I40E_RXD_QW1_ERROR_SHIFT); uint64_t error_bits = (qword >> I40E_RXD_QW1_ERROR_SHIFT);
#define I40E_RX_ERR_BITS 0x3f #define I40E_RX_ERR_BITS 0x3f
@ -143,12 +143,12 @@ i40e_rxd_error_to_pkt_flags(uint64_t qword)
} }
/* Translate pkt types to pkt flags */ /* Translate pkt types to pkt flags */
static inline uint16_t static inline uint64_t
i40e_rxd_ptype_to_pkt_flags(uint64_t qword) i40e_rxd_ptype_to_pkt_flags(uint64_t qword)
{ {
uint8_t ptype = (uint8_t)((qword & I40E_RXD_QW1_PTYPE_MASK) >> uint8_t ptype = (uint8_t)((qword & I40E_RXD_QW1_PTYPE_MASK) >>
I40E_RXD_QW1_PTYPE_SHIFT); I40E_RXD_QW1_PTYPE_SHIFT);
static const uint16_t ip_ptype_map[I40E_MAX_PKT_TYPE] = { static const uint64_t ip_ptype_map[I40E_MAX_PKT_TYPE] = {
0, /* PTYPE 0 */ 0, /* PTYPE 0 */
0, /* PTYPE 1 */ 0, /* PTYPE 1 */
0, /* PTYPE 2 */ 0, /* PTYPE 2 */
@ -567,7 +567,7 @@ i40e_rx_scan_hw_ring(struct i40e_rx_queue *rxq)
uint32_t rx_status; uint32_t rx_status;
int32_t s[I40E_LOOK_AHEAD], nb_dd; int32_t s[I40E_LOOK_AHEAD], nb_dd;
int32_t i, j, nb_rx = 0; int32_t i, j, nb_rx = 0;
uint16_t pkt_flags; uint64_t pkt_flags;
rxdp = &rxq->rx_ring[rxq->rx_tail]; rxdp = &rxq->rx_ring[rxq->rx_tail];
rxep = &rxq->sw_ring[rxq->rx_tail]; rxep = &rxq->sw_ring[rxq->rx_tail];
@ -789,7 +789,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
uint16_t rx_packet_len; uint16_t rx_packet_len;
uint16_t rx_id, nb_hold; uint16_t rx_id, nb_hold;
uint64_t dma_addr; uint64_t dma_addr;
uint16_t pkt_flags; uint64_t pkt_flags;
nb_rx = 0; nb_rx = 0;
nb_hold = 0; nb_hold = 0;
@ -896,10 +896,11 @@ i40e_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf *last_seg = rxq->pkt_last_seg; struct rte_mbuf *last_seg = rxq->pkt_last_seg;
struct rte_mbuf *nmb, *rxm; struct rte_mbuf *nmb, *rxm;
uint16_t rx_id = rxq->rx_tail; uint16_t rx_id = rxq->rx_tail;
uint16_t nb_rx = 0, nb_hold = 0, rx_packet_len, pkt_flags; uint16_t nb_rx = 0, nb_hold = 0, rx_packet_len;
uint32_t rx_status; uint32_t rx_status;
uint64_t qword1; uint64_t qword1;
uint64_t dma_addr; uint64_t dma_addr;
uint64_t pkt_flags;
while (nb_rx < nb_pkts) { while (nb_rx < nb_pkts) {
rxdp = &rx_ring[rx_id]; rxdp = &rx_ring[rx_id];
@ -1046,7 +1047,7 @@ i40e_recv_scattered_pkts(void *rx_queue,
/* Check if the context descriptor is needed for TX offloading */ /* Check if the context descriptor is needed for TX offloading */
static inline uint16_t static inline uint16_t
i40e_calc_context_desc(uint16_t flags) i40e_calc_context_desc(uint64_t flags)
{ {
uint16_t mask = 0; uint16_t mask = 0;
@ -1075,7 +1076,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
uint32_t td_offset; uint32_t td_offset;
uint32_t tx_flags; uint32_t tx_flags;
uint32_t td_tag; uint32_t td_tag;
uint16_t ol_flags; uint64_t ol_flags;
uint8_t l2_len; uint8_t l2_len;
uint8_t l3_len; uint8_t l3_len;
uint16_t nb_used; uint16_t nb_used;

View File

@ -358,7 +358,7 @@ ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
static inline void static inline void
ixgbe_set_xmit_ctx(struct igb_tx_queue* txq, ixgbe_set_xmit_ctx(struct igb_tx_queue* txq,
volatile struct ixgbe_adv_tx_context_desc *ctx_txd, volatile struct ixgbe_adv_tx_context_desc *ctx_txd,
uint16_t ol_flags, uint32_t vlan_macip_lens) uint64_t ol_flags, uint32_t vlan_macip_lens)
{ {
uint32_t type_tucmd_mlhl; uint32_t type_tucmd_mlhl;
uint32_t mss_l4len_idx; uint32_t mss_l4len_idx;
@ -421,7 +421,7 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq,
* or create a new context descriptor. * or create a new context descriptor.
*/ */
static inline uint32_t static inline uint32_t
what_advctx_update(struct igb_tx_queue *txq, uint16_t flags, what_advctx_update(struct igb_tx_queue *txq, uint64_t flags,
uint32_t vlan_macip_lens) uint32_t vlan_macip_lens)
{ {
/* If match with the current used context */ /* If match with the current used context */
@ -444,7 +444,7 @@ what_advctx_update(struct igb_tx_queue *txq, uint16_t flags,
} }
static inline uint32_t static inline uint32_t
tx_desc_cksum_flags_to_olinfo(uint16_t ol_flags) tx_desc_cksum_flags_to_olinfo(uint64_t ol_flags)
{ {
static const uint32_t l4_olinfo[2] = {0, IXGBE_ADVTXD_POPTS_TXSM}; static const uint32_t l4_olinfo[2] = {0, IXGBE_ADVTXD_POPTS_TXSM};
static const uint32_t l3_olinfo[2] = {0, IXGBE_ADVTXD_POPTS_IXSM}; static const uint32_t l3_olinfo[2] = {0, IXGBE_ADVTXD_POPTS_IXSM};
@ -456,7 +456,7 @@ tx_desc_cksum_flags_to_olinfo(uint16_t ol_flags)
} }
static inline uint32_t static inline uint32_t
tx_desc_vlan_flags_to_cmdtype(uint16_t ol_flags) tx_desc_vlan_flags_to_cmdtype(uint64_t ol_flags)
{ {
static const uint32_t vlan_cmd[2] = {0, IXGBE_ADVTXD_DCMD_VLE}; static const uint32_t vlan_cmd[2] = {0, IXGBE_ADVTXD_DCMD_VLE};
return vlan_cmd[(ol_flags & PKT_TX_VLAN_PKT) != 0]; return vlan_cmd[(ol_flags & PKT_TX_VLAN_PKT) != 0];
@ -546,12 +546,12 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint32_t cmd_type_len; uint32_t cmd_type_len;
uint32_t pkt_len; uint32_t pkt_len;
uint16_t slen; uint16_t slen;
uint16_t ol_flags; uint64_t ol_flags;
uint16_t tx_id; uint16_t tx_id;
uint16_t tx_last; uint16_t tx_last;
uint16_t nb_tx; uint16_t nb_tx;
uint16_t nb_used; uint16_t nb_used;
uint16_t tx_ol_req; uint64_t tx_ol_req;
uint32_t ctx = 0; uint32_t ctx = 0;
uint32_t new_ctx; uint32_t new_ctx;
@ -583,7 +583,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
vlan_macip_lens.f.l2_l3_len = tx_pkt->l2_l3_len; vlan_macip_lens.f.l2_l3_len = tx_pkt->l2_l3_len;
/* If hardware offload required */ /* If hardware offload required */
tx_ol_req = (uint16_t)(ol_flags & PKT_TX_OFFLOAD_MASK); tx_ol_req = ol_flags & PKT_TX_OFFLOAD_MASK;
if (tx_ol_req) { if (tx_ol_req) {
/* If new context need be built or reuse the exist ctx. */ /* If new context need be built or reuse the exist ctx. */
ctx = what_advctx_update(txq, tx_ol_req, ctx = what_advctx_update(txq, tx_ol_req,
@ -813,19 +813,19 @@ end_of_tx:
* RX functions * RX functions
* *
**********************************************************************/ **********************************************************************/
static inline uint16_t static inline uint64_t
rx_desc_hlen_type_rss_to_pkt_flags(uint32_t hl_tp_rs) rx_desc_hlen_type_rss_to_pkt_flags(uint32_t hl_tp_rs)
{ {
uint16_t pkt_flags; uint16_t pkt_flags;
static uint16_t ip_pkt_types_map[16] = { static uint64_t ip_pkt_types_map[16] = {
0, PKT_RX_IPV4_HDR, PKT_RX_IPV4_HDR_EXT, PKT_RX_IPV4_HDR_EXT, 0, PKT_RX_IPV4_HDR, PKT_RX_IPV4_HDR_EXT, PKT_RX_IPV4_HDR_EXT,
PKT_RX_IPV6_HDR, 0, 0, 0, PKT_RX_IPV6_HDR, 0, 0, 0,
PKT_RX_IPV6_HDR_EXT, 0, 0, 0, PKT_RX_IPV6_HDR_EXT, 0, 0, 0,
PKT_RX_IPV6_HDR_EXT, 0, 0, 0, PKT_RX_IPV6_HDR_EXT, 0, 0, 0,
}; };
static uint16_t ip_rss_types_map[16] = { static uint64_t ip_rss_types_map[16] = {
0, PKT_RX_RSS_HASH, PKT_RX_RSS_HASH, PKT_RX_RSS_HASH, 0, PKT_RX_RSS_HASH, PKT_RX_RSS_HASH, PKT_RX_RSS_HASH,
0, PKT_RX_RSS_HASH, 0, PKT_RX_RSS_HASH, 0, PKT_RX_RSS_HASH, 0, PKT_RX_RSS_HASH,
PKT_RX_RSS_HASH, 0, 0, 0, PKT_RX_RSS_HASH, 0, 0, 0,
@ -838,45 +838,44 @@ rx_desc_hlen_type_rss_to_pkt_flags(uint32_t hl_tp_rs)
0, 0, 0, 0, 0, 0, 0, 0,
}; };
pkt_flags = (uint16_t) ((hl_tp_rs & IXGBE_RXDADV_PKTTYPE_ETQF) ? pkt_flags = (hl_tp_rs & IXGBE_RXDADV_PKTTYPE_ETQF) ?
ip_pkt_etqf_map[(hl_tp_rs >> 4) & 0x07] : ip_pkt_etqf_map[(hl_tp_rs >> 4) & 0x07] :
ip_pkt_types_map[(hl_tp_rs >> 4) & 0x0F]); ip_pkt_types_map[(hl_tp_rs >> 4) & 0x0F];
#else #else
pkt_flags = (uint16_t) ((hl_tp_rs & IXGBE_RXDADV_PKTTYPE_ETQF) ? 0 : pkt_flags = (hl_tp_rs & IXGBE_RXDADV_PKTTYPE_ETQF) ? 0 :
ip_pkt_types_map[(hl_tp_rs >> 4) & 0x0F]); ip_pkt_types_map[(hl_tp_rs >> 4) & 0x0F];
#endif #endif
return (uint16_t)(pkt_flags | ip_rss_types_map[hl_tp_rs & 0xF]); return pkt_flags | ip_rss_types_map[hl_tp_rs & 0xF];
} }
static inline uint16_t static inline uint64_t
rx_desc_status_to_pkt_flags(uint32_t rx_status) rx_desc_status_to_pkt_flags(uint32_t rx_status)
{ {
uint16_t pkt_flags; uint64_t pkt_flags;
/* /*
* Check if VLAN present only. * Check if VLAN present only.
* Do not check whether L3/L4 rx checksum done by NIC or not, * Do not check whether L3/L4 rx checksum done by NIC or not,
* That can be found from rte_eth_rxmode.hw_ip_checksum flag * That can be found from rte_eth_rxmode.hw_ip_checksum flag
*/ */
pkt_flags = (uint16_t)((rx_status & IXGBE_RXD_STAT_VP) ? pkt_flags = (rx_status & IXGBE_RXD_STAT_VP) ? PKT_RX_VLAN_PKT : 0;
PKT_RX_VLAN_PKT : 0);
#ifdef RTE_LIBRTE_IEEE1588 #ifdef RTE_LIBRTE_IEEE1588
if (rx_status & IXGBE_RXD_STAT_TMST) if (rx_status & IXGBE_RXD_STAT_TMST)
pkt_flags = (uint16_t)(pkt_flags | PKT_RX_IEEE1588_TMST); pkt_flags = pkt_flags | PKT_RX_IEEE1588_TMST;
#endif #endif
return pkt_flags; return pkt_flags;
} }
static inline uint16_t static inline uint64_t
rx_desc_error_to_pkt_flags(uint32_t rx_status) rx_desc_error_to_pkt_flags(uint32_t rx_status)
{ {
/* /*
* Bit 31: IPE, IPv4 checksum error * Bit 31: IPE, IPv4 checksum error
* Bit 30: L4I, L4I integrity error * Bit 30: L4I, L4I integrity error
*/ */
static uint16_t error_to_pkt_flags_map[4] = { static uint64_t error_to_pkt_flags_map[4] = {
0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD,
PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD
}; };
@ -947,10 +946,10 @@ ixgbe_rx_scan_hw_ring(struct igb_rx_queue *rxq)
mb->ol_flags = rx_desc_hlen_type_rss_to_pkt_flags( mb->ol_flags = rx_desc_hlen_type_rss_to_pkt_flags(
rxdp[j].wb.lower.lo_dword.data); rxdp[j].wb.lower.lo_dword.data);
/* reuse status field from scan list */ /* reuse status field from scan list */
mb->ol_flags = (uint16_t)(mb->ol_flags | mb->ol_flags = mb->ol_flags |
rx_desc_status_to_pkt_flags(s[j])); rx_desc_status_to_pkt_flags(s[j]);
mb->ol_flags = (uint16_t)(mb->ol_flags | mb->ol_flags = mb->ol_flags |
rx_desc_error_to_pkt_flags(s[j])); rx_desc_error_to_pkt_flags(s[j]);
} }
/* Move mbuf pointers from the S/W ring to the stage */ /* Move mbuf pointers from the S/W ring to the stage */
@ -1143,7 +1142,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t rx_id; uint16_t rx_id;
uint16_t nb_rx; uint16_t nb_rx;
uint16_t nb_hold; uint16_t nb_hold;
uint16_t pkt_flags; uint64_t pkt_flags;
nb_rx = 0; nb_rx = 0;
nb_hold = 0; nb_hold = 0;
@ -1261,10 +1260,8 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan); rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss); pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
pkt_flags = (uint16_t)(pkt_flags | pkt_flags = pkt_flags | rx_desc_status_to_pkt_flags(staterr);
rx_desc_status_to_pkt_flags(staterr)); pkt_flags = pkt_flags | rx_desc_error_to_pkt_flags(staterr);
pkt_flags = (uint16_t)(pkt_flags |
rx_desc_error_to_pkt_flags(staterr));
rxm->ol_flags = pkt_flags; rxm->ol_flags = pkt_flags;
if (likely(pkt_flags & PKT_RX_RSS_HASH)) if (likely(pkt_flags & PKT_RX_RSS_HASH))

View File

@ -177,7 +177,7 @@ union ixgbe_vlan_macip {
*/ */
struct ixgbe_advctx_info { struct ixgbe_advctx_info {
uint16_t flags; /**< ol_flags for context build. */ uint64_t flags; /**< ol_flags for context build. */
uint32_t cmp_mask; /**< compare mask for vlan_macip_lens */ uint32_t cmp_mask; /**< compare mask for vlan_macip_lens */
union ixgbe_vlan_macip vlan_macip_lens; /**< vlan, mac ip length. */ union ixgbe_vlan_macip vlan_macip_lens; /**< vlan, mac ip length. */
}; };