Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp130601lqa; Fri, 26 Apr 2024 17:33:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVDMd9pWBGAqa7bA3Fhp1iLGzrT5xo6b57Vr2U5AQbPETxyMFWpmT8Nz72f9AFqPFdIdGTxiqmcZVLNvHW0M8a4+IdZ5DomwahMRlvRHg== X-Google-Smtp-Source: AGHT+IG0wGEji612A+H6Dl+gkvKIIdLZbFyCINYHO7sqRIEXZNldhw3rdk4n6MFVwXZCxcEAL1nf X-Received: by 2002:a17:90a:1fc6:b0:29d:dd93:5865 with SMTP id z6-20020a17090a1fc600b0029ddd935865mr3979310pjz.46.1714178012212; Fri, 26 Apr 2024 17:33:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714178012; cv=pass; d=google.com; s=arc-20160816; b=oTzztw9RQ6CtQNmj2FG228nzmI1iqHtGLf96Rf0LQrw5o27dbH3nKGeO2XLc0pJjgX l9aTCpbWpfLQGKWTFqcDqeF0og+x4/da0xnt9mNWlz5eAeGM+d5Mrjh/U3AM8ds9G+H5 Ll0aVPIiNDe534oxYZssvZxyU07ZJX9TVFsCt94wTRNapNoURZqa5eV3/YQ0gmV/p/QV Pe24H7KY7s953txBs7M3979so1mZGm8vfCcZEUPOwFoan3pJYF6cPj4CZK0d7CizTZSJ uO1utl/urVS08OQprVnvqIVYNPINyVttGScQJuQIbqrQJ+XJrC+16EL5hzu4r+6RTTDK P01A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=VTpzqemw9D79XSXjU8S13betZeGvZDFhhKPcXqeWasE=; fh=t1qVYhxaPJzDJLLHUqilzQXhc6fd/cVAZ/NhMNE0noE=; b=BCEKdIlakZ/vqRMrA7OrejjUEN7y27pgpHBgP2nTKfwR0wsPtlVdUfSNbZclBNF6Mm tYaDY1OBy6AG3wdYWy30j4hvgmOn2rwUS9L3zA8kuM50WNK+g2U0/sFw5biHkxAuJ8T7 S5c6MbKTcOOX0iVfOmKVpisz75FY7JYyMDtFC5yOuhbD66xzYg80Zn6uwQCGlhAeAcKT eEyso2obHOOkiyw3gLfLpvirKJ51rGsjJuyU1yWoe386C+HsH6a0guASuJ6s4t5J8isu 0ydE2TLLD8JbNcL8C/ioPO+CL5nIHv19EfU5ic69N8UAVYiTdXwOjPpYV2hPaSANmbmp IwPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VNmdvtPm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-160816-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160816-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u22-20020a17090a0c5600b002ac1f0bb667si2072261pje.0.2024.04.26.17.33.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 17:33:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160816-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VNmdvtPm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-160816-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160816-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 64317B231FD for ; Sat, 27 Apr 2024 00:33:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A7BE2BB0A; Sat, 27 Apr 2024 00:33:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VNmdvtPm" 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 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: linux-kernel@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.