Re: [PATCH net-next v2 3/4] net: dsa: add support for offloading HSR

George McCollister
2021-02-08T17:28:24Z

On Sat, Feb 6, 2021 at 5:29 PM Vladimir Oltean <olteanv@gmail.com> wrote:
>
> On Thu, Feb 04, 2021 at 03:59:25PM -0600, George McCollister wrote:
> > @@ -1935,6 +1936,19 @@ static int dsa_slave_changeupper(struct net_device *dev,
> > dsa_port_lag_leave(dp, info->upper_dev);
> > err = NOTIFY_OK;
> > }
> > + } else if (is_hsr_master(info->upper_dev)) {
> > + if (info->linking) {
> > + err = dsa_port_hsr_join(dp, info->upper_dev);
> > + if (err == -EOPNOTSUPP) {
> > + NL_SET_ERR_MSG_MOD(info->info.extack,
> > + "Offloading not supported");
> > + err = 0;
> > + }
> > + err = notifier_from_errno(err);
> > + } else {
> > + dsa_port_hsr_leave(dp, info->upper_dev);
> > + err = NOTIFY_OK;
> > + }
> > }
> [..]
> > +static int dsa_switch_hsr_join(struct dsa_switch *ds,
> > + struct dsa_notifier_hsr_info *info)
> > +{
> > + if (ds->index == info->sw_index && ds->ops->port_hsr_join)
> > + return ds->ops->port_hsr_join(ds, info->port, info->hsr);
> > +
> > + return 0;
> > +}
> > +
> > +static int dsa_switch_hsr_leave(struct dsa_switch *ds,
> > + struct dsa_notifier_hsr_info *info)
> > +{
> > + if (ds->index == info->sw_index && ds->ops->port_hsr_leave)
> > + ds->ops->port_hsr_leave(ds, info->port, info->hsr);
> > +
> > + return 0;
> > +}
> > +
>
> If you return zero, the software fallback is never going to kick in.

For join and leave? How is this not a problem for the bridge and lag
functions? They work the same way don't they? I figured it would be
safe to follow what they were doing.