1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>__alloc_skb</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Networking and Network Devices APIs"><link rel="up" href="ch01s02.html" title="Socket Buffer Functions"><link rel="prev" href="API-sock-unregister.html" title="sock_unregister"><link rel="next" href="API-netdev-alloc-frag.html" title="netdev_alloc_frag"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">__alloc_skb</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-sock-unregister.html">Prev</a> </td><th width="60%" align="center">Socket Buffer Functions</th><td width="20%" align="right"> <a accesskey="n" href="API-netdev-alloc-frag.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API---alloc-skb"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>__alloc_skb — 2 allocate a network buffer 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">struct sk_buff * <b class="fsfunc">__alloc_skb </b>(</code></td><td>unsigned int <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>gfp_t <var class="pdparam">gfp_mask</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">node</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1095993548"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>size</code></em></span></dt><dd><p> 4 size to allocate 5 </p></dd><dt><span class="term"><em class="parameter"><code>gfp_mask</code></em></span></dt><dd><p> 6 allocation mask 7 </p></dd><dt><span class="term"><em class="parameter"><code>flags</code></em></span></dt><dd><p> 8 If SKB_ALLOC_FCLONE is set, allocate from fclone cache 9 instead of head cache and allocate a cloned (child) skb. 10 If SKB_ALLOC_RX is set, __GFP_MEMALLOC will be used for 11 allocations in case the data is required for writeback 12 </p></dd><dt><span class="term"><em class="parameter"><code>node</code></em></span></dt><dd><p> 13 numa node to allocate memory on 14 </p></dd></dl></div></div><div class="refsect1"><a name="idp1095998236"></a><h2>Description</h2><p> 15 Allocate a new <span class="structname">sk_buff</span>. The returned buffer has no headroom and a 16 tail room of at least size bytes. The object has a reference count 17 of one. The return is the buffer. On a failure the return is <code class="constant">NULL</code>. 18 </p><p> 19 20 Buffers may only be allocated from interrupts using a <em class="parameter"><code>gfp_mask</code></em> of 21 <code class="constant">GFP_ATOMIC</code>. 22</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-sock-unregister.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch01s02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-netdev-alloc-frag.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">sock_unregister</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">netdev_alloc_frag</span></td></tr></table></div></body></html> 23