ipv4: Remove flowi from struct rtable.
Subsystems (4)
David Miller
maintainerRFC PATCH v3 5/8 ipv4: Remove flowi from struct rtable.
The only necessary parts are the src/dst addresses, the interface indexes, the TOS, and the mark.
The rest is unnecessary bloat, which amounts to nearly 50 bytes on 64-bit.
Signed-off-by David S. Miller <[email protected]>
--- include/net/route.h | 24 +++++++----- net/ipv4/icmp.c | 2 +- net/ipv4/ipmr.c | 52 ++++++++++++++++++++----- net/ipv4/route.c | 95 ++++++++++++++++++++++++++-------------------- net/ipv4/xfrm4_policy.c | 7 +++- 5 files changed, 116 insertions(+), 64 deletions(-)
include/net/route.h +14 -10
@@ -53,16 +53,20 @@ struct fib_info;struct rtable {struct dst_entry dst; -/* Cache lookup keys */ -struct flowi fl; +/* Lookup key. */ +__be32 rt_key_dst; +__be32 rt_key_src;int rt_genid;unsigned rt_flags;__u16 rt_type; +__u8 rt_tos;__be32 rt_dst;/* Path destination */ __be32 rt_src;/* Path source */ int rt_iif; +int rt_oif; +__u32 rt_mark;/* Info on neighbour */ __be32 rt_gateway;
@@ -76,12 +80,12 @@ struct rtable {static inline bool rt_is_input_route (struct rtable *rt) { -return rt->fl.iif !=0 ; +return rt->rt_iif !=0 ; }static inline bool rt_is_output_route (struct rtable *rt) { -return rt->fl.iif ==0 ; +return rt->rt_iif ==0 ; }struct ip_rt_acct {
@@ -199,12 +203,12 @@ static inline struct rtable *ip_route_newports(struct rtable *rt, __be16 dport, struct sock *sk) {if (sport != orig_sport || dport != orig_dport) { -struct flowi fl = { .oif = rt->fl.oif, - .mark = rt->fl.mark, - .fl4_dst = rt->fl.fl4_dst, - .fl4_src = rt->fl.fl4_src, - .fl4_tos = rt->fl.fl4_tos, - .proto = rt->fl.proto, +struct flowi fl = { .oif = rt->rt_oif, + .mark = rt->rt_mark, + .fl4_dst = rt->rt_key_dst, + .fl4_src = rt->rt_key_src, + .fl4_tos = rt->rt_tos, + .proto = protocol, .fl_ip_sport = sport, .fl_ip_dport = dport };
net/ipv4/icmp.c +1 -1
@@ -563,7 +563,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)rcu_read_lock ();if (rt_is_input_route (rt) && net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr) - dev =dev_get_by_index_rcu (net, rt->fl.iif); + dev =dev_get_by_index_rcu (net, rt->rt_iif);if (dev) saddr =inet_select_addr (dev,0 ,RT_SCOPE_LINK );
net/ipv4/ipmr.c +41 -11
71 lines not on this page · raw message
net/ipv4/route.c +54 -41
222 lines not on this page · raw message
net/ipv4/xfrm4_policy.c +6 -1
@@ -70,7 +70,12 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, {struct rtable *rt = (struct rtable *)xdst->route; - xdst->u.rt.fl = *fl; + rt->rt_key_dst = fl->fl4_dst; + rt->rt_key_src = fl->fl4_src; + rt->rt_tos = fl->fl4_tos; + rt->rt_iif = fl->iif; + rt->rt_oif = fl->oif; + rt->rt_mark = fl->mark; xdst->u.dst.dev = dev;dev_hold (dev);
Signature · 1 line
1.7.4.1