From: sugnan.prabhu@gmail.com (sugnan prabhu)
To: kernelnewbies@lists.kernelnewbies.org
Subject: help on skb functions
Date: Mon, 23 May 2011 10:36:52 +0530 [thread overview]
Message-ID: <BANLkTimQ39GjkQ3Bay1zAFYDMzB0YonN=w@mail.gmail.com> (raw)
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
reply other threads:[~2011-05-23 5:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTimQ39GjkQ3Bay1zAFYDMzB0YonN=w@mail.gmail.com' \
--to=sugnan.prabhu@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).