From: Jakub Kicinski <kuba@kernel.org>
To: Maxim Mikityanskiy <maxtram95@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, j.vosburgh@gmail.com, andy@greyhouse.net,
rajur@chelsio.com, ayush.sawal@chelsio.com,
dmichail@fungible.com, borisp@nvidia.com, saeedm@nvidia.com,
leon@kernel.org, simon.horman@corigine.com,
john.fastabend@gmail.com, anirudh.venkataramanan@intel.com,
tariqt@nvidia.com, gal@nvidia.com, raeds@nvidia.com,
liorna@nvidia.com, louis.peens@corigine.com,
yinjun.zhang@corigine.com, na.wang@corigine.com,
linux-rdma@vger.kernel.org, oss-drivers@corigine.com
Subject: Re: [PATCH net-next] net: tls: make the offload check helper take skb not socket
Date: Wed, 14 Jun 2023 10:46:04 -0700 [thread overview]
Message-ID: <20230614104605.2f9b205f@kernel.org> (raw)
In-Reply-To: <ZIlng6G_xP3V8O5E@mail.gmail.com>
On Wed, 14 Jun 2023 10:09:02 +0300 Maxim Mikityanskiy wrote:
> On Tue, 13 Jun 2023 at 13:50:06 -0700, Jakub Kicinski wrote:
> > 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>
Thanks!
> > 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
>
> After this change, the only usage of CONFIG_SOCK_VALIDATE_XMIT remains
> in sk_validate_xmit_skb, which has #ifdef CONFIG_TLS_DEVICE inside
> #ifdef CONFIG_SOCK_VALIDATE_XMIT. If feels a little bit weird, given
> that both defines always have the same value, but maybe it's OK if we
> consider that more users can start using sk_validate_xmit_skb in the
> future.
I'm working on another user of CONFIG_SOCK_VALIDATE_XMIT
so let's keep the two separate.
next prev parent reply other threads:[~2023-06-14 17:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 20:50 [PATCH net-next] net: tls: make the offload check helper take skb not socket Jakub Kicinski
2023-06-14 7:09 ` Maxim Mikityanskiy
2023-06-14 17:46 ` Jakub Kicinski [this message]
2023-06-14 7:38 ` Simon Horman
2023-06-14 11:03 ` Tariq Toukan
2023-06-15 1:54 ` Dimitris Michailidis
2023-06-15 8:10 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230614104605.2f9b205f@kernel.org \
--to=kuba@kernel.org \
--cc=andy@greyhouse.net \
--cc=anirudh.venkataramanan@intel.com \
--cc=ayush.sawal@chelsio.com \
--cc=borisp@nvidia.com \
--cc=davem@davemloft.net \
--cc=dmichail@fungible.com \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=j.vosburgh@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=liorna@nvidia.com \
--cc=louis.peens@corigine.com \
--cc=maxtram95@gmail.com \
--cc=na.wang@corigine.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@corigine.com \
--cc=pabeni@redhat.com \
--cc=raeds@nvidia.com \
--cc=rajur@chelsio.com \
--cc=saeedm@nvidia.com \
--cc=simon.horman@corigine.com \
--cc=tariqt@nvidia.com \
--cc=yinjun.zhang@corigine.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.