OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 11:26 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: RTL8169 on real hardware not able to send packages
PostPosted: Wed May 13, 2020 3:48 pm 
Offline
Member
Member

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 69
Hello everyone,

I am trying to setup a RTL8169 driver.
So far I used the tutorial on osdev.org and added the interrupt function so the interrupts are working.
After this, I decided to look for incoming packets by sending "sudo dhclient" from my Linux computer to my computer with my OS on it.
The computer caused an interrupt and I can see what the system is sending to my computer.
So far so good.
Now I'm trying to send data to the network (the same package as I received earlier since I know this package is alright):
https://github.com/AdeRegt/SanderOSUSB/ ... 8169.c#L58
This function is not causing an interrupt and polling seems not to work (stays on 0x40 forever). Also, I cannot see it is sent with Wireshark.
Im testing this on real hardware.

I hope someone can help me.


Top
 Profile  
 
 Post subject: Re: RTL8169 on real hardware not able to send packages
PostPosted: Thu May 14, 2020 12:02 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 26, 2007 1:53 am
Posts: 395
Hard to say what's wrong but one common mistake is that you forgot to set PCI Bus Mastering for the card.

_________________
Fudge - Simplicity, clarity and speed.
http://github.com/Jezze/fudge/


Top
 Profile  
 
 Post subject: Re: RTL8169 on real hardware not able to send packages
PostPosted: Thu May 14, 2020 2:23 pm 
Offline

Joined: Sat Aug 09, 2008 5:07 pm
Posts: 23
Please get rid of the magic numbers, it makes the code hard to read and maintain :)

It's not clear from the code if TX descriptors are properly aligned, they should be aligned on 256 byte boundary if I'm not mistaken.
You did not set the high address of the TX descriptor ring (bar1 + 0x24)


Top
 Profile  
 
 Post subject: Re: RTL8169 on real hardware not able to send packages
PostPosted: Sun May 17, 2020 5:42 am 
Offline
Member
Member

Joined: Mon Mar 14, 2016 5:34 am
Posts: 40
I managed to make an RTL8139 driver for my OS but I had trouble getting it to start. the clock was missing and I had not found any indication of this clock in the official documentation. to start the clock there is a need to send the "R" byte to port 5Bh of the card registers

the source code of my driver: https://github.com/N-LG/service-etherne ... TL8139.asm (in assembler and commented in French, I know it's not easy but it can help a little bit)


Top
 Profile  
 
 Post subject: Re: RTL8169 on real hardware not able to send packages
PostPosted: Sun May 17, 2020 7:09 am 
Offline
Member
Member

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 69
Thank you for your comments.
I managed to make it work on real hardware.

This is the sourcecode:
https://github.com/AdeRegt/SanderOSUSB/ ... /RTL8169.c


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 99 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group