From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 E14B232B981 for ; Sun, 18 Jan 2026 11:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768734035; cv=none; b=aNPLA1KRIsAPkzegeTRwc+qjeHJIwqXDPqS+2mAtCsy1Zgs88Sg9i0SzUG84Y7cBayKZ552S548ewBjh3B5yTvC4uwuAfDdQyWqn9GkL0xPoE+m2rz+aN7LUkIVHdtlwTAisJ0S8Hd8YD9z/K00VthJgtCsrFSuFdhhOfGgadk4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768734035; c=relaxed/simple; bh=oZlSrKc5HSf8OTgk8Y9zCO1ND/6B7m7anVTBiZTQDCE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u+MYWk2lciLYs5EuraDxQnpCrleSPg3Cay175T1dA6LpRpHuCON1DJY+vIk0Ev/VXJSjXb8RmWVTgr9dwRTuiElQSbA5xMbs75Od+NY8mny1jQMuwCBnCwGmbbaihAEXuA7s9xX86VfgWcuWIujaixLYMgXc//s1ZGLJzqlpMKw= 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=ZM6xEzUr; arc=none smtp.client-ip=209.85.128.47 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="ZM6xEzUr" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4801d24d91bso21970095e9.2 for ; Sun, 18 Jan 2026 03:00:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768734030; x=1769338830; 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=ZM6xEzUrJlnixDJMgVzB0RlaEAtNQNqH5SfVkeIQEauMxckLI/TBKtHBnpuff55nnR Qfmk47OrfmbJOlfBU+m2KUiJtiI3FDPAkWsKsGa8DnEuFF599MdIf4ZtHFi3AAGRjv/x BpG789CWMVFeDXo7P3mALGDwQp4u8h4NOFqdcclPAncfwOLdWdVh3Nhr9B0JM1DfF/kQ AbIUtIKq4zL3U1kLQuFruCJLCb1pEGzDDtZKWFrv0kSidyFsmfThvScE80Auz7FlKlPH cckli9Xk8oduWAfjRFJPO/AhERzVETjQEOOJk88n+IhYJ03uxhSa4BRjv6vcDialNYL4 xkxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768734030; x=1769338830; 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=v8aaag2nFgmpgKQlk9Fs8J+wOWvoehIak0pfvDpnCkENFSg+vwL2w5x/vR/mjlZYPq S9NHyZGugcn7LYMYlEhfmSeRL6IGhMbWfV8Zmp7uXL1FFYs9XT4P6qfLEwsHBeQoN2yK EjQmV9EdLoHFPgIFt4QMuPD+tG56hTfdYipaVO6M8Nzz2cI2YRiY3qYRGoPWSyEfjwf0 5schclQfIPHNI9NdEfcUSF8V1B7h34hLD/LmujUaGFKIekZi0GeXpXXcAhuj6zVuDR1B p+uTji679z6tmq8c95586vnBjwVldrYU1jyjj2S4Of7jeWUDHi6XVvR7KuBKy9E+qfWD emZg== X-Gm-Message-State: AOJu0YyfE7Q8yUs02AMnnWc8aflgErJj0K2eDFcX2FhtWaSEnhVmYIh/ zUBvPbQ9k0LxWHklhd+VfqsZzZF4wPjtjE9cU+msNOERhDBLqbeR6um/ X-Gm-Gg: AY/fxX61TwVqhoeDBfWFT3kd6u1T/DvjpMuTefYhomORJlkyLqmoqlftJPhCFQMft97 RzU8SIKG0tS20D+OjUP5vBCiXajuICnYiTNes7MAqApPJA6vMXeojTUihm0u7Gi2n1gYSDVwi5i 4q0EvFqkKkHODQ7rGN+vq45XBFRmd95voIssJKjf0cR/WmJuF8RCI/G96V7cE/lSh2iCwOYC3CH aHjjCbQEyczAty8fMwDW7ZJdLxgD04CfJ12xZnk+DThZbn+x01Mm63pEYeeG/mVcEz1KoKWlIzB eOIXlcWJsr060HNgz0t362FeYrIacME6Je2yQs0mMO7ENgfQC5oREwKeqori+CqlTwL6GBWcjqS 5qGwey+bpaOh8Vf57TYgiUcFEQasdkibX9UFv9BaVDhohx6SBR1lxqe2ayhY++WCHDIJcO5GS6L VpukgRQWtyp/Yjqw== X-Received: by 2002:a05:600c:4448:b0:465:a51d:d4 with SMTP id 5b1f17b1804b1-4801e2fdd54mr95040255e9.6.1768734029915; Sun, 18 Jan 2026 03:00:29 -0800 (PST) Received: from [192.168.1.243] ([143.58.192.3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356992201csm16864635f8f.2.2026.01.18.03.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jan 2026 03:00:29 -0800 (PST) From: Andre Carvalho Date: Sun, 18 Jan 2026 11:00:23 +0000 Subject: [PATCH net-next v11 3/7] netconsole: add STATE_DEACTIVATED to track targets disabled by low level Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260118-netcons-retrigger-v11-3-4de36aebcf48@gmail.com> References: <20260118-netcons-retrigger-v11-0-4de36aebcf48@gmail.com> In-Reply-To: <20260118-netcons-retrigger-v11-0-4de36aebcf48@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=1768734024; l=2409; i=asantostc@gmail.com; s=20250807; h=from:subject:message-id; bh=Bc0ee9DYK1oiSRrahxYGeDv2Y4gYudwUsG3FQq7nt2Y=; b=w47Bv0mJSq0H++87nzW6h5KMtb3quL1YV8R5bcPQBf+b6qibDRwH/Xr8ZeczEx6pVS526X8qp lrjJUKt/nNBD6Mn65spkAIhk/Po4No1vvdD2+IQ7ZEqu04Z7jMsQ0UG 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, }; /** @@ -580,6 +581,14 @@ static ssize_t enabled_store(struct config_item *item, if (ret) goto out_unlock; + /* 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 == STATE_DEACTIVATED) + nt->state = STATE_DISABLED; + ret = -EINVAL; current_enabled = nt->state == STATE_ENABLED; if (enabled == 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 = STATE_DISABLED; list_move(&nt->list, &target_cleanup_list); stopped = true; + break; + case NETDEV_UNREGISTER: + nt->state = STATE_DEACTIVATED; + list_move(&nt->list, &target_cleanup_list); + stopped = true; } } netconsole_target_put(nt); -- 2.52.0