From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"kuba@kernel.org" <kuba@kernel.org>,
"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
"vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
"andrew@lunn.ch" <andrew@lunn.ch>
Subject: Re: [PATCH net-next v2 3/3] net: lan966x: Extend switchdev with mdb support
Date: Tue, 4 Jan 2022 14:36:54 +0100 [thread overview]
Message-ID: <20220104133654.oaqtrnee6bxfs6fe@soft-dev3-1.localhost> (raw)
In-Reply-To: <20220104111209.2ky2n5gdqaxzf5fh@skbuf>
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
prev parent reply other threads:[~2022-01-04 13:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 10:18 [PATCH net-next v2 0/3] net: lan966x: Extend switchdev with mdb support Horatiu Vultur
2022-01-04 10:18 ` [PATCH net-next v2 1/3] net: lan966x: Add function lan966x_mac_ip_learn() Horatiu Vultur
2022-01-04 11:17 ` Vladimir Oltean
2022-01-04 13:40 ` Horatiu Vultur
2022-01-04 10:18 ` [PATCH net-next v2 2/3] net: lan966x: Add PGID_FIRST and PGID_LAST Horatiu Vultur
2022-01-04 11:21 ` Vladimir Oltean
2022-01-04 13:46 ` Horatiu Vultur
2022-01-04 10:18 ` [PATCH net-next v2 3/3] net: lan966x: Extend switchdev with mdb support Horatiu Vultur
2022-01-04 11:12 ` Vladimir Oltean
2022-01-04 13:36 ` Horatiu Vultur [this message]
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=20220104133654.oaqtrnee6bxfs6fe@soft-dev3-1.localhost \
--to=horatiu.vultur@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).