From: "Mark.Zhan" <rongkai.zhan@windriver.com>
To: art <art@sigrand.ru>
Cc: linux-mips@linux-mips.org
Subject: Re: Socket buffer allocation outside DMA-able memory
Date: Wed, 07 Jun 2006 12:11:51 +0800 [thread overview]
Message-ID: <44865207.9080606@windriver.com> (raw)
In-Reply-To: <10452.060607@sigrand.ru>
Hi art,
I think maybe my first noise is more easy to go.
As you know, sk_buff is made of a skb header and the packet data
container. The skb header is allocated from the slab cache, while the
packet data container is allocated via kmalloc().
So if you can add your low 32MB memory into ZONE_DMA, then your can call
__dev_alloc_skb() with __GFP_DMA flag in your driver, which should make
sure that the packet data container is in ZONE_DMA.
Best Regards,
Mark.Zhan
art wrote:
> Hello Rongkai,
>
> Thanks! Good idea!
>
>
> ZR> After having a look at the latest 2.6.17-rc6 codes, __dev_alloc_skb is defined like this:
>
> ZR> #ifndef CONFIG_HAVE_ARCH_DEV_ALLOC_SKB
> ZR> /**
> ZR> * __dev_alloc_skb - allocate an skbuff for sending
> ZR> * @length: length to allocate
> ZR> * @gfp_mask: get_free_pages mask, passed to alloc_skb
> ZR> *
> ZR> * Allocate a new &sk_buff and assign it a usage count of one. The
> ZR> * buffer has unspecified headroom built in. Users should allocate
> ZR> * the headroom they think they need without accounting for the
> ZR> * built in space. The built in space is used for optimisations.
> ZR> *
> ZR> * %NULL is returned in there is no free memory.
> ZR> */
> ZR> static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
> ZR> gfp_t gfp_mask)
> ZR> {
> ZR> struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
> ZR> if (likely(skb))
> ZR> skb_reserve(skb, NET_SKB_PAD);
> ZR> return skb;
> ZR> }
> ZR> #else
> ZR> extern struct sk_buff *__dev_alloc_skb(unsigned int length, int gfp_mask);
> ZR> #endif
>
>
> ZR> Therefore, you also can consider to implement your machine-specific __dev_alloc_skb() function, and force the skb is allocated from your low 32MB memory zone.
>
>
>
>
next prev parent reply other threads:[~2006-06-07 4:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-06 14:02 Socket buffer allocation outside DMA-able memory Zhan, Rongkai
2006-06-06 14:02 ` Zhan, Rongkai
[not found] ` <10452.060607@sigrand.ru>
2006-06-07 4:11 ` Mark.Zhan [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-06-06 13:33 Zhan, Rongkai
2006-06-06 13:33 ` Zhan, Rongkai
2006-06-02 13:26 art
2006-06-06 12:37 ` ashley jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44865207.9080606@windriver.com \
--to=rongkai.zhan@windriver.com \
--cc=art@sigrand.ru \
--cc=linux-mips@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.