[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220317065031.3830481-4-mattias.forsblad@gmail.com>
Date: Thu, 17 Mar 2022 07:50:29 +0100
From: Mattias Forsblad <mattias.forsblad@...il.com>
To: netdev@...r.kernel.org
Cc: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Roopa Prabhu <roopa@...dia.com>,
Tobias Waldekranz <tobias@...dekranz.com>,
Mattias Forsblad <mattias.forsblad@...il.com>
Subject: [PATCH 3/5] dsa: Handle the flood flag in the DSA layer.
Add infrastructure to be able to handle the flood
flag in the DSA layer.
Signed-off-by: Mattias Forsblad <mattias.forsblad@...il.com>
---
include/net/dsa.h | 7 +++++++
net/dsa/dsa_priv.h | 2 ++
net/dsa/slave.c | 18 ++++++++++++++++++
3 files changed, 27 insertions(+)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 9bfe984fcdbf..fcb47dc832e1 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -939,6 +939,13 @@ struct dsa_switch_ops {
void (*get_regs)(struct dsa_switch *ds, int port,
struct ethtool_regs *regs, void *p);
+ /*
+ * Local receive
+ */
+ int (*set_flood)(struct dsa_switch *ds, int port,
+ struct net_device *bridge, unsigned long mask,
+ unsigned long val);
+
/*
* Upper device tracking.
*/
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index f20bdd8ea0a8..ca3ea320c8eb 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -234,6 +234,8 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
struct netlink_ext_ack *extack);
bool dsa_port_skip_vlan_configuration(struct dsa_port *dp);
int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock);
+int dsa_port_set_flood(struct dsa_port *dp, struct net_device *br, unsigned long mask,
+ unsigned long val);
int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu,
bool targeted_match);
int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index d24b6bf845c1..f3d780e2b42b 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -458,6 +458,13 @@ static int dsa_slave_port_attr_set(struct net_device *dev, const void *ctx,
ret = dsa_port_vlan_filtering(dp, attr->u.vlan_filtering,
extack);
break;
+ case SWITCHDEV_ATTR_ID_BRIDGE_FLOOD:
+ if (!dsa_port_offloads_bridge_dev(dp, attr->orig_dev))
+ return -EOPNOTSUPP;
+
+ ret = dsa_port_set_flood(dp, attr->orig_dev, attr->u.brport_flags.mask,
+ attr->u.brport_flags.val);
+ break;
case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
if (!dsa_port_offloads_bridge_dev(dp, attr->orig_dev))
return -EOPNOTSUPP;
@@ -834,6 +841,17 @@ dsa_slave_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *_p)
ds->ops->get_regs(ds, dp->index, regs, _p);
}
+int dsa_port_set_flood(struct dsa_port *dp, struct net_device *br, unsigned long mask,
+ unsigned long val)
+{
+ struct dsa_switch *ds = dp->ds;
+
+ if (ds->ops->set_flood)
+ return ds->ops->set_flood(ds, dp->index, br, mask, val);
+
+ return 0;
+}
+
static int dsa_slave_nway_reset(struct net_device *dev)
{
struct dsa_port *dp = dsa_slave_to_port(dev);
--
2.25.1
Powered by blists - more mailing lists