• Nick Child's avatar
    ibmvnic: Reduce memcpys in tx descriptor generation · d95f749a
    Nick Child authored
    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: default avatarNick Child <nnac123@linux.ibm.com>
    Link: https://patch.msgid.link/20240807211809.1259563-4-nnac123@linux.ibm.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    d95f749a
ibmvnic.c 183 KB