From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<bpf@vger.kernel.org>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<daniel@iogearbox.net>, <hawk@kernel.org>,
<john.fastabend@gmail.com>, <richardcochran@gmail.com>,
<UNGLinuxDriver@microchip.com>, <maciej.fijalkowski@intel.com>,
<alexandr.lobakin@intel.com>
Subject: Re: [PATCH net-next] net: lan966x: Don't use xdp_frame when action is XDP_TX
Date: Thu, 20 Apr 2023 16:49:06 +0200 [thread overview]
Message-ID: <f79e2dde-6d45-cc97-0cde-05454bdb5077@intel.com> (raw)
In-Reply-To: <20230420121152.2737625-1-horatiu.vultur@microchip.com>
From: Horatiu Vultur <horatiu.vultur@microchip.com>
Date: Thu, 20 Apr 2023 14:11:52 +0200
> When the action of an xdp program was XDP_TX, lan966x was creating
> a xdp_frame and use this one to send the frame back. But it is also
> possible to send back the frame without needing a xdp_frame, because
> it possible to send it back using the page.
> And then once the frame is transmitted is possible to use directly
> page_pool_recycle_direct as lan966x is using page pools.
> This would save some CPU usage on this path.
>
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
[...]
> @@ -702,6 +704,7 @@ static void lan966x_fdma_tx_start(struct lan966x_tx *tx, int next_to_use)
> int lan966x_fdma_xmit_xdpf(struct lan966x_port *port,
> struct xdp_frame *xdpf,
> struct page *page,
> + u32 len,
> bool dma_map)
I think you can cut the number of arguments by almost a half:
int lan966x_fdma_xmit_xdpf(struct lan966x_port *port,
void *ptr, u32 len)
{
if (len) {
/* XDP_TX, ptr is page */
page = ptr;
dma_sync_here(page, len);
} else {
/* XDP_REDIR, ptr is xdp_frame */
xdpf = ptr;
dma_map_here(xdpf->data, xdpf->len);
}
@page and @xdpf are mutually exclusive. When @xdpf is non-null, @len is
excessive (xdpf->len is here), so you can use @len as logical
`len * !dma_map`, i.e. zero for REDIR and the actual frame length for TX.
I generally enjoy seeing how you constantly improve stuff in your driver :)
> {
> struct lan966x *lan966x = port->lan966x;
> @@ -722,6 +725,15 @@ int lan966x_fdma_xmit_xdpf(struct lan966x_port *port,
> goto out;
> }
[...]
Thanks,
Olek
next prev parent reply other threads:[~2023-04-20 14:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 12:11 Horatiu Vultur
2023-04-20 14:49 ` Alexander Lobakin [this message]
2023-04-21 7:49 ` Horatiu Vultur
2023-04-20 20:52 ` Maciej Fijalkowski
2023-04-21 8:03 ` Horatiu Vultur
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=f79e2dde-6d45-cc97-0cde-05454bdb5077@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandr.lobakin@intel.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horatiu.vultur@microchip.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.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
all inboxes | Powered by JetHome®