From: Prashanth <bshanth@gmail.com>
To: netdev@vger.kernel.org
Subject: ip_finish_outpu2 question
Date: Wed, 14 May 2008 09:12:54 +0530 [thread overview]
Message-ID: <7aa53e090805132042k5476eaf6lb66e534232154bf5@mail.gmail.com> (raw)
hi, In the following function at line 189 , we are getting aligned
length (hh_alen) for the hardware header , but while doing a
skb_push() why are we using the hh->hh_len;for ethernet hh_alen would
be 16 , and hh->hh_len would be 14, since we are doing skb_push() with
14 (i.e hh->hh_len), the skb->data will not be aligned right? Can
someone please shed some light on this. thanks.
163 static inline int ip_finish_output2(struct sk_buff *skb)
164 {
165 struct dst_entry *dst = skb->dst;
166 struct hh_cache *hh = dst->hh;
167 struct net_device *dev = dst->dev;
168 int hh_len = LL_RESERVED_SPACE(dev);
169
170 /* Be paranoid, rather than too clever. */
171 if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) {
172 struct sk_buff *skb2;
173
174 skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));
175 if (skb2 == NULL) {
176 kfree_skb(skb);
177 return -ENOMEM;
178 }
179 if (skb->sk)
180 skb_set_owner_w(skb2, skb->sk);
181 kfree_skb(skb);
182 skb = skb2;
183 }
184
185 if (hh) {
186 int hh_alen;
187
188 read_lock_bh(&hh->hh_lock);
189 hh_alen = HH_DATA_ALIGN(hh->hh_len);
190 memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
191 read_unlock_bh(&hh->hh_lock);
192 skb_push(skb, hh->hh_len);
193 return hh->hh_output(skb);
194 } else if (dst->neighbour)
195 return dst->neighbour->output(skb);
196
197 if (net_ratelimit())
198 printk(KERN_DEBUG "ip_finish_output2: No header cache
and no neighbour!\n");
199 kfree_skb(skb);
200 return -EINVAL;
201 }
next reply other threads:[~2008-05-14 3:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-14 3:42 Prashanth [this message]
2008-05-14 4:34 ` ip_finish_outpu2 question David Miller
2008-05-14 5:23 ` Prashanth
2008-05-14 5:46 ` David Miller
2008-05-14 8:47 ` kalash nainwal
2008-05-14 10:03 ` David Miller
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=7aa53e090805132042k5476eaf6lb66e534232154bf5@mail.gmail.com \
--to=bshanth@gmail.com \
--cc=netdev@vger.kernel.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).