From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (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 C36EB3A8747 for ; Sun, 24 May 2026 16:12:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779639156; cv=none; b=O/dseCKYRJASAN9m/tPLspmc8+A+I+ITJmNau1EkI0Ra5PBY1qRUhonji/KQvhWdwzEcQ+STw7RS+kBafIxydrulKcP0l+kRkDzIi3As1LSlgXApN13VEDf9vDpxj5keerp7PX5P262M1RwxiQSd4wqoFAGf8V/dWsXnZT9RnfM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779639156; c=relaxed/simple; bh=Yoy7b4IX7Q3gIK8QWyqTSh51xiLDR24883Jvqpd8ZGI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MRH3HjqRpBJ9PbhEaI0gJMs32pt0xJCPj/hsx1u5durUH2GKfHk+dtMtxaOAkCBudf5b8aTsuTNYWIk0oVHfH3NQ6/8U7NM+iMkEjxB38ivaQ3HwtjHhbe0TjqWD06CCF/GnIND+IYdtlOTTRvu/rMwZHBQu629VaRNIbvpvupk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.167.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-4824b15c19eso7371521b6e.2 for ; Sun, 24 May 2026 09:12:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779639152; x=1780243952; 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=SQ5ZFv4zqTjU+YraDC0YfxKk0Y8XgFqrJVhkuiFQ0YE=; b=f/RKjfSFk3U3pmXX/73v+o4iKPym3HEw93TMvzsnaQxh+StefYeGq902osR7efAZt+ YY0IBIbXEQfws5S6oCmKLwpM93ympzgr8/8/szN4zzYxVsOMiHrG0IOFAPcqCr/q6qyH 0P1eVavjTu0pGNEVsCXSZc7f+YJF08GEjmTbeSw/aJ+y6fpQeXrQq1gwl3z/JjWytWRZ ZMa3RKB9HyrBQtF0Leyf4I4bzL2zFAa2a50YezXknhLBQLb38au6PgqSimwl3siFjbmi IcEICFiKW5juvV/NXgJAeP+ajaY03RXyaizZwzXcfUtCAVa5EhaMSMUv/T57NDfqDozE lFlw== X-Forwarded-Encrypted: i=1; AFNElJ+35bKREApq463A3F8wxS8onN+6tTYpylsb6iUEXMWuQtAoZzJLaX0C/SrTgytiT1ewYwKbcGSXSY4fe4I=@vger.kernel.org X-Gm-Message-State: AOJu0YyddaT/QydZsXfuMLk3gKOnB/fuh8a/sPV70UpRZ69h70Knf4Se rQK1SY3k3q8/rF1PuxHz0XXYjkqTeTrAdwT+efntFrpZFZewpuG141ge X-Gm-Gg: Acq92OFjIL4FVz74FxS1tViLg/I2r34z9z3XuWcZXX3ZnEp8Brsn8iZFmh+WXoH5Frv CvwjHT9EnHpASzjbydLmRLY9IAph6lzf83kvjOZK66ZZi2BDXylZIf6H2iooMX8eMiEx2Js0Jlq n4GltxFXjdzaiTDoe/ZjnH0a24ZVaGvfn8Ltm0501hiVWaVCzl1t+Wb8xMKGqWDl0fa60HAowYp vdMvTqbn9I6d6VHpYU89CuKD1Q0AMDMeBaU3+/EjieD+yuiSj5wCYf4eg81+V0NrE6rPChNewU6 Me0aUiDEjyeOSSk0xYTMtLechIis05mJhBxY2uUY6AD/oh1RAG21/l1eZs8i/vnSlmDZWzWtm+b 0Tbl1fCIdU73Rkg6JIsGEsi2yaJR1fJAEfSjy/IpyHiPVGJe4UDldpkxuvtFD0IjTyCb3ApTzzI g2mXuX2LvBF9czA/N/HhlkVNNtj+LIPzFSEIc= X-Received: by 2002:a05:6808:1521:b0:485:1174:4582 with SMTP id 5614622812f47-4854a0eb6ebmr7684343b6e.13.1779639152191; Sun, 24 May 2026 09:12:32 -0700 (PDT) Received: from localhost ([2a03:2880:10ff:5f::]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e6065e6aabsm5589238a34.13.2026.05.24.09.12.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 May 2026 09:12:31 -0700 (PDT) From: Breno Leitao Date: Sun, 24 May 2026 09:12:24 -0700 Subject: [PATCH 8/9] netconsole: move remote_port from struct netpoll to netconsole_target 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: 7bit Message-Id: <20260524-netconsole_move_more-v1-8-909d1ab398b4@debian.org> References: <20260524-netconsole_move_more-v1-0-909d1ab398b4@debian.org> In-Reply-To: <20260524-netconsole_move_more-v1-0-909d1ab398b4@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gustavold@gmail.com, asantostc@gmail.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=4143; i=leitao@debian.org; h=from:subject:message-id; bh=Yoy7b4IX7Q3gIK8QWyqTSh51xiLDR24883Jvqpd8ZGI=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqEyNlcbGdUtW03jM9/bec0QsfkwZSiZIKAhBU2 pGLl7xndXOJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCahMjZQAKCRA1o5Of/Hh3 baxlEACEGNJcQ/LVw0+2GDdZfjS97JnL4p6NPMZGcDYosrotkT8Eo55iHERFzbG1v95f1O2zkJ8 RFdTq2zkoei+XxiyKypt3W3015Uk76iad7IbB7xq1MZn3uSqVPMyVFNTMmBnwWGxH16hSM2h3kQ i05KQhc6alXuzkBJd0hNr1fY8cGNjfYoGnw0Fd+P5YgCqt+7DYUZIFKOzPeeG1KXf0t72USvho+ N3cp0/0VxITppI4nHYYePli8T+uXEa5rzxl3ujl9gfi4s68vXv4ShHqthDDD1R9DhDitx3J55R3 8mKakGgZcRfv1fMwVKgP8x0dtEVXWDshzYobywYAp2HI/aX3SLKTWFvT5zdE+Fo6/uR1I55KL1Z yFNED+0AJ6oBk6fxvyEaIEgthP1ORpTRZc0e7NZTCneOjzJmUtNFzIPozZeguf03K5WGd1hY05x GtPFa22YphyUuHU+4pJYgCTueJ+KPOSDkmATyT6sJ+HbRK9spNJExdwLanNbwtwMMhm4tkdyXuS nvGMFkg470UW5UFw8fYltGDZGlyd1ur+sKcn1AmjffjBv/9Zy45f5tS7ihAKduHSYubDYrNmtca OE5r4I1uAAM7Ex8eyL2nwnnzfJrjcgfOO84L2AcVbiaxNOwlyvnxabszELPeJkFsIvssRXetwpC /HpCD3J3S6BcWZQ== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D The UDP destination port used to build outgoing log packets is pure netconsole configuration. net/core/netpoll.c never reads it, and no other struct netpoll consumer touches it. Add remote_port to struct netconsole_target, drop it from struct netpoll, and update alloc_and_init(), the remote_port_show / remote_port_store configfs handlers, push_udp(), netconsole_print_banner() and netconsole_parser_cmdline() to read it from nt-> rather than np->. The struct netconsole_target * parameter threaded through these helpers by the previous patch already gives them access to the new home. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 14 ++++++++------ include/linux/netpoll.h | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index a4f34560cee5..32e2a925f915 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -177,6 +177,7 @@ enum target_state { * that netpoll core still reads (local_ip, remote_ip, ipv6, * dev_name, dev_mac). * @local_port: UDP source port used to build outgoing log packets. + * @remote_port: UDP destination port used to build outgoing log packets. * @buf: The buffer used to send the full msg to the network stack * @resume_wq: Workqueue to resume deactivated target * @skb_pool: Per-target fallback skb pool consulted by find_skb() when @@ -205,6 +206,7 @@ struct netconsole_target { bool release; struct netpoll np; u16 local_port; + u16 remote_port; /* protected by target_list_lock */ char buf[MAX_PRINT_CHUNK]; struct work_struct resume_wq; @@ -430,7 +432,7 @@ static struct netconsole_target *alloc_and_init(void) nt->np.name = "netconsole"; strscpy(nt->np.dev_name, "eth0", IFNAMSIZ); nt->local_port = 6665; - nt->np.remote_port = 6666; + nt->remote_port = 6666; eth_broadcast_addr(nt->np.remote_mac); nt->state = STATE_DISABLED; INIT_WORK(&nt->resume_wq, process_resume_target); @@ -479,7 +481,7 @@ static void netconsole_print_banner(struct netconsole_target *nt) np_info(np, "local IPv4 address %pI4\n", &np->local_ip.ip); np_info(np, "interface name '%s'\n", np->dev_name); np_info(np, "local ethernet address '%pM'\n", np->dev_mac); - np_info(np, "remote port %d\n", np->remote_port); + np_info(np, "remote port %d\n", nt->remote_port); if (np->ipv6) np_info(np, "remote IPv6 address %pI6c\n", &np->remote_ip.in6); else @@ -607,7 +609,7 @@ static ssize_t local_port_show(struct config_item *item, char *buf) static ssize_t remote_port_show(struct config_item *item, char *buf) { - return sysfs_emit(buf, "%d\n", to_target(item)->np.remote_port); + return sysfs_emit(buf, "%d\n", to_target(item)->remote_port); } static ssize_t local_ip_show(struct config_item *item, char *buf) @@ -958,7 +960,7 @@ static ssize_t remote_port_store(struct config_item *item, goto out_unlock; } - ret = kstrtou16(buf, 10, &nt->np.remote_port); + ret = kstrtou16(buf, 10, &nt->remote_port); if (ret < 0) goto out_unlock; ret = count; @@ -1800,7 +1802,7 @@ static void push_udp(struct netconsole_target *nt, struct sk_buff *skb, int len) udph = udp_hdr(skb); udph->source = htons(nt->local_port); - udph->dest = htons(np->remote_port); + udph->dest = htons(nt->remote_port); udph->len = htons(udp_len); netpoll_udp_checksum(np, skb, len); @@ -2274,7 +2276,7 @@ static int netconsole_parser_cmdline(struct netconsole_target *nt, char *opt) *delim = 0; if (*cur == ' ' || *cur == '\t') np_info(np, "warning: whitespace is not allowed\n"); - if (kstrtou16(cur, 10, &np->remote_port)) + if (kstrtou16(cur, 10, &nt->remote_port)) goto parse_failed; cur = delim; } diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index dcea36713720..12467a45929e 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -33,7 +33,6 @@ struct netpoll { union inet_addr local_ip, remote_ip; bool ipv6; - u16 remote_port; u8 remote_mac[ETH_ALEN]; }; -- 2.54.0