[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH v3 07/30] imx_fec: Add support for multiple Tx DMA
From: |
Peter Maydell |
Subject: |
Re: [Qemu-arm] [PATCH v3 07/30] imx_fec: Add support for multiple Tx DMA rings |
Date: |
Tue, 21 Nov 2017 17:44:28 +0000 |
On 6 November 2017 at 15:47, Andrey Smirnov <address@hidden> wrote:
> More recent version of the IP block support more than one Tx DMA ring,
> so add the code implementing that feature.
>
> Cc: Peter Maydell <address@hidden>
> Cc: Jason Wang <address@hidden>
> Cc: Philippe Mathieu-Daudé <address@hidden>
> Cc: address@hidden
> Cc: address@hidden
> Cc: address@hidden
> Signed-off-by: Andrey Smirnov <address@hidden>
> static const VMStateDescription vmstate_imx_eth = {
> .name = TYPE_IMX_FEC,
> - .version_id = 2,
> - .minimum_version_id = 2,
> + .version_id = 3,
> + .minimum_version_id = 3,
> .fields = (VMStateField[]) {
> VMSTATE_UINT32_ARRAY(regs, IMXFECState, ENET_MAX),
> VMSTATE_UINT32(rx_descriptor, IMXFECState),
> - VMSTATE_UINT32(tx_descriptor, IMXFECState),
> -
> + VMSTATE_UINT32_ARRAY(tx_descriptor, IMXFECState, ENET_TX_RING_NUM),
> + VMSTATE_UINT32(tx_ring_num, IMXFECState),
> VMSTATE_UINT32(phy_status, IMXFECState),
> VMSTATE_UINT32(phy_control, IMXFECState),
> VMSTATE_UINT32(phy_advertise, IMXFECState),
tx_ring_num is constant for any particular instantiation of the device,
so you don't need to put it in the vmstate.
It's pretty trivial to make this vmstate compatible with the old
ones for the existing single-tx-descriptor devices, so we might as well:
/* Versions of this device with more than one TX descriptor
* save the 2nd and 3rd descriptors in a subsection, to maintain
* migration compatibility with previous versions of the device
* that only supported a single descriptor.
*/
static bool txdescs_needed(void *opaque) {
IMXFECState *s = opaque;
return s->tx_ring_num > 1;
}
static const VMStateDescription vmstate_imx_eth_txdescs = {
.name = "imx.fec/txdescs",
.version_id = 1,
.minimum_version_id = 1,
.needed = txdescs_needed,
.fields = (VMStateField[]) {
VMSTATE_UINT32(tx_descriptor[1], IMXFECState),
VMSTATE_UINT32(tx_descriptor[2], IMXFECState),
VMSTATE_END_OF_LIST()
}
};
and then add this to the vmx_state_eth at the end:
.subsections = (const VMStateDescription*[]) {
&vmstate_imx_eth_txdescs,
NULL
}
Then you don't need to bump version_id/minimum_version_id on the
vmstate_imx_eth struct.
> @@ -791,6 +821,7 @@ static void imx_eth_write(void *opaque, hwaddr offset,
> uint64_t value,
> unsigned size)
> {
> IMXFECState *s = IMX_FEC(opaque);
> + const bool single_tx_ring = s->tx_ring_num != 3;
This looks odd -- I would have expected "single_tx_ring =
s->tx_ring_num == 1" ...
Otherwise
Reviewed-by: Peter Maydell <address@hidden>
thanks
-- PMM
- [Qemu-arm] [PATCH v3 04/30] imx_fec: Use ENET_FTRL to determine truncation length, (continued)
- [Qemu-arm] [PATCH v3 03/30] imx_fec: Change queue flushing heuristics, Andrey Smirnov, 2017/11/06
- [Qemu-arm] [PATCH v3 05/30] imx_fec: Use MIN instead of explicit ternary operator, Andrey Smirnov, 2017/11/06
- [Qemu-arm] [PATCH v3 08/30] imx_fec: Use correct length for packet size, Andrey Smirnov, 2017/11/06
- [Qemu-arm] [PATCH v3 07/30] imx_fec: Add support for multiple Tx DMA rings, Andrey Smirnov, 2017/11/06
- Re: [Qemu-arm] [PATCH v3 07/30] imx_fec: Add support for multiple Tx DMA rings,
Peter Maydell <=
- [Qemu-arm] [PATCH v3 06/30] imx_fec: Emulate SHIFT16 in ENETx_RACC, Andrey Smirnov, 2017/11/06
- [Qemu-arm] [PATCH v3 10/30] imx_fec: Reserve full 4K page for the register file, Andrey Smirnov, 2017/11/06
- [Qemu-arm] [PATCH v3 11/30] sdhci: Add i.MX specific subtype of SDHCI, Andrey Smirnov, 2017/11/06
[Qemu-arm] [PATCH v3 09/30] imx_fec: Fix a typo in imx_enet_receive(), Andrey Smirnov, 2017/11/06