From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"John Fastabend" <john.fastabend@gmail.com>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Jose E. Marchesi" <jose.marchesi@oracle.com>,
"Toke Høiland-Jørgensen" <toke@redhat.com>,
"Magnus Karlsson" <magnus.karlsson@intel.com>,
"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
"Jason Baron" <jbaron@akamai.com>,
"Casey Schaufler" <casey@schaufler-ca.com>,
"Nathan Chancellor" <nathan@kernel.org>,
bpf@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/4] i40e: use generic unrolled_count() macro
Date: Mon, 10 Feb 2025 13:30:08 +0100 [thread overview]
Message-ID: <Z6nxUIK/xApn8B8N@boxer> (raw)
In-Reply-To: <20250206182630.3914318-3-aleksander.lobakin@intel.com>
On Thu, Feb 06, 2025 at 07:26:27PM +0100, Alexander Lobakin wrote:
> 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>
> ---
> drivers/net/ethernet/intel/i40e/i40e_xsk.h | 10 +---------
> drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 +++-
> 2 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.h b/drivers/net/ethernet/intel/i40e/i40e_xsk.h
> index ef156fad52f2..dd16351a7af8 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.h
> @@ -6,7 +6,7 @@
>
> #include <linux/types.h>
>
> -/* This value should match the pragma in the loop_unrolled_for
> +/* This value should match the pragma in the unrolled_count()
> * macro. Why 4? It is strictly empirical. It seems to be a good
> * compromise between the advantage of having simultaneous outstanding
> * reads to the DMA array that can hide each others latency and the
> @@ -14,14 +14,6 @@
> */
> #define PKTS_PER_BATCH 4
>
> -#ifdef __clang__
> -#define loop_unrolled_for _Pragma("clang loop unroll_count(4)") for
> -#elif __GNUC__ >= 8
> -#define loop_unrolled_for _Pragma("GCC unroll 4") for
> -#else
> -#define loop_unrolled_for for
> -#endif
> -
> struct i40e_ring;
> struct i40e_vsi;
> struct net_device;
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> index e28f1905a4a0..9f47388eaba5 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> @@ -2,6 +2,7 @@
> /* Copyright(c) 2018 Intel Corporation. */
>
> #include <linux/bpf_trace.h>
> +#include <linux/unroll.h>
> #include <net/xdp_sock_drv.h>
> #include "i40e_txrx_common.h"
> #include "i40e_xsk.h"
> @@ -529,7 +530,8 @@ static void i40e_xmit_pkt_batch(struct i40e_ring *xdp_ring, struct xdp_desc *des
> dma_addr_t dma;
> u32 i;
>
> - loop_unrolled_for(i = 0; i < PKTS_PER_BATCH; i++) {
> + unrolled_count(PKTS_PER_BATCH)
> + for (i = 0; i < PKTS_PER_BATCH; i++) {
> u32 cmd = I40E_TX_DESC_CMD_ICRC | xsk_is_eop_desc(&desc[i]);
>
> dma = xsk_buff_raw_get_dma(xdp_ring->xsk_pool, desc[i].addr);
> --
> 2.48.1
>
next prev parent reply other threads:[~2025-02-10 12:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 18:26 [PATCH net-next 0/4] xsk: the lost bits from Chapter III Alexander Lobakin
2025-02-06 18:26 ` [PATCH net-next 1/4] unroll: add generic loop unroll helpers Alexander Lobakin
2025-02-09 11:07 ` Simon Horman
2025-02-10 12:28 ` Maciej Fijalkowski
2025-02-10 15:49 ` Alexander Lobakin
2025-02-10 21:08 ` Simon Horman
2025-02-11 1:56 ` Jakub Kicinski
2025-02-06 18:26 ` [PATCH net-next 2/4] i40e: use generic unrolled_count() macro Alexander Lobakin
2025-02-10 12:30 ` Maciej Fijalkowski [this message]
2025-02-10 22:28 ` David Laight
2025-02-06 18:26 ` [PATCH net-next 3/4] ice: " Alexander Lobakin
2025-02-10 12:31 ` Maciej Fijalkowski
2025-02-06 18:26 ` [PATCH net-next 4/4] xsk: add helper to get &xdp_desc's DMA and meta pointer in one go Alexander Lobakin
2025-02-09 11:03 ` Simon Horman
2025-02-10 16:00 ` Alexander Lobakin
2025-02-10 21:06 ` Simon Horman
2025-02-11 2:00 ` [PATCH net-next 0/4] xsk: the lost bits from Chapter III patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z6nxUIK/xApn8B8N@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=casey@schaufler-ca.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jbaron@akamai.com \
--cc=john.fastabend@gmail.com \
--cc=jose.marchesi@oracle.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=magnus.karlsson@intel.com \
--cc=nathan@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=toke@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).