[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH v2 02/15] imx_fec: Refactor imx_eth_enable_rx()
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-arm] [PATCH v2 02/15] imx_fec: Refactor imx_eth_enable_rx() |
Date: |
Fri, 15 Dec 2017 07:06:25 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 12/14/2017 11:52 AM, Andrey Smirnov wrote:
> Refactor imx_eth_enable_rx() to have more meaningfull variable name
> than 'tmp' and to reduce number of logical negations done.
>
> 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
> Reviewed-by: Peter Maydell <address@hidden>
> Signed-off-by: Andrey Smirnov <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> hw/net/imx_fec.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
> index 88b4b049d7..8b2e4b8ffe 100644
> --- a/hw/net/imx_fec.c
> +++ b/hw/net/imx_fec.c
> @@ -536,19 +536,19 @@ static void imx_eth_do_tx(IMXFECState *s)
> static void imx_eth_enable_rx(IMXFECState *s)
> {
> IMXFECBufDesc bd;
> - bool tmp;
> + bool rx_ring_full;
>
> imx_fec_read_bd(&bd, s->rx_descriptor);
>
> - tmp = ((bd.flags & ENET_BD_E) != 0);
> + rx_ring_full = !(bd.flags & ENET_BD_E);
>
> - if (!tmp) {
> + if (rx_ring_full) {
> FEC_PRINTF("RX buffer full\n");
> } else if (!s->regs[ENET_RDAR]) {
> qemu_flush_queued_packets(qemu_get_queue(s->nic));
> }
>
> - s->regs[ENET_RDAR] = tmp ? ENET_RDAR_RDAR : 0;
> + s->regs[ENET_RDAR] = rx_ring_full ? 0 : ENET_RDAR_RDAR;
> }
>
> static void imx_eth_reset(DeviceState *d)
>
- [Qemu-arm] [PATCH v2 00/15] i.MX FEC and SD changes, Andrey Smirnov, 2017/12/14
- [Qemu-arm] [PATCH v2 02/15] imx_fec: Refactor imx_eth_enable_rx(), Andrey Smirnov, 2017/12/14
- Re: [Qemu-arm] [PATCH v2 02/15] imx_fec: Refactor imx_eth_enable_rx(),
Philippe Mathieu-Daudé <=
- [Qemu-arm] [PATCH v2 01/15] imx_fec: Do not link to netdev, Andrey Smirnov, 2017/12/14
- [Qemu-arm] [PATCH v2 03/15] imx_fec: Change queue flushing heuristics, Andrey Smirnov, 2017/12/14
- [Qemu-arm] [PATCH v2 04/15] imx_fec: Move Tx frame buffer away from the stack, Andrey Smirnov, 2017/12/14
- [Qemu-arm] [PATCH v2 05/15] imx_fec: Use ENET_FTRL to determine truncation length, Andrey Smirnov, 2017/12/14
- [Qemu-arm] [PATCH v2 06/15] imx_fec: Use MIN instead of explicit ternary operator, Andrey Smirnov, 2017/12/14
- [Qemu-arm] [PATCH v2 07/15] imx_fec: Emulate SHIFT16 in ENETx_RACC, Andrey Smirnov, 2017/12/14
- [Qemu-arm] [PATCH v2 08/15] imx_fec: Add support for multiple Tx DMA rings, Andrey Smirnov, 2017/12/14
- [Qemu-arm] [PATCH v2 10/15] imx_fec: Fix a typo in imx_enet_receive(), Andrey Smirnov, 2017/12/14