[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220301123104.226731-3-mattias.forsblad+netdev@gmail.com>
Date: Tue, 1 Mar 2022 13:31:03 +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>,
Nikolay Aleksandrov <razor@...ckwall.org>,
Mattias Forsblad <mattias.forsblad+netdev@...il.com>
Subject: [PATCH 2/3] dsa: Handle the local_receive flag in the DSA layer.
Add infrastructure to be able to handle the local_receive
flag to the DSA layer.
Signed-off-by: Mattias Forsblad <mattias.forsblad+netdev@...il.com>
---
include/net/dsa.h | 6 ++++++
net/dsa/dsa_priv.h | 1 +
net/dsa/slave.c | 16 ++++++++++++++++
3 files changed, 23 insertions(+)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index cfedcfb86350..3abd7cfad7a0 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -925,6 +925,12 @@ struct dsa_switch_ops {
void (*get_regs)(struct dsa_switch *ds, int port,
struct ethtool_regs *regs, void *p);
+ /*
+ * Local receive
+ */
+ int (*set_local_receive)(struct dsa_switch *ds, int port,
+ struct net_device *bridge, bool enable);
+
/*
* Upper device tracking.
*/
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 07c0ad52395a..33e607615e63 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -217,6 +217,7 @@ 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_local_receive(struct dsa_port *dp, struct net_device *br, bool enable);
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 089616206b11..50f88b0bd851 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -295,6 +295,12 @@ 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_LOCAL_RECEIVE:
+ if (!dsa_port_offloads_bridge_dev(dp, attr->orig_dev))
+ return -EOPNOTSUPP;
+
+ ret = dsa_port_set_local_receive(dp, attr->orig_dev, attr->u.local_receive);
+ break;
case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
if (!dsa_port_offloads_bridge_dev(dp, attr->orig_dev))
return -EOPNOTSUPP;
@@ -671,6 +677,16 @@ 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_local_receive(struct dsa_port *dp, struct net_device *br, bool enable)
+{
+ struct dsa_switch *ds = dp->ds;
+
+ if (ds->ops->set_local_receive)
+ return ds->ops->set_local_receive(ds, dp->index, br, enable);
+
+ 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