diff options
author | David S. Miller <davem@davemloft.net> | 2011-01-28 01:01:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-28 01:01:53 -0500 |
commit | a4daad6b0923030fbd3b00a01f570e4c3eef446b (patch) | |
tree | b8e5b9a2110628503e57149f0bb2a4bb1bf3f027 /include/net/route.h | |
parent | 8571a19c4ac140f1a507f3e7eb716892afa27109 (diff) |
net: Pre-COW metrics for TCP.
TCP is going to record metrics for the connection,
so pre-COW the route metrics at route cache entry
creation time.
This avoids several atomic operations that have to
occur if we COW the metrics after the entry reaches
global visibility.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/route.h')
-rw-r--r-- | include/net/route.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/route.h b/include/net/route.h index 5677cbf0c6e6..e5864658dc76 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -182,6 +182,8 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
182 | 182 | ||
183 | if (inet_sk(sk)->transparent) | 183 | if (inet_sk(sk)->transparent) |
184 | fl.flags |= FLOWI_FLAG_ANYSRC; | 184 | fl.flags |= FLOWI_FLAG_ANYSRC; |
185 | if (protocol == IPPROTO_TCP) | ||
186 | fl.flags |= FLOWI_FLAG_PRECOW_METRICS; | ||
185 | 187 | ||
186 | if (!dst || !src) { | 188 | if (!dst || !src) { |
187 | err = __ip_route_output_key(net, rp, &fl); | 189 | err = __ip_route_output_key(net, rp, &fl); |
@@ -209,6 +211,8 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
209 | fl.proto = protocol; | 211 | fl.proto = protocol; |
210 | if (inet_sk(sk)->transparent) | 212 | if (inet_sk(sk)->transparent) |
211 | fl.flags |= FLOWI_FLAG_ANYSRC; | 213 | fl.flags |= FLOWI_FLAG_ANYSRC; |
214 | if (protocol == IPPROTO_TCP) | ||
215 | fl.flags |= FLOWI_FLAG_PRECOW_METRICS; | ||
212 | ip_rt_put(*rp); | 216 | ip_rt_put(*rp); |
213 | *rp = NULL; | 217 | *rp = NULL; |
214 | security_sk_classify_flow(sk, &fl); | 218 | security_sk_classify_flow(sk, &fl); |