• Jakub Kicinski's avatar
    net/tls: remove the record tail optimization · e7b159a4
    Jakub Kicinski authored
    For TLS device offload the tag/message authentication code are
    filled in by the device. The kernel merely reserves space for
    them. Because device overwrites it, the contents of the tag make
    do no matter. Current code tries to save space by reusing the
    header as the tag. This, however, leads to an additional frag
    being created and defeats buffer coalescing (which trickles
    all the way down to the drivers).
    
    Remove this optimization, and try to allocate the space for
    the tag in the usual way, leave the memory uninitialized.
    If memory allocation fails rewind the record pointer so that
    we use the already copied user data as tag.
    
    Note that the optimization was actually buggy, as the tag
    for TLS 1.2 is 16 bytes, but header is just 13, so the reuse
    may had looked past the end of the page..
    Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
    Reviewed-by: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e7b159a4
tls_device.c 29.9 KB