Re: [net-next v5 2/3] net: ethernet: adi: Add ADIN1110 support

From: andrei . tachici
Date: Thu Aug 25 2022 - 06:55:44 EST


> > +static int adin1110_net_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags,
> > + struct netlink_ext_ack *extack)
> > +{
> > + struct adin1110_port_priv *port_priv = netdev_priv(dev);
> > + struct nlattr *br_spec;
> > + struct nlattr *attr;
> > + int rem;
> > +
> > + br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC);
> > + if (!br_spec)
> > + return -EINVAL;
> > +
> > + nla_for_each_nested(attr, br_spec, rem) {
> > + u16 mode;
> > +
> > + if (nla_type(attr) != IFLA_BRIDGE_MODE)
> > + continue;
> > +
> > + if (nla_len(attr) < sizeof(mode))
> > + return -EINVAL;
> > +
> > + port_priv->priv->br_mode = nla_get_u16(attr);
> > + adin1110_set_rx_mode(dev);
> > + break;
> > + }
> > +
> > + return 0;
> > +}
>
> I thought this is a callback for legacy SR-IOV NICs. What are you using
> it for in a HW device over SPI? :S

Here I wanted to allow the user to change between VEPA/VEB. The ADIN2111 switch
is not VLAN aware and also can't do any meaningful forwarding when multiple
ports from multiple ADIN2111 switches are added to the same software bridge. For these
cases I thought the user would like to disable hardware forwarding (VEB).

Should detect the above cases and automatically disable any forwarding instead?

Hardware forwarding translates to: I don't know this MAC address (not my MAC address)
throw it back to the other port. ADIN2111 can't learn the FDB, although has 16 entries that
can be statically programmed.

Thanks,
Alexandru