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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240807131639.GA2991391@kernel.org>
Date: Wed, 7 Aug 2024 14:16:39 +0100
From: Simon Horman <horms@...nel.org>
To: Nick Child <nnac123@...ux.ibm.com>
Cc: netdev@...r.kernel.org, bjking1@...ux.ibm.com, haren@...ux.ibm.com,
	ricklind@...ibm.com
Subject: Re: [PATCH net-next v2 3/7] ibmvnic: Reduce memcpys in tx descriptor
 generation

On Tue, Aug 06, 2024 at 02:37:02PM -0500, Nick Child wrote:
> Previously when creating the header descriptors, the driver would:
> 1. allocate a temporary buffer on the stack (in build_hdr_descs_arr)
> 2. memcpy the header info into the temporary buffer (in build_hdr_data)
> 3. memcpy the temp buffer into a local variable (in create_hdr_descs)
> 4. copy the local variable into the return buffer (in create_hdr_descs)
> 
> Since, there is no opportunity for errors during this process, the temp
> buffer is not needed and work can be done on the return buffer directly.
> 
> Repurpose build_hdr_data() to only calculate the header lengths. Rename
> it to get_hdr_lens().
> Edit create_hdr_descs() to read from the skb directly and copy directly
> into the returned useful buffer.
> 
> The process now involves less memory and write operations while
> also being more readable.
> 
> Signed-off-by: Nick Child <nnac123@...ux.ibm.com>
> ---
>  drivers/net/ethernet/ibm/ibmvnic.c | 80 +++++++++++++-----------------
>  1 file changed, 34 insertions(+), 46 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index 7d552d4bbe15..4fe2c8c17b05 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -2150,46 +2150,38 @@ static int ibmvnic_close(struct net_device *netdev)
>   * Builds a buffer containing these headers.  Saves individual header
>   * lengths and total buffer length to be used to build descriptors.
>   */
> -static int build_hdr_data(u8 hdr_field, struct sk_buff *skb,
> -			  int *hdr_len, u8 *hdr_data)
> +static int get_hdr_lens(u8 hdr_field, struct sk_buff *skb,
> +			int *hdr_len)

nit: The Kernel doc immediately above this function should be updated to
     reflect the new name of the function and removal of one parameter.

     Also, although not strictly related to this patch, ideally it should
     include a "Return:" or "Returns:" section.

Flagged by W=1 builds and ./scripts/kernel-doc -none -Wall

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ