* [PATCH net v5] net: xilinx: axienet: Fix IRQ coalescing packet count overflow
@ 2025-01-13 16:30 Sean Anderson
2025-01-13 16:36 ` Pandey, Radhey Shyam
2025-01-15 1:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Sean Anderson @ 2025-01-13 16:30 UTC (permalink / raw)
To: Radhey Shyam Pandey, Shannon Nelson, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev
Cc: linux-arm-kernel, Simon Horman, Michal Simek, linux-kernel,
Daniel Borkmann, Sean Anderson
If coalesce_count is greater than 255 it will not fit in the register and
will overflow. This can be reproduced by running
# ethtool -C ethX rx-frames 256
which will result in a timeout of 0us instead. Fix this by checking for
invalid values and reporting an error.
Fixes: 8a3b7a252dca ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver")
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
Changes in v5:
- Fix typo in commit message
Changes in v4:
- Fix checking rx twice instead of rx and tx
Changes in v3:
- Validate and reject instead of silently clamping
Changes in v2:
- Use FIELD_MAX to extract the max value from the mask
- Expand the commit message with an example on how to reproduce this
issue
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 0f4b02fe6f85..ae743991117c 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -2056,6 +2056,12 @@ axienet_ethtools_set_coalesce(struct net_device *ndev,
return -EBUSY;
}
+ if (ecoalesce->rx_max_coalesced_frames > 255 ||
+ ecoalesce->tx_max_coalesced_frames > 255) {
+ NL_SET_ERR_MSG(extack, "frames must be less than 256");
+ return -EINVAL;
+ }
+
if (ecoalesce->rx_max_coalesced_frames)
lp->coalesce_count_rx = ecoalesce->rx_max_coalesced_frames;
if (ecoalesce->rx_coalesce_usecs)
--
2.35.1.1320.gc452695387.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [PATCH net v5] net: xilinx: axienet: Fix IRQ coalescing packet count overflow
2025-01-13 16:30 [PATCH net v5] net: xilinx: axienet: Fix IRQ coalescing packet count overflow Sean Anderson
@ 2025-01-13 16:36 ` Pandey, Radhey Shyam
2025-01-15 1:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Pandey, Radhey Shyam @ 2025-01-13 16:36 UTC (permalink / raw)
To: Sean Anderson, Nelson, Shannon, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, Simon Horman, Simek, Michal,
linux-kernel@vger.kernel.org, Daniel Borkmann
> -----Original Message-----
> From: Sean Anderson <sean.anderson@linux.dev>
> Sent: Monday, January 13, 2025 10:00 PM
> To: Pandey, Radhey Shyam <radhey.shyam.pandey@amd.com>; Nelson, Shannon
> <Shannon.Nelson@amd.com>; David S . Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> Abeni <pabeni@redhat.com>; netdev@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org; Simon Horman <horms@kernel.org>;
> Simek, Michal <michal.simek@amd.com>; linux-kernel@vger.kernel.org; Daniel
> Borkmann <daniel@iogearbox.net>; Sean Anderson <sean.anderson@linux.dev>
> Subject: [PATCH net v5] net: xilinx: axienet: Fix IRQ coalescing packet count
> overflow
>
> If coalesce_count is greater than 255 it will not fit in the register and
> will overflow. This can be reproduced by running
>
> # ethtool -C ethX rx-frames 256
>
> which will result in a timeout of 0us instead. Fix this by checking for
> invalid values and reporting an error.
>
> Fixes: 8a3b7a252dca ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver")
> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Thanks!
> ---
>
> Changes in v5:
> - Fix typo in commit message
>
> Changes in v4:
> - Fix checking rx twice instead of rx and tx
>
> Changes in v3:
> - Validate and reject instead of silently clamping
>
> Changes in v2:
> - Use FIELD_MAX to extract the max value from the mask
> - Expand the commit message with an example on how to reproduce this
> issue
>
> drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 0f4b02fe6f85..ae743991117c 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -2056,6 +2056,12 @@ axienet_ethtools_set_coalesce(struct net_device *ndev,
> return -EBUSY;
> }
>
> + if (ecoalesce->rx_max_coalesced_frames > 255 ||
> + ecoalesce->tx_max_coalesced_frames > 255) {
> + NL_SET_ERR_MSG(extack, "frames must be less than 256");
> + return -EINVAL;
> + }
> +
> if (ecoalesce->rx_max_coalesced_frames)
> lp->coalesce_count_rx = ecoalesce->rx_max_coalesced_frames;
> if (ecoalesce->rx_coalesce_usecs)
> --
> 2.35.1.1320.gc452695387.dirty
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net v5] net: xilinx: axienet: Fix IRQ coalescing packet count overflow
2025-01-13 16:30 [PATCH net v5] net: xilinx: axienet: Fix IRQ coalescing packet count overflow Sean Anderson
2025-01-13 16:36 ` Pandey, Radhey Shyam
@ 2025-01-15 1:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-01-15 1:50 UTC (permalink / raw)
To: Sean Anderson
Cc: radhey.shyam.pandey, shannon.nelson, davem, edumazet, kuba,
pabeni, netdev, linux-arm-kernel, horms, michal.simek,
linux-kernel, daniel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 13 Jan 2025 11:30:00 -0500 you wrote:
> If coalesce_count is greater than 255 it will not fit in the register and
> will overflow. This can be reproduced by running
>
> # ethtool -C ethX rx-frames 256
>
> which will result in a timeout of 0us instead. Fix this by checking for
> invalid values and reporting an error.
>
> [...]
Here is the summary with links:
- [net,v5] net: xilinx: axienet: Fix IRQ coalescing packet count overflow
https://git.kernel.org/netdev/net/c/c17ff476f53a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-15 1:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-13 16:30 [PATCH net v5] net: xilinx: axienet: Fix IRQ coalescing packet count overflow Sean Anderson
2025-01-13 16:36 ` Pandey, Radhey Shyam
2025-01-15 1:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox