From patchwork Mon Feb 1 14:05:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George McCollister X-Patchwork-Id: 374523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83BC5C433DB for ; Mon, 1 Feb 2021 14:06:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3ED3464EA3 for ; Mon, 1 Feb 2021 14:06:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232555AbhBAOGJ (ORCPT ); Mon, 1 Feb 2021 09:06:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232488AbhBAOF7 (ORCPT ); Mon, 1 Feb 2021 09:05:59 -0500 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C31DC06174A for ; Mon, 1 Feb 2021 06:05:19 -0800 (PST) Received: by mail-oi1-x235.google.com with SMTP id d18so18890759oic.3 for ; Mon, 01 Feb 2021 06:05:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qpNdCAKICP0UB5OknYDWRj1L6fMqJ0u0YADyo5AvMbk=; b=Im0wO3FroOywaGwnqt6QwhPNgyKu12HobXc6X7Kv6GTocZ8gMITUrKSmxO8CFExgQ4 z7zFH5OVp4ySxKzWYSUcElvmhWBQ3Ilxus8ibOl5mhCDuyZIZb5Vmx/ghDOmqHJRsXMf awe56fSAH0nVxsrrqZ7mWkgURU6FZvUbz2s85h7/k8RdkgRwXB8I9sFBEkqljkme0hU4 5El46/Z0x9/T7EjtP+BPYvUqVPMfiI96umoqXvjMZaMeESD/BAgzd2ASHsFrqh6QqDyQ cLbFWqmSUBUE9aswC5fd5MOegydMSwxiWO2yq1I7+0dZlIktYbB+fNWLSqT4uu+uJtuB 3Wpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qpNdCAKICP0UB5OknYDWRj1L6fMqJ0u0YADyo5AvMbk=; b=FdKmc6+xy6nvU4fMl8l9wb0eyzjcpRaxs37cvpiyyJpYPf/lAx7DFRWGsZFRh+88XI 1dN8IH+lekzEisfwUmDp+ze7hWKwKGOkJn7rFZLvpDG2nDhhTBHmMff1cvd8ImFxagoP /pcsYgP11wkxoj70Xx79WIuy8X4IEw37elXVLIUQ/RohHUpA0sg4HPClvH6QYpkGX17+ mlFgaPWmMsJB2062yL27BSgH1iioy801uspfbm9F5cyZrC3CwrUCqJ6TuakXbPoGMl7m fG+eW639YWrFok1AC4fTQIhHyvrg8p0IcHG/HMWnaXrSTj30AdWJFMWKw8Tlxyq5gtQ3 bE7Q== X-Gm-Message-State: AOAM531RPQPDu5j5dSU3QSK362nNNcZqCViWjUWtofULkOhSkexA2GU2 NdlIUhoUxJfrhMemPBLwWQ== X-Google-Smtp-Source: ABdhPJwMqSwv9CoQs618zagxu12ruiZ81PXNxzIrKu5O1jyRgqO+WxWc/UJ+dq+Gyhm47qwClWrN3A== X-Received: by 2002:aca:3306:: with SMTP id z6mr10286814oiz.141.1612188318990; Mon, 01 Feb 2021 06:05:18 -0800 (PST) Received: from threadripper.novatech-llc.local ([216.21.169.52]) by smtp.gmail.com with ESMTPSA id q6sm3967972otm.68.2021.02.01.06.05.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Feb 2021 06:05:17 -0800 (PST) From: George McCollister To: Jakub Kicinski Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Jonathan Corbet , netdev@vger.kernel.org, George McCollister Subject: [RESEND PATCH net-next 1/4] net: hsr: generate supervision frame without HSR tag Date: Mon, 1 Feb 2021 08:05:00 -0600 Message-Id: <20210201140503.130625-2-george.mccollister@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210201140503.130625-1-george.mccollister@gmail.com> References: <20210201140503.130625-1-george.mccollister@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Generate supervision frame without HSR/PRP tag and rely on existing code which inserts it later. This will allow HSR/PRP tag insertions to be offloaded in the future. Signed-off-by: George McCollister --- net/hsr/hsr_device.c | 32 ++++---------------------------- net/hsr/hsr_forward.c | 10 +++++++--- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index ab953a1a0d6c..161b8da6a21d 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -242,8 +242,7 @@ static struct sk_buff *hsr_init_skb(struct hsr_port *master, u16 proto) * being, for PRP it is a trailer and for HSR it is a * header */ - skb = dev_alloc_skb(sizeof(struct hsr_tag) + - sizeof(struct hsr_sup_tag) + + skb = dev_alloc_skb(sizeof(struct hsr_sup_tag) + sizeof(struct hsr_sup_payload) + hlen + tlen); if (!skb) @@ -275,12 +274,10 @@ static void send_hsr_supervision_frame(struct hsr_port *master, { struct hsr_priv *hsr = master->hsr; __u8 type = HSR_TLV_LIFE_CHECK; - struct hsr_tag *hsr_tag = NULL; struct hsr_sup_payload *hsr_sp; struct hsr_sup_tag *hsr_stag; unsigned long irqflags; struct sk_buff *skb; - u16 proto; *interval = msecs_to_jiffies(HSR_LIFE_CHECK_INTERVAL); if (hsr->announce_count < 3 && hsr->prot_version == 0) { @@ -289,23 +286,12 @@ static void send_hsr_supervision_frame(struct hsr_port *master, hsr->announce_count++; } - if (!hsr->prot_version) - proto = ETH_P_PRP; - else - proto = ETH_P_HSR; - - skb = hsr_init_skb(master, proto); + skb = hsr_init_skb(master, ETH_P_PRP); if (!skb) { WARN_ONCE(1, "HSR: Could not send supervision frame\n"); return; } - if (hsr->prot_version > 0) { - hsr_tag = skb_put(skb, sizeof(struct hsr_tag)); - hsr_tag->encap_proto = htons(ETH_P_PRP); - set_hsr_tag_LSDU_size(hsr_tag, HSR_V1_SUP_LSDUSIZE); - } - hsr_stag = skb_put(skb, sizeof(struct hsr_sup_tag)); set_hsr_stag_path(hsr_stag, (hsr->prot_version ? 0x0 : 0xf)); set_hsr_stag_HSR_ver(hsr_stag, hsr->prot_version); @@ -315,8 +301,6 @@ static void send_hsr_supervision_frame(struct hsr_port *master, if (hsr->prot_version > 0) { hsr_stag->sequence_nr = htons(hsr->sup_sequence_nr); hsr->sup_sequence_nr++; - hsr_tag->sequence_nr = htons(hsr->sequence_nr); - hsr->sequence_nr++; } else { hsr_stag->sequence_nr = htons(hsr->sequence_nr); hsr->sequence_nr++; @@ -332,7 +316,7 @@ static void send_hsr_supervision_frame(struct hsr_port *master, hsr_sp = skb_put(skb, sizeof(struct hsr_sup_payload)); ether_addr_copy(hsr_sp->macaddress_A, master->dev->dev_addr); - if (skb_put_padto(skb, ETH_ZLEN + HSR_HLEN)) + if (skb_put_padto(skb, ETH_ZLEN)) return; hsr_forward_skb(skb, master); @@ -348,8 +332,6 @@ static void send_prp_supervision_frame(struct hsr_port *master, struct hsr_sup_tag *hsr_stag; unsigned long irqflags; struct sk_buff *skb; - struct prp_rct *rct; - u8 *tail; skb = hsr_init_skb(master, ETH_P_PRP); if (!skb) { @@ -373,17 +355,11 @@ static void send_prp_supervision_frame(struct hsr_port *master, hsr_sp = skb_put(skb, sizeof(struct hsr_sup_payload)); ether_addr_copy(hsr_sp->macaddress_A, master->dev->dev_addr); - if (skb_put_padto(skb, ETH_ZLEN + HSR_HLEN)) { + if (skb_put_padto(skb, ETH_ZLEN)) { spin_unlock_irqrestore(&master->hsr->seqnr_lock, irqflags); return; } - tail = skb_tail_pointer(skb) - HSR_HLEN; - rct = (struct prp_rct *)tail; - rct->PRP_suffix = htons(ETH_P_PRP); - set_prp_LSDU_size(rct, HSR_V1_SUP_LSDUSIZE); - rct->sequence_nr = htons(hsr->sequence_nr); - hsr->sequence_nr++; spin_unlock_irqrestore(&master->hsr->seqnr_lock, irqflags); hsr_forward_skb(skb, master); diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c index cadfccd7876e..a5566b2245a0 100644 --- a/net/hsr/hsr_forward.c +++ b/net/hsr/hsr_forward.c @@ -454,8 +454,10 @@ static void handle_std_frame(struct sk_buff *skb, void hsr_fill_frame_info(__be16 proto, struct sk_buff *skb, struct hsr_frame_info *frame) { - if (proto == htons(ETH_P_PRP) || - proto == htons(ETH_P_HSR)) { + struct hsr_port *port = frame->port_rcv; + + if (port->type != HSR_PT_MASTER && + (proto == htons(ETH_P_PRP) || proto == htons(ETH_P_HSR))) { /* HSR tagged frame :- Data or Supervision */ frame->skb_std = NULL; frame->skb_prp = NULL; @@ -473,8 +475,10 @@ void prp_fill_frame_info(__be16 proto, struct sk_buff *skb, { /* Supervision frame */ struct prp_rct *rct = skb_get_PRP_rct(skb); + struct hsr_port *port = frame->port_rcv; - if (rct && + if (port->type != HSR_PT_MASTER && + rct && prp_check_lsdu_size(skb, rct, frame->is_supervision)) { frame->skb_hsr = NULL; frame->skb_std = NULL; From patchwork Mon Feb 1 14:05:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George McCollister X-Patchwork-Id: 374522 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06D82C433E0 for ; Mon, 1 Feb 2021 14:06:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C41CF64EA3 for ; Mon, 1 Feb 2021 14:06:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232541AbhBAOG1 (ORCPT ); Mon, 1 Feb 2021 09:06:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231405AbhBAOGK (ORCPT ); Mon, 1 Feb 2021 09:06:10 -0500 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DFEAC061756 for ; Mon, 1 Feb 2021 06:05:30 -0800 (PST) Received: by mail-ot1-x32c.google.com with SMTP id f6so16289409ots.9 for ; Mon, 01 Feb 2021 06:05:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8HW3K8yagETnCFREbbV7sID3AtI2Eya/phv8oX3UrEI=; b=sbk9yj5XBDotfdUvarhmolf7m1hqOQOn3T9Ty4y7W7YBRrc8MlhjzQEkicH43EkFo8 oU5ngbasGwHKRBilvaqx/Cefkhf8EBQ6miAyUvJMmvMX52Xm+XJh33/C2xc26x48qaIJ iuWVfFIpaiMI144nehZj2Ih1xgdjxUPuKm5A5pDycq53o1GaG+F7Wq6Z5+kzH0BbYS9y 0oeXNmgUBwCZzBNJ21uWi1/8fJon5BPfOZRj/dGsIbSFHgIBjqvCCi4xjdtO00KOUSbL k5sRn6usUyl2sCkJBb8ZulmC0E3X3nu5P5vO0IKoGnSdCGUlO9Camhp6yroPZcOobgAO rRyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8HW3K8yagETnCFREbbV7sID3AtI2Eya/phv8oX3UrEI=; b=Uiz2RQGtJ1T4vxCAYRvLQULRYZKRZXeESsyPmxG4tO0o8FS/PsvhhsJMeUZf0OnSgG 4Zfu9zzc1e8iZauazCV6weY+kvbC/A7mVqv22EFPvBveFJFOjrsrOau9wt89J1kYKBiz hd/03BWE+jQPGKxLTfcvwm4DLPxSvVctoQxQkCISWwVkPAqBc1lvwstPtfPTwMu08KY4 EGFFm8eHx6iB6F0mnhPwk1WVivaURMT/0tM2R1ZlZsJg40wOApuR7IYnxaXh37ZT4ah0 9c8pev8DMFNUjR7b0T6FqtnB+AQY2ekg6YdLDeZZIcYStyMNB3HfHXNXCDHox7AjgTfp o+9g== X-Gm-Message-State: AOAM531+M5vwSxr1jrKwrOnFbjTBCUYqTkFDxUAD8K/SbUDlJZHQA+Tl IGoQkBAWjn0G7gTTSRe5anRbPm3bw6QP X-Google-Smtp-Source: ABdhPJxrNw/IKNRpqzMEljVcXbzQZWYuoFNTcCAwZcxl/8gvuRkfXF/ReE5E2caZVwJhOAysnLmwvw== X-Received: by 2002:a9d:7d12:: with SMTP id v18mr11675056otn.205.1612188329794; Mon, 01 Feb 2021 06:05:29 -0800 (PST) Received: from threadripper.novatech-llc.local ([216.21.169.52]) by smtp.gmail.com with ESMTPSA id q6sm3967972otm.68.2021.02.01.06.05.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Feb 2021 06:05:24 -0800 (PST) From: George McCollister To: Jakub Kicinski Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Jonathan Corbet , netdev@vger.kernel.org, George McCollister Subject: [RESEND PATCH net-next 3/4] net: dsa: add support for offloading HSR Date: Mon, 1 Feb 2021 08:05:02 -0600 Message-Id: <20210201140503.130625-4-george.mccollister@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210201140503.130625-1-george.mccollister@gmail.com> References: <20210201140503.130625-1-george.mccollister@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- include/net/dsa.h | 13 +++++++++++++ net/dsa/dsa_priv.h | 11 +++++++++++ net/dsa/port.c | 34 ++++++++++++++++++++++++++++++++++ net/dsa/slave.c | 13 +++++++++++++ net/dsa/switch.c | 24 ++++++++++++++++++++++++ 5 files changed, 95 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 2f5435d3d1db..584e2b5c02e0 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -167,6 +167,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) { @@ -257,6 +261,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; @@ -753,6 +758,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); + void (*port_hsr_leave)(struct dsa_switch *ds, int port, + struct net_device *hsr); }; #define DSA_DEVLINK_PARAM_DRIVER(_id, _name, _type, _cmodes) \ diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 2ce46bb87703..9006f62f69cd 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -20,6 +20,8 @@ enum { DSA_NOTIFIER_BRIDGE_LEAVE, DSA_NOTIFIER_FDB_ADD, DSA_NOTIFIER_FDB_DEL, + DSA_NOTIFIER_HSR_JOIN, + DSA_NOTIFIER_HSR_LEAVE, DSA_NOTIFIER_LAG_CHANGE, DSA_NOTIFIER_LAG_JOIN, DSA_NOTIFIER_LAG_LEAVE, @@ -94,6 +96,13 @@ struct dsa_switchdev_event_work { u16 vid; }; +/* DSA_NOTIFIER_HSR_* */ +struct dsa_notifier_hsr_info { + struct net_device *hsr; + int sw_index; + int port; +}; + struct dsa_slave_priv { /* Copy of CPU port xmit for faster access in slave transmit hot path */ struct sk_buff * (*xmit)(struct sk_buff *skb, @@ -174,6 +183,8 @@ int dsa_port_vlan_del(struct dsa_port *dp, const struct switchdev_obj_port_vlan *vlan); int dsa_port_link_register_of(struct dsa_port *dp); void dsa_port_link_unregister_of(struct dsa_port *dp); +int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr); +void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr); extern const struct phylink_mac_ops dsa_port_phylink_mac_ops; static inline bool dsa_port_offloads_netdev(struct dsa_port *dp, diff --git a/net/dsa/port.c b/net/dsa/port.c index f5b0f72ee7cd..09738af4d32e 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -870,3 +870,37 @@ int dsa_port_get_phy_sset_count(struct dsa_port *dp) return ret; } EXPORT_SYMBOL_GPL(dsa_port_get_phy_sset_count); + +int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr) +{ + struct dsa_notifier_hsr_info info = { + .sw_index = dp->ds->index, + .port = dp->index, + .hsr = hsr, + }; + int err; + + dp->hsr_dev = hsr; + + err = dsa_port_notify(dp, DSA_NOTIFIER_HSR_JOIN, &info); + if (err) + dp->hsr_dev = NULL; + + return err; +} + +void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr) +{ + struct dsa_notifier_hsr_info info = { + .sw_index = dp->ds->index, + .port = dp->index, + .hsr = hsr, + }; + int err; + + dp->hsr_dev = NULL; + + err = dsa_port_notify(dp, DSA_NOTIFIER_HSR_LEAVE, &info); + if (err) + pr_err("DSA: failed to notify DSA_NOTIFIER_HSR_LEAVE\n"); +} diff --git a/net/dsa/slave.c b/net/dsa/slave.c index f2fb433f3828..fc7e3ff11c5c 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1924,6 +1924,19 @@ static int dsa_slave_changeupper(struct net_device *dev, dsa_port_lag_leave(dp, info->upper_dev); err = NOTIFY_OK; } + } else if (netif_is_hsr_master(info->upper_dev)) { + if (info->linking) { + err = dsa_port_hsr_join(dp, info->upper_dev); + if (err == -EOPNOTSUPP) { + NL_SET_ERR_MSG_MOD(info->info.extack, + "Offloading not supported"); + err = 0; + } + err = notifier_from_errno(err); + } else { + dsa_port_hsr_leave(dp, info->upper_dev); + err = NOTIFY_OK; + } } return err; diff --git a/net/dsa/switch.c b/net/dsa/switch.c index cc0b25f3adea..c1e5083f2cfc 100644 --- a/net/dsa/switch.c +++ b/net/dsa/switch.c @@ -166,6 +166,24 @@ static int dsa_switch_fdb_del(struct dsa_switch *ds, return ds->ops->port_fdb_del(ds, port, info->addr, info->vid); } +static int dsa_switch_hsr_join(struct dsa_switch *ds, + struct dsa_notifier_hsr_info *info) +{ + if (ds->index == info->sw_index && ds->ops->port_hsr_join) + return ds->ops->port_hsr_join(ds, info->port, info->hsr); + + return 0; +} + +static int dsa_switch_hsr_leave(struct dsa_switch *ds, + struct dsa_notifier_hsr_info *info) +{ + if (ds->index == info->sw_index && ds->ops->port_hsr_leave) + ds->ops->port_hsr_leave(ds, info->port, info->hsr); + + return 0; +} + static int dsa_switch_lag_change(struct dsa_switch *ds, struct dsa_notifier_lag_info *info) { @@ -319,6 +337,12 @@ static int dsa_switch_event(struct notifier_block *nb, case DSA_NOTIFIER_FDB_DEL: err = dsa_switch_fdb_del(ds, info); break; + case DSA_NOTIFIER_HSR_JOIN: + err = dsa_switch_hsr_join(ds, info); + break; + case DSA_NOTIFIER_HSR_LEAVE: + err = dsa_switch_hsr_leave(ds, info); + break; case DSA_NOTIFIER_LAG_CHANGE: err = dsa_switch_lag_change(ds, info); break;