From: Simon Horman <horms@kernel.org>
To: Nick Child <nnac123@linux.ibm.com>
Cc: netdev@vger.kernel.org, bjking1@linux.ibm.com,
haren@linux.ibm.com, ricklind@us.ibm.com
Subject: Re: [PATCH net-next v2 3/7] ibmvnic: Reduce memcpys in tx descriptor generation
Date: Wed, 7 Aug 2024 14:16:39 +0100 [thread overview]
Message-ID: <20240807131639.GA2991391@kernel.org> (raw)
In-Reply-To: <20240806193706.998148-4-nnac123@linux.ibm.com>
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@linux.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
...
next prev parent reply other threads:[~2024-08-07 13:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 19:36 [PATCH net-next v2 0/7] ibmvnic rr patchset Nick Child
2024-08-06 19:37 ` [PATCH net-next v2 1/7] ibmvnic: Only replenish rx pool when resources are getting low Nick Child
2024-08-06 19:37 ` [PATCH net-next v2 2/7] ibmvnic: Use header len helper functions on tx Nick Child
2024-08-06 19:37 ` [PATCH net-next v2 3/7] ibmvnic: Reduce memcpys in tx descriptor generation Nick Child
2024-08-07 13:16 ` Simon Horman [this message]
2024-08-06 19:37 ` [PATCH net-next v2 4/7] ibmvnic: Remove duplicate memory barriers in tx Nick Child
2024-08-06 19:37 ` [PATCH net-next v2 5/7] ibmvnic: Introduce send sub-crq direct Nick Child
2024-08-06 19:37 ` [PATCH net-next v2 6/7] ibmvnic: Only record tx completed bytes once per handler Nick Child
2024-08-06 19:37 ` [PATCH net-next v2 7/7] ibmvnic: Perform tx CSO during send scrq direct Nick Child
2024-08-07 15:08 ` Jakub Kicinski
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=20240807131639.GA2991391@kernel.org \
--to=horms@kernel.org \
--cc=bjking1@linux.ibm.com \
--cc=haren@linux.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=nnac123@linux.ibm.com \
--cc=ricklind@us.ibm.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).