Skip to content

Commit cc14db1

Browse files
jbrandebanguy11
authored andcommitted
ice: use prefetch methods
The kernel provides some prefetch mechanisms to speed up commonly cold cache line accesses during receive processing. Since these are software structures it helps to have these strategically placed prefetches. Be careful to call BQL prefetch complete only for non XDP queues. Co-developed-by: Piotr Raczynski <[email protected]> Signed-off-by: Piotr Raczynski <[email protected]> Signed-off-by: Jesse Brandeburg <[email protected]> Tested-by: Gurucharan G <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 1c96c16 commit cc14db1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/net/ethernet/intel/ice/ice_txrx.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
/* The driver transmit and receive code */
55

6-
#include <linux/prefetch.h>
76
#include <linux/mm.h>
7+
#include <linux/netdevice.h>
8+
#include <linux/prefetch.h>
89
#include <linux/bpf_trace.h>
910
#include <net/dsfield.h>
1011
#include <net/xdp.h>
@@ -219,6 +220,10 @@ static bool ice_clean_tx_irq(struct ice_tx_ring *tx_ring, int napi_budget)
219220
struct ice_tx_desc *tx_desc;
220221
struct ice_tx_buf *tx_buf;
221222

223+
/* get the bql data ready */
224+
if (!ice_ring_is_xdp(tx_ring))
225+
netdev_txq_bql_complete_prefetchw(txring_txq(tx_ring));
226+
222227
tx_buf = &tx_ring->tx_buf[i];
223228
tx_desc = ICE_TX_DESC(tx_ring, i);
224229
i -= tx_ring->count;
@@ -232,6 +237,9 @@ static bool ice_clean_tx_irq(struct ice_tx_ring *tx_ring, int napi_budget)
232237
if (!eop_desc)
233238
break;
234239

240+
/* follow the guidelines of other drivers */
241+
prefetchw(&tx_buf->skb->users);
242+
235243
smp_rmb(); /* prevent any other reads prior to eop_desc */
236244

237245
ice_trace(clean_tx_irq, tx_ring, tx_desc, tx_buf);
@@ -2265,6 +2273,9 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_tx_ring *tx_ring)
22652273
return NETDEV_TX_BUSY;
22662274
}
22672275

2276+
/* prefetch for bql data which is infrequently used */
2277+
netdev_txq_bql_enqueue_prefetchw(txring_txq(tx_ring));
2278+
22682279
offload.tx_ring = tx_ring;
22692280

22702281
/* record the location of the first descriptor for this packet */

0 commit comments

Comments
 (0)