public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel•org>
To: Ioana Ciornei <ioana.ciornei@nxp•com>
Cc: davem@davemloft•net, edumazet@google•com, kuba@kernel•org,
	pabeni@redhat•com, netdev@vger•kernel.org
Subject: Re: [PATCH net-next v2 6/8] dpaa2-switch: reorganize the [pre]changeupper events
Date: Mon, 18 Dec 2023 08:33:45 +0000	[thread overview]
Message-ID: <20231218083345.GA6288@kernel.org> (raw)
In-Reply-To: <tkskehfowdrohukyhqu4ae6t56ceuwp6p2mm7r2tfzihladl6t@vxeggsm2ppte>

On Fri, Dec 15, 2023 at 02:08:51PM +0200, Ioana Ciornei wrote:
> On Fri, Dec 15, 2023 at 11:49:39AM +0000, Simon Horman wrote:
> > On Wed, Dec 13, 2023 at 02:14:09PM +0200, Ioana Ciornei wrote:

...

> > >  	if (!dpaa2_switch_port_dev_check(netdev))
> > > -		return NOTIFY_DONE;
> > > +		return 0;
> > >  
> > >  	extack = netdev_notifier_info_to_extack(&info->info);
> > > -
> > > -	switch (event) {
> > > -	case NETDEV_PRECHANGEUPPER:
> > > -		upper_dev = info->upper_dev;
> > > -		if (!netif_is_bridge_master(upper_dev))
> > > -			break;
> > > -
> > > +	upper_dev = info->upper_dev;
> > > +	if (netif_is_bridge_master(upper_dev)) {
> > >  		err = dpaa2_switch_prechangeupper_sanity_checks(netdev,
> > >  								upper_dev,
> > >  								extack);
> > >  		if (err)
> > > -			goto out;
> > > +			return err;
> > >  
> > >  		if (!info->linking)
> > >  			dpaa2_switch_port_pre_bridge_leave(netdev);
> > > +	}
> > 
> > FWIIW, I think that a more idomatic flow would be to return if
> > netif_is_bridge_master() is false. Something like this (completely untested!):
> > 
> > 	if (!netif_is_bridge_master(upper_dev))
> > 		return 0;
> > 
> > 	err = dpaa2_switch_prechangeupper_sanity_checks(netdev, upper_dev,
> > 							extack);
> > 	if (err)
> > 		return err;
> > 
> > 	if (!info->linking)
> > 		dpaa2_switch_port_pre_bridge_leave(netdev);
> > 
> 
> It looks better but I don't think this it's easily extensible.
> 
> I am planning to add support for LAG offloading which would mean that I
> would have to revert to the initial flow and extend it to something
> like:
> 
> 	if (netif_is_bridge_master(upper_dev)) {
> 		...
> 	} else if (netif_is_lag_master(upper_dev)) {
> 		...
> 	}
> 
> The same thing applies to the dpaa2_switch_port_changeupper() function
> below.

Understood. If this is going somewhere then don't let me derail it.

,,,

  reply	other threads:[~2023-12-18  8:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 12:14 [PATCH net-next v2 0/8] dpaa2-switch: small improvements Ioana Ciornei
2023-12-13 12:14 ` [PATCH net-next v2 1/8] dpaa2-switch: set interface MAC address only on endpoint change Ioana Ciornei
2023-12-15 11:57   ` Simon Horman
2023-12-13 12:14 ` [PATCH net-next v2 2/8] dpaa2-switch: declare the netdev as IFF_LIVE_ADDR_CHANGE capable Ioana Ciornei
2023-12-15 11:57   ` Simon Horman
2023-12-13 12:14 ` [PATCH net-next v2 3/8] dpaa2-switch: print an error when the vlan is already configured Ioana Ciornei
2023-12-15 11:58   ` Simon Horman
2023-12-13 12:14 ` [PATCH net-next v2 4/8] dpaa2-switch: add ENDPOINT_CHANGED to the irq_mask Ioana Ciornei
2023-12-15 11:51   ` Simon Horman
2023-12-13 12:14 ` [PATCH net-next v2 5/8] dpaa2-switch: do not clear any interrupts automatically Ioana Ciornei
2023-12-15 11:31   ` Simon Horman
2023-12-13 12:14 ` [PATCH net-next v2 6/8] dpaa2-switch: reorganize the [pre]changeupper events Ioana Ciornei
2023-12-15 11:49   ` Simon Horman
2023-12-15 12:08     ` Ioana Ciornei
2023-12-18  8:33       ` Simon Horman [this message]
2023-12-13 12:14 ` [PATCH net-next v2 7/8] dpaa2-switch: move a check to the prechangeupper stage Ioana Ciornei
2023-12-15 11:58   ` Simon Horman
2023-12-13 12:14 ` [PATCH net-next v2 8/8] dpaa2-switch: cleanup the egress flood of an unused FDB Ioana Ciornei
2023-12-15 11:58   ` Simon Horman

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=20231218083345.GA6288@kernel.org \
    --to=horms@kernel$(echo .)org \
    --cc=davem@davemloft$(echo .)net \
    --cc=edumazet@google$(echo .)com \
    --cc=ioana.ciornei@nxp$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(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