From: Peter Maydell <peter.maydell@linaro.org>
To: Nabih Estefan <nabihestefan@google.com>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, kfting@nuvoton.com,
wuhaotsh@google.com, jasowang@redhat.com,
avi.fishman@nuvoton.com, kwliu@nuvoton.com,
tomer.maimon@nuvoton.com, Hila.Miranda-Kuzi@nuvoton.com
Subject: Re: [PATCH v12 08/10] hw/net: GMAC Rx Implementation
Date: Sat, 13 Jan 2024 12:27:27 +0000 [thread overview]
Message-ID: <CAFEAcA-iP01=MCOMntqHm-VdZGwO+w7Ba36s7qvZJsHTWWkCKA@mail.gmail.com> (raw)
In-Reply-To: <20240110234232.4116804-9-nabihestefan@google.com>
On Wed, 10 Jan 2024 at 23:42, Nabih Estefan <nabihestefan@google.com> wrote:
>
> From: Nabih Estefan Diaz <nabihestefan@google.com>
>
> - Implementation of Receive function for packets
> - Implementation for reading and writing from and to descriptors in
> memory for Rx
>
> When RX starts, we need to flush the queued packets so that they
> can be received by the GMAC device. Without this it won't work
> with TAP NIC device.
>
> When RX descriptor list is full, it returns a DMA_STATUS for software
> to handle it. But there's no way to indicate the software has
> handled all RX descriptors and the whole pipeline stalls.
>
> We do something similar to NPCM7XX EMC to handle this case.
>
> 1. Return packet size when RX descriptor is full, effectively
> dropping these packets in such a case.
> 2. When software clears RX descriptor full bit, continue receiving
> further packets by flushing QEMU packet queue.
>
> Added relevant trace-events
>
> +static int gmac_read_tx_desc(dma_addr_t addr, struct NPCMGMACTxDesc *desc)
> +{
> + if (dma_memory_read(&address_space_memory, addr, desc,
> + sizeof(*desc), MEMTXATTRS_UNSPECIFIED)) {
> + qemu_log_mask(LOG_GUEST_ERROR, "%s: Failed to read descriptor @ 0x%"
> + HWADDR_PRIx "\n", __func__, addr);
> + return -1;
> + }
> + desc->tdes0 = le32_to_cpu(desc->tdes0);
> + desc->tdes1 = le32_to_cpu(desc->tdes1);
> + desc->tdes2 = le32_to_cpu(desc->tdes2);
> + desc->tdes3 = le32_to_cpu(desc->tdes3);
> + return 0;
> +}
> +
> +static int gmac_write_tx_desc(dma_addr_t addr, struct NPCMGMACTxDesc *desc)
> +{
> + struct NPCMGMACTxDesc le_desc;
> + le_desc.tdes0 = cpu_to_le32(desc->tdes0);
> + le_desc.tdes1 = cpu_to_le32(desc->tdes1);
> + le_desc.tdes2 = cpu_to_le32(desc->tdes2);
> + le_desc.tdes3 = cpu_to_le32(desc->tdes3);
> + if (dma_memory_write(&address_space_memory, addr, &le_desc,
> + sizeof(le_desc), MEMTXATTRS_UNSPECIFIED)) {
> + qemu_log_mask(LOG_GUEST_ERROR, "%s: Failed to write descriptor @ 0x%"
> + HWADDR_PRIx "\n", __func__, addr);
> + return -1;
> + }
> + return 0;
> +}
The series doesn't compile at this point, because:
../../hw/net/npcm_gmac.c:238:12: error: unused function
'gmac_read_tx_desc' [-Werror,-Wunused-function]
static int gmac_read_tx_desc(dma_addr_t addr, struct NPCMGMACTxDesc *desc)
^
../../hw/net/npcm_gmac.c:253:12: error: unused function
'gmac_write_tx_desc' [-Werror,-Wunused-function]
static int gmac_write_tx_desc(dma_addr_t addr, struct NPCMGMACTxDesc *desc)
^
(this might be a clang-only warning).
The fix is to move these two function definitions into
the following patch, where we add the code that uses them.
-- PMM
next prev parent reply other threads:[~2024-01-13 12:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 23:42 [PATCH v12 00/10] Implementation of NPI Mailbox and GMAC Networking Module Nabih Estefan
2024-01-10 23:42 ` [PATCH v12 01/10] hw/misc: Add Nuvoton's PCI Mailbox Module Nabih Estefan
2024-01-13 12:27 ` Peter Maydell
2024-01-10 23:42 ` [PATCH v12 02/10] hw/arm: Add PCI mailbox module to Nuvoton SoC Nabih Estefan
2024-01-10 23:42 ` [PATCH v12 03/10] hw/misc: Add qtest for NPCM7xx PCI Mailbox Nabih Estefan
2024-01-13 12:27 ` Peter Maydell
2024-01-10 23:42 ` [PATCH v12 04/10] hw/net: Add NPCMXXX GMAC device Nabih Estefan
2024-01-13 12:27 ` Peter Maydell
2024-01-10 23:42 ` [PATCH v12 05/10] hw/arm: Add GMAC devices to NPCM7XX SoC Nabih Estefan
2024-01-10 23:42 ` [PATCH v12 06/10] tests/qtest: Creating qtest for GMAC Module Nabih Estefan
2024-01-10 23:42 ` [PATCH v12 07/10] include/hw/net: General GMAC Implementation Nabih Estefan
2024-01-10 23:42 ` [PATCH v12 08/10] hw/net: GMAC Rx Implementation Nabih Estefan
2024-01-13 12:27 ` Peter Maydell [this message]
2024-01-10 23:42 ` [PATCH v12 09/10] hw/net: GMAC Tx Implementation Nabih Estefan
2024-01-10 23:42 ` [PATCH v12 10/10] tests/qtest: Adding PCS Module test to GMAC Qtest Nabih Estefan
2024-01-13 12:27 ` [PATCH v12 00/10] Implementation of NPI Mailbox and GMAC Networking Module Peter Maydell
2024-01-18 12:20 ` Peter Maydell
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-iP01=MCOMntqHm-VdZGwO+w7Ba36s7qvZJsHTWWkCKA@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=Hila.Miranda-Kuzi@nuvoton.com \
--cc=avi.fishman@nuvoton.com \
--cc=jasowang@redhat.com \
--cc=kfting@nuvoton.com \
--cc=kwliu@nuvoton.com \
--cc=nabihestefan@google.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=tomer.maimon@nuvoton.com \
--cc=wuhaotsh@google.com \
/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).