network driver that uses skb destructor

From: Sirotkin, Alexander (demiurg_at_ti.com)
Date: 12/29/03

  • Next message: Michael Guntsche: "Network problems with b44 in 2.6.0"
    To: linux-kernel@vger.kernel.org
    Date:	Mon, 29 Dec 2003 18:53:59 +0200
    
    

    I would like to write a network driver that uses DMA and manages it's
    own memory.

    The most common approach (in RX) 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.

    -- 
    Alexander Sirotkin
    SW Engineer
    Texas Instruments
    Broadband Communications Israel (BCIL)
    Tel:  +972-9-9706587
    ________________________________________________________________________
    "Those who do not understand Unix are condemned to reinvent it, poorly."
          -- Henry Spencer 
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Michael Guntsche: "Network problems with b44 in 2.6.0"

    Relevant Pages

    • Re: Trying to DMA data from PCI bus to IDE
      ... and then use the regular Linux functions to write it to the ... > hdparm has nothing to do with the kernel's in memory caching of disk ... It's still creating a buffer stack somewhere (even ... DMA it directly to the drive by setting the IO ports and registers. ...
      (comp.os.linux.development.system)
    • Re: NdisAllocateMemoryWithTag(Priority) -> Does it ensure Congtiguous physical memory by default
      ... I believe in W2K8 if your device does 64 bit DMA, when you call NdisMAllocateSharedMemory you will get high physical addresses before getting low addresses. ... NDIS does not provide an API to allocate physically contiguous memory outside what HAL DMA APIs provide. ...
      (microsoft.public.development.device.drivers)
    • Re: High-performance IO
      ... The size of contigious buffer is meaningfull for common buffer DMA ... I would say that for scatter-gather DMA it depends on how much memory ... I know that AWE can give the programmer a way to use ...
      (microsoft.public.win32.programmer.kernel)
    • Cache coherency issues using AllocateCommonBuffer(..)
      ... I am seeing a cache coherency issue with memory allocated through ... The application I am running is in a dual host enviornment, ... from its shared memory buffer, is stale, i.e. cached data. ... drivet I allocate with the following call: ...
      (microsoft.public.development.device.drivers)
    • Re: PCI bus-master and large contiguous memory buffers
      ... As soon as device reaches the end of the buffer ... Sure, I am developing both PCI adapter and device driver, so, it is ... not afford reinitializing DMA on my device after every transfer. ... x86 CPU memory management structures I never tried to dig into Windows ...
      (microsoft.public.development.device.drivers)