diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-11-14 00:33:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:53:37 -0500 |
commit | b4ce92775c2e7ff9cf79cca4e0a19c8c5fd6287b (patch) | |
tree | c057ff62b03582493b74005f7959a0207e748468 | |
parent | 550ade8432a2a6fbfb48ba7018750b0e8c81e8d0 (diff) |
[IPV6]: Move nfheader_len into rt6_info
The dst member nfheader_len is only used by IPv6. It's also currently
creating a rather ugly alignment hole in struct dst. Therefore this patch
moves it from there into struct rt6_info.
It also reorders the fields in rt6_info to minimize holes.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/dst.h | 1 | ||||
-rw-r--r-- | include/net/ip6_fib.h | 11 | ||||
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 1 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 5 | ||||
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 3 |
5 files changed, 13 insertions, 8 deletions
diff --git a/include/net/dst.h b/include/net/dst.h index 2f65e894b829..69888f1502b1 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -50,7 +50,6 @@ struct dst_entry | |||
50 | unsigned long expires; | 50 | unsigned long expires; |
51 | 51 | ||
52 | unsigned short header_len; /* more space at head required */ | 52 | unsigned short header_len; /* more space at head required */ |
53 | unsigned short nfheader_len; /* more non-fragment space at head required */ | ||
54 | unsigned short trailer_len; /* space to reserve at tail */ | 53 | unsigned short trailer_len; /* space to reserve at tail */ |
55 | 54 | ||
56 | u32 metrics[RTAX_MAX]; | 55 | u32 metrics[RTAX_MAX]; |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 857821360bb6..4cefcffe773e 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -99,16 +99,21 @@ struct rt6_info | |||
99 | u32 rt6i_flags; | 99 | u32 rt6i_flags; |
100 | u32 rt6i_metric; | 100 | u32 rt6i_metric; |
101 | atomic_t rt6i_ref; | 101 | atomic_t rt6i_ref; |
102 | struct fib6_table *rt6i_table; | ||
103 | 102 | ||
104 | struct rt6key rt6i_dst; | 103 | /* more non-fragment space at head required */ |
105 | struct rt6key rt6i_src; | 104 | unsigned short nfheader_len; |
106 | 105 | ||
107 | u8 rt6i_protocol; | 106 | u8 rt6i_protocol; |
108 | 107 | ||
108 | struct fib6_table *rt6i_table; | ||
109 | |||
110 | struct rt6key rt6i_dst; | ||
111 | |||
109 | #ifdef CONFIG_XFRM | 112 | #ifdef CONFIG_XFRM |
110 | u32 rt6i_flow_cache_genid; | 113 | u32 rt6i_flow_cache_genid; |
111 | #endif | 114 | #endif |
115 | |||
116 | struct rt6key rt6i_src; | ||
112 | }; | 117 | }; |
113 | 118 | ||
114 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | 119 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index cc86fb110dd8..5ee3a2f9fb27 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -161,7 +161,6 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
161 | dst_prev->flags |= DST_HOST; | 161 | dst_prev->flags |= DST_HOST; |
162 | dst_prev->lastuse = jiffies; | 162 | dst_prev->lastuse = jiffies; |
163 | dst_prev->header_len = header_len; | 163 | dst_prev->header_len = header_len; |
164 | dst_prev->nfheader_len = 0; | ||
165 | dst_prev->trailer_len = trailer_len; | 164 | dst_prev->trailer_len = trailer_len; |
166 | memcpy(&dst_prev->metrics, &x->route->metrics, sizeof(dst_prev->metrics)); | 165 | memcpy(&dst_prev->metrics, &x->route->metrics, sizeof(dst_prev->metrics)); |
167 | 166 | ||
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 150615758fdc..387030d2483c 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1099,7 +1099,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
1099 | sk->sk_sndmsg_page = NULL; | 1099 | sk->sk_sndmsg_page = NULL; |
1100 | sk->sk_sndmsg_off = 0; | 1100 | sk->sk_sndmsg_off = 0; |
1101 | exthdrlen = rt->u.dst.header_len + (opt ? opt->opt_flen : 0) - | 1101 | exthdrlen = rt->u.dst.header_len + (opt ? opt->opt_flen : 0) - |
1102 | rt->u.dst.nfheader_len; | 1102 | rt->nfheader_len; |
1103 | length += exthdrlen; | 1103 | length += exthdrlen; |
1104 | transhdrlen += exthdrlen; | 1104 | transhdrlen += exthdrlen; |
1105 | } else { | 1105 | } else { |
@@ -1114,7 +1114,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
1114 | 1114 | ||
1115 | hh_len = LL_RESERVED_SPACE(rt->u.dst.dev); | 1115 | hh_len = LL_RESERVED_SPACE(rt->u.dst.dev); |
1116 | 1116 | ||
1117 | fragheaderlen = sizeof(struct ipv6hdr) + rt->u.dst.nfheader_len + (opt ? opt->opt_nflen : 0); | 1117 | fragheaderlen = sizeof(struct ipv6hdr) + rt->nfheader_len + |
1118 | (opt ? opt->opt_nflen : 0); | ||
1118 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr); | 1119 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr); |
1119 | 1120 | ||
1120 | if (mtu <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) { | 1121 | if (mtu <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) { |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 3cad3e8dc4da..5b02f0efd38e 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -157,7 +157,8 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
157 | dst_prev = dst1; | 157 | dst_prev = dst1; |
158 | 158 | ||
159 | if (xfrm[i]->type->flags & XFRM_TYPE_NON_FRAGMENT) | 159 | if (xfrm[i]->type->flags & XFRM_TYPE_NON_FRAGMENT) |
160 | dst->nfheader_len += xfrm[i]->props.header_len; | 160 | ((struct rt6_info *)dst)->nfheader_len += |
161 | xfrm[i]->props.header_len; | ||
161 | header_len += xfrm[i]->props.header_len; | 162 | header_len += xfrm[i]->props.header_len; |
162 | trailer_len += xfrm[i]->props.trailer_len; | 163 | trailer_len += xfrm[i]->props.trailer_len; |
163 | 164 | ||