* [XFRM] Make XFRM core subsystem af-independent
@ 2004-09-17 11:50 YOSHIFUJI Hideaki / 吉藤英明
2004-09-17 12:40 ` Herbert Xu
2004-09-17 13:11 ` Herbert Xu
0 siblings, 2 replies; 11+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-09-17 11:50 UTC (permalink / raw)
To: davem; +Cc: yoshfuji, netdev
Hello.
Following changesets make XFRM core subsystem af-independent.
Please pull following changesets from:
<bk://bk.skbuff.net:20609/linux-2.6-xfrm-20040917/>.
HEADLINES
---------
ChangeSet@1.1925, 2004-09-17 20:13:22+09:00, yoshfuji@linux-ipv6.org
[IPV4] replace ip_route_output_key() with ip_route_output_flow().
ChangeSet@1.1926, 2004-09-17 20:13:43+09:00, yoshfuji@linux-ipv6.org
[XFRM] make xfrm_lookup() fully af-independent.
DIFFSTATS
---------
include/net/route.h | 5 ++---
net/atm/clip.c | 8 ++++----
net/core/netfilter.c | 4 ++--
net/ipv4/arp.c | 6 +++---
net/ipv4/icmp.c | 6 +++---
net/ipv4/igmp.c | 6 +++---
net/ipv4/ip_gre.c | 10 +++++-----
net/ipv4/ip_output.c | 2 +-
net/ipv4/ipip.c | 8 ++++----
net/ipv4/ipmr.c | 4 ++--
net/ipv4/ipvs/ip_vs_xmit.c | 6 +++---
net/ipv4/netfilter/ip_fw_compat_masq.c | 2 +-
net/ipv4/netfilter/ip_nat_core.c | 2 +-
net/ipv4/netfilter/ipt_MASQUERADE.c | 2 +-
net/ipv4/netfilter/ipt_REJECT.c | 6 +++---
net/ipv4/route.c | 26 +++++++++++++-------------
net/ipv4/syncookies.c | 2 +-
net/ipv4/xfrm4_policy.c | 2 +-
net/ipv6/sit.c | 4 ++--
net/sctp/protocol.c | 30 ++++++++----------------------
20 files changed, 63 insertions(+), 78 deletions(-)
CHANGESETS
----------
ChangeSet@1.1925, 2004-09-17 20:13:22+09:00, yoshfuji@linux-ipv6.org
[IPV4] replace ip_route_output_key() with ip_route_output_flow().
Since ip_route_output_key() is identical to ip_route_output_flow(),
except for the lack of the sk and the flags arguments,
let's use the later generic one.
Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
diff -Nru a/include/net/route.h b/include/net/route.h
--- a/include/net/route.h 2004-09-17 20:14:58 +09:00
+++ b/include/net/route.h 2004-09-17 20:14:58 +09:00
@@ -115,8 +115,7 @@
u32 src, u8 tos, struct net_device *dev);
extern void ip_rt_advice(struct rtable **rp, int advice);
extern void rt_cache_flush(int how);
-extern int __ip_route_output_key(struct rtable **, const struct flowi *flp);
-extern int ip_route_output_key(struct rtable **, struct flowi *flp);
+extern int __ip_route_output_flow(struct rtable **, const struct flowi *flp);
extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin);
extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu);
@@ -158,7 +157,7 @@
int err;
if (!dst || !src) {
- err = __ip_route_output_key(rp, &fl);
+ err = __ip_route_output_flow(rp, &fl);
if (err)
return err;
fl.fl4_dst = (*rp)->rt_dst;
diff -Nru a/net/atm/clip.c b/net/atm/clip.c
--- a/net/atm/clip.c 2004-09-17 20:14:58 +09:00
+++ b/net/atm/clip.c 2004-09-17 20:14:58 +09:00
@@ -556,7 +556,7 @@
unlink_clip_vcc(clip_vcc);
return 0;
}
- error = ip_route_output_key(&rt,&fl);
+ error = ip_route_output_flow(&rt, &fl, NULL, 0);
if (error) return error;
neigh = __neigh_lookup(&clip_tbl,&ip,rt->u.dst.dev,1);
ip_rt_put(rt);
diff -Nru a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
--- a/net/bridge/br_netfilter.c 2004-09-17 20:14:58 +09:00
+++ b/net/bridge/br_netfilter.c 2004-09-17 20:14:58 +09:00
@@ -168,8 +168,8 @@
* Let us now consider the case that ip_route_input() fails:
*
* After a "echo '0' > /proc/sys/net/ipv4/ip_forward" ip_route_input()
- * will fail, while __ip_route_output_key() will return success. The source
- * address for __ip_route_output_key() is set to zero, so __ip_route_output_key
+ * will fail, while __ip_route_output_flow() will return success. The source
+ * address for __ip_route_output_flow() is set to zero, so __ip_route_output_flow
* thinks we're handling a locally generated packet and won't care
* if IP forwarding is allowed. We send a warning message to the users's
* log telling her to put IP forwarding on.
@@ -225,7 +225,7 @@
{ .ip4_u = { .daddr = iph->daddr, .saddr = 0 ,
.tos = RT_TOS(iph->tos)} }, .proto = 0};
- if (!ip_route_output_key(&rt, &fl)) {
+ if (!ip_route_output_flow(&rt, &fl, NULL, 0)) {
/* Bridged-and-DNAT'ed traffic doesn't
* require ip_forwarding. */
if (((struct dst_entry *)rt)->dev == dev) {
diff -Nru a/net/core/netfilter.c b/net/core/netfilter.c
--- a/net/core/netfilter.c 2004-09-17 20:14:58 +09:00
+++ b/net/core/netfilter.c 2004-09-17 20:14:58 +09:00
@@ -631,7 +631,7 @@
fl.nl_u.ip4_u.fwmark = (*pskb)->nfmark;
#endif
fl.proto = iph->protocol;
- if (ip_route_output_key(&rt, &fl) != 0)
+ if (ip_route_output_flow(&rt, &fl, NULL, 0) != 0)
return -1;
/* Drop old route. */
@@ -641,7 +641,7 @@
/* non-local src, find valid iif to satisfy
* rp-filter when calling ip_route_input. */
fl.nl_u.ip4_u.daddr = iph->saddr;
- if (ip_route_output_key(&rt, &fl) != 0)
+ if (ip_route_output_flow(&rt, &fl, NULL, 0) != 0)
return -1;
odst = (*pskb)->dst;
diff -Nru a/net/ipv4/arp.c b/net/ipv4/arp.c
--- a/net/ipv4/arp.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/arp.c 2004-09-17 20:14:58 +09:00
@@ -430,7 +430,7 @@
int flag = 0;
/*unsigned long now; */
- if (ip_route_output_key(&rt, &fl) < 0)
+ if (ip_route_output_flow(&rt, &fl, NULL, 0) < 0)
return 1;
if (rt->u.dst.dev != dev) {
NET_INC_STATS_BH(LINUX_MIB_ARPFILTER);
@@ -1004,7 +1004,7 @@
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip,
.tos = RTO_ONLINK } } };
struct rtable * rt;
- if ((err = ip_route_output_key(&rt, &fl)) != 0)
+ if ((err = ip_route_output_flow(&rt, &fl, NULL, 0)) != 0)
return err;
dev = rt->u.dst.dev;
ip_rt_put(rt);
@@ -1092,7 +1092,7 @@
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip,
.tos = RTO_ONLINK } } };
struct rtable * rt;
- if ((err = ip_route_output_key(&rt, &fl)) != 0)
+ if ((err = ip_route_output_flow(&rt, &fl, NULL, 0)) != 0)
return err;
dev = rt->u.dst.dev;
ip_rt_put(rt);
diff -Nru a/net/ipv4/icmp.c b/net/ipv4/icmp.c
--- a/net/ipv4/icmp.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/icmp.c 2004-09-17 20:14:58 +09:00
@@ -403,7 +403,7 @@
.saddr = rt->rt_spec_dst,
.tos = RT_TOS(skb->nh.iph->tos) } },
.proto = IPPROTO_ICMP };
- if (ip_route_output_key(&rt, &fl))
+ if (ip_route_output_flow(&rt, &fl, NULL, 0))
goto out_unlock;
}
if (icmpv4_xrlim_allow(rt, icmp_param->data.icmph.type,
@@ -521,7 +521,7 @@
.saddr = saddr,
.tos = RT_TOS(tos) } },
.proto = IPPROTO_ICMP };
- if (ip_route_output_key(&rt, &fl))
+ if (ip_route_output_flow(&rt, &fl, NULL, 0))
goto out_unlock;
}
if (ip_options_echo(&icmp_param.replyopts, skb_in))
@@ -549,7 +549,7 @@
.tos = RT_TOS(tos) } },
.proto = IPPROTO_ICMP };
ip_rt_put(rt);
- if (ip_route_output_key(&rt, &fl))
+ if (ip_route_output_flow(&rt, &fl, NULL, 0))
goto out_unlock;
}
diff -Nru a/net/ipv4/igmp.c b/net/ipv4/igmp.c
--- a/net/ipv4/igmp.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/igmp.c 2004-09-17 20:14:58 +09:00
@@ -286,7 +286,7 @@
.nl_u = { .ip4_u = {
.daddr = IGMPV3_ALL_MCR } },
.proto = IPPROTO_IGMP };
- if (ip_route_output_key(&rt, &fl)) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0)) {
kfree_skb(skb);
return NULL;
}
@@ -630,7 +630,7 @@
struct flowi fl = { .oif = dev->ifindex,
.nl_u = { .ip4_u = { .daddr = dst } },
.proto = IPPROTO_IGMP };
- if (ip_route_output_key(&rt, &fl))
+ if (ip_route_output_flow(&rt, &fl, NULL, 0))
return -1;
}
if (rt->rt_src == 0) {
@@ -1317,7 +1317,7 @@
__dev_put(dev);
}
- if (!dev && !ip_route_output_key(&rt, &fl)) {
+ if (!dev && !ip_route_output_flow(&rt, &fl, NULL, 0)) {
dev = rt->u.dst.dev;
ip_rt_put(rt);
}
diff -Nru a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
--- a/net/ipv4/ip_gre.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/ip_gre.c 2004-09-17 20:14:58 +09:00
@@ -481,7 +481,7 @@
fl.fl4_dst = eiph->saddr;
fl.fl4_tos = RT_TOS(eiph->tos);
fl.proto = IPPROTO_GRE;
- if (ip_route_output_key(&rt, &fl)) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0)) {
kfree_skb(skb2);
return;
}
@@ -494,7 +494,7 @@
fl.fl4_dst = eiph->daddr;
fl.fl4_src = eiph->saddr;
fl.fl4_tos = eiph->tos;
- if (ip_route_output_key(&rt, &fl) ||
+ if (ip_route_output_flow(&rt, &fl, NULL, 0) ||
rt->u.dst.dev->type != ARPHRD_IPGRE) {
ip_rt_put(rt);
kfree_skb(skb2);
@@ -751,7 +751,7 @@
.saddr = tiph->saddr,
.tos = RT_TOS(tos) } },
.proto = IPPROTO_GRE };
- if (ip_route_output_key(&rt, &fl)) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0)) {
tunnel->stat.tx_carrier_errors++;
goto tx_error;
}
@@ -1103,7 +1103,7 @@
.tos = RT_TOS(t->parms.iph.tos) } },
.proto = IPPROTO_GRE };
struct rtable *rt;
- if (ip_route_output_key(&rt, &fl))
+ if (ip_route_output_flow(&rt, &fl, NULL, 0))
return -EADDRNOTAVAIL;
dev = rt->u.dst.dev;
ip_rt_put(rt);
@@ -1176,7 +1176,7 @@
.tos = RT_TOS(iph->tos) } },
.proto = IPPROTO_GRE };
struct rtable *rt;
- if (!ip_route_output_key(&rt, &fl)) {
+ if (!ip_route_output_flow(&rt, &fl, NULL, 0)) {
tdev = rt->u.dst.dev;
ip_rt_put(rt);
}
diff -Nru a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
--- a/net/ipv4/ip_output.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/ip_output.c 2004-09-17 20:14:58 +09:00
@@ -1308,7 +1308,7 @@
{ .sport = skb->h.th->dest,
.dport = skb->h.th->source } },
.proto = sk->sk_protocol };
- if (ip_route_output_key(&rt, &fl))
+ if (ip_route_output_flow(&rt, &fl, NULL, 0))
return;
}
diff -Nru a/net/ipv4/ipip.c b/net/ipv4/ipip.c
--- a/net/ipv4/ipip.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/ipip.c 2004-09-17 20:14:58 +09:00
@@ -407,7 +407,7 @@
fl.fl4_daddr = eiph->saddr;
fl.fl4_tos = RT_TOS(eiph->tos);
fl.proto = IPPROTO_IPIP;
- if (ip_route_output_key(&rt, &key)) {
+ if (ip_route_output_flow(&rt, &key, NULL, 0)) {
kfree_skb(skb2);
return;
}
@@ -420,7 +420,7 @@
fl.fl4_daddr = eiph->daddr;
fl.fl4_src = eiph->saddr;
fl.fl4_tos = eiph->tos;
- if (ip_route_output_key(&rt, &fl) ||
+ if (ip_route_output_flow(&rt, &fl, NULL, 0) ||
rt->u.dst.dev->type != ARPHRD_TUNNEL) {
ip_rt_put(rt);
kfree_skb(skb2);
@@ -556,7 +556,7 @@
.saddr = tiph->saddr,
.tos = RT_TOS(tos) } },
.proto = IPPROTO_IPIP };
- if (ip_route_output_key(&rt, &fl)) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0)) {
tunnel->stat.tx_carrier_errors++;
goto tx_error_icmp;
}
@@ -816,7 +816,7 @@
.tos = RT_TOS(iph->tos) } },
.proto = IPPROTO_IPIP };
struct rtable *rt;
- if (!ip_route_output_key(&rt, &fl)) {
+ if (!ip_route_output_flow(&rt, &fl, NULL, 0)) {
tdev = rt->u.dst.dev;
ip_rt_put(rt);
}
diff -Nru a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
--- a/net/ipv4/ipmr.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/ipmr.c 2004-09-17 20:14:58 +09:00
@@ -1156,7 +1156,7 @@
.saddr = vif->local,
.tos = RT_TOS(iph->tos) } },
.proto = IPPROTO_IPIP };
- if (ip_route_output_key(&rt, &fl))
+ if (ip_route_output_flow(&rt, &fl, NULL, 0))
goto out_free;
encap = sizeof(struct iphdr);
} else {
@@ -1165,7 +1165,7 @@
{ .daddr = iph->daddr,
.tos = RT_TOS(iph->tos) } },
.proto = IPPROTO_IPIP };
- if (ip_route_output_key(&rt, &fl))
+ if (ip_route_output_flow(&rt, &fl, NULL, 0))
goto out_free;
}
diff -Nru a/net/ipv4/ipvs/ip_vs_xmit.c b/net/ipv4/ipvs/ip_vs_xmit.c
--- a/net/ipv4/ipvs/ip_vs_xmit.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/ipvs/ip_vs_xmit.c 2004-09-17 20:14:58 +09:00
@@ -77,7 +77,7 @@
.tos = rtos, } },
};
- if (ip_route_output_key(&rt, &fl)) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0)) {
spin_unlock(&dest->dst_lock);
IP_VS_DBG_RL("ip_route_output error, "
"dest: %u.%u.%u.%u\n",
@@ -100,7 +100,7 @@
.tos = rtos, } },
};
- if (ip_route_output_key(&rt, &fl)) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0)) {
IP_VS_DBG_RL("ip_route_output error, dest: "
"%u.%u.%u.%u\n", NIPQUAD(cp->daddr));
return NULL;
@@ -170,7 +170,7 @@
EnterFunction(10);
- if (ip_route_output_key(&rt, &fl)) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0)) {
IP_VS_DBG_RL("ip_vs_bypass_xmit(): ip_route_output error, "
"dest: %u.%u.%u.%u\n", NIPQUAD(iph->daddr));
goto tx_error_icmp;
diff -Nru a/net/ipv4/netfilter/ip_fw_compat_masq.c b/net/ipv4/netfilter/ip_fw_compat_masq.c
--- a/net/ipv4/netfilter/ip_fw_compat_masq.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/netfilter/ip_fw_compat_masq.c 2004-09-17 20:14:58 +09:00
@@ -84,7 +84,7 @@
/* Pass 0 instead of saddr, since it's going to be changed
anyway. */
- if (ip_route_output_key(&rt, &fl) != 0) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0) != 0) {
DEBUGP("ipnat_rule_masquerade: Can't reroute.\n");
return NF_DROP;
}
diff -Nru a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c
--- a/net/ipv4/netfilter/ip_nat_core.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/netfilter/ip_nat_core.c 2004-09-17 20:14:58 +09:00
@@ -213,7 +213,7 @@
struct rtable *rt;
/* FIXME: IPTOS_TOS(iph->tos) --RR */
- if (ip_route_output_key(&rt, &fl) != 0) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0) != 0) {
DEBUGP("do_extra_mangle: Can't get route to %u.%u.%u.%u\n",
NIPQUAD(var_ip));
return 0;
diff -Nru a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c
--- a/net/ipv4/netfilter/ipt_MASQUERADE.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/netfilter/ipt_MASQUERADE.c 2004-09-17 20:14:58 +09:00
@@ -106,7 +106,7 @@
.fwmark = (*pskb)->nfmark
#endif
} } };
- if (ip_route_output_key(&rt, &fl) != 0) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0) != 0) {
/* Funky routing can do this. */
if (net_ratelimit())
printk("MASQUERADE:"
diff -Nru a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
--- a/net/ipv4/netfilter/ipt_REJECT.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/netfilter/ipt_REJECT.c 2004-09-17 20:14:58 +09:00
@@ -71,13 +71,13 @@
fl.nl_u.ip4_u.saddr = iph->daddr;
fl.nl_u.ip4_u.tos = RT_TOS(iph->tos);
- if (ip_route_output_key(&rt, &fl) != 0)
+ if (ip_route_output_flow(&rt, &fl, NULL, 0) != 0)
return NULL;
} else {
/* non-local src, find valid iif to satisfy
* rp-filter when calling ip_route_input. */
fl.nl_u.ip4_u.daddr = iph->daddr;
- if (ip_route_output_key(&rt, &fl) != 0)
+ if (ip_route_output_flow(&rt, &fl, NULL, 0) != 0)
return NULL;
odst = skb->dst;
@@ -300,7 +300,7 @@
{ .daddr = skb_in->nh.iph->saddr,
.saddr = saddr,
.tos = RT_TOS(tos) } } };
- if (ip_route_output_key(&rt, &fl))
+ if (ip_route_output_flow(&rt, &fl, NULL, 0))
return;
}
/* RFC says return as much as we can without exceeding 576 bytes. */
diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c
--- a/net/ipv4/route.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/route.c 2004-09-17 20:14:58 +09:00
@@ -2172,7 +2172,7 @@
goto done;
}
-int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
+int __ip_route_output_flow(struct rtable **rp, const struct flowi *flp)
{
unsigned hash;
struct rtable *rth;
@@ -2206,20 +2206,11 @@
return ip_route_output_slow(rp, flp);
}
-int ip_route_output_key(struct rtable **rp, struct flowi *flp)
-{
- int err;
-
- if ((err = __ip_route_output_key(rp, flp)) != 0)
- return err;
- return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, NULL, 0) : 0;
-}
-
int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags)
{
int err;
- if ((err = __ip_route_output_key(rp, flp)) != 0)
+ if ((err = __ip_route_output_flow(rp, flp)) != 0)
return err;
return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, sk, flags) : 0;
}
@@ -2369,7 +2360,7 @@
if (rta[RTA_OIF - 1])
memcpy(&oif, RTA_DATA(rta[RTA_OIF - 1]), sizeof(int));
fl.oif = oif;
- err = ip_route_output_key(&rt, &fl);
+ err = ip_route_output_flow(&rt, &fl, NULL, 0);
}
if (err)
goto out_free;
@@ -2797,4 +2788,4 @@
EXPORT_SYMBOL(__ip_select_ident);
EXPORT_SYMBOL(ip_route_input);
-EXPORT_SYMBOL(ip_route_output_key);
+EXPORT_SYMBOL(ip_route_output_flow);
diff -Nru a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
--- a/net/ipv4/syncookies.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/syncookies.c 2004-09-17 20:14:58 +09:00
@@ -184,7 +184,7 @@
.uli_u = { .ports =
{ .sport = skb->h.th->dest,
.dport = skb->h.th->source } } };
- if (ip_route_output_key(&rt, &fl)) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0)) {
tcp_openreq_free(req);
goto out;
}
diff -Nru a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
--- a/net/ipv4/xfrm4_policy.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv4/xfrm4_policy.c 2004-09-17 20:14:58 +09:00
@@ -19,7 +19,7 @@
static int xfrm4_dst_lookup(struct xfrm_dst **dst, struct flowi *fl)
{
- return __ip_route_output_key((struct rtable**)dst, fl);
+ return __ip_route_output_flow((struct rtable**)dst, fl);
}
/* Check that the bundle accepts the flow and its components are
diff -Nru a/net/ipv6/sit.c b/net/ipv6/sit.c
--- a/net/ipv6/sit.c 2004-09-17 20:14:58 +09:00
+++ b/net/ipv6/sit.c 2004-09-17 20:14:58 +09:00
@@ -481,7 +481,7 @@
.tos = RT_TOS(tos) } },
.oif = tunnel->parms.link,
.proto = IPPROTO_IPV6 };
- if (ip_route_output_key(&rt, &fl)) {
+ if (ip_route_output_flow(&rt, &fl, NULL, 0)) {
tunnel->stat.tx_carrier_errors++;
goto tx_error_icmp;
}
@@ -749,7 +749,7 @@
.oif = tunnel->parms.link,
.proto = IPPROTO_IPV6 };
struct rtable *rt;
- if (!ip_route_output_key(&rt, &fl)) {
+ if (!ip_route_output_flow(&rt, &fl, NULL, 0)) {
tdev = rt->u.dst.dev;
ip_rt_put(rt);
}
diff -Nru a/net/sctp/protocol.c b/net/sctp/protocol.c
--- a/net/sctp/protocol.c 2004-09-17 20:14:58 +09:00
+++ b/net/sctp/protocol.c 2004-09-17 20:14:58 +09:00
@@ -455,7 +455,7 @@
__FUNCTION__, NIPQUAD(fl.fl4_dst),
NIPQUAD(fl.fl4_src));
- if (!ip_route_output_key(&rt, &fl)) {
+ if (!ip_route_output_flow(&rt, &fl, NULL, 0)) {
dst = &rt->u.dst;
}
@@ -498,7 +498,7 @@
if (AF_INET == laddr->a.sa.sa_family) {
fl.fl4_src = laddr->a.v4.sin_addr.s_addr;
- if (!ip_route_output_key(&rt, &fl)) {
+ if (!ip_route_output_flow(&rt, &fl, NULL, 0)) {
dst = &rt->u.dst;
goto out_unlock;
}
ChangeSet@1.1926, 2004-09-17 20:13:43+09:00, yoshfuji@linux-ipv6.org
[XFRM] make xfrm_lookup() fully af-independent.
This extracts af-dependent portion from xfrm_lookup()
and put it into net/ipv4/route.c:ip_route_output_flow(),
the user of xfrm_lookup() in IPv4 side.
Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c
--- a/net/ipv4/route.c 2004-09-17 20:15:01 +09:00
+++ b/net/ipv4/route.c 2004-09-17 20:15:01 +09:00
@@ -2212,7 +2212,16 @@
if ((err = __ip_route_output_flow(rp, flp)) != 0)
return err;
- return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, sk, flags) : 0;
+
+ if (flp->proto) {
+ if (!flp->fl4_src)
+ flp->fl4_src = (*rp)->rt_src;
+ if (!flp->fl4_dst)
+ flp->fl4_dst = (*rp)->rt_dst;
+ return xfrm_lookup((struct dst_entry **)rp, flp, sk, flags);
+ }
+
+ return 0;
}
static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
diff -Nru a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
--- a/net/xfrm/xfrm_policy.c 2004-09-17 20:15:01 +09:00
+++ b/net/xfrm/xfrm_policy.c 2004-09-17 20:15:01 +09:00
@@ -711,25 +711,11 @@
{
struct xfrm_policy *policy;
struct xfrm_state *xfrm[XFRM_MAX_DEPTH];
- struct rtable *rt = (struct rtable*)*dst_p;
- struct dst_entry *dst;
+ struct dst_entry *dst, *dst_orig = *dst_p;
int nx = 0;
int err;
u32 genid;
- u16 family = (*dst_p)->ops->family;
-
- switch (family) {
- case AF_INET:
- if (!fl->fl4_src)
- fl->fl4_src = rt->rt_src;
- if (!fl->fl4_dst)
- fl->fl4_dst = rt->rt_dst;
- case AF_INET6:
- /* Still not clear... */
- default:
- /* nothing */;
- }
-
+ u16 family = dst_orig->ops->family;
restart:
genid = atomic_read(&flow_cache_genid);
policy = NULL;
@@ -738,7 +724,7 @@
if (!policy) {
/* To accelerate a bit... */
- if ((rt->u.dst.flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT])
+ if ((dst_orig->flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT])
return 0;
policy = flow_cache_lookup(fl, family,
@@ -813,7 +799,7 @@
return 0;
}
- dst = &rt->u.dst;
+ dst = dst_orig;
err = xfrm_bundle_create(policy, xfrm, nx, fl, &dst, family);
if (unlikely(err)) {
@@ -843,12 +829,12 @@
write_unlock_bh(&policy->lock);
}
*dst_p = dst;
- ip_rt_put(rt);
+ dst_release(dst_orig);
xfrm_pol_put(policy);
return 0;
error:
- ip_rt_put(rt);
+ dst_release(dst_orig);
xfrm_pol_put(policy);
*dst_p = NULL;
return err;
--
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] 11+ messages in thread
* Re: [XFRM] Make XFRM core subsystem af-independent
2004-09-17 11:50 [XFRM] Make XFRM core subsystem af-independent YOSHIFUJI Hideaki / 吉藤英明
@ 2004-09-17 12:40 ` Herbert Xu
2004-09-17 14:11 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-17 13:11 ` Herbert Xu
1 sibling, 1 reply; 11+ messages in thread
From: Herbert Xu @ 2004-09-17 12:40 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / ????; +Cc: davem, netdev
YOSHIFUJI Hideaki / ???? <yoshfuji@linux-ipv6.org> wrote:
>
> ChangeSet@1.1925, 2004-09-17 20:13:22+09:00, yoshfuji@linux-ipv6.org
> [IPV4] replace ip_route_output_key() with ip_route_output_flow().
>
> Since ip_route_output_key() is identical to ip_route_output_flow(),
> except for the lack of the sk and the flags arguments,
> let's use the later generic one.
>
> Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
>
> diff -Nru a/net/atm/clip.c b/net/atm/clip.c
> --- a/net/atm/clip.c 2004-09-17 20:14:58 +09:00
> +++ b/net/atm/clip.c 2004-09-17 20:14:58 +09:00
> @@ -556,7 +556,7 @@
> unlink_clip_vcc(clip_vcc);
> return 0;
> }
> - error = ip_route_output_key(&rt,&fl);
> + error = ip_route_output_flow(&rt, &fl, NULL, 0);
Yuck. You've bloated the source as well as the binary for the sake
of deleting one function.
Please provide ip_route_output_key() as an inline wrapper around
ip_route_output_flow() so that its users don't have to change.
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [XFRM] Make XFRM core subsystem af-independent
2004-09-17 11:50 [XFRM] Make XFRM core subsystem af-independent YOSHIFUJI Hideaki / 吉藤英明
2004-09-17 12:40 ` Herbert Xu
@ 2004-09-17 13:11 ` Herbert Xu
1 sibling, 0 replies; 11+ messages in thread
From: Herbert Xu @ 2004-09-17 13:11 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / ????; +Cc: davem, netdev
YOSHIFUJI Hideaki / ???? <yoshfuji@linux-ipv6.org> wrote:
>
> ChangeSet@1.1926, 2004-09-17 20:13:43+09:00, yoshfuji@linux-ipv6.org
> [XFRM] make xfrm_lookup() fully af-independent.
>
> This extracts af-dependent portion from xfrm_lookup()
> and put it into net/ipv4/route.c:ip_route_output_flow(),
> the user of xfrm_lookup() in IPv4 side.
This one looks great.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [XFRM] Make XFRM core subsystem af-independent
2004-09-17 12:40 ` Herbert Xu
@ 2004-09-17 14:11 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-17 22:35 ` David S. Miller
0 siblings, 1 reply; 11+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-09-17 14:11 UTC (permalink / raw)
To: herbert; +Cc: davem, netdev
In article <E1C8I2m-0005BS-00@gondolin.me.apana.org.au> (at Fri, 17 Sep 2004 22:40:52 +1000), Herbert Xu <herbert@gondor.apana.org.au> says:
> Please provide ip_route_output_key() as an inline wrapper around
> ip_route_output_flow() so that its users don't have to change.
No. Because I've succesfully changed all users (AFAIK),
there's no need to keep it.
And, I believe the name "ip_route_output_key()" itself was the bug.
--yoshfuji
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [XFRM] Make XFRM core subsystem af-independent
2004-09-17 14:11 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2004-09-17 22:35 ` David S. Miller
2004-09-17 23:50 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 1 reply; 11+ messages in thread
From: David S. Miller @ 2004-09-17 22:35 UTC (permalink / raw)
To: yoshfuji; +Cc: herbert, netdev
On Fri, 17 Sep 2004 23:11:27 +0900 (JST)
YOSHIFUJI Hideaki / ^[$B5HF#1QL@^[(B <yoshfuji@linux-ipv6.org> wrote:
> In article <E1C8I2m-0005BS-00@gondolin.me.apana.org.au> (at Fri, 17 Sep 2004 22:40:52 +1000), Herbert Xu <herbert@gondor.apana.org.au> says:
>
> > Please provide ip_route_output_key() as an inline wrapper around
> > ip_route_output_flow() so that its users don't have to change.
>
> No. Because I've succesfully changed all users (AFAIK),
> there's no need to keep it.
> And, I believe the name "ip_route_output_key()" itself was the bug.
Herbert is right this time Yoshifuji-san.
Now all these call sites must pass 2 more parameters when
calling ip_route_output_flow() than when they called
ip_route_output_key() with only 2 parameters.
Let's redo this first patch, putting ip_route_output_key()
into net/ipv4/route.c, and have that function pass the
"NULL, 0" final 2 args to ip_route_output_flow().
I see no problem with ip_route_output_key(), you merely made
a textual replacement that made no improvement of any kind
as far as I can see. Instead it made the generated code larger
for each of those call sites you changed (needed to pass in the extra
NULL, 0 arguments). All this was merely so that you only needed
to change one function in your second changeset, but you chould
have achieved that by simply changing ip_route_output_key() into:
int ip_route_output_key(struct rtable **rp, struct flowi *flp)
{
return ip_route_output_flow(rp, flp, NULL, 0);
}
And you therefore could have combined both efforts into
one simple changeset looking like this, which is what I'm
checking into my tree:
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/09/17 15:17:53-07:00 davem@nuts.davemloft.net
# [XFRM] make xfrm_lookup() fully af-independent.
#
# Simplified from 2 patches by Hideaki YOSHIFUJI
# <yoshfuji@linux-ipv6.org>
#
# Signed-off-by: David S. Miller <davem@davemloft.net>
#
# net/xfrm/xfrm_policy.c
# 2004/09/17 15:16:56-07:00 davem@nuts.davemloft.net +6 -20
# [XFRM] make xfrm_lookup() fully af-independent.
#
# net/ipv4/route.c
# 2004/09/17 15:16:56-07:00 davem@nuts.davemloft.net +13 -8
# [XFRM] make xfrm_lookup() fully af-independent.
#
diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c
--- a/net/ipv4/route.c 2004-09-17 15:18:14 -07:00
+++ b/net/ipv4/route.c 2004-09-17 15:18:14 -07:00
@@ -2206,22 +2206,27 @@
return ip_route_output_slow(rp, flp);
}
-int ip_route_output_key(struct rtable **rp, struct flowi *flp)
+int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags)
{
int err;
if ((err = __ip_route_output_key(rp, flp)) != 0)
return err;
- return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, NULL, 0) : 0;
+
+ if (flp->proto) {
+ if (!flp->fl4_src)
+ flp->fl4_src = (*rp)->rt_src;
+ if (!flp->fl4_dst)
+ flp->fl4_dst = (*rp)->rt_dst;
+ return xfrm_lookup((struct dst_entry **)rp, flp, sk, flags);
+ }
+
+ return 0;
}
-int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags)
+int ip_route_output_key(struct rtable **rp, struct flowi *flp)
{
- int err;
-
- if ((err = __ip_route_output_key(rp, flp)) != 0)
- return err;
- return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, sk, flags) : 0;
+ return ip_route_output_flow(rp, flp, NULL, 0);
}
static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
diff -Nru a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
--- a/net/xfrm/xfrm_policy.c 2004-09-17 15:18:14 -07:00
+++ b/net/xfrm/xfrm_policy.c 2004-09-17 15:18:14 -07:00
@@ -711,25 +711,11 @@
{
struct xfrm_policy *policy;
struct xfrm_state *xfrm[XFRM_MAX_DEPTH];
- struct rtable *rt = (struct rtable*)*dst_p;
- struct dst_entry *dst;
+ struct dst_entry *dst, *dst_orig = *dst_p;
int nx = 0;
int err;
u32 genid;
- u16 family = (*dst_p)->ops->family;
-
- switch (family) {
- case AF_INET:
- if (!fl->fl4_src)
- fl->fl4_src = rt->rt_src;
- if (!fl->fl4_dst)
- fl->fl4_dst = rt->rt_dst;
- case AF_INET6:
- /* Still not clear... */
- default:
- /* nothing */;
- }
-
+ u16 family = dst_orig->ops->family;
restart:
genid = atomic_read(&flow_cache_genid);
policy = NULL;
@@ -738,7 +724,7 @@
if (!policy) {
/* To accelerate a bit... */
- if ((rt->u.dst.flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT])
+ if ((dst_orig->flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT])
return 0;
policy = flow_cache_lookup(fl, family,
@@ -813,7 +799,7 @@
return 0;
}
- dst = &rt->u.dst;
+ dst = dst_orig;
err = xfrm_bundle_create(policy, xfrm, nx, fl, &dst, family);
if (unlikely(err)) {
@@ -843,12 +829,12 @@
write_unlock_bh(&policy->lock);
}
*dst_p = dst;
- ip_rt_put(rt);
+ dst_release(dst_orig);
xfrm_pol_put(policy);
return 0;
error:
- ip_rt_put(rt);
+ dst_release(dst_orig);
xfrm_pol_put(policy);
*dst_p = NULL;
return err;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [XFRM] Make XFRM core subsystem af-independent
2004-09-17 22:35 ` David S. Miller
@ 2004-09-17 23:50 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-18 0:06 ` David S. Miller
2004-09-18 0:10 ` Herbert Xu
0 siblings, 2 replies; 11+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-09-17 23:50 UTC (permalink / raw)
To: davem; +Cc: herbert, netdev, yoshfuji
Hello.
In article <20040917153536.6acec52e.davem@davemloft.net> (at Fri, 17 Sep 2004 15:35:36 -0700), "David S. Miller" <davem@davemloft.net> says:
> Now all these call sites must pass 2 more parameters when
> calling ip_route_output_flow() than when they called
> ip_route_output_key() with only 2 parameters.
Okay, let me explain.
Honestly speaking, I had (at least) 4 options.
1. change two functions (_key and _flow)
- maintenancability issues
2. David's one
- maintenancability will be improved
- maintains exported symbols for binary-only modules.
- more function call and more stack usage.
3. inlined __ip_route_output_flow() + ip_route_output_flow(), ip_route_output_key
- maintenancability will be improved
- breaks binary-only modules.
- code size.
4. migrate completely (my one)
- maintenancability will be improved
- breaks binary-only modules.
- best stack usage, minimum function call, code size.
- changes more places.
> Let's redo this first patch, putting ip_route_output_key()
> into net/ipv4/route.c, and have that function pass the
> "NULL, 0" final 2 args to ip_route_output_flow().
This increases function calls and uses more stack.
It seemd downgrade to me.
This is the reason I did not make such patch.
> And you therefore could have combined both efforts into
> one simple changeset looking like this, which is what I'm
> checking into my tree:
THANK YOU.
--
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] 11+ messages in thread
* Re: [XFRM] Make XFRM core subsystem af-independent
2004-09-17 23:50 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2004-09-18 0:06 ` David S. Miller
2004-09-18 0:12 ` Herbert Xu
2004-09-18 0:16 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-18 0:10 ` Herbert Xu
1 sibling, 2 replies; 11+ messages in thread
From: David S. Miller @ 2004-09-18 0:06 UTC (permalink / raw)
To: yoshfuji; +Cc: herbert, netdev
On Sat, 18 Sep 2004 08:50:03 +0900 (JST)
YOSHIFUJI Hideaki / ^[$B5HF#1QL@^[(B <yoshfuji@linux-ipv6.org> wrote:
> 2. David's one
> - maintenancability will be improved
> - maintains exported symbols for binary-only modules.
> - more function call and more stack usage.
Compiler is smarter than you think :-)
The whole stack frame is eliminated, because gcc
optimizes it away using tail-call optimizations.
Look at the assembler output for
net/ipv4/route.c:ip_route_output_key() after applying
my changes.
On sparc64 it looks like this:
ip_route_output_key:
mov 0, %o2
mov 0, %o3
or %o7, %g0, %g1
call ip_route_output_flow, 0
or %g1, %g0, %o7
No stack frame allocated at all, it basically amounts to
a branch and clearing two argument registers.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [XFRM] Make XFRM core subsystem af-independent
2004-09-17 23:50 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-18 0:06 ` David S. Miller
@ 2004-09-18 0:10 ` Herbert Xu
1 sibling, 0 replies; 11+ messages in thread
From: Herbert Xu @ 2004-09-18 0:10 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / ?$B5HF#1QL@; +Cc: davem, netdev
On Sat, Sep 18, 2004 at 08:50:03AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:
>
> 3. inlined __ip_route_output_flow() + ip_route_output_flow(), ip_route_output_key
> - maintenancability will be improved
> - breaks binary-only modules.
> - code size.
> 4. migrate completely (my one)
> - maintenancability will be improved
> - breaks binary-only modules.
> - best stack usage, minimum function call, code size.
> - changes more places.
You missed the more obvious version of 3:
5. inline ip_route_output_key() only
That is exactly the same as 4 except that it doesn't cause ripple
effects all over the place.
However, I really don't think 16 bytes of stack usage is anything
to write home about :)
Actually, there is a solution to that as well:
6. Add an inline version of __ip_route_output_flow() in route.c and
get ip_route_output_flow/ip_route_output_key to use that.
It'll generate code slightly bigger than 2 but is vastly smaller than 4.
Otherwise it has all the advantages of 2 and 4.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [XFRM] Make XFRM core subsystem af-independent
2004-09-18 0:06 ` David S. Miller
@ 2004-09-18 0:12 ` Herbert Xu
2004-09-18 1:24 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-18 0:16 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 1 reply; 11+ messages in thread
From: Herbert Xu @ 2004-09-18 0:12 UTC (permalink / raw)
To: David S. Miller; +Cc: yoshfuji, netdev
On Fri, Sep 17, 2004 at 05:06:07PM -0700, David S. Miller wrote:
>
> Compiler is smarter than you think :-)
Sparc bigots :)
Unfortunately it can't do that on architectures where the arguments
are pushed onto the stack in reverse order, i.e., i386.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [XFRM] Make XFRM core subsystem af-independent
2004-09-18 0:06 ` David S. Miller
2004-09-18 0:12 ` Herbert Xu
@ 2004-09-18 0:16 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 0 replies; 11+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-09-18 0:16 UTC (permalink / raw)
To: davem; +Cc: herbert, netdev
In article <20040917170607.2e96b58a.davem@davemloft.net> (at Fri, 17 Sep 2004 17:06:07 -0700), "David S. Miller" <davem@davemloft.net> says:
> > 2. David's one
> > - maintenancability will be improved
> > - maintains exported symbols for binary-only modules.
> > - more function call and more stack usage.
>
> Compiler is smarter than you think :-)
>
> The whole stack frame is eliminated, because gcc
> optimizes it away using tail-call optimizations.
Okay, thank you for explanation.
I'm not sure (and have some doubt) on i386,
but I am now smarter than before. :-)
--yoshfuji
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [XFRM] Make XFRM core subsystem af-independent
2004-09-18 0:12 ` Herbert Xu
@ 2004-09-18 1:24 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 0 replies; 11+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-09-18 1:24 UTC (permalink / raw)
To: herbert; +Cc: davem, netdev, yoshfuji
In article <20040918001216.GB24235@gondor.apana.org.au> (at Sat, 18 Sep 2004 10:12:16 +1000), Herbert Xu <herbert@gondor.apana.org.au> says:
> On Fri, Sep 17, 2004 at 05:06:07PM -0700, David S. Miller wrote:
> >
> > Compiler is smarter than you think :-)
>
> Sparc bigots :)
>
> Unfortunately it can't do that on architectures where the arguments
> are pushed onto the stack in reverse order, i.e., i386.
I've tested on i386.
.globl ip_route_output_key
.type ip_route_output_key,@function
ip_route_output_key:
movl 4(%esp),%edx
movl 8(%esp),%eax
pushl $0
pushl $0
pushl %eax
pushl %edx
call ip_route_output_flow
addl $16,%esp
ret
This is not good.
We, however, now have (up to 3) register parameters on i386 (CONFIG_REGPARM),
and assembly code is:
.globl ip_route_output_key
.type ip_route_output_key,@function
ip_route_output_key:
pushl $0
xorl %ecx, %ecx
call ip_route_output_flow
popl %ecx
ret
This is (not good as sparc, but) not bad
(well, much better than before at least).
--
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] 11+ messages in thread
end of thread, other threads:[~2004-09-18 1:24 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-17 11:50 [XFRM] Make XFRM core subsystem af-independent YOSHIFUJI Hideaki / 吉藤英明
2004-09-17 12:40 ` Herbert Xu
2004-09-17 14:11 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-17 22:35 ` David S. Miller
2004-09-17 23:50 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-18 0:06 ` David S. Miller
2004-09-18 0:12 ` Herbert Xu
2004-09-18 1:24 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-18 0:16 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-18 0:10 ` Herbert Xu
2004-09-17 13:11 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.