]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ibmvnic: Reduce memcpys in tx descriptor generation
authorNick Child <nnac123@linux.ibm.com>
Wed, 7 Aug 2024 21:18:05 +0000 (16:18 -0500)
committerJakub Kicinski <kuba@kernel.org>
Sat, 10 Aug 2024 05:09:18 +0000 (22:09 -0700)
commitd95f749a0b5e42a30d7025d19c15a11c1a570e72
treeda213d12f9c0b27c4693fcc17a4a7189db197f85
parentb41b45ecee6ba74bd590b113be9f349c6b818b46
ibmvnic: Reduce memcpys in tx descriptor generation

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>
Link: https://patch.msgid.link/20240807211809.1259563-4-nnac123@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ibm/ibmvnic.c