RealTek 8139 driver

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

RealTek 8139 driver

Post by eddyb »

So, I started a RTL8139 driver.
I've wrote routines for initializing(reset, flags to set, &co.) the NIC.
But i'm stuck: what I have is a "Hard To Understand" programming guide, the wiki article and a hackish linux-borrowed driver.
What I ask: I've got a Rx Buffer and a proper IRQ handler. What should I do when the IRQ is a Rx one, in order to receive the packet?
thanks, eddyb.
Last edited by eddyb on Mon Dec 08, 2008 12:33 pm, edited 1 time in total.
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: RealTek 8139 driver

Post by eddyb »

no one?
or at least some good documentation(not rubbish).
I'm going mad... why the hack there is no good docs for osdevers :x ?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: RealTek 8139 driver

Post by Combuster »

You have the specifications. Those things are good document to our standards. :twisted:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: RealTek 8139 driver

Post by eddyb »

Combuster wrote:You have the specifications. Those things are good document to our standards. :twisted:
if you'll tell me from where to get that, i thank you.
NOTE: RealTek.com ftp servers doesn't allow more than 0.5 simultaneous connections :mrgreen: .
EDIT: So nice :lol: ...: they are down right now.
Last edited by eddyb on Thu Dec 04, 2008 11:43 am, edited 1 time in total.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: RealTek 8139 driver

Post by Combuster »

Like I said, you already had them.
The Wiki wrote: * http://www.datasheetarchive.com/pdf/rtl ... sheet.html, Datasheet for the RTL8139
* http://www.cs.usfca.edu/~cruse/cs326f04 ... sGuide.pdf, Programming guide for the RTL8139
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: RealTek 8139 driver

Post by eddyb »

Combuster wrote:Like I said, you already had them.
The Wiki wrote: * http://www.datasheetarchive.com/pdf/rtl ... sheet.html, Datasheet for the RTL8139
* http://www.cs.usfca.edu/~cruse/cs326f04 ... sGuide.pdf, Programming guide for the RTL8139
Yes, I have them because i have read that in the wiki :) .
- first link is outdated(just click on it and you'll see).
- the second is that "Hard To Understand"(if is not so, i'm :oops: ) programming guide.

EDIT: I've found it: http://www.magnesium.net/~wpaul/rt/spec-8139cp(150).pdf. I've added the link to wiki. Maybe i'll write the rlt8139 page(now it's not a quality one), when i'll understand it.
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: RealTek 8139 driver

Post by eddyb »

Q: Is there any way to link a real eth to a emulated [Qemu] NIC? I have the eth1 board(the main is eth0) for tests, and i want qemu, when it runs, to redirect ALL packages to the emulated NIC.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: RealTek 8139 driver

Post by pcmattman »

RTFM? Seriously, it's in the QEMU manual. Just read the thing and experiment.
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: RealTek 8139 driver

Post by eddyb »

pcmattman wrote:RTFM? Seriously, it's in the QEMU manual. Just read the thing and experiment.
-net user: gives you a host user network stack access(i think is like NAT).
-net tun: i think is what i need... but i don't know how to use it(i must create some tunnel, but how? I've found vtund, but I'm not sure if it's what i want).
other options: are more like forwarding some of the packets, etc..
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: RealTek 8139 driver

Post by pcmattman »

Yes, tun is what you want - a tun/tap interface. I'm not 100% sure on the *nix method of creating and using such interfaces (tun0 for example).

You may also want to try passing an interface name to QEmu, though I'm not sure it creates the interface for you.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Re: RealTek 8139 driver

Post by Dex »

You can take a look at DexOS driver (including full TCP/IP stack)
http://www.dex4u.com/Rtl8139.zip
Note: its users polling.
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: RealTek 8139 driver

Post by eddyb »

Dex wrote:You can take a look at DexOS driver (including full TCP/IP stack)
http://www.dex4u.com/Rtl8139.zip
Note: its users polling.
thanks.
now i want to make qemu work.
also, the length/type field in net packet is length or type? :D
and i suppose the first packet is at rx_buffer_address+16 (some 16 byte header, but for what is it?)?
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: RealTek 8139 driver

Post by eddyb »

I've tried to dump first 80 (minimal size of eth frame + 16 bytes header -> What Is This Header?!) bytes of the Rx ring, but I've found only zeros(I've filled with zeros, at initialization, all the Rx ring to be sure there is nothing). so? i need to do something to make the NIC put there the packet? But I've set it to have no FIFO limit or something like that, just put there the packet it receives.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: RealTek 8139 driver

Post by Combuster »

Have you made sure it actually received some packets on the line? If you use a switch it could've routed packets directly to where they should so your test PC can't have seen them.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: RealTek 8139 driver

Post by eddyb »

Combuster wrote:Have you made sure it actually received some packets on the line? If you use a switch it could've routed packets directly to where they should so your test PC can't have seen them.
I dump that on a Rx IRQ... and I've got a lot on my real PPoE connection(maybe from PPoE acces concentrator stuff & co).
Post Reply