LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-04-2008, 06:50 AM   #1
kapsikum
Member
 
Registered: Mar 2005
Location: INDIA
Posts: 79

Rep: Reputation: 16
Question tool to help understand ethernet driver


hello,


i need to understand the functionality of a cavium ethernet driver. Can anybody please tell me if there any tool available (like gdb) using which i can get info of its working, like
what happens when the packet arrives ?
how it grabs/extracts a packets and sends up the stack ?
how its interfaced with the kernel ?


thanks in anticipation,
 
Old 06-05-2008, 08:50 AM   #2
kapsikum
Member
 
Registered: Mar 2005
Location: INDIA
Posts: 79

Original Poster
Rep: Reputation: 16
anyways, i have started from the base and trying to understand the code. Its been found that, in the recive routine, when the recieve routine gets the packet from NIC its checking some sort of receive error bit and (&&) a corrosponding error code. Its rejecting the packet right away if thats an error bit is set. Now at this stage even a packet sniffer is not able to show the packet as its not even entering the stack.

can any body please tell me how can i dump the packet or what is the option at my hand to see what is wrong in the received packet.

i thing i'd like to mention here is that the above problem is noticed only when the interface MTU is set < 1500 (its ethernet).
On 1500 there is not problem in recieving the packet.

Any help !!!
 
Old 06-05-2008, 03:34 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Since you are looking at code running in kernel space, your options are few. Littering the driver with printk()'s dumping key information is one of them. You will be able to use dmesg to view the messages. I've done very little hacking at the kernel level, so I can't offer much more than that.
It does not seem unreasonable that if the interface is connected to a lve network, it will receive packets from other hosts that are at the 1500 byte payload size. Hard to say whether setting the MTU ends up having a direct effect on the ethernet hardware, or not. You haven't said what the problem actually is.

--- rod.
 
Old 06-06-2008, 12:40 AM   #4
kapsikum
Member
 
Registered: Mar 2005
Location: INDIA
Posts: 79

Original Poster
Rep: Reputation: 16
thanks for the response theNbomr.

the actual problem is that when the interface MTU size is set to any value < 1500, the HTTP request is not getting serviced, i am not able to open any site at all. Though the ICMP still works and i can receive icmp echo-replies from the same site where my http fails(say google.com). On ethereal, i could see that the http requests are properly dispatched but no return packets from the destination. On changing the MTU size back to 1500 the issue disappears.

With value < 1500, when a http request is made i see these messuages reported by the driver:

Port 1 receive error code 2, packet dropped.

port 1 here is the interface (eth1) connected to external world.
but no such problem with ICMP.


I hope this elucidates the point to you. Please let me know if you need more input on this.

PS: Do you have any idea, if there are any kernel routines available to dump the packets at this place, just for debugging purposes.

Last edited by kapsikum; 06-06-2008 at 12:42 AM. Reason: incorrect sentence
 
Old 06-06-2008, 12:49 AM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
There are precious few places where the kernel *can* dump data. The message log facility where printk() messages go to is all I know of. Kernel mode programming & debugging isn't easy.
You could put the ethernet on a hub (not a switch), and use a second computer to sniff the traffic.
--- rod.
 
Old 06-06-2008, 01:29 AM   #6
kapsikum
Member
 
Registered: Mar 2005
Location: INDIA
Posts: 79

Original Poster
Rep: Reputation: 16
let me try with printk.

anyways, here is my setup.


host [x86 client]
|
router [mips, nat'ed, dropping http/https packets]
|
host [x86, nat'ed, sniffing packets]
|
INTERNET

Last edited by kapsikum; 06-06-2008 at 01:35 AM. Reason: misaligned diagram
 
Old 06-07-2008, 12:27 AM   #7
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Do you have the documentation for the ethernet chip in question? This is the only way to know for sure what the normal behavior is. Just curious why you want to use a non-standard MTU, especially for HTTP over ethernet?
--- rod.
 
Old 06-07-2008, 12:43 AM   #8
kapsikum
Member
 
Registered: Mar 2005
Location: INDIA
Posts: 79

Original Poster
Rep: Reputation: 16
no , unfortunately i don't have any doc., though i tried finding it on cavium site. Its not that the MTU is specifically changed to non-standard size and that too for HTTP, but the problem is so far seen only in HTTP/HTTPS case.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Any document to understand e1000 network device driver source code ahm_irf Linux - Networking 1 02-14-2007 01:37 AM
Driver development tool jkoshi Linux - General 0 09-29-2006 06:30 PM
PCMCIA ethernet driver loaded --now what? How do I access ethernet? KWTm Linux - Hardware 3 07-10-2006 01:07 PM
Help me understand this Driver code! fbarre Linux - Newbie 2 09-24-2003 05:10 PM
Help me understand this Driver code! fbarre Linux - General 2 09-24-2003 12:51 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration