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->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->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->skb);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>skb_push(tunnel->skb, len);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>memset(tunnel->skb->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->skb->tail -= len;</b></div><div><span class="Apple-tab-span" style="white-space:pre"><b>                        </b></span><b>tunnel->skb->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->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->tail and skb->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>