[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZIludj9blHkIovR3@corigine.com>
Date: Wed, 14 Jun 2023 09:38:30 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, j.vosburgh@...il.com, andy@...yhouse.net,
rajur@...lsio.com, ayush.sawal@...lsio.com, dmichail@...gible.com,
borisp@...dia.com, saeedm@...dia.com, leon@...nel.org,
john.fastabend@...il.com, anirudh.venkataramanan@...el.com,
maxtram95@...il.com, tariqt@...dia.com, gal@...dia.com,
raeds@...dia.com, liorna@...dia.com, louis.peens@...igine.com,
yinjun.zhang@...igine.com, na.wang@...igine.com,
linux-rdma@...r.kernel.org, oss-drivers@...igine.com
Subject: Re: [PATCH net-next] net: tls: make the offload check helper take
skb not socket
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@...nel.org>
Thanks. This looks correct.
And try as I did, I couldn't find anything missing.
Reviewed-by: Simon Horman <simon.horman@...igine.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>
Powered by blists - more mailing lists