help on skb functions

sugnan prabhu sugnan.prabhu at gmail.com
Mon May 23 01:06:52 EDT 2011


Hi,

        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.

if (tunnel->skb == NULL) {
int len;
tunnel->skb = netdev_alloc_skb(dev, sizeof(struct myprotocol_hdr));

/*Place holder for the mhdp packet count*/
len = skb_headroom(tunnel->skb);

skb_push(tunnel->skb, len);

memset(tunnel->skb->data, 0, len);

* **tunnel->skb->tail -= len;*
* **tunnel->skb->len  -= len;*
}

hdr_data = (struct data_info *) skb_put(tunnel->skb, sizeof(struct
data_info));

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.
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
structure is added at the end of previous header). Is there any better
function which can used instead.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110523/661815b9/attachment.html 


More information about the Kernelnewbies mailing list