]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
flowcache: more "unsigned int"
authorAlexey Dobriyan <adobriyan@gmail.com>
Sun, 2 Apr 2017 21:53:15 +0000 (00:53 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Apr 2017 02:04:48 +0000 (19:04 -0700)
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>
include/net/flowcache.h
net/core/flow.c

index 9caf3bfc8d2dafcc89064ec54e78682244d71fb7..51eb971e897378e25329b06f80678f522eec2ea6 100644 (file)
@@ -8,7 +8,7 @@
 
 struct flow_cache_percpu {
        struct hlist_head               *hash_table;
-       int                             hash_count;
+       unsigned int                    hash_count;
        u32                             hash_rnd;
        int                             hash_rnd_recalc;
        struct tasklet_struct           flush_tasklet;
@@ -18,8 +18,8 @@ struct flow_cache {
        u32                             hash_shift;
        struct flow_cache_percpu __percpu *percpu;
        struct hlist_node               node;
-       int                             low_watermark;
-       int                             high_watermark;
+       unsigned int                    low_watermark;
+       unsigned int                    high_watermark;
        struct timer_list               rnd_timer;
 };
 #endif /* _NET_FLOWCACHE_H */
index 923156d2a750ac571f634f2c2b00b4dd7181a76a..f7f5d1932a2720767dd31f4033f196815ff08447 100644 (file)
@@ -99,7 +99,8 @@ static void flow_cache_gc_task(struct work_struct *work)
 }
 
 static void flow_cache_queue_garbage(struct flow_cache_percpu *fcp,
-                                    int deleted, struct list_head *gc_list,
+                                    unsigned int deleted,
+                                    struct list_head *gc_list,
                                     struct netns_xfrm *xfrm)
 {
        if (deleted) {
@@ -114,18 +115,18 @@ static void flow_cache_queue_garbage(struct flow_cache_percpu *fcp,
 
 static void __flow_cache_shrink(struct flow_cache *fc,
                                struct flow_cache_percpu *fcp,
-                               int shrink_to)
+                               unsigned int shrink_to)
 {
        struct flow_cache_entry *fle;
        struct hlist_node *tmp;
        LIST_HEAD(gc_list);
-       int deleted = 0;
+       unsigned int deleted = 0;
        struct netns_xfrm *xfrm = container_of(fc, struct netns_xfrm,
                                                flow_cache_global);
        unsigned int i;
 
        for (i = 0; i < flow_cache_hash_size(fc); i++) {
-               int saved = 0;
+               unsigned int saved = 0;
 
                hlist_for_each_entry_safe(fle, tmp,
                                          &fcp->hash_table[i], u.hlist) {
@@ -146,7 +147,7 @@ static void __flow_cache_shrink(struct flow_cache *fc,
 static void flow_cache_shrink(struct flow_cache *fc,
                              struct flow_cache_percpu *fcp)
 {
-       int shrink_to = fc->low_watermark / flow_cache_hash_size(fc);
+       unsigned int shrink_to = fc->low_watermark / flow_cache_hash_size(fc);
 
        __flow_cache_shrink(fc, fcp, shrink_to);
 }
@@ -296,7 +297,7 @@ static void flow_cache_flush_tasklet(unsigned long data)
        struct flow_cache_entry *fle;
        struct hlist_node *tmp;
        LIST_HEAD(gc_list);
-       int deleted = 0;
+       unsigned int deleted = 0;
        struct netns_xfrm *xfrm = container_of(fc, struct netns_xfrm,
                                                flow_cache_global);
        unsigned int i;