Skip to contentSkip to conversation

net/bnxt: remove useless prefetches

PATCH In review Stephen Hemminger 3 participants 3 messages Nov 4, 2020 – Nov 5, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/bnxt: remove useless prefetches

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.

---
 drivers/net/bnxt/bnxt_rxr.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +0 -4
index 2645ed61f402..140d79e0e829 100644
@@ -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))
Signature · 1 line
2.27.0
Acked-by on v1 1/1
#1 lore raw
Quoted 43 lines · 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.

---
 drivers/net/bnxt/bnxt_rxr.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +0 -5
index 2645ed61f402..140d79e0e829 100644
@@ -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))
--
Quoted 2 lines

2.27.0

#2 lore raw
Quoted 45 lines · Lance Richardson
Quoted 18 lines · 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.

---
 drivers/net/bnxt/bnxt_rxr.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +0 -0
index 2645ed61f402..140d79e0e829 100644

drivers/net/bnxt/bnxt_rxr.c static inline struct rte_mbuf *bnxt_tpa_end( · line 309

Quoted 6 lines
drivers/net/bnxt/bnxt_rxr.c +0 -1
@@ -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);

drivers/net/bnxt/bnxt_rxr.c uint16_t bnxt_recv_pkts(void *rx_queue, struct

Quoted 11 lines
drivers/net/bnxt/bnxt_rxr.c +0 -2
        }
@@ -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,

Quoted 6 lines
drivers/net/bnxt/bnxt_rxr.c +0 -1
        /* 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];
 
Quoted 6 lines
Quoted 4 lines
drivers/net/bnxt/bnxt_rxr.c +0 -1
                if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
--

2.27.0

Updated commit log with fixes tag and applied to dpdk-next-net-brcm.