summaryrefslogtreecommitdiff
path: root/include/net/dsa.h
diff options
context:
space:
mode:
authorGeorge McCollister <george.mccollister@gmail.com>2021-02-10 04:02:12 +0300
committerDavid S. Miller <davem@davemloft.net>2021-02-12 00:24:45 +0300
commit18596f504a3e56c4f8e132b2a437cbe23a3f4635 (patch)
tree18bf5965e76ea12ad2ae722940735d47d0c31134 /include/net/dsa.h
parentdcf0cd1cc58b8e88793ad6531db9b3a47324ca09 (diff)
downloadlinux-18596f504a3e56c4f8e132b2a437cbe23a3f4635.tar.xz
net: dsa: add support for offloading HSR
Add support for offloading of HSR/PRP (IEC 62439-3) tag insertion tag removal, duplicate generation and forwarding on DSA switches. Add DSA_NOTIFIER_HSR_JOIN and DSA_NOTIFIER_HSR_LEAVE which trigger calls to .port_hsr_join and .port_hsr_leave in the DSA driver for the switch. The DSA switch driver should then set netdev feature flags for the HSR/PRP operation that it offloads. NETIF_F_HW_HSR_TAG_INS NETIF_F_HW_HSR_TAG_RM NETIF_F_HW_HSR_FWD NETIF_F_HW_HSR_DUP Signed-off-by: George McCollister <george.mccollister@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dsa.h')
-rw-r--r--include/net/dsa.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 60acb9fca124..d8de23ce7221 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -172,6 +172,10 @@ struct dsa_switch_tree {
list_for_each_entry((_dp), &(_dst)->ports, list) \
if ((_dp)->lag_dev == (_lag))
+#define dsa_hsr_foreach_port(_dp, _ds, _hsr) \
+ list_for_each_entry((_dp), &(_ds)->dst->ports, list) \
+ if ((_dp)->ds == (_ds) && (_dp)->hsr_dev == (_hsr))
+
static inline struct net_device *dsa_lag_dev(struct dsa_switch_tree *dst,
unsigned int id)
{
@@ -264,6 +268,7 @@ struct dsa_port {
struct phylink_config pl_config;
struct net_device *lag_dev;
bool lag_tx_enabled;
+ struct net_device *hsr_dev;
struct list_head list;
@@ -769,6 +774,14 @@ struct dsa_switch_ops {
struct netdev_lag_upper_info *info);
int (*port_lag_leave)(struct dsa_switch *ds, int port,
struct net_device *lag);
+
+ /*
+ * HSR integration
+ */
+ int (*port_hsr_join)(struct dsa_switch *ds, int port,
+ struct net_device *hsr);
+ int (*port_hsr_leave)(struct dsa_switch *ds, int port,
+ struct net_device *hsr);
};
#define DSA_DEVLINK_PARAM_DRIVER(_id, _name, _type, _cmodes) \