Networking Forums

Networking Forums > Computer Networking > Linux Networking > network driver that uses skb destructor

Reply
Thread Tools Display Modes

network driver that uses skb destructor

 
 
Alexander Sirotkin
Guest
Posts: n/a

 
      12-29-2003, 03:47 PM
I would like to write a network driver that uses DMA and manages
it's own memory.

The most common approach seem to be to allocate the memory for DMA
transfer using dev_alloc_skb(), get the HW DMA engine to transfer
the packet into this skb buffer and later free it using dev_kfree_skb().

For various reasons (mainly to support legacy source code) I would like
to allocate and free the buffer using my own functions. Theoretically,
I could get away by using skb->destructor.

When I receive a packet I could allocate a zero length skb, point
skb->data to my (already allocated) buffer which contains the packet and
register the skb->destructor callback. Later, when this skb would be
freed my destructor callback would be called and it would return the
buffer to driver's pool.

It seems to me that it should work, but I'm a little bit cautions
because I could not find a single network driver (in 2.4 kernel) that
uses such an approach and I'm not extremely eager to be the first one to
try.

Anybody tried to implement similar approach ?
Any thoughts why this would (or would not) work ?

Thanks a lot.

 
Reply With Quote
 
 
 
 
Pete Zaitcev
Guest
Posts: n/a

 
      12-30-2003, 06:32 AM
On Mon, 29 Dec 2003 18:47:38 +0200, Alexander Sirotkin wrote:

> I would like to write a network driver that uses DMA and manages
> it's own memory.
>[...]
> For various reasons (mainly to support legacy source code) I would like
> to allocate and free the buffer using my own functions. Theoretically,
> I could get away by using skb->destructor.
>[...]
> Anybody tried to implement similar approach ?
> Any thoughts why this would (or would not) work ?


It should work, IMHO. Check how AF_UNIX does it.

I might note that reusing WinCE or such too literally always
caused crappage in my experience. You might want to ponder
if it is worth bothering.

-- Pete

 
Reply With Quote
 
Alexander Sirotkin
Guest
Posts: n/a

 
      12-30-2003, 09:37 AM
Somebody on the LKML pointed out that it would not work because
skb->destructor can be overwritten at higher levels and there is
no way to chain destructors....

I gues I'll have to do this a hard way...

Pete Zaitcev wrote:
> On Mon, 29 Dec 2003 18:47:38 +0200, Alexander Sirotkin wrote:
>
>
>>I would like to write a network driver that uses DMA and manages
>>it's own memory.
>>[...]
>>For various reasons (mainly to support legacy source code) I would like
>>to allocate and free the buffer using my own functions. Theoretically,
>>I could get away by using skb->destructor.
>>[...]
>>Anybody tried to implement similar approach ?
>>Any thoughts why this would (or would not) work ?

>
>
> It should work, IMHO. Check how AF_UNIX does it.
>
> I might note that reusing WinCE or such too literally always
> caused crappage in my experience. You might want to ponder
> if it is worth bothering.
>
> -- Pete
>


 
Reply With Quote
 
Frogiswrong
Guest
Posts: n/a

 
      12-30-2003, 10:59 AM

"Alexander Sirotkin" <(E-Mail Removed)> wrote in message
news:bsplrj$14h$(E-Mail Removed)...
> I would like to write a network driver that uses DMA and manages
> it's own memory.
>


I bet you would Panama red

<snip>


 
Reply With Quote
 
Andi Kleen
Guest
Posts: n/a

 
      12-30-2003, 08:06 PM
Alexander Sirotkin <(E-Mail Removed)> writes:

> Somebody on the LKML pointed out that it would not work because
> skb->destructor can be overwritten at higher levels and there is
> no way to chain destructors....


Correct. That's intentional even.

> I gues I'll have to do this a hard way...


AKA the correct way.

-Andi
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
network driver modification Readon Shaw Linux Networking 0 02-16-2006 03:06 AM
Changing from orinoco driver to wlan or hostap driver Rick Bilonick Linux Networking 1 01-31-2005 11:03 AM
during boot Ndis2 driver & Network Transport Driver not found elgordo Windows Networking 0 08-24-2004 08:26 AM
need to add network driver to installation driver diskette Gary Roach Linux Networking 0 06-02-2004 04:12 PM
Network card driver Mainlander Linux Networking 1 02-18-2004 07:02 AM



1 2 3 4 5 6 7 8 9 10 11