From mboxrd@z Thu Jan 1 00:00:00 1970 From: sugnan.prabhu@gmail.com (sugnan prabhu) Date: Mon, 23 May 2011 10:36:52 +0530 Subject: help on skb functions Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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