From mboxrd@z Thu Jan 1 00:00:00 1970 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 AC8622570; Sat, 27 Apr 2024 00:33:19 +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=1714177999; cv=none; b=hQYn2XmsZPubxCbAiT+PhON2u1hdh4Ud7DFeTRqwkfAVFTfGih5WOFesLJ+VGnqq0xnSaO5rORaiG++BH0kLzUaJWkXp2e71IRSeStbblyXM+zkl5rimiR3J0bUI1gKh/N/rpkyBi12W0WP3/Ychc/rSYUmlY7nnBpn3fp9KqLs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714177999; c=relaxed/simple; bh=ExI0y1eLtvdS5sSntyhpyLpfJfO/Kp4Z8xHkYB9tJeE=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RGlh065Dqer/g9hHXEIVcUbSHS5Vv7VKwysCZVEOgUNNNB/efAI27fMgpord1wriZWJkv1Zkw89qz1TGQG+tx14gvgJGXJpk2uYrWr21Ce5IKfVjkVjFST78sNbS4wKm127vcWeE7y2HwZ1hqkKvvdpSum4zPT1jYiph8kFnitM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VNmdvtPm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VNmdvtPm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53459C113CD; Sat, 27 Apr 2024 00:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714177999; bh=ExI0y1eLtvdS5sSntyhpyLpfJfO/Kp4Z8xHkYB9tJeE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VNmdvtPmD+z7Dan9QGzpYm9/IVpPVXeZHY/xKgzwxWgaTRraPcAFeqs3/S8qkP9ac BfBwSCiey8KOnVAKoUZXkm4F0QSdSkoxDKu8poUVTXBnb1hYuto1iuplH4EubsHjbj A9K4G9OpHL3hWO39kw16yrfK3MkjFsGrc48v9+bW8nU1Og3DeLCDj/yJUM6L1ibxvO 4SPKFBRBfZlRw6tvvFXRu62UfoXkARA99mlpHar3MV3liNplE7AO/fy78nvkVJWQRa g5A6agyrXEUNvBf4QB0DbS5HtWXsrmcJKPsz2Lo0AVi+p9DcfseDVmpipw01DvnWBy JNKl/S/9yYdJg== Date: Fri, 26 Apr 2024 17:33:17 -0700 From: Jakub Kicinski To: Lukasz Majewski Cc: netdev@vger.kernel.org, Paolo Abeni , Casper Andersson , Andrew Lunn , Eric Dumazet , Vladimir Oltean , "David S. Miller" , Oleksij Rempel , Tristram.Ha@microchip.com, Sebastian Andrzej Siewior , Ravi Gunasekaran , Simon Horman , Nikita Zhandarovich , Murali Karicheri , Jiri Pirko , Dan Carpenter , Ziyang Xuan , Shigeru Yoshida , "Ricardo B. Marliere" , linux-kernel@vger.kernel.org Subject: Re: [net-next PATCH] hsr: Simplify code for announcing HSR nodes timer setup Message-ID: <20240426173317.2f6228a0@kernel.org> In-Reply-To: <20240425153958.2326772-1-lukma@denx.de> References: <20240425153958.2326772-1-lukma@denx.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 25 Apr 2024 17:39:58 +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() helper function to assess if > network device is up and then setup timer. Otherwise the timer is > activated. NETDEV_CHANGE can get called for multiple trivial reasons, if the timer is already running we'll mess with the spacing of the frames, no? If there is a path where the device may get activated without the notifier firing - maybe we can check carrier there and schedule the timer? Also sounds like a bug fix, so please add a Fixes tag.