LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 02-09-2012, 05:32 PM   #1
5883
Member
 
Registered: Aug 2004
Posts: 36

Rep: Reputation: 0
linux network device driver Q: receiving packets


hi i'm working on network driver driver, totally confused by the existing code under driver/net/...

say i got RECV_COMPLETE interrupt, i need to move the received pkt into the SKB to pass up.

my plan is,
1. read the 1st 22 bytes for un-tagged ethernet frame,
that's preamble+SFD+src+dst+len,
2. from len, i know the total size of this frame,
data_len = len - 22;
read this number of bytes from hardware into buf1
3. the last 4 bytes is the frame check sequence
4. skb = netdev_alloc_skb,
skb_len = data_len - 4; // don't need the last 4 bytes
5. copy skb_len of bytes from buf1 into skb->data

is the above correct ?

also i saw netdev_alloc_skp_ip_align, ALIGN(len, 4), ...
each driver is doing things in different ways,

can someone give me a clear steps ?

thanks very much !
 
Old 02-11-2012, 02:31 PM   #2
smallpond
Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 456

Rep: Reputation: 85
I don't know of any card that will give you the preamble or SFD. The first bytes of the frame delivered to you should be the dest. Typically there is no length field, the card reports that to you separately. You get ethertype in 12-13 (0-based) in most network protocols.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Receiving Packets Simultaneously in Two Different Network Interface ? citiz3n Linux - Networking 4 05-25-2008 07:38 PM
Multicasting not receiving packets :( culin Linux - Networking 2 09-27-2007 05:02 AM
I'm receiving packets but not sending on a wireless network chetjordan2002 Linux - Wireless Networking 2 07-29-2006 12:52 PM
Time stamping TCP packets at the device driver level saintt Linux - Networking 2 12-20-2002 05:02 AM


All times are GMT -5. The time now is 08:33 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration