[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220104133654.oaqtrnee6bxfs6fe@soft-dev3-1.localhost>
Date: Tue, 4 Jan 2022 14:36:54 +0100
From: Horatiu Vultur <horatiu.vultur@...rochip.com>
To: Vladimir Oltean <vladimir.oltean@....com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"vivien.didelot@...il.com" <vivien.didelot@...il.com>,
"andrew@...n.ch" <andrew@...n.ch>
Subject: Re: [PATCH net-next v2 3/3] net: lan966x: Extend switchdev with mdb
support
The 01/04/2022 11:12, Vladimir Oltean wrote:
>
> On Tue, Jan 04, 2022 at 11:18:49AM +0100, Horatiu Vultur wrote:
> > +static int lan966x_mdb_ip_del(struct lan966x_port *port,
> > + const struct switchdev_obj_port_mdb *mdb,
> > + enum macaccess_entry_type type)
> > +{
> > + bool cpu_port = netif_is_bridge_master(mdb->obj.orig_dev);
> > + struct lan966x *lan966x = port->lan966x;
> > + struct lan966x_mdb_entry *mdb_entry;
> > + unsigned char mac[ETH_ALEN];
> > +
> > + mdb_entry = lan966x_mdb_entry_get(lan966x, mdb->addr, mdb->vid);
> > + if (!mdb_entry)
> > + return -ENOENT;
> > +
> > + lan966x_mdb_encode_mac(mac, mdb_entry, type);
> > + lan966x_mac_forget(lan966x, mac, mdb_entry->vid, type);
> > +
> > + if (cpu_port)
> > + mdb_entry->cpu_copy--;
>
> Can you code this in such a way that you don't forget and then re-learn
> the entry if you only do a cpu_copy-- which doesn't reach zero?
I think it is possible to do this. I will do that.
>
> > + else
> > + mdb_entry->ports &= ~BIT(port->chip_port);
> > +
> > + if (!mdb_entry->ports && !mdb_entry->cpu_copy) {
> > + list_del(&mdb_entry->list);
> > + kfree(mdb_entry);
> > + return 0;
> > + }
> > +
> > + lan966x_mdb_encode_mac(mac, mdb_entry, type);
> > + return lan966x_mac_ip_learn(lan966x, mdb_entry->cpu_copy,
> > + mac, mdb_entry->vid, type);
> > +}
--
/Horatiu
Powered by blists - more mailing lists