* [PATCH] net/i40e: remove redundant judgment for rearm @ 2021-12-20 5:42 Feifei Wang 2023-03-28 7:28 ` [PATCH v2] net/i40e: remove redundant judgment Feifei Wang 0 siblings, 1 reply; 6+ messages in thread From: Feifei Wang @ 2021-12-20 5:42 UTC (permalink / raw) To: Ruifeng Wang, Beilei Xing, Bruce Richardson, Konstantin Ananyev Cc: dev, nd, Feifei Wang, Honnappa Nagarahalli Merged variable updates under the same condition. It reduces branch. In n1sdp, there is no performance improvement with this patch. In x86, there is also no performance improvement. Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Signed-off-by: Feifei Wang <feifei.wang2@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- drivers/net/i40e/i40e_rxtx_vec_neon.c | 9 +++++---- drivers/net/i40e/i40e_rxtx_vec_sse.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c index b951ea2dc3..c7e4222b61 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_neon.c +++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c @@ -64,14 +64,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) } rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; - if (rxq->rxrearm_start >= rxq->nb_rx_desc) + rx_id = rxq->rxrearm_start - 1; + + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { rxq->rxrearm_start = 0; + rx_id = rxq->nb_rx_desc - 1; + } rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); - rte_io_wmb(); /* Update the tail pointer on the NIC */ I40E_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rx_id); diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c index 497b2404c6..0910039d69 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_sse.c +++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c @@ -77,14 +77,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) } rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; - if (rxq->rxrearm_start >= rxq->nb_rx_desc) + rx_id = rxq->rxrearm_start - 1; + + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { rxq->rxrearm_start = 0; + rx_id = rxq->nb_rx_desc - 1; + } rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); - /* Update the tail pointer on the NIC */ I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } -- 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] net/i40e: remove redundant judgment 2021-12-20 5:42 [PATCH] net/i40e: remove redundant judgment for rearm Feifei Wang @ 2023-03-28 7:28 ` Feifei Wang 2023-04-27 7:37 ` Zhang, Qi Z 0 siblings, 1 reply; 6+ messages in thread From: Feifei Wang @ 2023-03-28 7:28 UTC (permalink / raw) To: Bruce Richardson, Konstantin Ananyev, Yuying Zhang, Beilei Xing, David Christensen, Ruifeng Wang Cc: dev, nd, Feifei Wang, Honnappa Nagarahalli Merged variable updates under the same condition. It reduces branch. In ampere-altra, there is no performance improvement with this patch. In x86 sse and avx2 path, there is also no performance improvement. v2: 1. add change for avx and altivec path. Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Signed-off-by: Feifei Wang <feifei.wang2@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- drivers/net/i40e/i40e_rxtx_common_avx.h | 9 +++++---- drivers/net/i40e/i40e_rxtx_vec_altivec.c | 9 +++++---- drivers/net/i40e/i40e_rxtx_vec_neon.c | 9 +++++---- drivers/net/i40e/i40e_rxtx_vec_sse.c | 9 +++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/net/i40e/i40e_rxtx_common_avx.h b/drivers/net/i40e/i40e_rxtx_common_avx.h index cfc1e63173..85958d6c81 100644 --- a/drivers/net/i40e/i40e_rxtx_common_avx.h +++ b/drivers/net/i40e/i40e_rxtx_common_avx.h @@ -198,14 +198,15 @@ i40e_rxq_rearm_common(struct i40e_rx_queue *rxq, __rte_unused bool avx512) #endif rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; - if (rxq->rxrearm_start >= rxq->nb_rx_desc) + rx_id = rxq->rxrearm_start - 1; + + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { rxq->rxrearm_start = 0; + rx_id = rxq->nb_rx_desc - 1; + } rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); - /* Update the tail pointer on the NIC */ I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c index 2dfa04599c..8672ad1c41 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c +++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c @@ -89,14 +89,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) } rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; - if (rxq->rxrearm_start >= rxq->nb_rx_desc) + rx_id = rxq->rxrearm_start - 1; + + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { rxq->rxrearm_start = 0; + rx_id = rxq->nb_rx_desc - 1; + } rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); - /* Update the tail pointer on the NIC */ I40E_PCI_REG_WRITE(rxq->qrx_tail, rx_id); } diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c index 12e6f1cbcb..49391fe4c7 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_neon.c +++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c @@ -64,14 +64,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) } rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; - if (rxq->rxrearm_start >= rxq->nb_rx_desc) + rx_id = rxq->rxrearm_start - 1; + + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { rxq->rxrearm_start = 0; + rx_id = rxq->nb_rx_desc - 1; + } rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); - rte_io_wmb(); /* Update the tail pointer on the NIC */ I40E_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rx_id); diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c index bdc979a839..baf83cb3df 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_sse.c +++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c @@ -77,14 +77,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) } rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; - if (rxq->rxrearm_start >= rxq->nb_rx_desc) + rx_id = rxq->rxrearm_start - 1; + + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { rxq->rxrearm_start = 0; + rx_id = rxq->nb_rx_desc - 1; + } rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); - /* Update the tail pointer on the NIC */ I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } -- 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2] net/i40e: remove redundant judgment 2023-03-28 7:28 ` [PATCH v2] net/i40e: remove redundant judgment Feifei Wang @ 2023-04-27 7:37 ` Zhang, Qi Z 2023-05-15 1:59 ` Zhang, Qi Z 0 siblings, 1 reply; 6+ messages in thread From: Zhang, Qi Z @ 2023-04-27 7:37 UTC (permalink / raw) To: Feifei Wang, Richardson, Bruce, Konstantin Ananyev, Zhang, Yuying, Xing, Beilei, David Christensen, Ruifeng Wang Cc: dev, nd, Honnappa Nagarahalli > -----Original Message----- > From: Feifei Wang <feifei.wang2@arm.com> > Sent: Tuesday, March 28, 2023 3:28 PM > To: Richardson, Bruce <bruce.richardson@intel.com>; Konstantin Ananyev > <konstantin.v.ananyev@yandex.ru>; Zhang, Yuying > <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; David > Christensen <drc@linux.vnet.ibm.com>; Ruifeng Wang > <ruifeng.wang@arm.com> > Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>; > Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > Subject: [PATCH v2] net/i40e: remove redundant judgment > > Merged variable updates under the same condition. It reduces branch. > > In ampere-altra, there is no performance improvement with this patch. > In x86 sse and avx2 path, there is also no performance improvement. Thanks for sharing the results. While the code implements some best practices, such as reducing branching and adding compiler hints, which should generally improve performance, it's not necessary to highlight that it didn't provide benefits on certain specific platforms. Would it be ok to remove the last two lines when merging the patch? Otherwise Acked-by: Qi Zhang <qi.z.zhang@intel.com> > > > v2: > 1. add change for avx and altivec path. > > Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > Signed-off-by: Feifei Wang <feifei.wang2@arm.com> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> > --- > drivers/net/i40e/i40e_rxtx_common_avx.h | 9 +++++---- > drivers/net/i40e/i40e_rxtx_vec_altivec.c | 9 +++++---- > drivers/net/i40e/i40e_rxtx_vec_neon.c | 9 +++++---- > drivers/net/i40e/i40e_rxtx_vec_sse.c | 9 +++++---- > 4 files changed, 20 insertions(+), 16 deletions(-) > > diff --git a/drivers/net/i40e/i40e_rxtx_common_avx.h > b/drivers/net/i40e/i40e_rxtx_common_avx.h > index cfc1e63173..85958d6c81 100644 > --- a/drivers/net/i40e/i40e_rxtx_common_avx.h > +++ b/drivers/net/i40e/i40e_rxtx_common_avx.h > @@ -198,14 +198,15 @@ i40e_rxq_rearm_common(struct i40e_rx_queue > *rxq, __rte_unused bool avx512) #endif > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > + rx_id = rxq->rxrearm_start - 1; > + > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > rxq->rxrearm_start = 0; > + rx_id = rxq->nb_rx_desc - 1; > + } > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > - > /* Update the tail pointer on the NIC */ > I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } diff --git > a/drivers/net/i40e/i40e_rxtx_vec_altivec.c > b/drivers/net/i40e/i40e_rxtx_vec_altivec.c > index 2dfa04599c..8672ad1c41 100644 > --- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c > +++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c > @@ -89,14 +89,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > } > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > + rx_id = rxq->rxrearm_start - 1; > + > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > rxq->rxrearm_start = 0; > + rx_id = rxq->nb_rx_desc - 1; > + } > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > - > /* Update the tail pointer on the NIC */ > I40E_PCI_REG_WRITE(rxq->qrx_tail, rx_id); } diff --git > a/drivers/net/i40e/i40e_rxtx_vec_neon.c > b/drivers/net/i40e/i40e_rxtx_vec_neon.c > index 12e6f1cbcb..49391fe4c7 100644 > --- a/drivers/net/i40e/i40e_rxtx_vec_neon.c > +++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c > @@ -64,14 +64,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > } > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > + rx_id = rxq->rxrearm_start - 1; > + > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > rxq->rxrearm_start = 0; > + rx_id = rxq->nb_rx_desc - 1; > + } > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > - > rte_io_wmb(); > /* Update the tail pointer on the NIC */ > I40E_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rx_id); diff --git > a/drivers/net/i40e/i40e_rxtx_vec_sse.c > b/drivers/net/i40e/i40e_rxtx_vec_sse.c > index bdc979a839..baf83cb3df 100644 > --- a/drivers/net/i40e/i40e_rxtx_vec_sse.c > +++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c > @@ -77,14 +77,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > } > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > + rx_id = rxq->rxrearm_start - 1; > + > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > rxq->rxrearm_start = 0; > + rx_id = rxq->nb_rx_desc - 1; > + } > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > - > /* Update the tail pointer on the NIC */ > I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } > -- > 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2] net/i40e: remove redundant judgment 2023-04-27 7:37 ` Zhang, Qi Z @ 2023-05-15 1:59 ` Zhang, Qi Z 2023-05-16 1:54 ` Feifei Wang 0 siblings, 1 reply; 6+ messages in thread From: Zhang, Qi Z @ 2023-05-15 1:59 UTC (permalink / raw) To: Zhang, Qi Z, Feifei Wang, Richardson, Bruce, Konstantin Ananyev, Zhang, Yuying, Xing, Beilei, David Christensen, Ruifeng Wang Cc: dev, nd, Honnappa Nagarahalli > -----Original Message----- > From: Zhang, Qi Z <qi.z.zhang@intel.com> > Sent: Thursday, April 27, 2023 3:38 PM > To: Feifei Wang <feifei.wang2@arm.com>; Richardson, Bruce > <bruce.richardson@intel.com>; Konstantin Ananyev > <konstantin.v.ananyev@yandex.ru>; Zhang, Yuying > <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; David > Christensen <drc@linux.vnet.ibm.com>; Ruifeng Wang > <ruifeng.wang@arm.com> > Cc: dev@dpdk.org; nd@arm.com; Honnappa Nagarahalli > <honnappa.nagarahalli@arm.com> > Subject: RE: [PATCH v2] net/i40e: remove redundant judgment > > > > > -----Original Message----- > > From: Feifei Wang <feifei.wang2@arm.com> > > Sent: Tuesday, March 28, 2023 3:28 PM > > To: Richardson, Bruce <bruce.richardson@intel.com>; Konstantin Ananyev > > <konstantin.v.ananyev@yandex.ru>; Zhang, Yuying > > <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; David > > Christensen <drc@linux.vnet.ibm.com>; Ruifeng Wang > > <ruifeng.wang@arm.com> > > Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>; > > Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > > Subject: [PATCH v2] net/i40e: remove redundant judgment > > > > Merged variable updates under the same condition. It reduces branch. > > > > In ampere-altra, there is no performance improvement with this patch. > > In x86 sse and avx2 path, there is also no performance improvement. > > Thanks for sharing the results. While the code implements some best > practices, such as reducing branching and adding compiler hints, which > should generally improve performance, it's not necessary to highlight that it > didn't provide benefits on certain specific platforms. > > Would it be ok to remove the last two lines when merging the patch? Ping > > Otherwise > Acked-by: Qi Zhang <qi.z.zhang@intel.com> > > > > > > > > v2: > > 1. add change for avx and altivec path. > > > > Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > > Signed-off-by: Feifei Wang <feifei.wang2@arm.com> > > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> > > --- > > drivers/net/i40e/i40e_rxtx_common_avx.h | 9 +++++---- > > drivers/net/i40e/i40e_rxtx_vec_altivec.c | 9 +++++---- > > drivers/net/i40e/i40e_rxtx_vec_neon.c | 9 +++++---- > > drivers/net/i40e/i40e_rxtx_vec_sse.c | 9 +++++---- > > 4 files changed, 20 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/net/i40e/i40e_rxtx_common_avx.h > > b/drivers/net/i40e/i40e_rxtx_common_avx.h > > index cfc1e63173..85958d6c81 100644 > > --- a/drivers/net/i40e/i40e_rxtx_common_avx.h > > +++ b/drivers/net/i40e/i40e_rxtx_common_avx.h > > @@ -198,14 +198,15 @@ i40e_rxq_rearm_common(struct i40e_rx_queue > *rxq, > > __rte_unused bool avx512) #endif > > > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > > + rx_id = rxq->rxrearm_start - 1; > > + > > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > > rxq->rxrearm_start = 0; > > + rx_id = rxq->nb_rx_desc - 1; > > + } > > > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > > - > > /* Update the tail pointer on the NIC */ > > I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } diff --git > > a/drivers/net/i40e/i40e_rxtx_vec_altivec.c > > b/drivers/net/i40e/i40e_rxtx_vec_altivec.c > > index 2dfa04599c..8672ad1c41 100644 > > --- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c > > +++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c > > @@ -89,14 +89,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > > } > > > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > > + rx_id = rxq->rxrearm_start - 1; > > + > > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > > rxq->rxrearm_start = 0; > > + rx_id = rxq->nb_rx_desc - 1; > > + } > > > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > > - > > /* Update the tail pointer on the NIC */ > > I40E_PCI_REG_WRITE(rxq->qrx_tail, rx_id); } diff --git > > a/drivers/net/i40e/i40e_rxtx_vec_neon.c > > b/drivers/net/i40e/i40e_rxtx_vec_neon.c > > index 12e6f1cbcb..49391fe4c7 100644 > > --- a/drivers/net/i40e/i40e_rxtx_vec_neon.c > > +++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c > > @@ -64,14 +64,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > > } > > > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > > + rx_id = rxq->rxrearm_start - 1; > > + > > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > > rxq->rxrearm_start = 0; > > + rx_id = rxq->nb_rx_desc - 1; > > + } > > > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > > - > > rte_io_wmb(); > > /* Update the tail pointer on the NIC */ > > I40E_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rx_id); diff --git > > a/drivers/net/i40e/i40e_rxtx_vec_sse.c > > b/drivers/net/i40e/i40e_rxtx_vec_sse.c > > index bdc979a839..baf83cb3df 100644 > > --- a/drivers/net/i40e/i40e_rxtx_vec_sse.c > > +++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c > > @@ -77,14 +77,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > > } > > > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > > + rx_id = rxq->rxrearm_start - 1; > > + > > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > > rxq->rxrearm_start = 0; > > + rx_id = rxq->nb_rx_desc - 1; > > + } > > > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > > - > > /* Update the tail pointer on the NIC */ > > I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } > > -- > > 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2] net/i40e: remove redundant judgment 2023-05-15 1:59 ` Zhang, Qi Z @ 2023-05-16 1:54 ` Feifei Wang 2023-05-17 2:25 ` Zhang, Qi Z 0 siblings, 1 reply; 6+ messages in thread From: Feifei Wang @ 2023-05-16 1:54 UTC (permalink / raw) To: Zhang, Qi Z, Richardson, Bruce, Konstantin Ananyev, Zhang, Yuying, Xing, Beilei, David Christensen, Ruifeng Wang Cc: dev, nd, Honnappa Nagarahalli, nd > -----Original Message----- > From: Zhang, Qi Z <qi.z.zhang@intel.com> > Sent: Monday, May 15, 2023 9:59 AM > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Feifei Wang > <Feifei.Wang2@arm.com>; Richardson, Bruce <bruce.richardson@intel.com>; > Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>; Zhang, Yuying > <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; David > Christensen <drc@linux.vnet.ibm.com>; Ruifeng Wang > <Ruifeng.Wang@arm.com> > Cc: dev@dpdk.org; nd <nd@arm.com>; Honnappa Nagarahalli > <Honnappa.Nagarahalli@arm.com> > Subject: RE: [PATCH v2] net/i40e: remove redundant judgment > > > > > -----Original Message----- > > From: Zhang, Qi Z <qi.z.zhang@intel.com> > > Sent: Thursday, April 27, 2023 3:38 PM > > To: Feifei Wang <feifei.wang2@arm.com>; Richardson, Bruce > > <bruce.richardson@intel.com>; Konstantin Ananyev > > <konstantin.v.ananyev@yandex.ru>; Zhang, Yuying > > <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; David > > Christensen <drc@linux.vnet.ibm.com>; Ruifeng Wang > > <ruifeng.wang@arm.com> > > Cc: dev@dpdk.org; nd@arm.com; Honnappa Nagarahalli > > <honnappa.nagarahalli@arm.com> > > Subject: RE: [PATCH v2] net/i40e: remove redundant judgment > > > > > > > > > -----Original Message----- > > > From: Feifei Wang <feifei.wang2@arm.com> > > > Sent: Tuesday, March 28, 2023 3:28 PM > > > To: Richardson, Bruce <bruce.richardson@intel.com>; Konstantin > > > Ananyev <konstantin.v.ananyev@yandex.ru>; Zhang, Yuying > > > <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; > > > David Christensen <drc@linux.vnet.ibm.com>; Ruifeng Wang > > > <ruifeng.wang@arm.com> > > > Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>; > > > Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > > > Subject: [PATCH v2] net/i40e: remove redundant judgment > > > > > > Merged variable updates under the same condition. It reduces branch. > > > > > > In ampere-altra, there is no performance improvement with this patch. > > > In x86 sse and avx2 path, there is also no performance improvement. > > > > Thanks for sharing the results. While the code implements some best > > practices, such as reducing branching and adding compiler hints, which > > should generally improve performance, it's not necessary to highlight > > that it didn't provide benefits on certain specific platforms. > > > > Would it be ok to remove the last two lines when merging the patch? > > Ping > Sorry for I did not reply this. I agree with this when merging the patch. Thanks for the comments~. > > > > Otherwise > > Acked-by: Qi Zhang <qi.z.zhang@intel.com> > > > > > > > > > > > > > v2: > > > 1. add change for avx and altivec path. > > > > > > Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > > > Signed-off-by: Feifei Wang <feifei.wang2@arm.com> > > > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> > > > --- > > > drivers/net/i40e/i40e_rxtx_common_avx.h | 9 +++++---- > > > drivers/net/i40e/i40e_rxtx_vec_altivec.c | 9 +++++---- > > > drivers/net/i40e/i40e_rxtx_vec_neon.c | 9 +++++---- > > > drivers/net/i40e/i40e_rxtx_vec_sse.c | 9 +++++---- > > > 4 files changed, 20 insertions(+), 16 deletions(-) > > > > > > diff --git a/drivers/net/i40e/i40e_rxtx_common_avx.h > > > b/drivers/net/i40e/i40e_rxtx_common_avx.h > > > index cfc1e63173..85958d6c81 100644 > > > --- a/drivers/net/i40e/i40e_rxtx_common_avx.h > > > +++ b/drivers/net/i40e/i40e_rxtx_common_avx.h > > > @@ -198,14 +198,15 @@ i40e_rxq_rearm_common(struct > i40e_rx_queue > > *rxq, > > > __rte_unused bool avx512) #endif > > > > > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > > > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > > > + rx_id = rxq->rxrearm_start - 1; > > > + > > > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > > > rxq->rxrearm_start = 0; > > > + rx_id = rxq->nb_rx_desc - 1; > > > + } > > > > > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > > > > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > > > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > > > - > > > /* Update the tail pointer on the NIC */ > > > I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } diff --git > > > a/drivers/net/i40e/i40e_rxtx_vec_altivec.c > > > b/drivers/net/i40e/i40e_rxtx_vec_altivec.c > > > index 2dfa04599c..8672ad1c41 100644 > > > --- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c > > > +++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c > > > @@ -89,14 +89,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > > > } > > > > > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > > > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > > > + rx_id = rxq->rxrearm_start - 1; > > > + > > > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > > > rxq->rxrearm_start = 0; > > > + rx_id = rxq->nb_rx_desc - 1; > > > + } > > > > > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > > > > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > > > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > > > - > > > /* Update the tail pointer on the NIC */ > > > I40E_PCI_REG_WRITE(rxq->qrx_tail, rx_id); } diff --git > > > a/drivers/net/i40e/i40e_rxtx_vec_neon.c > > > b/drivers/net/i40e/i40e_rxtx_vec_neon.c > > > index 12e6f1cbcb..49391fe4c7 100644 > > > --- a/drivers/net/i40e/i40e_rxtx_vec_neon.c > > > +++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c > > > @@ -64,14 +64,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > > > } > > > > > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > > > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > > > + rx_id = rxq->rxrearm_start - 1; > > > + > > > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > > > rxq->rxrearm_start = 0; > > > + rx_id = rxq->nb_rx_desc - 1; > > > + } > > > > > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > > > > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > > > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > > > - > > > rte_io_wmb(); > > > /* Update the tail pointer on the NIC */ > > > I40E_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rx_id); diff --git > > > a/drivers/net/i40e/i40e_rxtx_vec_sse.c > > > b/drivers/net/i40e/i40e_rxtx_vec_sse.c > > > index bdc979a839..baf83cb3df 100644 > > > --- a/drivers/net/i40e/i40e_rxtx_vec_sse.c > > > +++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c > > > @@ -77,14 +77,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > > > } > > > > > > rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; > > > - if (rxq->rxrearm_start >= rxq->nb_rx_desc) > > > + rx_id = rxq->rxrearm_start - 1; > > > + > > > + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { > > > rxq->rxrearm_start = 0; > > > + rx_id = rxq->nb_rx_desc - 1; > > > + } > > > > > > rxq->rxrearm_nb -= RTE_I40E_RXQ_REARM_THRESH; > > > > > > - rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? > > > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > > > - > > > /* Update the tail pointer on the NIC */ > > > I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } > > > -- > > > 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2] net/i40e: remove redundant judgment 2023-05-16 1:54 ` Feifei Wang @ 2023-05-17 2:25 ` Zhang, Qi Z 0 siblings, 0 replies; 6+ messages in thread From: Zhang, Qi Z @ 2023-05-17 2:25 UTC (permalink / raw) To: Feifei Wang, Richardson, Bruce, Konstantin Ananyev, Zhang, Yuying, Xing, Beilei, David Christensen, Ruifeng Wang Cc: dev, nd, Honnappa Nagarahalli, nd > -----Original Message----- > From: Feifei Wang <Feifei.Wang2@arm.com> > Sent: Tuesday, May 16, 2023 9:54 AM > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Richardson, Bruce > <bruce.richardson@intel.com>; Konstantin Ananyev > <konstantin.v.ananyev@yandex.ru>; Zhang, Yuying > <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; David > Christensen <drc@linux.vnet.ibm.com>; Ruifeng Wang > <Ruifeng.Wang@arm.com> > Cc: dev@dpdk.org; nd <nd@arm.com>; Honnappa Nagarahalli > <Honnappa.Nagarahalli@arm.com>; nd <nd@arm.com> > Subject: RE: [PATCH v2] net/i40e: remove redundant judgment > > > -----Original Message----- > > From: Zhang, Qi Z <qi.z.zhang@intel.com> > > Sent: Monday, May 15, 2023 9:59 AM > > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Feifei Wang > > <Feifei.Wang2@arm.com>; Richardson, Bruce > > <bruce.richardson@intel.com>; Konstantin Ananyev > > <konstantin.v.ananyev@yandex.ru>; Zhang, Yuying > > <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; David > > Christensen <drc@linux.vnet.ibm.com>; Ruifeng Wang > > <Ruifeng.Wang@arm.com> > > Cc: dev@dpdk.org; nd <nd@arm.com>; Honnappa Nagarahalli > > <Honnappa.Nagarahalli@arm.com> > > Subject: RE: [PATCH v2] net/i40e: remove redundant judgment > > > > > > > > > -----Original Message----- > > > From: Zhang, Qi Z <qi.z.zhang@intel.com> > > > Sent: Thursday, April 27, 2023 3:38 PM > > > To: Feifei Wang <feifei.wang2@arm.com>; Richardson, Bruce > > > <bruce.richardson@intel.com>; Konstantin Ananyev > > > <konstantin.v.ananyev@yandex.ru>; Zhang, Yuying > > > <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; > > > David Christensen <drc@linux.vnet.ibm.com>; Ruifeng Wang > > > <ruifeng.wang@arm.com> > > > Cc: dev@dpdk.org; nd@arm.com; Honnappa Nagarahalli > > > <honnappa.nagarahalli@arm.com> > > > Subject: RE: [PATCH v2] net/i40e: remove redundant judgment > > > > > > > > > > > > > -----Original Message----- > > > > From: Feifei Wang <feifei.wang2@arm.com> > > > > Sent: Tuesday, March 28, 2023 3:28 PM > > > > To: Richardson, Bruce <bruce.richardson@intel.com>; Konstantin > > > > Ananyev <konstantin.v.ananyev@yandex.ru>; Zhang, Yuying > > > > <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; > > > > David Christensen <drc@linux.vnet.ibm.com>; Ruifeng Wang > > > > <ruifeng.wang@arm.com> > > > > Cc: dev@dpdk.org; nd@arm.com; Feifei Wang > <feifei.wang2@arm.com>; > > > > Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > > > > Subject: [PATCH v2] net/i40e: remove redundant judgment > > > > > > > > Merged variable updates under the same condition. It reduces branch. > > > > > > > > In ampere-altra, there is no performance improvement with this patch. > > > > In x86 sse and avx2 path, there is also no performance improvement. > > > > > > Thanks for sharing the results. While the code implements some best > > > practices, such as reducing branching and adding compiler hints, > > > which should generally improve performance, it's not necessary to > > > highlight that it didn't provide benefits on certain specific platforms. > > > > > > Would it be ok to remove the last two lines when merging the patch? > > > > Ping > > > Sorry for I did not reply this. I agree with this when merging the patch. > Thanks for the comments~. > > > > > > Otherwise > > > Acked-by: Qi Zhang <qi.z.zhang@intel.com> Applied to dpdk-next-net-intel. Thanks Qi ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-05-17 2:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-12-20 5:42 [PATCH] net/i40e: remove redundant judgment for rearm Feifei Wang 2023-03-28 7:28 ` [PATCH v2] net/i40e: remove redundant judgment Feifei Wang 2023-04-27 7:37 ` Zhang, Qi Z 2023-05-15 1:59 ` Zhang, Qi Z 2023-05-16 1:54 ` Feifei Wang 2023-05-17 2:25 ` Zhang, Qi Z
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).