net/ice: enhance the FlexiMD handling
PATCH 1/1 net/ice: enhance the FlexiMD handling
The ice hardware supports different FlexiMDs selection into mbuf, it can have different offset in the Rx descriptor for single FlexiMD, like flow id. So it needs to handle the FlexiMD extraction according to the RXDID.
--- drivers/net/ice/ice_rxtx.c | 260 ++++++++++++++++++++++--------------- drivers/net/ice/ice_rxtx.h | 5 + 2 files changed, 160 insertions(+), 105 deletions(-)
drivers/net/ice/ice_rxtx.c +155 -105
@@ -25,40 +25,6 @@ uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask; -static inline uint64_t -ice_rxdid_to_proto_xtr_ol_flag (uint8_t rxdid,bool *chk_valid) -{ -static struct { -uint64_t *ol_flag; -bool chk_valid; - } ol_flag_map[] = { - [ICE_RXDID_COMMS_AUX_VLAN ] = { - &rte_net_ice_dynflag_proto_xtr_vlan_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV4 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv4_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6_FLOW ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask, true }, - [ICE_RXDID_COMMS_AUX_TCP ] = { - &rte_net_ice_dynflag_proto_xtr_tcp_mask, true }, - [ICE_RXDID_COMMS_AUX_IP_OFFSET ] = { - &rte_net_ice_dynflag_proto_xtr_ip_offset_mask, false }, - }; -uint64_t *ol_flag; - -if (rxdid <RTE_DIM (ol_flag_map)) { - ol_flag = ol_flag_map[rxdid].ol_flag; -if (!ol_flag) -return 0ULL ; - - *chk_valid = ol_flag_map[rxdid].chk_valid; -return *ol_flag; - } - -return 0ULL ; -} -static inline uint8_t ice_proto_xtr_type_to_rxdid (uint8_t xtr_type) {
@@ -76,6 +42,156 @@ ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) rxdid_map[xtr_type] : ICE_RXDID_COMMS_OVS; } +static inline void +ice_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = + (volatile struct ice_32b_rx_flex_desc_comms_ovs *)rxdp; +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +uint16_t stat_err; +#endif + +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v1 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + + stat_err =rte_le_to_cpu_16 (desc->status_error1); + +if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S )) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); + +if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S )) + metadata |= +rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) <<16 ; + +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; + } + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v2 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +if (desc->flex_ts.flex.aux0 !=0xFFFF ) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); +else if (desc->flex_ts.flex.aux1 !=0xFFFF ) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux1); + +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; + } + } +#endif +} + +static void +ice_select_rxd_to_pkt_fields_handler (struct ice_rx_queue *rxq,uint32_t rxdid) +{ +switch (rxdid) { +case ICE_RXDID_COMMS_AUX_VLAN : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_vlan_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV4 : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv4_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV6 : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV6_FLOW : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_TCP : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_tcp_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IP_OFFSET : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ip_offset_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v2; +break ; + +case ICE_RXDID_COMMS_OVS : +/* fall-through */ +default : + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs; +break ; + } + +if (!rte_net_ice_dynf_proto_xtr_metadata_avail ()) + rxq->xtr_ol_flag =0 ; +} +static enum ice_status ice_program_hw_rx_queue (struct ice_rx_queue *rxq) {
@@ -158,6 +274,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)return -EINVAL ; } +ice_select_rxd_to_pkt_fields_handler (rxq, rxdid); +/* Enable Flexible Descriptors in the queue context which * allows this driver to select a specific receive descriptor format */
@@ -1338,74 +1456,6 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ice_rx_flex_desc *rxdp) mb->vlan_tci, mb->vlan_tci_outer); } -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -#define ICE_RX_PROTO_XTR_VALID \ - ((1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S) | \ - (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) - -static void -ice_rxd_to_proto_xtr (struct rte_mbuf *mb, -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc) -{ -uint16_t stat_err =rte_le_to_cpu_16 (desc->status_error1); -uint32_t metadata =0 ; -uint64_t ol_flag; -bool chk_valid; - - ol_flag =ice_rxdid_to_proto_xtr_ol_flag (desc->rxdid, &chk_valid); -if (unlikely (!ol_flag)) -return ; - -if (chk_valid) { -if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S )) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); - -if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S )) - metadata |= -rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) <<16 ; - }else { -if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux0) !=0xFFFF ) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); -else if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) !=0xFFFF ) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux1); - } - -if (!metadata) -return ; - - mb->ol_flags |= ol_flag; - - *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; -} -#endif - -static inline void -ice_rxd_to_pkt_fields (struct rte_mbuf *mb, -volatile union ice_rx_flex_desc *rxdp) -{ -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = - (volatile struct ice_32b_rx_flex_desc_comms_ovs *)rxdp; -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -uint16_t stat_err; - - stat_err =rte_le_to_cpu_16 (desc->status_error0); -if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { - mb->ol_flags |=PKT_RX_RSS_HASH ; - mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); - } -#endif - -if (desc->flow_id !=0xFFFFFFFF ) { - mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; - mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); - } - -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -if (unlikely (rte_net_ice_dynf_proto_xtr_metadata_avail ())) -ice_rxd_to_proto_xtr (mb, desc); -#endif -} -#define ICE_LOOK_AHEAD 8#if (ICE_LOOK_AHEAD !=8 )#error "PMD ICE: ICE_LOOK_AHEAD must be 8\n"
@@ -1463,7 +1513,7 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) mb->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxdp[j].wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (mb, &rxdp[j]); -ice_rxd_to_pkt_fields (mb, &rxdp[j]); + rxq->rxd_to_pkt_fields (rxq, mb, &rxdp[j]); mb->ol_flags |= pkt_flags; }
@@ -1760,7 +1810,7 @@ ice_recv_scattered_pkts(void *rx_queue, first_seg->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (first_seg, &rxd); -ice_rxd_to_pkt_fields (first_seg, &rxd); + rxq->rxd_to_pkt_fields (rxq, first_seg, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); first_seg->ol_flags |= pkt_flags;/* Prefetch data of first segment, if configured to do so. */
@@ -2160,7 +2210,7 @@ ice_recv_pkts(void *rx_queue, rxm->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (rxm, &rxd); -ice_rxd_to_pkt_fields (rxm, &rxd); + rxq->rxd_to_pkt_fields (rxq, rxm, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); rxm->ol_flags |= pkt_flags;/* copy old mbuf to rx_pkts */
drivers/net/ice/ice_rxtx.h +5 -0
@@ -42,6 +42,9 @@typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq); +typedef void (*ice_rxd_to_pkt_fields_t)(__rte_unused struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp);struct ice_rx_entry {struct rte_mbuf *mbuf;
@@ -82,6 +85,8 @@ struct ice_rx_queue {bool q_set;/* indicate if rx queue has been configured */ bool rx_deferred_start;/* don't start this queue in dev start */ uint8_t proto_xtr;/* Protocol extraction from flexible descriptor */ +uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;ice_rx_release_mbufs_t rx_rel_mbufs; };
Signature · 1 line
2.28.0
PATCH v2 1/1 net/ice: enhance the FlexiMD handling
The ice hardware supports different FlexiMDs selection into mbuf, it can have different offset in the Rx descriptor for single FlexiMD, like flow id. So it needs to handle the FlexiMD extraction according to the RXDID.
---
v2: assign the handle for ICE_RXDID_COMMS_OVS directly, not use
fall-through.
--- drivers/net/ice/ice_rxtx.c | 263 ++++++++++++++++++++++--------------- drivers/net/ice/ice_rxtx.h | 5 + 2 files changed, 163 insertions(+), 105 deletions(-)
drivers/net/ice/ice_rxtx.c +158 -105
@@ -25,40 +25,6 @@ uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask; -static inline uint64_t -ice_rxdid_to_proto_xtr_ol_flag (uint8_t rxdid,bool *chk_valid) -{ -static struct { -uint64_t *ol_flag; -bool chk_valid; - } ol_flag_map[] = { - [ICE_RXDID_COMMS_AUX_VLAN ] = { - &rte_net_ice_dynflag_proto_xtr_vlan_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV4 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv4_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6_FLOW ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask, true }, - [ICE_RXDID_COMMS_AUX_TCP ] = { - &rte_net_ice_dynflag_proto_xtr_tcp_mask, true }, - [ICE_RXDID_COMMS_AUX_IP_OFFSET ] = { - &rte_net_ice_dynflag_proto_xtr_ip_offset_mask, false }, - }; -uint64_t *ol_flag; - -if (rxdid <RTE_DIM (ol_flag_map)) { - ol_flag = ol_flag_map[rxdid].ol_flag; -if (!ol_flag) -return 0ULL ; - - *chk_valid = ol_flag_map[rxdid].chk_valid; -return *ol_flag; - } - -return 0ULL ; -} -static inline uint8_t ice_proto_xtr_type_to_rxdid (uint8_t xtr_type) {
@@ -76,6 +42,159 @@ ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) rxdid_map[xtr_type] : ICE_RXDID_COMMS_OVS; } +static inline void +ice_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = + (volatile struct ice_32b_rx_flex_desc_comms_ovs *)rxdp; +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +uint16_t stat_err; +#endif + +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v1 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + + stat_err =rte_le_to_cpu_16 (desc->status_error1); + +if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S )) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); + +if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S )) + metadata |= +rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) <<16 ; + +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; + } + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v2 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +if (desc->flex_ts.flex.aux0 !=0xFFFF ) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); +else if (desc->flex_ts.flex.aux1 !=0xFFFF ) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux1); + +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; + } + } +#endif +} + +static void +ice_select_rxd_to_pkt_fields_handler (struct ice_rx_queue *rxq,uint32_t rxdid) +{ +switch (rxdid) { +case ICE_RXDID_COMMS_AUX_VLAN : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_vlan_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV4 : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv4_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV6 : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV6_FLOW : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_TCP : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_tcp_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IP_OFFSET : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ip_offset_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v2; +break ; + +case ICE_RXDID_COMMS_OVS : + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs; +break ; + +default : +/* update this according to the RXDID for PROTO_XTR_NONE */ + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs; +break ; + } + +if (!rte_net_ice_dynf_proto_xtr_metadata_avail ()) + rxq->xtr_ol_flag =0 ; +} +static enum ice_status ice_program_hw_rx_queue (struct ice_rx_queue *rxq) {
@@ -158,6 +277,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)return -EINVAL ; } +ice_select_rxd_to_pkt_fields_handler (rxq, rxdid); +/* Enable Flexible Descriptors in the queue context which * allows this driver to select a specific receive descriptor format */
@@ -1338,74 +1459,6 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ice_rx_flex_desc *rxdp) mb->vlan_tci, mb->vlan_tci_outer); } -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -#define ICE_RX_PROTO_XTR_VALID \ - ((1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S) | \ - (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) - -static void -ice_rxd_to_proto_xtr (struct rte_mbuf *mb, -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc) -{ -uint16_t stat_err =rte_le_to_cpu_16 (desc->status_error1); -uint32_t metadata =0 ; -uint64_t ol_flag; -bool chk_valid; - - ol_flag =ice_rxdid_to_proto_xtr_ol_flag (desc->rxdid, &chk_valid); -if (unlikely (!ol_flag)) -return ; - -if (chk_valid) { -if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S )) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); - -if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S )) - metadata |= -rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) <<16 ; - }else { -if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux0) !=0xFFFF ) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); -else if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) !=0xFFFF ) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux1); - } - -if (!metadata) -return ; - - mb->ol_flags |= ol_flag; - - *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; -} -#endif - -static inline void -ice_rxd_to_pkt_fields (struct rte_mbuf *mb, -volatile union ice_rx_flex_desc *rxdp) -{ -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = - (volatile struct ice_32b_rx_flex_desc_comms_ovs *)rxdp; -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -uint16_t stat_err; - - stat_err =rte_le_to_cpu_16 (desc->status_error0); -if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { - mb->ol_flags |=PKT_RX_RSS_HASH ; - mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); - } -#endif - -if (desc->flow_id !=0xFFFFFFFF ) { - mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; - mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); - } - -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -if (unlikely (rte_net_ice_dynf_proto_xtr_metadata_avail ())) -ice_rxd_to_proto_xtr (mb, desc); -#endif -} -#define ICE_LOOK_AHEAD 8#if (ICE_LOOK_AHEAD !=8 )#error "PMD ICE: ICE_LOOK_AHEAD must be 8\n"
@@ -1463,7 +1516,7 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) mb->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxdp[j].wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (mb, &rxdp[j]); -ice_rxd_to_pkt_fields (mb, &rxdp[j]); + rxq->rxd_to_pkt_fields (rxq, mb, &rxdp[j]); mb->ol_flags |= pkt_flags; }
@@ -1760,7 +1813,7 @@ ice_recv_scattered_pkts(void *rx_queue, first_seg->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (first_seg, &rxd); -ice_rxd_to_pkt_fields (first_seg, &rxd); + rxq->rxd_to_pkt_fields (rxq, first_seg, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); first_seg->ol_flags |= pkt_flags;/* Prefetch data of first segment, if configured to do so. */
@@ -2160,7 +2213,7 @@ ice_recv_pkts(void *rx_queue, rxm->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (rxm, &rxd); -ice_rxd_to_pkt_fields (rxm, &rxd); + rxq->rxd_to_pkt_fields (rxq, rxm, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); rxm->ol_flags |= pkt_flags;/* copy old mbuf to rx_pkts */
drivers/net/ice/ice_rxtx.h +5 -0
@@ -42,6 +42,9 @@typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq); +typedef void (*ice_rxd_to_pkt_fields_t)(__rte_unused struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp);struct ice_rx_entry {struct rte_mbuf *mbuf;
@@ -82,6 +85,8 @@ struct ice_rx_queue {bool q_set;/* indicate if rx queue has been configured */ bool rx_deferred_start;/* don't start this queue in dev start */ uint8_t proto_xtr;/* Protocol extraction from flexible descriptor */ +uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;ice_rx_release_mbufs_t rx_rel_mbufs; };
Signature · 1 line
2.28.0
PATCH v3 1/1 net/ice: refactor the Rx FlexiMD handling
In reply to Haiyue WangThe hardware supports many kinds of FlexiMDs set into Rx descriptor, and the FlexiMDs can have different offsets in the descriptor according the DDP package setting.
The FlexiMDs type and offset are identified by the RXDID, which will be used to setup the queue.
For expanding to support different RXDIDs in the future, refactor the Rx FlexiMD handling by the functions mapped to related RXDIDs.
---
v3: remove the typedef's ___rte_unused, and rewrite the commit title and
message.
v2: assign the handle for ICE_RXDID_COMMS_OVS directly, not use
fall-through.
--- drivers/net/ice/ice_rxtx.c | 263 ++++++++++++++++++++++--------------- drivers/net/ice/ice_rxtx.h | 5 + 2 files changed, 163 insertions(+), 105 deletions(-)
drivers/net/ice/ice_rxtx.c +158 -105
@@ -25,40 +25,6 @@ uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask; -static inline uint64_t -ice_rxdid_to_proto_xtr_ol_flag (uint8_t rxdid,bool *chk_valid) -{ -static struct { -uint64_t *ol_flag; -bool chk_valid; - } ol_flag_map[] = { - [ICE_RXDID_COMMS_AUX_VLAN ] = { - &rte_net_ice_dynflag_proto_xtr_vlan_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV4 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv4_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6_FLOW ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask, true }, - [ICE_RXDID_COMMS_AUX_TCP ] = { - &rte_net_ice_dynflag_proto_xtr_tcp_mask, true }, - [ICE_RXDID_COMMS_AUX_IP_OFFSET ] = { - &rte_net_ice_dynflag_proto_xtr_ip_offset_mask, false }, - }; -uint64_t *ol_flag; - -if (rxdid <RTE_DIM (ol_flag_map)) { - ol_flag = ol_flag_map[rxdid].ol_flag; -if (!ol_flag) -return 0ULL ; - - *chk_valid = ol_flag_map[rxdid].chk_valid; -return *ol_flag; - } - -return 0ULL ; -} -static inline uint8_t ice_proto_xtr_type_to_rxdid (uint8_t xtr_type) {
@@ -76,6 +42,159 @@ ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) rxdid_map[xtr_type] : ICE_RXDID_COMMS_OVS; } +static inline void +ice_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = + (volatile struct ice_32b_rx_flex_desc_comms_ovs *)rxdp; +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +uint16_t stat_err; +#endif + +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v1 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + + stat_err =rte_le_to_cpu_16 (desc->status_error1); + +if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S )) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); + +if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S )) + metadata |= +rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) <<16 ; + +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; + } + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v2 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +if (desc->flex_ts.flex.aux0 !=0xFFFF ) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); +else if (desc->flex_ts.flex.aux1 !=0xFFFF ) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux1); + +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; + } + } +#endif +} + +static void +ice_select_rxd_to_pkt_fields_handler (struct ice_rx_queue *rxq,uint32_t rxdid) +{ +switch (rxdid) { +case ICE_RXDID_COMMS_AUX_VLAN : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_vlan_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV4 : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv4_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV6 : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV6_FLOW : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_TCP : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_tcp_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IP_OFFSET : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ip_offset_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v2; +break ; + +case ICE_RXDID_COMMS_OVS : + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs; +break ; + +default : +/* update this according to the RXDID for PROTO_XTR_NONE */ + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs; +break ; + } + +if (!rte_net_ice_dynf_proto_xtr_metadata_avail ()) + rxq->xtr_ol_flag =0 ; +} +static enum ice_status ice_program_hw_rx_queue (struct ice_rx_queue *rxq) {
@@ -158,6 +277,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)return -EINVAL ; } +ice_select_rxd_to_pkt_fields_handler (rxq, rxdid); +/* Enable Flexible Descriptors in the queue context which * allows this driver to select a specific receive descriptor format */
@@ -1338,74 +1459,6 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ice_rx_flex_desc *rxdp) mb->vlan_tci, mb->vlan_tci_outer); } -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -#define ICE_RX_PROTO_XTR_VALID \ - ((1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S) | \ - (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) - -static void -ice_rxd_to_proto_xtr (struct rte_mbuf *mb, -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc) -{ -uint16_t stat_err =rte_le_to_cpu_16 (desc->status_error1); -uint32_t metadata =0 ; -uint64_t ol_flag; -bool chk_valid; - - ol_flag =ice_rxdid_to_proto_xtr_ol_flag (desc->rxdid, &chk_valid); -if (unlikely (!ol_flag)) -return ; - -if (chk_valid) { -if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S )) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); - -if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S )) - metadata |= -rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) <<16 ; - }else { -if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux0) !=0xFFFF ) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); -else if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) !=0xFFFF ) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux1); - } - -if (!metadata) -return ; - - mb->ol_flags |= ol_flag; - - *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; -} -#endif - -static inline void -ice_rxd_to_pkt_fields (struct rte_mbuf *mb, -volatile union ice_rx_flex_desc *rxdp) -{ -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = - (volatile struct ice_32b_rx_flex_desc_comms_ovs *)rxdp; -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -uint16_t stat_err; - - stat_err =rte_le_to_cpu_16 (desc->status_error0); -if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { - mb->ol_flags |=PKT_RX_RSS_HASH ; - mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); - } -#endif - -if (desc->flow_id !=0xFFFFFFFF ) { - mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; - mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); - } - -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -if (unlikely (rte_net_ice_dynf_proto_xtr_metadata_avail ())) -ice_rxd_to_proto_xtr (mb, desc); -#endif -} -#define ICE_LOOK_AHEAD 8#if (ICE_LOOK_AHEAD !=8 )#error "PMD ICE: ICE_LOOK_AHEAD must be 8\n"
@@ -1463,7 +1516,7 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) mb->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxdp[j].wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (mb, &rxdp[j]); -ice_rxd_to_pkt_fields (mb, &rxdp[j]); + rxq->rxd_to_pkt_fields (rxq, mb, &rxdp[j]); mb->ol_flags |= pkt_flags; }
@@ -1760,7 +1813,7 @@ ice_recv_scattered_pkts(void *rx_queue, first_seg->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (first_seg, &rxd); -ice_rxd_to_pkt_fields (first_seg, &rxd); + rxq->rxd_to_pkt_fields (rxq, first_seg, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); first_seg->ol_flags |= pkt_flags;/* Prefetch data of first segment, if configured to do so. */
@@ -2160,7 +2213,7 @@ ice_recv_pkts(void *rx_queue, rxm->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (rxm, &rxd); -ice_rxd_to_pkt_fields (rxm, &rxd); + rxq->rxd_to_pkt_fields (rxq, rxm, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); rxm->ol_flags |= pkt_flags;/* copy old mbuf to rx_pkts */
drivers/net/ice/ice_rxtx.h +5 -0
@@ -42,6 +42,9 @@typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq); +typedef void (*ice_rxd_to_pkt_fields_t )(struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp);struct ice_rx_entry {struct rte_mbuf *mbuf;
@@ -82,6 +85,8 @@ struct ice_rx_queue {bool q_set;/* indicate if rx queue has been configured */ bool rx_deferred_start;/* don't start this queue in dev start */ uint8_t proto_xtr;/* Protocol extraction from flexible descriptor */ +uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;ice_rx_release_mbufs_t rx_rel_mbufs; };
Signature · 1 line
2.28.0
Re: [dpdk-dev] [PATCH v3] net/ice: refactor the Rx FlexiMD handling
Hi, haiyue
Quoted 90 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Friday, September 18, 2020 9:06 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingThe hardware supports many kinds of FlexiMDs set into Rx descriptor, and the FlexiMDs can have different offsets in the descriptor according the DDP package setting.
The FlexiMDs type and offset are identified by the RXDID, which will be used to setup the queue.
For expanding to support different RXDIDs in the future, refactor the Rx FlexiMD handling by the functions mapped to related RXDIDs.
Signed-off-by Haiyue Wang <[email protected]>---
v3: remove the typedef's___rte_unused, and rewrite the commit title and
message.
v2: assign the handle forICE_RXDID_COMMS_OVSdirectly, not use
fall-through.--- drivers/net/ice/ice_rxtx.c | 263 ++++++++++++++++++++++--------------- drivers/net/ice/ice_rxtx.h | 5 + 2 files changed, 163 insertions(+), 105 deletions(-)drivers/net/ice/ice_rxtx.c index renamed from drivers/net/ice/ice_rxtx.c +0
-0
fef6ad454..93a0ac691100644drivers/net/ice/ice_rxtx.c +0
-33@@ -25,40 +25,6 @@ uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask; -static inline uint64_t -ice_rxdid_to_proto_xtr_ol_flag(uint8_t rxdid, bool *chk_valid) -{ -static struct { -uint64_t *ol_flag; -bool chk_valid; - } ol_flag_map[] = { - [ICE_RXDID_COMMS_AUX_VLAN ] = { - &rte_net_ice_dynflag_proto_xtr_vlan_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV4 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv4_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6_FLOW ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask, true }, - [ICE_RXDID_COMMS_AUX_TCP ] = { - &rte_net_ice_dynflag_proto_xtr_tcp_mask, true }, - [ICE_RXDID_COMMS_AUX_IP_OFFSET ] = { - &rte_net_ice_dynflag_proto_xtr_ip_offset_mask, false }, - }; -uint64_t *ol_flag; - -if (rxdid <RTE_DIM (ol_flag_map)) { - ol_flag = ol_flag_map[rxdid].ol_flag; -if (!ol_flag) -return 0ULL ; - - *chk_valid = ol_flag_map[rxdid].chk_valid; -return *ol_flag; - } - -return 0ULL ; -} -static inline uint8_t ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) { @@ -76,6 +42,159 @@
ice_proto_xtr_type_to_rxdid(uint8_t xtr_type)
rxdid_map[xtr_type] :ICE_RXDID_COMMS_OVS; }drivers/net/ice/ice_rxtx.c +2
-0+static inline void +ice_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct ice_rx_queue*rxq,
drivers/net/ice/ice_rxtx.c +4
-0+ struct rte_mbuf *mb, + volatile union ice_rx_flex_desc *rxdp) { + volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = + (volatile struct ice_32b_rx_flex_desc_comms_ovs*)rxdp; #ifndef
drivers/net/ice/ice_rxtx.c ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) · line 54
Quoted 3 lines
drivers/net/ice/ice_rxtx.c +3
-0+RTE_LIBRTE_ICE_16BYTE_RX_DESC + uint16_t stat_err; +#endif
This #ifndef could be better combine with below #ifndef.
Quoted 92 lines
drivers/net/ice/ice_rxtx.c +9
-0+ +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + stat_err =rte_le_to_cpu_16 (desc->status_error0); + if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +16
-0+ mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v1 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) { +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); + if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +16
-0+ mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + + stat_err =rte_le_to_cpu_16 (desc->status_error1); + + if (stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S))drivers/net/ice/ice_rxtx.c +1
-0+ metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +2
-0+ + if (stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S))drivers/net/ice/ice_rxtx.c +2
-0+ metadata |= +rte_le_to_cpu_16 (desc->flex_ts.flex.aux1)<< 16;
drivers/net/ice/ice_rxtx.c +5
-0+ +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb)= metadata;
drivers/net/ice/ice_rxtx.c +15
-0+ } + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v2 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) { +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); + if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +15
-0+ mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +if (desc->flex_ts.flex.aux0 !=0xFFFF ) + metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +2
-0+else if (desc->flex_ts.flex.aux1 !=0xFFFF ) + metadata = rte_le_to_cpu_16(desc-
Quoted 1 line
Quoted 1 line
flex_ts.flex.aux1);
So you mean the ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S and ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S could not use to identify the IPv4 hdr offset and IPv6 hdr offset here in rxdid # 25? And if yes they can and they will not set at the same time, is that separate this v2 from v1 necessary?
Quoted 214 lines
drivers/net/ice/ice_rxtx.c +5
-0+ +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb)= metadata;
drivers/net/ice/ice_rxtx.c +11
-0+ } + } +#endif +} + +static void +ice_select_rxd_to_pkt_fields_handler (struct ice_rx_queue *rxq,uint32_t +rxdid) { +switch (rxdid) { +case ICE_RXDID_COMMS_AUX_VLAN : + rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_vlan_mask;drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV4 : + rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv4_mask;drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV6 : + rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv6_mask;drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV6_FLOW : + rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +5
-0+break ; + +case ICE_RXDID_COMMS_AUX_TCP : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_tcp_mask; + rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IP_OFFSET : + rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ip_offset_mask;drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v2;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_OVS : + rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_ovs;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +default : +/* update this according to the RXDID for PROTO_XTR_NONE */
drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_ovs;drivers/net/ice/ice_rxtx.c +7
-0+break ; + } + +if (!rte_net_ice_dynf_proto_xtr_metadata_avail ()) + rxq->xtr_ol_flag =0 ; +} +static enum ice_status ice_program_hw_rx_queue(struct ice_rx_queue *rxq) { @@ -158,6 +277,8@@
ice_program_hw_rx_queue(struct ice_rx_queue *rxq)drivers/net/ice/ice_rxtx.c +2
-25return -EINVAL ; } +ice_select_rxd_to_pkt_fields_handler (rxq, rxdid); +/* Enable Flexible Descriptors in the queue context which * allows this driver to select a specific receive descriptor format */ @@ -1338,74 +1459,6 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ice_rx_flex_desc *rxdp) mb->vlan_tci, mb->vlan_tci_outer); } -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -#define ICE_RX_PROTO_XTR_VALID \ - ((1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S) | \ - (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) - -static void -ice_rxd_to_proto_xtr (struct rte_mbuf *mb, -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc) -{ -uint16_t stat_err =rte_le_to_cpu_16 (desc->status_error1); -uint32_t metadata =0 ; -uint64_t ol_flag; -bool chk_valid; - - ol_flag =ice_rxdid_to_proto_xtr_ol_flag (desc->rxdid, &chk_valid); -if (unlikely (!ol_flag)) -return ; - -if (chk_valid) { -if (stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S)) - metadata =rte_le_to_cpu_16 (desc- >flex_ts.flex.aux0); - -if (stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) - metadata |= -rte_le_to_cpu_16 (desc->flex_ts.flex.aux1)<< 16;
drivers/net/ice/ice_rxtx.c +0
-3- }else { -if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux0) !=0xFFFF ) - metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +0
-2-else if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) !=0xFFFF ) - metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux1);
drivers/net/ice/ice_rxtx.c +0
-17- } - -if (!metadata) -return ; - - mb->ol_flags |= ol_flag; - - *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; -} -#endif - -static inline void -ice_rxd_to_pkt_fields (struct rte_mbuf *mb, -volatile union ice_rx_flex_desc *rxdp) -{ - volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = - (volatile struct ice_32b_rx_flex_desc_comms_ovs*)rxdp;
drivers/net/ice/ice_rxtx.c +0
-5-#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -uint16_t stat_err; - - stat_err =rte_le_to_cpu_16 (desc->status_error0); - if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +0
-16- mb->ol_flags |=PKT_RX_RSS_HASH ; - mb->hash.rss = rte_le_to_cpu_32(desc->rss_hash); - } -#endif - -if (desc->flow_id !=0xFFFFFFFF ) { - mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; - mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); - } - -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -if (unlikely (rte_net_ice_dynf_proto_xtr_metadata_avail ())) -ice_rxd_to_proto_xtr (mb, desc); -#endif -} -#define ICE_LOOK_AHEAD 8#if (ICE_LOOK_AHEAD !=8 )#error "PMD ICE: ICE_LOOK_AHEAD must be 8\n"@@ -1463,7 +1516,7 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) mb->packet_type =ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
rte_le_to_cpu_16(rxdp[j].wb.ptype_flex_flags0)];drivers/net/ice/ice_rxtx.c +1
-1ice_rxd_to_vlan_tci (mb, &rxdp[j]); -ice_rxd_to_pkt_fields (mb, &rxdp[j]); + rxq->rxd_to_pkt_fields (rxq, mb, &rxdp[j]); mb->ol_flags |= pkt_flags; }@@ -1760,7 +1813,7 @@ ice_recv_scattered_pkts(void *rx_queue, first_seg->packet_type =ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
drivers/net/ice/ice_rxtx.c +1
-1rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (first_seg, &rxd); -ice_rxd_to_pkt_fields (first_seg, &rxd); + rxq->rxd_to_pkt_fields (rxq, first_seg, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); first_seg->ol_flags |= pkt_flags;/* Prefetch data of first segment, if configured to do so. */ @@ -2160,7 +2213,7 @@ ice_recv_pkts(void *rx_queue, rxm->packet_type =ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
drivers/net/ice/ice_rxtx.c +1
-1rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (rxm, &rxd); -ice_rxd_to_pkt_fields (rxm, &rxd); + rxq->rxd_to_pkt_fields (rxq, rxm, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); rxm->ol_flags |= pkt_flags;/* copy old mbuf to rx_pkts */ drivers/net/ice/ice_rxtx.h index renamed from drivers/net/ice/ice_rxtx.h +0
-0
9fa57b3b2..de2291788100644drivers/net/ice/ice_rxtx.h +3
-0@@ -42,6 +42,9 @@typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq); +typedef void (*ice_rxd_to_pkt_fields_t )(struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp);struct ice_rx_entry {drivers/net/ice/ice_rxtx.h +0
-0struct rte_mbuf *mbuf;
drivers/net/ice/ice_rxtx.h struct ice_rx_queue { · line 89
Quoted 5 lines
drivers/net/ice/ice_rxtx.h +2
-0@@ -82,6 +85,8 @@ struct ice_rx_queue {bool q_set;/* indicate if rx queue has been configured */ bool rx_deferred_start;/* don't start this queue in dev start */ uint8_t proto_xtr;/* Protocol extraction from flexible descriptor */ +uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;
If create a function pointer here in .h, it is better add some doc.
Quoted 5 lines
drivers/net/ice/ice_rxtx.h +0
-1ice_rx_release_mbufs_t rx_rel_mbufs; }; --2.28.0
Re: [dpdk-dev] [PATCH v3] net/ice: refactor the Rx FlexiMD handling
Hi Jeff,
Quoted 93 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 13:35
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingHi, haiyue
Quoted 82 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Friday, September 18, 2020 9:06 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingThe hardware supports many kinds of FlexiMDs set into Rx descriptor, and the FlexiMDs can have different offsets in the descriptor according the DDP package setting.
The FlexiMDs type and offset are identified by the RXDID, which will be used to setup the queue.
For expanding to support different RXDIDs in the future, refactor the Rx FlexiMD handling by the functions mapped to related RXDIDs.
Signed-off-by Haiyue Wang <[email protected]>---
v3: remove the typedef's___rte_unused, and rewrite the commit title and
message.
v2: assign the handle forICE_RXDID_COMMS_OVSdirectly, not use
fall-through.--- drivers/net/ice/ice_rxtx.c | 263 ++++++++++++++++++++++--------------- drivers/net/ice/ice_rxtx.h | 5 + 2 files changed, 163 insertions(+), 105 deletions(-)drivers/net/ice/ice_rxtx.c index renamed from drivers/net/ice/ice_rxtx.c +0
-0
fef6ad454..93a0ac691100644drivers/net/ice/ice_rxtx.c +0
-33@@ -25,40 +25,6 @@ uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask; -static inline uint64_t -ice_rxdid_to_proto_xtr_ol_flag(uint8_t rxdid, bool *chk_valid) -{ -static struct { -uint64_t *ol_flag; -bool chk_valid; -} ol_flag_map[] = { -[ICE_RXDID_COMMS_AUX_VLAN ] = { -&rte_net_ice_dynflag_proto_xtr_vlan_mask, true }, -[ICE_RXDID_COMMS_AUX_IPV4 ] = { -&rte_net_ice_dynflag_proto_xtr_ipv4_mask, true }, -[ICE_RXDID_COMMS_AUX_IPV6 ] = { -&rte_net_ice_dynflag_proto_xtr_ipv6_mask, true }, -[ICE_RXDID_COMMS_AUX_IPV6_FLOW ] = { -&rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask, true }, -[ICE_RXDID_COMMS_AUX_TCP ] = { -&rte_net_ice_dynflag_proto_xtr_tcp_mask, true }, -[ICE_RXDID_COMMS_AUX_IP_OFFSET ] = { -&rte_net_ice_dynflag_proto_xtr_ip_offset_mask, false }, -}; -uint64_t *ol_flag; - -if (rxdid <RTE_DIM (ol_flag_map)) { -ol_flag = ol_flag_map[rxdid].ol_flag; -if (!ol_flag) -return 0ULL ; - -*chk_valid = ol_flag_map[rxdid].chk_valid; -return *ol_flag; -} - -return 0ULL ; -} -static inline uint8_t ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) { @@ -76,6 +42,159 @@
ice_proto_xtr_type_to_rxdid(uint8_t xtr_type)
rxdid_map[xtr_type] :ICE_RXDID_COMMS_OVS; }
Quoted 14 lines
drivers/net/ice/ice_rxtx.c ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) · line 54
Quoted 11 lines
drivers/net/ice/ice_rxtx.c +2
-0+static inline void +ice_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct ice_rx_queue*rxq,
drivers/net/ice/ice_rxtx.c +4
-0+ struct rte_mbuf *mb, + volatile union ice_rx_flex_desc *rxdp) { +volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = +(volatile struct ice_32b_rx_flex_desc_comms_ovs*)rxdp; #ifndef
drivers/net/ice/ice_rxtx.c +3
-0+RTE_LIBRTE_ICE_16BYTE_RX_DESC +uint16_t stat_err; +#endif This #ifndef could be better combine with below #ifndef.
I changed it to according to the different offsets, like ovs has rss hash in Qword 3, which is after flow Id Qword 1, others are opposite. So that this handling order can reflect the offset difference, although, it MAY looks not so beautiful. What do you think ? :)
Quoted 326 lines
Quoted 92 lines
drivers/net/ice/ice_rxtx.c +9
-0+ +if (desc->flow_id !=0xFFFFFFFF ) { +mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; +mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); +} + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +16
-0+mb->ol_flags |=PKT_RX_RSS_HASH ; +mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); +} +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v1 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) { +volatile struct ice_32b_rx_flex_desc_comms *desc = +(volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + +stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +16
-0+mb->ol_flags |=PKT_RX_RSS_HASH ; +mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); +} + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { +mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; +mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); +} + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +stat_err =rte_le_to_cpu_16 (desc->status_error1); + +if (stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S))
+metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +2
-0+ +if (stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S))drivers/net/ice/ice_rxtx.c +2
-0+metadata |= +rte_le_to_cpu_16 (desc->flex_ts.flex.aux1)<< 16;
drivers/net/ice/ice_rxtx.c +5
-0+ +if (metadata) { +mb->ol_flags |= rxq->xtr_ol_flag; + +*RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb)= metadata;
drivers/net/ice/ice_rxtx.c +15
-0+} +} +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v2 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) { +volatile struct ice_32b_rx_flex_desc_comms *desc = +(volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + +stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +15
-0+mb->ol_flags |=PKT_RX_RSS_HASH ; +mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); +} + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { +mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; +mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); +} + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +if (desc->flex_ts.flex.aux0 !=0xFFFF ) +metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +2
-0+else if (desc->flex_ts.flex.aux1 !=0xFFFF ) +metadata = rte_le_to_cpu_16(desc-Quoted 1 line
Quoted 1 line
flex_ts.flex.aux1);
So you mean the
ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_SandICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_Scould not use to identify the IPv4 hdr offset and IPv6 hdr offset here in rxdid # 25? And if yes they can and they will not set at the same time, is that separate this v2 from v1 necessary?Quoted 214 lines
drivers/net/ice/ice_rxtx.c +5
-0+ +if (metadata) { +mb->ol_flags |= rxq->xtr_ol_flag; + +*RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb)= metadata;
drivers/net/ice/ice_rxtx.c +11
-0+} +} +#endif +} + +static void +ice_select_rxd_to_pkt_fields_handler (struct ice_rx_queue *rxq,uint32_t +rxdid) { +switch (rxdid) { +case ICE_RXDID_COMMS_AUX_VLAN : +rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_vlan_mask;
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV4 : +rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv4_mask;
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV6 : +rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv6_mask;
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV6_FLOW : +rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +5
-0+break ; + +case ICE_RXDID_COMMS_AUX_TCP : +rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_tcp_mask; +rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IP_OFFSET : +rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ip_offset_mask;
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_aux_v2;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_OVS : +rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_ovs;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +default : +/* update this according to the RXDID for PROTO_XTR_NONE */
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_ovs;drivers/net/ice/ice_rxtx.c +7
-0+break ; +} + +if (!rte_net_ice_dynf_proto_xtr_metadata_avail ()) +rxq->xtr_ol_flag =0 ; +} +static enum ice_status ice_program_hw_rx_queue(struct ice_rx_queue *rxq) { @@ -158,6 +277,8@@
ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
return-EINVAL;
}drivers/net/ice/ice_rxtx.c +2
-25+ice_select_rxd_to_pkt_fields_handler (rxq, rxdid); +/* Enable Flexible Descriptors in the queue context which * allows this driver to select a specific receive descriptor format */ @@ -1338,74 +1459,6 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ice_rx_flex_desc *rxdp) mb->vlan_tci, mb->vlan_tci_outer); } -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -#define ICE_RX_PROTO_XTR_VALID \ -((1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S) | \ - (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) - -static void -ice_rxd_to_proto_xtr (struct rte_mbuf *mb, -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc) -{ -uint16_t stat_err =rte_le_to_cpu_16 (desc->status_error1); -uint32_t metadata =0 ; -uint64_t ol_flag; -bool chk_valid; - -ol_flag =ice_rxdid_to_proto_xtr_ol_flag (desc->rxdid, &chk_valid); -if (unlikely (!ol_flag)) -return ; - -if (chk_valid) { -if (stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S)) -metadata =rte_le_to_cpu_16 (desc- >flex_ts.flex.aux0); - -if (stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) -metadata |= -rte_le_to_cpu_16 (desc->flex_ts.flex.aux1)<< 16;
drivers/net/ice/ice_rxtx.c +0
-3-}else { -if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux0) !=0xFFFF ) -metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +0
-2-else if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) !=0xFFFF ) -metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux1);
drivers/net/ice/ice_rxtx.c +0
-17-} - -if (!metadata) -return ; - -mb->ol_flags |= ol_flag; - -*RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; -} -#endif - -static inline void -ice_rxd_to_pkt_fields (struct rte_mbuf *mb, -volatile union ice_rx_flex_desc *rxdp) -{ -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = -(volatile struct ice_32b_rx_flex_desc_comms_ovs*)rxdp;
drivers/net/ice/ice_rxtx.c +0
-5-#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -uint16_t stat_err; - -stat_err =rte_le_to_cpu_16 (desc->status_error0); -if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +0
-16-mb->ol_flags |=PKT_RX_RSS_HASH ; -mb->hash.rss = rte_le_to_cpu_32(desc->rss_hash); -} -#endif - -if (desc->flow_id !=0xFFFFFFFF ) { -mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; -mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); -} - -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -if (unlikely (rte_net_ice_dynf_proto_xtr_metadata_avail ())) -ice_rxd_to_proto_xtr (mb, desc); -#endif -} -#define ICE_LOOK_AHEAD 8#if (ICE_LOOK_AHEAD !=8 )#error "PMD ICE: ICE_LOOK_AHEAD must be 8\n"@@ -1463,7 +1516,7 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) mb->packet_type =ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
rte_le_to_cpu_16(rxdp[j].wb.ptype_flex_flags0)];
ice_rxd_to_vlan_tci(mb, &rxdp[j]);drivers/net/ice/ice_rxtx.c +1
-1-ice_rxd_to_pkt_fields (mb, &rxdp[j]); +rxq->rxd_to_pkt_fields (rxq, mb, &rxdp[j]); mb->ol_flags |= pkt_flags; }@@ -1760,7 +1813,7 @@ ice_recv_scattered_pkts(void *rx_queue, first_seg->packet_type =ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
ice_rxd_to_vlan_tci(first_seg, &rxd);drivers/net/ice/ice_rxtx.c +1
-1-ice_rxd_to_pkt_fields (first_seg, &rxd); +rxq->rxd_to_pkt_fields (rxq, first_seg, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); first_seg->ol_flags |= pkt_flags;/* Prefetch data of first segment, if configured to do so. */ @@ -2160,7 +2213,7 @@ ice_recv_pkts(void *rx_queue, rxm->packet_type =ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
ice_rxd_to_vlan_tci(rxm, &rxd);drivers/net/ice/ice_rxtx.c +1
-1-ice_rxd_to_pkt_fields (rxm, &rxd); +rxq->rxd_to_pkt_fields (rxq, rxm, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); rxm->ol_flags |= pkt_flags;/* copy old mbuf to rx_pkts */ drivers/net/ice/ice_rxtx.h index renamed from drivers/net/ice/ice_rxtx.h +0
-0
9fa57b3b2..de2291788100644drivers/net/ice/ice_rxtx.h +3
-0@@ -42,6 +42,9 @@typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq); +typedef void (*ice_rxd_to_pkt_fields_t )(struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp);struct ice_rx_entry {struct
rte_mbuf*mbuf;drivers/net/ice/ice_rxtx.h struct ice_rx_queue { · line 89
Quoted 5 lines
drivers/net/ice/ice_rxtx.h +2
-0@@ -82,6 +85,8 @@ struct ice_rx_queue {bool q_set;/* indicate if rx queue has been configured */ bool rx_deferred_start;/* don't start this queue in dev start */ uint8_t proto_xtr;/* Protocol extraction from flexible descriptor */ +uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;If create a function pointer here in .h, it is better add some doc.
Quoted 5 lines
drivers/net/ice/ice_rxtx.h +0
-1ice_rx_release_mbufs_t rx_rel_mbufs; }; --2.28.0
Re: [dpdk-dev] [PATCH v3] net/ice: refactor the Rx FlexiMD handling
Quoted 118 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 1:42 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingHi Jeff,
Quoted 10 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 13:35
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 26 lines
Hi, haiyue
Quoted 24 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Friday, September 18, 2020 9:06 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingThe hardware supports many kinds of FlexiMDs set into Rx descriptor, and the FlexiMDs can have different offsets in the descriptor according the DDP package setting.
The FlexiMDs type and offset are identified by the RXDID, which will be used to setup the queue.
For expanding to support different RXDIDs in the future, refactor the Rx FlexiMD handling by the functions mapped to related RXDIDs.
Signed-off-by Haiyue Wang <[email protected]>---
v3: remove the typedef's___rte_unused, and rewrite the commit titleand
Quoted 52 lines
Quoted 52 lines
message.
v2: assign the handle forICE_RXDID_COMMS_OVSdirectly, not use
fall-through.--- drivers/net/ice/ice_rxtx.c | 263 ++++++++++++++++++++++--------------- drivers/net/ice/ice_rxtx.h | 5 + 2 files changed, 163 insertions(+), 105 deletions(-)drivers/net/ice/ice_rxtx.c +0
-0index
fef6ad454..93a0ac691100644drivers/net/ice/ice_rxtx.c +0
-14@@ -25,40 +25,6 @@ uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask; -static inline uint64_t -ice_rxdid_to_proto_xtr_ol_flag(uint8_t rxdid, bool *chk_valid) -{ -static struct { -uint64_t *ol_flag; -bool chk_valid; -} ol_flag_map[] = { -[ICE_RXDID_COMMS_AUX_VLAN] = { -&rte_net_ice_dynflag_proto_xtr_vlan_mask, true }, -[ICE_RXDID_COMMS_AUX_IPV4] = { -&rte_net_ice_dynflag_proto_xtr_ipv4_mask, true }, -[ICE_RXDID_COMMS_AUX_IPV6] = { -&rte_net_ice_dynflag_proto_xtr_ipv6_mask, true }, -[ICE_RXDID_COMMS_AUX_IPV6_FLOW] = { -&rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask, true }, -[ICE_RXDID_COMMS_AUX_TCP] = { -&rte_net_ice_dynflag_proto_xtr_tcp_mask, true }, -[ICE_RXDID_COMMS_AUX_IP_OFFSET] = { -&rte_net_ice_dynflag_proto_xtr_ip_offset_mask,false },
drivers/net/ice/ice_rxtx.c +0
-4-}; -uint64_t *ol_flag; - -if (rxdid < RTE_DIM(ol_flag_map)) { -ol_flag =ol_flag_map[rxdid].ol_flag; -if (!ol_flag) -return 0ULL;
drivers/net/ice/ice_rxtx.c +0
-6- -*chk_valid = ol_flag_map[rxdid].chk_valid; -return *ol_flag; -} - -return 0ULL ; -} -static inline uint8_t ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) { @@ -76,6 +42,159@@
ice_proto_xtr_type_to_rxdid(uint8_t xtr_type)
rxdid_map[xtr_type] :ICE_RXDID_COMMS_OVS; }Quoted 2 lines
drivers/net/ice/ice_rxtx.c
Quoted 2 lines
drivers/net/ice/ice_rxtx.c +2
-0+static inline void +ice_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct
ice_rx_queueQuoted 12 lines
drivers/net/ice/ice_rxtx.c ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) · line 54
Quoted 9 lines
*rxq,
drivers/net/ice/ice_rxtx.c +4
-0+ struct rte_mbuf *mb, + volatile union ice_rx_flex_desc *rxdp) { volatile struct +ice_32b_rx_flex_desc_comms_ovs *desc = (volatile struct +ice_32b_rx_flex_desc_comms_ovs*)rxdp; #ifndef
drivers/net/ice/ice_rxtx.c +3
-0+RTE_LIBRTE_ICE_16BYTE_RX_DESC +uint16_t stat_err; +#endif This #ifndef could be better combine with below #ifndef.
Quoted 5 lines
I changed it to according to the different offsets, like ovs has rss hash in Qword 3, which is after flow Id Qword 1, others are opposite. So that this handling order can reflect the offset difference, although, it MAY looks not so beautiful. What do you think ? :)
I am not sure I got you point about the order reason, but I think in or out #ifndef should be clear show the offset difference, I am insist about that but if other also agree. And I still have 2 comments assume you are default agree and could I expect a new version or not?
Quoted 322 lines
Quoted 87 lines
Quoted 87 lines
drivers/net/ice/ice_rxtx.c +9
-0+ +if (desc->flow_id !=0xFFFFFFFF ) { +mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; hash.fdir.hi = +mb->rte_le_to_cpu_32 (desc->flow_id); +} + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC stat_err = +rte_le_to_cpu_16 (desc->status_error0); +if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +15
-0+mb->ol_flags |=PKT_RX_RSS_HASH ; +mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); +} +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v1 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) {volatile struct +ice_32b_rx_flex_desc_comms *desc = (volatile struct +ice_32b_rx_flex_desc_comms *)rxdp;uint16_t stat_err; + +stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +16
-0+mb->ol_flags |=PKT_RX_RSS_HASH ; +mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); +} + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC if (desc->flow_id != +0xFFFFFFFF ) { +mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; hash.fdir.hi = +mb->rte_le_to_cpu_32 (desc->flow_id); +} + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +stat_err =rte_le_to_cpu_16 (desc->status_error1); + +if (stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S))
+metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +2
-0+ +if (stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S))drivers/net/ice/ice_rxtx.c +2
-0+metadata |= +rte_le_to_cpu_16 (desc->flex_ts.flex.aux1)<< 16;
drivers/net/ice/ice_rxtx.c +5
-0+ +if (metadata) { +mb->ol_flags |= rxq->xtr_ol_flag; + +*RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb)= metadata;
drivers/net/ice/ice_rxtx.c +14
-0+} +} +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v2 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) {volatile struct +ice_32b_rx_flex_desc_comms *desc = (volatile struct +ice_32b_rx_flex_desc_comms *)rxdp;uint16_t stat_err; + +stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +15
-0+mb->ol_flags |=PKT_RX_RSS_HASH ; +mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); +} + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC if (desc->flow_id != +0xFFFFFFFF ) { +mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; hash.fdir.hi = +mb->rte_le_to_cpu_32 (desc->flow_id); +} + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +if (desc->flex_ts.flex.aux0 !=0xFFFF ) metadata = +rte_le_to_cpu_16(desc-Quoted 8 lines
Quoted 4 lines
Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +2
-0+else if (desc->flex_ts.flex.aux1 !=0xFFFF ) metadata = +rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux1);
So you mean the
ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_SandICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S
could not use to identify the IPv4 hdr offset and IPv6 hdr offset here inrxdid # 25?
Quoted 1 line
And if yes they can and they will not set at the same time, is that separate
this v2 from v1 necessary?
Quoted 70 lines
Quoted 70 lines
drivers/net/ice/ice_rxtx.c +5
-0+ +if (metadata) { +mb->ol_flags |= rxq->xtr_ol_flag; + +*RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb)= metadata;
drivers/net/ice/ice_rxtx.c +12
-0+} +} +#endif +} + +static void +ice_select_rxd_to_pkt_fields_handler (struct ice_rx_queue *rxq, +uint32_t +rxdid) { +switch (rxdid) { +case ICE_RXDID_COMMS_AUX_VLAN : +rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_vlan_mask;
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV4 : +rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv4_mask;
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV6 : +rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv6_mask;
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV6_FLOW : +rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +5
-0+break ; + +case ICE_RXDID_COMMS_AUX_TCP : +rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_tcp_mask; +rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IP_OFFSET : +rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ip_offset_mask;
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_aux_v2;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_OVS : +rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_ovs;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +default : +/* update this according to the RXDID for PROTO_XTR_NONE */
+rxq->rxd_to_pkt_fields =ice_rxd_to_pkt_fields_by_comms_ovs;drivers/net/ice/ice_rxtx.c +2
-0+break ; +}Quoted 8 lines
drivers/net/ice/ice_rxtx.c ice_proto_xtr_type_to_rxdid(uint8_t xtr_type)
Quoted 8 lines
drivers/net/ice/ice_rxtx.c +6
-0+ +if (!rte_net_ice_dynf_proto_xtr_metadata_avail ()) +rxq->xtr_ol_flag =0 ; +} +static enum ice_status ice_program_hw_rx_queue(struct ice_rx_queue *rxq) { @@ -158,6 +277,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)return
Quoted 46 lines
Quoted 46 lines
drivers/net/ice/ice_rxtx.c +2
-22-EINVAL ; } +ice_select_rxd_to_pkt_fields_handler (rxq, rxdid); +/* Enable Flexible Descriptors in the queue context which * allows this driver to select a specific receive descriptor format */ @@ -1338,74 +1459,6 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ice_rx_flex_desc *rxdp) mb->vlan_tci, mb->vlan_tci_outer); } -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -#defineICE_RX_PROTO_XTR_VALID \ -((1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S) | \ - (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) - -static void -ice_rxd_to_proto_xtr (struct rte_mbuf *mb, -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc) -{ -uint16_t stat_err =rte_le_to_cpu_16 (desc->status_error1); -uint32_t metadata =0 ; -uint64_t ol_flag; -bool chk_valid; - -ol_flag =ice_rxdid_to_proto_xtr_ol_flag (desc->rxdid, &chk_valid); -if (unlikely (!ol_flag)) -return; - -if (chk_valid) { -if (stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S)) -metadata =rte_le_to_cpu_16 (desc- >flex_ts.flex.aux0); - -if (stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S))drivers/net/ice/ice_rxtx.c +0
-2-metadata |= -rte_le_to_cpu_16 (desc->flex_ts.flex.aux1)<< 16;
drivers/net/ice/ice_rxtx.c +0
-2-}else { -if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux0) !=0xFFFF ) -metadata= rte_le_to_cpu_16(desc-
Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +0
-2-else if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) !=0xFFFF ) -metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux1);
Quoted 8 lines
drivers/net/ice/ice_rxtx.c ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ice_rx_flex_desc *rxdp)
Quoted 8 lines
drivers/net/ice/ice_rxtx.c +0
-8-} - -if (!metadata) -return ; - -mb->ol_flags |= ol_flag; - -*RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(mb) = metadata; -} -#endif
Quoted 89 lines
Quoted 75 lines
drivers/net/ice/ice_rxtx.c +0
-6- -static inline void -ice_rxd_to_pkt_fields (struct rte_mbuf *mb, -volatile union ice_rx_flex_desc *rxdp) -{ -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = -(volatilestruct
ice_32b_rx_flex_desc_comms_ovs*)rxdp; -#ifndefRTE_LIBRTE_ICE_16BYTE_RX_DESC-uint16_tstat_err;drivers/net/ice/ice_rxtx.c +0
-3- -stat_err =rte_le_to_cpu_16 (desc->status_error0); -if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +0
-11-mb->ol_flags |=PKT_RX_RSS_HASH ; -mb->hash.rss = rte_le_to_cpu_32(desc->rss_hash); -} -#endif - -if (desc->flow_id !=0xFFFFFFFF ) { -mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; hash.fdir.hi = -mb->rte_le_to_cpu_32 (desc->flow_id); -} - -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -if(unlikely(rte_net_ice_dynf_proto_xtr_metadata_avail()))
drivers/net/ice/ice_rxtx.c +0
-4-ice_rxd_to_proto_xtr (mb, desc); -#endif -} -#define ICE_LOOK_AHEAD 8#if (ICE_LOOK_AHEAD !=8 )#error "PMD ICE: ICE_LOOK_AHEAD must be 8\n"@@ -1463,7 +1516,7 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq)
mb->packet_type= ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
rte_le_to_cpu_16(rxdp[j].wb.ptype_flex_flags0)];
ice_rxd_to_vlan_tci(mb, &rxdp[j]);drivers/net/ice/ice_rxtx.c +1
-1-ice_rxd_to_pkt_fields (mb, &rxdp[j]); +rxq->rxd_to_pkt_fields (rxq, mb, &rxdp[j]); mb->ol_flags |= pkt_flags; }@@ -1760,7 +1813,7 @@ ice_recv_scattered_pkts(void *rx_queue,
first_seg->packet_type= ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
ice_rxd_to_vlan_tci(first_seg, &rxd);drivers/net/ice/ice_rxtx.c +1
-2-ice_rxd_to_pkt_fields (first_seg, &rxd); +rxq->rxd_to_pkt_fields (rxq, first_seg, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); first_seg->ol_flags |= pkt_flags; /* Prefetch data of first segment, if configured to do so. */ @@ -2160,7 +2213,7 @@ ice_recv_pkts(void *rx_queue, rxm->packet_type =ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
ice_rxd_to_vlan_tci(rxm, &rxd);drivers/net/ice/ice_rxtx.c +1
-1-ice_rxd_to_pkt_fields (rxm, &rxd); +rxq->rxd_to_pkt_fields (rxq, rxm, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); rxm->ol_flags |= pkt_flags;/* copy old mbuf to rx_pkts */ drivers/net/ice/ice_rxtx.h +0
-0index
9fa57b3b2..de2291788100644drivers/net/ice/ice_rxtx.h +2
-0@@ -42,6 +42,9 @@typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq); +typedef void (*ice_rxd_to_pkt_fields_t )(struct ice_rx_queue *rxq, +struct rte_mbuf *mb,volatile union ice_rx_flex_desc *rxdp);struct ice_rx_entry {struct rte_mbuf *mbuf;drivers/net/ice/ice_rxtx.h struct ice_rx_queue { · line 89
Quoted 5 lines
drivers/net/ice/ice_rxtx.h +2
-0@@ -82,6 +85,8 @@ struct ice_rx_queue {bool q_set;/* indicate if rx queue has been configured */ bool rx_deferred_start;/* don't start this queue in dev start */ uint8_t proto_xtr;/* Protocol extraction from flexible descriptor */ +uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;If create a function pointer here in .h, it is better add some doc.
Quoted 5 lines
drivers/net/ice/ice_rxtx.h +0
-1ice_rx_release_mbufs_t rx_rel_mbufs; }; --2.28.0
Re: [dpdk-dev] [PATCH v3] net/ice: refactor the Rx FlexiMD handling
Quoted 47 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 13:51
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 37 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 1:42 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingHi Jeff,
Quoted 24 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 13:35
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingHi, haiyue
drivers/net/ice/ice_rxtx.c ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) · line 54
Quoted 8 lines
(quoted diff) +4
-0+ struct rte_mbuf *mb, + volatile union ice_rx_flex_desc *rxdp) { volatile struct +ice_32b_rx_flex_desc_comms_ovs *desc = (volatile struct +ice_32b_rx_flex_desc_comms_ovs*)rxdp; #ifndef
drivers/net/ice/ice_rxtx.c +3
-0+RTE_LIBRTE_ICE_16BYTE_RX_DESC +uint16_t stat_err; +#endif This #ifndef could be better combine with below #ifndef.
Quoted 8 lines
Quoted 5 lines
I changed it to according to the different offsets, like ovs has rss hash in Qword 3, which is after flow Id Qword 1, others are opposite. So that this handling order can reflect the offset difference, although, it MAY looks not so beautiful. What do you think ? :)
I am not sure I got you point about the order reason, but I think in or out #ifndef should be clear show the offset difference,
You mean below ? If so, 'uint16_t stat_err;' is not so good in the middle of two code blocks.
#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC
uint16_t stat_err;
stat_err = rte_le_to_cpu_16(desc->status_error0);
if (likely(stat_err & (1 << ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {
mb->ol_flags |= PKT_RX_RSS_HASH;
mb->hash.rss = rte_le_to_cpu_32(desc->rss_hash);
}#endif
I am insist about that but if other also agree. And I still have 2
Quoted 2 lines
comments assume you are default agree and could I expect a new version or not?
Oh, I missed you other two comments. Your reply is embedded into my original many code lines. You can remove the unnecessary codes, so that people can get your comments quickly without moving mouse down to check line by line. ;-)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/net/ice/ice_rxtx.c +5
-0+if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +if (desc->flex_ts.flex.aux0 !=0xFFFF ) metadata = +rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
(quoted diff) +2
-0+else if (desc->flex_ts.flex.aux1 != 0xFFFF) metadata = +rte_le_to_cpu_16(desc-
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
flex_ts.flex.aux1);
So you mean the
ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_SandICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S
could not use to identify the IPv4 hdr offset and IPv6 hdr offset here inrxdid # 25?
Quoted 1 line
And if yes they can and they will not set at the same time, is that separate
this v2 from v1 necessary?
XTRMD4/5_VALID_S can't detect the value of IP offset available, non 0xffffffff is the right check condition.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/net/ice/ice_rxtx.h struct ice_rx_queue { · line 89
Quoted 2 lines
drivers/net/ice/ice_rxtx.h +2
-0+uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;If create a function pointer here in .h, it is better add some doc.
C comments: /* .... */ ?
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
ice_rx_release_mbufs_trx_rel_mbufs;
};--
2.28.0
Re: [dpdk-dev] [PATCH v3] net/ice: refactor the Rx FlexiMD handling
Quoted 75 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 2:09 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 55 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 13:51
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 37 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 1:42 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingHi Jeff,
Quoted 13 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 13:35
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingHi, haiyue
Quoted 11 lines
drivers/net/ice/ice_rxtx.c ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) · line 54
Quoted 8 lines
(quoted diff) +4
-0+ struct rte_mbuf *mb, + volatile union ice_rx_flex_desc *rxdp) { volatile struct +ice_32b_rx_flex_desc_comms_ovs *desc = (volatile struct +ice_32b_rx_flex_desc_comms_ovs*)rxdp; #ifndef
drivers/net/ice/ice_rxtx.c +3
-0+RTE_LIBRTE_ICE_16BYTE_RX_DESC +uint16_t stat_err; +#endif This #ifndef could be better combine with below #ifndef.
Quoted 6 lines
I changed it to according to the different offsets, like ovs has rss hash in Qword 3, which is after flow Id Qword 1, others are opposite. So that this handling order can reflect the offset difference, although, it MAY looks not so beautiful. What do you think ? :)
Quoted 2 lines
I am not sure I got you point about the order reason, but I think in or out #ifndef should be clear show the offset difference,
You mean below ? If so, '
uint16_tstat_err;' is not so good in the middle of two code blocks.#ifndef
RTE_LIBRTE_ICE_16BYTE_RX_DESCuint16_tstat_err;
Quoted 7 lines
stat_err=rte_le_to_cpu_16(desc->status_error0);
if (likely(stat_err & (1 << ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {mb->ol_flags|=PKT_RX_RSS_HASH;mb->hash.rss=rte_le_to_cpu_32(desc->rss_hash);
}
#endif
Sorry, let me show clear as below
#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC
uint16_t stat_err;
stat_err = rte_le_to_cpu_16(desc->status_error0);
if (likely(stat_err & (1 << ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {
mb->ol_flags |= PKT_RX_RSS_HASH;
mb->hash.rss = rte_le_to_cpu_32(desc->rss_hash);
}
#endif
if (desc->flow_id != 0xFFFFFFFF) {
mb->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
mb->hash.fdir.hi = rte_le_to_cpu_32(desc->flow_id);
}Quoted 12 lines
I am insist about that but if other also agree. And I still have 2
Quoted 1 line
comments assume you are default agree and could I expect a new version
or not?
Quoted 1 line
Oh, I missed you other two comments. Your reply is embedded into my original many code lines. You can remove the unnecessary codes, so that people can get your comments quickly without moving mouse down to check line by line. ;-)
That is a good idea.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines
drivers/net/ice/ice_rxtx.c +5
-0+if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +if (desc->flex_ts.flex.aux0 !=0xFFFF ) metadata = +rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
(quoted diff) +2
-0+else if (desc->flex_ts.flex.aux1 != 0xFFFF) metadata = +rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux1);
So you mean the
ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_SandICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S
could not use to identify the IPv4 hdr offset and IPv6 hdr offset here in
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
rxdid # 25?
Quoted 2 lines
And if yes they can and they will not set at the same time, is that separate
this v2 from v1 necessary?
XTRMD4/5_VALID_S can't detect the value of IP offset available, non
0xffffffffis the right check condition.
Ok, just clarify me now.
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/net/ice/ice_rxtx.h struct ice_rx_queue { · line 89
Quoted 2 lines
drivers/net/ice/ice_rxtx.h +2
-0+uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;If create a function pointer here in .h, it is better add some doc.
C comments: /* .... */ ?
Yes.
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
ice_rx_release_mbufs_trx_rel_mbufs; };--
2.28.0
Re: [dpdk-dev] [PATCH v3] net/ice: refactor the Rx FlexiMD handling
Quoted 104 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 14:15
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 74 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 2:09 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 55 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 13:51
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 37 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 1:42 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingHi Jeff,
Quoted 13 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 13:35
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingHi, haiyue
Quoted 11 lines
drivers/net/ice/ice_rxtx.c ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) · line 54
Quoted 8 lines
(quoted diff) +4
-0+ struct rte_mbuf *mb, + volatile union ice_rx_flex_desc *rxdp) { volatile struct +ice_32b_rx_flex_desc_comms_ovs *desc = (volatile struct +ice_32b_rx_flex_desc_comms_ovs*)rxdp; #ifndef
drivers/net/ice/ice_rxtx.c +3
-0+RTE_LIBRTE_ICE_16BYTE_RX_DESC +uint16_t stat_err; +#endif This #ifndef could be better combine with below #ifndef.
Quoted 6 lines
I changed it to according to the different offsets, like ovs has rss hash in Qword 3, which is after flow Id Qword 1, others are opposite. So that this handling order can reflect the offset difference, although, it MAY looks not so beautiful. What do you think ? :)
Quoted 2 lines
I am not sure I got you point about the order reason, but I think in or out #ifndef should be clear show the offset difference,
You mean below ? If so, '
uint16_tstat_err;' is not so good in the middle of two code blocks.#ifndef
RTE_LIBRTE_ICE_16BYTE_RX_DESCuint16_tstat_err;Quoted 7 lines
stat_err=rte_le_to_cpu_16(desc->status_error0);
if (likely(stat_err & (1 << ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {mb->ol_flags|=PKT_RX_RSS_HASH;mb->hash.rss=rte_le_to_cpu_32(desc->rss_hash);
}
#endifSorry, let me show clear as below
#ifndef
RTE_LIBRTE_ICE_16BYTE_RX_DESCuint16_tstat_err;
stat_err=rte_le_to_cpu_16(desc->status_error0);
if (likely(stat_err & (1 << ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {mb->ol_flags|=PKT_RX_RSS_HASH;mb->hash.rss=rte_le_to_cpu_32(desc->rss_hash);
}
#endif
Quoted 5 lines
if (
desc->flow_id!=0xFFFFFFFF) {mb->ol_flags|=PKT_RX_FDIR|PKT_RX_FDIR_ID;mb->hash.fdir.hi=rte_le_to_cpu_32(desc->flow_id); }
That's what I said about the order, you can check "ice_rxd_to_pkt_fields_by_comms_ovs" vs "ice_rxd_to_pkt_fields_by_comms_aux_v1" about "desc->flow_id" and "desc->rss_hash" handling order: offset first, handle it firstly.
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/net/ice/ice_rxtx.h struct ice_rx_queue { · line 89
Quoted 2 lines
drivers/net/ice/ice_rxtx.h +2
-0+uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;If create a function pointer here in .h, it is better add some doc.
C comments: /* .... */ ?
Yes.
OK.
Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
ice_rx_release_mbufs_trx_rel_mbufs; };--
2.28.0
Re: [dpdk-dev] [PATCH v3] net/ice: refactor the Rx FlexiMD handling
Quoted 122 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 2:24 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 105 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 14:15
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 73 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 2:09 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 55 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 13:51
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingQuoted 37 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 1:42 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingHi Jeff,
Quoted 14 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 13:35
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v3] net/ice: refactor the Rx FlexiMD handlingHi, haiyue
Quoted 9 lines
Quoted 6 lines
(quoted diff) +4
-0+ struct rte_mbuf *mb, + volatile union ice_rx_flex_desc *rxdp) { volatile struct +ice_32b_rx_flex_desc_comms_ovs *desc = (volatile struct +ice_32b_rx_flex_desc_comms_ovs*)rxdp; #ifndef
+RTE_LIBRTE_ICE_16BYTE_RX_DESCuint16_tstat_err; #endifThis #ifndef could be better combine with below #ifndef.
Quoted 6 lines
I changed it to according to the different offsets, like ovs has rss hash in Qword 3, which is after flow Id Qword 1, others are opposite. So that this handling order can reflect the offset difference, although, it MAY looks not so beautiful. What do you think ? :)
Quoted 2 lines
I am not sure I got you point about the order reason, but I think in or out #ifndef should be clear show the offset difference,
You mean below ? If so, '
uint16_tstat_err;' is not so good in the middle of two code blocks.#ifndef
RTE_LIBRTE_ICE_16BYTE_RX_DESCuint16_tstat_err;Quoted 8 lines
stat_err=rte_le_to_cpu_16(desc->status_error0);
if (likely(stat_err & (1 << ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {mb->ol_flags|=PKT_RX_RSS_HASH;mb->hash.rss=rte_le_to_cpu_32(desc->rss_hash);
}
#endifSorry, let me show clear as below
#ifndef
RTE_LIBRTE_ICE_16BYTE_RX_DESCuint16_tstat_err;
stat_err=rte_le_to_cpu_16(desc->status_error0);
if (likely(stat_err & (1 << ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {mb->ol_flags|=PKT_RX_RSS_HASH;mb->hash.rss=rte_le_to_cpu_32(desc->rss_hash);
}
#endifQuoted 5 lines
if (
desc->flow_id!=0xFFFFFFFF) {mb->ol_flags|=PKT_RX_FDIR|PKT_RX_FDIR_ID; hash.fdir.hi =mb->rte_le_to_cpu_32(desc->flow_id);
}
Quoted 6 lines
That's what I said about the order, you can check "
ice_rxd_to_pkt_fields_by_comms_ovs"
vs "ice_rxd_to_pkt_fields_by_comms_aux_v1" about "desc->flow_id" and "desc->rss_hash"
handling order: offset first, handle it firstly.
I know your point and you could choose if need more doc to highlight this offset change or not. Anyway, I am not insist object for this order.
Quoted 24 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+uint64_t xtr_ol_flag; /* Protocol extraction offload flag +*/ ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;If create a function pointer here in .h, it is better add some doc.
C comments: /* .... */ ?
Yes.
OK.
Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
ice_rx_release_mbufs_trx_rel_mbufs; };--
2.28.0
PATCH v4 1/1 net/ice: refactor the Rx FlexiMD handling
In reply to Haiyue WangThe hardware supports many kinds of FlexiMDs set into Rx descriptor, and the FlexiMDs can have different offsets in the descriptor according the DDP package setting.
The FlexiMDs type and offset are identified by the RXDID, which will be used to setup the queue.
For expanding to support different RXDIDs in the future, refactor the Rx FlexiMD handling by the functions mapped to related RXDIDs.
---
v4: Add comment for the new FlexiMD handler type.
v3: remove the typedef's ___rte_unused, and rewrite the commit title and
message.
v2: assign the handle for ICE_RXDID_COMMS_OVS directly, not use
fall-through.
--- drivers/net/ice/ice_rxtx.c | 263 ++++++++++++++++++++++--------------- drivers/net/ice/ice_rxtx.h | 5 + 2 files changed, 163 insertions(+), 105 deletions(-)
drivers/net/ice/ice_rxtx.c +158 -105
@@ -25,40 +25,6 @@ uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask; -static inline uint64_t -ice_rxdid_to_proto_xtr_ol_flag (uint8_t rxdid,bool *chk_valid) -{ -static struct { -uint64_t *ol_flag; -bool chk_valid; - } ol_flag_map[] = { - [ICE_RXDID_COMMS_AUX_VLAN ] = { - &rte_net_ice_dynflag_proto_xtr_vlan_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV4 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv4_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6_FLOW ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask, true }, - [ICE_RXDID_COMMS_AUX_TCP ] = { - &rte_net_ice_dynflag_proto_xtr_tcp_mask, true }, - [ICE_RXDID_COMMS_AUX_IP_OFFSET ] = { - &rte_net_ice_dynflag_proto_xtr_ip_offset_mask, false }, - }; -uint64_t *ol_flag; - -if (rxdid <RTE_DIM (ol_flag_map)) { - ol_flag = ol_flag_map[rxdid].ol_flag; -if (!ol_flag) -return 0ULL ; - - *chk_valid = ol_flag_map[rxdid].chk_valid; -return *ol_flag; - } - -return 0ULL ; -} -static inline uint8_t ice_proto_xtr_type_to_rxdid (uint8_t xtr_type) {
@@ -76,6 +42,159 @@ ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) rxdid_map[xtr_type] : ICE_RXDID_COMMS_OVS; } +static inline void +ice_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = + (volatile struct ice_32b_rx_flex_desc_comms_ovs *)rxdp; +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +uint16_t stat_err; +#endif + +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v1 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + + stat_err =rte_le_to_cpu_16 (desc->status_error1); + +if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S )) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); + +if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S )) + metadata |= +rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) <<16 ; + +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; + } + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v2 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) +{ +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); +if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { + mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +if (desc->flex_ts.flex.aux0 !=0xFFFF ) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); +else if (desc->flex_ts.flex.aux1 !=0xFFFF ) + metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux1); + +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; + } + } +#endif +} + +static void +ice_select_rxd_to_pkt_fields_handler (struct ice_rx_queue *rxq,uint32_t rxdid) +{ +switch (rxdid) { +case ICE_RXDID_COMMS_AUX_VLAN : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_vlan_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV4 : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv4_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV6 : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IPV6_FLOW : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_TCP : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_tcp_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v1; +break ; + +case ICE_RXDID_COMMS_AUX_IP_OFFSET : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ip_offset_mask; + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v2; +break ; + +case ICE_RXDID_COMMS_OVS : + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs; +break ; + +default : +/* update this according to the RXDID for PROTO_XTR_NONE */ + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs; +break ; + } + +if (!rte_net_ice_dynf_proto_xtr_metadata_avail ()) + rxq->xtr_ol_flag =0 ; +} +static enum ice_status ice_program_hw_rx_queue (struct ice_rx_queue *rxq) {
@@ -158,6 +277,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)return -EINVAL ; } +ice_select_rxd_to_pkt_fields_handler (rxq, rxdid); +/* Enable Flexible Descriptors in the queue context which * allows this driver to select a specific receive descriptor format */
@@ -1338,74 +1459,6 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ice_rx_flex_desc *rxdp) mb->vlan_tci, mb->vlan_tci_outer); } -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -#define ICE_RX_PROTO_XTR_VALID \ - ((1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S) | \ - (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) - -static void -ice_rxd_to_proto_xtr (struct rte_mbuf *mb, -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc) -{ -uint16_t stat_err =rte_le_to_cpu_16 (desc->status_error1); -uint32_t metadata =0 ; -uint64_t ol_flag; -bool chk_valid; - - ol_flag =ice_rxdid_to_proto_xtr_ol_flag (desc->rxdid, &chk_valid); -if (unlikely (!ol_flag)) -return ; - -if (chk_valid) { -if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S )) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); - -if (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S )) - metadata |= -rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) <<16 ; - }else { -if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux0) !=0xFFFF ) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux0); -else if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) !=0xFFFF ) - metadata =rte_le_to_cpu_16 (desc->flex_ts.flex.aux1); - } - -if (!metadata) -return ; - - mb->ol_flags |= ol_flag; - - *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; -} -#endif - -static inline void -ice_rxd_to_pkt_fields (struct rte_mbuf *mb, -volatile union ice_rx_flex_desc *rxdp) -{ -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = - (volatile struct ice_32b_rx_flex_desc_comms_ovs *)rxdp; -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -uint16_t stat_err; - - stat_err =rte_le_to_cpu_16 (desc->status_error0); -if (likely (stat_err & (1 <<ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S ))) { - mb->ol_flags |=PKT_RX_RSS_HASH ; - mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); - } -#endif - -if (desc->flow_id !=0xFFFFFFFF ) { - mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; - mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); - } - -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -if (unlikely (rte_net_ice_dynf_proto_xtr_metadata_avail ())) -ice_rxd_to_proto_xtr (mb, desc); -#endif -} -#define ICE_LOOK_AHEAD 8#if (ICE_LOOK_AHEAD !=8 )#error "PMD ICE: ICE_LOOK_AHEAD must be 8\n"
@@ -1463,7 +1516,7 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) mb->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxdp[j].wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (mb, &rxdp[j]); -ice_rxd_to_pkt_fields (mb, &rxdp[j]); + rxq->rxd_to_pkt_fields (rxq, mb, &rxdp[j]); mb->ol_flags |= pkt_flags; }
@@ -1760,7 +1813,7 @@ ice_recv_scattered_pkts(void *rx_queue, first_seg->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (first_seg, &rxd); -ice_rxd_to_pkt_fields (first_seg, &rxd); + rxq->rxd_to_pkt_fields (rxq, first_seg, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); first_seg->ol_flags |= pkt_flags;/* Prefetch data of first segment, if configured to do so. */
@@ -2160,7 +2213,7 @@ ice_recv_pkts(void *rx_queue, rxm->packet_type = ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &rte_le_to_cpu_16 (rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (rxm, &rxd); -ice_rxd_to_pkt_fields (rxm, &rxd); + rxq->rxd_to_pkt_fields (rxq, rxm, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); rxm->ol_flags |= pkt_flags;/* copy old mbuf to rx_pkts */
drivers/net/ice/ice_rxtx.h +5 -0
@@ -42,6 +42,9 @@typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq); +typedef void (*ice_rxd_to_pkt_fields_t )(struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp);struct ice_rx_entry {struct rte_mbuf *mbuf;
@@ -82,6 +85,8 @@ struct ice_rx_queue {bool q_set;/* indicate if rx queue has been configured */ bool rx_deferred_start;/* don't start this queue in dev start */ uint8_t proto_xtr;/* Protocol extraction from flexible descriptor */ +uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;/* handle FlexiMD by RXDID */ ice_rx_release_mbufs_t rx_rel_mbufs; };
Signature · 1 line
2.28.0
Re: [dpdk-dev] [PATCH v4] net/ice: refactor the Rx FlexiMD handling
Quoted 413 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 2:40 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v4] net/ice: refactor the Rx FlexiMD handlingThe hardware supports many kinds of FlexiMDs set into Rx descriptor, and the FlexiMDs can have different offsets in the descriptor according the DDP package setting.
The FlexiMDs type and offset are identified by the RXDID, which will be used to setup the queue.
For expanding to support different RXDIDs in the future, refactor the Rx FlexiMD handling by the functions mapped to related RXDIDs.
Signed-off-by Haiyue Wang <[email protected]>---
v4: Add comment for the new FlexiMD handler type.
v3: remove the typedef's___rte_unused, and rewrite the commit title and
message.
v2: assign the handle forICE_RXDID_COMMS_OVSdirectly, not use
fall-through.--- drivers/net/ice/ice_rxtx.c | 263 ++++++++++++++++++++++--------------- drivers/net/ice/ice_rxtx.h | 5 + 2 files changed, 163 insertions(+), 105 deletions(-)drivers/net/ice/ice_rxtx.c index renamed from drivers/net/ice/ice_rxtx.c +0
-0
fef6ad454..93a0ac691100644drivers/net/ice/ice_rxtx.c +0
-33@@ -25,40 +25,6 @@ uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask; -static inline uint64_t -ice_rxdid_to_proto_xtr_ol_flag(uint8_t rxdid, bool *chk_valid) -{ -static struct { -uint64_t *ol_flag; -bool chk_valid; - } ol_flag_map[] = { - [ICE_RXDID_COMMS_AUX_VLAN ] = { - &rte_net_ice_dynflag_proto_xtr_vlan_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV4 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv4_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6 ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_mask, true }, - [ICE_RXDID_COMMS_AUX_IPV6_FLOW ] = { - &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask, true }, - [ICE_RXDID_COMMS_AUX_TCP ] = { - &rte_net_ice_dynflag_proto_xtr_tcp_mask, true }, - [ICE_RXDID_COMMS_AUX_IP_OFFSET ] = { - &rte_net_ice_dynflag_proto_xtr_ip_offset_mask, false }, - }; -uint64_t *ol_flag; - -if (rxdid <RTE_DIM (ol_flag_map)) { - ol_flag = ol_flag_map[rxdid].ol_flag; -if (!ol_flag) -return 0ULL ; - - *chk_valid = ol_flag_map[rxdid].chk_valid; -return *ol_flag; - } - -return 0ULL ; -} -static inline uint8_t ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) { @@ -76,6 +42,159 @@
ice_proto_xtr_type_to_rxdid(uint8_t xtr_type)
rxdid_map[xtr_type] :ICE_RXDID_COMMS_OVS; }drivers/net/ice/ice_rxtx.c +2
-0+static inline void +ice_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct ice_rx_queue*rxq,
drivers/net/ice/ice_rxtx.c +4
-0+ struct rte_mbuf *mb, + volatile union ice_rx_flex_desc *rxdp) { + volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = + (volatile struct ice_32b_rx_flex_desc_comms_ovs*)rxdp; #ifndef
drivers/net/ice/ice_rxtx.c +12
-0+RTE_LIBRTE_ICE_16BYTE_RX_DESC + uint16_t stat_err; +#endif + +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + stat_err =rte_le_to_cpu_16 (desc->status_error0); + if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +16
-0+ mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v1 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) { +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); + if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +16
-0+ mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + + stat_err =rte_le_to_cpu_16 (desc->status_error1); + + if (stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S))drivers/net/ice/ice_rxtx.c +1
-0+ metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +2
-0+ + if (stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S))drivers/net/ice/ice_rxtx.c +2
-0+ metadata |= +rte_le_to_cpu_16 (desc->flex_ts.flex.aux1)<< 16;
drivers/net/ice/ice_rxtx.c +5
-0+ +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb)= metadata;
drivers/net/ice/ice_rxtx.c +15
-0+ } + } +#endif +} + +static inline void +ice_rxd_to_pkt_fields_by_comms_aux_v2 (struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp) { +volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; +uint16_t stat_err; + + stat_err =rte_le_to_cpu_16 (desc->status_error0); + if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +15
-0+ mb->ol_flags |=PKT_RX_RSS_HASH ; + mb->hash.rss =rte_le_to_cpu_32 (desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC +if (desc->flow_id !=0xFFFFFFFF ) { + mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; + mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); + } + +if (rxq->xtr_ol_flag) { +uint32_t metadata =0 ; + +if (desc->flex_ts.flex.aux0 !=0xFFFF ) + metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +2
-0+else if (desc->flex_ts.flex.aux1 !=0xFFFF ) + metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux1);
drivers/net/ice/ice_rxtx.c +5
-0+ +if (metadata) { + mb->ol_flags |= rxq->xtr_ol_flag; + + *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb)= metadata;
drivers/net/ice/ice_rxtx.c +11
-0+ } + } +#endif +} + +static void +ice_select_rxd_to_pkt_fields_handler (struct ice_rx_queue *rxq,uint32_t +rxdid) { +switch (rxdid) { +case ICE_RXDID_COMMS_AUX_VLAN : + rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_vlan_mask;drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV4 : + rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv4_mask;drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV6 : + rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv6_mask;drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IPV6_FLOW : + rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +5
-0+break ; + +case ICE_RXDID_COMMS_AUX_TCP : + rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_tcp_mask; + rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v1;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_AUX_IP_OFFSET : + rxq->xtr_ol_flag =
rte_net_ice_dynflag_proto_xtr_ip_offset_mask;drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_aux_v2;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +case ICE_RXDID_COMMS_OVS : + rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_ovs;drivers/net/ice/ice_rxtx.c +4
-0+break ; + +default : +/* update this according to the RXDID for PROTO_XTR_NONE */
drivers/net/ice/ice_rxtx.c +1
-0+ rxq->rxd_to_pkt_fields =
ice_rxd_to_pkt_fields_by_comms_ovs;drivers/net/ice/ice_rxtx.c +7
-0+break ; + } + +if (!rte_net_ice_dynf_proto_xtr_metadata_avail ()) + rxq->xtr_ol_flag =0 ; +} +static enum ice_status ice_program_hw_rx_queue(struct ice_rx_queue *rxq) { @@ -158,6 +277,8@@
ice_program_hw_rx_queue(struct ice_rx_queue *rxq)drivers/net/ice/ice_rxtx.c +2
-25return -EINVAL ; } +ice_select_rxd_to_pkt_fields_handler (rxq, rxdid); +/* Enable Flexible Descriptors in the queue context which * allows this driver to select a specific receive descriptor format */ @@ -1338,74 +1459,6 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ice_rx_flex_desc *rxdp) mb->vlan_tci, mb->vlan_tci_outer); } -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -#define ICE_RX_PROTO_XTR_VALID \ - ((1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S) | \ - (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) - -static void -ice_rxd_to_proto_xtr (struct rte_mbuf *mb, -volatile struct ice_32b_rx_flex_desc_comms_ovs *desc) -{ -uint16_t stat_err =rte_le_to_cpu_16 (desc->status_error1); -uint32_t metadata =0 ; -uint64_t ol_flag; -bool chk_valid; - - ol_flag =ice_rxdid_to_proto_xtr_ol_flag (desc->rxdid, &chk_valid); -if (unlikely (!ol_flag)) -return ; - -if (chk_valid) { -if (stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S)) - metadata =rte_le_to_cpu_16 (desc- >flex_ts.flex.aux0); - -if (stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)) - metadata |= -rte_le_to_cpu_16 (desc->flex_ts.flex.aux1)<< 16;
drivers/net/ice/ice_rxtx.c +0
-3- }else { -if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux0) !=0xFFFF ) - metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux0);
drivers/net/ice/ice_rxtx.c +0
-2-else if (rte_le_to_cpu_16 (desc->flex_ts.flex.aux1) !=0xFFFF ) - metadata = rte_le_to_cpu_16(desc-Quoted 1 line
flex_ts.flex.aux1);
drivers/net/ice/ice_rxtx.c +0
-17- } - -if (!metadata) -return ; - - mb->ol_flags |= ol_flag; - - *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA (mb) = metadata; -} -#endif - -static inline void -ice_rxd_to_pkt_fields (struct rte_mbuf *mb, -volatile union ice_rx_flex_desc *rxdp) -{ - volatile struct ice_32b_rx_flex_desc_comms_ovs *desc = - (volatile struct ice_32b_rx_flex_desc_comms_ovs*)rxdp;
drivers/net/ice/ice_rxtx.c +0
-5-#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -uint16_t stat_err; - - stat_err =rte_le_to_cpu_16 (desc->status_error0); - if (likely(stat_err & (1 <<
ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {drivers/net/ice/ice_rxtx.c +0
-16- mb->ol_flags |=PKT_RX_RSS_HASH ; - mb->hash.rss = rte_le_to_cpu_32(desc->rss_hash); - } -#endif - -if (desc->flow_id !=0xFFFFFFFF ) { - mb->ol_flags |=PKT_RX_FDIR |PKT_RX_FDIR_ID ; - mb->hash.fdir.hi =rte_le_to_cpu_32 (desc->flow_id); - } - -#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC -if (unlikely (rte_net_ice_dynf_proto_xtr_metadata_avail ())) -ice_rxd_to_proto_xtr (mb, desc); -#endif -} -#define ICE_LOOK_AHEAD 8#if (ICE_LOOK_AHEAD !=8 )#error "PMD ICE: ICE_LOOK_AHEAD must be 8\n"@@ -1463,7 +1516,7 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) mb->packet_type =ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
rte_le_to_cpu_16(rxdp[j].wb.ptype_flex_flags0)];drivers/net/ice/ice_rxtx.c +1
-1ice_rxd_to_vlan_tci (mb, &rxdp[j]); -ice_rxd_to_pkt_fields (mb, &rxdp[j]); + rxq->rxd_to_pkt_fields (rxq, mb, &rxdp[j]); mb->ol_flags |= pkt_flags; }@@ -1760,7 +1813,7 @@ ice_recv_scattered_pkts(void *rx_queue, first_seg->packet_type =ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
drivers/net/ice/ice_rxtx.c +1
-1rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (first_seg, &rxd); -ice_rxd_to_pkt_fields (first_seg, &rxd); + rxq->rxd_to_pkt_fields (rxq, first_seg, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); first_seg->ol_flags |= pkt_flags;/* Prefetch data of first segment, if configured to do so. */ @@ -2160,7 +2213,7 @@ ice_recv_pkts(void *rx_queue, rxm->packet_type =ptype_tbl[ICE_RX_FLEX_DESC_PTYPE_M &
drivers/net/ice/ice_rxtx.c +1
-1rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];ice_rxd_to_vlan_tci (rxm, &rxd); -ice_rxd_to_pkt_fields (rxm, &rxd); + rxq->rxd_to_pkt_fields (rxq, rxm, &rxd); pkt_flags =ice_rxd_error_to_pkt_flags (rx_stat_err0); rxm->ol_flags |= pkt_flags;/* copy old mbuf to rx_pkts */ drivers/net/ice/ice_rxtx.h index renamed from drivers/net/ice/ice_rxtx.h +0
-0
9fa57b3b2..6937faec3100644drivers/net/ice/ice_rxtx.h +3
-0@@ -42,6 +42,9 @@typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq); +typedef void (*ice_rxd_to_pkt_fields_t )(struct ice_rx_queue *rxq, +struct rte_mbuf *mb, +volatile union ice_rx_flex_desc *rxdp);struct ice_rx_entry {drivers/net/ice/ice_rxtx.h +2
-0struct rte_mbuf *mbuf;@@ -82,6 +85,8 @@ struct ice_rx_queue {bool q_set;/* indicate if rx queue has been configured */ bool rx_deferred_start;/* don't start this queue in dev start */ uint8_t proto_xtr;/* Protocol extraction from flexible descriptor */ +uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ +ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;/* handle FlexiMD by RXDID
drivers/net/ice/ice_rxtx.h +1
-1+*/ ice_rx_release_mbufs_t rx_rel_mbufs; }; --2.28.0
Zhang, Qi Z
AppliedRe: [dpdk-dev] [PATCH v4] net/ice: refactor the Rx FlexiMD handling
Quoted 12 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Tuesday, September 22, 2020 3:24 PM
To: Wang, Haiyue <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v4] net/ice: refactor the Rx FlexiMD handling
Quoted 24 lines
Acked-by Jeff Guo <[email protected]>Quoted 22 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, September 22, 2020 2:40 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Jiang, JunyuX <[email protected]>; Rong, Leyi <[email protected]>; Yang, Qiming <[email protected]>; Sun, GuinanX <[email protected]>; Guo, Junfeng <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v4] net/ice: refactor the Rx FlexiMD handlingThe hardware supports many kinds of FlexiMDs set into Rx descriptor, and the FlexiMDs can have different offsets in the descriptor according the DDP package setting.
The FlexiMDs type and offset are identified by the RXDID, which will be used to setup the queue.
For expanding to support different RXDIDs in the future, refactor the Rx FlexiMD handling by the functions mapped to related RXDIDs.
Signed-off-by Haiyue Wang <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi