From: Lukasz Majewski <lukma@denx.de>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Vladimir Oltean <olteanv@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Oleksij Rempel <o.rempel@pengutronix.de>,
Tristram.Ha@microchip.com,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Simon Horman <horms@kernel.org>,
"Ricardo B. Marliere" <ricardo@marliere.net>,
Casper Andersson <casper.casan@gmail.com>,
linux-kernel@vger.kernel.org,
Woojung Huh <woojung.huh@microchip.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH v1 net-next] net: dsa: Allow only up to two HSR HW offloaded ports for KSZ9477
Date: Tue, 18 Jun 2024 16:31:11 +0200 [thread overview]
Message-ID: <20240618163111.5091108a@wsk> (raw)
In-Reply-To: <339031f6-e732-43b4-9e83-0e2098df65ef@moroto.mountain>
[-- Attachment #1: Type: text/plain, Size: 2605 bytes --]
On Tue, 18 Jun 2024 16:42:51 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:
> On Tue, Jun 18, 2024 at 03:04:33PM +0200, Lukasz Majewski wrote:
> > The KSZ9477 allows HSR in-HW offloading for any of two selected
> > ports. This patch adds check if one tries to use more than two
> > ports with HSR offloading enabled.
> >
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
>
> Is this a bug fix? What is the impact for the user? Fixes tag? Add
> this information to the commit message when you resend.
>
> > ---
> > drivers/net/dsa/microchip/ksz_common.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/dsa/microchip/ksz_common.c
> > b/drivers/net/dsa/microchip/ksz_common.c index
> > 2818e24e2a51..0d68f0a5bf19 100644 ---
> > a/drivers/net/dsa/microchip/ksz_common.c +++
> > b/drivers/net/dsa/microchip/ksz_common.c @@ -3913,6 +3913,9 @@
> > static int ksz_hsr_join(struct dsa_switch *ds, int port, struct
> > net_device *hsr, if (ret) return ret;
> >
> > + if (dev->chip_id == KSZ9477_CHIP_ID &&
> > hweight8(dev->hsr_ports) > 1)
> > + return -EOPNOTSUPP;
>
> Put this condition before the ksz_switch_macaddr_get(). Otherwise
> we'd need to do a ksz_switch_macaddr_put().
>
> If dev->chip_id != KSZ9477_CHIP_ID then we would have already
> returned. Really, that should be the first check in this function.
> The hsr_get_version() should be moved to right before we use the
> version. (But that's a separate issue, not related to this patch so
> ignore it).
>
> So do something like this but write a better error message.
Ok.
>
> regards,
> dan carpenter
>
> diff --git a/drivers/net/dsa/microchip/ksz_common.c
> b/drivers/net/dsa/microchip/ksz_common.c index
> 2818e24e2a51..181e81af3a78 100644 ---
> a/drivers/net/dsa/microchip/ksz_common.c +++
> b/drivers/net/dsa/microchip/ksz_common.c @@ -3906,6 +3906,11 @@
> static int ksz_hsr_join(struct dsa_switch *ds, int port, struct
> net_device *hsr, return -EOPNOTSUPP; }
>
> + if (hweight8(dev->hsr_ports) > 1) {
> + NL_SET_ERR_MSG_MOD(extack, "Cannot offload more than
> two ports (in use=0x%x)", dev->hsr_ports);
> + return -EOPNOTSUPP;
> + }
> +
> /* Self MAC address filtering, to avoid frames traversing
> * the HSR ring more than once.
> */
>
>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2024-06-18 14:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-18 13:04 [PATCH v1 net-next] net: dsa: Allow only up to two HSR HW offloaded ports for KSZ9477 Lukasz Majewski
2024-06-18 13:42 ` Dan Carpenter
2024-06-18 13:49 ` Lukasz Majewski
2024-06-18 13:52 ` Andrew Lunn
2024-06-18 14:06 ` Dan Carpenter
2024-06-18 14:31 ` Woojung.Huh
2024-06-18 14:45 ` Lukasz Majewski
2024-06-18 14:56 ` Woojung.Huh
2024-06-18 14:58 ` Andrew Lunn
2024-06-18 15:02 ` Lukasz Majewski
2024-06-18 14:31 ` Lukasz Majewski [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=20240618163111.5091108a@wsk \
--to=lukma@denx.de \
--cc=Tristram.Ha@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=bigeasy@linutronix.de \
--cc=casper.casan@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=ricardo@marliere.net \
--cc=woojung.huh@microchip.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).