Skip to contentSkip to conversation

Can you commit the pcnet patch ?

Qemu-devel Ludovic Drolez 7 participants 19 messages Jul 20, 2005 – Jul 21, 2005

lore
Share & tools
lore
#0 lore raw

Hi !

I've tried the latest AMD pcnet patch (made by Antony T Curtis) with qemu 0.7 because I was tired of the sloooww PXE booting of my QEMU. For exemple, to load a linux kernel + initrd over TFTP, it takes 4m30s with a ne2000, and 1m35s with the PCNET card.

I had no problems with this driver under Windows and Linux, so it would be nice to have this driver for the next Qemu release...

Cheers,

Signature · 3 lines
Ludovic DROLEZ                              Linbox / Free&ALter Soft
www.linbox.com www.linbox.org	              tel: +33 3 87 50 87 90
152 rue de Grigy - Technopole Metz 2000                   57070 METZ
#1 lore raw
Quoted 6 lines · Ludovic Drolez

Hi !

I've tried the latest AMD pcnet patch (made by Antony T Curtis) with qemu 0.7 because I was tired of the sloooww PXE booting of my QEMU. For exemple, to load a linux kernel + initrd over TFTP, it takes 4m30s with a ne2000, and 1m35s with the PCNET card.

A reference URL would be handy. I assume you mean:

http://dad-answers.com/qemu/patches/AMD-PCNET-II/qemu-pcnet.patch6.gz

Paul

#3 lore raw
Quoted 5 lines · Christian MICHON

=============================================
Probing pci nic...
[lancepci]pcnet32.c: Found lancepci, Vendor=0x1022 Device=0x2000
lancepci: 52:54:00:12:34:56 at ioaddr C020, No MII tranceiver found!
=============================================

Very strange... I had no problems with Etherboot's PXE and a linux host.

Why a virtual network driver works under linux and not under windows ?

Signature · 1 line
Ludovic DROLEZ
#5 lore raw

anyway, this patch as it is fails on v0.7.0 needs re-alignment badly...
if you've an updated patch, could you post it, please ?

Thx
Christian

Quoted 17 lines · Ludovic Drolez
Quoted 4 lines · Paul Brook

A reference URL would be handy. I assume you mean:

http://dad-answers.com/qemu/patches/AMD-PCNET-II/qemu-pcnet.patch6.gz

Yes, this one !

--
Ludovic DROLEZ

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 1 line
Christian
#6 lore raw
Quoted 1 line
Quoted 1 line

Yes, this one !

I think I understand now why it's not in the mainline yet. This is only for linux hosts. I doesn't compile (yet :) ) on Windows hosts.

I already tapped into the patch to see if I can make it work on Windows.

Christian

#7 lore raw

When I try to replace bcmp (inexistant in mingw32) with memcmp inside pcnet.h, like this:

int result = (!CSR_DRCVPA(s)) && !bcmp(hdr->ether_dhost, padr, 6);

into

int result = (!CSR_DRCVPA(s)) && !bcmp(hdr->ether_dhost, padr, 6);

I get the following error:
In file included from C:/dev/msys/1.0/home/xian/qemu-0.7.0/hw/pcnet.c:64:
C:/dev/msys/1.0/home/xian/qemu-0.7.0/hw/pcnet.h: In function `padr_match':
C:/dev/msys/1.0/home/xian/qemu-0.7.0/hw/pcnet.h:531: error:
dereferencing pointer to incomplete type

anyone having a fix. I'm quite puzzled by the gcc error message.

Thx
Christian

=============================================
static inline int padr_match(PCNetState *s, const uint8_t *buf, int size)

{
    struct ether_header *hdr = (void *)buf;
    uint8_t padr[6] = { 
        s->csr[12] & 0xff, s->csr[12] >> 8,
        s->csr[13] & 0xff, s->csr[13] >> 8,
        s->csr[14] & 0xff, s->csr[14] >> 8 
    };

int result = (!CSR_DRCVPA(s)) && !memcmp(hdr->ether_dhost, padr, 6);

for better understanding of the faulty piece of code

#8 lore raw
Quoted 6 lines

I get the following error:
In file included from C:/dev/msys/1.0/home/xian/qemu-0.7.0/hw/pcnet.c:64:
C:/dev/msys/1.0/home/xian/qemu-0.7.0/hw/pcnet.h: In function `padr_match':
C:/dev/msys/1.0/home/xian/qemu-0.7.0/hw/pcnet.h:531: error:
dereferencing pointer to incomplete type
...

Quoted 7 lines
    struct ether_header *hdr = (void *)buf;
    uint8_t padr[6] = {
        s->csr[12] & 0xff, s->csr[12] >> 8,
        s->csr[13] & 0xff, s->csr[13] >> 8,
        s->csr[14] & 0xff, s->csr[14] >> 8
    };

int result = (!CSR_DRCVPA(s)) && !memcmp(hdr->ether_dhost, padr, 6);

Probably win32 doesn't have a definition for "struct ether_header".

Paul

#9 lore raw
In reply to Christian MICHON
Quoted 4 lines · Christian MICHON
Quoted 3 lines
Quoted 3 lines

Yes, this one !

Quoted 8 lines

I think I understand now why it's not in the mainline yet.
This is only for linux hosts. I doesn't compile (yet :) ) on Windows hosts.

I already tapped into the patch to see if I can make it work on Windows.

Christian

Hmm, I used it on Windows some time ago...

- Filip

#10 lore raw

Hi Filip,

Quoted 1 line · Filip Navara

Hmm, I used it on Windows some time ago...

did it work ? I manage to update and compile the patch for qemu 0.7.0 and windows host (see attached file). I added some #ifdef and followed Paul's hint of yesterday (thx Paul :) ).

It compiles fine, but all my clients crash whenever the tcp/ip layer gets loaded. I tried on linux slaxpro.iso, win95b and win2003/sp1 eval.

Any uber-hacker on windows who could get this to work, pls ? Thanks in advance.

Christian

#11 lore raw
Quoted 13 lines · Christian MICHON

Hi Filip,

Quoted 3 lines · Filip Navara

Hmm, I used it on Windows some time ago...

did it work ? I manage to update and compile the patch for qemu 0.7.0 and windows host (see attached file). I added some #ifdef and followed Paul's hint of yesterday (thx Paul :) ).

Quoted 7 lines

It compiles fine, but all my clients crash whenever the tcp/ip layer gets loaded. I tried on linux slaxpro.iso, win95b and win2003/sp1 eval.

Any uber-hacker on windows who could get this to work, pls ? Thanks in advance.

I used it with ReactOS and WinXP. I remember that except the compilation fixes I also had to fix the PCI subsystem id ... Anyway, the patch that I made at that time should be available somewhere in the qemu-devel archives. I'll try to find it when I get at my home computer.

- Filip

#12 lore raw
Quoted 15 lines · Filip Navara
Quoted 13 lines · Christian MICHON

Hi Filip,

Quoted 2 lines · Filip Navara

Hmm, I used it on Windows some time ago...

did it work ? I manage to update and compile the patch for qemu 0.7.0 and windows host (see attached file). I added some #ifdef and followed Paul's hint of yesterday (thx Paul :) ).

Quoted 8 lines
Quoted 7 lines

It compiles fine, but all my clients crash whenever the tcp/ip layer gets loaded. I tried on linux slaxpro.iso, win95b and win2003/sp1 eval.

Any uber-hacker on windows who could get this to work, pls ? Thanks in advance.

I used it with ReactOS and WinXP. I remember that except the compilation fixes I also had to fix the PCI subsystem id ... Anyway, the patch that I made at that time should be available somewhere in the qemu-devel archives. I'll try to find it when I get at my home computer.

Ok, I lost the compilation patch ... but the other one is here: www.volny.cz/xnavara/pcnet.c.diff

- Filip

#14 lore raw
In reply to Ludovic Drolez
Quoted 6 lines · Ludovic Drolez

Hi !

I've tried the latest AMD pcnet patch (made by Antony T Curtis) with qemu 0.7 because I was tired of the sloooww PXE booting of my QEMU. For exemple, to load a linux kernel + initrd over TFTP, it takes 4m30s with a ne2000, and 1m35s with the PCNET card.

Does anyone know why pcnet is so much faster than ne2000? is it easier to emulate? or is there room for improvements on the ne2000?

-- Lars Munch

#15 lore raw
Quoted 10 lines · Lars Munch
Quoted 6 lines · Ludovic Drolez

Hi !

I've tried the latest AMD pcnet patch (made by Antony T Curtis) with qemu 0.7 because I was tired of the sloooww PXE booting of my QEMU. For exemple, to load a linux kernel + initrd over TFTP, it takes 4m30s with a ne2000, and 1m35s with the PCNET card.

Does anyone know why pcnet is so much faster than ne2000? is it easier to emulate? or is there room for improvements on the ne2000?

Probably because it's a DMA capable controller. IIRC the ne2k is pio based, so has to shuffle the data through an IO port one byte at a time.

Paul

#16 lore raw

I tried using pxe (at least the probe) to get more diagnostics regarding this pcnet failure.

Based on the windows host patches I posted earlier on, I get this message:

=============================================
Probing pci nic...
[lancepci]pcnet32.c: Found lancepci, Vendor=0x1022 Device=0x2000
lancepci: 52:54:00:12:34:56 at ioaddr C020, No MII tranceiver found!
=============================================

This apparently tells the hw emulation is incomplete. When using realtek, I do not get this tranceiver message.

If I try to boot win95 guest with "-nic-pcnet -nics 2", I finally get an IP thru the DHCP, but the network does not work.

The patch needs badly some update/improvement on the windows side. Any specialist around? I'm puzzled, not being an expert in this field.

Christian

#17 lore raw
Quoted 12 lines · Christian MICHON

I tried using pxe (at least the probe) to get more diagnostics regarding this pcnet failure.

Based on the windows host patches I posted earlier on, I get this message:

=============================================
Probing pci nic...
[lancepci]pcnet32.c: Found lancepci, Vendor=0x1022 Device=0x2000
lancepci: 52:54:00:12:34:56 at ioaddr C020, No MII tranceiver found!
=============================================

Quoted 8 lines

This apparently tells the hw emulation is incomplete. When using realtek, I do not get this tranceiver message.

If I try to boot win95 guest with "-nic-pcnet -nics 2", I finally get an IP thru the DHCP, but the network does not work.

The patch needs badly some update/improvement on the windows side. Any specialist around? I'm puzzled, not being an expert in this field.

Early AMD PCNet controllers did not need/use a seperate MII chip. The PCNet device as emulated is one of these earlier devices. (I can provide pdf copy datasheet, and I have one such adaptor here in hardware)

Signature · 3 lines
Antony T Curtis, BSc.                   UNIX, Linux, *BSD, Networking
[email protected]            C++, J2EE, Perl, MySQL, Apache
                                        IT Consultancy.
#18 lore raw
In reply to Paul Brook
Quoted 11 lines · Paul Brook
Quoted 9 lines · Lars Munch
Quoted 6 lines · Ludovic Drolez

Hi !

I've tried the latest AMD pcnet patch (made by Antony T Curtis) with qemu 0.7 because I was tired of the sloooww PXE booting of my QEMU. For exemple, to load a linux kernel + initrd over TFTP, it takes 4m30s with a ne2000, and 1m35s with the PCNET card.

Quoted 5 lines
Quoted 2 lines

Does anyone know why pcnet is so much faster than ne2000? is it easier to emulate? or is there room for improvements on the ne2000?

Probably because it's a DMA capable controller. IIRC the ne2k is pio based, so has to shuffle the data through an IO port one byte at a time.

I don't think that the switch to DMA can explain a factor of 3. Another possibility is that there is a bug in the ne2000 code. It could be interesting to check the send and receive latencies by adding traces in the ne2000 code...

Fabrice.