From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"allan.nielsen@microchip.com" <allan.nielsen@microchip.com>,
"joergen.andreasen@microchip.com"
<joergen.andreasen@microchip.com>,
"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
"vinicius.gomes@intel.com" <vinicius.gomes@intel.com>,
"michael.chan@broadcom.com" <michael.chan@broadcom.com>,
"saeedm@mellanox.com" <saeedm@mellanox.com>,
"jiri@mellanox.com" <jiri@mellanox.com>,
"idosch@mellanox.com" <idosch@mellanox.com>,
"alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>,
"kuba@kernel.org" <kuba@kernel.org>, Po Liu <po.liu@nxp.com>,
Leo Li <leoyang.li@nxp.com>,
"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
"andrew@lunn.ch" <andrew@lunn.ch>,
"vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>
Subject: Re: [PATCH v4 net-next 5/8] net: dsa: felix: support psfp filter on vsc9959
Date: Thu, 23 Sep 2021 11:35:28 +0000 [thread overview]
Message-ID: <20210923113527.jd3buthrh2rx6ulz@skbuf> (raw)
In-Reply-To: <DB8PR04MB578574BC7F055D55725374CCF0A39@DB8PR04MB5785.eurprd04.prod.outlook.com>
On Thu, Sep 23, 2021 at 11:23:45AM +0000, Xiaoliang Yang wrote:
> Hi Vladimir,
>
> On Thu, Sep 23, 2021 at 15:45:16 +0000, Vladimir Oltean wrote:
> > > Maybe we need to use ocelot_mact_learn() instead of
> > > ocelot_mact_write() after setting SFID in StreamData. I think this can
> > > avoid writing a wrong entry.
> >
> > So you're thinking of introducing a new ocelot_mact_learn_with_streamdata(),
> > that writes the SFID and SSID of the STREAMDATA too, instead of editing them
> > in-place for an existing MAC table entry, and then issuing a LEARN MAC Table
> > command which would hopefully transfer the entire data structure to the MAC
> > table?
> >
> > Have you tried that?
>
> Yes, I have tried. I mean writes SFID of STREAMDATA in
> vsc9959_mact_stream_set() first, then calls ocelot_mact_learn()
> function to write VID, mac and STREAMDATA in MAC table. We don't need
> to introduce a new function. Once we call ocelot_mact_learn()
> function, STREAMDATA will be stored in the learned entry.
>
> >
> > In the documentation for the LEARN MAC Table command, I see:
> >
> > Purpose: Insert/learn new entry in MAC table. Position given by (MAC, VID)
> >
> > Use: Configure MAC and VID of the new entry in MACHDATA and MACLDATA.
> > Configure remaining entry fields in MACACCESS. The location in the MAC
> > table is calculated based on (MAC, VID).
> >
> > I just hope it will transfer the STREAMDATA too, it doesn't explicitly say that it
> > will...
> >
> > And assuming it does, will the LEARN command overwrite an existing static
> > FDB entry which has the same MAC DA and VLAN ID, but not SFID?
> > I haven't tried that either.
>
> I tried the case that when MAC table index has changed, STREAMDATA
> will keep move with VID and MAC. The entry { STREAMDATA , VID, MAC}
> also can overwrite a static exist entry. I think we can do like this.
Ok, so maybe we should do that?
Even though I must say I don't really like the idea of partially writing
MAC table entry data from the vsc9959 driver, and partially from
ocelot_mact_learn. I also have this patch pending:
https://patchwork.kernel.org/project/netdevbpf/patch/20210824114049.3814660-4-vladimir.oltean@nxp.com/
and concurrency will be an absolute mess. The ocelot->mact_lock will
need to be taken _before_ we start writing the STREAMDATA, so this
variant of ocelot_mact_learn will still have to stay somewhere in the
ocelot library, and be organized something like this:
__ocelot_mact_learn()
{
do what ocelot_mact_learn() currently does
}
ocelot_mact_learn()
{
mutex_lock(&ocelot->mact_lock);
__ocelot_mact_learn();
mutex_unlock(&ocelot->mact_lock);
}
ocelot_mact_learn_streamdata()
{
mutex_lock(&ocelot->mact_lock);
write_streamdata();
__ocelot_mact_learn();
mutex_unlock(&ocelot->mact_lock);
}
otherwise I would need to introduce avoidable refactoring in the driver.
In fact, could you please pick up that mact_lock patch? Even if the
rtnl_mutex was not dropped yet, the extra lock should not hurt anyone.
next prev parent reply other threads:[~2021-09-23 11:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 10:51 [PATCH v4 net-next 0/8] net: dsa: felix: psfp support on vsc9959 Xiaoliang Yang
2021-09-22 10:51 ` [PATCH v4 net-next 1/8] net: mscc: ocelot: export struct ocelot_mact_entry Xiaoliang Yang
2021-09-23 1:57 ` Florian Fainelli
2021-09-22 10:51 ` [PATCH v4 net-next 2/8] net: mscc: ocelot: add MAC table write and lookup operations Xiaoliang Yang
2021-09-23 1:58 ` Florian Fainelli
2021-09-22 10:51 ` [PATCH v4 net-next 3/8] net: mscc: ocelot: set vcap IS2 chain to goto PSFP chain Xiaoliang Yang
2021-09-22 10:51 ` [PATCH v4 net-next 4/8] net: mscc: ocelot: add gate and police action offload to PSFP Xiaoliang Yang
2021-09-22 10:51 ` [PATCH v4 net-next 5/8] net: dsa: felix: support psfp filter on vsc9959 Xiaoliang Yang
2021-09-22 12:47 ` Vladimir Oltean
2021-09-23 2:30 ` Xiaoliang Yang
2021-09-23 9:44 ` Vladimir Oltean
2021-09-23 11:23 ` Xiaoliang Yang
2021-09-23 11:35 ` Vladimir Oltean [this message]
2021-09-22 10:52 ` [PATCH v4 net-next 6/8] net: dsa: felix: add stream gate settings for psfp Xiaoliang Yang
2021-09-22 10:52 ` [PATCH v4 net-next 7/8] net: mscc: ocelot: use index to set vcap policer Xiaoliang Yang
2021-09-22 13:18 ` Vladimir Oltean
2021-09-23 1:52 ` Xiaoliang Yang
2021-09-23 7:30 ` Horatiu Vultur
2021-09-23 9:22 ` Vladimir Oltean
2021-09-23 14:07 ` Horatiu Vultur
2021-09-22 10:52 ` [PATCH v4 net-next 8/8] net: dsa: felix: use vcap policer to set flow meter for psfp Xiaoliang Yang
-- strict thread matches above, loose matches on Subject: below --
2021-09-07 9:09 [PATCH v4 net-next 0/8] net: dsa: felix: psfp support on vsc9959 Xiaoliang Yang
2021-09-07 9:09 ` [PATCH v4 net-next 5/8] net: dsa: felix: support psfp filter " Xiaoliang Yang
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=20210923113527.jd3buthrh2rx6ulz@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=allan.nielsen@microchip.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=joergen.andreasen@microchip.com \
--cc=kuba@kernel.org \
--cc=leoyang.li@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=po.liu@nxp.com \
--cc=saeedm@mellanox.com \
--cc=vinicius.gomes@intel.com \
--cc=vivien.didelot@gmail.com \
--cc=xiaoliang.yang_1@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