diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2017-04-02 17:53:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-03 22:04:48 -0400 |
commit | ec2e45a978b05cd9711e804a41b8a5bc829a8650 (patch) | |
tree | dce827fc16f1119dc93208ccb1d43bbcaf838357 | |
parent | f31cc7e8155f392583a1e3cc2e83ddbc43bacbb3 (diff) |
flowcache: more "unsigned int"
Make ->hash_count, ->low_watermark and ->high_watermark unsigned int
and propagate unsignedness to other variables.
This change doesn't change code generation because these fields aren't
used in 64-bit contexts but make it anyway: these fields can't be
negative numbers.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/flowcache.h | 6 | ||||
-rw-r--r-- | net/core/flow.c | 13 |
2 files changed, 10 insertions, 9 deletions
diff --git a/include/net/flowcache.h b/include/net/flowcache.h index 9caf3bfc8d2d..51eb971e8973 100644 --- a/include/net/flowcache.h +++ b/include/net/flowcache.h | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | struct flow_cache_percpu { | 9 | struct flow_cache_percpu { |
10 | struct hlist_head *hash_table; | 10 | struct hlist_head *hash_table; |
11 | int hash_count; | 11 | unsigned int hash_count; |
12 | u32 hash_rnd; | 12 | u32 hash_rnd; |
13 | int hash_rnd_recalc; | 13 | int hash_rnd_recalc; |
14 | struct tasklet_struct flush_tasklet; | 14 | struct tasklet_struct flush_tasklet; |
@@ -18,8 +18,8 @@ struct flow_cache { | |||
18 | u32 hash_shift; | 18 | u32 hash_shift; |
19 | struct flow_cache_percpu __percpu *percpu; | 19 | struct flow_cache_percpu __percpu *percpu; |
20 | struct hlist_node node; | 20 | struct hlist_node node; |
21 | int low_watermark; | 21 | unsigned int low_watermark; |
22 | int high_watermark; | 22 | unsigned int high_watermark; |
23 | struct timer_list rnd_timer; | 23 | struct timer_list rnd_timer; |
24 | }; | 24 | }; |
25 | #endif /* _NET_FLOWCACHE_H */ | 25 | #endif /* _NET_FLOWCACHE_H */ |
diff --git a/net/core/flow.c b/net/core/flow.c index 923156d2a750..f7f5d1932a27 100644 --- a/net/core/flow.c +++ b/net/core/flow.c | |||
@@ -99,7 +99,8 @@ static void flow_cache_gc_task(struct work_struct *work) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | static void flow_cache_queue_garbage(struct flow_cache_percpu *fcp, | 101 | static void flow_cache_queue_garbage(struct flow_cache_percpu *fcp, |
102 | int deleted, struct list_head *gc_list, | 102 | unsigned int deleted, |
103 | struct list_head *gc_list, | ||
103 | struct netns_xfrm *xfrm) | 104 | struct netns_xfrm *xfrm) |
104 | { | 105 | { |
105 | if (deleted) { | 106 | if (deleted) { |
@@ -114,18 +115,18 @@ static void flow_cache_queue_garbage(struct flow_cache_percpu *fcp, | |||
114 | 115 | ||
115 | static void __flow_cache_shrink(struct flow_cache *fc, | 116 | static void __flow_cache_shrink(struct flow_cache *fc, |
116 | struct flow_cache_percpu *fcp, | 117 | struct flow_cache_percpu *fcp, |
117 | int shrink_to) | 118 | unsigned int shrink_to) |
118 | { | 119 | { |
119 | struct flow_cache_entry *fle; | 120 | struct flow_cache_entry *fle; |
120 | struct hlist_node *tmp; | 121 | struct hlist_node *tmp; |
121 | LIST_HEAD(gc_list); | 122 | LIST_HEAD(gc_list); |
122 | int deleted = 0; | 123 | unsigned int deleted = 0; |
123 | struct netns_xfrm *xfrm = container_of(fc, struct netns_xfrm, | 124 | struct netns_xfrm *xfrm = container_of(fc, struct netns_xfrm, |
124 | flow_cache_global); | 125 | flow_cache_global); |
125 | unsigned int i; | 126 | unsigned int i; |
126 | 127 | ||
127 | for (i = 0; i < flow_cache_hash_size(fc); i++) { | 128 | for (i = 0; i < flow_cache_hash_size(fc); i++) { |
128 | int saved = 0; | 129 | unsigned int saved = 0; |
129 | 130 | ||
130 | hlist_for_each_entry_safe(fle, tmp, | 131 | hlist_for_each_entry_safe(fle, tmp, |
131 | &fcp->hash_table[i], u.hlist) { | 132 | &fcp->hash_table[i], u.hlist) { |
@@ -146,7 +147,7 @@ static void __flow_cache_shrink(struct flow_cache *fc, | |||
146 | static void flow_cache_shrink(struct flow_cache *fc, | 147 | static void flow_cache_shrink(struct flow_cache *fc, |
147 | struct flow_cache_percpu *fcp) | 148 | struct flow_cache_percpu *fcp) |
148 | { | 149 | { |
149 | int shrink_to = fc->low_watermark / flow_cache_hash_size(fc); | 150 | unsigned int shrink_to = fc->low_watermark / flow_cache_hash_size(fc); |
150 | 151 | ||
151 | __flow_cache_shrink(fc, fcp, shrink_to); | 152 | __flow_cache_shrink(fc, fcp, shrink_to); |
152 | } | 153 | } |
@@ -296,7 +297,7 @@ static void flow_cache_flush_tasklet(unsigned long data) | |||
296 | struct flow_cache_entry *fle; | 297 | struct flow_cache_entry *fle; |
297 | struct hlist_node *tmp; | 298 | struct hlist_node *tmp; |
298 | LIST_HEAD(gc_list); | 299 | LIST_HEAD(gc_list); |
299 | int deleted = 0; | 300 | unsigned int deleted = 0; |
300 | struct netns_xfrm *xfrm = container_of(fc, struct netns_xfrm, | 301 | struct netns_xfrm *xfrm = container_of(fc, struct netns_xfrm, |
301 | flow_cache_global); | 302 | flow_cache_global); |
302 | unsigned int i; | 303 | unsigned int i; |