* [Q] LL_RESERVED_SPACE(dev) vs HH_DATA_ALIGN(dev->hard_header_len)
@ 2004-02-08 11:39 YOSHIFUJI Hideaki / 吉藤英明
2004-02-08 21:03 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-02-08 11:39 UTC (permalink / raw)
To: davem, kuznet; +Cc: netdev
Hello.
There're many places like:
(dev->hard_header_len + 15) & ~15
or
dev->hard_header_len + 15.
I guess the second one trying to express maximum number of the
first one and it seems that
HH_DATA_ALIGN(dev->hard_header_len)
LL_SPACE_RESERVED(dev)
(defined in include/linux/netdevice.h) will do for us respectively.
Question:
How do you think about the following patch?
Or, is it okay to simply use LL_RESERVED_SPACE(dev) in both places?
Thanks in advance.
===== net/econet/af_econet.c 1.30 vs edited =====
--- 1.30/net/econet/af_econet.c Mon Jan 26 04:05:06 2004
+++ edited/net/econet/af_econet.c Sun Feb 8 17:18:51 2004
@@ -318,12 +318,12 @@
#ifdef CONFIG_ECONET_NATIVE
dev_hold(dev);
- skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15,
+ skb = sock_alloc_send_skb(sk, len + LL_RESERVED_SPACE(dev),
msg->msg_flags & MSG_DONTWAIT, &err);
if (skb==NULL)
goto out_unlock;
- skb_reserve(skb, (dev->hard_header_len+15)&~15);
+ skb_reserve(skb, HH_DATA_ALIGN(dev->hard_header_len));
skb->nh.raw = skb->data;
eb = (struct ec_cb *)&skb->cb;
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Q] LL_RESERVED_SPACE(dev) vs HH_DATA_ALIGN(dev->hard_header_len)
2004-02-08 11:39 [Q] LL_RESERVED_SPACE(dev) vs HH_DATA_ALIGN(dev->hard_header_len) YOSHIFUJI Hideaki / 吉藤英明
@ 2004-02-08 21:03 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-02-08 21:03 UTC (permalink / raw)
To: yoshfuji; +Cc: kuznet, netdev
On Sun, 08 Feb 2004 20:39:30 +0900 (JST)
YOSHIFUJI Hideaki / ^[$B5HF#1QL@^[(B <yoshfuji@linux-ipv6.org> wrote:
> Question:
> How do you think about the following patch?
> Or, is it okay to simply use LL_RESERVED_SPACE(dev) in both places?
LL_RESERVED_SPACE() is what should be used in both spots.
I checked in the following patch, thanks for noticing this.
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/02/08 12:58:29-08:00 davem@nuts.davemloft.net
# [ECONET]: Use LL_RESERVED_SPACE() where applicable. Noticed by yoshfuji.
#
# net/econet/af_econet.c
# 2004/02/08 12:58:13-08:00 davem@nuts.davemloft.net +2 -2
# [ECONET]: Use LL_RESERVED_SPACE() where applicable. Noticed by yoshfuji.
#
diff -Nru a/net/econet/af_econet.c b/net/econet/af_econet.c
--- a/net/econet/af_econet.c Sun Feb 8 12:59:08 2004
+++ b/net/econet/af_econet.c Sun Feb 8 12:59:08 2004
@@ -318,12 +318,12 @@
#ifdef CONFIG_ECONET_NATIVE
dev_hold(dev);
- skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15,
+ skb = sock_alloc_send_skb(sk, len+LL_RESERVED_SPACE(dev),
msg->msg_flags & MSG_DONTWAIT, &err);
if (skb==NULL)
goto out_unlock;
- skb_reserve(skb, (dev->hard_header_len+15)&~15);
+ skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb->nh.raw = skb->data;
eb = (struct ec_cb *)&skb->cb;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-08 21:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-08 11:39 [Q] LL_RESERVED_SPACE(dev) vs HH_DATA_ALIGN(dev->hard_header_len) YOSHIFUJI Hideaki / 吉藤英明
2004-02-08 21:03 ` David S. Miller
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).