DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/bnxt: remove useless prefetches
@ 2020-11-04 17:03 Stephen Hemminger
  2020-11-05 15:18 ` Lance Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2020-11-04 17:03 UTC (permalink / raw)
  To: ajit.khaparde, somnath.kotur; +Cc: dev, Stephen Hemminger

Prefetching only helps performance if it is done several 100
instructions before the actual use. The purpose of the prefetch
is to read ahead, it doesn't help if the next instruction
will block.

The code in the bnxt driver was doing these unnecessary prefetches.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnxt/bnxt_rxr.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 2645ed61f402..140d79e0e829 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -305,7 +305,6 @@ static inline struct rte_mbuf *bnxt_tpa_end(
 	mbuf = tpa_info->mbuf;
 	RTE_ASSERT(mbuf != NULL);
 
-	rte_prefetch0(mbuf);
 	if (agg_bufs) {
 		bnxt_rx_pages(rxq, mbuf, raw_cp_cons, agg_bufs, tpa_info);
 	}
@@ -733,8 +732,6 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	if (mbuf == NULL)
 		return -EBUSY;
 
-	rte_prefetch0(mbuf);
-
 	mbuf->data_off = RTE_PKTMBUF_HEADROOM;
 	mbuf->nb_segs = 1;
 	mbuf->next = NULL;
@@ -867,7 +864,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	/* Handle RX burst request */
 	while (1) {
 		cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
-		rte_prefetch0(&cpr->cp_desc_ring[cons]);
 		rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
 
 		if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
-- 
2.27.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/bnxt: remove useless prefetches
  2020-11-04 17:03 [dpdk-dev] [PATCH] net/bnxt: remove useless prefetches Stephen Hemminger
@ 2020-11-05 15:18 ` Lance Richardson
  2020-11-05 22:24   ` Ajit Khaparde
  0 siblings, 1 reply; 3+ messages in thread
From: Lance Richardson @ 2020-11-05 15:18 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Ajit Kumar Khaparde, Somnath Kotur, dev

On Wed, Nov 4, 2020 at 12:03 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Prefetching only helps performance if it is done several 100
> instructions before the actual use. The purpose of the prefetch
> is to read ahead, it doesn't help if the next instruction
> will block.
>
> The code in the bnxt driver was doing these unnecessary prefetches.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/net/bnxt/bnxt_rxr.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
> index 2645ed61f402..140d79e0e829 100644
> --- a/drivers/net/bnxt/bnxt_rxr.c
> +++ b/drivers/net/bnxt/bnxt_rxr.c
> @@ -305,7 +305,6 @@ static inline struct rte_mbuf *bnxt_tpa_end(
>         mbuf = tpa_info->mbuf;
>         RTE_ASSERT(mbuf != NULL);
>
> -       rte_prefetch0(mbuf);
>         if (agg_bufs) {
>                 bnxt_rx_pages(rxq, mbuf, raw_cp_cons, agg_bufs, tpa_info);
>         }
> @@ -733,8 +732,6 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
>         if (mbuf == NULL)
>                 return -EBUSY;
>
> -       rte_prefetch0(mbuf);
> -
>         mbuf->data_off = RTE_PKTMBUF_HEADROOM;
>         mbuf->nb_segs = 1;
>         mbuf->next = NULL;
> @@ -867,7 +864,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
>         /* Handle RX burst request */
>         while (1) {
>                 cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
> -               rte_prefetch0(&cpr->cp_desc_ring[cons]);
>                 rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
>
>                 if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
> --
> 2.27.0
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/bnxt: remove useless prefetches
  2020-11-05 15:18 ` Lance Richardson
@ 2020-11-05 22:24   ` Ajit Khaparde
  0 siblings, 0 replies; 3+ messages in thread
From: Ajit Khaparde @ 2020-11-05 22:24 UTC (permalink / raw)
  To: Lance Richardson; +Cc: Stephen Hemminger, Somnath Kotur, dpdk-dev

On Thu, Nov 5, 2020 at 7:18 AM Lance Richardson <
lance.richardson@broadcom.com> wrote:

> On Wed, Nov 4, 2020 at 12:03 PM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > Prefetching only helps performance if it is done several 100
> > instructions before the actual use. The purpose of the prefetch
> > is to read ahead, it doesn't help if the next instruction
> > will block.
> >
> > The code in the bnxt driver was doing these unnecessary prefetches.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  drivers/net/bnxt/bnxt_rxr.c | 4 ----
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
> > index 2645ed61f402..140d79e0e829 100644
> > --- a/drivers/net/bnxt/bnxt_rxr.c
> > +++ b/drivers/net/bnxt/bnxt_rxr.c
> > @@ -305,7 +305,6 @@ static inline struct rte_mbuf *bnxt_tpa_end(
> >         mbuf = tpa_info->mbuf;
> >         RTE_ASSERT(mbuf != NULL);
> >
> > -       rte_prefetch0(mbuf);
> >         if (agg_bufs) {
> >                 bnxt_rx_pages(rxq, mbuf, raw_cp_cons, agg_bufs,
> tpa_info);
> >         }
> > @@ -733,8 +732,6 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
> >         if (mbuf == NULL)
> >                 return -EBUSY;
> >
> > -       rte_prefetch0(mbuf);
> > -
> >         mbuf->data_off = RTE_PKTMBUF_HEADROOM;
> >         mbuf->nb_segs = 1;
> >         mbuf->next = NULL;
> > @@ -867,7 +864,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct
> rte_mbuf **rx_pkts,
> >         /* Handle RX burst request */
> >         while (1) {
> >                 cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
> > -               rte_prefetch0(&cpr->cp_desc_ring[cons]);
> >                 rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
> >
> >                 if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
> > --
> > 2.27.0
> >
> Acked-by: Lance Richardson <lance.richardson@broadcom.com>
>
Updated commit log with fixes tag and applied to dpdk-next-net-brcm.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-05 22:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 17:03 [dpdk-dev] [PATCH] net/bnxt: remove useless prefetches Stephen Hemminger
2020-11-05 15:18 ` Lance Richardson
2020-11-05 22:24   ` Ajit Khaparde

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).