From nobody Sat Oct 11 12:15:10 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 44E6E22A4CC; Tue, 10 Jun 2025 15:18:27 +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=1749568709; cv=none; b=RISzVcegixf+AAduahThWhfOueVPMbuMqCHXuTvUJrLfkBPTzbZ4fjyk8As2l6ufwOB3Zx105x4VvcirEJeC48jBveQlrIDRz2ynYUEEdBoEGHda5JOJxYKmNV6DKgFlW9V6cg7RidC2sASLvJfRkaBZxZvQ1jeW23bCAyZKFA0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568709; 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=WZKgT1hDHW2lKggP5xiC9NADglJPUQO2LHhYESaRTXR/orq+DMENOsNIZ9WbGaTtHnFWvFOUxjXcUmb7ny4q5Kq8Rp1kSp4G+p+mEruaWUot8+CTrDWqYwepKrjaqyvjO3HgSczee4Rd3ZqXGjG6sxnw82vJJKPWGkokQf8dnpE= 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-60700a745e5so8404632a12.3; Tue, 10 Jun 2025 08:18:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749568705; x=1750173505; 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=N0oHlt1I3O6/uogX/43sLGc9K/HOMyMQAH5kdv0P6AhybpCJpR5cUnIzvsMuOPA8Bm OSXHXlNbrgShq7/gNGivuLEByVpjrLt3A+0gOk7+7iyfJokcuYNaByn8iEySEIhIbvFJ SIylf9dUwwFLwKRuGEkc0YusXhtHitaxHQRepCohPYNrEMBjE1g3XqSBgYI2fuLOAgrb kovywRkeqkjOQWXzWQsTZVWNBvWSazbzcX/sT43cTcii27cDqCqd36ZjrfyoourWMbPw cZ9/ZDqLLQYiYmj8Olx6hPZpWA0uCLcXvuiUT7zFoUL8IVfDm37j84SDWaTQgFjWeE+I ZmEQ== X-Forwarded-Encrypted: i=1; AJvYcCXuAmH+xJ7PP7sMklmrwgIBmtwKz+NEEtHXnusVYumdKkO9cPEzuU5+tzfeTuTv74iGLaqJvSiQyOgXlADoE9e/@vger.kernel.org, AJvYcCXvdfYkBkwFcrQsZkBEbzlfkYBNWfG9RJBGRGswH90yrqCFmZ/eioVyKP6/Q4Jw09LdIjfzTgk/gT4r2Ng=@vger.kernel.org X-Gm-Message-State: AOJu0YxnssViIFlfFIqXQj1iZjKNDAwYboAde3B7C6xyIfIXfuToqG5e 0Cg5FeLpvgVmNE8fBuYLpKlOPqavkREI7kD5YpKBhMTBxWCmsrna54xI X-Gm-Gg: ASbGncskBsMBsjFJwvRfH8Tve3jVHNitc784+FnzbxIvvkOBh8YQy/fpvBXJ1o98vjH JYpTzLfNjwCfd6Ca9/n6W40H/dKtkjQ15XdLlZOOCAPUSptWJJgC2Di/e/qFHCxAbI2MR2AUnF6 /GWLtMVims4AYjD1b0NjpFjx/JYEmiEUnKtzsyewBXw976XfcME61nN6MQ3XdLbXdOqOejH4Hk6 ZlLsbTqhhLmwTfJQiRNHGulwQT8W1NWwrONBRKGyVDTVvPltJYRQF7PTWj9MirdMYq60evluywn qCZOnOOCzplrleb/669+xJs3egNzuHdKxGtf++HQxEH8Pq6zua7q/cvgZZ6D X-Google-Smtp-Source: AGHT+IE9WVA+kbFrnmT1TlL+TV+6AcVIBawnAOeskXYVBGEHFwX/ukFBz4SHKuCvRS0A7itqPfPprw== X-Received: by 2002:a05:6402:2554:b0:605:878:3553 with SMTP id 4fb4d7f45d1cf-60773ecd524mr15584636a12.16.1749568705223; Tue, 10 Jun 2025 08:18:25 -0700 (PDT) Received: from localhost ([2a03:2880:30ff::]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6077836fe51sm6312471a12.13.2025.06.10.08.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 08:18:24 -0700 (PDT) From: Breno Leitao Date: Tue, 10 Jun 2025 08:18:13 -0700 Subject: [PATCH net-next 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: <20250610-rework-v1-1-7cfde283f246@debian.org> References: <20250610-rework-v1-0-7cfde283f246@debian.org> In-Reply-To: <20250610-rework-v1-0-7cfde283f246@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/8eHdtAcsmYgBoSEy9cbamCtk1q+VC3hBblqcpJ/gZ0ql8ZGNKa j9+AkbUZ9mJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEhMvQAKCRA1o5Of/Hh3 bSGMD/wJT5gteXkme6oDQxMbBr2uzXcXsryawLuy+gz0A1w4UStNjLOPIb3TEZk9TezsVlaNxs6 hRiSnwIXsxu5Oa/2VVwY6Fx/cZKVNfG+oAtFIQK60ys0Sq2cb8ipxdcwM69MX+KusXZmCAjsZ9Z gguQYq2Q5I7svysDoN9zyDAm7EkravGWiXJevP/tb6jX8WRHq+uhVUeVvkz/5+uQnJv5MjneqGa eRZJ+YRp/ukBRrdWrU/TXEcsVIDXGGdGXTFGkYw5c3SZrcTEciWxqq+aR2NjD+h/FtvjxV0kmta ooUGZR+HyH6mceVFxlkXFd32wJW0upysesQv9JEC+e1MejuwN0e8Xn0u0umvTC9KX7HpHZIQJyB eA5Q4EkQBr4XyzQC69QU2xAdRJ1TDMvwSm/QAOt9soi3DvjyJwsMJ7ZUd83EsPSwThgBGV76YhH ke6KwIpfx6ogyf/0g/NR/dSdfcAOrnIUBCsJJ1e7JG9UxFBWVbiJCG1xk7VGUkBGTjWPoVvM/tg 6wivFIp67CYzmgWp4lyOu0S/90IYuBrq0c4aYvzOa30NCjkj8RRTNqoZ+HzIxuXMeSpZjV3tmN9 GRuI0fWPGXNL/OfHODnc/NGcxjkCYjxGrNUIxF3kJq4ayeGOm4y2ronObeJO6YvMe9lGjBsE9DQ FKPwI/VyoSz+Bpg== 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 12:15:10 2025 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.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 73AD2248873; Tue, 10 Jun 2025 15:18:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568722; cv=none; b=bzKpo3UuDPRFdzlsfiEECbt9ZujFWIAijEh1H3frhjRCBq2J3sRZ+/qOiVl9dGydp95wDpiHSxkeQpGSVA369M2gmcXJfr3M+JY3WPEeW7J5WAx6ENKbmvCWB/x1cJu2zOqO2xee6CDOuISRQ2qKMaITKe0+JCvGVi1VOoaeRYc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568722; c=relaxed/simple; bh=9MWyVnOGtCTb6f3l99b+ZT3EK3ZbCVffW6Ctmx3iUqo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IYr/krA9UpF8/RMj9uSS+AAmTGbHQClGYwO5mLTRAzeNp3XyvipVivLaYu+QrMuy3ChRqcuAMtsPFxhYJRkwBCCwN3YKpa0te/inkdamKCYFW/BMqIMJEuRZQOtzS/ks/NS6nEEMG6YqNSbBHhnkRNvQXBlJIj3eh6egoG5MqkU= 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.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-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-606fdbd20afso11005910a12.1; Tue, 10 Jun 2025 08:18:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749568718; x=1750173518; 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=o4fQohhoxi81zBO7I2YwJ2/CTdn4/zGPWs9x9abIzYD0XhDBjVoEnHgcxB1cRWJv8U uoNIDhbDVUxyS45FUVXUOqY+YRcEwqNRnAa5xKfxwrJC6GL4ZiH2ic5ckJyWl4LhEFsE jtOsUcZLO96kDTHNLYFM0It3Bl3QHsuqz2SCszmeswuHy1D8qAJQ8ZheRg+4MSs4LmR3 xlH/awmhqReuR0jyE7C0IPdnYKllryUKcqim5AQ5NTFwoJpfjop7AhdtSGA1Q+qD4QQl 4lzzxWt6Jze+Z6iylBaxbw4sStBb9IInFsdN8vtPP8HQj3NmrMPZs2DAI9F+ffSoG3wY H6wg== X-Forwarded-Encrypted: i=1; AJvYcCVEXc7nnzWyXydrYq/PN0cbX9NpNyziacMI3XlQomW5Wa6LAMeyUhNzMTc+XQzsUSdElwquFKfR9olfrkg7FLRG@vger.kernel.org, AJvYcCXCp1aQOXQ4qdie4dmScPi7uDv6d4saQa4xpAEto32Y60dvL0uUswTQaNbC73xe3MvsW7oAMmQExSw3tsg=@vger.kernel.org X-Gm-Message-State: AOJu0YzFr41Oon4qKLgmJEFOF8J5vZCOKuT08GyAB0+uXIao5WY1DIpV vjiJ8G8VaygetbbcMHKn2jUXdcgsYYBrP9UPMIczqmuyfn565M9KkUWtnXB37w== X-Gm-Gg: ASbGnctKQ0mZQ2/0gxmAeBDJZhcRTs15izER2tsGTziexoqhxx5BpPq9xFLLL0DVTD7 vW+wHWmYQMJybwciLxdyT6744NIcvaTwKYQUsEdIUpGDJ15oO78FB9VVaRsCW71Mdr4kb7HM0AT 6hBP3529/k7PD3k/WQH3xZhBRb6JzQn9zKJA6TWBGq7rej1LLW7eUqBnqDopttN81Y/1meNKAwr /3ZIIvcLOJ2osiS7l8s9BXupRSRLIJxtl2P47xrICXjky/G9kWp3VRwLVqU4SCaA+Imqmf/6dPr 7MFMZYiHUlmicEhn+ltOTc6VQXGvxs+81MfuiKs+GJ/eCoUOrDwo12T4LOhBYZo= X-Google-Smtp-Source: AGHT+IFi7m7IPJloJyOQs2CLtH3z718IwouGyQ1nOAQKQdL2sR29+mTuDOLtp+cEiVwjfgC4aIc2sQ== X-Received: by 2002:a17:907:9483:b0:ad8:8689:2cc9 with SMTP id a640c23a62f3a-ade1ab325f3mr1861228366b.56.1749568706707; Tue, 10 Jun 2025 08:18:26 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:2::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1d755281sm748188666b.18.2025.06.10.08.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 08:18:26 -0700 (PDT) From: Breno Leitao Date: Tue, 10 Jun 2025 08:18:14 -0700 Subject: [PATCH net-next 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: <20250610-rework-v1-2-7cfde283f246@debian.org> References: <20250610-rework-v1-0-7cfde283f246@debian.org> In-Reply-To: <20250610-rework-v1-0-7cfde283f246@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/8eHdtAcsmYgBoSEy+qpFULA29lNETIGCTd3h76nekk19u06qRZ p69G+PbiFmJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEhMvgAKCRA1o5Of/Hh3 balGEACgWZ7XicJeIucyZxRxslAdwKCNmnMKL8WHVsa29IBDIMNUsvjVYHEyZZHwqy2nqSTVj+Y fpdH2/XD9KCmHW2FoZzCTxzAghZUg0eMFbIvAp6NxMu6e6SYVfUi5G2pT5SuSvKpjwyPgzj9oRW CbPVOY5G24wd1gjAJXqTpJT1aOj8nnrE7jOeWFuGbJvbkiYJmaRqsoPCwNTWSQv8UvjAzQiIigQ AjzD1KEdfDAh5wm9q7LeFUP/Il9N1NL44HL4xhVFQuvWx+R/Na7SsDTsTddd4Y3eF97CTrmwvEo 5tYIvG2A5+Ji7DJlFmssX74bNKPKfKDmfosMsuxPl61aewnEA1ziq6+kxdWzYkhMn2SuWBU5uTj CRjcnwLPov3lCDQ0yvBiuO26/KtXR+lXsULrQHyg+DNfTnOqq4AM4LveqgWdBoNozoJLIoeov7W t0+r4SENytg+oLA4lneYvk5HGkDC87PkWAedvGfzyd78K9wR1xum6/sj3a3fGv/8SVCLDyg4bjy 8dJoYcRndWLy0LgLuJ0I1FPxRKgYwfvbEZ2qjVLn+YC0GNb/lVRFoDjkvIfjrJ1ogv8rxL8dTQr 5/SX/Todrm1UMp7k7uyf8BrCUU4S8Jr46dcsvK8XkGV4dG7uGRCnc804q9GuTGhyt2nlUtwT3i6 lBfwOsOrjT7LIGQ== 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 12:15:10 2025 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 277532417E0; Tue, 10 Jun 2025 15:18:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568712; cv=none; b=qfU9XD3tB4Sd2u6iiHjpi+Q62rPNeiYYdyOiATCPXULEtvx6ftZH7Wpbc3ihVl5279JGg2HO5lxTzRW61yzopwcxH6b56DU1EoUdSiLuSmBqAV9BGQLN0KK+mUYM+0cwtGIinrYq8rJ/kVGnzSiBO1TJpgO083DoZP7dsxVzv78= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568712; c=relaxed/simple; bh=ELE6/E7HccXbM89haD8jxqL/F0Q13DuUMNnMP95XilU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e0KUiUe4qWkhq/aed1rpZMoureQhkAktH+CS4PLXUXy+YxJYc/vdIavXDDQnMb9TdvJGhDQDYppZ9M+fal9e2B9wZYdNhG05+p4oHDjuESBEg/8gvpjEQF1cNkeLtWCFeAusNEqrDnI7GKIYt1CwA9qfFeZezJlqxfCgPG7La2o= 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.43 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-f43.google.com with SMTP id a640c23a62f3a-ad88eb71eb5so767353666b.0; Tue, 10 Jun 2025 08:18:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749568708; x=1750173508; 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=vNJBJN8ruAzkE4jdoJqoCEdFnnUo4AIPbizdSl6cvmo=; b=Mn5mVGlWH9kkjMRdrUYBgrtct6Z2mtrygiWYZEt9qdNcs1wyxfWgZ1FdiwAmdpZ5Lx 2meceLEDp1QFiaXYiDVhG3AKfIORzHc6RIvFYnWlR9RJITnD//wG5cwo81acjFWdRAUu M8Hd0ri/vb4mTEQnAUF/x5PzPKDNrvJUOgZIvMpIbZ1vCvSA4Lje0KFJWBhSJFTImuV0 rx1eCKswh5Af1QvwEeJe/uGW9eyixzPpnu8C6HNRu0X48DVbKVlZAHVlKSMkH/TsJ+HD 6UtswXI92fr1irYKKiPXHbeYg0X6V68FElxiSv7Frb8g8uye7Mjvc09R3w9tJirNz/Bv ZRCw== X-Forwarded-Encrypted: i=1; AJvYcCU/moSMdixBLXxgcWOE5vqRNpJ7PgyXB9tYOhhn4BrC3cVgM+O44DMzrii90rTtjterJ+jn8PozIDEtrMI=@vger.kernel.org, AJvYcCUVVQlZ+6DwobGqDCSc6Meg5WK+KK3fyWa71EXIRmrEyVE27nVZDPlWh37Q7DZX5AalFUTEeSukL8WAN5k9EUYs@vger.kernel.org X-Gm-Message-State: AOJu0YymYQCsMA3MAnkyDpH5NEB/zg+HqAV+k45k+JNVmcGgaqolwB88 FeaHoPqEL/oR+7ysW8L8BanFjZfe2Y3HpIg0LB1ziLkfEICHruPf885S X-Gm-Gg: ASbGncsFvzbMPjOGVpmsTXhYXMvCrKn6HLImXNM6zS65jvJPfdvoCh/SFXEAkIy1v3n Jd7usreNG1wEuWn8A7wraafhoWZQl2r1GWXjLx3jMkfB2///PHbSPeVD03tt/psCiLEIxwBCled bUlJEiC3EzcR2Rg2Zc1tGzKMC62yMeAdtcTVnYaV3hBtQtUQuc1XWl8OpNWFiNCM/w3ot4LXxc9 7dTUND6akmToB3ZBmv0+r5nXfTLV9lMLG6EG1j05gYL6Q1ACMvnXxMfvuW181MXGTFT7MW/pAxM 4P4rBBT/QVK6gfRZxQV0Z7KJA/O6x5Iii6S5ub6Ed/HBiuUOmPHH X-Google-Smtp-Source: AGHT+IH/bV9DJxyKz5+T6dTRQy4Sn0VEPk5y+gTzwBJWQDTFhmSBF8uQ0vi3o5o+0c6GJSjJItqjUw== X-Received: by 2002:a17:906:dc95:b0:adb:469d:221f with SMTP id a640c23a62f3a-ade7acdf3b3mr309023766b.31.1749568708195; Tue, 10 Jun 2025 08:18:28 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:7::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc1c676sm747742666b.105.2025.06.10.08.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 08:18:27 -0700 (PDT) From: Breno Leitao Date: Tue, 10 Jun 2025 08:18:15 -0700 Subject: [PATCH net-next 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: <20250610-rework-v1-3-7cfde283f246@debian.org> References: <20250610-rework-v1-0-7cfde283f246@debian.org> In-Reply-To: <20250610-rework-v1-0-7cfde283f246@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=ELE6/E7HccXbM89haD8jxqL/F0Q13DuUMNnMP95XilU=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSEy+MkOFwNSv1yN5uCINM0P8BOJ/1wbKCYvRq lufpo0WBFKJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEhMvgAKCRA1o5Of/Hh3 bZVeEACkftbYtve5Qa8RKaWKwGyfomqoPuGcKb9Zr065TkDg8msJ5F5/a9f3XdNaBLLLKBLbnOZ CaV8JmFo2BBZv0t4sW7ilRC7vysJYUNm4VcLgIj3XKdLJz7jO/Zzyd6W9W5utgJOXpPd+ntk6eq uMcDIqhnp/DfjjcZhBD4Y8qJakOEjUMy19bBXH1SSPsochCbD8e9RNjblNG1q3T8DvCUFHoXzHg /OAUXzHjg+tEN+L3G/cPwTYCFq1p5h/cTIYsxRSLGElvZComk7YONpY0mZGNR5szP3kuROWOrE7 NCi2/GBXlmx/qmHcB5weQzrpwCe3mCOfPDYVAUU1rwtAMKmD58QHmZLi/PKv1B8n/rS0ZL/jed+ Yl4ik3zZ6Dx07JFwuXx5WrqLBl50MfEHHWpWjdiU+JCGxLSaxLbpzDfb9upyqOpQLk7aYg6G05d qO7FuMlwe86SRFfm5CTXSSBx4uF8PuhdUAA++KI+wJE0GF2pR9nh02xnk8fP2JhRE6DtKjnQi9x SGALidFLHgnd+iFrkenH8Fo27r2TdWqzdNMNfz+EwwxwqRorpabX4DB/IudjlPCdX7GMBPS1CW3 bKvz3LTchmw1yiEwU2QlXtBTR75KKBoIn+V6E1RtyC6+mS/1lIeFJXNyXTQESSiuyV6ua8hNCJ1 yrQbP2n9PbsFHKQ== 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 4289ccd3e41bf..07424ae4943d7 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -1614,6 +1614,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 12:15:10 2025 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.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 82A3E2417FA; Tue, 10 Jun 2025 15:18:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568713; cv=none; b=qUo35FLeEUrLUQCsdhkQTSnXHa9rZ8rOpqQGZGAHrqb/FKlvrA6XtNqPwHmdEFyW0KkYIm/LLnomJ13c1rtlFkaoYl5dXCdvouAcydfWdptqb7MoSTiNn4tfNQeOuHge8Cc4hULomGgwvObxzf98ouqwTo+2lFTQdvu1b9G+r2Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568713; c=relaxed/simple; bh=r2O8/+01a6kXz62r/eNtYlumzp/QwLzjW+M3wmiEa5A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N12DQnOhtMrriTlTO8WG7UqIf0vgmr1dc9R3n5qyFhm369lm1yeHDSXBDIeKghB2tb+Ekd/gYi4kjucN1d9PVq8f3u/jcOyEgISpWC4C3Xa5qpknoYFuvjCwZmUHYjatA0wQgrI+v/C6m/7qw9LdeDr4yfXF0U7Wb+jMART6sfA= 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.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-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-606ddbda275so10257550a12.1; Tue, 10 Jun 2025 08:18:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749568710; x=1750173510; 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=Wsg2kGUHoFjE6B+vxs4Ti6GqKpJ6HFVNeSy/lG/YiIo=; b=AZR+RCBhTjovRf00b+HBGfRjmSXPwIR7xijtsDQ1i4u4VuY+megBgMsTuk7znIPbH4 NplkZGcrNtWi7//N14xhUeyq/1CH/KEPOxaMeO5JVgwF8mg3Os34lpL3OkHtGx/qKpPX mwSSmtdIaoBTdTkLjq2HzrTjqP2lB5KSUdLEA9JQMK5s1QpYrczVxea3bCcjVr/nmuzp muqeVY9WmpJfa3wRGTfPzIV9HsieSmpGZDC0wmkI9sCYaLprergH43ochN8rNG7hERxu n8nU56o3SLMrmDY1c7YTIes0s9BQS/P64B3xOyb/ZCcfFvwwyHncNC0Kr46c2euKz5Ea cQjw== X-Forwarded-Encrypted: i=1; AJvYcCX5T3vibmirc+KU5dL3KotYoZ2rUq2Xj/lqES8xLzbIsyulsMHj3pfgFDSRozJd0yEpQ7g4bCoM0h+8uDQ=@vger.kernel.org, AJvYcCXnJGfnjZgO0vk0K/eV4jGzBAnx2y+szAglXnbExO3Z6jIHV5vERBf9mGZtB/SKSRJy0bj9Cn0fJcKsKL8B/xi7@vger.kernel.org X-Gm-Message-State: AOJu0YxMNayzV7B2Njk/4LpsvFqjt32tojtOFM+q08gpMmFqJ5GBIqbT 9AU5Qlc3V9KmYtADVVjNOgj8EaopzbMpCK8NN+/ce5siMECyhHQ1tKCj X-Gm-Gg: ASbGncvYx1UBtJuQkOhJI1onhizHO6lcBMLqtsxJ6VRvEBBFWPZqWpgeJ/VsZaXzC/3 WinRX/5XRxXt9c4OIMgITHkUbS9w62/5wAPKKmui2IAoTg4cdFg+t8cJkhKijrYn6XUvgqf+F3y N8VG8bYe4WXXHKtVbopoFP7LVCKHbslqBTfusSlY55sWwTKc1aia9z7KktEP4Q92ES/04BX7DiR L0TFbpnP/Q7JeENKp6ReUlYz6vG0hwmsMGLsNZSvOQ+NJiopNPsJ711cHAD1dgDvl9weji19SSG fsmZG1XxhvdnCLF+9aqRDm9ehsCrsjNWR3W+S9NtFvbueyVSpW1k X-Google-Smtp-Source: AGHT+IE01H2VJzfwk1HF+AmCT+4+vQlEfXzYxIXaP4lI+VyRSq7rBaxTyCXLBQGJjHydYzzkOwi3Cg== X-Received: by 2002:a05:6402:34c8:b0:602:346b:1509 with SMTP id 4fb4d7f45d1cf-6077351388emr14409988a12.9.1749568709713; Tue, 10 Jun 2025 08:18:29 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:8::]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-607f162352asm2925389a12.71.2025.06.10.08.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 08:18:29 -0700 (PDT) From: Breno Leitao Date: Tue, 10 Jun 2025 08:18:16 -0700 Subject: [PATCH net-next 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: <20250610-rework-v1-4-7cfde283f246@debian.org> References: <20250610-rework-v1-0-7cfde283f246@debian.org> In-Reply-To: <20250610-rework-v1-0-7cfde283f246@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=r2O8/+01a6kXz62r/eNtYlumzp/QwLzjW+M3wmiEa5A=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSEy+Z5mWouBpT45Ksw77SzERNAdeUKmi11FFY iZR4Pfb8IuJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEhMvgAKCRA1o5Of/Hh3 bb5sEACIETr3C5O3Y6X7Or98khZoQczSvYoR8VAzHIcdllIgHFgX+j60Z7WQ5+QcbBZDR+yskuC hfVBWf7m/OQvXpVOeG2eTjDEVERlEKJ/SkkB7sq7Tku6+iIGUdmjs2U02KsS8nb+wrZj7CUiK+/ KQw2KtzIvxT1RP9t9yIELU6K+r+NSjDDesFokF6nbXHXnskWvanneQMn2EBDzwO/fbsLXvHO601 E42CNzbYzKFu3+TqO2l2bOYj/84Jp8NawMdgUs9u1FAuBwVcT8K3XcqrkK3QPT/oCyAIVSk2cUr teqnzJYNwIUFJUG3MFySRCsPPrZqW0CIcwHB1IyFCB4ab/L150ugrukarVfN7uDuUGSIqi7G7nS DAdSrkpvm8yqpMmZKyYKOz0uxVSDBbau//WDdFONH60td+mWV7WT0RqBZ91j3ekIoEovSknEdbv r2y00pFJDJGfru6JqQx8pTKvXSmdvAmJ7kbX2tVZ/ZieYMxK79Ty6K9GVVuvfMtGbc22RMZ2ywB MadCrcUIejb3g7+iiqcMssf2jxNzVFX8Nd99Qmt50nTdLBdRXI+R8OB9D9zjkPdtX3G7Q4cj95B TMx57GOh4H8wArsz8Xmkey7BBhW5Eo9p/HddHqeBFvOnT3sQmGUBhgJeWVpe/SVoaGzhbZDvWwR JFNlta3NbQmNDvA== 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 07424ae4943d7..18e482b28c427 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -273,6 +273,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 12:15:10 2025 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 EB6B42459D5; Tue, 10 Jun 2025 15:18:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568716; cv=none; b=mjLBr+HcZivdai6tOh1nU08WMsdYy5l6lvb/Ac0KX/GBq2MG1e6ic/LSLMHJQVLDxLi4Uu51BIkCrS6GgJuevTqjxqT17o8dt7cOJFbvI2bLuRmFK0ByjjnAb8AOPzJZrBxkJ/UhoQDhgPK59GL5ybQkrqXWxmSL0baJDdOKzW4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568716; c=relaxed/simple; bh=gL4hophrvKavJhtc5bA24dntNiRgjnALWCf3bYiRI2I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y26Vzhj9Vk6J9Ifjad/MgjQ8FqPAlE5rh5J6xK75qlHCdADCvTTPPt/8+Q/2Ff10ySnNkBF1YIODjSKrXMQQqOBbWGXEMjJbT5eKitNRR/nQxqIgsrJ+tlnpL4byApgHMRlxp7D7zupYdwzAK3uCr3GUW+S0l7LLUSQYNqExhCo= 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.42 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-f42.google.com with SMTP id a640c23a62f3a-ad89c32a7b5so903848066b.2; Tue, 10 Jun 2025 08:18:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749568711; x=1750173511; 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=2gmL5b01iheNder2mMcUL/fkMuF1KCU61E/Tx/JVdTs=; b=BS0MFPgZt79Bplyvnr4UmukmW2u9ZGJIPo/5JOtcTt3Wq9+ujsFi+F+U3SDiKavLwd LOszdMYzjlShxA+IzyeTZ4nngnorcmjKJiS4n5LuX66bKnIem6pDHB4thQH5kgHPUlho XKIg0fQSUP7EbNvPwbszUvqI2/1lvkqe9V9wOjOAaKB05+O3VUrekD2L5UaOocq0s4uG eaf8lzjXIXKMPHDf38l71tUMaR9VdlQQxqHlFg3VV6F1OzHiQQalH3zASmHDXbuSiE8B J+8h0KiG3ombLo6rLa3bjpDnCvW/RCSGkKdl6kh9/caCS6qXU+DEs4ZZM1e75fuNXmXw x0zw== X-Forwarded-Encrypted: i=1; AJvYcCV81+pmHBTNMLMqWmCENSCMYMMhNpHGXxgXDf1F02H5EZzY7DbotameLEF1NsGP195KKT3S9DfiiNRTbDVS22Eu@vger.kernel.org, AJvYcCVDihL664gmXrM0eF/Ipr2zJ0yinin91EvM38upalHe8WqsofOPTh8x3NOpjqvLRPYpnnlS6gwgkkaTlws=@vger.kernel.org X-Gm-Message-State: AOJu0YwNrzNmA35cq0v3NSj62unqyBAu5fD9p9BhbcAHXu6MQFFzS2Fo ClQEhqvHMhxGyOh26wTUVEkhlaYH7QeBjsQxPn0KwVb1yWPtXTf8XbtS X-Gm-Gg: ASbGncsu1E9deNcMX3XX/pyVoxjAqoMV1QKd25F6M+oLoevAZP26eEZ+lICo/FnAG8C SW1iVuEOt4ETSwudTBkgURO+ggigjINvfG6/FAgKEy59DyhDrz7AqS9VvQpTowTrFciq+Mn/sdW KpGBR8Qn7GuDq2kzJCfj5HcPo7P+HZhIaE+CMbAaFA7HjP942eqqK6DgEQWdPSqxDDMKQiJ3K3A tyT8+Zlr2vLCJU518VbulS0wv+8ghJU9MaC6V/qbNyts6evFpew1yWMVBWKdI80PVkt5g6Tskve dTPis1UTnouCPU976HK6tXvWpcO7V7Vt+8MYPdDuPzC+ijDctjxOcwqgXpzKQWM= X-Google-Smtp-Source: AGHT+IHdOUJIPUOAH8GhZMUmgA1NBxkzIOpLVyPmpU3W+vxCtSe0xVNvtd9kQwK9DiCOhkAVMeMiCA== X-Received: by 2002:a17:906:6046:b0:ad2:1cd6:aacf with SMTP id a640c23a62f3a-ade7acf8d25mr196119266b.47.1749568711105; Tue, 10 Jun 2025 08:18:31 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:2::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc38a11sm732113366b.116.2025.06.10.08.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 08:18:30 -0700 (PDT) From: Breno Leitao Date: Tue, 10 Jun 2025 08:18:17 -0700 Subject: [PATCH net-next 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: <20250610-rework-v1-5-7cfde283f246@debian.org> References: <20250610-rework-v1-0-7cfde283f246@debian.org> In-Reply-To: <20250610-rework-v1-0-7cfde283f246@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=2497; i=leitao@debian.org; h=from:subject:message-id; bh=gL4hophrvKavJhtc5bA24dntNiRgjnALWCf3bYiRI2I=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSEy+7ccCAtyZ/tmWV+GeHkvJ5w7X0jl63ezZE /ftBC+40/KJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEhMvgAKCRA1o5Of/Hh3 bfTqEACP91poOQiPw80BuXyVC6pQD8B4jrgZxr3w5b459yBCrEbWwm5XfKGCNftnJgg/xRREXSG i0bXjLzP3BhO89N/JPCLnq4nktZQ2QBaLhUY9otWUVuCLWKcUhJhucl9lS4SAxtOo+kSKz9BfJ9 VLTeG9vRL1ynqNs4L/a61AhptT2xq8Yyeq03k5T3kF3544coO3HLgBM0YuHf1/f9A30jECwxLJ5 yK/Av+yg92rmjpsR0E2gyUck7tp2qtqXtfc2RP6mm4BWY2yCD4JfpZXGGzRj3BpzxHuWulwrWaG v4K+FvOd3ducJRVWcsRt9h/bYXxQWNkrUyL7pxzZ4K4ewGuJYsw4/mshhm0UpXGO9FaVWmaTuf1 ndkQM/9HkQ2Dzn9wE19bCYfmLhyIFNn61ulRt1fjiKwMKlA5x5EBqpP9uyez/7ukUf2DbX5qY9j 47lWqakPImY3kCQq+hBP2Mm3vQj2PpXcTfQ/wClunpXKHqMgpZ6b95GaUioku9Al9dLGVNlQObw 175E//4CkzgMM3DlS91zBN9osNJlp0FZYPsmuSSVFNQ5XSs9vzTI3XEecjnz1bA9iMKMD6AI6Xr 7yoYDzAZddKIjue297zsEYCrbIJMfAo7gycmU2BZfWMa3b2ynm7X1oKyim3XalsTrhkCoXnynWL vDRjy0hADoqo8Tg== 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 18e482b28c427..3406a5cbdc11a 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -273,7 +273,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) @@ -509,10 +509,10 @@ static ssize_t enabled_store(struct config_item *item, register_console(&netconsole_ext); =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) @@ -1651,11 +1651,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) @@ -1730,7 +1731,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 @@ -1768,7 +1769,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 12:15:10 2025 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 5A6AA246770; Tue, 10 Jun 2025 15:18:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568716; cv=none; b=IsuzybRcfFr1mKdfHVkCuSI5Zr0wIy3qzuOYByJZf7o1uh0Yx71x98uAaNYbD8oP83NEaTFV1frl/l1+IAd/fw0ZuRFGqbdk2HkeOyrw7TVtwuv/WuXULhp5l+Gcz7cZxoHfZOqtnYC+AYdAtCpErCEL//CRPReysu0OBNnFkZ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568716; c=relaxed/simple; bh=EFQnMbuoE7wGo8TFaGGcNNF0Xsjmk7DiwkC5gz6Bm6o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qAVuXU6O7EoguTGOzYu5SAB7hSGQjrihmRTXdCq7LK7XJLTngcPBhCqFQLkG775CqAgJU5sbpmwI0y2JpXCLFBgpz5yZEhYPVTWd5Rs5dYXM2ykfFmVY9GJX8VoKjaWdwkAfvf+gOgYwmU5x/Fu7TmwWOxXjVeqP8U5sOQFI/xI= 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.44 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-f44.google.com with SMTP id 4fb4d7f45d1cf-60780d74c8cso6997349a12.2; Tue, 10 Jun 2025 08:18:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749568713; x=1750173513; 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=MFOyEeCTQwX/1iCWq4y06MO74LLbRFJPgwC7bFpkrFw=; b=Ly9MS9PQFGcs/lPO9ywn8yc3HD9JXCHkxkrfscrNffqXryXe1LBIkoLtLAD0Nz3WuK uZ4MHv5i+3QL2akfvSLzIsi3JL5OkgLSdjCaXzG3emroPCxGaJKkrZ5kK+MrKh4PJsnk eM72eAcvSemURfSpNpcRc5hOgLAjtUqFUGjXfWsysXlz42kGxgEiDLj5cRY/kwBy8LCq Qz+2lRMkd++LbtXA6pk9eS+XC0opMeeIuWJ4o3WaR378b7jwVSR121ukeuB7XWBrISmx erKWXlQpDda4sV0G4UptKZZixqhclLGB6+P40Z6BGKVjus4IUzPnImCdhDSy8neq6qXj G5Ng== X-Forwarded-Encrypted: i=1; AJvYcCUnq0vPcsYqfNXVD23Qy8dXJ3bCdILfFbhvBjVM23FyHpiXRJ5zpm5TI3acefxU/js1si0IP9W1mUjv2oM=@vger.kernel.org, AJvYcCXfgNghS2sfHRTOLZ3Piyg7PjaB32nIsr6TvVoVvrvOXkV3nzJ3hR6LlWFMalI22eNvbp9Bpm4n4/Fx4SKXMIvZ@vger.kernel.org X-Gm-Message-State: AOJu0Yx8JxsKxQOuxO7RAHfmJRQE22qyi3eKX6z/m8bim0XlI12PDPP1 Io1QQrW9N2Z5ssDn9zY4kMPF3NusxVtz9g+l/HujSzsqXsykWaiDxAf/ X-Gm-Gg: ASbGncuNdYfi/FcOua5xW/0h0Q99ZOt+3hvbQiO8wkn1pxNO6ucWucD/hh3GzFFSl9b 2b4pVL4Dt7z7dhTkCo4sXCyiAlEZoSQSqSui1IM923XsrAvlfg3x+B7PQ+zoIsv5qaVHJoWNOud mtNZd2q2OHsbqZTieXy8SMClbxn7UZFIslYh7b1GQf5HVRk56ZISmYSk9PWlJnMvBmo343dQBKt 8SWU+8Nmy4n9REc9IJIoHz9oXifgWAfB4XMVl3GzntSg8gCR8RtHiMIwwG03hCqSZlnA5hg9gxi qQRE2d5T6vr1EZ0Z9/XP6sMUbtjvUGcXaqApaB0JLoExz01dXr+nTQ== X-Google-Smtp-Source: AGHT+IHlrZMS4vkl2I6tfIJnHV3TX6eJQigH+Q4Qbu7WiRpFW30GdN/QKBdmn1yS98LHb8s7NYcg0Q== X-Received: by 2002:a17:907:60d0:b0:ad8:50c3:3359 with SMTP id a640c23a62f3a-ade1a8da8ecmr1492684166b.9.1749568712542; Tue, 10 Jun 2025 08:18:32 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:73::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade1dc7b252sm728930466b.159.2025.06.10.08.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 08:18:32 -0700 (PDT) From: Breno Leitao Date: Tue, 10 Jun 2025 08:18:18 -0700 Subject: [PATCH net-next 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: <20250610-rework-v1-6-7cfde283f246@debian.org> References: <20250610-rework-v1-0-7cfde283f246@debian.org> In-Reply-To: <20250610-rework-v1-0-7cfde283f246@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=EFQnMbuoE7wGo8TFaGGcNNF0Xsjmk7DiwkC5gz6Bm6o=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSEy+Vvhsfjp96VTvHkkdYeA2w+WaqLInfIIfh WOjTbcE9CeJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEhMvgAKCRA1o5Of/Hh3 bWKeD/48dsHypmbqd/qrkPlpBLopWHhErhxInd8ABD7ly7MSggoCNyX0BLXgeLzQKpWeBw1XalT mOGJnkL1+Hu1Y/RsCNBZ25T3D9YVNODlGKzAG/LeN5RX9CwL3xwLd6cv6MmzU7P778ISs3fNnAT DORXM7xQNUyUxwQTE8uIOwUbaiSqLYhylnJKz5DadOB6mTmjeoMM0yR4YM1VW1djW9Gu53O2f16 DMQDlpjVHZivGSPxVV4WGhQeVDm+WjIXNqHNMI+8Hhc53CitlmJjEGEDl+yTl6tUZ5TBGq/TMvu oiCF+gARpnzdQLTUNriLF8rw5i37yvOerepbIdGxljg7bwUEdsZgI7PH0nf+lozqV8rrGJoEKU8 ErPML/Q5Us4N8Y7tSB/N8l6F/xW+r4VNuVHMlF9wqhXMz6WqRkjWRpF45L5tMZNaRyHrAM8uMcT mznoeLSzjWSGXSjfMBWCsjclo3s4+QRo4uOZhjG5CLElcWoMdXexwKt7jflQZ8j7D9m0rKjyPU6 2cuk9Rv29+ZW1YiDPkDHdzAqMgLbMUzeAuF57+MxPnR7ORUtf5doEQIMv+iFB1sBJTIG9vj61BK JE14VsNV8kkbBgOoSCHVMolYjqI5KRaM9//YmMjj2dfbABV8gpqtuLzwCTxH8pxkKEm5ZKCTUDz oba3warVX6rLINA== 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 3406a5cbdc11a..2a13b6f16f082 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -1659,7 +1659,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)) @@ -1670,7 +1671,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); @@ -1684,7 +1686,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 @@ -1701,7 +1704,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') @@ -1713,7 +1717,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 12:15:10 2025 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.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 D7BEB24728D; Tue, 10 Jun 2025 15:18:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568718; cv=none; b=PQmK8kTBiipNKAzAxz0PPUBxiUdWjlWy0xSVY1t7QDa/VsR7FuV85Y3CoQpX+j7tNgJQdYyCFYGNd5vxvZB32tjD8kBsch4jr964CshO3toI5v9wG3OP2jmrLT/TMUfDLxPbi5/J6kTH/v9TVXMLcxX6yNpkf4iad+4Ud4Sd8Zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749568718; c=relaxed/simple; bh=hPZb8Nw1IuP4F5I5h55bS2jnLuizM8vNJnpbTBELM00=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BVdZTLkxRWaOMUzQXox5b4sJcHbjk871Lr2RuQ0a361C0ZGNHDYDOCInQ0ZsPK02prxzTmEuQLWpAARlREkQgI767dpvuSVPwi8NBahNn9lwrg8UntqdX1r09XqtVxd93IH4gCqYVNtICYSphsq764BZGTB6p0ot8pSCQWDTARo= 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.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-ej1-f47.google.com with SMTP id a640c23a62f3a-ade750971f2so161084766b.2; Tue, 10 Jun 2025 08:18:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749568714; x=1750173514; 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=o4cUGNOuwVhN2a6Wgm+mSMUHrtnStHJlUP7RSdOBQSk=; b=JUHQTPU9AdWV9bll2T4hiBazUjnwsBWoQBM1FjNayF0zuWUGeRKfItRFEzstFpT9ZC EMvnDI5dfqLr7yy5mEkZGR7dsrXBP8NS42175IhcWjCNg/enZtoBOP/djABvbxbSwhIM UksMB2vqSpsJP/kF3jcA0Susxvy0h5P0n7Y54dzOrhWptcDmZQE6lOFGv8SVknLgZnBc M1HBEs55Hg/nBSNj1yqxUy4yhReEKRkDIdNsGEu5N9YEIZyd6qdrV2fSGDsFrKLbz0pR ObizNsjkFnFw6EG9O2Pbz+ZEfees5gmHDEFFG8P11hTLKMr6aV/WdGda6AYRCaJBHlYU pceg== X-Forwarded-Encrypted: i=1; AJvYcCVkCtkD3WzJt8xZzEbNgtARx5ya63BYxhP/UAloDruuoQwOoaqfELS6alDGJNTuNGUakDVI+E8Pn0UyS9yVOUwn@vger.kernel.org, AJvYcCWK0gmJtZjgzxtpKCqlD4yg78j2bD6u/uXhsjTkNealQVvLRPOWTTCAXFlhAFiPnnrdVhzeZuNl1n3wygg=@vger.kernel.org X-Gm-Message-State: AOJu0YxCLAYrg2FOVFh2imSyblhenwkiqMRPRboBkCo6A0E1i84/BJmZ GbEIRkgz9FYi1ZQIuoPJ5tRP2SN83ktTewtmNyQ6eaELTWaXWlQYJRf4 X-Gm-Gg: ASbGncv9aV/0JtIEgxY9CtdLS5JYA3ElIYPume4GEho+KT5XWz/UWJZ1C/RdskF7cg7 dVhup6fafY5BMurLwZ18muaZjLwB7hQhZc+PXmUok+2jK3UIFjz/hiMFRfa2LP0A/xB+DrOFwyb tiGp3vXBjNi0NcFlKwxYy04g3c24zM9I8PPgKbhBzFV83rcV8k4ZwxNZNvnTzmwKautHQosNWi7 6R3VatndKgKRMyNSjTznSrMkf1S5QTd0n5OZ3zKG0SxmfMUkq7trB6Qv8N5Tx2MZzF5fmXESBe+ vpuacJ0Lkno29PLs3VG+TG2aPNxia/IxaqoiK0LOF8GQd2wUAaCX X-Google-Smtp-Source: AGHT+IGnGBT0yDRCGFnwgDaFrKXCuG0tFdl0+Y1Fdv0DP0GXVyOqqGUFOA4ckLxv5IDPmagvLUYiHA== X-Received: by 2002:a17:906:dc8d:b0:adb:2a66:85bc with SMTP id a640c23a62f3a-ade1aab9e47mr1534646266b.34.1749568713962; Tue, 10 Jun 2025 08:18:33 -0700 (PDT) Received: from localhost ([2a03:2880:30ff:4::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ade343eeea1sm636189066b.74.2025.06.10.08.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 08:18:33 -0700 (PDT) From: Breno Leitao Date: Tue, 10 Jun 2025 08:18:19 -0700 Subject: [PATCH net-next 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: <20250610-rework-v1-7-7cfde283f246@debian.org> References: <20250610-rework-v1-0-7cfde283f246@debian.org> In-Reply-To: <20250610-rework-v1-0-7cfde283f246@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=6008; i=leitao@debian.org; h=from:subject:message-id; bh=hPZb8Nw1IuP4F5I5h55bS2jnLuizM8vNJnpbTBELM00=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBoSEy+3U7nbPd4IvWNtmUI4sfQZ5L151a93Wuxr tvLoIVsdAOJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaEhMvgAKCRA1o5Of/Hh3 bfesD/42YmOcr2cmcrcIOZwSGJU74Sar6s2sMqctjxrP8QLrUX9be54e0Q1CUgjM34edM2Xp6ub B34nc3c3m2m3BlImfwI9Dun9t87Q6qvGQjW93bCSE+c84vba7wLSwFOAQxnx1gG27UWtKHjlQhk 8g5v6KZVYBq242laRTWJfzFmiPl9Uo9jeIAjpluEwqVW0DUTM1eE2A1vu1zCIfHYFtV2u6VHfHC /ogoj4qd01IOKQLU1zlt/DoswSfgDToqzWmOI3yDPSbqmgK27gxiZsBAJEfUvM3WeewmTadLyem lqK+sSEzvAaf4/3Jy/S39DcQVsDaucDLiltNzoGhh7EyEvPGDk/4iqYOI019Skrk3NGjDsdAbHR vOSkgqiqDMHPYL4szbPYQeZO+CxsrANOn14W5gVph3Pti8+HVgcp1OL6wHaK2zdVn3a+F+diZYo Ss32/OGDHlJu40YRJczLaIRlRXcB44mOVIIMU36Kr9z6cmgxDnuPOjKisVIiboflgt+5wbQ9Grm nR0PXE9nhKtK1oasrcjOvuEUgLCXxy2VfrsbTv1G83I0L5216CabqGDVP+fJS2lkVa0kC8QIpzp 2EaC/NVAaB6iiXJSO91+EKzlm3EUBr03+rydbd/3pmkukPh+PHrlF7/ZucK7968OT/051il/Vll CWyPsrR3TkCxNsQ== 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 29b01b8e2215c..bacd98c7a9eb6 100644 --- a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh +++ b/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh @@ -109,6 +109,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 @@ -157,13 +168,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" - - # TMPFILENAME will contain something like: - # 6.11.1-0_fbk0_rc13_509_g30d75cea12f7,13,1822,115075213798,-;netconsole = selftest: netcons_gtJHM - # key=3Dvalue - # Check if the file exists if [ ! -f "$TMPFILENAME" ]; then echo "FAIL: File was not generated." >&2 @@ -175,6 +182,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 if ! grep -q "${USERDATA_KEY}=3D${USERDATA_VALUE}" "${TMPFILENAME}"; then echo "FAIL: ${USERDATA_KEY}=3D${USERDATA_VALUE} not found in ${TMPFILENA= ME}" >&2 @@ -246,3 +264,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