From: Peter Maydell <peter.maydell@linaro.org>
To: Jim Shu <jim.shu@sifive.com>
Cc: qemu-devel@nongnu.org,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Alistair Francis <alistair@alistair23.me>,
Jason Wang <jasowang@redhat.com>,
"open list:Xilinx Zynq" <qemu-arm@nongnu.org>
Subject: Re: [PATCH 4/4] hw/net: xilinx_axienet: Fix DMA RX IRQ if ethernet disable RX
Date: Mon, 29 Jul 2024 16:31:41 +0100 [thread overview]
Message-ID: <CAFEAcA_QmSdqTo4zmv=AKox2ZiJPt18vV4CwaLLp6VPLWBMcpA@mail.gmail.com> (raw)
In-Reply-To: <20240726055933.817-5-jim.shu@sifive.com>
On Fri, 26 Jul 2024 at 06:59, Jim Shu <jim.shu@sifive.com> wrote:
>
> When AXI ethernet RX is disabled, it shouldn't send packets to AXI DMA,
> which may let AXI DMA to send RX full IRQs. It is aligned with real AXI
> DMA/ethernet IP behavior in the FPGA.
>
> Also, now ethernet RX blocks the RX packets when it is disabled. It
> should send and clear the remaining RX packets when enabling it.
>
> Signed-off-by: Jim Shu <jim.shu@sifive.com>
> ---
> hw/net/xilinx_axienet.c | 71 ++++++++++++++++++++++++-----------------
> 1 file changed, 42 insertions(+), 29 deletions(-)
>
> diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
> index 05d41bd548..8428f10946 100644
> --- a/hw/net/xilinx_axienet.c
> +++ b/hw/net/xilinx_axienet.c
> @@ -530,6 +530,40 @@ static uint64_t enet_read(void *opaque, hwaddr addr, unsigned size)
> return r;
> }
>
> +static void axienet_eth_rx_notify(void *opaque)
> +{
> + XilinxAXIEnet *s = XILINX_AXI_ENET(opaque);
> +
> + /* If RX is disabled, don't trigger DMA to update RX desc and send IRQ */
> + if (!axienet_rx_enabled(s)) {
> + return;
> + }
This checks s->rcw[1] & RCW1_RX, and does nothing if it's not set...
> static void enet_write(void *opaque, hwaddr addr,
> uint64_t value, unsigned size)
> {
> @@ -546,6 +580,14 @@ static void enet_write(void *opaque, hwaddr addr,
> } else {
> qemu_flush_queued_packets(qemu_get_queue(s->nic));
> }
> +
> + /*
> + * When RX is enabled, check if any remaining data in rxmem
> + * and send them.
> + */
> + if ((addr & 1) && s->rcw[addr & 1] & RCW1_RX) {
> + axienet_eth_rx_notify(s);
> + }
...but at this callsite we open-code a check on RCW1_RX and
skip the call if it's not set. We don't need to check twice.
> break;
>
> case R_TC:
thanks
-- PMM
next prev parent reply other threads:[~2024-07-29 15:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 5:59 [PATCH 0/4] Several fixes of AXI-ethernet/DMA Jim Shu
2024-07-26 5:59 ` [PATCH 1/4] hw/dma: xilinx_axidma: Correct the txlen value in the descriptor Jim Shu
2024-07-26 5:59 ` [PATCH 2/4] hw/dma: xilinx_axidma: Send DMA error IRQ if any memory access is failed Jim Shu
2024-07-26 5:59 ` [PATCH 3/4] hw/dma: xilinx_axidma: Reset qemu_irq when DMA/Stream is reset Jim Shu
2024-07-29 15:23 ` Peter Maydell
2024-08-01 13:55 ` Jim Shu
2024-07-26 5:59 ` [PATCH 4/4] hw/net: xilinx_axienet: Fix DMA RX IRQ if ethernet disable RX Jim Shu
2024-07-29 15:31 ` Peter Maydell [this message]
2024-08-01 13:34 ` Jim Shu
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='CAFEAcA_QmSdqTo4zmv=AKox2ZiJPt18vV4CwaLLp6VPLWBMcpA@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=alistair@alistair23.me \
--cc=edgar.iglesias@gmail.com \
--cc=jasowang@redhat.com \
--cc=jim.shu@sifive.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).