lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 13 Jan 2020 15:57:58 +0100
From:   Antoine Tenart <antoine.tenart@...tlin.com>
To:     Jiri Pirko <jiri@...nulli.us>
Cc:     Antoine Tenart <antoine.tenart@...tlin.com>, davem@...emloft.net,
        sd@...asysnail.net, andrew@...n.ch, f.fainelli@...il.com,
        hkallweit1@...il.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com,
        alexandre.belloni@...tlin.com, allan.nielsen@...rochip.com,
        camelia.groza@....com, Simon.Edelhaus@...antia.com,
        Igor.Russkikh@...antia.com, jakub.kicinski@...ronome.com
Subject: Re: [PATCH net-next v5 05/15] net: macsec: hardware offloading
 infrastructure

Hello Jiri,

On Mon, Jan 13, 2020 at 03:34:52PM +0100, Jiri Pirko wrote:
> Fri, Jan 10, 2020 at 05:20:00PM CET, antoine.tenart@...tlin.com wrote:
> 
> Couple nitpicks I randomly spotted:
> 
> [...]
> 
> 
> >+static bool macsec_is_offloaded(struct macsec_dev *macsec)
> >+{
> >+	if (macsec->offload == MACSEC_OFFLOAD_PHY)
> >+		return true;
> >+
> >+	return false;
> 
> Just:
> 	return macsec->offload == MACSEC_OFFLOAD_PHY;

This construction is because I split the phy offloading support from the
MAC one, and this check becomes more complex when the MAC offloading
support is applied. I could check it's not MACSEC_OFFLOAD_OFF, but I
think it's nice having the default set to false when reading the code.

> >+/* Checks if underlying layers implement MACsec offloading functions. */
> >+static bool macsec_check_offload(enum macsec_offload offload,
> >+				 struct macsec_dev *macsec)
> >+{
> >+	if (!macsec || !macsec->real_dev)
> >+		return false;
> >+
> >+	if (offload == MACSEC_OFFLOAD_PHY)
> 
> You have a helper for this already - macsec_is_offloaded(). No need for
> "offload" arg then.

Same here, except the _PHY case is different from the _MAC one. So the
check needs to be specific to _PHY.

> >+		return macsec->real_dev->phydev &&
> >+		       macsec->real_dev->phydev->macsec_ops;
> >+
> >+	return false;
> >+}
> >+
> >+static const struct macsec_ops *__macsec_get_ops(enum macsec_offload offload,
> >+						 struct macsec_dev *macsec,
> >+						 struct macsec_context *ctx)
> >+{
> >+	if (ctx) {
> >+		memset(ctx, 0, sizeof(*ctx));
> >+		ctx->offload = offload;
> >+
> >+		if (offload == MACSEC_OFFLOAD_PHY)
> 
> Same here.

Same here.

Thanks,
Antoine

-- 
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ