OSDN Git Service

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)
commitb1a6f56b6506c2cecef301b5c3804be656a8c334
tree9e52be62727bdab332d02431856fc298859cbdc8
parent1ddcbfbf9dc9b59258dc5a4429f607a6828863d0
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