[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 05/20] arm: add Faraday FTGMAC100 1Gbps ether
From: |
Paul Brook |
Subject: |
Re: [Qemu-devel] [PATCH v2 05/20] arm: add Faraday FTGMAC100 1Gbps ethernet support |
Date: |
Fri, 25 Jan 2013 23:18:32 +0000 |
User-agent: |
KMail/1.13.7 (Linux/3.7-trunk-amd64; KDE/4.8.4; x86_64; ; ) |
> In order to reduce the processing load of the host CPU, the FTGMAC100
> implements TCP, UDP, and IP V4 checksum generation and validation, and
> supports VLAN tagging.
I see no evidence of these features in the code.
> +static void ftgmac100_read_desc(hwaddr addr, void *desc)
> +{
> + int i;
> + uint32_t *p = desc;
> +
> + cpu_physical_memory_read(addr, desc, 16);
> +
> + for (i = 0; i < 16; i += 4) {
> + *p = le32_to_cpu(*p);
> + }
> +}
You're relying on the compiler choosing a particular bitfield and structure
layout. Don't do that. Especially when one of the fields is a void*. Clearly
never been tested on a 64-bit host. "void *desc" is just plain lazy.
> + buf = s->txbuff.buf + s->txbuff.len;
> + cpu_physical_memory_read(txd.buf, (uint8_t *)buf, txd.len);
Buffer overflow. In at least two differnt ways.
> + if (!(s->maccr & MACCR_HT_MULTI_EN)) {
> + printf("[qemu] ftgmac100_receive: mcst filtered\n");
> + return -1;
Looks like stray debug code. Several other occurences.
> + case REG_TXPD:
> + case REG_HPTXPD:
> + qemu_mod_timer(s->qtimer, qemu_get_clock_ns(vm_clock) + 1);
Using a timer here is wrong. Either you should transmit immediately, or you
should wait for something else to happen. Delaying by 1ns is never the right
answer.
Paul
- Re: [Qemu-devel] [PATCH v2 01/20] arm: add Faraday a36x SoC platform support, (continued)
- [Qemu-devel] [PATCH v2 03/20] arm: add Faraday FTAPBBRG020 APB DMA support, Kuo-Jung Su, 2013/01/25
- [Qemu-devel] [PATCH v2 02/20] arm: add Faraday FUSBH200 EHCI controller, Kuo-Jung Su, 2013/01/25
- [Qemu-devel] [PATCH v2 04/20] arm: add Faraday FTDMAC020 AHB DMA support, Kuo-Jung Su, 2013/01/25
- [Qemu-devel] [PATCH v2 05/20] arm: add Faraday FTGMAC100 1Gbps ethernet support, Kuo-Jung Su, 2013/01/25
- Re: [Qemu-devel] [PATCH v2 05/20] arm: add Faraday FTGMAC100 1Gbps ethernet support,
Paul Brook <=
- [Qemu-devel] [PATCH v2 06/20] arm: add Faraday FTMAC110 10/100Mbps ethernet support, Kuo-Jung Su, 2013/01/25
- [Qemu-devel] [PATCH v2 07/20] arm: add Faraday FTI2C010 I2C controller support, Kuo-Jung Su, 2013/01/25
- [Qemu-devel] [PATCH v2 09/20] arm: add Faraday FTNANDC021 nand flash controller support, Kuo-Jung Su, 2013/01/25
- [Qemu-devel] [PATCH v2 08/20] arm: add Faraday FTLCDC200 LCD controller support, Kuo-Jung Su, 2013/01/25
- [Qemu-devel] [PATCH v2 10/20] arm: add Faraday FTSDC010 MMC/SD controller support, Kuo-Jung Su, 2013/01/25
- [Qemu-devel] [PATCH v2 11/20] arm: add Faraday FTTSC010 touchscreen controller support, Kuo-Jung Su, 2013/01/25