* [PATCH net-next v2 0/2] net: dsa: loop: Expose VLAN table through devlink @ 2020-08-19 4:32 Florian Fainelli 2020-08-19 4:32 ` [PATCH net-next v2 1/2] net: dsa: loop: Configure VLANs while not filtering Florian Fainelli ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Florian Fainelli @ 2020-08-19 4:32 UTC (permalink / raw) To: netdev Cc: Florian Fainelli, Andrew Lunn, Vivien Didelot, David S. Miller, Jakub Kicinski Changes in v2: - set the DSA configure_vlan_while_not_filtering boolean - return the actual occupancy Florian Fainelli (2): net: dsa: loop: Configure VLANs while not filtering net: dsa: loop: Return VLAN table size through devlink drivers/net/dsa/dsa_loop.c | 56 +++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v2 1/2] net: dsa: loop: Configure VLANs while not filtering 2020-08-19 4:32 [PATCH net-next v2 0/2] net: dsa: loop: Expose VLAN table through devlink Florian Fainelli @ 2020-08-19 4:32 ` Florian Fainelli 2020-08-19 13:16 ` Andrew Lunn 2020-08-19 4:32 ` [PATCH net-next v2 2/2] net: dsa: loop: Return VLAN table size through devlink Florian Fainelli 2020-08-19 19:01 ` [PATCH net-next v2 0/2] net: dsa: loop: Expose VLAN table " David Miller 2 siblings, 1 reply; 6+ messages in thread From: Florian Fainelli @ 2020-08-19 4:32 UTC (permalink / raw) To: netdev Cc: Florian Fainelli, Andrew Lunn, Vivien Didelot, David S. Miller, Jakub Kicinski Since this is a mock-up driver with no real data path for now, but we will have one at some point, enable VLANs while not filtering. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- drivers/net/dsa/dsa_loop.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c index eb600b3dbf26..e6fc4fec9cfc 100644 --- a/drivers/net/dsa/dsa_loop.c +++ b/drivers/net/dsa/dsa_loop.c @@ -290,6 +290,7 @@ static int dsa_loop_drv_probe(struct mdio_device *mdiodev) ds->dev = &mdiodev->dev; ds->ops = &dsa_loop_driver; ds->priv = ps; + ds->configure_vlan_while_not_filtering = true; ps->bus = mdiodev->bus; dev_set_drvdata(&mdiodev->dev, ds); -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 1/2] net: dsa: loop: Configure VLANs while not filtering 2020-08-19 4:32 ` [PATCH net-next v2 1/2] net: dsa: loop: Configure VLANs while not filtering Florian Fainelli @ 2020-08-19 13:16 ` Andrew Lunn 0 siblings, 0 replies; 6+ messages in thread From: Andrew Lunn @ 2020-08-19 13:16 UTC (permalink / raw) To: Florian Fainelli; +Cc: netdev, Vivien Didelot, David S. Miller, Jakub Kicinski On Tue, Aug 18, 2020 at 09:32:17PM -0700, Florian Fainelli wrote: > Since this is a mock-up driver with no real data path for now, but we > will have one at some point, enable VLANs while not filtering. > > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v2 2/2] net: dsa: loop: Return VLAN table size through devlink 2020-08-19 4:32 [PATCH net-next v2 0/2] net: dsa: loop: Expose VLAN table through devlink Florian Fainelli 2020-08-19 4:32 ` [PATCH net-next v2 1/2] net: dsa: loop: Configure VLANs while not filtering Florian Fainelli @ 2020-08-19 4:32 ` Florian Fainelli 2020-08-19 13:15 ` Andrew Lunn 2020-08-19 19:01 ` [PATCH net-next v2 0/2] net: dsa: loop: Expose VLAN table " David Miller 2 siblings, 1 reply; 6+ messages in thread From: Florian Fainelli @ 2020-08-19 4:32 UTC (permalink / raw) To: netdev Cc: Florian Fainelli, Andrew Lunn, Vivien Didelot, David S. Miller, Jakub Kicinski We return the VLAN table size through devlink as a simple parameter, we do not support altering it at runtime: devlink resource show mdio_bus/fixed-0:1f mdio_bus/fixed-0:1f: name VTU size 4096 occ 0 unit entry dpipe_tables none and after configure a bridge with VLAN filtering: devlink resource show mdio_bus/fixed-0:1f mdio_bus/fixed-0:1f: name VTU size 4096 occ 1 unit entry dpipe_tables none Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- drivers/net/dsa/dsa_loop.c | 55 +++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c index e6fc4fec9cfc..b588614d1e5e 100644 --- a/drivers/net/dsa/dsa_loop.c +++ b/drivers/net/dsa/dsa_loop.c @@ -28,6 +28,53 @@ static struct dsa_loop_mib_entry dsa_loop_mibs[] = { static struct phy_device *phydevs[PHY_MAX_ADDR]; +enum dsa_loop_devlink_resource_id { + DSA_LOOP_DEVLINK_PARAM_ID_VTU, +}; + +static u64 dsa_loop_devlink_vtu_get(void *priv) +{ + struct dsa_loop_priv *ps = priv; + unsigned int i, count = 0; + struct dsa_loop_vlan *vl; + + for (i = 0; i < ARRAY_SIZE(ps->vlans); i++) { + vl = &ps->vlans[i]; + if (vl->members) + count++; + } + + return count; +} + +static int dsa_loop_setup_devlink_resources(struct dsa_switch *ds) +{ + struct devlink_resource_size_params size_params; + struct dsa_loop_priv *ps = ds->priv; + int err; + + devlink_resource_size_params_init(&size_params, ARRAY_SIZE(ps->vlans), + ARRAY_SIZE(ps->vlans), + 1, DEVLINK_RESOURCE_UNIT_ENTRY); + + err = dsa_devlink_resource_register(ds, "VTU", ARRAY_SIZE(ps->vlans), + DSA_LOOP_DEVLINK_PARAM_ID_VTU, + DEVLINK_RESOURCE_ID_PARENT_TOP, + &size_params); + if (err) + goto out; + + dsa_devlink_resource_occ_get_register(ds, + DSA_LOOP_DEVLINK_PARAM_ID_VTU, + dsa_loop_devlink_vtu_get, ps); + + return 0; + +out: + dsa_devlink_resources_unregister(ds); + return err; +} + static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds, int port, enum dsa_tag_protocol mp) @@ -48,7 +95,12 @@ static int dsa_loop_setup(struct dsa_switch *ds) dev_dbg(ds->dev, "%s\n", __func__); - return 0; + return dsa_loop_setup_devlink_resources(ds); +} + +static void dsa_loop_teardown(struct dsa_switch *ds) +{ + dsa_devlink_resources_unregister(ds); } static int dsa_loop_get_sset_count(struct dsa_switch *ds, int port, int sset) @@ -243,6 +295,7 @@ static int dsa_loop_port_max_mtu(struct dsa_switch *ds, int port) static const struct dsa_switch_ops dsa_loop_driver = { .get_tag_protocol = dsa_loop_get_protocol, .setup = dsa_loop_setup, + .teardown = dsa_loop_teardown, .get_strings = dsa_loop_get_strings, .get_ethtool_stats = dsa_loop_get_ethtool_stats, .get_sset_count = dsa_loop_get_sset_count, -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 2/2] net: dsa: loop: Return VLAN table size through devlink 2020-08-19 4:32 ` [PATCH net-next v2 2/2] net: dsa: loop: Return VLAN table size through devlink Florian Fainelli @ 2020-08-19 13:15 ` Andrew Lunn 0 siblings, 0 replies; 6+ messages in thread From: Andrew Lunn @ 2020-08-19 13:15 UTC (permalink / raw) To: Florian Fainelli; +Cc: netdev, Vivien Didelot, David S. Miller, Jakub Kicinski On Tue, Aug 18, 2020 at 09:32:18PM -0700, Florian Fainelli wrote: > We return the VLAN table size through devlink as a simple parameter, we > do not support altering it at runtime: > > devlink resource show mdio_bus/fixed-0:1f > mdio_bus/fixed-0:1f: > name VTU size 4096 occ 0 unit entry dpipe_tables none > > and after configure a bridge with VLAN filtering: > > devlink resource show mdio_bus/fixed-0:1f > mdio_bus/fixed-0:1f: > name VTU size 4096 occ 1 unit entry dpipe_tables none > > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 0/2] net: dsa: loop: Expose VLAN table through devlink 2020-08-19 4:32 [PATCH net-next v2 0/2] net: dsa: loop: Expose VLAN table through devlink Florian Fainelli 2020-08-19 4:32 ` [PATCH net-next v2 1/2] net: dsa: loop: Configure VLANs while not filtering Florian Fainelli 2020-08-19 4:32 ` [PATCH net-next v2 2/2] net: dsa: loop: Return VLAN table size through devlink Florian Fainelli @ 2020-08-19 19:01 ` David Miller 2 siblings, 0 replies; 6+ messages in thread From: David Miller @ 2020-08-19 19:01 UTC (permalink / raw) To: f.fainelli; +Cc: netdev, andrew, vivien.didelot, kuba From: Florian Fainelli <f.fainelli@gmail.com> Date: Tue, 18 Aug 2020 21:32:16 -0700 > Changes in v2: > > - set the DSA configure_vlan_while_not_filtering boolean > - return the actual occupancy Series applied, thank you. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-19 19:02 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-08-19 4:32 [PATCH net-next v2 0/2] net: dsa: loop: Expose VLAN table through devlink Florian Fainelli 2020-08-19 4:32 ` [PATCH net-next v2 1/2] net: dsa: loop: Configure VLANs while not filtering Florian Fainelli 2020-08-19 13:16 ` Andrew Lunn 2020-08-19 4:32 ` [PATCH net-next v2 2/2] net: dsa: loop: Return VLAN table size through devlink Florian Fainelli 2020-08-19 13:15 ` Andrew Lunn 2020-08-19 19:01 ` [PATCH net-next v2 0/2] net: dsa: loop: Expose VLAN table " David Miller
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).