]> git.baikalelectronics.ru Git - kernel.git/commit
net/tls: optimize judgement processes in tls_set_device_offload()
authorZiyang Xuan <william.xuanziyang@huawei.com>
Sat, 19 Mar 2022 03:15:20 +0000 (11:15 +0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 21 Mar 2022 21:58:16 +0000 (14:58 -0700)
commit3245946d56699e53fc1860ddaefe05f57e7551c3
tree9e52be62727bdab332d02431856fc298859cbdc8
parente749a51ba890a254e798033b5ddf8d125073cad8
net/tls: optimize judgement processes in tls_set_device_offload()

It is known that priority setting HW offload when set tls TX/RX offload
by setsockopt(). Check netdevice whether support NETIF_F_HW_TLS_TX or
not at the later stages in the whole tls_set_device_offload() process,
some memory allocations have been done before that. We must release those
memory and return error if we judge the netdevice not support
NETIF_F_HW_TLS_TX. It is redundant.

Move NETIF_F_HW_TLS_TX judgement forward, and move start_marker_record
and offload_ctx memory allocation back slightly. Thus, we can get
simpler exception handling process.

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/tls/tls_device.c