kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* help on skb functions
@ 2011-05-23  5:06 sugnan prabhu
  0 siblings, 0 replies; only message in thread
From: sugnan prabhu @ 2011-05-23  5:06 UTC (permalink / raw)
  To: kernelnewbies

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 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-23  5:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-23  5:06 help on skb functions sugnan prabhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).