From: Jakub Kicinski <kuba@kernel.org>
To: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: netdev@vger.kernel.org, Doug Berger <opendmb@gmail.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>,
Antoine Tenart <atenart@kernel.org>,
Kuniyuki Iwashima <kuniyu@google.com>,
Yajun Deng <yajun.deng@linux.dev>,
linux-kernel@vger.kernel.org (open list)
Subject: Re: [PATCH net-next v3 1/2] net: ethernet: Allow disabling pause on panic
Date: Mon, 10 Nov 2025 17:10:36 -0800 [thread overview]
Message-ID: <20251110171036.733aa203@kernel.org> (raw)
In-Reply-To: <20251107002510.1678369-2-florian.fainelli@broadcom.com>
On Thu, 6 Nov 2025 16:25:09 -0800 Florian Fainelli wrote:
> Development devices on a lab network might be subject to kernel panics
> and if they have pause frame generation enabled, once the kernel panics,
> the Ethernet controller stops being serviced. This can create a flood of
> pause frames that certain switches are unable to handle resulting a
> completle paralysis of the network because they broadcast to other
> stations on that same network segment.
>
> To accomodate for such situation introduce a
> /sys/class/net/<device>/disable_pause_on_panic knob which will disable
> Ethernet pause frame generation upon kernel panic.
>
> Note that device driver wishing to make use of that feature need to
> implement ethtool_ops::set_pauseparam_panic to specifically deal with
> that atomic context.
Some basic review comments below (no promises if addressing those will
make me for one feel any warmer towards the concept).
> Documentation/ABI/testing/sysfs-class-net | 16 +++++
> include/linux/ethtool.h | 3 +
> include/linux/netdevice.h | 1 +
> net/core/net-sysfs.c | 39 +++++++++++
> net/ethernet/Makefile | 3 +-
> net/ethernet/pause_panic.c | 79 +++++++++++++++++++++++
panic.c or shutdown.c is probably a slightly better name,
more likely we'd add more code in that.
> 6 files changed, 140 insertions(+), 1 deletion(-)
> create mode 100644 net/ethernet/pause_panic.c
>
> diff --git a/Documentation/ABI/testing/sysfs-class-net b/Documentation/ABI/testing/sysfs-class-net
> index ebf21beba846..da0e4e862aca 100644
> --- a/Documentation/ABI/testing/sysfs-class-net
> +++ b/Documentation/ABI/testing/sysfs-class-net
> @@ -352,3 +352,19 @@ Description:
> 0 threaded mode disabled for this dev
> 1 threaded mode enabled for this dev
> == ==================================
> +
> +What: /sys/class/net/<iface>/disable_pause_on_panic
> +Date: Nov 2025
> +KernelVersion: 6.20
> +Contact: netdev@vger.kernel.org
> +Description:
> + Boolean value to control whether to disable pause frame
> + generation on panic. This is helpful in environments where
> + the link partner may incorrect respond to pause frames (e.g.:
> + improperly configured Ethernet switches)
> +
> + Possible values:
> + == =====================================================
> + 0 do not disable pause frame generation on kernel panic
> + 1 disable pause frame generation on kernel panic
> + == =====================================================
please no sysfs for something as niche as this feature
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index e808071dbb7d..2d4b07693745 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2441,6 +2441,7 @@ struct net_device {
> bool proto_down;
> bool irq_affinity_auto;
> bool rx_cpu_rmap_auto;
> + bool disable_pause_on_panic;
Warning: include/linux/netdevice.h:2567 struct member
'disable_pause_on_panic' not described in 'net_device'
> /* priv_flags_slow, ungrouped to save space */
> unsigned long see_all_hwtstamp_requests:1;
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/panic_notifier.h>
> +#include <linux/netdevice.h>
> +#include <linux/ethtool.h>
> +#include <linux/notifier.h>
> +#include <linux/if_ether.h>
> +#include <net/net_namespace.h>
Alphabetical sort, please.
> +/*
> + * Disable pause/flow control on a single Ethernet device.
> + */
> +static void disable_pause_on_device(struct net_device *dev)
> +{
> + const struct ethtool_ops *ops;
> +
> + /* Only proceed if this device has the flag enabled */
> + if (!READ_ONCE(dev->disable_pause_on_panic))
> + return;
> +
> + ops = dev->ethtool_ops;
> + if (!ops || !ops->set_pauseparam_panic)
> + return;
> +
> + /*
> + * In panic context, we're in atomic context and cannot sleep.
> + */
single-line comment would do?
> + ops->set_pauseparam_panic(dev);
> +}
--
pw-bot: cr
next prev parent reply other threads:[~2025-11-11 1:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 0:25 [PATCH net-next v3 0/2] Allow disabling pause frames on panic Florian Fainelli
2025-11-07 0:25 ` [PATCH net-next v3 1/2] net: ethernet: Allow disabling pause " Florian Fainelli
2025-11-11 1:10 ` Jakub Kicinski [this message]
2025-11-12 22:53 ` Florian Fainelli
2025-11-13 2:19 ` Jakub Kicinski
2025-11-07 0:25 ` [PATCH net-next v3 2/2] net: bcmgenet: Add support for set_pauseparam_panic Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251110171036.733aa203@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=atenart@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=horms@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=yajun.deng@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox