From: Tobias Waldekranz <tobias@waldekranz•com>
To: Vladimir Oltean <olteanv@gmail•com>
Cc: davem@davemloft•net, kuba@kernel•org, andrew@lunn•ch,
vivien.didelot@gmail•com, f.fainelli@gmail•com,
j.vosburgh@gmail•com, vfalico@gmail•com, andy@greyhouse•net,
netdev@vger•kernel.org
Subject: Re: [PATCH v4 net-next 4/5] net: dsa: mv88e6xxx: Link aggregation support
Date: Wed, 16 Dec 2020 21:21:40 +0100 [thread overview]
Message-ID: <87h7olbiy3.fsf@waldekranz.com> (raw)
In-Reply-To: <20201216190410.2mgrujtjfd2uvnwu@skbuf>
On Wed, Dec 16, 2020 at 21:04, Vladimir Oltean <olteanv@gmail•com> wrote:
> On Wed, Dec 16, 2020 at 05:00:55PM +0100, Tobias Waldekranz wrote:
>> Support offloading of LAGs to hardware. LAGs may be attached to a
>> bridge in which case VLANs, multicast groups, etc. are also offloaded
>> as usual.
>>
>> Signed-off-by: Tobias Waldekranz <tobias@waldekranz•com>
>> ---
>> drivers/net/dsa/mv88e6xxx/chip.c | 298 +++++++++++++++++++++++++++-
>> drivers/net/dsa/mv88e6xxx/global2.c | 8 +-
>> drivers/net/dsa/mv88e6xxx/global2.h | 5 +
>> drivers/net/dsa/mv88e6xxx/port.c | 21 ++
>> drivers/net/dsa/mv88e6xxx/port.h | 5 +
>> 5 files changed, 329 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
>> index eafe6bedc692..bd80b3939157 100644
>> --- a/drivers/net/dsa/mv88e6xxx/chip.c
>> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
>> @@ -1189,7 +1189,8 @@ static int mv88e6xxx_set_mac_eee(struct dsa_switch *ds, int port,
>> }
>>
>> /* Mask of the local ports allowed to receive frames from a given fabric port */
>> -static u16 mv88e6xxx_port_vlan(struct mv88e6xxx_chip *chip, int dev, int port)
>> +static u16 mv88e6xxx_port_vlan(struct mv88e6xxx_chip *chip, int dev, int port,
>> + struct net_device **lag)
>> {
>> struct dsa_switch *ds = chip->ds;
>> struct dsa_switch_tree *dst = ds->dst;
>> @@ -1201,6 +1202,9 @@ static u16 mv88e6xxx_port_vlan(struct mv88e6xxx_chip *chip, int dev, int port)
>> list_for_each_entry(dp, &dst->ports, list) {
>> if (dp->ds->index == dev && dp->index == port) {
>> found = true;
>> +
>> + if (dp->lag_dev && lag)
>> + *lag = dp->lag_dev;
>> break;
>> }
>> }
>
> I'll let Andrew and Vivien have the decisive word, who are vastly more
> familiar with mv88e6xxx than I am, but to me it looks like a bit of a
> hack to put this logic here, especially since one of the two callers
> (i.e. half) doesn't even care about the LAG.
>
>> @@ -1396,14 +1402,21 @@ static int mv88e6xxx_mac_setup(struct mv88e6xxx_chip *chip)
>>
>> static int mv88e6xxx_pvt_map(struct mv88e6xxx_chip *chip, int dev, int port)
>> {
>> + struct net_device *lag = NULL;
>> u16 pvlan = 0;
>>
>> if (!mv88e6xxx_has_pvt(chip))
>> return 0;
>>
>> /* Skip the local source device, which uses in-chip port VLAN */
>> - if (dev != chip->ds->index)
>> - pvlan = mv88e6xxx_port_vlan(chip, dev, port);
>> + if (dev != chip->ds->index) {
>> + pvlan = mv88e6xxx_port_vlan(chip, dev, port, &lag);
>> +
>> + if (lag) {
>> + dev = MV88E6XXX_G2_PVT_ADRR_DEV_TRUNK;
>> + port = dsa_lag_id(chip->ds->dst, lag);
>> + }
>> + }
>
> What about the following, which should remove the need of modifying mv88e6xxx_port_vlan:
>
> static int mv88e6xxx_pvt_map(struct mv88e6xxx_chip *chip, int dev, int port)
> {
> struct dsa_switch *ds = chip->ds;
> struct net_device *lag = NULL;
> u16 pvlan = 0;
>
> if (!mv88e6xxx_has_pvt(chip))
> return 0;
>
> /* Skip the local source device, which uses in-chip port VLAN */
> if (dev != ds->index) {
> pvlan = mv88e6xxx_port_vlan(chip, dev, port);
> struct dsa_switch *other_ds;
> struct dsa_port *other_dp;
>
> other_ds = dsa_switch_find(ds->dst->index, dev);
> other_dp = dsa_to_port(other_ds, port);
>
> /* XXX needs an explanation for the reinterpreted values of
> * dev and port
> */
> if (other_dp->lag_dev) {
> dev = MV88E6XXX_G2_PVT_ADRR_DEV_TRUNK;
> port = dsa_lag_id(ds->dst, other_dp->lag_dev);
> }
> }
>
> return mv88e6xxx_g2_pvt_write(chip, dev, port, pvlan);
> }
Yeah I agree. This is really a left-over from the RFC that I meant to
clean-up. I will change it for v5.
>>
>> return mv88e6xxx_g2_pvt_write(chip, dev, port, pvlan);
>> }
>> @@ -5375,6 +5388,271 @@ static int mv88e6xxx_port_egress_floods(struct dsa_switch *ds, int port,
>> return err;
>> }
>>
next prev parent reply other threads:[~2020-12-16 20:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-16 16:00 [PATCH v4 net-next 0/5] net: dsa: Link aggregation support Tobias Waldekranz
2020-12-16 16:00 ` [PATCH v4 net-next 1/5] net: bonding: Notify ports about their initial state Tobias Waldekranz
2020-12-16 16:28 ` Vladimir Oltean
2020-12-16 16:00 ` [PATCH v4 net-next 2/5] net: dsa: Don't offload port attributes on standalone ports Tobias Waldekranz
2020-12-16 16:27 ` Vladimir Oltean
2020-12-16 19:32 ` Tobias Waldekranz
2020-12-16 16:00 ` [PATCH v4 net-next 3/5] net: dsa: Link aggregation support Tobias Waldekranz
2020-12-16 16:22 ` Vladimir Oltean
2020-12-16 19:47 ` Tobias Waldekranz
2020-12-16 18:02 ` Vladimir Oltean
2020-12-16 19:49 ` Tobias Waldekranz
2020-12-16 18:44 ` Vladimir Oltean
2020-12-16 20:09 ` Tobias Waldekranz
2020-12-17 18:31 ` Vladimir Oltean
2020-12-16 16:00 ` [PATCH v4 net-next 4/5] net: dsa: mv88e6xxx: " Tobias Waldekranz
2020-12-16 19:04 ` Vladimir Oltean
2020-12-16 20:21 ` Tobias Waldekranz [this message]
2020-12-16 16:00 ` [PATCH v4 net-next 5/5] net: dsa: tag_dsa: Support reception of packets from LAG devices Tobias Waldekranz
2020-12-16 19:14 ` Vladimir Oltean
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=87h7olbiy3.fsf@waldekranz.com \
--to=tobias@waldekranz$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=andy@greyhouse$(echo .)net \
--cc=davem@davemloft$(echo .)net \
--cc=f.fainelli@gmail$(echo .)com \
--cc=j.vosburgh@gmail$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=olteanv@gmail$(echo .)com \
--cc=vfalico@gmail$(echo .)com \
--cc=vivien.didelot@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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