Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7435457pxb; Thu, 18 Feb 2021 09:59:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6pbN3XPjfiH/Ot98w9cEG2eXpC/yh1ot85FN4urBERllazLxBdROnlMw5ajPkAmV3iJkR X-Received: by 2002:aa7:d9cb:: with SMTP id v11mr5133772eds.153.1613671150185; Thu, 18 Feb 2021 09:59:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613671150; cv=none; d=google.com; s=arc-20160816; b=WZTXYIh9mWCxdkzNASoor8Qj+QLy1cu83uxby0s7jxmmzx8rovHNrffCSUF06k4Nkc 0wjZo5ijt03QkWgLZZMhstITmXyMTk2LnzD5XcvKN+y6XD3aP6miGPe6LJmDza8jfF5b 2RRScJEdIak3lwE8AcCKJwlSUUSf1jAxQ6JfXLI4f0U3RIODGQwq0nPpKVvp5P7Kg5IB LR+hSmG4uc32CimW57aVk638WHQkz0bhVDN+WMtOs0V4iuC9nMOraH0sVPCiO/8JiC/a jw3r1iG/+8grFPz0I9lJ7qdqTYjQXlWx930JTtMsAUSDVbyaJ6HHxA5Qu6hdVoOkS/G5 kOHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=2hyfwkLOlVCWwvCjju/6VWHscu2xH35ZM60TRHYZMmY=; b=Ocm2GmwHzBN9hPjEt0HmKy5MvxAEvbLAfYiInPrB5CVhy1/0uCZCJF8ugASabI95Ij HFhhg/jnRzXah/ngsst4GxaSWz0/B3DlEJ+ZCB11R8ef3HDmidJUpxsoCdjakSWAoxci 5fAxyle8O2AFG8wQLbgsYCG6zmR6v8SAi+iFnrxvHS9YP1C+SIIR83DXyYHyR4qBxhUF GR2b8pNJ7x3/z0VcmS8jNHqC8EUjKSWQjCEFzc82FVAmreV056b5YdbxTEHnBPezJrjT gz823T6bSw6A5QKYyxqLkJVn8lnGB/7b08waf4FHVBv5xR1TSUMExviFcIi+SZBeBlNj qoJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x9si4091888ejb.735.2021.02.18.09.58.45; Thu, 18 Feb 2021 09:59:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234893AbhBRR55 (ORCPT + 99 others); Thu, 18 Feb 2021 12:57:57 -0500 Received: from mail.a-eberle.de ([213.95.140.213]:51378 "EHLO mail.a-eberle.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231408AbhBRPQL (ORCPT ); Thu, 18 Feb 2021 10:16:11 -0500 X-Greylist: delayed 789 seconds by postgrey-1.27 at vger.kernel.org; Thu, 18 Feb 2021 10:16:10 EST Received: from localhost (localhost [127.0.0.1]) by mail.a-eberle.de (Postfix) with ESMTP id C7799380537; Thu, 18 Feb 2021 16:01:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aeberle-mx.softwerk.noris.de Received: from mail.a-eberle.de ([127.0.0.1]) by localhost (ebl-mx-02.a-eberle.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mYqigv7O4NS2; Thu, 18 Feb 2021 16:01:46 +0100 (CET) Received: from localhost.localdomain (unknown [188.194.194.169]) (Authenticated sender: marco.wenzel@a-eberle.de) by mail.a-eberle.de (Postfix) with ESMTPA; Thu, 18 Feb 2021 16:01:46 +0100 (CET) From: Marco Wenzel To: george.mccollister@gmail.com Cc: Marco Wenzel , "David S. Miller" , Jakub Kicinski , Murali Karicheri , Taehee Yoo , Amol Grover , YueHaibing , Arvid Brodin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: hsr: add support for EntryForgetTime Date: Thu, 18 Feb 2021 16:01:12 +0100 Message-Id: <20210218150116.1521-1-marco.wenzel@a-eberle.de> X-Mailer: git-send-email 2.30.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In IEC 62439-3 EntryForgetTime is defined with a value of 400 ms. When a node does not send any frame within this time, the sequence number check for can be ignored. This solves communication issues with Cisco IE 2000 in Redbox mode. Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)") Signed-off-by: Marco Wenzel --- net/hsr/hsr_framereg.c | 9 +++++++-- net/hsr/hsr_framereg.h | 1 + net/hsr/hsr_main.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 5c97de459905..805f974923b9 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c @@ -164,8 +164,10 @@ static struct hsr_node *hsr_add_node(struct hsr_priv *hsr, * as initialization. (0 could trigger an spurious ring error warning). */ now = jiffies; - for (i = 0; i < HSR_PT_PORTS; i++) + for (i = 0; i < HSR_PT_PORTS; i++) { new_node->time_in[i] = now; + new_node->time_out[i] = now; + } for (i = 0; i < HSR_PT_PORTS; i++) new_node->seq_out[i] = seq_out; @@ -411,9 +413,12 @@ void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port, int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node, u16 sequence_nr) { - if (seq_nr_before_or_eq(sequence_nr, node->seq_out[port->type])) + if (seq_nr_before_or_eq(sequence_nr, node->seq_out[port->type]) && + time_is_after_jiffies(node->time_out[port->type] + + msecs_to_jiffies(HSR_ENTRY_FORGET_TIME))) return 1; + node->time_out[port->type] = jiffies; node->seq_out[port->type] = sequence_nr; return 0; } diff --git a/net/hsr/hsr_framereg.h b/net/hsr/hsr_framereg.h index 86b43f539f2c..d9628e7a5f05 100644 --- a/net/hsr/hsr_framereg.h +++ b/net/hsr/hsr_framereg.h @@ -75,6 +75,7 @@ struct hsr_node { enum hsr_port_type addr_B_port; unsigned long time_in[HSR_PT_PORTS]; bool time_in_stale[HSR_PT_PORTS]; + unsigned long time_out[HSR_PT_PORTS]; /* if the node is a SAN */ bool san_a; bool san_b; diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h index 7dc92ce5a134..f79ca55d6986 100644 --- a/net/hsr/hsr_main.h +++ b/net/hsr/hsr_main.h @@ -21,6 +21,7 @@ #define HSR_LIFE_CHECK_INTERVAL 2000 /* ms */ #define HSR_NODE_FORGET_TIME 60000 /* ms */ #define HSR_ANNOUNCE_INTERVAL 100 /* ms */ +#define HSR_ENTRY_FORGET_TIME 400 /* ms */ /* By how much may slave1 and slave2 timestamps of latest received frame from * each node differ before we notify of communication problem? -- 2.30.0