Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp397765lqo; Wed, 8 May 2024 03:17:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVc4myPGxvv8GvipTa+ogQp2Paei5hFzShhHLKtO6MtwFp3UBFtHo93UXFL9XnRD6vpNvAACmpdOScpYjeC7/Si9euqsjDpGxGA+NU55A== X-Google-Smtp-Source: AGHT+IGxDMVEO875VIYErVUdOSAfxF43tDl9COtQ3V9aS5+I230votc9Pm/0o07z3CYBfa0kuKaM X-Received: by 2002:a17:906:e912:b0:a59:be21:3577 with SMTP id a640c23a62f3a-a59fb9699b2mr123654666b.43.1715163420023; Wed, 08 May 2024 03:17:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715163420; cv=pass; d=google.com; s=arc-20160816; b=PqN8z/vWToskZyofYHmzVclIhYOCriso/4Y1PNOamUt24NSzL9iuOLNUGb8HKtaODr /KCfTZ99bwC7HJcYlAqzL+eS138F1Hnf70Yls/U6JAvhwIY/tntmQ7NZBfeQzwSCiNU/ oUxdRzYFVotoHmVbdFQZ5iXFhDcC2klQIcRJ2PHplrwOWDIMFwmFBKyevko5WbiLODmw 7+Yn+9KmsiZ1tzI+ZztxD6CwREKbrhPt/RHIzPgB1yhaN2krv7TN57iOnvEQXPPMy5mC Bzk3c9TiXGnWP0lLaIOuywNUzPBLTt4IEqaSc2gAXAYLDtUF39guwuK9gZ0MUNv1JUv7 U+bA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7+HNZttvanMoaOc7K56hRR5wHrM33OXFmjUUr/5fF9g=; fh=ffFUvaypBWNLzme1lRltwUuMHT12K8og2mZVBzrGIAo=; b=vwOt6+UBI1yh4v+NCvt8t3tZ5h6IpPwdtWpn7vc3SZlyC3eBxnrJ+GR5D4p3KfwUqc emnKGqM9wN6+KeTFLYdPhmej9YXQmETh2KhncF9GlDgzRlcDTT36nQHHEUZ64aoNOhsq 6VpBSzdJmFugVSRVBG0T4FVXf/8FqPK7/PiM3Zoo3l9lBDknKC47K+SKAfCGnMUMRzRP qUiP34Grb8aOF2lBsUTf6RY1y+fSHDGVzt1ynR9c+DT7OLmuuk06+FYOelV3utltUnqX 7AP91AAb+SheWLtfFGKjHt0z5zwZl0tjDnZr1tKHD0NMMxePvQwF7cKon5a9mHqtyhw/ WzvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="WVomiSR/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-173046-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173046-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ay10-20020a056402202a00b00572303b12afsi6861537edb.681.2024.05.08.03.16.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 03:17:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173046-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="WVomiSR/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-173046-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173046-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BD1851F254BC for ; Wed, 8 May 2024 10:16:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F13727D3EC; Wed, 8 May 2024 10:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WVomiSR/" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 739647D405; Wed, 8 May 2024 10:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715163292; cv=none; b=mf+UvfhN9u1c40xjVgHBDQc4b3CmzmhNHj+o6Gl2gyS+ys72VsVQXx4P36e5n1hMcfr3vRxS3UnRtg/K3uHteQXJjiqfAjyZncfmGmZzfgvnVVWCVMj5jesOE4pdhk/+ODNrZ4P1R4ncOE4oMUOQPHiN1ntwAPtJO53D6w0ZPeo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715163292; c=relaxed/simple; bh=QJq+nxCPYLW+HuN4uFAjTQF8DmqNROLLUZUNwKPWQsY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WdsCJRsK2ocxmvYV1I2LTJiumhx7RbB4QWfGoeT2sswjws8fXqKNEBL+idiiHqVCtKpOUFoKBFj5Wc2Qi7mwVkKCNjUHnDIXDGojBUJzqB3G8w+wvbNLrb19GQ23FwQBcwWlWCU9UPKFvU9gSJulSXdqKmqdqZnRpf5p28XaXrQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WVomiSR/; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63557C113CC; Wed, 8 May 2024 10:14:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715163291; bh=QJq+nxCPYLW+HuN4uFAjTQF8DmqNROLLUZUNwKPWQsY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WVomiSR/Z9uGISAitvK/ZZVFf7Nrlpk5P7u9mbB5AkPKsPxa0JHqIWVI9IrmONbjK dvziDVHgVhi8DTnLrg8alzGUHyixJX1B7MjB8vVjOGx9LlVVYdbVLnqsROQAlYsTyk EsrtK8539Z+SVdYfu5A9b5HJBGr8q4axRhcjGGk+y2FhFS43h66R96K3481hYoRE0v D46ZsZ4bNySvwBpQyfIwcQsyxEb0/VFfYwQCN5BB/WBeve1Yi21iUc9A7rAWFK5Tlg AyzoQ0YSlHz+XjuGcMfcikc5qTbrBXOVIEVNAPG/moMBkaRXbgbzJw4kimTRBXqYk5 gYdGaLSaA/8vg== Date: Wed, 8 May 2024 11:14:46 +0100 From: Simon Horman To: Lukasz Majewski Cc: Jakub Kicinski , netdev@vger.kernel.org, Paolo Abeni , Eric Dumazet , Vladimir Oltean , "David S. Miller" , Oleksij Rempel , Tristram.Ha@microchip.com, Sebastian Andrzej Siewior , Ravi Gunasekaran , Nikita Zhandarovich , Murali Karicheri , Arvid Brodin , Dan Carpenter , "Ricardo B. Marliere" , Casper Andersson , linux-kernel@vger.kernel.org Subject: Re: [net PATCH v2] hsr: Simplify code for announcing HSR nodes timer setup Message-ID: <20240508101446.GC1736038@kernel.org> References: <20240507111214.3519800-1-lukma@denx.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240507111214.3519800-1-lukma@denx.de> On Tue, May 07, 2024 at 01:12:14PM +0200, Lukasz Majewski wrote: > Up till now the code to start HSR announce timer, which triggers sending > supervisory frames, was assuming that hsr_netdev_notify() would be called > at least twice for hsrX interface. This was required to have different > values for old and current values of network device's operstate. > > This is problematic for a case where hsrX interface is already in the > operational state when hsr_netdev_notify() is called, so timer is not > configured to trigger and as a result the hsrX is not sending supervisory > frames to HSR ring. > > This error has been discovered when hsr_ping.sh script was run. To be > more specific - for the hsr1 and hsr2 the hsr_netdev_notify() was > called at least twice with different IF_OPER_{LOWERDOWN|DOWN|UP} states > assigned in hsr_check_carrier_and_operstate(hsr). As a result there was > no issue with sending supervisory frames. > However, with hsr3, the notify function was called only once with > operstate set to IF_OPER_UP and timer responsible for triggering > supervisory frames was not fired. > > The solution is to use netif_oper_up() and netif_running() helper > functions to assess if network hsrX device is up. > Only then, when the timer is not already pending, it is started. > Otherwise it is deactivated. > > Signed-off-by: Lukasz Majewski > > Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)") > --- > Changes for v2: > > - Add extra condition to check if the hsr network device is running > (not only up). > > - Only start announce timer when it is not pending (to avoid period > shortening/violation) Reviewed-by: Simon Horman