From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Andrew Lunn <andrew@lunn.ch>, Sekhar Nori <nsekhar@ti.com>,
Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>,
linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH] net: ethernet: ti: ale: ensure vlan/mdb deleted when no members
Date: Thu, 28 Nov 2019 11:38:04 +0200 [thread overview]
Message-ID: <20191128093804.GA18633@apalos.home> (raw)
In-Reply-To: <20191128082127.GA16359@apalos.home>
On Thu, Nov 28, 2019 at 10:21:27AM +0200, Ilias Apalodimas wrote:
> On Wed, Nov 27, 2019 at 05:59:05PM +0200, Grygorii Strashko wrote:
> > The recently updated ALE APIs cpsw_ale_del_mcast() and
> > cpsw_ale_del_vlan_modify() have an issue and will not delete ALE entry even
> > if VLAN/mcast group has no more members. Hence fix it here and delete ALE
> > entry if !port_mask.
> >
> > The issue affected only new cpsw switchdev driver.
> >
> > Fixes: e85c14370783 ("net: ethernet: ti: ale: modify vlan/mdb api for switchdev")
> > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> > ---
> > drivers/net/ethernet/ti/cpsw_ale.c | 14 ++++++++++----
> > 1 file changed, 10 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
> > index 929f3d3354e3..a5179ecfea05 100644
> > --- a/drivers/net/ethernet/ti/cpsw_ale.c
> > +++ b/drivers/net/ethernet/ti/cpsw_ale.c
> > @@ -396,12 +396,14 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask,
> > if (port_mask) {
> > mcast_members = cpsw_ale_get_port_mask(ale_entry,
> > ale->port_mask_bits);
> > - mcast_members &= ~port_mask;
> > - cpsw_ale_set_port_mask(ale_entry, mcast_members,
> > + port_mask = mcast_members & ~port_mask;
> > + }
> > +
> > + if (port_mask)
> > + cpsw_ale_set_port_mask(ale_entry, port_mask,
> > ale->port_mask_bits);
> > - } else {
> > + else
> > cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
> > - }
>
> The code assumed calls cpsw_ale_del_mcast() should have a port mask '0' when
> deleting an entry. Do we want to have 'dual' functionality on it?
> This will delete mcast entries if port mask is 0 or port mask matches exactly
> what's configured right?
>
Deleting the ALE entry if the port_mask matches execlty what's configured makes
sense. Can we change it to something that doesn't change the function argument?
I think something like:
mcast_members = 0;
if (port_mask) {
mcast_members = cpsw_ale_get_port_mask(ale_entry,
ale->port_mask_bits);
mcast_members &= ~port_mask;
}
if (mcast_members)
cpsw_ale_set_port_mask(ale_entry, mcast_members, ....)
else
cpsw_ale_set_entry_type(....)
is more readable?
Thanks
/Ilias
next prev parent reply other threads:[~2019-11-28 9:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-27 15:59 Grygorii Strashko
2019-11-28 8:21 ` Ilias Apalodimas
2019-11-28 9:38 ` Ilias Apalodimas [this message]
2019-11-29 17:58 ` Grygorii Strashko
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=20191128093804.GA18633@apalos.home \
--to=ilias.apalodimas@linaro.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=grygorii.strashko@ti.com \
--cc=ivan.khoronzhuk@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nsekhar@ti.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
all inboxes | Powered by JetHome®