aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/flow.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-02-22 21:44:31 -0500
committerDavid S. Miller <davem@davemloft.net>2011-02-22 21:44:31 -0500
commitdee9f4bceb5fd9dbfcc1567148fccdbf16d6a38a (patch)
tree4b88bec4650dbc539594ae5027d7a1e34c196c88 /net/core/flow.c
parent4ca2e685114c55e6777022a46849795d2aa1d31a (diff)
net: Make flow cache paths use a const struct flowi.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/flow.c')
-rw-r--r--net/core/flow.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/core/flow.c b/net/core/flow.c
index 127c8a7ffd61..990703b8863b 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -172,9 +172,9 @@ static void flow_new_hash_rnd(struct flow_cache *fc,
172 172
173static u32 flow_hash_code(struct flow_cache *fc, 173static u32 flow_hash_code(struct flow_cache *fc,
174 struct flow_cache_percpu *fcp, 174 struct flow_cache_percpu *fcp,
175 struct flowi *key) 175 const struct flowi *key)
176{ 176{
177 u32 *k = (u32 *) key; 177 const u32 *k = (const u32 *) key;
178 178
179 return jhash2(k, (sizeof(*key) / sizeof(u32)), fcp->hash_rnd) 179 return jhash2(k, (sizeof(*key) / sizeof(u32)), fcp->hash_rnd)
180 & (flow_cache_hash_size(fc) - 1); 180 & (flow_cache_hash_size(fc) - 1);
@@ -186,17 +186,17 @@ typedef unsigned long flow_compare_t;
186 * important assumptions that we can here, such as alignment and 186 * important assumptions that we can here, such as alignment and
187 * constant size. 187 * constant size.
188 */ 188 */
189static int flow_key_compare(struct flowi *key1, struct flowi *key2) 189static int flow_key_compare(const struct flowi *key1, const struct flowi *key2)
190{ 190{
191 flow_compare_t *k1, *k1_lim, *k2; 191 const flow_compare_t *k1, *k1_lim, *k2;
192 const int n_elem = sizeof(struct flowi) / sizeof(flow_compare_t); 192 const int n_elem = sizeof(struct flowi) / sizeof(flow_compare_t);
193 193
194 BUILD_BUG_ON(sizeof(struct flowi) % sizeof(flow_compare_t)); 194 BUILD_BUG_ON(sizeof(struct flowi) % sizeof(flow_compare_t));
195 195
196 k1 = (flow_compare_t *) key1; 196 k1 = (const flow_compare_t *) key1;
197 k1_lim = k1 + n_elem; 197 k1_lim = k1 + n_elem;
198 198
199 k2 = (flow_compare_t *) key2; 199 k2 = (const flow_compare_t *) key2;
200 200
201 do { 201 do {
202 if (*k1++ != *k2++) 202 if (*k1++ != *k2++)
@@ -207,7 +207,7 @@ static int flow_key_compare(struct flowi *key1, struct flowi *key2)
207} 207}
208 208
209struct flow_cache_object * 209struct flow_cache_object *
210flow_cache_lookup(struct net *net, struct flowi *key, u16 family, u8 dir, 210flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir,
211 flow_resolve_t resolver, void *ctx) 211 flow_resolve_t resolver, void *ctx)
212{ 212{
213 struct flow_cache *fc = &flow_cache_global; 213 struct flow_cache *fc = &flow_cache_global;