maximize vector rx burst for PMDs
cover maximize vector rx burst for PMDs
The limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf PMDs.
Jeff Guo (4):
net/ixgbe: maximize vector rx burst for ixgbe
net/i40e: maximize vector rx burst for i40e
net/ice: maximize vector rx burst for ice
net/iavf: maximize vector rx burst for iavf
drivers/net/i40e/i40e_rxtx_vec_altivec.c | 60 ++++++++----- drivers/net/i40e/i40e_rxtx_vec_avx2.c | 6 +- drivers/net/i40e/i40e_rxtx_vec_neon.c | 49 +++++++---- drivers/net/i40e/i40e_rxtx_vec_sse.c | 51 ++++++++---- drivers/net/iavf/iavf_rxtx_vec_sse.c | 102 +++++++++++++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 47 ++++++++--- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 51 +++++++++--- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 48 ++++++++--- 8 files changed, 301 insertions(+), 113 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/4 net/ixgbe: maximize vector rx burst for ixgbe
The limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
--- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 51 ++++++++++++++++++++----- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 48 ++++++++++++++++------- 2 files changed, 76 insertions(+), 23 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +41 -10
@@ -206,6 +206,13 @@ desc_to_ptype_v(uint64x2_t descs[4], uint16_t pkt_type_mask, vgetq_lane_u32(tunnel_check, 3)); } +/** +* vPMD raw receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) +* +* Notice: +* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet +* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two +*/ static inline uint16_t _recv_raw_pkts_vec (struct ixgbe_rx_queue *rxq,struct rte_mbuf **rx_pkts,uint16_t nb_pkts,uint8_t *split_packet)
@@ -226,9 +233,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,uint16x8_t crc_adjust = {0 ,0 , rxq->crc_len,0 , rxq->crc_len,0 ,0 ,0 }; -/* nb_pkts shall be less equal than RTE_IXGBE_MAX_RX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,RTE_IXGBE_MAX_RX_BURST ); -/* nb_pkts has to be floor-aligned to RTE_IXGBE_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,RTE_IXGBE_DESCS_PER_LOOP );
@@ -382,7 +386,7 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,return nb_pkts_recd; } -/* +/** * vPMD receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) * * Notice:
@@ -399,19 +403,17 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* +/** * vPMD receive routine that reassembles scattered packets * * Notice: * - don't support ol_flags for rss and csum err * - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan RTE_IXGBE_MAX_RX_BURST -* numbers of DD bit * - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two */ -uint16_t -ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +ixgbe_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct ixgbe_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_IXGBE_MAX_RX_BURST ] = {0 };
@@ -443,6 +445,35 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +* Main receive routine that can handle arbitrary burst sizes +* Notice: +* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet +*/ +uint16_t +ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_IXGBE_MAX_RX_BURST ) { +uint16_t burst; + + burst =ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_IXGBE_MAX_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <RTE_IXGBE_MAX_RX_BURST ) +return retval; + } + +return retval +ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void vtx1 (volatile union ixgbe_adv_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags)
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +35 -13
88 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 2/4 net/i40e: maximize vector rx burst for i40e
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
--- drivers/net/i40e/i40e_rxtx_vec_altivec.c | 60 ++++++++++++++++-------- drivers/net/i40e/i40e_rxtx_vec_avx2.c | 6 +-- drivers/net/i40e/i40e_rxtx_vec_neon.c | 49 +++++++++++++------ drivers/net/i40e/i40e_rxtx_vec_sse.c | 51 ++++++++++++++------ 4 files changed, 115 insertions(+), 51 deletions(-)
drivers/net/i40e/i40e_rxtx_vec_altivec.c +41 -19
@@ -190,8 +190,6 @@ desc_to_ptype_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts,/* Notice: * - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_I40E_VPMD_RX_BURST, only scan RTE_I40E_VPMD_RX_BURST -* numbers of DD bits */ static inline uint16_t _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
@@ -214,9 +212,6 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts, };vector unsigned long dd_check, eop_check; -/* nb_pkts shall be less equal than RTE_I40E_MAX_RX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,RTE_I40E_MAX_RX_BURST ); -/* nb_pkts has to be floor-aligned to RTE_I40E_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,RTE_I40E_DESCS_PER_LOOP );
@@ -447,11 +442,10 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,return nb_pkts_recd; } -/* Notice: -* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_I40E_VPMD_RX_BURST, only scan RTE_I40E_VPMD_RX_BURST -* numbers of DD bits -*/ +/** +* Notice: +* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet +*/ uint16_t i40e_recv_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts)
@@ -459,15 +453,14 @@ i40e_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* vPMD receive routine that reassembles scattered packets -* Notice: -* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_I40E_VPMD_RX_BURST, only scan RTE_I40E_VPMD_RX_BURST -* numbers of DD bits -*/ -uint16_t -i40e_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +/** +* vPMD receive routine that reassembles scattered packets +* Notice: +* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet +*/ +static uint16_t +i40e_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct i40e_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_I40E_VPMD_RX_BURST ] = {0 };
@@ -500,6 +493,35 @@ i40e_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +* Main receive routine that can handle arbitrary burst sizes +* Notice: +* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet +*/ +uint16_t +i40e_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_I40E_VPMD_RX_BURST ) { +uint16_t burst; + + burst =i40e_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_I40E_VPMD_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <RTE_I40E_VPMD_RX_BURST ) +return retval; + } + +return retval +i40e_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void vtx1 (volatile struct i40e_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags)
drivers/net/i40e/i40e_rxtx_vec_avx2.c +3 -3
@@ -729,7 +729,7 @@ _recv_raw_pkts_vec_avx2(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,return received; } -/* +/** * Notice: * - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet */
@@ -740,7 +740,7 @@ i40e_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec_avx2 (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* +/** * vPMD receive routine that reassembles single burst of 32 scattered packets * Notice: * - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet
@@ -781,7 +781,7 @@ i40e_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } -/* +/** * vPMD receive routine that reassembles scattered packets. * Main receive routine that can handle arbitrary burst sizes * Notice:
drivers/net/i40e/i40e_rxtx_vec_neon.c +35 -14
84 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx_vec_sse.c +36 -15
88 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 3/4 net/ice: maximize vector rx burst for ice
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
--- drivers/net/ice/ice_rxtx_vec_sse.c | 47 +++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 13 deletions(-)
drivers/net/ice/ice_rxtx_vec_sse.c +34 -13
@@ -207,8 +207,6 @@ ice_rx_desc_to_ptype_v(__m128i descs[4], struct rte_mbuf **rx_pkts,/** * Notice: * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST -* numbers of DD bits */ static inline uint16_t _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,
@@ -264,9 +262,6 @@ _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,const __m128i eop_check =_mm_set_epi64x (0x0000000200000002LL ,0x0000000200000002LL ); -/* nb_pkts shall be less equal than ICE_MAX_RX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,ICE_MAX_RX_BURST ); -/* nb_pkts has to be floor-aligned to ICE_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,ICE_DESCS_PER_LOOP );
@@ -444,8 +439,6 @@ _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,/** * Notice: * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST -* numbers of DD bits */ uint16_t ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -454,15 +447,14 @@ ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,return _ice_recv_raw_pkts_vec (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* vPMD receive routine that reassembles scattered packets +/** +* vPMD receive routine that reassembles scattered packets * Notice: * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST -* numbers of DD bits */ -uint16_t -ice_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +ice_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct ice_rx_queue *rxq = rx_queue;uint8_t split_flags[ICE_VPMD_RX_BURST ] = {0 };
@@ -496,6 +488,35 @@ ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +* Main receive routine that can handle arbitrary burst sizes +* Notice: +* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet +*/ +uint16_t +ice_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >ICE_VPMD_RX_BURST ) { +uint16_t burst; + + burst =ice_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +ICE_VPMD_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <ICE_VPMD_RX_BURST ) +return retval; + } + +return retval +ice_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void ice_vtx1 (volatile struct ice_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags)
Signature · 1 line
2.20.1
PATCH 4/4 net/iavf: maximize vector rx burst for iavf
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
--- drivers/net/iavf/iavf_rxtx_vec_sse.c | 102 ++++++++++++++++++++------- 1 file changed, 76 insertions(+), 26 deletions(-)
drivers/net/iavf/iavf_rxtx_vec_sse.c +76 -26
@@ -379,10 +379,9 @@ flex_desc_to_ptype_v(__m128i descs[4], struct rte_mbuf **rx_pkts, rx_pkts[3 ]->packet_type = type_table[_mm_extract_epi16 (ptype_all,7 )]; } -/* Notice: +/** +* Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > IAVF_VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST -* numbers of DD bits */ static inline uint16_t _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts,
@@ -413,9 +412,6 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts, offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);__m128i dd_check, eop_check; -/* nb_pkts shall be less equal than IAVF_VPMD_RX_MAX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,IAVF_VPMD_RX_MAX_BURST ); -/* nb_pkts has to be floor-aligned to IAVF_VPMD_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,IAVF_VPMD_DESCS_PER_LOOP );
@@ -627,10 +623,9 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts,return nb_pkts_recd; } -/* Notice: +/** +* Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > IAVF_VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST -* numbers of DD bits */ static inline uint16_t _recv_raw_pkts_vec_flex_rxd(struct iavf_rx_queue *rxq,
@@ -688,9 +683,6 @@ _recv_raw_pkts_vec_flex_rxd(struct iavf_rx_queue *rxq,const __m128i eop_check =_mm_set_epi64x (0x0000000200000002LL ,0x0000000200000002LL ); -/* nb_pkts shall be less equal than IAVF_VPMD_RX_MAX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,IAVF_VPMD_RX_MAX_BURST ); -/* nb_pkts has to be floor-aligned to IAVF_VPMD_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,IAVF_VPMD_DESCS_PER_LOOP );
@@ -921,7 +913,8 @@ _recv_raw_pkts_vec_flex_rxd(struct iavf_rx_queue *rxq,return nb_pkts_recd; } -/* Notice: +/** +* Notice: * - nb_pkts < IAVF_DESCS_PER_LOOP, just return no packet * - nb_pkts > IAVF_VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST * numbers of DD bits
@@ -933,7 +926,8 @@ iavf_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* Notice: +/** +* Notice: * - nb_pkts < IAVF_DESCS_PER_LOOP, just return no packet * - nb_pkts > IAVF_VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST * numbers of DD bits
@@ -945,15 +939,14 @@ iavf_recv_pkts_vec_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec_flex_rxd (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* vPMD receive routine that reassembles scattered packets +/** +* vPMD receive routine that reassembles scattered packets * Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST -* numbers of DD bits */ -uint16_t -iavf_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +iavf_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct iavf_rx_queue *rxq = rx_queue;uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST ] = {0 };
@@ -986,16 +979,44 @@ iavf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } -/* vPMD receive routine that reassembles scattered packets for flex RxD +/** +* vPMD receive routine that reassembles scattered packets. +* Main receive routine that can handle arbitrary burst sizes * Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST -* numbers of DD bits */ uint16_t -iavf_recv_scattered_pkts_vec_flex_rxd (void *rx_queue, -struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +iavf_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >IAVF_VPMD_RX_MAX_BURST ) { +uint16_t burst; + + burst =iavf_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +IAVF_VPMD_RX_MAX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <IAVF_VPMD_RX_MAX_BURST ) +return retval; + } + +return retval +iavf_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} + +/** +* vPMD receive routine that reassembles scattered packets for flex RxD +* Notice: +* - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet +*/ +static uint16_t +iavf_recv_scattered_burst_vec_flex_rxd (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct iavf_rx_queue *rxq = rx_queue;uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST ] = {0 };
@@ -1028,6 +1049,35 @@ iavf_recv_scattered_pkts_vec_flex_rxd(void *rx_queue, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +* Main receive routine that can handle arbitrary burst sizes +* Notice: +* - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet +*/ +uint16_t +iavf_recv_scattered_pkts_vec_flex_rxd (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >IAVF_VPMD_RX_MAX_BURST ) { +uint16_t burst; + + burst =iavf_recv_scattered_burst_vec_flex_rxd (rx_queue, + rx_pkts + retval, +IAVF_VPMD_RX_MAX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <IAVF_VPMD_RX_MAX_BURST ) +return retval; + } + +return retval +iavf_recv_scattered_burst_vec_flex_rxd (rx_queue, + rx_pkts + retval, nb_pkts); +} +static inline void vtx1 (volatile struct iavf_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags) {
Signature · 1 line
2.20.1
[dpdk-dev] [RFC] ethdev: rte_eth_rx_burst() requirements for nb_pkts
In reply to Jeff GuoJeff and Ethernet API maintainers Thomas, Ferruh and Andrew,
I'm hijacking this patch thread to propose a small API modification that prevents unnecessarily performance degradations.
Quoted 11 lines
From: dev [mailto:[email protected]] On Behalf Of Jeff Guo
Sent: Thursday, August 27, 2020 9:55 AMThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf PMDs.
Now I'm going to be pedantic and say that it still doesn't conform to the rte_eth_rx_burst() API, because the API does not specify any minimum requirement for nb_pkts.
In theory, that could also be fixed in the driver by calling the non-vector function from the vector functions if nb_pkts is too small for the vector implementation.
However, I think that calling rte_eth_rx_burst() with a small nb_pkts is silly and not in the spirit of DPDK, and introducing an additional comparison for a small nb_pkts in the driver vector functions would degrade their performance (only slightly, but anyway).
Instead, I propose that the rte_eth_rx_burst() API is updated with a minimum requirement for nb_pkts. This minimum requirement should be supported by all Ethernet drivers, instead of having minimum requirements for nb_pkts depending on driver and vector function.
I also have a small comment about the description for all the main rx functions:
+/**
+ * vPMD receive routine that reassembles scattered packets.
+ * Main receive routine that can handle arbitrary burst sizes
+ * Notice:
+ * - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet
+ */
It says "can handle arbitrary burst sizes", but bears a notice that it really cannot. So please remove that line from all these functions.
Med venlig hilsen / kind regards
- Morten Brørup
Re: [dpdk-dev] [RFC] ethdev: rte_eth_rx_burst() requirements for nb_pkts
Quoted 16 lines · Morten Brørup
Jeff and Ethernet API maintainers Thomas, Ferruh and Andrew,
I'm hijacking this patch thread to propose a small API modification that prevents unnecessarily performance degradations.
Quoted 11 lines
From: dev [mailto:[email protected]] On Behalf Of Jeff Guo
Sent: Thursday, August 27, 2020 9:55 AMThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf PMDs.
Quoted 6 lines
Now I'm going to be pedantic and say that it still doesn't conform to the
rte_eth_rx_burst()API, because the API does not specify any minimum requirement fornb_pkts.In theory, that could also be fixed in the driver by calling the non-vector function from the vector functions if
nb_pktsis too small for the vector implementation.However, I think that calling
rte_eth_rx_burst()with a smallnb_pktsis silly and not in the spirit of DPDK, and introducing an additional comparison for a smallnb_pktsin the driver vector functions would degrade their performance (only slightly, but anyway).
Actually, I'd like to see a confirmed measurement showing a slowdown before we discard such an option. :-) While I agree that using small bursts is not keeping with the design approach of DPDK of using large bursts to amortize costs and allow prefetching, there are cases where a user/app may want a small burst size, e.g. 4, for latency reasons, and we need a way to support that.
Since the path selection is dynamic, we need to either:
a) provide a way for the user to specify that they will use smaller bursts and so that vector functions should not be used
b) have the vector functions transparently fallback to the scalar ones if used with smaller bursts
Of these, option b) is simpler, and should be low cost since any check is just once per burst, and - assuming an app is written using the same request-size each time - should be entirely predictable after the first call.
/Bruce
Re: [dpdk-dev] [RFC] ethdev: rte_eth_rx_burst() requirements for nb_pkts
Quoted 32 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, August 27, 2020 11:10 AMQuoted 3 lines · Morten Brørup
Jeff and Ethernet API maintainers Thomas, Ferruh and Andrew,
I'm hijacking this patch thread to propose a small API modification
that prevents unnecessarily performance degradations.
Quoted 5 lines
Quoted 5 lines
From: dev [mailto:[email protected]] On Behalf Of Jeff Guo
Sent: Thursday, August 27, 2020 9:55 AMThe limitation of burst size in vector rx was removed, since it
should
Quoted 1 line
Quoted 1 line
retrieve as much received packets as possible. And also the
scattered
Quoted 8 lines
Quoted 6 lines
receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf PMDs.
Now I'm going to be pedantic and say that it still doesn't conform to
the
rte_eth_rx_burst()API, because the API does not specify any minimum requirement fornb_pkts.Quoted 2 lines
In theory, that could also be fixed in the driver by calling the non-
vector function from the vector functions if
nb_pktsis too small for the vector implementation.Quoted 2 lines
However, I think that calling
rte_eth_rx_burst()with a smallnb_pkts
Quoted 8 lines
is silly and not in the spirit of DPDK, and introducing an additional comparison for a small
nb_pktsin the driver vector functions would degrade their performance (only slightly, but anyway).Quoted 1 line
Actually, I'd like to see a confirmed measurement showing a slowdown before
we discard such an option. :-)
Good point!
Quoted 10 lines
While I agree that using small bursts is
not
keeping with the design approach of DPDK of using large bursts to amortize
costs and allow prefetching, there are cases where a user/app may want a
small burst size, e.g. 4, for latency reasons, and we need a way to support
that.
I assume that calling rte_eth_rx_burst() with nb_pkts=32 returns 4 packets if only 4 packets are available, so you would need to be extremely latency sensitive to call it with a smaller nb_pkts. I guess that high frequency trading is the only real life scenario here.
Quoted 8 lines
Since the path selection is dynamic, we need to either:
a) provide a way for the user to specify that they will use smaller bursts
and so that vector functions should not be used
b) have the vector functions transparently fallback to the scalar ones if
used with smaller bursts
Quoted 6 lines
Of these, option b) is simpler, and should be low cost since any check is
just once per burst, and - assuming an app is written using the same request-size each time - should be entirely predictable after the first call.
Why does everyone assume that DPDK applications are so simple that the branch predictor will cover the entire data path? I hear this argument over and over again, and by principle I disagree with it!
How about c): add rte_eth_rx() and rte_eth_tx() functions for receiving/transmitting a single packet. The ring library has such functions.
Optimized single-packet functions might even perform better than calling the burst functions with nb_pkts=1. Great for latency focused applications. :-)
Quoted 2 lines
/Bruce
Re: [dpdk-dev] [RFC] ethdev: rte_eth_rx_burst() requirements for nb_pkts
Quoted 53 lines · Morten Brørup
Quoted 32 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, August 27, 2020 11:10 AMQuoted 3 lines · Morten Brørup
Jeff and Ethernet API maintainers Thomas, Ferruh and Andrew,
I'm hijacking this patch thread to propose a small API modification
that prevents unnecessarily performance degradations.
Quoted 5 lines
Quoted 5 lines
From: dev [mailto:[email protected]] On Behalf Of Jeff Guo
Sent: Thursday, August 27, 2020 9:55 AMThe limitation of burst size in vector rx was removed, since it
should
Quoted 1 line
Quoted 1 line
retrieve as much received packets as possible. And also the
scattered
Quoted 8 lines
Quoted 6 lines
receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf PMDs.
Now I'm going to be pedantic and say that it still doesn't conform to
the
rte_eth_rx_burst()API, because the API does not specify any minimum requirement fornb_pkts.Quoted 2 lines
In theory, that could also be fixed in the driver by calling the non-
vector function from the vector functions if
nb_pktsis too small for the vector implementation.Quoted 2 lines
However, I think that calling
rte_eth_rx_burst()with a smallnb_pktsQuoted 8 lines
is silly and not in the spirit of DPDK, and introducing an additional comparison for a small
nb_pktsin the driver vector functions would degrade their performance (only slightly, but anyway).Quoted 1 line
Actually, I'd like to see a confirmed measurement showing a slowdown before
we discard such an option. :-)Good point!
Quoted 10 lines
While I agree that using small bursts is
not
keeping with the design approach of DPDK of using large bursts to amortize
costs and allow prefetching, there are cases where a user/app may want a
small burst size, e.g. 4, for latency reasons, and we need a way to support
that.
Quoted 2 lines
I assume that calling
rte_eth_rx_burst()with nb_pkts=32 returns 4 packets if only 4 packets are available, so you would need to be extremely latency sensitive to call it with a smallernb_pkts. I guess that high frequency trading is the only real life scenario here.
Yes, it really boils down to whether you are prepared to accept lower max throughput or dropped packets in order to gain lower latency.
Quoted 8 lines
Quoted 8 lines
Since the path selection is dynamic, we need to either:
a) provide a way for the user to specify that they will use smaller bursts
and so that vector functions should not be used
b) have the vector functions transparently fallback to the scalar ones if
used with smaller bursts
Quoted 8 lines
Quoted 6 lines
Of these, option b) is simpler, and should be low cost since any check is
just once per burst, and - assuming an app is written using the same request-size each time - should be entirely predictable after the first call.Why does everyone assume that DPDK applications are so simple that the branch predictor will cover the entire data path? I hear this argument over and over again, and by principle I disagree with it!
Fair enough, that was an assumption on my part. Do you see in your apps many cases where branches are getting mispredicted despite going the same way each time though the code?
Quoted 4 lines
How about c): add
rte_eth_rx()andrte_eth_tx()functions for receiving/transmitting a single packet. The ring library has such functions.Optimized single-packet functions might even perform better than calling the burst functions with nb_pkts=1. Great for latency focused applications. :-)
That is another option, yes.
A further option is to add to the vector code a one-off switch to check first time it's called that the request size is not lower than the min supported (again basing on the assumption that one is not going to be varying the burst size asked - which may not be true in call cases but won't leave us any worse off than we are now!).
/Bruce
Re: [dpdk-dev] [RFC] ethdev: rte_eth_rx_burst() requirements fornb_pkts
Quoted 93 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, August 27, 2020 11:44 AMQuoted 7 lines · Morten Brørup
Quoted 7 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, August 27, 2020 11:10 AMQuoted 3 lines · Morten Brørup
Jeff and Ethernet API maintainers Thomas, Ferruh and Andrew,
I'm hijacking this patch thread to propose a small API
modification
Quoted 10 lines
Quoted 10 lines
that prevents unnecessarily performance degradations.
Quoted 5 lines
Quoted 5 lines
From: dev [mailto:[email protected]] On Behalf Of Jeff Guo
Sent: Thursday, August 27, 2020 9:55 AMThe limitation of burst size in vector rx was removed, since it
should
Quoted 1 line
Quoted 1 line
retrieve as much received packets as possible. And also the
scattered
Quoted 1 line
Quoted 1 line
receive path should use a wrapper function to achieve the goal
of
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf PMDs.
Now I'm going to be pedantic and say that it still doesn't
conform to
Quoted 4 lines
Quoted 4 lines
the
rte_eth_rx_burst()API, because the API does not specify any minimum requirement fornb_pkts.Quoted 2 lines
In theory, that could also be fixed in the driver by calling the
non-
Quoted 1 line
Quoted 1 line
vector function from the vector functions if
nb_pktsis too smallfor
Quoted 3 lines
Quoted 3 lines
the vector implementation.
Quoted 2 lines
However, I think that calling
rte_eth_rx_burst()with a small
nb_pktsQuoted 1 line
Quoted 1 line
is silly and not in the spirit of DPDK, and introducing an
additional
Quoted 5 lines
Quoted 5 lines
comparison for a small
nb_pktsin the driver vector functions would degrade their performance (only slightly, but anyway).Quoted 1 line
Actually, I'd like to see a confirmed measurement showing a
slowdown
Quoted 10 lines
Quoted 2 lines
before
we discard such an option. :-)Good point!
Quoted 5 lines
While I agree that using small bursts is
not
keeping with the design approach of DPDK of using large bursts to amortize
costs and allow prefetching, there are cases where a user/app maywant
Quoted 6 lines
Quoted 5 lines
a
small burst size, e.g. 4, for latency reasons, and we need a way to support
that.I assume that calling
rte_eth_rx_burst()with nb_pkts=32 returns 4packets if only 4 packets are available, so you would need to be extremely latency sensitive to call it with a smaller
nb_pkts. I guess that high frequency trading is the only real life scenario here.Quoted 1 line
Yes, it really boils down to whether you are prepared to accept lower max throughput or dropped packets in order to gain lower latency.
Quoted 5 lines
Quoted 5 lines
Since the path selection is dynamic, we need to either:
a) provide a way for the user to specify that they will use smaller bursts
and so that vector functions should not be used
b) have the vector functions transparently fallback to the scalarones
Quoted 4 lines
Quoted 4 lines
if
used with smaller burstsOf these, option b) is simpler, and should be low cost since any
check
Quoted 2 lines
Quoted 2 lines
is
just once per burst, and - assuming an app is written using thesame
Quoted 1 line
Quoted 1 line
request-size each time - should be entirely predictable after the
first
Quoted 3 lines
Quoted 2 lines
call.
Why does everyone assume that DPDK applications are so simple that
Quoted 9 lines
the branch predictor will cover the entire data path? I hear this argument over and over again, and by principle I disagree with it!
Quoted 1 line
Fair enough, that was an assumption on my part. Do you see in your apps many cases where branches are getting mispredicted despite going the same
way each time though the code?
We haven't looked deeply into this, but I don't think so.
My objection is of a more general nature. As a library, DPDK cannot assume that applications using it are simple, and - based on that assumption - take away resources that could have been available for the application.
The Intel general optimization guidelines specifies that code should be arranged to be consistent with the static branch prediction algorithm: make the fall-through code following a conditional branch be the likely target for a branch with a forward target, and make the fall-through code following a conditional branch be the unlikely target for a branch with a backward target.
It also says: Conditional branches that are never taken do not consume BTB resources.
Somehow this last detail is completely ignored by DPDK developers.
We put a lot of effort into conserving resources in most areas in DPDK, but when it comes to the branch prediction target buffer (BTB), we gladly organize code with branches turning the wrong way, thus unnecessarily consuming BTB entries. And the argument goes: The branch predictor will catch it after the first time.
Quoted 8 lines
Quoted 1 line
How about c): add
rte_eth_rx()andrte_eth_tx()functions forreceiving/transmitting a single packet. The ring library has such functions.
Quoted 2 lines
Optimized single-packet functions might even perform better than
calling the burst functions with nb_pkts=1. Great for latency focused applications. :-)
Quoted 1 line
Quoted 9 lines
That is another option, yes.
A further option is to add to the vector code a one-off switch to check first
time it's called that the request size is not lower than the min supported
(again basing on the assumption that one is not going to be varying the burst size asked - which may not be true in call cases but won't leave us
any worse off than we are now!).
I certainly don't support this option. But it was worth mentioning.
Re: [dpdk-dev] [RFC] ethdev: rte_eth_rx_burst() requirements fornb_pkts
Quoted 106 lines · Morten Brørup
Quoted 93 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, August 27, 2020 11:44 AMQuoted 7 lines · Morten Brørup
Quoted 7 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, August 27, 2020 11:10 AMQuoted 3 lines · Morten Brørup
Jeff and Ethernet API maintainers Thomas, Ferruh and Andrew,
I'm hijacking this patch thread to propose a small API
modification
Quoted 10 lines
Quoted 10 lines
that prevents unnecessarily performance degradations.
Quoted 5 lines
Quoted 5 lines
From: dev [mailto:[email protected]] On Behalf Of Jeff Guo
Sent: Thursday, August 27, 2020 9:55 AMThe limitation of burst size in vector rx was removed, since it
should
Quoted 1 line
Quoted 1 line
retrieve as much received packets as possible. And also the
scattered
Quoted 1 line
Quoted 1 line
receive path should use a wrapper function to achieve the goal
of
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf PMDs.
Now I'm going to be pedantic and say that it still doesn't
conform to
Quoted 4 lines
Quoted 4 lines
the
rte_eth_rx_burst()API, because the API does not specify any minimum requirement fornb_pkts.Quoted 2 lines
In theory, that could also be fixed in the driver by calling the
non-
Quoted 1 line
Quoted 1 line
vector function from the vector functions if
nb_pktsis too smallfor
Quoted 3 lines
Quoted 3 lines
the vector implementation.
Quoted 2 lines
However, I think that calling
rte_eth_rx_burst()with a small
nb_pktsQuoted 1 line
Quoted 1 line
is silly and not in the spirit of DPDK, and introducing an
additional
Quoted 5 lines
Quoted 5 lines
comparison for a small
nb_pktsin the driver vector functions would degrade their performance (only slightly, but anyway).Quoted 1 line
Actually, I'd like to see a confirmed measurement showing a
slowdown
Quoted 10 lines
Quoted 2 lines
before
we discard such an option. :-)Good point!
Quoted 5 lines
While I agree that using small bursts is
not
keeping with the design approach of DPDK of using large bursts to amortize
costs and allow prefetching, there are cases where a user/app maywant
Quoted 6 lines
Quoted 5 lines
a
small burst size, e.g. 4, for latency reasons, and we need a way to support
that.I assume that calling
rte_eth_rx_burst()with nb_pkts=32 returns 4packets if only 4 packets are available, so you would need to be extremely latency sensitive to call it with a smaller
nb_pkts. I guess that high frequency trading is the only real life scenario here.Quoted 1 line
Yes, it really boils down to whether you are prepared to accept lower max throughput or dropped packets in order to gain lower latency.
Quoted 5 lines
Quoted 5 lines
Since the path selection is dynamic, we need to either:
a) provide a way for the user to specify that they will use smaller bursts
and so that vector functions should not be used
b) have the vector functions transparently fallback to the scalarones
Quoted 4 lines
Quoted 4 lines
if
used with smaller burstsOf these, option b) is simpler, and should be low cost since any
check
Quoted 2 lines
Quoted 2 lines
is
just once per burst, and - assuming an app is written using thesame
Quoted 1 line
Quoted 1 line
request-size each time - should be entirely predictable after the
first
Quoted 3 lines
Quoted 2 lines
call.
Why does everyone assume that DPDK applications are so simple that
Quoted 9 lines
the branch predictor will cover the entire data path? I hear this argument over and over again, and by principle I disagree with it!
Quoted 1 line
Fair enough, that was an assumption on my part. Do you see in your apps many cases where branches are getting mispredicted despite going the same
way each time though the code?We haven't looked deeply into this, but I don't think so.
My objection is of a more general nature. As a library, DPDK cannot assume that applications using it are simple, and - based on that assumption - take away resources that could have been available for the application.
Quoted 8 lines
The Intel general optimization guidelines specifies that code should be arranged to be consistent with the static branch prediction algorithm: make the fall-through code following a conditional branch be the likely target for a branch with a forward target, and make the fall-through code following a conditional branch be the unlikely target for a branch with a backward target.
It also says: Conditional branches that are never taken do not consume BTB resources.
Somehow this last detail is completely ignored by DPDK developers.
We put a lot of effort into conserving resources in most areas in DPDK, but when it comes to the branch prediction target buffer (BTB), we gladly organize code with branches turning the wrong way, thus unnecessarily consuming BTB entries. And the argument goes: The branch predictor will catch it after the first time.
Looks like something to investigate more. Thanks for bringing this up.
Quoted 18 lines
Quoted 8 lines
Quoted 1 line
How about c): add
rte_eth_rx()andrte_eth_tx()functions forreceiving/transmitting a single packet. The ring library has such functions.
Quoted 2 lines
Optimized single-packet functions might even perform better than
calling the burst functions with nb_pkts=1. Great for latency focused applications. :-)
Quoted 1 line
Quoted 9 lines
That is another option, yes.
A further option is to add to the vector code a one-off switch to check first
time it's called that the request size is not lower than the min supported
(again basing on the assumption that one is not going to be varying the burst size asked - which may not be true in call cases but won't leave us
any worse off than we are now!).
Quoted 2 lines
I certainly don't support this option. But it was worth mentioning.
Right. For now then, it seems like just documenting a minimum burst size is reasonable.
/Bruce
Re: [dpdk-dev] [RFC] ethdev: rte_eth_rx_burst() requirements fornb_pkts
Quoted 88 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, August 27, 2020 1:41 PMQuoted 1 line · Morten Brørup
Quoted 1 line
From: dev [mailto:[email protected]] On Behalf Of Bruce
Richardson
Quoted 6 lines
Quoted 6 lines
Sent: Thursday, August 27, 2020 11:44 AM
Quoted 3 lines · Morten Brørup
Quoted 3 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, August 27, 2020 11:10 AMQuoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines · Morten Brørup
Quoted 3 lines
Jeff and Ethernet API maintainers Thomas, Ferruh and Andrew,
I'm hijacking this patch thread to propose a small API
modification
Quoted 3 lines
Quoted 3 lines
that prevents unnecessarily performance degradations.
Quoted 2 lines
Quoted 2 lines
From: dev [mailto:[email protected]] On Behalf Of Jeff
Guo
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Sent: Thursday, August 27, 2020 9:55 AM
The limitation of burst size in vector rx was removed,
since it
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
should
Quoted 1 line
Quoted 1 line
retrieve as much received packets as possible. And also the
scattered
Quoted 1 line
Quoted 1 line
receive path should use a wrapper function to achieve the
goal
Quoted 10 lines
Quoted 10 lines
of
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf PMDs.
Now I'm going to be pedantic and say that it still doesn't
conform to
Quoted 1 line
Quoted 1 line
the
rte_eth_rx_burst()API, because the API does not specifyany
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
minimum requirement for
nb_pkts.Quoted 2 lines
In theory, that could also be fixed in the driver by calling
the
Quoted 2 lines
Quoted 2 lines
non-
Quoted 1 line
Quoted 1 line
vector function from the vector functions if
nb_pktsis toosmall
Quoted 8 lines
Quoted 8 lines
for
Quoted 3 lines
Quoted 3 lines
the vector implementation.
Quoted 2 lines
However, I think that calling
rte_eth_rx_burst()with a small
nb_pktsQuoted 1 line
Quoted 1 line
is silly and not in the spirit of DPDK, and introducing an
additional
Quoted 1 line
Quoted 1 line
comparison for a small
nb_pktsin the driver vector functionswould
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
degrade their performance (only slightly, but anyway).
Quoted 1 line
Actually, I'd like to see a confirmed measurement showing a
slowdown
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
before
we discard such an option. :-)Good point!
Quoted 3 lines
While I agree that using small bursts is
not
keeping with the design approach of DPDK of using large burststo
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
amortize
costs and allow prefetching, there are cases where a user/appmay
Quoted 3 lines
Quoted 3 lines
want
Quoted 2 lines
Quoted 2 lines
a
small burst size, e.g. 4, for latency reasons, and we need away to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
support
that.I assume that calling
rte_eth_rx_burst()with nb_pkts=32 returns4
Quoted 2 lines
Quoted 2 lines
packets if only 4 packets are available, so you would need to be extremely latency sensitive to call it with a smaller
nb_pkts. Iguess
Quoted 2 lines
Quoted 2 lines
that high frequency trading is the only real life scenario here.
Quoted 1 line
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Yes, it really boils down to whether you are prepared to accept
lower
Quoted 4 lines
Quoted 4 lines
max throughput or dropped packets in order to gain lower latency.
Quoted 2 lines
Quoted 2 lines
Since the path selection is dynamic, we need to either:
a) provide a way for the user to specify that they will usesmaller
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
bursts
and so that vector functions should not be used
After thinking about it, and also inspired by Haiyue's comment in the other thread, this may be a good option. Configure the driver with the burst size that the application is going to use, so the driver can select the appropriate function. The driver could even select another vector function, optimized for the specific size.
It could be a field in the rte_eth_rxmode structure, which is part of the rte_eth_conf structure used in the rte_eth_dev_configure() function.
This would also make the nb_pkts in the rte_eth_rx_burst() obsolete. So we could add a function without the nb_pkts parameter.
Alternatively, we could introduce new variants of the rte_eth_rx_burst() function with fixed burst size, e.g. rte_eth_rx_burst32() to receive a burst of 32 packets, rte_eth_rx_burst64() for 64 packets, and rte_eth_rx_burst128(). Assuming that the performance difference beyond a certain vector size is insignificant, e.g. 128 packets, we don't need to add functions for larger vectors than that.
Or my suggestion here might just be a case of over-optimizing with insignificant performance benefits.
Quoted 80 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
b) have the vector functions transparently fallback to the
scalar
Quoted 5 lines
Quoted 5 lines
ones
Quoted 4 lines
Quoted 4 lines
if
used with smaller burstsOf these, option b) is simpler, and should be low cost since
any
Quoted 5 lines
Quoted 5 lines
check
Quoted 2 lines
Quoted 2 lines
is
just once per burst, and - assuming an app is written using thesame
Quoted 1 line
Quoted 1 line
request-size each time - should be entirely predictable after
the
Quoted 4 lines
Quoted 4 lines
first
Quoted 3 lines
Quoted 2 lines
call.
Why does everyone assume that DPDK applications are so simple
that
Quoted 5 lines
Quoted 5 lines
the branch predictor will cover the entire data path? I hear this argument over and over again, and by principle I disagree with it!
Quoted 1 line
Fair enough, that was an assumption on my part. Do you see in your
apps
Quoted 1 line
Quoted 1 line
many cases where branches are getting mispredicted despite going
the
Quoted 6 lines
Quoted 3 lines
same
way each time though the code?We haven't looked deeply into this, but I don't think so.
My objection is of a more general nature. As a library, DPDK cannot
assume that applications using it are simple, and - based on that assumption - take away resources that could have been available for the application.
Quoted 2 lines
The Intel general optimization guidelines specifies that code should
be arranged to be consistent with the static branch prediction
algorithm: make the fall-through code following a conditional branch be the likely target for a branch with a forward target, and make the fall-through code following a conditional branch be the unlikely target for a branch with a backward target.Quoted 2 lines
It also says: Conditional branches that are never taken do not
consume BTB resources.
Quoted 4 lines
Somehow this last detail is completely ignored by DPDK developers.
We put a lot of effort into conserving resources in most areas in
DPDK, but when it comes to the branch prediction target buffer (BTB), we gladly organize code with branches turning the wrong way, thus unnecessarily consuming BTB entries. And the argument goes: The branch predictor will catch it after the first time.
Quoted 1 line
Looks like something to investigate more. Thanks for bringing this up.
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
How about c): add
rte_eth_rx()andrte_eth_tx()functions forreceiving/transmitting a single packet. The ring library has such functions.
Quoted 2 lines
Optimized single-packet functions might even perform better than
calling the burst functions with nb_pkts=1. Great for latency
focused
Quoted 4 lines
Quoted 4 lines
applications. :-)
Quoted 1 line
That is another option, yes.
A further option is to add to the vector code a one-off switch tocheck
Quoted 4 lines
Quoted 4 lines
first
time it's called that the request size is not lower than the min supported
(again basing on the assumption that one is not going to be varyingthe
Quoted 1 line
Quoted 1 line
burst size asked - which may not be true in call cases but won't
leave
Quoted 3 lines
Quoted 2 lines
us
any worse off than we are now!).
Quoted 6 lines
Quoted 2 lines
I certainly don't support this option. But it was worth mentioning.
Right. For now then, it seems like just documenting a minimum burst size is
reasonable.
I agree. It is so far from the spirit of DPDK to call rte_eth_rx_burst() with a small nb_pkts that the driver developers didn't even consider it. The API documentation needs fixing, not the drivers.
It doesn't take care of your example 4 packet latency sensitive application, though. Which BTW also doesn’t work today on drivers with vector support. So it might not be a real world scenario anyway. :-)
Quoted 2 lines
/Bruce
Re: [dpdk-dev] [RFC] ethdev: rte_eth_rx_burst() requirements fornb_pkts
Quoted 2 lines · Morten Brørup
Quoted 2 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
<snip>
Quoted 9 lines
Quoted 4 lines
Right. For now then, it seems like just documenting a minimum burst size is
reasonable.I agree. It is so far from the spirit of DPDK to call
rte_eth_rx_burst()with a smallnb_pktsthat the driver developers didn't even consider it. The API documentation needs fixing, not the drivers.It doesn't take care of your example 4 packet latency sensitive application, though. Which BTW also doesn’t work today on drivers with vector support. So it might not be a real world scenario anyway. :-)
AFAIK, 8 is the smallest burst guaranteed to work everywhere, but I think just about everything bar the AVX2 i40e code path also supports 4 as a burst size. Therefore adjusting to 4 as min-burst might well be reasonable.
/Bruce
Re: [dpdk-dev] [RFC] ethdev: rte_eth_rx_burst() requirements fornb_pkts
Quoted 22 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Friday, August 28, 2020 12:07 PMQuoted 1 line · Morten Brørup
Quoted 1 line
From: dev [mailto:[email protected]] On Behalf Of Bruce
Richardson
Quoted 1 line
Quoted 1 line
<snip>
Quoted 6 lines
Quoted 4 lines
Right. For now then, it seems like just documenting a minimum burst size is
reasonable.I agree. It is so far from the spirit of DPDK to call
rte_eth_rx_burst()with a smallnb_pktsthat the driver developers didn't even consider it. The API documentation needs fixing, not the drivers.Quoted 2 lines
It doesn't take care of your example 4 packet latency sensitive
application, though. Which BTW also doesn’t work today on drivers with vector support. So it might not be a real world scenario anyway. :-)
Quoted 1 line
Quoted 7 lines
AFAIK, 8 is the smallest burst guaranteed to work everywhere, but I think
just about everything bar the AVX2 i40e code path also supports 4 as a burst size. Therefore adjusting to 4 as min-burst might well be reasonable./Bruce
There must be a reason the i40e AVX2 driver chose to step up to 8 from the previous convention of 4.
Considering Intel's stance on the controversial vector instructions, a larger numbers seems more future proof. HPC benefits from the vector instructions, and DPDK seems to benefit from them too. Let's not prevent that.
Since I don't have insight into Intel's (or any other CPU vendors') plans for future vector instructions, I will assume that 8 suffices for the foreseeable future, and thus I am leaning towards 8 rather than 4.
-Morten
Re: [dpdk-dev] [RFC] ethdev: rte_eth_rx_burst() requirements fornb_pkts
In reply to Bruce RichardsonQuoted 36 lines
From: Morten Brørup
Sent: Friday, August 28, 2020 12:51 PMQuoted 22 lines
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Friday, August 28, 2020 12:07 PMQuoted 1 line · Morten Brørup
Quoted 1 line
From: dev [mailto:[email protected]] On Behalf Of Bruce
Richardson
Quoted 1 line
Quoted 1 line
<snip>
Quoted 6 lines
Quoted 4 lines
Right. For now then, it seems like just documenting a minimum burst size is
reasonable.I agree. It is so far from the spirit of DPDK to call
rte_eth_rx_burst()with a smallnb_pktsthat the driver developers didn't even consider it. The API documentation needs fixing, not the drivers.Quoted 2 lines
It doesn't take care of your example 4 packet latency sensitive
application, though. Which BTW also doesn’t work today on drivers with vector support. So it might not be a real world scenario anyway. :-)
Quoted 1 line
Quoted 7 lines
AFAIK, 8 is the smallest burst guaranteed to work everywhere, but I think
just about everything bar the AVX2 i40e code path also supports 4 as a burst size. Therefore adjusting to 4 as min-burst might well be reasonable./Bruce
There must be a reason the i40e AVX2 driver chose to step up to 8 from the previous convention of 4.
Quoted 9 lines
Considering Intel's stance on the controversial vector instructions, a larger numbers seems more future proof. HPC benefits from the vector instructions, and DPDK seems to benefit from them too. Let's not prevent that.
Since I don't have insight into Intel's (or any other CPU vendors') plans for future vector instructions, I will assume that 8 suffices for the foreseeable future, and thus I am leaning towards 8 rather than 4.
nb_pkts must be >= 8 and divisible by 8.
Alternatively to being divisible by 8, would there be any benefit in requiring that it is a power-of-two?
-Morten
v3 cover fix vector rx burst for PMDs
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf/fm10k PMDs, and also do some code cleaning.
v3->v2:
1:move define into header file.
2:delete some useless doc.
v2->v1:
1:add fm10k driver case
2:refine some doc
Jeff Guo (5):
net/iavf: fix vector rx burst for iavf
net/ixgbe: fix vector rx burst for ixgbe
net/i40e: fix vector rx burst for i40e
net/ice: fix vector rx burst for ice
net/fm10k: fix vector rx burst for fm10k
drivers/net/fm10k/fm10k_rxtx_vec.c | 42 ++++++-- drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/i40e/i40e_rxtx_vec_altivec.c | 64 +++++++----- drivers/net/i40e/i40e_rxtx_vec_avx2.c | 29 +++--- drivers/net/i40e/i40e_rxtx_vec_neon.c | 58 +++++++---- drivers/net/i40e/i40e_rxtx_vec_sse.c | 58 +++++++---- drivers/net/iavf/iavf_rxtx.h | 1 + drivers/net/iavf/iavf_rxtx_vec_avx2.c | 78 +++++++-------- drivers/net/iavf/iavf_rxtx_vec_sse.c | 119 +++++++++++++++-------- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 +++-- drivers/net/ice/ice_rxtx_vec_sse.c | 56 +++++++---- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 77 ++++++++------- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 61 +++++++----- 14 files changed, 412 insertions(+), 256 deletions(-)
Signature · 1 line
2.20.1
PATCH v3 1/5 net/iavf: fix vector rx burst for iavf
The limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
--- drivers/net/iavf/iavf_rxtx.h | 1 + drivers/net/iavf/iavf_rxtx_vec_avx2.c | 78 ++++++++--------- drivers/net/iavf/iavf_rxtx_vec_sse.c | 119 ++++++++++++++++++-------- 3 files changed, 121 insertions(+), 77 deletions(-)
drivers/net/iavf/iavf_rxtx.h +1 -0
@@ -21,6 +21,7 @@#define IAVF_VPMD_TX_MAX_BURST 32#define IAVF_RXQ_REARM_THRESH 32#define IAVF_VPMD_DESCS_PER_LOOP 4 +#define IAVF_VPMD_DESCS_PER_LOOP_AVX 8#define IAVF_VPMD_TX_MAX_FREE_BUF 64#define IAVF_NO_VECTOR_FLAGS ( \
drivers/net/iavf/iavf_rxtx_vec_avx2.c +39 -39
214 lines not on this page · raw message
drivers/net/iavf/iavf_rxtx_vec_sse.c +81 -38
188 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v3 2/5 net/ixgbe: fix vector rx burst for ixgbe
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
--- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 77 +++++++++++++------------ drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 61 +++++++++++--------- 2 files changed, 76 insertions(+), 62 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +41 -36
@@ -130,17 +130,6 @@ desc_to_olflags_v(uint8x16x2_t sterr_tmp1, uint8x16x2_t sterr_tmp2, rx_pkts[3 ]->ol_flags = vol.e[3 ]; } -/* -* vPMD raw receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) -* -* Notice: -* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan RTE_IXGBE_MAX_RX_BURST -* numbers of DD bit -* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two -* - don't support ol_flags for rss and csum err -*/ -#define IXGBE_VPMD_DESC_EOP_MASK 0x02020202#define IXGBE_UINT8_BIT (CHAR_BIT * sizeof(uint8_t))
@@ -206,6 +195,13 @@ desc_to_ptype_v(uint64x2_t descs[4], uint16_t pkt_type_mask, vgetq_lane_u32(tunnel_check, 3)); } +/** +* vPMD raw receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) +* +* Notice: +* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet +* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two +*/ static inline uint16_t _recv_raw_pkts_vec (struct ixgbe_rx_queue *rxq,struct rte_mbuf **rx_pkts,uint16_t nb_pkts,uint8_t *split_packet)
@@ -226,9 +222,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,uint16x8_t crc_adjust = {0 ,0 , rxq->crc_len,0 , rxq->crc_len,0 ,0 ,0 }; -/* nb_pkts shall be less equal than RTE_IXGBE_MAX_RX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,RTE_IXGBE_MAX_RX_BURST ); -/* nb_pkts has to be floor-aligned to RTE_IXGBE_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,RTE_IXGBE_DESCS_PER_LOOP );
@@ -382,16 +375,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,return nb_pkts_recd; } -/* -* vPMD receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) -* -* Notice: -* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan RTE_IXGBE_MAX_RX_BURST -* numbers of DD bit -* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two -* - don't support ol_flags for rss and csum err -*/ uint16_t ixgbe_recv_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts)
@@ -399,23 +382,19 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* -* vPMD receive routine that reassembles scattered packets -* -* Notice: -* - don't support ol_flags for rss and csum err -* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan RTE_IXGBE_MAX_RX_BURST -* numbers of DD bit -* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two +/** +* vPMD receive routine that reassembles single burst of 32 scattered packets */ -uint16_t -ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +ixgbe_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct ixgbe_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_IXGBE_MAX_RX_BURST ] = {0 }; +/* split_flags only can support max of RTE_IXGBE_MAX_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,RTE_IXGBE_MAX_RX_BURST ); +/* get some new buffers */ uint16_t nb_bufs =_recv_raw_pkts_vec (rxq, rx_pkts, nb_pkts, split_flags);
@@ -443,6 +422,32 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_IXGBE_MAX_RX_BURST ) { +uint16_t burst; + + burst =ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_IXGBE_MAX_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <RTE_IXGBE_MAX_RX_BURST ) +return retval; + } + +return retval +ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void vtx1 (volatile union ixgbe_adv_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags)
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +35 -26
100 lines not on this page · raw message
Signature · 1 line
2.20.1
A message that is not in the archive (sent off-list or not yet received): VI1PR0802MB23518C6B517B6EAD8E018CD49E260@VI1PR0802MB2351.eurprd08.prod.outlook.com
Feifei Wang
Tested-by[dpdk-dev] 回复: [PATCH v3 2/5] net/ixgbe: fix vector rx burst for ixgbe
Hi, Jeff
Quoted 9 lines
From: dev <[email protected]> On Behalf Of Jeff Guo
Sent: Wednesday, September 9, 2020 2:37 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v3 2/5] net/ixgbe: fix vector rx burst for ixgbe
Quoted 8 lines
The limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
Signed-off-by Jeff Guo <[email protected]>--- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 77 +++++++++++++------------
This patch has passed the test on aarch64 platform with neon path.
Quoted 242 lines
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c| 61 +++++++++++---------2 files changed, 76 insertions(+), 62 deletions(-)drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +0
-6@@ -130,17 +130,6 @@ desc_to_olflags_v(uint8x16x2_t sterr_tmp1, uint8x16x2_t sterr_tmp2, rx_pkts[3]->ol_flags = vol.e[3]; } -/* -* vPMD raw receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) -* -* Notice: -* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan
RTE_IXGBE_MAX_RX_BURST
- * numbers of DD bit
- * - floor alignnb_pktsto aRTE_IXGBE_DESC_PER_LOOPpower-of-two
- * - don't supportol_flagsfor rss and csum err
- */drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +7
-1-#define IXGBE_VPMD_DESC_EOP_MASK0x02020202 #define IXGBE_UINT8_BIT(CHAR_BIT * sizeof(uint8_t))@@ -206,6 +195,13 @@ desc_to_ptype_v(uint64x2_t descs[4], uint16_t pkt_type_mask, vgetq_lane_u32(tunnel_check, 3)); } +/** +* vPMD raw receive routine, only accept(nb_pkts >= +RTE_IXGBE_DESCS_PER_LOOP) +* +* Notice: +* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet +* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two */ static inline uint16_t _recv_raw_pkts_vec (struct ixgbe_rx_queue *rxq,struct rte_mbuf **rx_pkts, uint16_t nb_pkts, uint8_t *split_packet) @@ -226,9 +222,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
uint16x8_tcrc_adjust= {0, 0,rxq->crc_len, 0,
rxq->crc_len, 0, 0, 0};-/*
nb_pktsshall be less equal thanRTE_IXGBE_MAX_RX_BURST*/ -nb_pkts =RTE_MIN(nb_pkts, RTE_IXGBE_MAX_RX_BURST);
-
/*nb_pktshas to be floor-aligned toRTE_IXGBE_DESCS_PER_LOOP*/nb_pkts
=RTE_ALIGN_FLOOR(nb_pkts, RTE_IXGBE_DESCS_PER_LOOP);drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +0
-6@@ -382,16 +375,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, return nb_pkts_recd; } -/* -* vPMD receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) -* -* Notice: -* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan
RTE_IXGBE_MAX_RX_BURST
- * numbers of DD bit
- * - floor alignnb_pktsto aRTE_IXGBE_DESC_PER_LOOPpower-of-two
- * - don't supportol_flagsfor rss and csum err
- */
uint16_t
ixgbe_recv_pkts_vec(void*rx_queue, structrte_mbuf**rx_pkts,uint16_tnb_pkts) @@ -399,23 +382,19 @@ ixgbe_recv_pkts_vec(void*rx_queue, structrte_mbuf**rx_pkts, return_recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL); }-/*
- * vPMD receive routine that reassembles scattered packets
- *
- * Notice:
- * - don't supportol_flagsfor rss and csum err
- * -nb_pkts<RTE_IXGBE_DESCS_PER_LOOP, just return no packet
- * -nb_pkts>RTE_IXGBE_MAX_RX_BURST, only scanRTE_IXGBE_MAX_RX_BURST
- * numbers of DD bit
- * - floor alignnb_pktsto aRTE_IXGBE_DESC_PER_LOOPpower-of-twodrivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +3
-2+/** +* vPMD receive routine that reassembles single burst of 32 scattered +packets */ -uint16_t -ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, -
uint16_tnb_pkts)drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +31
-0+static uint16_t +ixgbe_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct ixgbe_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_IXGBE_MAX_RX_BURST ] = {0 }; +/* split_flags only can support max of RTE_IXGBE_MAX_RX_BURST */ +nb_pkts =RTE_MIN (nb_pkts,RTE_IXGBE_MAX_RX_BURST ); +/* get some new buffers */ uint16_t nb_bufs =_recv_raw_pkts_vec (rxq, rx_pkts, nb_pkts, split_flags);@@ -443,6 +422,32 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_IXGBE_MAX_RX_BURST ) {uint16_t burst; + +burst =ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_IXGBE_MAX_RX_BURST ); +retval += burst; +nb_pkts -= burst; +if (burst <RTE_IXGBE_MAX_RX_BURST ) +return retval; +} + +return retval +ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void vtx1(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf *pkt, uint64_tflags) diff --git
a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.cb/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index517ca3166..cf54ff128100644drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +1
-2@@ -302,13 +302,11 @@ desc_to_ptype_v(__m128i descs[4], uint16_t pkt_type_mask,get_packet_type (3 , pkt_info, etqf_check, tunnel_check); } -/* +/** * vPMD raw receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) * * Notice: * - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan
RTE_IXGBE_MAX_RX_BURST
- * numbers of DD bit
* - floor alignnb_pktsto aRTE_IXGBE_DESC_PER_LOOPpower-of-two */
static inlineuint16_tdrivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +0
-8@@ -344,9 +342,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, __m128i mbuf_init; uint8_t vlan_flags; -/* nb_pkts shall be less equal than RTE_IXGBE_MAX_RX_BURST */ -nb_pkts =RTE_MIN (nb_pkts,RTE_IXGBE_MAX_RX_BURST ); -/* nb_pkts has to be floor-aligned to RTE_IXGBE_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,RTE_IXGBE_DESCS_PER_LOOP );@@ -556,15 +551,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, return nb_pkts_recd; } -/* -* vPMD receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) -* -* Notice: -* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan
RTE_IXGBE_MAX_RX_BURST
- * numbers of DD bit
- * - floor alignnb_pktsto aRTE_IXGBE_DESC_PER_LOOPpower-of-two
- */
uint16_t
ixgbe_recv_pkts_vec(void*rx_queue, structrte_mbuf**rx_pkts,uint16_tnb_pkts) @@ -572,22 +558,19 @@ ixgbe_recv_pkts_vec(void*rx_queue, structrte_mbuf**rx_pkts, return_recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL); }-/*
- * vPMD receive routine that reassembles scattered packets
- *
- * Notice:
- * -nb_pkts<RTE_IXGBE_DESCS_PER_LOOP, just return no packet
- * -nb_pkts>RTE_IXGBE_MAX_RX_BURST, only scanRTE_IXGBE_MAX_RX_BURST
- * numbers of DD bit
- * - floor alignnb_pktsto aRTE_IXGBE_DESC_PER_LOOPpower-of-twodrivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +3
-2+/** +* vPMD receive routine that reassembles single burst of 32 scattered +packets */ -uint16_t -ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, -
uint16_tnb_pkts)drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +31
-1+static uint16_t +ixgbe_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct ixgbe_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_IXGBE_MAX_RX_BURST ] = {0 }; +/* split_flags only can support max of RTE_IXGBE_MAX_RX_BURST */ +nb_pkts =RTE_MIN (nb_pkts,RTE_IXGBE_MAX_RX_BURST ); +/* get some new buffers */ uint16_t nb_bufs =_recv_raw_pkts_vec (rxq, rx_pkts, nb_pkts, split_flags);@@ -615,6 +598,32 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_IXGBE_MAX_RX_BURST ) {uint16_t burst; + +burst =ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_IXGBE_MAX_RX_BURST ); +retval += burst; +nb_pkts -= burst; +if (burst <RTE_IXGBE_MAX_RX_BURST ) +return retval; +} + +return retval +ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void vtx1 (volatile union ixgbe_adv_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags) --2.20.1
PATCH v3 3/5 net/i40e: fix vector rx burst for i40e
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
--- drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/i40e/i40e_rxtx_vec_altivec.c | 64 ++++++++++++++++-------- drivers/net/i40e/i40e_rxtx_vec_avx2.c | 29 ++++++----- drivers/net/i40e/i40e_rxtx_vec_neon.c | 58 +++++++++++++-------- drivers/net/i40e/i40e_rxtx_vec_sse.c | 58 +++++++++++++-------- 5 files changed, 133 insertions(+), 77 deletions(-)
drivers/net/i40e/i40e_rxtx.h +1 -0
@@ -14,6 +14,7 @@#define RTE_I40E_MAX_RX_BURST RTE_I40E_RXQ_REARM_THRESH#define RTE_I40E_TX_MAX_FREE_BUF_SZ 64#define RTE_I40E_DESCS_PER_LOOP 4 +#define RTE_I40E_DESCS_PER_LOOP_AVX 8#define I40E_RXBUF_SZ_1024 1024#define I40E_RXBUF_SZ_2048 2048
drivers/net/i40e/i40e_rxtx_vec_altivec.c +42 -22
98 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx_vec_avx2.c +14 -15
@@ -36,7 +36,7 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) rxq->nb_rx_desc) {__m128i dma_addr0; dma_addr0 =_mm_setzero_si128 (); -for (i =0 ; i <RTE_I40E_DESCS_PER_LOOP ; i++) { +for (i =0 ; i <RTE_I40E_DESCS_PER_LOOP_AVX ; i++) { rxep[i].mbuf = &rxq->fake_mbuf;_mm_store_si128 ((__m128i *)&rxdp[i].read, dma_addr0);
@@ -219,13 +219,18 @@ desc_fdir_processing_32b(volatile union i40e_rx_desc *rxdp,#define PKTLEN_SHIFT 10 -/* Force inline as some compilers will not inline by default. */ +/** +* vPMD raw receive routine, only accept(nb_pkts >= RTE_I40E_DESCS_PER_LOOP_AVX) +* +* Notice: +* - nb_pkts < RTE_I40E_DESCS_PER_LOOP_AVX, just return no packet +* - floor align nb_pkts to a RTE_I40E_DESCS_PER_LOOP_AVX power-of-two +* - force inline as some compilers will not inline by default +*/ static __rte_always_inline uint16_t_recv_raw_pkts_vec_avx2 (struct i40e_rx_queue *rxq,struct rte_mbuf **rx_pkts,uint16_t nb_pkts,uint8_t *split_packet) { -#define RTE_I40E_DESCS_PER_LOOP_AVX 8 -const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);
@@ -729,10 +734,6 @@ _recv_raw_pkts_vec_avx2(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,return received; } -/* -* Notice: -* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet -*/ uint16_t i40e_recv_pkts_vec_avx2 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts)
@@ -740,10 +741,8 @@ i40e_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec_avx2 (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* +/** * vPMD receive routine that reassembles single burst of 32 scattered packets -* Notice: -* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet */ static uint16_t i40e_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -752,6 +751,9 @@ i40e_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,struct i40e_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_I40E_VPMD_RX_BURST ] = {0 }; +/* split_flags only can support max of RTE_I40E_VPMD_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,RTE_I40E_VPMD_RX_BURST ); +/* get some new buffers */ uint16_t nb_bufs =_recv_raw_pkts_vec_avx2 (rxq, rx_pkts, nb_pkts, split_flags);
@@ -781,11 +783,8 @@ i40e_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } -/* +/** * vPMD receive routine that reassembles scattered packets. -* Main receive routine that can handle arbitrary burst sizes -* Notice: -* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet */ uint16_t i40e_recv_scattered_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/i40e/i40e_rxtx_vec_neon.c +38 -20
96 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx_vec_sse.c +38 -20
96 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v3 4/5 net/ice: fix vector rx burst for ice
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
--- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 ++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 56 +++++++++++++++++++---------- 3 files changed, 49 insertions(+), 31 deletions(-)
drivers/net/ice/ice_rxtx.h +1 -0
@@ -35,6 +35,7 @@#define ICE_MAX_RX_BURST ICE_RXQ_REARM_THRESH#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_DESCS_PER_LOOP_AVX 8#define ICE_FDIR_PKT_LEN 512
drivers/net/ice/ice_rxtx_vec_avx2.c +11 -12
@@ -29,7 +29,7 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)__m128i dma_addr0; dma_addr0 =_mm_setzero_si128 (); -for (i =0 ; i <ICE_DESCS_PER_LOOP ; i++) { +for (i =0 ; i <ICE_DESCS_PER_LOOP_AVX ; i++) { rxep[i].mbuf = &rxq->fake_mbuf;_mm_store_si128 ((__m128i *)&rxdp[i].read, dma_addr0);
@@ -132,12 +132,17 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)ICE_PCI_REG_WRITE (rxq->qrx_tail, rx_id); } +/** +* vPMD raw receive routine, only accept(nb_pkts >= ICE_DESCS_PER_LOOP_AVX) +* +* Notice: +* - nb_pkts < ICE_DESCS_PER_LOOP_AVX, just return no packet +* - floor align nb_pkts to a ICE_DESCS_PER_LOOP_AVX power-of-two +*/ static inline uint16_t _ice_recv_raw_pkts_vec_avx2 (struct ice_rx_queue *rxq,struct rte_mbuf **rx_pkts,uint16_t nb_pkts,uint8_t *split_packet) { -#define ICE_DESCS_PER_LOOP_AVX 8 -const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);
@@ -603,10 +608,6 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,return received; } -/** -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -*/ uint16_t ice_recv_pkts_vec_avx2 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts)
@@ -616,8 +617,6 @@ ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles single burst of 32 scattered packets -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */ static uint16_t ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -626,6 +625,9 @@ ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,struct ice_rx_queue *rxq = rx_queue;uint8_t split_flags[ICE_VPMD_RX_BURST ] = {0 }; +/* split_flags only can support max of ICE_VPMD_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,ICE_VPMD_RX_BURST ); +/* get some new buffers */ uint16_t nb_bufs =_ice_recv_raw_pkts_vec_avx2 (rxq, rx_pkts, nb_pkts, split_flags);
@@ -657,9 +659,6 @@ ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles scattered packets. -* Main receive routine that can handle arbitrary burst sizes -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/ice/ice_rxtx_vec_sse.c +37 -19
93 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH v3 4/5] net/ice: fix vector rx burst for ice
-----Original Message-----
From: dev <[email protected]> On Behalf Of Jeff Guo
Sent: Wednesday, September 9, 2020 2:37 PM
To: Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v3 4/5] net/ice: fix vector rx burst for ice
The limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
--- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 ++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 56 +++++++++++++++++++---------- 3 files changed, 49 insertions(+), 31 deletions(-)
drivers/net/ice/ice_rxtx.h +1 -0
@@ -35,6 +35,7 @@#define ICE_MAX_RX_BURST ICE_RXQ_REARM_THRESH#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_DESCS_PER_LOOP_AVX 8#define ICE_FDIR_PKT_LEN 512
drivers/net/ice/ice_rxtx_vec_avx2.c +8 -8
@@ -29,7 +29,7 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)__m128i dma_addr0; dma_addr0 =_mm_setzero_si128 (); -for (i =0 ; i <ICE_DESCS_PER_LOOP ; i++) { +for (i =0 ; i <ICE_DESCS_PER_LOOP_AVX ; i++) { rxep[i].mbuf = &rxq->fake_mbuf;_mm_store_si128 ((__m128i *)&rxdp[i].read, dma_addr0);
@@ -132,12 +132,17 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)ICE_PCI_REG_WRITE (rxq->qrx_tail, rx_id); } +/** +* vPMD raw receive routine, only accept(nb_pkts >= +ICE_DESCS_PER_LOOP_AVX) +* +* Notice: +* - nb_pkts < ICE_DESCS_PER_LOOP_AVX, just return no packet +* - floor align nb_pkts to a ICE_DESCS_PER_LOOP_AVX power-of-two */ static inline uint16_t _ice_recv_raw_pkts_vec_avx2 (struct ice_rx_queue *rxq,struct rte_mbuf **rx_pkts, uint16_t nb_pkts, uint8_t *split_packet) { -#define ICE_DESCS_PER_LOOP_AVX 8 -const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);
@@ -603,10 +608,6 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,return received; } -/** -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -*/ uint16_t ice_recv_pkts_vec_avx2 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts)
@@ -616,8 +617,6 @@ ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles single burst of 32 scattered packets -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */ static uint16_t ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, @@ -626,6 +625,9 @@ ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
struct ice_rx_queue *rxq = rx_queue; uint8_t split_flags[ICE_VPMD_RX_BURST] = {0};
+ /* split_flags only can support max of ICE_VPMD_RX_BURST */
+ nb_pkts = RTE_MIN(nb_pkts, ICE_VPMD_RX_BURST);
+
/* get some new buffers */
uint16_t nb_bufs = _ice_recv_raw_pkts_vec_avx2(rxq, rx_pkts, nb_pkts,
split_flags);
@@ -657,9 +659,6 @@ ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
/**
* vPMD receive routine that reassembles scattered packets.
- * Main receive routine that can handle arbitrary burst sizes
- * Notice:
- * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet
*/
uint16_t
ice_recv_scattered_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, diff --git a/drivers/net/ice/ice_rxtx_vec_sse.c b/drivers/net/ice/ice_rxtx_vec_sse.c
index 382ef31f3..c03e24092 100644
drivers/net/ice/ice_rxtx_vec_sse.c +3 -2
@@ -205,10 +205,11 @@ ice_rx_desc_to_ptype_v(__m128i descs[4], struct rte_mbuf **rx_pkts, }/** +* vPMD raw receive routine, only accept(nb_pkts >= ICE_DESCS_PER_LOOP) +* * Notice: * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST -* numbers of DD bits +* - floor align nb_pkts to a ICE_DESCS_PER_LOOP power-of-two */ static inline uint16_t _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts, @@ -264,9 +265,6 @@ _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts, const __m128i eop_check = _mm_set_epi64x(0x0000000200000002LL,
0x0000000200000002LL);
- /* nb_pkts shall be less equal than ICE_MAX_RX_BURST */
- nb_pkts = RTE_MIN(nb_pkts, ICE_MAX_RX_BURST);
-
/* nb_pkts has to be floor-aligned to ICE_DESCS_PER_LOOP */ nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, ICE_DESCS_PER_LOOP);
@@ -441,12 +439,6 @@ _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,
return nb_pkts_recd;
}
-/**
- * Notice:
- * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet
- * - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST
- * numbers of DD bits
- */
uint16_t
ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts)
@@ -454,19 +446,19 @@ ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
return _ice_recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL); }
-/* vPMD receive routine that reassembles scattered packets
- * Notice:
- * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet
- * - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST
- * numbers of DD bits
+/**
+ * vPMD receive routine that reassembles single burst of 32 scattered +packets
*/
-uint16_t
-ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
+static uint16_t
+ice_recv_scattered_burst_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+ uint16_t nb_pkts)
{
struct ice_rx_queue *rxq = rx_queue;
uint8_t split_flags[ICE_VPMD_RX_BURST] = {0};
+ /* split_flags only can support max of ICE_VPMD_RX_BURST */
+ nb_pkts = RTE_MIN(nb_pkts, ICE_VPMD_RX_BURST);
+
/* get some new buffers */
uint16_t nb_bufs = _ice_recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts,
split_flags);
@@ -496,6 +488,32 @@ ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
&split_flags[i]);
}
+/**
+ * vPMD receive routine that reassembles scattered packets.
+ */
+uint16_t
+ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+ uint16_t nb_pkts)
+{
+ uint16_t retval = 0;
+
+ while (nb_pkts > ICE_VPMD_RX_BURST) {
+ uint16_t burst;
+
+ burst = ice_recv_scattered_burst_vec(rx_queue,
+ rx_pkts + retval,
+ ICE_VPMD_RX_BURST);
+ retval += burst;
+ nb_pkts -= burst;
+ if (burst < ICE_VPMD_RX_BURST)
+ return retval;
+ }
+
+ return retval + ice_recv_scattered_burst_vec(rx_queue,
+ rx_pkts + retval,
+ nb_pkts);
+}
+
static inline void
ice_vtx1(volatile struct ice_tx_desc *txdp, struct rte_mbuf *pkt,
uint64_t flags)
--
2.20.1
PATCH v3 5/5 net/fm10k: fix vector rx burst for fm10k
In reply to Jeff GuoThe scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
--- drivers/net/fm10k/fm10k_rxtx_vec.c | 42 +++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 9 deletions(-)
drivers/net/fm10k/fm10k_rxtx_vec.c +33 -9
@@ -645,25 +645,23 @@ fm10k_reassemble_packets(struct fm10k_rx_queue *rxq,return pkt_idx; } -/* -* vPMD receive routine that reassembles scattered packets +/** +* vPMD receive routine that reassembles single burst of 32 scattered packets * * Notice: * - don't support ol_flags for rss and csum err -* - nb_pkts > RTE_FM10K_MAX_RX_BURST, only scan RTE_FM10K_MAX_RX_BURST -* numbers of DD bit */ -uint16_t -fm10k_recv_scattered_pkts_vec (void *rx_queue, -struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +fm10k_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct fm10k_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_FM10K_MAX_RX_BURST ] = {0 };unsigned i =0 ; -/* Split_flags only can support max of RTE_FM10K_MAX_RX_BURST */ +/* split_flags only can support max of RTE_FM10K_MAX_RX_BURST */ nb_pkts =RTE_MIN (nb_pkts,RTE_FM10K_MAX_RX_BURST ); +/* get some new buffers */ uint16_t nb_bufs =fm10k_recv_raw_pkts_vec (rxq, rx_pkts, nb_pkts, split_flags);
@@ -691,6 +689,32 @@ fm10k_recv_scattered_pkts_vec(void *rx_queue, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +fm10k_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_FM10K_MAX_RX_BURST ) { +uint16_t burst; + + burst =fm10k_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_FM10K_MAX_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <RTE_FM10K_MAX_RX_BURST ) +return retval; + } + +return retval +fm10k_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static const struct fm10k_txq_ops vec_txq_ops = { .reset = fm10k_reset_tx_queue, };
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH v3 0/5] fix vector rx burst for PMDs
In reply to Jeff GuoQuoted 10 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Wednesday, September 9, 2020 14:37
To: Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v3 0/5] fix vector rx burst for PMDs
Quoted 7 lines
The limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf/fm10k PMDs, and also do some code cleaning.
IMO, this can be "enhance the vector ...", but not "fix ...". If "fix", it needs "Fixes:" tags ... ;-)
Quoted 3 lines
--
2.20.1
Re: [dpdk-dev] [PATCH v3 0/5] fix vector rx burst for PMDs
Hi, haiyue
Quoted 29 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Wednesday, September 9, 2020 2:45 PM
To: Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v3 0/5] fix vector rx burst for PMDsQuoted 18 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Wednesday, September 9, 2020 14:37
To: Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v3 0/5] fix vector rx burst for PMDsThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
Quoted 6 lines
Quoted 2 lines
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf/fm10k PMDs, and also do some code cleaning.
IMO, this can be "enhance the vector ...", but not "fix ...". If "fix", it needs "Fixes:" tags ... ;-)
Ok, so I will prefer to use "refine the vector rx burst for PMDs", thanks.
Quoted 4 lines
Quoted 3 lines
--
2.20.1
Re: [dpdk-dev] [PATCH v3 0/5] fix vector rx burst for PMDs
Quoted 42 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Wednesday, September 9, 2020 15:03
To: Wang, Haiyue <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v3 0/5] fix vector rx burst for PMDsHi, haiyue
Quoted 29 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Wednesday, September 9, 2020 2:45 PM
To: Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v3 0/5] fix vector rx burst for PMDsQuoted 18 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Wednesday, September 9, 2020 14:37
To: Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v3 0/5] fix vector rx burst for PMDsThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf/fm10k PMDs, and also do some code cleaning.
IMO, this can be "enhance the vector ...", but not "fix ...". If "fix", it needs "Fixes:" tags ... ;-)
Ok, so I will prefer to use "refine the vector rx burst for PMDs", thanks.
Better than "fix" now.
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
--
2.20.1
Re: [dpdk-dev] [PATCH v3 0/5] fix vector rx burst for PMDs
Quoted 24 lines
From: dev [mailto:[email protected]] On Behalf Of Wang, Haiyue
Sent: Wednesday, September 9, 2020 9:05 AMQuoted 12 lines
From: Guo, Jia <[email protected]>
Sent: Wednesday, September 9, 2020 15:03Hi, haiyue
Quoted 7 lines
From: Wang, Haiyue <[email protected]>
Sent: Wednesday, September 9, 2020 2:45 PMQuoted 4 lines
From: Guo, Jia <[email protected]>
Sent: Wednesday, September 9, 2020 14:37The limitation of burst size in vector rx was removed, since it
should
Quoted 1 line
Quoted 1 line
Quoted 1 line
retrieve as much received packets as possible. And also the
scattered
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf/fm10k PMDs, and also do some code cleaning.
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
IMO, this can be "enhance the vector ...", but not "fix ...". If "fix", it needs "Fixes:" tags ... ;-)
Ok, so I will prefer to use "refine the vector rx burst for PMDs",
thanks.
Better than "fix" now.
It does fix a bug: https://bugs.dpdk.org/show_bug.cgi?id=516
Re: [dpdk-dev] [PATCH v3 0/5] fix vector rx burst for PMDs
Quoted 38 lines
-----Original Message-----
From: Morten Brørup <[email protected]>
Sent: Wednesday, September 9, 2020 15:43
To: Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]
Subject: RE: [dpdk-dev] [PATCH v3 0/5] fix vector rx burst for PMDsQuoted 28 lines
From: dev [mailto:[email protected]] On Behalf Of Wang, Haiyue
Sent: Wednesday, September 9, 2020 9:05 AMQuoted 12 lines
From: Guo, Jia <[email protected]>
Sent: Wednesday, September 9, 2020 15:03Hi, haiyue
Quoted 7 lines
From: Wang, Haiyue <[email protected]>
Sent: Wednesday, September 9, 2020 2:45 PMQuoted 4 lines
From: Guo, Jia <[email protected]>
Sent: Wednesday, September 9, 2020 14:37The limitation of burst size in vector rx was removed, since it
should
Quoted 1 line
Quoted 1 line
Quoted 1 line
retrieve as much received packets as possible. And also the
scattered
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf/fm10k PMDs, and also do some code cleaning.
IMO, this can be "enhance the vector ...", but not "fix ...". If "fix", it needs "Fixes:" tags ... ;-)
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Ok, so I will prefer to use "refine the vector rx burst for PMDs",
thanks.
Better than "fix" now.
It does fix a bug: https://bugs.dpdk.org/show_bug.cgi?id=516
Looks like a backport is needed.
Re: [dpdk-dev] [PATCH v3 0/5] fix vector rx burst for PMDs
Quoted 23 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Wednesday, September 9, 2020 3:55 PM
To: Morten Brørup <[email protected]>; Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]
Subject: RE: [dpdk-dev] [PATCH v3 0/5] fix vector rx burst for PMDsQuoted 11 lines
-----Original Message-----
From: Morten Brørup <[email protected]>
Sent: Wednesday, September 9, 2020 15:43
To: Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected];
Quoted 40 lines
Quoted 38 lines
Subject: RE: [dpdk-dev] [PATCH v3 0/5] fix vector rx burst for PMDs
Quoted 25 lines
From: dev [mailto:[email protected]] On Behalf Of Wang, Haiyue
Sent: Wednesday, September 9, 2020 9:05 AMQuoted 13 lines
From: Guo, Jia <[email protected]>
Sent: Wednesday, September 9, 2020 15:03Hi, haiyue
Quoted 8 lines
From: Wang, Haiyue <[email protected]>
Sent: Wednesday, September 9, 2020 2:45 PMQuoted 5 lines
From: Guo, Jia <[email protected]>
Sent: Wednesday, September 9, 2020 14:37The limitation of burst size in vector rx was removed, since it
should
Quoted 1 line
Quoted 1 line
Quoted 1 line
retrieve as much received packets as possible. And also the
scattered
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf/fm10k PMDs, and also do some code cleaning.
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
IMO, this can be "enhance the vector ...", but not "fix ...". If "fix", it needs "Fixes:" tags ... ;-)
Ok, so I will prefer to use "refine the vector rx burst for PMDs",
thanks.
Better than "fix" now.
It does fix a bug: https://bugs.dpdk.org/show_bug.cgi?id=516
Oh, I missing it, so the Fixed tag and bug info could be expect in commit log in next version. Thanks, morten.
Quoted 2 lines
Looks like a backport is needed.
v4 cover fix vector rx burst for PMDs
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf/fm10k PMDs, and also do some code cleaning.
Bugzilla ID: 516
v4->v3:
add Fixes tag.
v3->v2:
1:move define into header file.
2:delete some useless doc.
v2->v1:
1:add fm10k driver case
2:refine some doc
Jeff Guo (5):
net/iavf: fix vector rx burst for iavf
net/ixgbe: fix vector rx burst for ixgbe
net/i40e: fix vector rx burst for i40e
net/ice: fix vector rx burst for ice
net/fm10k: fix vector rx burst for fm10k
drivers/net/fm10k/fm10k_rxtx_vec.c | 42 ++++++-- drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/i40e/i40e_rxtx_vec_altivec.c | 64 +++++++----- drivers/net/i40e/i40e_rxtx_vec_avx2.c | 29 +++--- drivers/net/i40e/i40e_rxtx_vec_neon.c | 58 +++++++---- drivers/net/i40e/i40e_rxtx_vec_sse.c | 58 +++++++---- drivers/net/iavf/iavf_rxtx.h | 1 + drivers/net/iavf/iavf_rxtx_vec_avx2.c | 78 +++++++-------- drivers/net/iavf/iavf_rxtx_vec_sse.c | 119 +++++++++++++++-------- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 +++-- drivers/net/ice/ice_rxtx_vec_sse.c | 56 +++++++---- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 77 ++++++++------- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 61 +++++++----- 14 files changed, 412 insertions(+), 256 deletions(-)
Signature · 1 line
2.20.1
PATCH v4 1/5 net/iavf: fix vector rx burst for iavf
The limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
Bugzilla ID: 516
--- drivers/net/iavf/iavf_rxtx.h | 1 + drivers/net/iavf/iavf_rxtx_vec_avx2.c | 78 ++++++++--------- drivers/net/iavf/iavf_rxtx_vec_sse.c | 119 ++++++++++++++++++-------- 3 files changed, 121 insertions(+), 77 deletions(-)
drivers/net/iavf/iavf_rxtx.h +1 -0
@@ -21,6 +21,7 @@#define IAVF_VPMD_TX_MAX_BURST 32#define IAVF_RXQ_REARM_THRESH 32#define IAVF_VPMD_DESCS_PER_LOOP 4 +#define IAVF_VPMD_DESCS_PER_LOOP_AVX 8#define IAVF_VPMD_TX_MAX_FREE_BUF 64#define IAVF_NO_VECTOR_FLAGS ( \
drivers/net/iavf/iavf_rxtx_vec_avx2.c +39 -39
214 lines not on this page · raw message
drivers/net/iavf/iavf_rxtx_vec_sse.c +81 -38
188 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 2/5 net/ixgbe: fix vector rx burst for ixgbe
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
Bugzilla ID: 516
--- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 77 +++++++++++++------------ drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 61 +++++++++++--------- 2 files changed, 76 insertions(+), 62 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +41 -36
@@ -130,17 +130,6 @@ desc_to_olflags_v(uint8x16x2_t sterr_tmp1, uint8x16x2_t sterr_tmp2, rx_pkts[3 ]->ol_flags = vol.e[3 ]; } -/* -* vPMD raw receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) -* -* Notice: -* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan RTE_IXGBE_MAX_RX_BURST -* numbers of DD bit -* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two -* - don't support ol_flags for rss and csum err -*/ -#define IXGBE_VPMD_DESC_EOP_MASK 0x02020202#define IXGBE_UINT8_BIT (CHAR_BIT * sizeof(uint8_t))
@@ -206,6 +195,13 @@ desc_to_ptype_v(uint64x2_t descs[4], uint16_t pkt_type_mask, vgetq_lane_u32(tunnel_check, 3)); } +/** +* vPMD raw receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) +* +* Notice: +* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet +* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two +*/ static inline uint16_t _recv_raw_pkts_vec (struct ixgbe_rx_queue *rxq,struct rte_mbuf **rx_pkts,uint16_t nb_pkts,uint8_t *split_packet)
@@ -226,9 +222,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,uint16x8_t crc_adjust = {0 ,0 , rxq->crc_len,0 , rxq->crc_len,0 ,0 ,0 }; -/* nb_pkts shall be less equal than RTE_IXGBE_MAX_RX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,RTE_IXGBE_MAX_RX_BURST ); -/* nb_pkts has to be floor-aligned to RTE_IXGBE_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,RTE_IXGBE_DESCS_PER_LOOP );
@@ -382,16 +375,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,return nb_pkts_recd; } -/* -* vPMD receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) -* -* Notice: -* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan RTE_IXGBE_MAX_RX_BURST -* numbers of DD bit -* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two -* - don't support ol_flags for rss and csum err -*/ uint16_t ixgbe_recv_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts)
@@ -399,23 +382,19 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* -* vPMD receive routine that reassembles scattered packets -* -* Notice: -* - don't support ol_flags for rss and csum err -* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan RTE_IXGBE_MAX_RX_BURST -* numbers of DD bit -* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two +/** +* vPMD receive routine that reassembles single burst of 32 scattered packets */ -uint16_t -ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +ixgbe_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct ixgbe_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_IXGBE_MAX_RX_BURST ] = {0 }; +/* split_flags only can support max of RTE_IXGBE_MAX_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,RTE_IXGBE_MAX_RX_BURST ); +/* get some new buffers */ uint16_t nb_bufs =_recv_raw_pkts_vec (rxq, rx_pkts, nb_pkts, split_flags);
@@ -443,6 +422,32 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_IXGBE_MAX_RX_BURST ) { +uint16_t burst; + + burst =ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_IXGBE_MAX_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <RTE_IXGBE_MAX_RX_BURST ) +return retval; + } + +return retval +ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void vtx1 (volatile union ixgbe_adv_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags)
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +35 -26
100 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 3/5 net/i40e: fix vector rx burst for i40e
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
Bugzilla ID: 516
--- drivers/net/i40e/i40e_rxtx.h | 1 + drivers/net/i40e/i40e_rxtx_vec_altivec.c | 64 ++++++++++++++++-------- drivers/net/i40e/i40e_rxtx_vec_avx2.c | 29 ++++++----- drivers/net/i40e/i40e_rxtx_vec_neon.c | 58 +++++++++++++-------- drivers/net/i40e/i40e_rxtx_vec_sse.c | 58 +++++++++++++-------- 5 files changed, 133 insertions(+), 77 deletions(-)
drivers/net/i40e/i40e_rxtx.h +1 -0
@@ -14,6 +14,7 @@#define RTE_I40E_MAX_RX_BURST RTE_I40E_RXQ_REARM_THRESH#define RTE_I40E_TX_MAX_FREE_BUF_SZ 64#define RTE_I40E_DESCS_PER_LOOP 4 +#define RTE_I40E_DESCS_PER_LOOP_AVX 8#define I40E_RXBUF_SZ_1024 1024#define I40E_RXBUF_SZ_2048 2048
drivers/net/i40e/i40e_rxtx_vec_altivec.c +42 -22
98 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx_vec_avx2.c +14 -15
@@ -36,7 +36,7 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) rxq->nb_rx_desc) {__m128i dma_addr0; dma_addr0 =_mm_setzero_si128 (); -for (i =0 ; i <RTE_I40E_DESCS_PER_LOOP ; i++) { +for (i =0 ; i <RTE_I40E_DESCS_PER_LOOP_AVX ; i++) { rxep[i].mbuf = &rxq->fake_mbuf;_mm_store_si128 ((__m128i *)&rxdp[i].read, dma_addr0);
@@ -219,13 +219,18 @@ desc_fdir_processing_32b(volatile union i40e_rx_desc *rxdp,#define PKTLEN_SHIFT 10 -/* Force inline as some compilers will not inline by default. */ +/** +* vPMD raw receive routine, only accept(nb_pkts >= RTE_I40E_DESCS_PER_LOOP_AVX) +* +* Notice: +* - nb_pkts < RTE_I40E_DESCS_PER_LOOP_AVX, just return no packet +* - floor align nb_pkts to a RTE_I40E_DESCS_PER_LOOP_AVX power-of-two +* - force inline as some compilers will not inline by default +*/ static __rte_always_inline uint16_t_recv_raw_pkts_vec_avx2 (struct i40e_rx_queue *rxq,struct rte_mbuf **rx_pkts,uint16_t nb_pkts,uint8_t *split_packet) { -#define RTE_I40E_DESCS_PER_LOOP_AVX 8 -const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);
@@ -729,10 +734,6 @@ _recv_raw_pkts_vec_avx2(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,return received; } -/* -* Notice: -* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet -*/ uint16_t i40e_recv_pkts_vec_avx2 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts)
@@ -740,10 +741,8 @@ i40e_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec_avx2 (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* +/** * vPMD receive routine that reassembles single burst of 32 scattered packets -* Notice: -* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet */ static uint16_t i40e_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -752,6 +751,9 @@ i40e_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,struct i40e_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_I40E_VPMD_RX_BURST ] = {0 }; +/* split_flags only can support max of RTE_I40E_VPMD_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,RTE_I40E_VPMD_RX_BURST ); +/* get some new buffers */ uint16_t nb_bufs =_recv_raw_pkts_vec_avx2 (rxq, rx_pkts, nb_pkts, split_flags);
@@ -781,11 +783,8 @@ i40e_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } -/* +/** * vPMD receive routine that reassembles scattered packets. -* Main receive routine that can handle arbitrary burst sizes -* Notice: -* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet */ uint16_t i40e_recv_scattered_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/i40e/i40e_rxtx_vec_neon.c +38 -20
96 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx_vec_sse.c +38 -20
96 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 4/5 net/ice: fix vector rx burst for ice
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
Bugzilla ID: 516
--- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 ++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 56 +++++++++++++++++++---------- 3 files changed, 49 insertions(+), 31 deletions(-)
drivers/net/ice/ice_rxtx.h +1 -0
@@ -35,6 +35,7 @@#define ICE_MAX_RX_BURST ICE_RXQ_REARM_THRESH#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_DESCS_PER_LOOP_AVX 8#define ICE_FDIR_PKT_LEN 512
drivers/net/ice/ice_rxtx_vec_avx2.c +11 -12
@@ -29,7 +29,7 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)__m128i dma_addr0; dma_addr0 =_mm_setzero_si128 (); -for (i =0 ; i <ICE_DESCS_PER_LOOP ; i++) { +for (i =0 ; i <ICE_DESCS_PER_LOOP_AVX ; i++) { rxep[i].mbuf = &rxq->fake_mbuf;_mm_store_si128 ((__m128i *)&rxdp[i].read, dma_addr0);
@@ -132,12 +132,17 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)ICE_PCI_REG_WRITE (rxq->qrx_tail, rx_id); } +/** +* vPMD raw receive routine, only accept(nb_pkts >= ICE_DESCS_PER_LOOP_AVX) +* +* Notice: +* - nb_pkts < ICE_DESCS_PER_LOOP_AVX, just return no packet +* - floor align nb_pkts to a ICE_DESCS_PER_LOOP_AVX power-of-two +*/ static inline uint16_t _ice_recv_raw_pkts_vec_avx2 (struct ice_rx_queue *rxq,struct rte_mbuf **rx_pkts,uint16_t nb_pkts,uint8_t *split_packet) { -#define ICE_DESCS_PER_LOOP_AVX 8 -const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);
@@ -603,10 +608,6 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,return received; } -/** -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -*/ uint16_t ice_recv_pkts_vec_avx2 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts)
@@ -616,8 +617,6 @@ ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles single burst of 32 scattered packets -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */ static uint16_t ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -626,6 +625,9 @@ ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,struct ice_rx_queue *rxq = rx_queue;uint8_t split_flags[ICE_VPMD_RX_BURST ] = {0 }; +/* split_flags only can support max of ICE_VPMD_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,ICE_VPMD_RX_BURST ); +/* get some new buffers */ uint16_t nb_bufs =_ice_recv_raw_pkts_vec_avx2 (rxq, rx_pkts, nb_pkts, split_flags);
@@ -657,9 +659,6 @@ ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles scattered packets. -* Main receive routine that can handle arbitrary burst sizes -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/ice/ice_rxtx_vec_sse.c +37 -19
93 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH v4 4/5] net/ice: fix vector rx burst for ice
Quoted 37 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Thursday, September 17, 2020 3:59 PM
To: Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: [PATCH v4 4/5] net/ice: fix vector rx burst for iceThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
Bugzilla ID: 516
Fixes c68a52b8b38c ("net/ice: support vector SSE in Rx")Fixes ae60d3c9b227 ("net/ice: support Rx AVX2 vector")Signed-off-by Jeff Guo <[email protected]>Tested-by Yingya Han <[email protected]>--- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 ++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 56 +++++++++++++++++++---------- 3 files changed, 49 insertions(+), 31 deletions(-)drivers/net/ice/ice_rxtx.h index renamed from drivers/net/ice/ice_rxtx.h +0
-0
2fdcfb7d0..3ef5f300d100644
drivers/net/ice/ice_rxtx.h line 38
Quoted 4 lines
drivers/net/ice/ice_rxtx.h +1
-0@@ -35,6 +35,7 @@#define ICE_MAX_RX_BURST ICE_RXQ_REARM_THRESH#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_DESCS_PER_LOOP_AVX 8
No need to expose this if no external link, better to keep all avx stuff inside avx.c
Quoted 18 lines
drivers/net/ice/ice_rxtx.h +0
-0#define ICE_FDIR_PKT_LEN 512drivers/net/ice/ice_rxtx_vec_avx2.c +1
-1@@ -29,7 +29,7 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)__m128i dma_addr0; dma_addr0 =_mm_setzero_si128 (); -for (i =0 ; i <ICE_DESCS_PER_LOOP ; i++) { +for (i =0 ; i <ICE_DESCS_PER_LOOP_AVX ; i++) { rxep[i].mbuf = &rxq->fake_mbuf;_mm_store_si128 ((__m128i *)&rxdp[i].read, dma_addr0);
drivers/net/ice/ice_rxtx_vec_avx2.c ice_rxq_rearm(struct ice_rx_queue *rxq) · line 140
Quoted 9 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +7
-0@@ -132,12 +132,17 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)ICE_PCI_REG_WRITE (rxq->qrx_tail, rx_id); } +/** +* vPMD raw receive routine, only accept(nb_pkts >= +ICE_DESCS_PER_LOOP_AVX) +* +* Notice: +* - nb_pkts < ICE_DESCS_PER_LOOP_AVX, just return no packet +* - floor align nb_pkts to a ICE_DESCS_PER_LOOP_AVX power-of-two */
The comment is misleading, it looks like we are going to floor align nb_pkts to 2^8, better to reword .
Quoted 26 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0static inline uint16_t _ice_recv_raw_pkts_vec_avx2 (struct ice_rx_queue *rxq,struct rte_mbuf **rx_pkts, uint16_t nb_pkts, uint8_t *split_packet) { -#define
ICE_DESCS_PER_LOOP_AVX8drivers/net/ice/ice_rxtx_vec_avx2.c +0
-5-const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);@@ -603,10 +608,6 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts, return received; } -/* -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -*/ uint16_t ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0uint16_t nb_pkts)@@ -616,8 +617,6 @@ ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles single burst of 32 scattered
Quoted 4 lines
packets
- * Notice:
- * -nb_pkts<ICE_DESCS_PER_LOOP, just return no packet */
Why we need to remove this? is it still true for this function?
drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, · line 629
Quoted 9 lines
static
uint16_t
ice_recv_scattered_burst_vec_avx2(void*rx_queue, structrte_mbuf
**rx_pkts, @@ -626,6 +625,9 @@ ice_recv_scattered_burst_vec_avx2(void*rx_queue, structrte_mbuf**rx_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c +2
-0struct ice_rx_queue *rxq = rx_queue;uint8_t split_flags[ICE_VPMD_RX_BURST ] = {0 }; +/* split_flags only can support max of ICE_VPMD_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,ICE_VPMD_RX_BURST );
Is this necessary? the only consumer of this function is ice_recv_scattered_pkts_vec_avx2, I think nb_pkts <= ICE_VPMD_RX_BURST it already be guaranteed.
drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void *rx_queue, · line 663
Quoted 13 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +1
-3+/* get some new buffers */ uint16_t nb_bufs =_ice_recv_raw_pkts_vec_avx2 (rxq, rx_pkts, nb_pkts, split_flags);@@ -657,9 +659,6 @@ ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles scattered packets. -* Main receive routine that can handle arbitrary burst sizes -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */
Why we need to remove this? isn't it the main routine that be able to handle arbitrary burst size?
Btw, I will suggest all AVX2 changes can be in a separate patch, because this looks like some code clean and fix. its not related with the main purpose of the patch set.
Re: [dpdk-dev] [PATCH v4 4/5] net/ice: fix vector rx burst for ice
Hi, qi
Quoted 46 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, September 17, 2020 7:03 PM
To: Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: RE: [PATCH v4 4/5] net/ice: fix vector rx burst for iceQuoted 31 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Thursday, September 17, 2020 3:59 PM
To: Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: [PATCH v4 4/5] net/ice: fix vector rx burst for iceThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
Bugzilla ID: 516
Fixes c68a52b8b38c ("net/ice: support vector SSE in Rx")Fixes ae60d3c9b227 ("net/ice: support Rx AVX2 vector")Signed-off-by Jeff Guo <[email protected]>Tested-by Yingya Han <[email protected]>--- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 ++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 56 +++++++++++++++++++---------- 3 files changed, 49 insertions(+), 31 deletions(-)
Quoted 13 lines
drivers/net/ice/ice_rxtx.h line 38
Quoted 9 lines
drivers/net/ice/ice_rxtx.h +1
-0@@ -35,6 +35,7 @@#define ICE_MAX_RX_BURST ICE_RXQ_REARM_THRESH#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_DESCS_PER_LOOP_AVX 8No need to expose this if no external link, better to keep all avx stuff inside
avx.c
Ok, so define it in avx.c is the best choice if avx should not in rxtx.h.
Quoted 20 lines
Quoted 20 lines
drivers/net/ice/ice_rxtx.h +0
-0#define ICE_FDIR_PKT_LEN 512drivers/net/ice/ice_rxtx_vec_avx2.c +1
-1@@ -29,7 +29,7 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)__m128i dma_addr0; dma_addr0 =_mm_setzero_si128 (); -for (i =0 ; i <ICE_DESCS_PER_LOOP ; i++) { +for (i =0 ; i <ICE_DESCS_PER_LOOP_AVX ; i++) { rxep[i].mbuf = &rxq->fake_mbuf;_mm_store_si128 ((__m128i *)&rxdp[i].read, dma_addr0);@@ -132,12 +132,17 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)ICE_PCI_REG_WRITE (rxq->qrx_tail, rx_id); }
Quoted 11 lines
drivers/net/ice/ice_rxtx_vec_avx2.c ice_rxq_rearm(struct ice_rx_queue *rxq)
Quoted 7 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +7
-0+/** +* vPMD raw receive routine, only accept(nb_pkts >= +ICE_DESCS_PER_LOOP_AVX) +* +* Notice: +* - nb_pkts < ICE_DESCS_PER_LOOP_AVX, just return no packet +* - floor align nb_pkts to a ICE_DESCS_PER_LOOP_AVX power-of-two */ The comment is misleading, it looks like we are going to floor align
nb_pktsto 2^8, better to reword .
It should be, agree.
Quoted 25 lines
drivers/net/ice/ice_rxtx_vec_avx2.c _ice_recv_raw_pkts_vec_avx2(struct
Quoted 10 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0static inline uint16_t _ice_recv_raw_pkts_vec_avx2 (struct ice_rx_queue *rxq,struct rte_mbuf **rx_pkts, uint16_t nb_pkts, uint8_t *split_packet) { -#define
ICE_DESCS_PER_LOOP_AVX8drivers/net/ice/ice_rxtx_vec_avx2.c +0
-1-const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);@@ -603,10 +608,6 @@ _ice_recv_raw_pkts_vec_avx2(struct
ice_rx_queueQuoted 14 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-4*rxq, struct rte_mbuf **rx_pkts, return received; } -/* -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -*/ uint16_t ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0uint16_t nb_pkts)@@ -616,8 +617,6 @@ ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
Quoted 9 lines
Quoted 6 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0/** * vPMD receive routine that reassembles single burst of 32 scattered packets
- * Notice:
- * -nb_pkts<ICE_DESCS_PER_LOOP, just return no packet */Why we need to remove this? is it still true for this function?
The reason is that this comment is in the calling function " _ice_recv_raw_pkts_vec_avx2" which process the related thing, no need to add it more and more in the caller function.
Quoted 8 lines
Quoted 3 lines
static
uint16_t
ice_recv_scattered_burst_vec_avx2(void*rx_queue, structrte_mbuf
**rx_pkts, @@ -626,6 +625,9 @@ice_recv_scattered_burst_vec_avx2(void
Quoted 4 lines
*rx_queue, structrte_mbuf**rx_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0struct ice_rx_queue *rxq = rx_queue;uint8_t split_flags[ICE_VPMD_RX_BURST ] = {0 };
Quoted 6 lines
drivers/net/ice/ice_rxtx_vec_avx2.c
Quoted 2 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +2
-0+/* split_flags only can support max of ICE_VPMD_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,ICE_VPMD_RX_BURST );Is this necessary? the only consumer of this function is
ice_recv_scattered_pkts_vec_avx2, I thinknb_pkts<=ICE_VPMD_RX_BURSTit already be guaranteed.
The reason is that we remove "nb_pkts <= ICE_VPMD_RX_BURST" and in this function split_flags have a limit for ICE_VPMD_RX_BURST, so a checking is need in the function.
Quoted 16 lines
drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
Quoted 3 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +1
-0+/* get some new buffers */ uint16_t nb_bufs = _ice_recv_raw_pkts_vec_avx2(rxq, rx_pkts,
nb_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void
Quoted 2 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0split_flags);@@ -657,9 +659,6 @@ ice_recv_scattered_burst_vec_avx2(void
*rx_queue,drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, · line 662
Quoted 8 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-3struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles scattered packets. -* Main receive routine that can handle arbitrary burst sizes -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */
Quoted 3 lines
Why we need to remove this? isn't it the main routine that be able to handle arbitrary burst size?
The question is why we need to said the arbitrary sizes if we process and return what we could receive packet for maximum? It is not only useless comment but also maybe bring some confuse I think.
Quoted 3 lines
Btw, I will suggest all AVX2 changes can be in a separate patch, because this looks like some code clean and fix.
its not related with the main purpose of the patch set.
I consider it and ask any objection before, so totally I am not disagree on separate it, but I think if the purpose of the patch set is to clean some misleading for vec(sse/avx) burst, it could still be on a set even separate it to patch.
Re: [dpdk-dev] [PATCH v4 4/5] net/ice: fix vector rx burst for ice
Quoted 151 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Friday, September 18, 2020 11:20 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: RE: [PATCH v4 4/5] net/ice: fix vector rx burst for iceHi, qi
Quoted 48 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, September 17, 2020 7:03 PM
To: Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: RE: [PATCH v4 4/5] net/ice: fix vector rx burst for iceQuoted 33 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Thursday, September 17, 2020 3:59 PM
To: Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: [PATCH v4 4/5] net/ice: fix vector rx burst for iceThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
Bugzilla ID: 516
Fixes c68a52b8b38c ("net/ice: support vector SSE in Rx")Fixes ae60d3c9b227 ("net/ice: support Rx AVX2 vector")Signed-off-by Jeff Guo <[email protected]>Tested-by Yingya Han <[email protected]>--- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 ++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 56 +++++++++++++++++++---------- 3 files changed, 49 insertions(+), 31 deletions(-)Quoted 13 lines
drivers/net/ice/ice_rxtx.h line 38
Quoted 9 lines
drivers/net/ice/ice_rxtx.h +1
-0@@ -35,6 +35,7 @@#define ICE_MAX_RX_BURST ICE_RXQ_REARM_THRESH#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_DESCS_PER_LOOP_AVX 8No need to expose this if no external link, better to keep all avx stuff inside
avx.cOk, so define it in
avx.cis the best choice if avx should not inrxtx.h.Quoted 20 lines
Quoted 20 lines
drivers/net/ice/ice_rxtx.h +0
-0#define ICE_FDIR_PKT_LEN 512drivers/net/ice/ice_rxtx_vec_avx2.c +1
-1@@ -29,7 +29,7 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)__m128i dma_addr0; dma_addr0 =_mm_setzero_si128 (); -for (i =0 ; i <ICE_DESCS_PER_LOOP ; i++) { +for (i =0 ; i <ICE_DESCS_PER_LOOP_AVX ; i++) { rxep[i].mbuf = &rxq->fake_mbuf;_mm_store_si128 ((__m128i *)&rxdp[i].read, dma_addr0);@@ -132,12 +132,17 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)ICE_PCI_REG_WRITE (rxq->qrx_tail, rx_id); }Quoted 12 lines
drivers/net/ice/ice_rxtx_vec_avx2.c ice_rxq_rearm(struct ice_rx_queue *rxq) · line 141
Quoted 8 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +8
-0+/** +* vPMD raw receive routine, only accept(nb_pkts >= +ICE_DESCS_PER_LOOP_AVX) +* +* Notice: +* - nb_pkts < ICE_DESCS_PER_LOOP_AVX, just return no packet +* - floor align nb_pkts to a ICE_DESCS_PER_LOOP_AVX power-of-two +*/ The comment is misleading, it looks like we are going to floor align
nb_pktsto 2^8, better to reword .It should be, agree.
Quoted 25 lines
drivers/net/ice/ice_rxtx_vec_avx2.c _ice_recv_raw_pkts_vec_avx2(struct
Quoted 10 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0static inline uint16_t _ice_recv_raw_pkts_vec_avx2 (struct ice_rx_queue *rxq,struct rte_mbuf **rx_pkts, uint16_t nb_pkts, uint8_t *split_packet) { -#define
ICE_DESCS_PER_LOOP_AVX8drivers/net/ice/ice_rxtx_vec_avx2.c +0
-1-const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);@@ -603,10 +608,6 @@ _ice_recv_raw_pkts_vec_avx2(struct
ice_rx_queueQuoted 14 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-4*rxq, struct rte_mbuf **rx_pkts, return received; } -/* -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -*/ uint16_t ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0uint16_t nb_pkts)@@ -616,8 +617,6 @@ ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,Quoted 9 lines
Quoted 6 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0/** * vPMD receive routine that reassembles single burst of 32 scattered packets
- * Notice:
- * -nb_pkts<ICE_DESCS_PER_LOOP, just return no packet */Why we need to remove this? is it still true for this function?
Quoted 3 lines
The reason is that this comment is in the calling function "
_ice_recv_raw_pkts_vec_avx2" which process the related thing, no need to add it more and more in the caller function.
I think you remove related comment from the calling function also :)
Also I think better to keep this even it's a little bit duplicate, that help people to understand the internal logic
Quoted 16 lines
Quoted 9 lines
Quoted 4 lines
static
uint16_t
ice_recv_scattered_burst_vec_avx2(void*rx_queue, structrte_mbuf
**rx_pkts, @@ -626,6 +625,9 @@ice_recv_scattered_burst_vec_avx2(void
Quoted 4 lines
*rx_queue, structrte_mbuf**rx_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0struct ice_rx_queue *rxq = rx_queue;uint8_t split_flags[ICE_VPMD_RX_BURST ] = {0 };Quoted 6 lines
drivers/net/ice/ice_rxtx_vec_avx2.c
Quoted 2 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +2
-0+/* split_flags only can support max of ICE_VPMD_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,ICE_VPMD_RX_BURST );Is this necessary? the only consumer of this function is
ice_recv_scattered_pkts_vec_avx2, I thinknb_pkts<=ICE_VPMD_RX_BURSTit already be guaranteed.
Quoted 3 lines
The reason is that we remove "
nb_pkts<=ICE_VPMD_RX_BURST" and in this functionsplit_flagshave a limit forICE_VPMD_RX_BURST, so a checking is need in the function.
Can't get this, could tell me is there any case that nb_pkts > ICE_VPMD_RX_BURST?
Quoted 17 lines
Quoted 17 lines
drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
Quoted 4 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +1
-0+/* get some new buffers */ uint16_t nb_bufs = _ice_recv_raw_pkts_vec_avx2(rxq, rx_pkts,
nb_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void
Quoted 2 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0split_flags);@@ -657,9 +659,6 @@ ice_recv_scattered_burst_vec_avx2(void
*rx_queue,Quoted 8 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-3struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles scattered packets. -* Main receive routine that can handle arbitrary burst sizes -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */
Quoted 7 lines
Quoted 3 lines
Why we need to remove this? isn't it the main routine that be able to handle arbitrary burst size?
The question is why we need to said the arbitrary sizes if we process and return what we could receive packet for maximum? It is not only useless comment but also maybe bring some confuse I think.
Yes arbitrary size description can be removed, as this is assumed to be the default behavior. But the description for nb_pkts should still be kept.
Quoted 9 lines
Quoted 4 lines
Btw, I will suggest all AVX2 changes can be in a separate patch, because this looks like some code clean and fix.
its not related with the main purpose of the patch set.I consider it and ask any objection before, so totally I am not disagree on separate it, but I think if the purpose of the patch set is to clean some misleading for vec(sse/avx) burst, it could still be on a set even separate it to patch.
I will not be insist on patch separate, but if you separate them, some of fixes can be merged early and no need to wait for those part need more review.
Re: [dpdk-dev] [PATCH v4 4/5] net/ice: fix vector rx burst for ice
Quoted 193 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Friday, September 18, 2020 11:41 AM
To: Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: RE: [PATCH v4 4/5] net/ice: fix vector rx burst for iceQuoted 10 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Friday, September 18, 2020 11:20 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected];Quoted 40 lines
Han, YingyaX <[email protected]>
Subject: RE: [PATCH v4 4/5] net/ice: fix vector rx burst for iceHi, qi
Quoted 35 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, September 17, 2020 7:03 PM
To: Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: RE: [PATCH v4 4/5] net/ice: fix vector rx burst for iceQuoted 19 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Thursday, September 17, 2020 3:59 PM
To: Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: [PATCH v4 4/5] net/ice: fix vector rx burst for iceThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx
path.
Quoted 100 lines
Quoted 14 lines
Quoted 14 lines
Bugzilla ID: 516
Fixes c68a52b8b38c ("net/ice: support vector SSE in Rx")Fixes ae60d3c9b227 ("net/ice: support Rx AVX2 vector")Signed-off-by Jeff Guo <[email protected]>Tested-by Yingya Han <[email protected]>--- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 ++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 56 +++++++++++++++++++---------- 3 files changed, 49 insertions(+), 31 deletions(-)Quoted 13 lines
drivers/net/ice/ice_rxtx.h line 38
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/net/ice/ice_rxtx.hindex2fdcfb7d0..3ef5f300d100644drivers/net/ice/ice_rxtx.h +1
-0@@ -35,6 +35,7 @@#define ICE_MAX_RX_BURST ICE_RXQ_REARM_THRESH#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_DESCS_PER_LOOP_AVX 8No need to expose this if no external link, better to keep all avx stuff inside
avx.cOk, so define it in
avx.cis the best choice if avx should not inrxtx.h.Quoted 20 lines
Quoted 20 lines
drivers/net/ice/ice_rxtx.h +0
-0#define ICE_FDIR_PKT_LEN 512drivers/net/ice/ice_rxtx_vec_avx2.c +1
-1@@ -29,7 +29,7 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)__m128i dma_addr0; dma_addr0 =_mm_setzero_si128 (); -for (i =0 ; i <ICE_DESCS_PER_LOOP ; i++) { +for (i =0 ; i <ICE_DESCS_PER_LOOP_AVX ; i++) { rxep[i].mbuf = &rxq->fake_mbuf;_mm_store_si128 ((__m128i *)&rxdp[i].read, dma_addr0);@@ -132,12 +132,17 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)ICE_PCI_REG_WRITE (rxq->qrx_tail, rx_id); }Quoted 12 lines
drivers/net/ice/ice_rxtx_vec_avx2.c ice_rxq_rearm(struct ice_rx_queue *rxq) · line 141
Quoted 8 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +8
-0+/** +* vPMD raw receive routine, only accept(nb_pkts >= +ICE_DESCS_PER_LOOP_AVX) +* +* Notice: +* - nb_pkts < ICE_DESCS_PER_LOOP_AVX, just return no packet +* - floor align nb_pkts to a ICE_DESCS_PER_LOOP_AVX power-of-two +*/ The comment is misleading, it looks like we are going to floor align
nb_pktsto 2^8, better to reword .It should be, agree.
Quoted 25 lines
drivers/net/ice/ice_rxtx_vec_avx2.c _ice_recv_raw_pkts_vec_avx2(struct
Quoted 10 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0static inline uint16_t _ice_recv_raw_pkts_vec_avx2 (struct ice_rx_queue *rxq,struct rte_mbuf **rx_pkts, uint16_t nb_pkts, uint8_t *split_packet) { -#define
ICE_DESCS_PER_LOOP_AVX8drivers/net/ice/ice_rxtx_vec_avx2.c +0
-1-const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);@@ -603,10 +608,6 @@ _ice_recv_raw_pkts_vec_avx2(struct
ice_rx_queueQuoted 14 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-4*rxq, struct rte_mbuf **rx_pkts, return received; } -/* -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -*/ uint16_t ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0uint16_t nb_pkts)@@ -616,8 +617,6 @@ ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,Quoted 9 lines
Quoted 6 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0/** * vPMD receive routine that reassembles single burst of 32 scattered packets
- * Notice:
- * -nb_pkts<ICE_DESCS_PER_LOOP, just return no packet */Why we need to remove this? is it still true for this function?
Quoted 3 lines
The reason is that this comment is in the calling function "
_ice_recv_raw_pkts_vec_avx2" which process the related thing, no need to add it more and more in the caller function.I think you remove related comment from the calling function also :)
Also I think better to keep this even it's a little bit duplicate, that help people to understand the internal logic
Quoted 16 lines
Quoted 15 lines
Quoted 4 lines
static
uint16_t
ice_recv_scattered_burst_vec_avx2(void*rx_queue, structrte_mbuf
**rx_pkts, @@ -626,6 +625,9 @@ice_recv_scattered_burst_vec_avx2(void
drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, · line 629
Quoted 6 lines
*rx_queue, structrte_mbuf**rx_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c +2
-0struct ice_rx_queue *rxq = rx_queue;uint8_t split_flags[ICE_VPMD_RX_BURST ] = {0 }; +/* split_flags only can support max of ICE_VPMD_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,ICE_VPMD_RX_BURST );Is this necessary? the only consumer of this function is
ice_recv_scattered_pkts_vec_avx2, I thinknb_pkts<=ICE_VPMD_RX_BURSTit already be guaranteed.
Quoted 7 lines
Quoted 3 lines
The reason is that we remove "
nb_pkts<=ICE_VPMD_RX_BURST" and in this functionsplit_flagshave a limit forICE_VPMD_RX_BURST, so a checking is need in the function.Can't get this, could tell me is there any case that
nb_pkts>ICE_VPMD_RX_BURST?
I know we just set the hard value here and only one case usage, but I think only the caller know what would be the input param, but the calling should not know the input param will be, even there is no any caller but the calling still need to be complete.
Quoted 35 lines
Quoted 18 lines
Quoted 18 lines
drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
Quoted 5 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +1
-0+/* get some new buffers */ uint16_t nb_bufs = _ice_recv_raw_pkts_vec_avx2(rxq, rx_pkts,
nb_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void
Quoted 2 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0split_flags);@@ -657,9 +659,6 @@ ice_recv_scattered_burst_vec_avx2(void
*rx_queue,Quoted 8 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-3struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles scattered packets. -* Main receive routine that can handle arbitrary burst sizes -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */ Quoted 7 lines
Quoted 3 lines
Why we need to remove this? isn't it the main routine that be able to handle arbitrary burst size?
The question is why we need to said the arbitrary sizes if we process and return what we could receive packet for maximum? It is not only useless comment but also maybe bring some confuse I think.
Yes arbitrary size description can be removed, as this is assumed to be the default behavior.
But the description fornb_pktsshould still be kept.Quoted 5 lines
Quoted 4 lines
Btw, I will suggest all AVX2 changes can be in a separate patch, because this looks like some code clean and fix.
its not related with the main purpose of the patch set.
Quoted 7 lines
Quoted 4 lines
I consider it and ask any objection before, so totally I am not disagree on separate it, but I think if the purpose of the patch set is to clean some misleading for vec(sse/avx) burst, it could still be on a set even separate it to patch.
I will not be insist on patch separate, but if you separate them, some of fixes can be merged early and no need to wait for those part need more review.
Ok, seems that there still something discuss on the code cleaning patch, let me separate it for better review.
Re: [dpdk-dev] [PATCH v4 4/5] net/ice: fix vector rx burst for ice
Quoted 215 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Friday, September 18, 2020 12:41 PM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: RE: [PATCH v4 4/5] net/ice: fix vector rx burst for iceQuoted 83 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Friday, September 18, 2020 11:41 AM
To: Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: RE: [PATCH v4 4/5] net/ice: fix vector rx burst for iceQuoted 11 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Friday, September 18, 2020 11:20 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected];Quoted 41 lines
Han, YingyaX <[email protected]>
Subject: RE: [PATCH v4 4/5] net/ice: fix vector rx burst for iceHi, qi
Quoted 36 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, September 17, 2020 7:03 PM
To: Guo, Jia <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: RE: [PATCH v4 4/5] net/ice: fix vector rx burst for iceQuoted 20 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Thursday, September 17, 2020 3:59 PM
To: Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Wang, Haiyue <[email protected]>
Cc: Zhao1, Wei <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; Han, YingyaX <[email protected]>
Subject: [PATCH v4 4/5] net/ice: fix vector rx burst for iceThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx
path.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Bugzilla ID: 516
Fixes c68a52b8b38c ("net/ice: support vector SSE in Rx")Fixes ae60d3c9b227 ("net/ice: support Rx AVX2 vector")Signed-off-by Jeff Guo <[email protected]>Tested-by Yingya Han <[email protected]>--- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 ++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 56 +++++++++++++++++++---------- 3 files changed, 49 insertions(+), 31 deletions(-)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/net/ice/ice_rxtx.h line 35
Quoted 6 lines
(quoted diff) +0
-0
b/drivers/net/ice/ice_rxtx.hindex2fdcfb7d0..3ef5f300d100644drivers/net/ice/ice_rxtx.h +0
-0@@ -35,6 +35,7 @@#define ICE_MAX_RX_BURST
ICE_RXQ_REARM_THRESHQuoted 109 lines
Quoted 80 lines
Quoted 7 lines
drivers/net/ice/ice_rxtx.h line 38
Quoted 3 lines
drivers/net/ice/ice_rxtx.h +1
-0#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_DESCS_PER_LOOP_AVX 8No need to expose this if no external link, better to keep all avx stuff inside
avx.cOk, so define it in
avx.cis the best choice if avx should not inrxtx.h.Quoted 20 lines
Quoted 20 lines
drivers/net/ice/ice_rxtx.h +0
-0#define ICE_FDIR_PKT_LEN 512drivers/net/ice/ice_rxtx_vec_avx2.c +1
-1@@ -29,7 +29,7 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)__m128i dma_addr0; dma_addr0 =_mm_setzero_si128 (); -for (i =0 ; i <ICE_DESCS_PER_LOOP ; i++) { +for (i =0 ; i <ICE_DESCS_PER_LOOP_AVX ; i++) { rxep[i].mbuf = &rxq->fake_mbuf;_mm_store_si128 ((__m128i *)&rxdp[i].read, dma_addr0);@@ -132,12 +132,17 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)ICE_PCI_REG_WRITE (rxq->qrx_tail, rx_id); }Quoted 12 lines
drivers/net/ice/ice_rxtx_vec_avx2.c ice_rxq_rearm(struct ice_rx_queue *rxq)
Quoted 8 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +8
-0+/** +* vPMD raw receive routine, only accept(nb_pkts >= +ICE_DESCS_PER_LOOP_AVX) +* +* Notice: +* - nb_pkts < ICE_DESCS_PER_LOOP_AVX, just return no packet +* - floor align nb_pkts to a ICE_DESCS_PER_LOOP_AVX +power-of-two */ The comment is misleading, it looks like we are going to floor align
nb_pktsto 2^8, better to reword .It should be, agree.
Quoted 25 lines
drivers/net/ice/ice_rxtx_vec_avx2.c _ice_recv_raw_pkts_vec_avx2(struct
Quoted 10 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0static inline uint16_t _ice_recv_raw_pkts_vec_avx2 (struct ice_rx_queue *rxq,struct rte_mbuf **rx_pkts, uint16_t nb_pkts, uint8_t *split_packet) { -#define
ICE_DESCS_PER_LOOP_AVX8drivers/net/ice/ice_rxtx_vec_avx2.c +0
-1-const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m256i mbuf_init =_mm256_set_epi64x (0 ,0 ,0 , rxq->mbuf_initializer);@@ -603,10 +608,6 @@ _ice_recv_raw_pkts_vec_avx2(struct
ice_rx_queueQuoted 14 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-4*rxq, struct rte_mbuf **rx_pkts, return received; } -/* -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -*/ uint16_t ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0uint16_t nb_pkts)@@ -616,8 +617,6 @@ ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,Quoted 9 lines
Quoted 6 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0/** * vPMD receive routine that reassembles single burst of 32 scattered packets
- * Notice:
- * -nb_pkts<ICE_DESCS_PER_LOOP, just return no packet */Why we need to remove this? is it still true for this function?
Quoted 3 lines
The reason is that this comment is in the calling function "
_ice_recv_raw_pkts_vec_avx2" which process the related thing, no need to add it more and more in the caller function.I think you remove related comment from the calling function also :)
Also I think better to keep this even it's a little bit duplicate, that help people to understand the internal logic
Quoted 19 lines
Quoted 9 lines
Quoted 4 lines
static
uint16_tice_recv_scattered_burst_vec_avx2(void*rx_queue, structrte_mbuf**rx_pkts, @@ -626,6 +625,9 @@ice_recv_scattered_burst_vec_avx2(void
Quoted 4 lines
*rx_queue, structrte_mbuf**rx_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0struct ice_rx_queue *rxq = rx_queue;uint8_t split_flags[ICE_VPMD_RX_BURST ] = {0 };Quoted 6 lines
drivers/net/ice/ice_rxtx_vec_avx2.c
Quoted 2 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +2
-0+/* split_flags only can support max of ICE_VPMD_RX_BURST */ + nb_pkts =RTE_MIN (nb_pkts,ICE_VPMD_RX_BURST );Is this necessary? the only consumer of this function is
ice_recv_scattered_pkts_vec_avx2, I thinknb_pkts<=ICE_VPMD_RX_BURSTit already be guaranteed.The reason is that we remove "
nb_pkts<=ICE_VPMD_RX_BURST" and in this functionsplit_flagshave a limit forICE_VPMD_RX_BURST, so a checking is need in the function.
Quoted 8 lines
Quoted 3 lines
Can't get this, could tell me is there any case that
nb_pkts>ICE_VPMD_RX_BURST?I know we just set the hard value here and only one case usage, but I think only the caller know what would be the input param, but the calling should not know the input param will be, even there is no any caller but the calling still need to be complete.
It's in data path where performance is sensitive and also this is just an internal function, we know all the detail, so skip unnecessary route is reasonable, to avoid bugs and give necessary warning for future scale, I think RTE_ASSERT is the right way.
Quoted 47 lines
Quoted 36 lines
Quoted 19 lines
Quoted 19 lines
drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
Quoted 6 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +1
-0+/* get some new buffers */ uint16_t nb_bufs = _ice_recv_raw_pkts_vec_avx2(rxq, rx_pkts,
nb_pkts,drivers/net/ice/ice_rxtx_vec_avx2.c ice_recv_scattered_burst_vec_avx2(void
Quoted 2 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-0split_flags);@@ -657,9 +659,6 @@ ice_recv_scattered_burst_vec_avx2(void
*rx_queue,Quoted 8 lines
drivers/net/ice/ice_rxtx_vec_avx2.c +0
-3struct rte_mbuf **rx_pkts,/** * vPMD receive routine that reassembles scattered packets. -* Main receive routine that can handle arbitrary burst sizes -* Notice: -* - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */ Quoted 7 lines
Quoted 3 lines
Why we need to remove this? isn't it the main routine that be able to handle arbitrary burst size?
The question is why we need to said the arbitrary sizes if we process and return what we could receive packet for maximum? It is not only useless comment but also maybe bring some confuse I think.
Yes arbitrary size description can be removed, as this is assumed to be the default behavior.
But the description fornb_pktsshould still be kept.Quoted 5 lines
Quoted 4 lines
Btw, I will suggest all AVX2 changes can be in a separate patch, because this looks like some code clean and fix.
its not related with the main purpose of the patch set.Quoted 7 lines
Quoted 4 lines
I consider it and ask any objection before, so totally I am not disagree on separate it, but I think if the purpose of the patch set is to clean some misleading for vec(sse/avx) burst, it could still be on a set even separate it to patch.
I will not be insist on patch separate, but if you separate them, some of fixes can be merged early and no need to wait for those part need more
review.
Ok, seems that there still something discuss on the code cleaning patch, let me separate it for better review.
PATCH v4 5/5 net/fm10k: fix vector rx burst for fm10k
In reply to Jeff GuoThe scattered receive path should use a wrapper function to achieve the goal of burst maximizing. And do some code cleaning for vector rx path.
Bugzilla ID: 516
--- drivers/net/fm10k/fm10k_rxtx_vec.c | 42 +++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 9 deletions(-)
drivers/net/fm10k/fm10k_rxtx_vec.c +33 -9
@@ -645,25 +645,23 @@ fm10k_reassemble_packets(struct fm10k_rx_queue *rxq,return pkt_idx; } -/* -* vPMD receive routine that reassembles scattered packets +/** +* vPMD receive routine that reassembles single burst of 32 scattered packets * * Notice: * - don't support ol_flags for rss and csum err -* - nb_pkts > RTE_FM10K_MAX_RX_BURST, only scan RTE_FM10K_MAX_RX_BURST -* numbers of DD bit */ -uint16_t -fm10k_recv_scattered_pkts_vec (void *rx_queue, -struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +fm10k_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct fm10k_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_FM10K_MAX_RX_BURST ] = {0 };unsigned i =0 ; -/* Split_flags only can support max of RTE_FM10K_MAX_RX_BURST */ +/* split_flags only can support max of RTE_FM10K_MAX_RX_BURST */ nb_pkts =RTE_MIN (nb_pkts,RTE_FM10K_MAX_RX_BURST ); +/* get some new buffers */ uint16_t nb_bufs =fm10k_recv_raw_pkts_vec (rxq, rx_pkts, nb_pkts, split_flags);
@@ -691,6 +689,32 @@ fm10k_recv_scattered_pkts_vec(void *rx_queue, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +fm10k_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_FM10K_MAX_RX_BURST ) { +uint16_t burst; + + burst =fm10k_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_FM10K_MAX_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <RTE_FM10K_MAX_RX_BURST ) +return retval; + } + +return retval +fm10k_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static const struct fm10k_txq_ops vec_txq_ops = { .reset = fm10k_reset_tx_queue, };
Signature · 1 line
2.20.1
v5 cover fix vector rx burst for PMDs
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf/fm10k PMDs.
Bugzilla ID: 516
v5->v4:
split patch set, this patch only for max burst size issue. Add back Acked-by which has been added at v2.
v4->v3:
add Fixes tag.
v3->v2:
1:move define into header file.
2:delete some useless doc.
v2->v1:
1:add fm10k driver case
2:refine some doc
Jeff Guo (5):
net/ixgbe: fix vector rx burst for ixgbe
net/i40e: fix vector rx burst for i40e
net/ice: fix vector rx burst for ice
net/fm10k: fix vector rx burst for fm10k
net/iavf: fix vector rx burst for iavf
drivers/net/fm10k/fm10k_rxtx_vec.c | 39 +++++++-- drivers/net/i40e/i40e_rxtx_vec_altivec.c | 59 +++++++++---- drivers/net/i40e/i40e_rxtx_vec_neon.c | 48 ++++++++--- drivers/net/i40e/i40e_rxtx_vec_sse.c | 48 ++++++++--- drivers/net/iavf/iavf_rxtx_vec_sse.c | 103 +++++++++++++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 46 +++++++--- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 61 +++++++++----- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 47 +++++++---- 8 files changed, 328 insertions(+), 123 deletions(-)
Signature · 1 line
2.20.1
PATCH v5 1/5 net/ixgbe: fix vector rx burst for ixgbe
The limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
Bugzilla ID: 516
--- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 61 +++++++++++++++---------- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 47 +++++++++++++------ 2 files changed, 70 insertions(+), 38 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +38 -23
@@ -130,17 +130,6 @@ desc_to_olflags_v(uint8x16x2_t sterr_tmp1, uint8x16x2_t sterr_tmp2, rx_pkts[3 ]->ol_flags = vol.e[3 ]; } -/* -* vPMD raw receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) -* -* Notice: -* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan RTE_IXGBE_MAX_RX_BURST -* numbers of DD bit -* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two -* - don't support ol_flags for rss and csum err -*/ -#define IXGBE_VPMD_DESC_EOP_MASK 0x02020202#define IXGBE_UINT8_BIT (CHAR_BIT * sizeof(uint8_t))
@@ -206,6 +195,13 @@ desc_to_ptype_v(uint64x2_t descs[4], uint16_t pkt_type_mask, vgetq_lane_u32(tunnel_check, 3)); } +/** +* vPMD raw receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) +* +* Notice: +* - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet +* - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two +*/ static inline uint16_t _recv_raw_pkts_vec (struct ixgbe_rx_queue *rxq,struct rte_mbuf **rx_pkts,uint16_t nb_pkts,uint8_t *split_packet)
@@ -226,9 +222,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,uint16x8_t crc_adjust = {0 ,0 , rxq->crc_len,0 , rxq->crc_len,0 ,0 ,0 }; -/* nb_pkts shall be less equal than RTE_IXGBE_MAX_RX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,RTE_IXGBE_MAX_RX_BURST ); -/* nb_pkts has to be floor-aligned to RTE_IXGBE_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,RTE_IXGBE_DESCS_PER_LOOP );
@@ -382,13 +375,11 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,return nb_pkts_recd; } -/* +/** * vPMD receive routine, only accept(nb_pkts >= RTE_IXGBE_DESCS_PER_LOOP) * * Notice: * - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan RTE_IXGBE_MAX_RX_BURST -* numbers of DD bit * - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two * - don't support ol_flags for rss and csum err */
@@ -399,19 +390,17 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* +/** * vPMD receive routine that reassembles scattered packets * * Notice: * - don't support ol_flags for rss and csum err * - nb_pkts < RTE_IXGBE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_IXGBE_MAX_RX_BURST, only scan RTE_IXGBE_MAX_RX_BURST -* numbers of DD bit * - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two */ -uint16_t -ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +ixgbe_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct ixgbe_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_IXGBE_MAX_RX_BURST ] = {0 };
@@ -443,6 +432,32 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +ixgbe_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_IXGBE_MAX_RX_BURST ) { +uint16_t burst; + + burst =ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_IXGBE_MAX_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <RTE_IXGBE_MAX_RX_BURST ) +return retval; + } + +return retval +ixgbe_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void vtx1 (volatile union ixgbe_adv_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags)
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +32 -15
91 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v5 2/5 net/i40e: fix vector rx burst for i40e
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
Bugzilla ID: 516
--- drivers/net/i40e/i40e_rxtx_vec_altivec.c | 59 +++++++++++++++++------- drivers/net/i40e/i40e_rxtx_vec_neon.c | 48 ++++++++++++++----- drivers/net/i40e/i40e_rxtx_vec_sse.c | 48 ++++++++++++++----- 3 files changed, 114 insertions(+), 41 deletions(-)
drivers/net/i40e/i40e_rxtx_vec_altivec.c +42 -17
@@ -188,11 +188,13 @@ desc_to_ptype_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts, ptype_tbl[(*(vector unsigned char *)&ptype1)[8]]; } -/* Notice: -* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_I40E_VPMD_RX_BURST, only scan RTE_I40E_VPMD_RX_BURST -* numbers of DD bits -*/ +/** +* vPMD raw receive routine, only accept(nb_pkts >= RTE_I40E_DESCS_PER_LOOP) +* +* Notice: +* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet +* - floor align nb_pkts to a RTE_I40E_DESCS_PER_LOOP power-of-two +*/ static inline uint16_t _recv_raw_pkts_vec (struct i40e_rx_queue *rxq,struct rte_mbuf **rx_pkts,uint16_t nb_pkts,uint8_t *split_packet)
@@ -214,9 +216,6 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts, };vector unsigned long dd_check, eop_check; -/* nb_pkts shall be less equal than RTE_I40E_MAX_RX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,RTE_I40E_MAX_RX_BURST ); -/* nb_pkts has to be floor-aligned to RTE_I40E_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,RTE_I40E_DESCS_PER_LOOP );
@@ -459,15 +458,15 @@ i40e_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* vPMD receive routine that reassembles scattered packets -* Notice: -* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet -* - nb_pkts > RTE_I40E_VPMD_RX_BURST, only scan RTE_I40E_VPMD_RX_BURST -* numbers of DD bits -*/ -uint16_t -i40e_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +/** +* vPMD receive routine that reassembles single burst of 32 scattered packets +* +* Notice: +* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet +*/ +static uint16_t +i40e_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct i40e_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_I40E_VPMD_RX_BURST ] = {0 };
@@ -500,6 +499,32 @@ i40e_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +i40e_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_I40E_VPMD_RX_BURST ) { +uint16_t burst; + + burst =i40e_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_I40E_VPMD_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <RTE_I40E_VPMD_RX_BURST ) +return retval; + } + +return retval +i40e_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void vtx1 (volatile struct i40e_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags)
drivers/net/i40e/i40e_rxtx_vec_neon.c +36 -12
77 lines not on this page · raw message
drivers/net/i40e/i40e_rxtx_vec_sse.c +36 -12
77 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v5 3/5 net/ice: fix vector rx burst for ice
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
Bugzilla ID: 516
--- drivers/net/ice/ice_rxtx_vec_sse.c | 46 +++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 11 deletions(-)
drivers/net/ice/ice_rxtx_vec_sse.c +35 -11
@@ -254,10 +254,11 @@ ice_rx_desc_to_ptype_v(__m128i descs[4], struct rte_mbuf **rx_pkts, }/** +* vPMD raw receive routine, only accept(nb_pkts >= ICE_DESCS_PER_LOOP) +* * Notice: * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST -* numbers of DD bits +* - floor align nb_pkts to a ICE_DESCS_PER_LOOP power-of-two */ static inline uint16_t _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,
@@ -314,9 +315,6 @@ _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts,const __m128i eop_check =_mm_set_epi64x (0x0000000200000002LL ,0x0000000200000002LL ); -/* nb_pkts shall be less equal than ICE_MAX_RX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,ICE_MAX_RX_BURST ); -/* nb_pkts has to be floor-aligned to ICE_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,ICE_DESCS_PER_LOOP );
@@ -560,15 +558,15 @@ ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,return _ice_recv_raw_pkts_vec (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* vPMD receive routine that reassembles scattered packets +/** +* vPMD receive routine that reassembles single burst of 32 scattered packets +* * Notice: * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet -* - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST -* numbers of DD bits */ -uint16_t -ice_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +ice_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct ice_rx_queue *rxq = rx_queue;uint8_t split_flags[ICE_VPMD_RX_BURST ] = {0 };
@@ -602,6 +600,32 @@ ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +ice_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >ICE_VPMD_RX_BURST ) { +uint16_t burst; + + burst =ice_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +ICE_VPMD_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <ICE_VPMD_RX_BURST ) +return retval; + } + +return retval +ice_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void ice_vtx1 (volatile struct ice_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags)
Signature · 1 line
2.20.1
PATCH v5 4/5 net/fm10k: fix vector rx burst for fm10k
In reply to Jeff GuoThe scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
Bugzilla ID: 516
--- drivers/net/fm10k/fm10k_rxtx_vec.c | 39 ++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 8 deletions(-)
drivers/net/fm10k/fm10k_rxtx_vec.c +31 -8
@@ -645,18 +645,15 @@ fm10k_reassemble_packets(struct fm10k_rx_queue *rxq,return pkt_idx; } -/* -* vPMD receive routine that reassembles scattered packets +/** +* vPMD receive routine that reassembles single burst of 32 scattered packets * * Notice: * - don't support ol_flags for rss and csum err -* - nb_pkts > RTE_FM10K_MAX_RX_BURST, only scan RTE_FM10K_MAX_RX_BURST -* numbers of DD bit */ -uint16_t -fm10k_recv_scattered_pkts_vec (void *rx_queue, -struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +fm10k_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct fm10k_rx_queue *rxq = rx_queue;uint8_t split_flags[RTE_FM10K_MAX_RX_BURST ] = {0 };
@@ -691,6 +688,32 @@ fm10k_recv_scattered_pkts_vec(void *rx_queue, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +fm10k_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >RTE_FM10K_MAX_RX_BURST ) { +uint16_t burst; + + burst =fm10k_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +RTE_FM10K_MAX_RX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <RTE_FM10K_MAX_RX_BURST ) +return retval; + } + +return retval +fm10k_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static const struct fm10k_txq_ops vec_txq_ops = { .reset = fm10k_reset_tx_queue, };
Signature · 1 line
2.20.1
PATCH v5 5/5 net/iavf: fix vector rx burst for iavf
In reply to Jeff GuoThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
Bugzilla ID: 516
--- drivers/net/iavf/iavf_rxtx_vec_sse.c | 103 ++++++++++++++++++++------- 1 file changed, 78 insertions(+), 25 deletions(-)
drivers/net/iavf/iavf_rxtx_vec_sse.c +78 -25
@@ -379,10 +379,12 @@ flex_desc_to_ptype_v(__m128i descs[4], struct rte_mbuf **rx_pkts, rx_pkts[3 ]->packet_type = type_table[_mm_extract_epi16 (ptype_all,7 )]; } -/* Notice: +/** +* vPMD raw receive routine, only accept(nb_pkts >= IAVF_VPMD_DESCS_PER_LOOP) +* +* Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > IAVF_VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST -* numbers of DD bits +* - floor align nb_pkts to a IAVF_VPMD_DESCS_PER_LOOP power-of-two */ static inline uint16_t _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts,
@@ -413,9 +415,6 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts, offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);__m128i dd_check, eop_check; -/* nb_pkts shall be less equal than IAVF_VPMD_RX_MAX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,IAVF_VPMD_RX_MAX_BURST ); -/* nb_pkts has to be floor-aligned to IAVF_VPMD_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,IAVF_VPMD_DESCS_PER_LOOP );
@@ -627,10 +626,13 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts,return nb_pkts_recd; } -/* Notice: +/** +* vPMD raw receive routine for flex RxD, +* only accept(nb_pkts >= IAVF_VPMD_DESCS_PER_LOOP) +* +* Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > IAVF_VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST -* numbers of DD bits +* - floor align nb_pkts to a IAVF_VPMD_DESCS_PER_LOOP power-of-two */ static inline uint16_t _recv_raw_pkts_vec_flex_rxd(struct iavf_rx_queue *rxq,
@@ -688,9 +690,6 @@ _recv_raw_pkts_vec_flex_rxd(struct iavf_rx_queue *rxq,const __m128i eop_check =_mm_set_epi64x (0x0000000200000002LL ,0x0000000200000002LL ); -/* nb_pkts shall be less equal than IAVF_VPMD_RX_MAX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,IAVF_VPMD_RX_MAX_BURST ); -/* nb_pkts has to be floor-aligned to IAVF_VPMD_DESCS_PER_LOOP */ nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,IAVF_VPMD_DESCS_PER_LOOP );
@@ -945,15 +944,15 @@ iavf_recv_pkts_vec_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts,return _recv_raw_pkts_vec_flex_rxd (rx_queue, rx_pkts, nb_pkts,NULL ); } -/* vPMD receive routine that reassembles scattered packets +/** +* vPMD receive routine that reassembles single burst of 32 scattered packets +* * Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST -* numbers of DD bits */ -uint16_t -iavf_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +iavf_recv_scattered_burst_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct iavf_rx_queue *rxq = rx_queue;uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST ] = {0 };
@@ -986,16 +985,43 @@ iavf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, &split_flags[i]); } -/* vPMD receive routine that reassembles scattered packets for flex RxD +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +iavf_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >IAVF_VPMD_RX_MAX_BURST ) { +uint16_t burst; + + burst =iavf_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, +IAVF_VPMD_RX_MAX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <IAVF_VPMD_RX_MAX_BURST ) +return retval; + } + +return retval +iavf_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} + +/** +* vPMD receive routine that reassembles single burst of 32 scattered packets +* for flex RxD +* * Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST -* numbers of DD bits */ -uint16_t -iavf_recv_scattered_pkts_vec_flex_rxd (void *rx_queue, -struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +iavf_recv_scattered_burst_vec_flex_rxd (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct iavf_rx_queue *rxq = rx_queue;uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST ] = {0 };
@@ -1028,6 +1054,33 @@ iavf_recv_scattered_pkts_vec_flex_rxd(void *rx_queue, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets for flex RxD +*/ +uint16_t +iavf_recv_scattered_pkts_vec_flex_rxd (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >IAVF_VPMD_RX_MAX_BURST ) { +uint16_t burst; + + burst =iavf_recv_scattered_burst_vec_flex_rxd (rx_queue, + rx_pkts + retval, +IAVF_VPMD_RX_MAX_BURST ); + retval += burst; + nb_pkts -= burst; +if (burst <IAVF_VPMD_RX_MAX_BURST ) +return retval; + } + +return retval +iavf_recv_scattered_burst_vec_flex_rxd (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void vtx1 (volatile struct iavf_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags) {
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH v5 5/5] net/iavf: fix vector rx burst for iavf
Regards,
Ling Wei
Quoted 211 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Jeff Guo
Sent: Friday, October 16, 2020 05:45 PM
To: Wu, Jingjing <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>; Wang, Haiyue <[email protected]>; Yang, Qiming <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>
Subject: [dpdk-dev] [PATCH v5 5/5] net/iavf: fix vector rx burst for iavfThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
Bugzilla ID: 516
Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")Fixes 1162f5a0ef31 ("net/iavf: support flexible Rx descriptor in SSE path")Fixes 5b6e8859081d ("net/iavf: support flexible Rx descriptor in AVX path")Signed-off-by Jeff Guo <[email protected]>Acked-by Morten Brørup <[email protected]>--- drivers/net/iavf/iavf_rxtx_vec_sse.c | 103 ++++++++++++++++++++------- 1 file changed, 78 insertions(+), 25 deletions(-)drivers/net/iavf/iavf_rxtx_vec_sse.c +5
-2@@ -379,10 +379,12 @@ flex_desc_to_ptype_v(__m128i descs[4], struct rte_mbuf **rx_pkts, rx_pkts[3 ]->packet_type = type_table[_mm_extract_epi16 (ptype_all,7 )]; } -/* Notice: +/** +* vPMD raw receive routine, only accept(nb_pkts >= +IAVF_VPMD_DESCS_PER_LOOP) +* +* Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > IAVF_VPMD_RX_MAX_BURST, only scan
IAVF_VPMD_RX_MAX_BURST
- * numbers of DD bits
+ * - floor alignnb_pktsto aIAVF_VPMD_DESCS_PER_LOOPpower-of-two */
static inlineuint16_t
_recv_raw_pkts_vec(structiavf_rx_queue*rxq, structrte_mbuf**rx_pkts,drivers/net/iavf/iavf_rxtx_vec_sse.c +0
-3@@ -413,9 +415,6 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq,struct rte_mbuf **rx_pkts, offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);__m128i dd_check, eop_check; -/* nb_pkts shall be less equal than IAVF_VPMD_RX_MAX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,IAVF_VPMD_RX_MAX_BURST ); -/* nb_pkts has to be floor-aligned to IAVF_VPMD_DESCS_PER_LOOP */
nb_pkts= RTE_ALIGN_FLOOR(nb_pkts,IAVF_VPMD_DESCS_PER_LOOP);drivers/net/iavf/iavf_rxtx_vec_sse.c +5
-2@@ -627,10 +626,13 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq,struct rte_mbuf **rx_pkts, return nb_pkts_recd; } -/* Notice: +/** +* vPMD raw receive routine for flex RxD, +* only accept(nb_pkts >= IAVF_VPMD_DESCS_PER_LOOP) +* +* Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > IAVF_VPMD_RX_MAX_BURST, only scan
IAVF_VPMD_RX_MAX_BURST
- * numbers of DD bits
+ * - floor alignnb_pktsto aIAVF_VPMD_DESCS_PER_LOOPpower-of-two */
static inlineuint16_t
_recv_raw_pkts_vec_flex_rxd(structiavf_rx_queue*rxq, @@ -688,9 +690,6
@@ _recv_raw_pkts_vec_flex_rxd(structiavf_rx_queue*rxq,drivers/net/iavf/iavf_rxtx_vec_sse.c +0
-3const __m128i eop_check =_mm_set_epi64x (0x0000000200000002LL ,0x0000000200000002LL ); -/* nb_pkts shall be less equal than IAVF_VPMD_RX_MAX_BURST */ - nb_pkts =RTE_MIN (nb_pkts,IAVF_VPMD_RX_MAX_BURST ); -/* nb_pkts has to be floor-aligned to IAVF_VPMD_DESCS_PER_LOOP */
nb_pkts= RTE_ALIGN_FLOOR(nb_pkts,IAVF_VPMD_DESCS_PER_LOOP);drivers/net/iavf/iavf_rxtx_vec_sse.c +4
-2@@ -945,15 +944,15 @@ iavf_recv_pkts_vec_flex_rxd(void *rx_queue,struct rte_mbuf **rx_pkts, return _recv_raw_pkts_vec_flex_rxd(rx_queue, rx_pkts, nb_pkts,NULL ); } -/* vPMD receive routine that reassembles scattered packets +/** +* vPMD receive routine that reassembles single burst of 32 scattered +packets +* * Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > VPMD_RX_MAX_BURST, only scan
IAVF_VPMD_RX_MAX_BURST
- * numbers of DD bits
*/drivers/net/iavf/iavf_rxtx_vec_sse.c +4
-3-uint16_t -iavf_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +iavf_recv_scattered_burst_vec(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) { struct iavf_rx_queue *rxq = rx_queue; uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST] = {0}; @@ -986,16 +985,43 @@ iavf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf**rx_pkts,
drivers/net/iavf/iavf_rxtx_vec_sse.c +15
-1&split_flags[i]); } -/* vPMD receive routine that reassembles scattered packets for flex RxD +/** +* vPMD receive routine that reassembles scattered packets. +*/ +uint16_t +iavf_recv_scattered_pkts_vec (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >IAVF_VPMD_RX_MAX_BURST ) { +uint16_t burst; + + burst = iavf_recv_scattered_burst_vec(rx_queue, + rx_pkts + retval, +
IAVF_VPMD_RX_MAX_BURST);drivers/net/iavf/iavf_rxtx_vec_sse.c +16
-1+ retval += burst; + nb_pkts -= burst; +if (burst <IAVF_VPMD_RX_MAX_BURST ) +return retval; + } + +return retval +iavf_recv_scattered_burst_vec (rx_queue, + rx_pkts + retval, + nb_pkts); +} + +/** +* vPMD receive routine that reassembles single burst of 32 scattered +packets +* for flex RxD +* * Notice: * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet -* - nb_pkts > VPMD_RX_MAX_BURST, only scan
IAVF_VPMD_RX_MAX_BURST
- * numbers of DD bits
*/drivers/net/iavf/iavf_rxtx_vec_sse.c +19
-4-uint16_t -iavf_recv_scattered_pkts_vec_flex_rxd (void *rx_queue, -struct rte_mbuf **rx_pkts, -uint16_t nb_pkts) +static uint16_t +iavf_recv_scattered_burst_vec_flex_rxd (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) {struct iavf_rx_queue *rxq = rx_queue; uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST] = {0}; @@ -1028,6 +1054,33 @@ iavf_recv_scattered_pkts_vec_flex_rxd(void *rx_queue, &split_flags[i]); } +/** +* vPMD receive routine that reassembles scattered packets for flex RxD +*/ uint16_t iavf_recv_scattered_pkts_vec_flex_rxd (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts) +{ +uint16_t retval =0 ; + +while (nb_pkts >IAVF_VPMD_RX_MAX_BURST ) { +uint16_t burst; + + burst = iavf_recv_scattered_burst_vec_flex_rxd(rx_queue, + rx_pkts + retval, +IAVF_VPMD_RX_MAX_BURST);drivers/net/iavf/iavf_rxtx_vec_sse.c +11
-0+ retval += burst; + nb_pkts -= burst; +if (burst <IAVF_VPMD_RX_MAX_BURST ) +return retval; + } + +return retval +iavf_recv_scattered_burst_vec_flex_rxd (rx_queue, + rx_pkts + retval, + nb_pkts); +} +static inline void vtx1 (volatile struct iavf_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags){
--
2.20.1
Re: [dpdk-dev] [PATCH v5 0/5] fix vector rx burst for PMDs
In reply to Jeff GuoQuoted 56 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Friday, October 16, 2020 5:44 PM
To: Wu, Jingjing <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>; Wang, Haiyue <[email protected]>; Yang, Qiming <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Richardson, Bruce <[email protected]>; Guo, Jia <[email protected]>; Zhang, Helin <[email protected]>
Subject: [PATCH v5 0/5] fix vector rx burst for PMDsThe limitation of burst size in vector rx was removed, since it should retrieve as much received packets as possible. And also the scattered receive path should use a wrapper function to achieve the goal of burst maximizing.
This patch set aims to maximize vector rx burst for for ixgbe/i40e/ice/iavf/fm10k PMDs.
Bugzilla ID: 516
v5->v4:
split patch set, this patch only for max burst size issue. Add back Acked-by which has been added at v2.
v4->v3:
add Fixes tag.
v3->v2:
1:move define into header file.
2:delete some useless doc.
v2->v1:
1:add fm10k driver case
2:refine some docJeff Guo (5):
net/ixgbe: fix vector rx burst for ixgbe
net/i40e: fix vector rx burst for i40e
net/ice: fix vector rx burst for ice
net/fm10k: fix vector rx burst for fm10k
net/iavf: fix vector rx burst for iavfdrivers/net/fm10k/fm10k_rxtx_vec.c | 39 +++++++-- drivers/net/i40e/i40e_rxtx_vec_altivec.c | 59 +++++++++---- drivers/net/i40e/i40e_rxtx_vec_neon.c | 48 ++++++++--- drivers/net/i40e/i40e_rxtx_vec_sse.c | 48 ++++++++--- drivers/net/iavf/iavf_rxtx_vec_sse.c | 103 +++++++++++++++++------ drivers/net/ice/ice_rxtx_vec_sse.c | 46 +++++++--- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 61 +++++++++----- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 47 +++++++---- 8 files changed, 328 insertions(+), 123 deletions(-)
Quoted 2 lines
--
2.20.1
Applied to dpdk-next-net-intel.
Thanks
Qi