From nobody Mon Dec 1 22:41:03 2025 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73CFA2E8E0E for ; Fri, 28 Nov 2025 22:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764367710; cv=none; b=IxaB7Dkx9KGwini9rG5LLoUshDXwx/b2JQufcxZ0D7rI6xrVLgQCfHBhgHZwbkj1IEwjNSP+zoS3lgl0Oovz5uE3Tsumg+C4LdXrgcImZetiNcxa4M5AHFnCcob6JTQMGFxVVB01mq9DVllyoy7PZs6xCWpybPuvpMa5AX32rtw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764367710; c=relaxed/simple; bh=oZlSrKc5HSf8OTgk8Y9zCO1ND/6B7m7anVTBiZTQDCE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MrgQ90Qkzb7V1RKgCToph0LzWHlu40aF85Z0tErzbjTkEmFl6b3egWDZWlW886kvrLLNuFj/Dpq49luhIizBAL1APo9h41YOpVa7ftQVcTOitlLo21cw9XRjZiH6rUsL+ZVZSVi5KKTsCMxCK1xD88t8mvO6n+JhfxR4iSDoLuE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dGXJVnti; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dGXJVnti" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-7a9c64dfa8aso1930347b3a.3 for ; Fri, 28 Nov 2025 14:08:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764367708; x=1764972508; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=J4d7URFdeCPYu3U6zdfTOnUzmMHd/kT6rS033v+6Sa8=; b=dGXJVntiSZZidJaEYQWYuCXXdwg4QByX3kDzwShDuhfPI6XVLwcgUtmaN9qZbF5+wT Lw+x8n5rBVq91z55Q5bpvj2VClxgbo5oVz1HqtWViBrbRuZe8QppnsOmCLfBVuabEcsr BS1ByUHd+mc2eNZyUyi+OEgejnsULwit/q7wtX0O7l47kPKc6kaMRv99qVRh0Kn6kxAv 6HkAKiaGByk1Dwd6jTrE+Br2V3eh0xA8h/GLSEJ9+cdFoo7rJfqX6Vv5NdHdJLw0Q1HU 3nzQw4dZQgJNu7ISRaXqELscEzdNrTcgdhTbFAEjkkFe0MpPiS2yPurG8/dk3S/GHI54 OEqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764367708; x=1764972508; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=J4d7URFdeCPYu3U6zdfTOnUzmMHd/kT6rS033v+6Sa8=; b=DLml1wJm4LpxwOs/cJ2LsT2Xy1VoEpdNRbmZ+w8LL3ob0Js+/91iJFUVuf9a5Qirzd yh8uwknZUPStJEeVmDgS5s1MftNSAaTQmQuKcgPUIzKsHm4HhI69ZDz9VswyM586+D2A y6c5t8cMmJv3rKjcMvjp0LW50wIYX3r2d2KpGmZM2T+ei8dqzREiIyJXd64zEo3dSftU e+Djav19N7zE34oHdz4+1hrQo1xO2rwoA2zJSz0NhwQR+5KVcFLi8y7vrjCqYWk7aC12 D0gzBGxzzvkIPx6wmWrgfVtS9NrO9HDsLxut6fgLQ8AY96ZitplW2ZStnBLBa47+puAx tZAg== X-Forwarded-Encrypted: i=1; AJvYcCWeiRpZt3PlDGj1GJh94PqUVZzFvQK+P9fWH0ljAa4HbzTSYG+rbR4cqaYIJvxlkSHL13RyDJCPkhUsNoE=@vger.kernel.org X-Gm-Message-State: AOJu0YyA/p/LFwsTcQFFOGxe/mgThvXttW6HAnirqQLhOb6jz4blMOe1 N5nUWIaGNqZeeOS+4du5VcySQ2U0usQ44HQl1TJuEQ5s8WamKb0xIkRt X-Gm-Gg: ASbGncufIogjYDCdit1UutmTnnW0+J8aPUZXQZdNgSZ3Q419Q1jBcXnUIFCdbgdHJlr 6+LIROMadRUBTDbNZy39/8HGp583Gz7MB1OL8NLCk6MbGG8y3keSM3DVZKFb+JeAyhcSY9Do+MX nftNW6Hl18orilpnxexl7CGatOtxKc+ktTvVBOLBFtP4YqrWPVn86WMwCEUuIPiKb68+YWXrvL2 ElPbZhO8hiC3O76/GlIjyasnSkWEbY1ZX8SHx3HRmluEmMHDAVonuXSyXKXa2TycUZzh7n5ItWn SUBGc4hwILkZG1veu1JSNxqMxFcpZVu1SKmRI+h5e0Q5dN2r/o9HmQvPvHU5rOW6phXmvIAie+T DRjBx3OCIu36V+qBlYt0dj1+ezADRS8dYnzEZih+Rw4M+bFbpgOnpzKsJp8PuIHIKGN7cn2i0qZ Fttvdy+mHCee4kUyNNAA== X-Google-Smtp-Source: AGHT+IHP9cacM3sLthbsJDzciAEys52jMWZBJESkwrB9/1Buq/1iB5QinbxCfCe5nE75YPOMpByUNQ== X-Received: by 2002:a05:7022:1506:b0:119:e55a:9c06 with SMTP id a92af1059eb24-11cbba6f374mr13160663c88.34.1764367707518; Fri, 28 Nov 2025 14:08:27 -0800 (PST) Received: from [192.168.15.94] ([2804:7f1:ebc3:752f:12e1:8eff:fe46:88b8]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcaee660asm26824205c88.3.2025.11.28.14.08.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Nov 2025 14:08:26 -0800 (PST) From: Andre Carvalho Date: Fri, 28 Nov 2025 22:08:02 +0000 Subject: [PATCH net-next v8 3/5] netconsole: add STATE_DEACTIVATED to track targets disabled by low level 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251128-netcons-retrigger-v8-3-0bccbf4c6385@gmail.com> References: <20251128-netcons-retrigger-v8-0-0bccbf4c6385@gmail.com> In-Reply-To: <20251128-netcons-retrigger-v8-0-0bccbf4c6385@gmail.com> To: Breno Leitao , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Andre Carvalho X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1764367687; l=2409; i=asantostc@gmail.com; s=20250807; h=from:subject:message-id; bh=Bc0ee9DYK1oiSRrahxYGeDv2Y4gYudwUsG3FQq7nt2Y=; b=OKYBLhWd1IZ93XaJ9r5FNHNxrv9gpqahkExk6+Sfgd6RO3fy3SSFjwyesY0i0145zbiJbCC8N kESIR+0Us6cCG4UmGvJUiw55zckCUS23UxCkJ2i8G9SSdcO+03E87C7 X-Developer-Key: i=asantostc@gmail.com; a=ed25519; pk=eWre+RwFHCxkiaQrZLsjC67mZ/pZnzSM/f7/+yFXY4Q= From: Breno Leitao When the low level interface brings a netconsole target down, record this using a new STATE_DEACTIVATED state. This allows netconsole to distinguish between targets explicitly disabled by users and those deactivated due to interface state changes. It also enables automatic recovery and re-enabling of targets if the underlying low-level interfaces come back online. From a code perspective, anything that is not STATE_ENABLED is disabled. Devices (de)enslaving are marked STATE_DISABLED to prevent automatically resuming as enslaved interfaces cannot have netconsole enabled. Signed-off-by: Breno Leitao Signed-off-by: Andre Carvalho --- drivers/net/netconsole.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index b21ecea60d52..7a1e5559fc0d 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -122,6 +122,7 @@ enum sysdata_feature { enum target_state { STATE_DISABLED, STATE_ENABLED, + STATE_DEACTIVATED, }; =20 /** @@ -580,6 +581,14 @@ static ssize_t enabled_store(struct config_item *item, if (ret) goto out_unlock; =20 + /* When the user explicitly enables or disables a target that is + * currently deactivated, reset its state to disabled. The DEACTIVATED + * state only tracks interface-driven deactivation and should _not_ + * persist when the user manually changes the target's enabled state. + */ + if (nt->state =3D=3D STATE_DEACTIVATED) + nt->state =3D STATE_DISABLED; + ret =3D -EINVAL; current_enabled =3D nt->state =3D=3D STATE_ENABLED; if (enabled =3D=3D current_enabled) { @@ -1445,10 +1454,19 @@ static int netconsole_netdev_event(struct notifier_= block *this, break; case NETDEV_RELEASE: case NETDEV_JOIN: - case NETDEV_UNREGISTER: + /* transition target to DISABLED instead of + * DEACTIVATED when (de)enslaving devices as + * their targets should not be automatically + * resumed when the interface is brought up. + */ nt->state =3D STATE_DISABLED; list_move(&nt->list, &target_cleanup_list); stopped =3D true; + break; + case NETDEV_UNREGISTER: + nt->state =3D STATE_DEACTIVATED; + list_move(&nt->list, &target_cleanup_list); + stopped =3D true; } } netconsole_target_put(nt); --=20 2.52.0