From: "Sverdlin, Alexander" <alexander.sverdlin@siemens.com>
To: "hauke@hauke-m.de" <hauke@hauke-m.de>,
"olteanv@gmail.com" <olteanv@gmail.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"andrew@lunn.ch" <andrew@lunn.ch>,
"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"arkadis@mellanox.com" <arkadis@mellanox.com>,
"daniel@makrotopia.org" <daniel@makrotopia.org>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"edumazet@google.com" <edumazet@google.com>,
"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
"horms@kernel.org" <horms@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "john@phrozen.org" <john@phrozen.org>,
"Stockmann, Lukas" <lukas.stockmann@siemens.com>,
"yweng@maxlinear.com" <yweng@maxlinear.com>,
"fchan@maxlinear.com" <fchan@maxlinear.com>,
"lxu@maxlinear.com" <lxu@maxlinear.com>,
"jpovazanec@maxlinear.com" <jpovazanec@maxlinear.com>,
"Schirm, Andreas" <andreas.schirm@siemens.com>,
"Christen, Peter" <peter.christen@siemens.com>,
"ajayaraman@maxlinear.com" <ajayaraman@maxlinear.com>,
"bxu@maxlinear.com" <bxu@maxlinear.com>,
"lrosu@maxlinear.com" <lrosu@maxlinear.com>
Subject: Re: [PATCH RFC net-next 12/23] net: dsa: lantiq_gswip: support 4k VLANs on API 2.2 or later
Date: Thu, 21 Aug 2025 16:40:37 +0000 [thread overview]
Message-ID: <88bdaad0bb744dc401e94d97aba002431ac0b03b.camel@siemens.com> (raw)
In-Reply-To: <aKDhwYPptuC94u-f@pidgin.makrotopia.org>
Hi Daniel,
On Sat, 2025-08-16 at 20:53 +0100, Daniel Golle wrote:
> Dynamically allocate vlans array depending on the switch API version.
> Versions less than 2.2 support 64 VLANs, versions 2.2 or later support
> 4096 VLANs.
...
> @@ -725,9 +730,9 @@ static int gswip_vlan_active_create(struct gswip_priv *priv,
> return err;
> }
>
> - priv->vlans[idx].bridge = bridge;
> - priv->vlans[idx].vid = vid;
> - priv->vlans[idx].fid = fid;
> + (*priv->vlans)[idx].bridge = bridge;
> + (*priv->vlans)[idx].vid = vid;
> + (*priv->vlans)[idx].fid = fid;
Would it be possible to leave this chunk unchanged (and all array
dereferencing in the driver as well)?
> @@ -1948,6 +1953,22 @@ static int gswip_validate_cpu_port(struct dsa_switch *ds)
> return 0;
> }
>
> +static int gswip_allocate_vlans(struct gswip_priv *priv)
> +{
> + if (GSWIP_VERSION_GE(priv, GSWIP_VERSION_2_2))
> + priv->num_vlans = 4096;
> + else
> + priv->num_vlans = 64;
> +
> + priv->vlans = devm_kcalloc(priv->dev, priv->num_vlans,
> + sizeof((*priv->vlans)[0]), GFP_KERNEL);
maybe sizeof(*priv->vlans) or sizeof(priv->vlans[0])?
> --- a/drivers/net/dsa/lantiq_gswip.h
> +++ b/drivers/net/dsa/lantiq_gswip.h
> @@ -269,7 +270,8 @@ struct gswip_priv {
> struct dsa_switch *ds;
> struct device *dev;
> struct regmap *rcu_regmap;
> - struct gswip_vlan vlans[64];
> + struct gswip_vlan (*vlans)[];
... if this would be just "struct gswip_vlan *vlans;"?
> + unsigned int num_vlans;
> int num_gphy_fw;
> struct gswip_gphy_fw *gphy_fw;
> u32 port_vlan_filter;
--
Alexander Sverdlin
Siemens AG
www.siemens.com
next prev parent reply other threads:[~2025-08-21 16:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-16 19:53 Daniel Golle
2025-08-21 16:40 ` Sverdlin, Alexander [this message]
2025-08-21 17:03 ` Andrew Lunn
2025-08-21 17:43 ` Daniel Golle
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=88bdaad0bb744dc401e94d97aba002431ac0b03b.camel@siemens.com \
--to=alexander.sverdlin@siemens.com \
--cc=ajayaraman@maxlinear.com \
--cc=andreas.schirm@siemens.com \
--cc=andrew@lunn.ch \
--cc=arkadis@mellanox.com \
--cc=bxu@maxlinear.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=fchan@maxlinear.com \
--cc=hauke@hauke-m.de \
--cc=horms@kernel.org \
--cc=john@phrozen.org \
--cc=jpovazanec@maxlinear.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lrosu@maxlinear.com \
--cc=lukas.stockmann@siemens.com \
--cc=lxu@maxlinear.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=peter.christen@siemens.com \
--cc=yweng@maxlinear.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®