From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
Sasha Levin <sashal@kernel.org>,
manivannan.sadhasivam@linaro.org, mailhol.vincent@wanadoo.fr,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux-can@vger.kernel.org,
netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 6.6 01/12] can: mcp251xfd: mcp251xfd_ring_init(): check TX-coalescing configuration
Date: Tue, 10 Sep 2024 13:22:43 -0400 [thread overview]
Message-ID: <20240910172301.2415973-1-sashal@kernel.org> (raw)
From: Marc Kleine-Budde <mkl@pengutronix.de>
[ Upstream commit ac2b81eb8b2d104033560daea886ee84531e3d0a ]
When changing the interface from CAN-CC to CAN-FD mode the old
coalescing parameters are re-used. This might cause problem, as the
configured parameters are too big for CAN-FD mode.
During testing an invalid TX coalescing configuration has been seen.
The problem should be been fixed in the previous patch, but add a
safeguard here to ensure that the number of TEF coalescing buffers (if
configured) is exactly the half of all TEF buffers.
Link: https://lore.kernel.org/all/20240805-mcp251xfd-fix-ringconfig-v1-2-72086f0ca5ee@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c
index 4cb79a4f2461..489d1439563a 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c
@@ -289,7 +289,7 @@ int mcp251xfd_ring_init(struct mcp251xfd_priv *priv)
const struct mcp251xfd_rx_ring *rx_ring;
u16 base = 0, ram_used;
u8 fifo_nr = 1;
- int i;
+ int err = 0, i;
netdev_reset_queue(priv->ndev);
@@ -385,10 +385,18 @@ int mcp251xfd_ring_init(struct mcp251xfd_priv *priv)
netdev_err(priv->ndev,
"Error during ring configuration, using more RAM (%u bytes) than available (%u bytes).\n",
ram_used, MCP251XFD_RAM_SIZE);
- return -ENOMEM;
+ err = -ENOMEM;
}
- return 0;
+ if (priv->tx_obj_num_coalesce_irq &&
+ priv->tx_obj_num_coalesce_irq * 2 != priv->tx->obj_num) {
+ netdev_err(priv->ndev,
+ "Error during ring configuration, number of TEF coalescing buffers (%u) must be half of TEF buffers (%u).\n",
+ priv->tx_obj_num_coalesce_irq, priv->tx->obj_num);
+ err = -EINVAL;
+ }
+
+ return err;
}
void mcp251xfd_ring_free(struct mcp251xfd_priv *priv)
--
2.43.0
next reply other threads:[~2024-09-10 17:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 17:22 Sasha Levin [this message]
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 02/12] ASoC: Intel: soc-acpi-cht: Make Lenovo Yoga Tab 3 X90F DMI match less strict Sasha Levin
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 03/12] ASoC: intel: fix module autoloading Sasha Levin
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 04/12] ASoC: google: " Sasha Levin
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 05/12] ASoC: tda7419: " Sasha Levin
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 06/12] ASoC: " Sasha Levin
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 07/12] spi: spidev: Add an entry for elgin,jg10309-01 Sasha Levin
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 08/12] ASoC: amd: yc: Add a quirk for MSI Bravo 17 (D7VEK) Sasha Levin
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 09/12] ALSA: hda: add HDMI codec ID for Intel PTL Sasha Levin
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 10/12] drm: komeda: Fix an issue related to normalized zpos Sasha Levin
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 11/12] spi: bcm63xx: Enable module autoloading Sasha Levin
2024-09-10 17:22 ` [PATCH AUTOSEL 6.6 12/12] smb: client: fix hang in wait_for_response() for negproto Sasha Levin
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=20240910172301.2415973-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
/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