All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antoine Tenart <antoine.tenart@bootlin.com>
To: Igor Russkikh <irusskikh@marvell.com>
Cc: Antoine Tenart <antoine.tenart@bootlin.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"sd@queasysnail.net" <sd@queasysnail.net>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"hkallweit1@gmail.com" <hkallweit1@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"thomas.petazzoni@bootlin.com" <thomas.petazzoni@bootlin.com>,
	"alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>,
	"allan.nielsen@microchip.com" <allan.nielsen@microchip.com>,
	"camelia.groza@nxp.com" <camelia.groza@nxp.com>,
	"Simon.Edelhaus@aquantia.com" <Simon.Edelhaus@aquantia.com>,
	Dmitry Bogdanov <dbogdanov@marvell.com>,
	"jakub.kicinski@netronome.com" <jakub.kicinski@netronome.com>,
	Igor Russkikh <Igor.Russkikh@aquantia.com>
Subject: Re: [EXT] [PATCH net-next v3 05/15] net: macsec: hardware offloading infrastructure
Date: Wed, 18 Dec 2019 15:01:31 +0100	[thread overview]
Message-ID: <20191218140131.GA3325@kwain> (raw)
In-Reply-To: <BYAPR18MB2630684FD194F179E718E198B7530@BYAPR18MB2630.namprd18.prod.outlook.com>

Hello Igor,

On Wed, Dec 18, 2019 at 01:40:39PM +0000, Igor Russkikh wrote:
> > @@ -2922,7 +3300,27 @@ static int macsec_changelink(struct net_device
> > *dev, struct nlattr *tb[],
> >  	    data[IFLA_MACSEC_PORT])
> >  		return -EINVAL;
> >  
> > -	return macsec_changelink_common(dev, data);
> > +	/* If h/w offloading is available, propagate to the device */
> > +	if (macsec_is_offloaded(macsec)) {
> > +		const struct macsec_ops *ops;
> > +		struct macsec_context ctx;
> > +		int ret;
> > +
> > +		ops = macsec_get_ops(netdev_priv(dev), &ctx);
> > +		if (!ops)
> > +			return -EOPNOTSUPP;
> > +
> > +		ctx.secy = &macsec->secy;
> > +		ret = macsec_offload(ops->mdo_upd_secy, &ctx);
> > +		if (ret)
> > +			return ret;
> > +	}
> > +
> > +	ret = macsec_changelink_common(dev, data);
> 
> In our mac driver verification we see that propagating upd_secy to
> device before doing macsec_changelink_common is actually useless,
> since in this case underlying device can't fetch any of the updated
> parameters from the macsec structures.
> 
> Isn't it logical first doing `macsec_changelink_common` and then
> propagate the event?

Doing the macsec_changelink_common after propagating the event to the
device driver was done to ease the fail case scenario (it's quite hard
to revert macsec_changelink_common). But then you're right that many
parameters are set by macsec_changelink_common, which means it must be
performed before the propagation of the upd_secy event.

I think the solution is to keep a copy of unmodified secy and tx_sc, and
in case of failure to revert the operation by copying the whole
structures back. That would allow to move macsec_changelink_common up.
Would that work for you?

Thanks for spotting this!
Antoine

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

  reply	other threads:[~2019-12-18 14:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-13 15:48 [PATCH net-next v3 00/15] net: macsec: initial support for hardware offloading Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 01/15] net: macsec: move some definitions in a dedicated header Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 02/15] net: macsec: introduce the macsec_context structure Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 03/15] net: macsec: introduce MACsec ops Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 04/15] net: phy: add MACsec ops in phy_device Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 05/15] net: macsec: hardware offloading infrastructure Antoine Tenart
2019-12-18 13:40   ` [EXT] " Igor Russkikh
2019-12-18 14:01     ` Antoine Tenart [this message]
2019-12-13 15:48 ` [PATCH net-next v3 06/15] net: macsec: add nla support for changing the offloading selection Antoine Tenart
2019-12-15 21:44   ` David Miller
2019-12-16  8:46     ` Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 07/15] net: phy: export __phy_read_page/__phy_write_page Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 08/15] net: phy: mscc: macsec initialization Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 09/15] net: phy: mscc: macsec support Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 10/15] net: macsec: PN wrap callback Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 11/15] net: phy: mscc: PN rollover support Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 12/15] net: introduce the MACSEC netdev feature Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 13/15] net: add a reference to MACsec ops in net_device Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 14/15] net: macsec: allow to reference a netdev from a MACsec context Antoine Tenart
2019-12-13 15:48 ` [PATCH net-next v3 15/15] net: macsec: add support for offloading to the MAC Antoine Tenart

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=20191218140131.GA3325@kwain \
    --to=antoine.tenart@bootlin.com \
    --cc=Igor.Russkikh@aquantia.com \
    --cc=Simon.Edelhaus@aquantia.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=camelia.groza@nxp.com \
    --cc=davem@davemloft.net \
    --cc=dbogdanov@marvell.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=irusskikh@marvell.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sd@queasysnail.net \
    --cc=thomas.petazzoni@bootlin.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.