Hi,
<div><br></div><div>        I have working on the tunnel networking driver. My requirement is to perform operation, which is opposite to the skb_put. following is the code i have written.</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (tunnel-&gt;skb == NULL) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>int len;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>tunnel-&gt;skb = netdev_alloc_skb(dev, sizeof(struct myprotocol_hdr));</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>/*Place holder for the mhdp packet count*/</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>len = skb_headroom(tunnel-&gt;skb);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>skb_push(tunnel-&gt;skb, len);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>memset(tunnel-&gt;skb-&gt;data, 0, len);</div>
<div><span class="Apple-style-span" style="white-space: pre;"><br></span></div><div><span class="Apple-tab-span" style="white-space:pre"><b>                        </b></span><b>tunnel-&gt;skb-&gt;tail -= len;</b></div><div><span class="Apple-tab-span" style="white-space:pre"><b>                        </b></span><b>tunnel-&gt;skb-&gt;len  -= len;</b></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>hdr_data = (struct data_info *) skb_put(tunnel-&gt;skb, sizeof(struct data_info));</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div></div><div>Every time before calling the dev_queue_xmit i check whether the hardware is busy? if it is, then i call skb_put and add a structure at the end of header.</div>
<div>you can observe that, for the first time skb is allocated, skb-&gt;tail and skb-&gt;len are being decremented manually in order to avoid memory copy(as the</div><div>structure is added at the end of previous header). Is there any better function which can used instead.</div>
<div><br></div>