Skip to content

Commit ba69d29

Browse files
committed
i40e: use generic unrolled_count() macro
JIRA: https://issues.redhat.com/browse/RHEL-83573 commit 9144e6f Author: Alexander Lobakin <aleksander.lobakin@intel.com> Date: Thu Feb 6 19:26:27 2025 +0100 i40e: use generic unrolled_count() macro i40e, as well as ice, has a custom loop unrolling macro for unrolling Tx descriptors filling on XSk xmit. Replace i40e defs with generic unrolled_count(), which is also more convenient as it allows passing defines as its argument, not hardcoded values, while the loop declaration will still be a usual for-loop. Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Link: https://patch.msgid.link/20250206182630.3914318-3-aleksander.lobakin@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Dennis Chen <dechen@redhat.com>
1 parent d4181c4 commit ba69d29

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

drivers/net/ethernet/intel/i40e/i40e_xsk.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* Copyright(c) 2018 Intel Corporation. */
33

44
#include <linux/bpf_trace.h>
5+
#include <linux/unroll.h>
56
#include <net/xdp_sock_drv.h>
67
#include "i40e_txrx_common.h"
78
#include "i40e_xsk.h"
@@ -553,7 +554,8 @@ static void i40e_xmit_pkt_batch(struct i40e_ring *xdp_ring, struct xdp_desc *des
553554
dma_addr_t dma;
554555
u32 i;
555556

556-
loop_unrolled_for(i = 0; i < PKTS_PER_BATCH; i++) {
557+
unrolled_count(PKTS_PER_BATCH)
558+
for (i = 0; i < PKTS_PER_BATCH; i++) {
557559
u32 cmd = I40E_TX_DESC_CMD_ICRC | xsk_is_eop_desc(&desc[i]);
558560

559561
dma = xsk_buff_raw_get_dma(xdp_ring->xsk_pool, desc[i].addr);

drivers/net/ethernet/intel/i40e/i40e_xsk.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,14 @@
66

77
#include <linux/types.h>
88

9-
/* This value should match the pragma in the loop_unrolled_for
9+
/* This value should match the pragma in the unrolled_count()
1010
* macro. Why 4? It is strictly empirical. It seems to be a good
1111
* compromise between the advantage of having simultaneous outstanding
1212
* reads to the DMA array that can hide each others latency and the
1313
* disadvantage of having a larger code path.
1414
*/
1515
#define PKTS_PER_BATCH 4
1616

17-
#ifdef __clang__
18-
#define loop_unrolled_for _Pragma("clang loop unroll_count(4)") for
19-
#elif __GNUC__ >= 8
20-
#define loop_unrolled_for _Pragma("GCC unroll 4") for
21-
#else
22-
#define loop_unrolled_for for
23-
#endif
24-
2517
struct i40e_ring;
2618
struct i40e_vsi;
2719
struct net_device;

0 commit comments

Comments
 (0)