diff mbox series

net/ixgbe: add vector Rx parameter check

Message ID 20211202031857.1808705-1-zhengbin.89740@bytedance.com (mailing list archive)
State Superseded
Headers show
Series net/ixgbe: add vector Rx parameter check | expand

Checks

Context Check Description
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch warning coding style issues

Commit Message

Bin Zheng Dec. 2, 2021, 3:18 a.m. UTC
Under the circumstance that `rx_tail` wrap back to zero
and the advance speed of `rx_tail` is greater than `rxrearm_start`,
`rx_tail` will catch up with `rxrearm_start` and surpass it.
This may cause some mbufs be reused by applicaion.

So we need to make some restrictions to ensure that
 `rx_tail` will not exceed `rxrearm_start`.

e.g.

RDH: 972 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail: 959
RDH: 1004 RDT: 1023 rxrearm_nb: 991 rxrearm_start: 0 rx_tail: 991
RDH: 12 RDT: 31 rxrearm_nb: 991 rxrearm_start: 32 rx_tail: 1023
RDH: 31 RDT: 63 rxrearm_nb: 960 rxrearm_start: 64 rx_tail: 0
RDH: 95 RDT: 95 rxrearm_nb: 1016 rxrearm_start: 96 rx_tail: 88
RDH: 95 RDT: 127 rxrearm_nb: 991 rxrearm_start: 128 rx_tail: 95
...
RDH: 908 RDT: 927 rxrearm_nb: 991 rxrearm_start: 928 rx_tail: 895
RDH: 940 RDT: 959 rxrearm_nb: 991 rxrearm_start: 960 rx_tail: 927
RDH: 980 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail: 959
RDH: 991 RDT: 991 rxrearm_nb: 1026 rxrearm_start: 992 rx_tail: 994

when `rx_tail` catches up with `rxrearm_start`,
2(994 - 992) mbufs be reused by applicaion !

Bugzilla ID: 882
Fixes: 5a3cca342417 ("net/ixgbe: fix vector Rx")
Cc: jia.guo@intel.com
Cc: stable@dpdk.org

Signed-off-by: Bin Zheng <zhengbin.89740@bytedance.com>
---
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Haiyue Wang Dec. 2, 2021, 5:33 a.m. UTC | #1
> -----Original Message-----
> From: Bin Zheng <zhengbin.89740@bytedance.com>
> Sent: Thursday, December 2, 2021 11:19
> To: dev@dpdk.org
> Cc: Wang, Haiyue <haiyue.wang@intel.com>; liangma@liangbit.com; Bin Zheng
> <zhengbin.89740@bytedance.com>; jia.guo@intel.com; stable@dpdk.org
> Subject: [PATCH] net/ixgbe: add vector Rx parameter check
> 
> Under the circumstance that `rx_tail` wrap back to zero
> and the advance speed of `rx_tail` is greater than `rxrearm_start`,
> `rx_tail` will catch up with `rxrearm_start` and surpass it.
> This may cause some mbufs be reused by applicaion.
> 
> So we need to make some restrictions to ensure that
>  `rx_tail` will not exceed `rxrearm_start`.
> 
> e.g.
> 
> RDH: 972 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail: 959
> RDH: 1004 RDT: 1023 rxrearm_nb: 991 rxrearm_start: 0 rx_tail: 991
> RDH: 12 RDT: 31 rxrearm_nb: 991 rxrearm_start: 32 rx_tail: 1023
> RDH: 31 RDT: 63 rxrearm_nb: 960 rxrearm_start: 64 rx_tail: 0
> RDH: 95 RDT: 95 rxrearm_nb: 1016 rxrearm_start: 96 rx_tail: 88
> RDH: 95 RDT: 127 rxrearm_nb: 991 rxrearm_start: 128 rx_tail: 95
> ...
> RDH: 908 RDT: 927 rxrearm_nb: 991 rxrearm_start: 928 rx_tail: 895
> RDH: 940 RDT: 959 rxrearm_nb: 991 rxrearm_start: 960 rx_tail: 927
> RDH: 980 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail: 959
> RDH: 991 RDT: 991 rxrearm_nb: 1026 rxrearm_start: 992 rx_tail: 994
> 
> when `rx_tail` catches up with `rxrearm_start`,
> 2(994 - 992) mbufs be reused by applicaion !
> 
> Bugzilla ID: 882
> Fixes: 5a3cca342417 ("net/ixgbe: fix vector Rx")
> Cc: jia.guo@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bin Zheng <zhengbin.89740@bytedance.com>
> ---
>  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 

Both ? Or ?

https://patchwork.dpdk.org/project/dpdk/patch/20211202031530.1808112-1-zhengbin.89740@bytedance.com/
https://patchwork.dpdk.org/project/dpdk/patch/20211202031857.1808705-1-zhengbin.89740@bytedance.com/

> diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
> index 1eed949495..5811749b95 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
> @@ -364,6 +364,17 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
>  	uint8_t vlan_flags;
>  	uint16_t udp_p_flag = 0; /* Rx Descriptor UDP header present */
> 
> +	/*
> +	 * Under the circumstance that `rx_tail` wrap back to zero
> +	 * and the advance speed of `rx_tail` is greater than `rxrearm_start`,
> +	 * `rx_tail` will catch up with `rxrearm_start` and surpass it.
> +	 * This may cause some mbufs be reused by applicaion.
> +	 *
> +	 * So we need to make some restrictions to ensure that
> +	 * `rx_tail` will not exceed `rxrearm_start`.
> +	 */
> +	nb_pkts = RTE_MIN(nb_pkts, RTE_IXGBE_RXQ_REARM_THRESH);
> +
>  	/* 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);
> 
> --
> 2.25.1
diff mbox series

Patch

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index 1eed949495..5811749b95 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -364,6 +364,17 @@  _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 	uint8_t vlan_flags;
 	uint16_t udp_p_flag = 0; /* Rx Descriptor UDP header present */
 
+	/*
+	 * Under the circumstance that `rx_tail` wrap back to zero
+	 * and the advance speed of `rx_tail` is greater than `rxrearm_start`,
+	 * `rx_tail` will catch up with `rxrearm_start` and surpass it.
+	 * This may cause some mbufs be reused by applicaion.
+	 *
+	 * So we need to make some restrictions to ensure that
+	 * `rx_tail` will not exceed `rxrearm_start`.
+	 */
+	nb_pkts = RTE_MIN(nb_pkts, RTE_IXGBE_RXQ_REARM_THRESH);
+
 	/* 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);