lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 20 Apr 2023 16:49:06 +0200
From:   Alexander Lobakin <aleksander.lobakin@...el.com>
To:     Horatiu Vultur <horatiu.vultur@...rochip.com>
CC:     <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <bpf@...r.kernel.org>, <davem@...emloft.net>,
        <edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
        <daniel@...earbox.net>, <hawk@...nel.org>,
        <john.fastabend@...il.com>, <richardcochran@...il.com>,
        <UNGLinuxDriver@...rochip.com>, <maciej.fijalkowski@...el.com>,
        <alexandr.lobakin@...el.com>
Subject: Re: [PATCH net-next] net: lan966x: Don't use xdp_frame when action is
 XDP_TX

From: Horatiu Vultur <horatiu.vultur@...rochip.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@...rochip.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ