[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240819143753.GF11472@kernel.org>
Date: Mon, 19 Aug 2024 15:37:53 +0100
From: Simon Horman <horms@...nel.org>
To: Hangbin Liu <liuhangbin@...il.com>
Cc: netdev@...r.kernel.org, Jay Vosburgh <j.vosburgh@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Nikolay Aleksandrov <razor@...ckwall.org>,
Tariq Toukan <tariqt@...dia.com>, Jianbo Liu <jianbol@...dia.com>,
Sabrina Dubroca <sd@...asysnail.net>
Subject: Re: [PATCHv2 net-next 1/3] bonding: add common function to check
ipsec device
On Mon, Aug 19, 2024 at 03:53:31PM +0800, Hangbin Liu wrote:
> This patch adds a common function to check the status of IPSec devices.
> This function will be useful for future implementations, such as IPSec ESN
> and state offload callbacks.
>
> Suggested-by: Nikolay Aleksandrov <razor@...ckwall.org>
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> ---
> drivers/net/bonding/bond_main.c | 43 +++++++++++++++++++++++----------
> 1 file changed, 30 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index f9633a6f8571..250a2717b4e9 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -418,6 +418,34 @@ static int bond_vlan_rx_kill_vid(struct net_device *bond_dev,
> /*---------------------------------- XFRM -----------------------------------*/
>
> #ifdef CONFIG_XFRM_OFFLOAD
> +/**
> + * bond_ipsec_dev - return the device for ipsec offload, or NULL if not exist
> + * caller must hold rcu_read_lock.
> + * @xs: pointer to transformer state struct
> + **/
> +static struct net_device bond_ipsec_dev(struct xfrm_state *xs)
Hi Hangbin,
Based on the implementation of the function, it looks like it should return
'struct net_device *' rather than 'struct net_device' (a '*' is missing).
> +{
> + struct net_device *bond_dev = xs->xso.dev;
> + struct net_device *real_dev;
> + struct bonding *bond;
> + struct slave *slave;
> +
> + if (!bond_dev)
> + return NULL;
> +
> + bond = netdev_priv(bond_dev);
> + slave = rcu_dereference(bond->curr_active_slave);
> + real_dev = slave ? slave->dev : NULL;
> +
> + if ((BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) ||
> + !slave || !real_dev || !xs->xso.real_dev)
> + return NULL;
> +
> + WARN_ON(xs->xso.real_dev != slave->dev);
> +
> + return real_dev;
> +}
> +
> /**
> * bond_ipsec_add_sa - program device with a security association
> * @xs: pointer to transformer state struct
--
pw-bot: cr
Powered by blists - more mailing lists