hw/net/can/xlnx-versal-canfd: Fix FIFO issues
authorDoug Brown <doug@schmorgal.com>
Fri, 13 Sep 2024 14:31:49 +0000 (15:31 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 13 Sep 2024 14:31:49 +0000 (15:31 +0100)
commitd4b668b799c5ce7ab7cc500707edff8af01ecf68
treeb323b43520abc86b8c204ebd8834c2ef313c7ef6
parent12d60ca09e5150b785d067566f49e330c68b2985
hw/net/can/xlnx-versal-canfd: Fix FIFO issues

The read index should not be changed when storing a new message into the
RX or TX FIFO. Changing it at this point will cause the reader to get
out of sync. The wrapping of the read index is already handled by the
pre-write functions for the FIFO status registers anyway.

Additionally, the calculation for wrapping the store index was off by
one, which caused new messages to be written to the wrong location in
the FIFO. This caused incorrect messages to be delivered.

Signed-off-by: Doug Brown <doug@schmorgal.com>
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
Message-id: 20240827034927.66659-8-doug@schmorgal.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/net/can/xlnx-versal-canfd.c