public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine•com>
To: Jakub Kicinski <kuba@kernel•org>
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, john.fastabend@gmail•com,
	anirudh.venkataramanan@intel•com, maxtram95@gmail•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 09:38:30 +0200	[thread overview]
Message-ID: <ZIludj9blHkIovR3@corigine.com> (raw)
In-Reply-To: <20230613205006.1995873-1-kuba@kernel.org>

On Tue, Jun 13, 2023 at 01:50:06PM -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>

Thanks. This looks correct.
And try as I did, I couldn't find anything missing.

Reviewed-by: Simon Horman <simon.horman@corigine•com>

> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 007cec23a92f..16405b84dc2f 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -5442,7 +5442,7 @@ static netdev_tx_t bond_tls_device_xmit(struct bonding *bond, struct sk_buff *sk
>  {
>  	struct net_device *tls_netdev = rcu_dereference(tls_get_ctx(skb->sk)->netdev);
>  
> -	/* tls_netdev might become NULL, even if tls_is_sk_tx_device_offloaded
> +	/* tls_netdev might become NULL, even if tls_is_skb_tx_device_offloaded
>  	 * was true, if tls_device_down is running in parallel, but it's OK,
>  	 * because bond_get_slave_by_dev has a NULL check.
>  	 */
> @@ -5461,7 +5461,7 @@ static netdev_tx_t __bond_start_xmit(struct sk_buff *skb, struct net_device *dev
>  		return NETDEV_TX_OK;
>  
>  #if IS_ENABLED(CONFIG_TLS_DEVICE)
> -	if (skb->sk && tls_is_sk_tx_device_offloaded(skb->sk))
> +	if (tls_is_skb_tx_device_offloaded(skb))
>  		return bond_tls_device_xmit(bond, skb, dev);
>  #endif

<2c>
Possibly some further shuffling, perhaps by making bond_tls_device_xmit
do nothing if CONFIG_TLS_DEVICE isn't enabled, could remove the #if from
here. But possibly that wouldn't be an improvement anyway.
</2c>

  parent reply	other threads:[~2023-06-14  7:38 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
2023-06-14  7:38 ` Simon Horman [this message]
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=ZIludj9blHkIovR3@corigine.com \
    --to=simon.horman@corigine$(echo .)com \
    --cc=andy@greyhouse$(echo .)net \
    --cc=anirudh.venkataramanan@intel$(echo .)com \
    --cc=ayush.sawal@chelsio$(echo .)com \
    --cc=borisp@nvidia$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=dmichail@fungible$(echo .)com \
    --cc=edumazet@google$(echo .)com \
    --cc=gal@nvidia$(echo .)com \
    --cc=j.vosburgh@gmail$(echo .)com \
    --cc=john.fastabend@gmail$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=leon@kernel$(echo .)org \
    --cc=linux-rdma@vger$(echo .)kernel.org \
    --cc=liorna@nvidia$(echo .)com \
    --cc=louis.peens@corigine$(echo .)com \
    --cc=maxtram95@gmail$(echo .)com \
    --cc=na.wang@corigine$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=oss-drivers@corigine$(echo .)com \
    --cc=pabeni@redhat$(echo .)com \
    --cc=raeds@nvidia$(echo .)com \
    --cc=rajur@chelsio$(echo .)com \
    --cc=saeedm@nvidia$(echo .)com \
    --cc=tariqt@nvidia$(echo .)com \
    --cc=yinjun.zhang@corigine$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox