From nobody Sat Oct 11 04:07:53 2025 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 9FDA6224D7; Wed, 11 Jun 2025 14:19:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651552; cv=none; b=BbsGVwYfuIxLPfix/+NTAoT3QQ08vKaZbqs/PlPXUqDfgHQJuYGiVmy1tuW/S/9cQ/tDn7vnlUPoi8wa4W1tMeLhforhFkFieRVbzLFFtdjKclRqHJdJv0UcC/2guOwzjAyZGDOsuY78lgFctfssQoD51yFW/ntUVmAxN0nPNNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651552; c=relaxed/simple; bh=kaPQVqJqh+eg2jcnJq+k42Jh9O4UIBng+B1OeZ2n8IE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uD1Tdta9f2akK6fvQwxbqPJpSwgmtIawXIZcGjU2BUKx0lv4yYz7w3tfySuOswMVUUrmg308NH0zvoAKg7WsugtEUYwih1isuDlq7XVRSWbprdkkH6iNUSFbm19Gl1pz9NOtzav1F7o8g6CuxDJd/psF5gTFBLiJcZGU2OlO/bU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-6077d0b9bbeso9378843a12.3; Wed, 11 Jun 2025 07:19:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749651549; x=1750256349; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DLOOJJpc60B0rv4JPb2Hwjyu0WdXvR5+iYJdvbJfP3Q=; b=QMF1T/RLS01sGiZsMDb6TzaQf48cTsZlqkXJf9baSEHFdBQj9es6mbsKaFwDranVPD fPqQkUJKLhgOeBAILwx9ttAbstp8qOXuB2VIB5bv3zcvBL9/6Lp0e1qstICgmOwzRAIL dTkPU3QoU7G4YEip+IqfSI4fKX8/H9KrgXKZctUM1Mt9QinDGvjGPt1ShOQRAY6M8ctv co5rIn9nbUrm03b8tlV2jQthE6dv8WO65PbnMbeYtPcXitNFaJoxJ9ZKXz5QgUxw7TsE eDhK6QSbGlUD9aG9611DaJ4HDFwku0oEfjOt/slVfsnVNN7V+TzcS0szLeRm0ddZuXam 4EQg== X-Forwarded-Encrypted: i=1; AJvYcCUTTXCxajtJ86RT4aesI5ZZw8QqmCc/P2KCW156OHGMEkSw9o270uE6jy5bj8r+5bTLrqbH3WHxYXvyNKcRgNlk@vger.kernel.org, AJvYcCUhKZdIus9Ot3XsFfZXtY+1AP9UvMwqKloHNbMZTMZWPRibIuPLH3vCpwpLVaWOSFiMDsNroI6H2wwOub8=@vger.kernel.org X-Gm-Message-State: AOJu0YznnymyxH1KnksL9j5uq9a58dPWFP84Jqev/u51KF/ojlv+cNAm UGDr5jin9msYvGNA5z4YvA06gOfsfp6yVlEoiIvLPhJMfaCVwJLUtqBt X-Gm-Gg: ASbGncsee7odZRh/orume36QCWMj261wpWLjfI7gu7jblJZ+AWrzmGaxA4GgTEe1dzF xZqHwirEnqyJhfJBLkO/yGs7nlGlYaHHYxoCzFc7P3O7G2kpOlwlczTEcPFVQXFGGyTU60Cqk1F Es82vCIS8gyrmTJoZYTWb2+Ce9eSOjIFzOYLYkNSkj57VV4GFNe2yQgYq7VU0LNZG0GqJ+RLXln ONmXVN7p8yl361Zs+VZWg76K4hd9iS+T50QEoh+VrXRbZHVVU6z7OkCe7cxU9s6ACtyrEJgU0hn UADwZcF5PKpncXvcVI24uTSC55e0lIONthXULD0iRsetcHgl51kl X-Google-Smtp-Source: AGHT+IEyBfj35EXjgV32POhKGaylOa97e3Bq7ODAGeZcwTni4MntpM/huQTqSsgbGq9kV6ApSNrmfQ== X-Received: by 2002:a17:907:fd15:b0:ad8:8621:924f with SMTP id a640c23a62f3a-ade8c990163mr286915366b.56.1749651548599; Wed, 11 Jun 2025 07:19:08 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:4::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1db55c7esm893884666b.49.2025.06.11.07.19.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 07:19:08 -0700 (PDT) From: Breno Leitao Date: Wed, 11 Jun 2025 07:18:50 -0700 Subject: [PATCH net-next v2 1/7] netpoll: remove __netpoll_cleanup from exported API 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: <20250611-rework-v2-1-ab1d92b458ca@debian.org> References: <20250611-rework-v2-0-ab1d92b458ca@debian.org> In-Reply-To: <20250611-rework-v2-0-ab1d92b458ca@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=1685; i=leitao@debian.org; h=from:subject:message-id; bh=kaPQVqJqh+eg2jcnJq+k42Jh9O4UIBng+B1OeZ2n8IE=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSZBZeAy8rCRhIviW++2d+F+ridtJSqQtX41dr nRf+QPEMxKJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEmQWQAKCRA1o5Of/Hh3 bYquD/9rI5rqqz5kcKugBm2oz5O2S6Uc76i1XENSnMCmti57knfLjPDaYlmagaxGrbNFX3VW3JP A8OT5f6a19XE8PXSObS/wGLBkoX5lwDzPI2uAodDPdL3D+Oqqj0/F2HQ0CJG6Hmb61MQQN7u9qw yXKz9doq9L3fGCx6iF+eBN86XWRAhmGznjDu8HhedXxT0MoUwDx9tXfVlxQgwVu/KTixvjov/gM wL9tlMtpOE2Qj/m9UTZUQbY609crbUzUgiAVEYy/Tgzo4QKQP6vioOBhV0ZmupdHHDdsCq+KpSu s0l4wLicgf0UuVr0I1RwSABRciguT0s3c9PlkMFnD+CbRjy0J3Cp2hbeFXX5EWmiSoV+rFhLI39 yehpxhFPIWbnop3vQKBmzYYqEOHoWhKdj/AX0riwxSxXYreBj/YHgrcgaaBLNouDLQI2Z3xbU+t /thsnp6InzKyQtFX7IuuBLmxyZhanWLJn9DAGugzfmsoIX6THl0/Y6tKlu1OT7eYaUfREEd7Z1a Bi3q3YJgncGL6hNPLnx6TjVG/bRMw6XcOzPPXtDnLSc0601Gk8UDFJMTQ8nHfchBdsjIfZqHSZL soeW10Fb82E9G7SKv07kmVeklBm3n2bn5FTgfftto5njryhsD/6c9FXoISj9bqGBt8/cFVEOlDH mDpKUYaeMMZkKbA== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Since commit 97714695ef90 ("net: netconsole: Defer netpoll cleanup to avoid lock release during list traversal"), netconsole no longer uses __netpoll_cleanup(). With no remaining users, remove this function from the exported netpoll API. The function remains available internally within netpoll for use by netpoll_cleanup(). Signed-off-by: Breno Leitao --- include/linux/netpoll.h | 1 - net/core/netpoll.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 0477208ed9ffa..a637e51152544 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -69,7 +69,6 @@ void netpoll_print_options(struct netpoll *np); int netpoll_parse_options(struct netpoll *np, char *opt); int __netpoll_setup(struct netpoll *np, struct net_device *ndev); int netpoll_setup(struct netpoll *np); -void __netpoll_cleanup(struct netpoll *np); void __netpoll_free(struct netpoll *np); void netpoll_cleanup(struct netpoll *np); void do_netpoll_cleanup(struct netpoll *np); diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 4ddb7490df4b8..a69c2773841a5 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -863,7 +863,7 @@ static void rcu_cleanup_netpoll_info(struct rcu_head *r= cu_head) kfree(npinfo); } =20 -void __netpoll_cleanup(struct netpoll *np) +static void __netpoll_cleanup(struct netpoll *np) { struct netpoll_info *npinfo; =20 @@ -885,7 +885,6 @@ void __netpoll_cleanup(struct netpoll *np) =20 skb_pool_flush(np); } -EXPORT_SYMBOL_GPL(__netpoll_cleanup); =20 void __netpoll_free(struct netpoll *np) { --=20 2.47.1 From nobody Sat Oct 11 04:07:53 2025 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 196512BCF75; Wed, 11 Jun 2025 14:19:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651553; cv=none; b=jDD4LQtSOihTCYKBnMvE/1bRlxSepjCWgUo1YPnFAcMUx2zQluOTOOkrwsxTYjsTG1uhjoW5D2SqqVIF+qfpImi00JiL2h8b0suTvhAPd3cgKX3jp4aw4PC03umaLt1EpBxBkFj+wdseGOUzZpviVL95LJI+zn4jXmx8ELTyfc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651553; c=relaxed/simple; bh=9MWyVnOGtCTb6f3l99b+ZT3EK3ZbCVffW6Ctmx3iUqo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sHhK96oMS+qu1FkyKvc359TyeNZswfTPB+iDicT1NHB4NEKhkBJbfHhfJaKWfk+sc06b/0+gJcBMLxhj1PpzfKr7nBJooIKK4p4nr/M/iHo9tXCAuQR1aRMAl0wBFD9+HiFvDbtch/CQLhr+uR0ZzzxNKBSnFiOaKe46G3xzrq4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-ad8a6c202ffso1252071766b.3; Wed, 11 Jun 2025 07:19:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749651550; x=1750256350; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KBPQhHa8Mre4rsIn6yFSq4q69O1rqX0rwLacF4V2/d0=; b=Ri2QCxBIQIoDdPDBlAK0dW00LePO2NQ41BuoAzTX6UUaEozpZ2DwdceLo85xvBe81p YPTBKFowa4F728s5vBZ/XTTFJ9b8IMzu1f4gFh9+SMJstQ9VT0hHEbSBNZtFi1JMHeTV PDk9R4ZP4KX1uvkRXPtFd4aS1cqKak2cFO2LqCe2zaDCQlMg1kfgQUEZ42Sp1X6kMWjv NdEjnfKYZpd9eZnPx8wwRw+Vrl3mIisTnDNpSHDAbmQr+2yIAlid3k6vY0WqUO4Bowep DWQOwk8pXzn+aID2hHKUKMOa4rwyy8pc8PnrKv2y0I7tOLaohddShGOGQPYtDopEiWZT KJcA== X-Forwarded-Encrypted: i=1; AJvYcCUhygejK2YZO3E1A/07jN7iFshISwtT+DdX+NPYQrV1dht0nqCzQxdVVf9KN0JPI9U6glwUJPP0aE9MtDk=@vger.kernel.org, AJvYcCXtDWAAHDUEvOv3lUJ8zKYtokUVW8GTHBgQ23lWCj8DwCBZ3x24k2bylLyN5QJsFuEqh+wa5b7GJwsV8XuKiVsd@vger.kernel.org X-Gm-Message-State: AOJu0YzCdjlSH/zVTgrBeRoAKq+b+XvNv5m8eNQpjCKNKwNWoWDpAxO5 Z47arJMueetxyXpY30E3nMJ5Ez4VSFMHJsg5obioKi5MG5tAaGIj70P6 X-Gm-Gg: ASbGncvwi8fGNOpCwemIH6n6xt3Ri+1Xne6Uz6o+MpNYNXTEjU6k4J2RLoQCZOTGE7j IJ7+yHdf8Kd8++8bE/To3iO5YRmdKFv2Dq4uEMmak7nkk7pz/20VjRoiaS0LXreDqi0ocGs6FBF o3RyLXmz40yxI7Zl5hKH+fo4weqjEBaohTDgYPyc/vgJDtlHGT/LtE+NwvtB8tQRxijAQn5aeIU FuEtkXaaH/mn/ZbhOjNaWBHQXgcSlSfuSH33D2Zqoj0Jr0SwovMV0WgNKulw0uefqV7yufECB37 SuyQD+IWBn5HoAchn81LVWxoLkk2pN87ojmjHC6LghM3q5H9sF0u X-Google-Smtp-Source: AGHT+IGCq5ha3fGkQvwbBbsxckaS2fcSPaelGVokqtnlen6vmoVHqRZX1gnlf2BAw2N3roLpCVqeBg== X-Received: by 2002:a17:907:3e23:b0:ad8:8f44:134 with SMTP id a640c23a62f3a-ade8972af9bmr374993366b.46.1749651549934; Wed, 11 Jun 2025 07:19:09 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:2::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade343eeea1sm792827066b.74.2025.06.11.07.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 07:19:09 -0700 (PDT) From: Breno Leitao Date: Wed, 11 Jun 2025 07:18:51 -0700 Subject: [PATCH net-next v2 2/7] netpoll: expose netpoll logging macros in public header 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: <20250611-rework-v2-2-ab1d92b458ca@debian.org> References: <20250611-rework-v2-0-ab1d92b458ca@debian.org> In-Reply-To: <20250611-rework-v2-0-ab1d92b458ca@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=1901; i=leitao@debian.org; h=from:subject:message-id; bh=9MWyVnOGtCTb6f3l99b+ZT3EK3ZbCVffW6Ctmx3iUqo=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSZBZAjsT6mgCnutBVMZQlHPN/O2YeZMrN3E+u zZxJBKeWhWJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEmQWQAKCRA1o5Of/Hh3 bTNqD/9aEQ8m/UEYnEhbY5rEjxcbTntbw9+72eGW8dKkHUfuTX7euj/4vvrGWcHjlpRbNebPyz0 NeBKytgXaWkv0F348Gk8gVMyTtexTB4ieSMKJmYz57z/Nzn5JKaAosfOqiGZi3UhbWOQKTDOvWY KARoC3M8IMVZ33hktWA7aq3uMOD4IewKxZNvOIo8n4hqxTk+10YVvpE6Ru5kzcxA9pU5Ue+cqLy WqrcOlA8E7d0eYl65H06/6W7G1cIwLnOzUtzrVYofP0tbl0NGhz8iizir4OraGckxfX7yNtsHn3 WUMGIz0HI4RBcVcC+5o2yNVL7yFakPCp85dzvj6zBHejDgu1djmPSr3swfVVNqSLkgQjdxuj6pr HHJdeeyJYZHspU5Roe3uPdlPwubFiIX7sH1ZsnBCFllIu6PPLtux6V2YHpyNKzEIUih4D9riVf7 LY07+vz2AApyoHNF6AZBJZKMDaDkW+QA4pnSRiE0jRFbIat6ixz/hnLVHzR/0YNMKraDdrRviDI qMO8FN3djxYCPMmUZ2y1VLuSRvfPDzCo/ZYxTshVgilKyV7OLTBB7/vRJSogxBSUlK4eAT1OWCx N8/wluZTvi85Gyncs6mOISL8GsssqeJvLIo75Yc1xyQ5A2ZJPu3hx989Y+Jz0WAtlebecTWZto1 Ja/nge2d8w2blpQ== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Move np_info(), np_err(), and np_notice() macros from internal implementation to the public netpoll header file to make them available for use by netpoll consumers. These logging macros provide consistent formatting for netpoll-related messages by automatically prefixing log output with the netpoll instance name. The goal is to use the exact same format that is being displayed today, instead of creating something netconsole-specific. Signed-off-by: Breno Leitao --- include/linux/netpoll.h | 7 +++++++ net/core/netpoll.c | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index a637e51152544..72086b8a3decd 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -42,6 +42,13 @@ struct netpoll { struct work_struct refill_wq; }; =20 +#define np_info(np, fmt, ...) \ + pr_info("%s: " fmt, np->name, ##__VA_ARGS__) +#define np_err(np, fmt, ...) \ + pr_err("%s: " fmt, np->name, ##__VA_ARGS__) +#define np_notice(np, fmt, ...) \ + pr_notice("%s: " fmt, np->name, ##__VA_ARGS__) + struct netpoll_info { refcount_t refcnt; =20 diff --git a/net/core/netpoll.c b/net/core/netpoll.c index a69c2773841a5..9e86026225a36 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -58,13 +58,6 @@ static void zap_completion_queue(void); static unsigned int carrier_timeout =3D 4; module_param(carrier_timeout, uint, 0644); =20 -#define np_info(np, fmt, ...) \ - pr_info("%s: " fmt, np->name, ##__VA_ARGS__) -#define np_err(np, fmt, ...) \ - pr_err("%s: " fmt, np->name, ##__VA_ARGS__) -#define np_notice(np, fmt, ...) \ - pr_notice("%s: " fmt, np->name, ##__VA_ARGS__) - static netdev_tx_t netpoll_start_xmit(struct sk_buff *skb, struct net_device *dev, struct netdev_queue *txq) --=20 2.47.1 From nobody Sat Oct 11 04:07:53 2025 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 6DB2B2BD5B4; Wed, 11 Jun 2025 14:19:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651555; cv=none; b=TDEiQmlqYPcoTrEH8n2owofdd1+AptLZ4MsY2XX0eIAtm/AODpiOMm+AaAhp4b50XolBBlvgk8NdkQrIoyvKS9Y2zLiQUX8RgznZHocPa3BCOdABlwuibrT5FUlDx4c6wFnf+A+yCDAamHZJ2IgcJU2wI/nInyAV70iEyZhQEQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651555; c=relaxed/simple; bh=4g4vBwWPdT4IgtiPcAtD4LEJ+GCF3RMDEty2lSNgRKI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kGdd0aRE3Dhv8uUzwu3kgDzJ1KjBZGx+NkF2MsgFERGiUg0+yxZ/OqAuXXoCRiZo102788u8wAEuXw1iVlMxu1Xc4tSW8s7jCoWcdb5Cb7lsqByqrp+5VHaY0aXAq8e163ZYoiCfV69fyA3HSMn9RZW+lPgnkH2enhMZ3CI+DI4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-ade58ef47c0so201066966b.1; Wed, 11 Jun 2025 07:19:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749651552; x=1750256352; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dyGUnyAgFY+pvwrKu8sNKKhFp9R+q/qeb7KvVtPdSFU=; b=EzL12qLf+YKBb5ppiq/X/tCS6ByNf5i2aNGWEZOB319G15BuWzZ3LD6FC2fukQ3rDU A05QHnaeIwnmksPrFx4LEfzFWBW6pnhxmuRNvldW1Sc6SH5WDlvqKyl20TfliePRK5QK QwjDReSuEtS7AHRyrAQBQzMqUmue60tkf5G25IAQmcbmG7B6uzkmzIU7wHj8dCFYWcuS ZF5KsLBOA8DEiIt1xclyMA1Pv7D5BYfJ8E3BtTZq5sM/z6N2vx7Ct1kZu+RT3xmVuP+L smxZ4GZDCNUI6ZC2oz/C4WDYlKXQ4w0kDWv1YSXQuyqhfZiGPDYKlbyalLyQkzsAaoHK 363A== X-Forwarded-Encrypted: i=1; AJvYcCWbDV1TMIQ1+kW4LwhkDS7WIpqzdWXCGEloPb5NXXjM7gcv0hzCGqEweRkGQpbWFeNwDCHhSzSPvpF0IVo=@vger.kernel.org, AJvYcCXU7I3AlherL5VNkbeectC9O8hun1P1+6de5En845FQlyD6AR6ihAymmn1Z8zdW03dS8tnfNERImR1B2GgXwKu0@vger.kernel.org X-Gm-Message-State: AOJu0YzpjD0eSblu8QqFyOf0CZ0FTZ+irb2N2tHPOYPwV5aGiKC8F1nr lai2u2whQK69RGAnOG0qh+FA3x6lKxw1QeJFzdiuYUkv/WXktDjKie8ehbSSow== X-Gm-Gg: ASbGncsZWBF+E7Iv/tOq+aXGdDFLAvYt4ZTe4f6oS6O+g8l7+s9vZCiOPE3A5xB5Qw7 NGdhAs/reXMxnGCLqS7CF278My254cEXN93fMKnDtvfhPEA2OM/zXqo917tEvvYwk0kQPBoJPd5 qaM6VhFXp0HKQaaoSxkFeWVuful7QAQJ/5V3gFbift0/Tj4NKhirzZigbgpSkeWHp3HiF3dP2oX EG3J4bkeygtUBOpPSmAvm0yXOM9rz9GSYxkqbnLnMykf7CTeyhQOMXHdhAaL6seS9P7XwFmIaBA 5vxfwVz+3/DcyQ+vDgwhjdvAlM6YMh3/mYogoPVkP8UxIbbO5oTM X-Google-Smtp-Source: AGHT+IFrnnWp2i0nWQ8ik4xeowC/mQaCysLjNojr1d1ev8T2ufTRaWOnjM+l9gVViA1UZC6kNcFDtA== X-Received: by 2002:a17:907:3eaa:b0:ad5:2d5d:2069 with SMTP id a640c23a62f3a-ade8982dd3amr378670866b.13.1749651551413; Wed, 11 Jun 2025 07:19:11 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:8::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1db576basm905398766b.65.2025.06.11.07.19.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 07:19:10 -0700 (PDT) From: Breno Leitao Date: Wed, 11 Jun 2025 07:18:52 -0700 Subject: [PATCH net-next v2 3/7] netpoll: relocate netconsole-specific functions to netconsole module 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: <20250611-rework-v2-3-ab1d92b458ca@debian.org> References: <20250611-rework-v2-0-ab1d92b458ca@debian.org> In-Reply-To: <20250611-rework-v2-0-ab1d92b458ca@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=7728; i=leitao@debian.org; h=from:subject:message-id; bh=4g4vBwWPdT4IgtiPcAtD4LEJ+GCF3RMDEty2lSNgRKI=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSZBZNxeY4KcqFpoSFDSF66ZvvJp0jceZ2mIuK loOnM6tejyJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEmQWQAKCRA1o5Of/Hh3 bc5RD/4rOGDPuKuYnXU5270wa0Rerejiwxd9kTqUWbxCgPRe1TIQ3Yq8ZUCv8AcyXyw+LfhhVFv BmiAscQRK7QCUk2zWE+ThXh55m81WIKzbB7VmbPgEM35Iuvt0Wlm4IkZ9JnkQl3kFrhG/vJ9+AX k5wDBwnBPiH3eEEIX9BOsnyDXTxEe1dzvX601t19F04i3blZkEmhO4TO73M7OnVrTkLEYSg6Kpm mbtLE3gw2tF4t7ZRIvvwrO/U9v7f+xD/4+Coeumh2BZ91YPIpfTyhDG4LracNE1+sPuqoUCmHCp spwGfCnxY3Ls5jl1PyrmveGwDXtpAxSEIdA6YC9MogV915fett/68iM/wC1W84YbSfs646npSS2 zDIPGLu3wHOOl5Zv2LUbkbj13LKr1Jeu46C7Vc8SUr4JW+w1fO3uGzc2dAkQhE0+PVUzcizunBb VinF602a9n5E+v+2K4wgdEoXltGQitMu1cSY5YV1k9Sb9ffTRYFyEbEn/O0J47UVT31FIpwKLv0 jvp9d/gP1TftlROl5/RmhxFxPbS7Ys3ONziinQVnrsgctOZvBDi7UnrGOKyEBF4geoxQW8vspJ8 8i+sx71QaAiHAGBTJF+pXbBh98iXzhwhTkTqhT069BG9mw8WF5jSTYJXZCp3bBLcv019BCNdCKY QN93MM6yw2Lsc2A== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Move netpoll_parse_ip_addr() and netpoll_parse_options() from the generic netpoll module to the netconsole module where they are actually used. These functions were originally placed in netpoll but are only consumed by netconsole. This refactoring improves code organization by: - Removing unnecessary exported symbols from netpoll - Making netpoll_parse_options() static (no longer needs global visibility) - Reducing coupling between netpoll and netconsole modules The functions remain functionally identical - this is purely a code reorganization to better reflect their actual usage patterns. Here are the changes: 1) Move both functions from netpoll to netconsole 2) Add static to netpoll_parse_options() 3) Removed the EXPORT_SYMBOL() PS: This diff does not change the function format, so, it is easy to review, but, checkpatch will not be happy. A follow-up patch will address the current issues reported by checkpatch. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 108 +++++++++++++++++++++++++++++++++++++++++++= +++ include/linux/netpoll.h | 1 - net/core/netpoll.c | 109 -------------------------------------------= ---- 3 files changed, 108 insertions(+), 110 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 21077aff061c5..6741e5484f053 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -1660,6 +1660,114 @@ static void write_msg(struct console *con, const ch= ar *msg, unsigned int len) spin_unlock_irqrestore(&target_list_lock, flags); } =20 +static int netpoll_parse_ip_addr(const char *str, union inet_addr *addr) +{ + const char *end; + + if (!strchr(str, ':') && + in4_pton(str, -1, (void *)addr, -1, &end) > 0) { + if (!*end) + return 0; + } + if (in6_pton(str, -1, addr->in6.s6_addr, -1, &end) > 0) { +#if IS_ENABLED(CONFIG_IPV6) + if (!*end) + return 1; +#else + return -1; +#endif + } + return -1; +} + +static int netpoll_parse_options(struct netpoll *np, char *opt) +{ + char *cur=3Dopt, *delim; + int ipv6; + bool ipversion_set =3D false; + + if (*cur !=3D '@') { + if ((delim =3D strchr(cur, '@')) =3D=3D NULL) + goto parse_failed; + *delim =3D 0; + if (kstrtou16(cur, 10, &np->local_port)) + goto parse_failed; + cur =3D delim; + } + cur++; + + if (*cur !=3D '/') { + ipversion_set =3D true; + if ((delim =3D strchr(cur, '/')) =3D=3D NULL) + goto parse_failed; + *delim =3D 0; + ipv6 =3D netpoll_parse_ip_addr(cur, &np->local_ip); + if (ipv6 < 0) + goto parse_failed; + else + np->ipv6 =3D (bool)ipv6; + cur =3D delim; + } + cur++; + + if (*cur !=3D ',') { + /* parse out dev_name or dev_mac */ + if ((delim =3D strchr(cur, ',')) =3D=3D NULL) + goto parse_failed; + *delim =3D 0; + + np->dev_name[0] =3D '\0'; + eth_broadcast_addr(np->dev_mac); + if (!strchr(cur, ':')) + strscpy(np->dev_name, cur, sizeof(np->dev_name)); + else if (!mac_pton(cur, np->dev_mac)) + goto parse_failed; + + cur =3D delim; + } + cur++; + + if (*cur !=3D '@') { + /* dst port */ + if ((delim =3D strchr(cur, '@')) =3D=3D NULL) + goto parse_failed; + *delim =3D 0; + if (*cur =3D=3D ' ' || *cur =3D=3D '\t') + np_info(np, "warning: whitespace is not allowed\n"); + if (kstrtou16(cur, 10, &np->remote_port)) + goto parse_failed; + cur =3D delim; + } + cur++; + + /* dst ip */ + if ((delim =3D strchr(cur, '/')) =3D=3D NULL) + goto parse_failed; + *delim =3D 0; + ipv6 =3D netpoll_parse_ip_addr(cur, &np->remote_ip); + if (ipv6 < 0) + goto parse_failed; + else if (ipversion_set && np->ipv6 !=3D (bool)ipv6) + goto parse_failed; + else + np->ipv6 =3D (bool)ipv6; + cur =3D delim + 1; + + if (*cur !=3D 0) { + /* MAC address */ + if (!mac_pton(cur, np->remote_mac)) + goto parse_failed; + } + + netpoll_print_options(np); + + return 0; + + parse_failed: + np_info(np, "couldn't parse config at '%s'!\n", cur); + return -1; +} + /* Allocate new target (from boot/module param) and setup netpoll for it */ static struct netconsole_target *alloc_param_target(char *target_config, int cmdline_count) diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 72086b8a3decd..1b8000954e52a 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -73,7 +73,6 @@ static inline void netpoll_poll_enable(struct net_device = *dev) { return; } =20 int netpoll_send_udp(struct netpoll *np, const char *msg, int len); void netpoll_print_options(struct netpoll *np); -int netpoll_parse_options(struct netpoll *np, char *opt); int __netpoll_setup(struct netpoll *np, struct net_device *ndev); int netpoll_setup(struct netpoll *np); void __netpoll_free(struct netpoll *np); diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 9e86026225a36..d2965c916130d 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -510,26 +510,6 @@ void netpoll_print_options(struct netpoll *np) } EXPORT_SYMBOL(netpoll_print_options); =20 -static int netpoll_parse_ip_addr(const char *str, union inet_addr *addr) -{ - const char *end; - - if (!strchr(str, ':') && - in4_pton(str, -1, (void *)addr, -1, &end) > 0) { - if (!*end) - return 0; - } - if (in6_pton(str, -1, addr->in6.s6_addr, -1, &end) > 0) { -#if IS_ENABLED(CONFIG_IPV6) - if (!*end) - return 1; -#else - return -1; -#endif - } - return -1; -} - static void skb_pool_flush(struct netpoll *np) { struct sk_buff_head *skb_pool; @@ -539,95 +519,6 @@ static void skb_pool_flush(struct netpoll *np) skb_queue_purge_reason(skb_pool, SKB_CONSUMED); } =20 -int netpoll_parse_options(struct netpoll *np, char *opt) -{ - char *cur=3Dopt, *delim; - int ipv6; - bool ipversion_set =3D false; - - if (*cur !=3D '@') { - if ((delim =3D strchr(cur, '@')) =3D=3D NULL) - goto parse_failed; - *delim =3D 0; - if (kstrtou16(cur, 10, &np->local_port)) - goto parse_failed; - cur =3D delim; - } - cur++; - - if (*cur !=3D '/') { - ipversion_set =3D true; - if ((delim =3D strchr(cur, '/')) =3D=3D NULL) - goto parse_failed; - *delim =3D 0; - ipv6 =3D netpoll_parse_ip_addr(cur, &np->local_ip); - if (ipv6 < 0) - goto parse_failed; - else - np->ipv6 =3D (bool)ipv6; - cur =3D delim; - } - cur++; - - if (*cur !=3D ',') { - /* parse out dev_name or dev_mac */ - if ((delim =3D strchr(cur, ',')) =3D=3D NULL) - goto parse_failed; - *delim =3D 0; - - np->dev_name[0] =3D '\0'; - eth_broadcast_addr(np->dev_mac); - if (!strchr(cur, ':')) - strscpy(np->dev_name, cur, sizeof(np->dev_name)); - else if (!mac_pton(cur, np->dev_mac)) - goto parse_failed; - - cur =3D delim; - } - cur++; - - if (*cur !=3D '@') { - /* dst port */ - if ((delim =3D strchr(cur, '@')) =3D=3D NULL) - goto parse_failed; - *delim =3D 0; - if (*cur =3D=3D ' ' || *cur =3D=3D '\t') - np_info(np, "warning: whitespace is not allowed\n"); - if (kstrtou16(cur, 10, &np->remote_port)) - goto parse_failed; - cur =3D delim; - } - cur++; - - /* dst ip */ - if ((delim =3D strchr(cur, '/')) =3D=3D NULL) - goto parse_failed; - *delim =3D 0; - ipv6 =3D netpoll_parse_ip_addr(cur, &np->remote_ip); - if (ipv6 < 0) - goto parse_failed; - else if (ipversion_set && np->ipv6 !=3D (bool)ipv6) - goto parse_failed; - else - np->ipv6 =3D (bool)ipv6; - cur =3D delim + 1; - - if (*cur !=3D 0) { - /* MAC address */ - if (!mac_pton(cur, np->remote_mac)) - goto parse_failed; - } - - netpoll_print_options(np); - - return 0; - - parse_failed: - np_info(np, "couldn't parse config at '%s'!\n", cur); - return -1; -} -EXPORT_SYMBOL(netpoll_parse_options); - static void refill_skbs_work_handler(struct work_struct *work) { struct netpoll *np =3D --=20 2.47.1 From nobody Sat Oct 11 04:07:53 2025 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 D42C32BDC2F; Wed, 11 Jun 2025 14:19:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651556; cv=none; b=ULbScRy8nVJzNHcxJaAlnka9ke3v93vhqlWu4qao6W6/BHOcO2JtpKG53zagte6I6Qwoc2ApleBjbjOFIkO6loTKqvYpIR6fRjBlAS3MTcxgPxxv22jmnIRmHiv+tlrCF0B1R8CnXAanGwJ1hYKr0Wg6hmG5GsyPotRt0VlThdU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651556; c=relaxed/simple; bh=11HeW/BW2ezUf62qSDE6k77RuJurRYrt5Fv+ask0ZJE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OP7WZY8TrTiZue1+GRKYreUsgzm9Yn9OL9fSDeUCYRTMre9SJyYjy6mMS0DWd6fnj80jWoTYKtVFXbW7PFGnqt/HbvfG2kJgb6vHgrGGk58fUyaZIKiXDPgWZ89T0IWghpWLKKqW9689zTe0+OuVEd2xdlJM9XFG2vB9v+0bSs8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-adb2bd27c7bso1086831066b.2; Wed, 11 Jun 2025 07:19:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749651553; x=1750256353; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wE1ZdjeMGd/Lj/Y789gUtgoVV9g+RCFQuvjFrwgVVjM=; b=uL4jmpO4XV9UW+Q4siJ4q5WdZ9wWSc9dPXo3g6LcEAeOAYCSbCnA33qOBDSFZC5mul ogrzCMohLL/JbV33miOH+Kxo7C1slKzR1eG2ufVL7dQshh6+rZutNfC6YUx9vrzXDWmx iw2jZGND0F5H4NBDzukXw+FPKCfnORq9Pp3kzMSBex9Pg4NshuQDx9KruLxxsefgl0dG ZsFoWjFYRKM0kjiIE2MdnDRaN2MLlp4FdcMvZUIi7W7L/JbvN91bpW6CdvF1wZENlXpo bLeCpl+TTFjFLg5WRn6xJuevpCXFL7WbDLrcynHtPPULaPfF0lkorrvdIahq/twNc1E6 RYsw== X-Forwarded-Encrypted: i=1; AJvYcCVmihr92j23UolFNtDhWK+qyaYyKKa5GdGQ25W84GIa0SHgtO3o7FtD+rmV5VRc/NygyrHzNRAZRs7TpVlKHl+r@vger.kernel.org, AJvYcCWCoUn9iy3orhJMS082Phry9nYIOrq5FPA0JNm+IwXQNQXdJTRzd6/lRpT4/MnWjX8mjaX3PD7wiue1EaE=@vger.kernel.org X-Gm-Message-State: AOJu0Ywd8u8YDo7IzP2pv4RI40LTr8jgOoRH5D3yL6ipZ8TA6oTlFGpm YiqO9VI3ZGjrCh+99t1tXpP3KEaeU5Xs9vIlckhEwqoBi6Fzb9FFJyvw X-Gm-Gg: ASbGnctQ6AR4ZPbt3Xbfrem3q9DgNfXE6YceqwgNeMfRAV+94DoqTvtx1UIRi9zMZA+ NfS9Dz5nqCq75ys1f1SOf1Jv3OlktLKNR49r6SmfXUja4BdoBQkWL5/yOK3W/HMaWzf5KsyPrXq 1asvHVIZ/OFAC2Y9eaje+/ie1ykNSYH+ZkDtp+6Yo2R5oWNNyaZ4v6jZe69hSQWaOrTjnDGryWw XUgCaLt+VEGVRnIdN7aIxS2lpS9nQcKaKlBMWo8U9ppaCm3jFaxSe6hXZDsI/bI4U/RvrBPUzS9 aY2DdtfTWDrIIFEfzOok+W3QzradB3LJcRc9Q/McuTu8Un6cjF/W X-Google-Smtp-Source: AGHT+IHYmJfgPQWJPOravoqqPH3ZXtzqmUX0D4vOQzypu8zXhzAfCwgK5q9+Dd6ArMdXfwmozPfr2w== X-Received: by 2002:a17:907:3e09:b0:add:ed0d:a583 with SMTP id a640c23a62f3a-ade8950f8b6mr357647066b.19.1749651552829; Wed, 11 Jun 2025 07:19:12 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:2::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade7a3603b3sm300867366b.38.2025.06.11.07.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 07:19:12 -0700 (PDT) From: Breno Leitao Date: Wed, 11 Jun 2025 07:18:53 -0700 Subject: [PATCH net-next v2 4/7] netpoll: move netpoll_print_options to netconsole 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: <20250611-rework-v2-4-ab1d92b458ca@debian.org> References: <20250611-rework-v2-0-ab1d92b458ca@debian.org> In-Reply-To: <20250611-rework-v2-0-ab1d92b458ca@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=3210; i=leitao@debian.org; h=from:subject:message-id; bh=11HeW/BW2ezUf62qSDE6k77RuJurRYrt5Fv+ask0ZJE=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSZBZHy6mYXrfk0iJB65wJDRUgJC8nY4pgyba6 3+Rk4T3s7WJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEmQWQAKCRA1o5Of/Hh3 bQttD/9sfYt0sIOwnj/7Uhcl7yG0ypktjEpiALmspOSQ1IE4t7aR1RyBi5WfTE3xyKnYvaxrd1Z H3N/16cCH98nvnEx4jqQjOp1sWLiyeeKuUNa91vckRwVmFtNtG6cL4DYboM3177q4My7V/M8leD AaxNd0+H2P7dY1NaSkM0BQkW3YDBQKiI1Mxd47jmj20TJ7GH6GAVwcGcaT4RsAFQubSLSwqkw4V ZHTQPhGBtBYjirYFth3XSAgzrJvkiE9T+WC87xYmQf6JfsjUwMV0XDs/mdHiGFsEVL24M2iZs0/ v6k0i+hTdf/FKLJKn69P/rIEYcAYuNNPnGvW9cd7811R3unM5fVCjYaywYJimLy80Wrh4TTs+yv NzBbG/RQV2Zrx64PjtCH31kQ1BT8sfQ3+xIh1XC2zG14J4CuwNCGXhQE1qT/zqq8mG+7oME9Tu1 LjStSVeJDfqrFeqpvazkUqdwM5dsx6oN7d8rvLtMPTBdmaRx2uIlHqbhgQtf/0RZ0UCZO5kDtUo zQTkqGJiLO31W3Tw4uAOACp4tAgK0qM3wy/caaXW6pgynTcTI1M7t/G0vVHoT2qgp1B++pRHxKn XVltObmSMHot3FoiGniQ26eqfhlgvN2ktzMsLdrrphBqdyYeZWWSYrIfnqY6aCR8tgJAwB7ADBl gT+HhVvhs9XaaAg== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Move netpoll_print_options() from net/core/netpoll.c to drivers/net/netconsole.c and make it static. This function is only used by netconsole, so there's no need to export it or keep it in the public netpoll API. This reduces the netpoll API surface and improves code locality by keeping netconsole-specific functionality within the netconsole driver. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 17 +++++++++++++++++ include/linux/netpoll.h | 1 - net/core/netpoll.c | 17 ----------------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 6741e5484f053..1b8f9150eb350 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -278,6 +278,23 @@ static void netconsole_process_cleanups_core(void) mutex_unlock(&target_cleanup_list_lock); } =20 +static void netpoll_print_options(struct netpoll *np) +{ + np_info(np, "local port %d\n", np->local_port); + if (np->ipv6) + np_info(np, "local IPv6 address %pI6c\n", &np->local_ip.in6); + else + 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); + if (np->ipv6) + np_info(np, "remote IPv6 address %pI6c\n", &np->remote_ip.in6); + else + np_info(np, "remote IPv4 address %pI4\n", &np->remote_ip.ip); + np_info(np, "remote ethernet address %pM\n", np->remote_mac); +} + #ifdef CONFIG_NETCONSOLE_DYNAMIC =20 /* diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 1b8000954e52a..735e65c3cc114 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -72,7 +72,6 @@ static inline void netpoll_poll_enable(struct net_device = *dev) { return; } #endif =20 int netpoll_send_udp(struct netpoll *np, const char *msg, int len); -void netpoll_print_options(struct netpoll *np); int __netpoll_setup(struct netpoll *np, struct net_device *ndev); int netpoll_setup(struct netpoll *np); void __netpoll_free(struct netpoll *np); diff --git a/net/core/netpoll.c b/net/core/netpoll.c index d2965c916130d..07c453864a7df 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -492,23 +492,6 @@ int netpoll_send_udp(struct netpoll *np, const char *m= sg, int len) } EXPORT_SYMBOL(netpoll_send_udp); =20 -void netpoll_print_options(struct netpoll *np) -{ - np_info(np, "local port %d\n", np->local_port); - if (np->ipv6) - np_info(np, "local IPv6 address %pI6c\n", &np->local_ip.in6); - else - 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); - if (np->ipv6) - np_info(np, "remote IPv6 address %pI6c\n", &np->remote_ip.in6); - else - np_info(np, "remote IPv4 address %pI4\n", &np->remote_ip.ip); - np_info(np, "remote ethernet address %pM\n", np->remote_mac); -} -EXPORT_SYMBOL(netpoll_print_options); =20 static void skb_pool_flush(struct netpoll *np) { --=20 2.47.1 From nobody Sat Oct 11 04:07:53 2025 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 2DE652BDC19; Wed, 11 Jun 2025 14:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651558; cv=none; b=Gn4Yd5ClqcyRBQG3yE5aeKwtYqKVOtHyTiDAlyBTnMhrPlS1K5D3lVFo8Lq3UVK7Zux7YsqzijnAUDWOCjXvoeUm05J93w5CXeMxrS3wnYcvI5l6cutivSP2RQUj0Mu9dzQYg9lHZgObGt/zyNUVosIem6YS9jY+6/LU9+gr92U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651558; c=relaxed/simple; bh=Fwo8eKlVXNwWqkJY9/H+Q8gTiX4pph3761TVMvL2FfU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ElEWQ0pXMNCV0EANkqQN0mGm5QHZwe1qFvlMty+P0YSJ+cBd0SlcSbzyjHOjvcYKZuJNjc21r6aPQgUF/79H5Ah+KRvnZL3VS1WB1dQxbvNG6+fvsgSsx0xNN256L3pQ3Fk4HHkzgW8XjAQyAaXC6XxMyHdBCQZYrbyVnLkoh3s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-adb4e36904bso1331953166b.1; Wed, 11 Jun 2025 07:19:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749651554; x=1750256354; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HfXeyo1sC7jXwyqp5+K4Bcm4n+94BdelX+fnhM+6GaQ=; b=nlXAc/72foNFQmlpahClXDC+SlXjHvKe9X2MlhZc3fvNkQwpbwYG/BPMj2Lu5fsvoO 9+McF+VdBfPUX50al2rv9B9ntOC1xsRvbaKHD1WFKja+iDV06H4Jd0yzsBEBeEke+cUl W2xAJu37QtaqqN0BsS2weqHHx2phVJjdgDv6JhhaUiXeF117W2WJ6YCH7yO8Z+gZ7IpN QX3cn1pRz0OJT9p4ahUtOy0qW88TXMl3FdP53y3PLaFcD0UrPfSs04XxzNIVa2nYSKKa SMcswLndWjPupveRPzfrknbInHiqLR1+Gd9doZZHnmIwPOu+IwIMkhK+qAHcdxInxqbL FIcQ== X-Forwarded-Encrypted: i=1; AJvYcCVJw3Xbmbq05K43+IeSVODLdzyZepS6wziifQzeC6vewQimes98ygf8RQdV5Q/8814fIEJgaUEkTFs/mvI=@vger.kernel.org, AJvYcCWCTFjzLQl2WoZan9y3HD822cxiVmQdvhUEL5lI1YS0j+yNFZ153AT8AgB1wLf4TvoUBot60x+9oOoRXn8g3Xas@vger.kernel.org X-Gm-Message-State: AOJu0Yyimv00xXc3T5oFE7kkf3C9j1pzvaB37qivReyuIMMadsm+VW+8 T3zz3RgHdU2vrl1Mux+jxAghDIbHFL0RlQ0OqbrDSo6ymGGNziLt4V05 X-Gm-Gg: ASbGncurjTa7DtC6BgFKNo6J7olpozm2glo/eJFJ12TmfPDqk5lJ5e/MIwzr1ZXQSSY 8dFz6jDMTXgYKthRug56zCdJ+vSKbjLE0TWflyJeH9hL+ELl8MJMvYIv5XUXFOxz05RniOWH/dr 6y3TdmcRscqeK0ZswUS6eSFjWwnr5w/YD6/QQreuo7VkpmLriHGPAZip47og3VtHY4cxRjnNe10 XDXq87z4x1NZgtoYOuR269WWqxkUDTZpIxrahnG9tQsbzq5w4vkVQaLuZPkiwtZ0T4KynwT9jv0 gRaX3VJD+DtlP3HskfcH7vsXvXlW/xvEqyDYYyCghO48Ys9pBAymJJQUhgivKBQ= X-Google-Smtp-Source: AGHT+IGX6PFn6XiLHfgB7a12QDKxsJC69MYvRIaL8NsLgGwt74nuaQn7uePRd6EE5ue0UyfGTRaKkg== X-Received: by 2002:a17:907:1ca1:b0:ad8:9b5d:2c19 with SMTP id a640c23a62f3a-ade8c5f72e9mr266343966b.9.1749651554338; Wed, 11 Jun 2025 07:19:14 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:1::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1d7541fdsm897272466b.27.2025.06.11.07.19.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 07:19:13 -0700 (PDT) From: Breno Leitao Date: Wed, 11 Jun 2025 07:18:54 -0700 Subject: [PATCH net-next v2 5/7] netconsole: rename functions to better reflect their purpose 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: <20250611-rework-v2-5-ab1d92b458ca@debian.org> References: <20250611-rework-v2-0-ab1d92b458ca@debian.org> In-Reply-To: <20250611-rework-v2-0-ab1d92b458ca@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=2463; i=leitao@debian.org; h=from:subject:message-id; bh=Fwo8eKlVXNwWqkJY9/H+Q8gTiX4pph3761TVMvL2FfU=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSZBZoUEnbJaCpVqCOoQpSnbZTNKPevLNnjbkS CHPVyqphX+JAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEmQWQAKCRA1o5Of/Hh3 bWntEACjaND0zvquhzuqrRXV2Zr8C9UujgHEFL6XMVQm+bA92ltpriT8QoXADb+Bmbtdqtp2Kmk iBfHb1AqJZaAmO4iRzWP/fznQdUyasVr9WlGAY1LTVKDKBdr3ojnaelGAVGjv2ZS75MXKYXFotO Rm9ihZouAMwkImbbI2c0dF4D1FFdIsSxMeZ5QncXqg/o3uEkv++DVkQOJdPHfdCYZidCfUT4rjO b2xpLOF7KUFsQFgW1o9tWM3jCC5OFtHIMGsWeARyew2A9hAa3kmBuTbKUhxbPGYAFcQxmobSyZC n8tAy5XQQpngmevBZk7FR506Xjx6iX5EMrKrpiam6E/CDZoL223vwy60+iRqDo846yZlp/QyO1F LeUE1CvBz32Ay8o1+ChLkMPskl+6/NpbPO+M8JtbhDXuwzlL7H8UV8oMiYfK8IaJV01D4/I4S9Y ppEJYcPANhqTaGs9xvCWy5Kqb1mJchm4hyfBzKb3jQaEnWp6kFF8+cYdPnZ0pFGsQQssxIqCcEJ M0Ev9pUOs0J2Scrt3havJmNuoL7oajZanQyk0rFUjX5wGTM9LZ8LgRm7m75RtJDMxdX12Ti5UB1 fHum4HxeW/p8+vlNVuTKqXuarxstuW7jP6qAm2V0x9UykFgKYDt+MNfR1CblaiRhkGEMMUb6/6h 2F0VInJ7yIywCaA== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Rename netpoll_parse_options() to netconsole_parser_cmdline() and netpoll_print_options() to netconsole_print_banner() to better describe what these functions actually do within the netconsole context. Also fix minor code style issues including variable declaration ordering and spacing. These functions are specific to netconsole functionality rather than general netpoll operations, so the new names better reflect their actual purpose. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 1b8f9150eb350..7f1fed7871967 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -278,7 +278,7 @@ static void netconsole_process_cleanups_core(void) mutex_unlock(&target_cleanup_list_lock); } =20 -static void netpoll_print_options(struct netpoll *np) +static void netconsole_print_banner(struct netpoll *np) { np_info(np, "local port %d\n", np->local_port); if (np->ipv6) @@ -551,10 +551,10 @@ static ssize_t enabled_store(struct config_item *item, } =20 /* - * Skip netpoll_parse_options() -- all the attributes are + * Skip netconsole_parser_cmdline() -- all the attributes are * already configured via configfs. Just print them out. */ - netpoll_print_options(&nt->np); + netconsole_print_banner(&nt->np); =20 ret =3D netpoll_setup(&nt->np); if (ret) @@ -1697,11 +1697,12 @@ static int netpoll_parse_ip_addr(const char *str, u= nion inet_addr *addr) return -1; } =20 -static int netpoll_parse_options(struct netpoll *np, char *opt) +static int netconsole_parser_cmdline(struct netpoll *np, char *opt) { - char *cur=3Dopt, *delim; - int ipv6; bool ipversion_set =3D false; + char *cur =3D opt; + char *delim; + int ipv6; =20 if (*cur !=3D '@') { if ((delim =3D strchr(cur, '@')) =3D=3D NULL) @@ -1776,7 +1777,7 @@ static int netpoll_parse_options(struct netpoll *np, = char *opt) goto parse_failed; } =20 - netpoll_print_options(np); + netconsole_print_banner(np); =20 return 0; =20 @@ -1814,7 +1815,7 @@ static struct netconsole_target *alloc_param_target(c= har *target_config, } =20 /* Parse parameters and setup netpoll */ - err =3D netpoll_parse_options(&nt->np, target_config); + err =3D netconsole_parser_cmdline(&nt->np, target_config); if (err) goto fail; =20 --=20 2.47.1 From nobody Sat Oct 11 04:07:53 2025 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 81020272E7C; Wed, 11 Jun 2025 14:19:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651559; cv=none; b=EzUZtcfU45jJobiiT9R3ouMoWQKwm4eySmBSif7PQwQMpqY9HBi/9OzZUTYXRgQFYYIvZ+zlVtHDOXwvbSVqcQf3jf/0sIkw4UUDcMIP0RlwLu3VkijcbT4YOP2MSoJrWCLAiMrw2xbeOaQehVZfxK7/hqTTYkzefUvU36ZSKEE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651559; c=relaxed/simple; bh=EdA74/+V2zz2asOoQAH6QfMca+RqGWUEWsqPEKaI6bc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mSFYFiGeQk1ctoBmPYY9qt2k/zP0VElIe4DfuF20WQsntCV/Fmg53nIxnQSP9c5nkr9n2WTmfTu2uhm9xHvQCze2BNHrNMVMeewEM/BuWTZ5Bx+RVi8m3fLIdsWf+qMtoTuaAgO6lBLMyi8PkiCw4ohkXaD/jzEbunz9fwxj52c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-607cf70b00aso7656313a12.2; Wed, 11 Jun 2025 07:19:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749651556; x=1750256356; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TQ0YLkP+R6uUe1ptSrDSo+/Jx3Q/UQ8OAewlKbpdVaw=; b=W1VnvHBHTIBPgTB4kyNDjs8t31FXOSTw2/21le8J3JINXe+/X5Kcm0uDNj/QBmE3Pg zOr3uj7g+TKptLNXhnoyl9sj1WhR6KwWA+9c+lavTTEI2g4M9JtQDMADBOubXeUSFlID 0UDnZ+mxhqmJt/QMgMUFFclC5sUR7vJ7pAb/xq4agH4VAw6hsiStrDnUNqckteYkTEYZ 2cGNSxxNtcdGbOgXpMT9kFsSILU4HiGwk5LusxwIr+n1Fl0G3SNlV46E3i3g6kYG1f+a kIxyHPyY534Xs8Dq7FutiW0kvNHB2UkAfUzI5/4iP/kNC7aRqtOD+eYBaeuRrLw2pcbj 2S/w== X-Forwarded-Encrypted: i=1; AJvYcCVX9l8bhoLWdwKqIzCgKxDTVM4eUxQJJ7vvSiVvMweSLs/Q0isZQriiq1Ugqn14P0mWJ/IkijkXC8YKqfA=@vger.kernel.org, AJvYcCXzWchfpSUivBQB14iv9+tv1FgyuCv7gqASIZaBl2gUCnqRoXZ1g/VAhGLzRHM1c0G5Amvn5sVPurz0+ANYvapK@vger.kernel.org X-Gm-Message-State: AOJu0Yxo/YOZf5ywWL4znN2z+pPMmCZ4yK0VQG6PaEV1mIi6XDensvPF Fv4bGfyVtvQv/WIlWmKWR/mOxNgEsff3BKuddmG8eA04coxDfUS/Sjoi X-Gm-Gg: ASbGncvN+boC3hUI+yUNwY3fATF2124DqiVc64iwM6gVCadhf9P44tZpUOWspchoftx rJ9VyZCb+xiziCVxNXuAJ/NFPAjbuECMTAgBjfurejQvbAzsGqqLPS4LzTqRezjdTppRsjiMkip syj55DCn54HOMAi/5iA6vEpxuHhfdpfDOWNf6OvjXCzrbwWto7KbWGNMGemkBzMSFYVASOVFUow dfJ3e6NwaPS+vgs3VIDmGzCQ/EZ0WJTjdkMX1GBU21OR3ykwU4ne2svVBq5Mhsbe/sA8ldmk61o dLLJsPprG1DtuKDM2CoprNMrmt8R+9895mnebDeQeygCeq9m84EY X-Google-Smtp-Source: AGHT+IF07su2dp6sPs/dNAXxWpm5VPq+/wBVQDjmDG/s/wUGdmtqkVBr8Cff6TAXYAX9QWWABCFLtw== X-Received: by 2002:a17:907:9803:b0:ad8:9e80:6bc3 with SMTP id a640c23a62f3a-ade893db0e9mr348809866b.1.1749651555664; Wed, 11 Jun 2025 07:19:15 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:2::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade399c1887sm772487166b.93.2025.06.11.07.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 07:19:15 -0700 (PDT) From: Breno Leitao Date: Wed, 11 Jun 2025 07:18:55 -0700 Subject: [PATCH net-next v2 6/7] netconsole: improve code style in parser function 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: <20250611-rework-v2-6-ab1d92b458ca@debian.org> References: <20250611-rework-v2-0-ab1d92b458ca@debian.org> In-Reply-To: <20250611-rework-v2-0-ab1d92b458ca@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=2089; i=leitao@debian.org; h=from:subject:message-id; bh=EdA74/+V2zz2asOoQAH6QfMca+RqGWUEWsqPEKaI6bc=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSZBZWwKGd8sQ+x+DyIsXrnHQ35lo2Y+YeVH7m /inujdQ9QuJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEmQWQAKCRA1o5Of/Hh3 bVHzD/0V7QBMgOr8bZZqOnqpL2w2mWFIVvyZ/flWYE0fnW01Q3I6GgrETwhPj7zRbFwdZ+VDdru elEPxdWqnQkLHDYWj308kXAfNAa2Kmo6niknr+PuNg8BlhHPtwpqEuZ2iLoPpqkdZFHlsrPygiW sO7wGi7xsnkI0fxqW2gv2YA4Wn1Zua9xPDWcM7I974NdCORS57iDHDZb9jbevjKtY0M2wZi08qD 63x8058Md4ku9/Rmx1Ab13nMdzNM6UPBzyZpknQ8g17DuZEmG4VPG6SYavPTX7FA2WRsc+LG7Ih LzUjwZjfRlf+U12XSLQN19AI0kwh600qVcZkth6LiRydrXYCFZIQ/BzDU8gmsiDdwHr0LXprdEV rdZLfNUeCH7DkKfHkBQFCCt3K/ke4Gz49EgfcxawQNZiL1uKYzbJidHg+8hIfma1jzpK8EDFxCX UZmD4GwSlK9BpWazKP/J1oPVuzlDQiLEZfIIoPGUHKxn3Qx0V5kXIYquV9doJUJ1wfpS1eNAifZ FiYq0qEKFhtQJtNquLPs54mzdrPkJRRojcKhh4E++gh2QpfCiPzVHNSauX4dTP5QQ1D4M80M4SZ MfUttiwuuoRS3upr2wFsy5UOfhSNvx2Ha/imbS+iIpBdz0nk9Fm6mMhcmc4JTNY4cajX7cQvHzt MFM9O4wbtVhdRrw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Split assignment from conditional checks and use preferred null pointer check style (!delim instead of =3D=3D NULL) in netconsole_parser_cmdline(). This improves code readability and follows kernel coding style conventions. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 7f1fed7871967..56d14294ddcaf 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -1705,7 +1705,8 @@ static int netconsole_parser_cmdline(struct netpoll *= np, char *opt) int ipv6; =20 if (*cur !=3D '@') { - if ((delim =3D strchr(cur, '@')) =3D=3D NULL) + delim =3D strchr(cur, '@'); + if (!delim) goto parse_failed; *delim =3D 0; if (kstrtou16(cur, 10, &np->local_port)) @@ -1716,7 +1717,8 @@ static int netconsole_parser_cmdline(struct netpoll *= np, char *opt) =20 if (*cur !=3D '/') { ipversion_set =3D true; - if ((delim =3D strchr(cur, '/')) =3D=3D NULL) + delim =3D strchr(cur, '/'); + if (!delim) goto parse_failed; *delim =3D 0; ipv6 =3D netpoll_parse_ip_addr(cur, &np->local_ip); @@ -1730,7 +1732,8 @@ static int netconsole_parser_cmdline(struct netpoll *= np, char *opt) =20 if (*cur !=3D ',') { /* parse out dev_name or dev_mac */ - if ((delim =3D strchr(cur, ',')) =3D=3D NULL) + delim =3D strchr(cur, ','); + if (!delim) goto parse_failed; *delim =3D 0; =20 @@ -1747,7 +1750,8 @@ static int netconsole_parser_cmdline(struct netpoll *= np, char *opt) =20 if (*cur !=3D '@') { /* dst port */ - if ((delim =3D strchr(cur, '@')) =3D=3D NULL) + delim =3D strchr(cur, '@'); + if (!delim) goto parse_failed; *delim =3D 0; if (*cur =3D=3D ' ' || *cur =3D=3D '\t') @@ -1759,7 +1763,8 @@ static int netconsole_parser_cmdline(struct netpoll *= np, char *opt) cur++; =20 /* dst ip */ - if ((delim =3D strchr(cur, '/')) =3D=3D NULL) + delim =3D strchr(cur, '/'); + if (!delim) goto parse_failed; *delim =3D 0; ipv6 =3D netpoll_parse_ip_addr(cur, &np->remote_ip); --=20 2.47.1 From nobody Sat Oct 11 04:07:53 2025 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.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 1D8A02BD5B4; Wed, 11 Jun 2025 14:19:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651561; cv=none; b=dfgI9rwif/Gt7BoUnGMVYTk4fIhILp36KhPPFblJAPL2/yMzmkT0nV70ILys2VRxeX84wXUsMJSS8GI1sy4ivHMMeuW9BmjZE+KUfJCxrJI/3sC7L1EkP5BdAdP0lVn3SxuQEFPpCK7Zwge1SygSaDsxMFG1X6uwLDk1uGvitTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749651561; c=relaxed/simple; bh=90WOkJyHZWryshNeI2TppKcZTUgW1razEou2DXt0DvQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LBSOXPoYBxtBL/VTnOT1QSXNXRyn7FmGNd+49nEumdDVBvzrDq4zNP6AAknWRsXPXk+zEIgSqI9T5slZ6aLURxhyvHgoMgAGVLG/3lSLFz+h/6fcEGKvoK++YbDLi/4SxMNluk6JPLAwwRCdjw0Pe3XVuHCQTQURrNnoNH4W94g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-60768f080d8so10338648a12.1; Wed, 11 Jun 2025 07:19:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749651557; x=1750256357; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1A7oozekEJYmGg//Ai1+WY03klz1mRrkPiqnVnqyjj8=; b=pLjtztqJaF2rOZsjVRV7/Ea5ANLvO2QnBSi3JE5BVfujSFLE+NNNfOBDdV+N/eM2Pv JvJeO8nMJojQp5tybxQU/T8It3jPeq/njQrxE8w+c2r3lsWcqzLofcUtI/oKjB7jzf/Q PKwgOXLjnyjGydPs7HoM0DBcjQ57y38wAx4CNTp7OuEl6CyQfDBUYdthhxjmyFdI/UTv xSbS7agmH2bqMEpHzJbT0bu+JOu0IbQMkXR/3txz8NM9j3Vqijzrd/CUPKooRwu2GmCX MwK+gAIPqI0PJaO3yA5sLpw3B8zEJTpLwVdeDsJgog1nzHCjsWDXEMiAMCicKyqiak2s G12A== X-Forwarded-Encrypted: i=1; AJvYcCU1IT9zD7cHs43dAT+Be4JarZ2WSlU6XHQUsrXBV+o8IS7FQyaafBmw52kPiBDNTxmPOP6EU6lo9qPwKPKbsl7R@vger.kernel.org, AJvYcCWoDQSrHkNk3/oHUd6uv4RSw/8OrqMAsVpoqY1fqrvqqvGxBwvrj1MgwsiV0U/s5kJFLF8jcPBB+LzKQ7U=@vger.kernel.org X-Gm-Message-State: AOJu0Yxdw5W20qm96Z/Yu6maEgXJW6QH1BfzaBPKZ5b7/fksWQbyyGHq hyPL5XCTqdHLqslXYeQAyGlWouTq/qjQ58xLz8B3rXnurBGcB7/1aPhn X-Gm-Gg: ASbGncubNCcSVR7BtLZk3/ZqWKJMp0WnKm7MjP0vAjLw3lLtKn3pGprXJJCEr0/Ty27 GhfRdkw79oT1lrJ2zR63SMAcZA2ycblW65Wcjt6b7D+XI4Dzx2QyQ9b36JUeK/nwOh4H5bagwDh MQAaufFPw1cb6ah77zoVu7S0LSk4TTaxRiSfjUg9TCa6EozrctVNRJ4BG9h3nX7Hxmcju0ZHr96 DseKAP/P3qYxSXp+veRJ0jVEQP9XkNIufv5ACohgVkRlWBrJrsCOJJ5KZgCm5UlXNGDecz3hRB9 z4Z7H5xTwphsVtzFvJWx48/c/x5A/5gBW2kp22VjxWOWdpUuEPWaS68mQedFFxRf X-Google-Smtp-Source: AGHT+IETa4xhReJhKDmZM1e934PAkGpD5H8063zemDow5kIUu7EkO4GS5Ufvv7401dXPqPBsvlX6Yw== X-Received: by 2002:a05:6402:3593:b0:607:ec18:940f with SMTP id 4fb4d7f45d1cf-60863820789mr4290a12.6.1749651557147; Wed, 11 Jun 2025 07:19:17 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:72::]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-607783e66f1sm7555596a12.79.2025.06.11.07.19.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 07:19:16 -0700 (PDT) From: Breno Leitao Date: Wed, 11 Jun 2025 07:18:56 -0700 Subject: [PATCH net-next v2 7/7] selftest: netconsole: add test for cmdline configuration 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: <20250611-rework-v2-7-ab1d92b458ca@debian.org> References: <20250611-rework-v2-0-ab1d92b458ca@debian.org> In-Reply-To: <20250611-rework-v2-0-ab1d92b458ca@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=5924; i=leitao@debian.org; h=from:subject:message-id; bh=90WOkJyHZWryshNeI2TppKcZTUgW1razEou2DXt0DvQ=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSZBZyOhAItP32l3C4x9fWH/Ae8HGu8tNABH3R d0w+FkVW5CJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEmQWQAKCRA1o5Of/Hh3 bfRCEACwVxEBb6gqTC/BcAMG8UTMlkNCRtpQvzBPd31Iw3Nsnzfg45JVhISoYs6qD0stdIFY00R PZbvHuGrX1lARMsqIjFGW5X7q6i0XxHMDmVQKgTVyfQ4PpZXR7pLZDKDseE1vhWKspsF57zGQsF 8kVhvBG+0Q7j0MTAiz0AwmNIAjpriXf2EtTxXo7ZYurT37TmOnpykhEqw9Na/CFGcoBj7/83Z75 FTt7telyEeHsiPfjZkxqjTzLX+USwGdgNgSvVehGEr9eJCnoR+0RmqevFYxYVmVZA6ckR2hLO9R coPV5IbMmgIKPhAn0XpF6IA+5xj9RH4/lG6h1BbcJJirEIR3DKXCO9jb1kIS/94BvEqdjdE15pQ X2unvUGCsO6h9KcJw4AuNuMkmW9H0zlEIhJfzezzBpC89e1qA1F+icx2AUWuzkH0N81C6pxvIjk PsF/BKxVeLAxdaPSnvJVL6HlwAyVU0JLcPHtjxUVrUqY6tcBJ/pqUCw9H4UDPUIR+3P9PVdfayi 7NvFPne9qyXGoM1M28YPh19cJD/X0c6U4qMnabfKS+HFAIs67kJRsYDNAsyDRiu9HvzgXi/ApH3 KrULEmxdZHVCaV+GwoJiokyPnJLN4eTHlX/FXgRMxxhcJ5rh6vt4sLm3ZaIAXbt659X8PY8t54c XfdQYT1NG39ohRw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Add a new selftest to verify netconsole module loading with command line arguments. This test exercises the init_netconsole() path and validates proper parsing of the netconsole=3D parameter format. The test: - Loads netconsole module with cmdline configuration instead of dynamic reconfiguration - Validates message transmission through the configured target - Adds helper functions for cmdline string generation and module validation This complements existing netconsole selftests by covering the module initialization code path that processes boot-time parameters. This test is useful to test issues like the one described in [1]. Link: https://lore.kernel.org/netdev/Z36TlACdNMwFD7wv@dev-ushankar.dev.pure= storage.com/ [1] Signed-off-by: Breno Leitao --- tools/testing/selftests/drivers/net/Makefile | 1 + .../selftests/drivers/net/lib/sh/lib_netcons.sh | 39 +++++++++++++--- .../selftests/drivers/net/netcons_cmdline.sh | 52 ++++++++++++++++++= ++++ 3 files changed, 86 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/drivers/net/Makefile b/tools/testing/s= elftests/drivers/net/Makefile index be780bcb73a3b..bd309b2d39095 100644 --- a/tools/testing/selftests/drivers/net/Makefile +++ b/tools/testing/selftests/drivers/net/Makefile @@ -12,6 +12,7 @@ TEST_GEN_FILES :=3D \ TEST_PROGS :=3D \ napi_id.py \ netcons_basic.sh \ + netcons_cmdline.sh \ netcons_fragmented_msg.sh \ netcons_overflow.sh \ netcons_sysdata.sh \ diff --git a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh b/to= ols/testing/selftests/drivers/net/lib/sh/lib_netcons.sh index 71a5a8b1712c0..42fd458be56c9 100644 --- a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh +++ b/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh @@ -121,6 +121,17 @@ function create_dynamic_target() { echo 1 > "${NETCONS_PATH}"/enabled } =20 +# Generate the command line argument for netconsole following: +# netconsole=3D[+][src-port]@[src-ip]/[],[tgt-port]@/[tgt-ma= caddr] +function create_cmdline_str() { + DSTMAC=3D$(ip netns exec "${NAMESPACE}" \ + ip link show "${DSTIF}" | awk '/ether/ {print $2}') + SRCPORT=3D"1514" + TGTPORT=3D"6666" + + echo "netconsole=3D\"+${SRCPORT}@${SRCIP}/${SRCIF},${TGTPORT}@${DSTIP}/${= DSTMAC}\"" +} + # Do not append the release to the header of the message function disable_release_append() { echo 0 > "${NETCONS_PATH}"/enabled @@ -169,13 +180,9 @@ function listen_port_and_save_to() { socat UDP-LISTEN:"${PORT}",fork "${OUTPUT}" } =20 -function validate_result() { +# Only validate that the message arrived properly +function validate_msg() { local TMPFILENAME=3D"$1" - local FORMAT=3D${2:-"extended"} - - # TMPFILENAME will contain something like: - # 6.11.1-0_fbk0_rc13_509_g30d75cea12f7,13,1822,115075213798,-;netconsole = selftest: netcons_gtJHM - # key=3Dvalue =20 # Check if the file exists if [ ! -f "$TMPFILENAME" ]; then @@ -188,6 +195,17 @@ function validate_result() { cat "${TMPFILENAME}" >&2 exit "${ksft_fail}" fi +} + +# Validate the message and userdata +function validate_result() { + local TMPFILENAME=3D"$1" + + # TMPFILENAME will contain something like: + # 6.11.1-0_fbk0_rc13_509_g30d75cea12f7,13,1822,115075213798,-;netconsole = selftest: netcons_gtJHM + # key=3Dvalue + + validate_msg "${TMPFILENAME}" =20 # userdata is not supported on basic format target, # thus, do not validate it. @@ -263,3 +281,12 @@ function pkill_socat() { pkill -f "${PROCESS_NAME}" set -e } + +# Check if netconsole was compiled as a module, otherwise exit +function check_netconsole_module() { + if modinfo netconsole | grep filename: | grep -q builtin + then + echo "SKIP: netconsole should be compiled as a module" >&2 + exit "${ksft_skip}" + fi +} diff --git a/tools/testing/selftests/drivers/net/netcons_cmdline.sh b/tools= /testing/selftests/drivers/net/netcons_cmdline.sh new file mode 100755 index 0000000000000..6d743b6e4922b --- /dev/null +++ b/tools/testing/selftests/drivers/net/netcons_cmdline.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0 + +# This is a selftest to test cmdline arguments on netconsole. +# It exercises loading of netconsole from cmdline instead of the dynamic +# reconfiguration. This includes parsing the long netconsole=3D line and a= ll the +# flow through init_netconsole(). +# +# Author: Breno Leitao + +set -euo pipefail + +SCRIPTDIR=3D$(dirname "$(readlink -e "${BASH_SOURCE[0]}")") + +source "${SCRIPTDIR}"/lib/sh/lib_netcons.sh + +check_netconsole_module + +modprobe netdevsim 2> /dev/null || true +rmmod netconsole 2> /dev/null || true + +# The content of kmsg will be save to the following file +OUTPUT_FILE=3D"/tmp/${TARGET}" + +# Check for basic system dependency and exit if not found +# check_for_dependencies +# Set current loglevel to KERN_INFO(6), and default to KERN_NOTICE(5) +echo "6 5" > /proc/sys/kernel/printk +# Remove the namespace and network interfaces +trap cleanup_all_ns EXIT +# Create one namespace and two interfaces +set_network +# Create the command line for netconsole, with the configuration from the +# function above +CMDLINE=3D"$(create_cmdline_str)" + +# Load the module, with the cmdline set +modprobe netconsole "${CMDLINE}" + +# Listed for netconsole port inside the namespace and destination interface +listen_port_and_save_to "${OUTPUT_FILE}" & +# Wait for socat to start and listen to the port. +wait_local_port_listen "${NAMESPACE}" "${PORT}" udp +# Send the message +echo "${MSG}: ${TARGET}" > /dev/kmsg +# Wait until socat saves the file to disk +busywait "${BUSYWAIT_TIMEOUT}" test -s "${OUTPUT_FILE}" +# Make sure the message was received in the dst part +# and exit +validate_msg "${OUTPUT_FILE}" + +exit "${ksft_pass}" --=20 2.47.1