diff options
author | Jakub Kicinski <kuba@kernel.org> | 2023-06-13 22:50:06 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-06-15 10:01:05 +0200 |
commit | ed3c9a2fcab3b60b0766eb5d7566fd3b10df9a8e (patch) | |
tree | 76d8edce93760a8a518efaa9fb774ced54907009 /include/net/tls.h | |
parent | Merge branch 'macb-partial-store-and-forward' (diff) | |
download | linux-ed3c9a2fcab3b60b0766eb5d7566fd3b10df9a8e.tar.xz linux-ed3c9a2fcab3b60b0766eb5d7566fd3b10df9a8e.zip |
net: tls: make the offload check helper take skb not socket
All callers of tls_is_sk_tx_device_offloaded() currently do
an equivalent of:
if (skb->sk && tls_is_skb_tx_device_offloaded(skb->sk))
Have the helper accept skb and do the skb->sk check locally.
Two drivers have local static inlines with similar wrappers
already.
While at it change the ifdef condition to TLS_DEVICE.
Only TLS_DEVICE selects SOCK_VALIDATE_XMIT, so the two are
equivalent. This makes removing the duplicated IS_ENABLED()
check in funeth more obviously correct.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Tariq Toukan <tariqt@nvidia.com>
Acked-by: Dimitris Michailidis <dmichail@fungible.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tls.h')
-rw-r--r-- | include/net/tls.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/net/tls.h b/include/net/tls.h index b7d0f1e3058b..5e71dd3df8ca 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -370,10 +370,12 @@ struct sk_buff * tls_validate_xmit_skb_sw(struct sock *sk, struct net_device *dev, struct sk_buff *skb); -static inline bool tls_is_sk_tx_device_offloaded(struct sock *sk) +static inline bool tls_is_skb_tx_device_offloaded(const struct sk_buff *skb) { -#ifdef CONFIG_SOCK_VALIDATE_XMIT - return sk_fullsock(sk) && +#ifdef CONFIG_TLS_DEVICE + struct sock *sk = skb->sk; + + return sk && sk_fullsock(sk) && (smp_load_acquire(&sk->sk_validate_xmit_skb) == &tls_validate_xmit_skb); #else |