]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
netns: make struct pernet_operations::id unsigned int
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 17 Nov 2016 01:58:21 +0000 (04:58 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Nov 2016 15:59:15 +0000 (10:59 -0500)
Make struct pernet_operations::id unsigned.

There are 2 reasons to do so:

1)
This field is really an index into an zero based array and
thus is unsigned entity. Using negative value is out-of-bound
access by definition.

2)
On x86_64 unsigned 32-bit data which are mixed with pointers
via array indexing or offsets added or subtracted to pointers
are preffered to signed 32-bit data.

"int" being used as an array index needs to be sign-extended
to 64-bit before being used.

void f(long *p, int i)
{
g(p[i]);
}

  roughly translates to

movsx rsi, esi
mov rdi, [rsi+...]
call  g

MOVSX is 3 byte instruction which isn't necessary if the variable is
unsigned because x86_64 is zero extending by default.

Now, there is net_generic() function which, you guessed it right, uses
"int" as an array index:

static inline void *net_generic(const struct net *net, int id)
{
...
ptr = ng->ptr[id - 1];
...
}

And this function is used a lot, so those sign extensions add up.

Patch snipes ~1730 bytes on allyesconfig kernel (without all junk
messing with code generation):

add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)

Unfortunately some functions actually grow bigger.
This is a semmingly random artefact of code generation with register
allocator being used differently. gcc decides that some variable
needs to live in new r8+ registers and every access now requires REX
prefix. Or it is shifted into r12, so [r12+0] addressing mode has to be
used which is longer than [r8]

However, overall balance is in negative direction:

add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)
function                                     old     new   delta
nfsd4_lock                                  3886    3959     +73
tipc_link_build_proto_msg                   1096    1140     +44
mac80211_hwsim_new_radio                    2776    2808     +32
tipc_mon_rcv                                1032    1058     +26
svcauth_gss_legacy_init                     1413    1429     +16
tipc_bcbase_select_primary                   379     392     +13
nfsd4_exchange_id                           1247    1260     +13
nfsd4_setclientid_confirm                    782     793     +11
...
put_client_renew_locked                      494     480     -14
ip_set_sockfn_get                            730     716     -14
geneve_sock_add                              829     813     -16
nfsd4_sequence_done                          721     703     -18
nlmclnt_lookup_host                          708     686     -22
nfsd4_lockt                                 1085    1063     -22
nfs_get_client                              1077    1050     -27
tcf_bpf_init                                1106    1076     -30
nfsd4_encode_fattr                          5997    5930     -67
Total: Before=154856051, After=154854321, chg -0.00%

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
73 files changed:
drivers/infiniband/core/cma.c
drivers/net/bonding/bond_main.c
drivers/net/geneve.c
drivers/net/gtp.c
drivers/net/ppp/ppp_generic.c
drivers/net/ppp/pppoe.c
drivers/net/vxlan.c
drivers/net/wireless/mac80211_hwsim.c
fs/lockd/netns.h
fs/lockd/svc.c
fs/nfs/inode.c
fs/nfs/netns.h
fs/nfs_common/grace.c
fs/nfsd/netns.h
fs/nfsd/nfsctl.c
include/net/bonding.h
include/net/ip_tunnels.h
include/net/net_namespace.h
include/net/netfilter/nf_conntrack_l4proto.h
include/net/netfilter/nf_conntrack_synproxy.h
include/net/netns/generic.h
kernel/audit.c
net/8021q/vlan.c
net/8021q/vlan.h
net/bridge/br_netfilter_hooks.c
net/caif/caif_dev.c
net/core/net_namespace.c
net/core/pktgen.c
net/ipv4/ip_gre.c
net/ipv4/ip_tunnel.c
net/ipv4/ip_vti.c
net/ipv4/ipip.c
net/ipv4/netfilter/ipt_CLUSTERIP.c
net/ipv6/ip6_gre.c
net/ipv6/ip6_tunnel.c
net/ipv6/ip6_vti.c
net/ipv6/sit.c
net/ipv6/xfrm6_tunnel.c
net/key/af_key.c
net/netfilter/ipset/ip_set_core.c
net/netfilter/ipvs/ip_vs_core.c
net/netfilter/nf_conntrack_proto_dccp.c
net/netfilter/nf_conntrack_proto_gre.c
net/netfilter/nf_conntrack_proto_sctp.c
net/netfilter/nf_conntrack_proto_udplite.c
net/netfilter/nf_synproxy_core.c
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c
net/netfilter/xt_hashlimit.c
net/netfilter/xt_recent.c
net/openvswitch/datapath.c
net/openvswitch/datapath.h
net/phonet/pn_dev.c
net/rds/tcp.c
net/sched/act_bpf.c
net/sched/act_connmark.c
net/sched/act_csum.c
net/sched/act_gact.c
net/sched/act_ife.c
net/sched/act_ipt.c
net/sched/act_mirred.c
net/sched/act_nat.c
net/sched/act_pedit.c
net/sched/act_police.c
net/sched/act_simple.c
net/sched/act_skbedit.c
net/sched/act_skbmod.c
net/sched/act_tunnel_key.c
net/sched/act_vlan.c
net/sunrpc/netns.h
net/sunrpc/sunrpc_syms.c
net/tipc/core.c
net/tipc/core.h

index 89a6b05468045cbca835573fd450d4e4466f75d7..c68f4fe001d7de57e6411089c8aa207a6e5cde56 100644 (file)
@@ -116,7 +116,7 @@ static LIST_HEAD(dev_list);
 static LIST_HEAD(listen_any_list);
 static DEFINE_MUTEX(lock);
 static struct workqueue_struct *cma_wq;
-static int cma_pernet_id;
+static unsigned int cma_pernet_id;
 
 struct cma_pernet {
        struct idr tcp_ps;
index 5708f17e4cdf3b64be18a1d760f8ad9f6a74cbd9..8029dd4912b6f950e8ab5f06d5de9747d6832a02 100644 (file)
@@ -199,7 +199,7 @@ MODULE_PARM_DESC(lp_interval, "The number of seconds between instances where "
 atomic_t netpoll_block_tx = ATOMIC_INIT(0);
 #endif
 
-int bond_net_id __read_mostly;
+unsigned int bond_net_id __read_mostly;
 
 static __be32 arp_target[BOND_MAX_ARP_TARGETS];
 static int arp_ip_count;
index 85a423a664784979ed2cc90d11ae4bb22f6b30cd..90dc6b188607329974475967aff77cfff9e45f6c 100644 (file)
@@ -43,7 +43,7 @@ struct geneve_net {
        struct list_head        sock_list;
 };
 
-static int geneve_net_id;
+static unsigned int geneve_net_id;
 
 union geneve_addr {
        struct sockaddr_in sin;
index 719d19f35673fb4235df4cd2254347410a5b2d22..98f10c21652140a57cf2ee89ee1ff3b25a7802ba 100644 (file)
@@ -77,7 +77,7 @@ struct gtp_dev {
        struct hlist_head       *addr_hash;
 };
 
-static int gtp_net_id __read_mostly;
+static unsigned int gtp_net_id __read_mostly;
 
 struct gtp_net {
        struct list_head gtp_dev_list;
index 5489c0ec1d9a3cecb9957c474450006d0f63727b..3d3b1f4339eff6be6713f968da0aa55eaa9931fb 100644 (file)
@@ -204,7 +204,7 @@ static atomic_t ppp_unit_count = ATOMIC_INIT(0);
 static atomic_t channel_count = ATOMIC_INIT(0);
 
 /* per-net private data for this module */
-static int ppp_net_id __read_mostly;
+static unsigned int ppp_net_id __read_mostly;
 struct ppp_net {
        /* units to ppp mapping */
        struct idr units_idr;
index 4ddae8118c8566e4de07a16b136af13597fe4f3e..f017c72bb7fd3a3fbc09fc8d9ceeefd767eb41e8 100644 (file)
@@ -95,7 +95,7 @@ static const struct proto_ops pppoe_ops;
 static const struct ppp_channel_ops pppoe_chan_ops;
 
 /* per-net private data for this module */
-static int pppoe_net_id __read_mostly;
+static unsigned int pppoe_net_id __read_mostly;
 struct pppoe_net {
        /*
         * we could use _single_ hash table for all
index 0a3fd675408f2cbea2eb8d813af77e1d4dbef3a8..21e92be6e56c49d5a1c4b12c790d7b5e79f2f793 100644 (file)
@@ -52,7 +52,7 @@ static bool log_ecn_error = true;
 module_param(log_ecn_error, bool, 0644);
 MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
 
-static int vxlan_net_id;
+static unsigned int vxlan_net_id;
 static struct rtnl_link_ops vxlan_link_ops;
 
 static const u8 all_zeros_mac[ETH_ALEN + 2];
index 8f366cc097e6f9bd353be3f9729cacaf9452469c..1293f84949856601013bb11165b4d97087e620c4 100644 (file)
@@ -250,7 +250,7 @@ static inline void hwsim_clear_chanctx_magic(struct ieee80211_chanctx_conf *c)
        cp->magic = 0;
 }
 
-static int hwsim_net_id;
+static unsigned int hwsim_net_id;
 
 static int hwsim_netgroup;
 
index 5426189406c17c233bfcd0e139db5e7921e412fb..fb8cac88251ae64da116b8390826118c3eb1c81c 100644 (file)
@@ -15,6 +15,6 @@ struct lockd_net {
        struct list_head nsm_handles;
 };
 
-extern int lockd_net_id;
+extern unsigned int lockd_net_id;
 
 #endif
index fc4084ef4736d47a410e27052497cd00829204c2..1c13dd80744ff99cc0691476c3a2920eca9757cc 100644 (file)
@@ -57,7 +57,7 @@ static struct task_struct     *nlmsvc_task;
 static struct svc_rqst         *nlmsvc_rqst;
 unsigned long                  nlmsvc_timeout;
 
-int lockd_net_id;
+unsigned int lockd_net_id;
 
 /*
  * These can be set at insmod time (useful for NFS as root filesystem),
index bf4ec5ecc97e4571e3f971222c71f0519874682a..ce42dd00e4ee5f1131715d1ea23c2a5792ea0c73 100644 (file)
@@ -2015,7 +2015,7 @@ static void nfsiod_stop(void)
        destroy_workqueue(wq);
 }
 
-int nfs_net_id;
+unsigned int nfs_net_id;
 EXPORT_SYMBOL_GPL(nfs_net_id);
 
 static int nfs_net_init(struct net *net)
index fbce0d885d4c2dc77bb98f604ec881175e945eb7..5fbd2bde91ba7e7c18a367559d636b90908fc6e7 100644 (file)
@@ -35,6 +35,6 @@ struct nfs_net {
 #endif
 };
 
-extern int nfs_net_id;
+extern unsigned int nfs_net_id;
 
 #endif
index fd8c9a5bcac44c74101d1b2ba4001c8785875254..420d3a0ab258fb2b312310e50081bbab30f2c2ae 100644 (file)
@@ -9,7 +9,7 @@
 #include <net/netns/generic.h>
 #include <linux/fs.h>
 
-static int grace_net_id;
+static unsigned int grace_net_id;
 static DEFINE_SPINLOCK(grace_lock);
 
 /**
index ee36efd5aece83e08712bb0d839423bb30b8674a..3714231a9d0fb71e4e440a9f8efa7113839c4392 100644 (file)
@@ -124,5 +124,5 @@ struct nfsd_net {
 /* Simple check to find out if a given net was properly initialized */
 #define nfsd_netns_ready(nn) ((nn)->sessionid_hashtbl)
 
-extern int nfsd_net_id;
+extern unsigned int nfsd_net_id;
 #endif /* __NFSD_NETNS_H__ */
index 36b2af931e06d1d1a7c3dc613747a58433350811..2857e46d5cc5eacd3c2a78b6de8947ef97c48e6b 100644 (file)
@@ -1201,7 +1201,7 @@ static int create_proc_exports_entry(void)
 }
 #endif
 
-int nfsd_net_id;
+unsigned int nfsd_net_id;
 
 static __net_init int nfsd_init_net(struct net *net)
 {
index f32f7ef8a23a25a06f8e095f6982b57c78b0dd7f..3c857778a6ca6870f7e7d5604adcd263380e4708 100644 (file)
@@ -681,7 +681,7 @@ static inline int bond_get_targets_ip(__be32 *targets, __be32 ip)
 }
 
 /* exported from bond_main.c */
-extern int bond_net_id;
+extern unsigned int bond_net_id;
 extern const struct bond_parm_tbl bond_lacp_tbl[];
 extern const struct bond_parm_tbl xmit_hashtype_tbl[];
 extern const struct bond_parm_tbl arp_validate_tbl[];
index 59557c07904b40ad28c448413d285c245c0ac529..e893fe43dd139d827cd587c814c1cb0cd0a9c8fe 100644 (file)
@@ -129,7 +129,7 @@ struct ip_tunnel {
 #endif
        struct ip_tunnel_prl_entry __rcu *prl;  /* potential router list */
        unsigned int            prl_count;      /* # of entries in PRL */
-       int                     ip_tnl_net_id;
+       unsigned int            ip_tnl_net_id;
        struct gro_cells        gro_cells;
        bool                    collect_md;
        bool                    ignore_df;
@@ -248,7 +248,7 @@ void ip_tunnel_uninit(struct net_device *dev);
 void  ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
 struct net *ip_tunnel_get_link_net(const struct net_device *dev);
 int ip_tunnel_get_iflink(const struct net_device *dev);
-int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
+int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id,
                       struct rtnl_link_ops *ops, char *devname);
 
 void ip_tunnel_delete_net(struct ip_tunnel_net *itn, struct rtnl_link_ops *ops);
@@ -275,7 +275,7 @@ int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[],
                         struct ip_tunnel_parm *p);
 int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
                      struct ip_tunnel_parm *p);
-void ip_tunnel_setup(struct net_device *dev, int net_id);
+void ip_tunnel_setup(struct net_device *dev, unsigned int net_id);
 
 struct ip_tunnel_encap_ops {
        size_t (*encap_hlen)(struct ip_tunnel_encap *e);
index fc4f757107df0b51eae83781324337001ed7fb6d..d7149e93a60a68eba3a6e4e235ca8a687c2d8f90 100644 (file)
@@ -291,7 +291,7 @@ struct pernet_operations {
        int (*init)(struct net *net);
        void (*exit)(struct net *net);
        void (*exit_batch)(struct list_head *net_exit_list);
-       int *id;
+       unsigned int *id;
        size_t size;
 };
 
index 2152b70626d5252273c60c96d155f669a69aa554..e7b836590f0b7a24e13659063b7aa87ad133885e 100644 (file)
@@ -98,7 +98,7 @@ struct nf_conntrack_l4proto {
                const struct nla_policy *nla_policy;
        } ctnl_timeout;
 #endif
-       int     *net_id;
+       unsigned int    *net_id;
        /* Init l4proto pernet data */
        int (*init_net)(struct net *net, u_int16_t proto);
 
index e6937318546ceee3b32a63bd791932c1ea1e12de..b0ca402c1f72e20bae492c634f663b8846e788a5 100644 (file)
@@ -54,7 +54,7 @@ struct synproxy_net {
        struct synproxy_stats __percpu  *stats;
 };
 
-extern int synproxy_net_id;
+extern unsigned int synproxy_net_id;
 static inline struct synproxy_net *synproxy_pernet(struct net *net)
 {
        return net_generic(net, synproxy_net_id);
index 70e158551704767da8653bc4149698e34105a072..d315786bcfd7ad0d1f4479821775c0ca96567553 100644 (file)
@@ -31,7 +31,7 @@ struct net_generic {
        void *ptr[0];
 };
 
-static inline void *net_generic(const struct net *net, int id)
+static inline void *net_generic(const struct net *net, unsigned int id)
 {
        struct net_generic *ng;
        void *ptr;
index f1ca11613379fa2950aa7e33e732d85462f1fb57..92c463d2d1c73b45086df19c34e37b43a393f77f 100644 (file)
@@ -126,7 +126,7 @@ static atomic_t    audit_lost = ATOMIC_INIT(0);
 
 /* The netlink socket. */
 static struct sock *audit_sock;
-static int audit_net_id;
+static unsigned int audit_net_id;
 
 /* Hash for inode-based rules */
 struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS];
index a793655745317b73481d402d7f6353e8a6815d56..691f0ad7067d167dfac7e8746b43c4b83fe47754 100644 (file)
@@ -44,7 +44,7 @@
 
 /* Global VLAN variables */
 
-int vlan_net_id __read_mostly;
+unsigned int vlan_net_id __read_mostly;
 
 const char vlan_fullname[] = "802.1Q VLAN Support";
 const char vlan_version[] = DRV_VERSION;
index cc15579780669a613165336387a3f8eabc669dec..df8bd65dd370e225c8e410202d8130b9857aac5d 100644 (file)
@@ -159,7 +159,7 @@ void vlan_netlink_fini(void);
 
 extern struct rtnl_link_ops vlan_link_ops;
 
-extern int vlan_net_id;
+extern unsigned int vlan_net_id;
 
 struct proc_dir_entry;
 
index 8155bd2a5138431e09a31298b17d150df1f15e20..83d937f4415eea3f386f83269abac90fdaabb641 100644 (file)
@@ -46,7 +46,7 @@
 #include <linux/sysctl.h>
 #endif
 
-static int brnf_net_id __read_mostly;
+static unsigned int brnf_net_id __read_mostly;
 
 struct brnf_net {
        bool enabled;
index d730a0f68f46b43b3e8dd51cb3bb029f04cde93a..2d38b6e34203b7df5638c340126c2f5169fb3791 100644 (file)
@@ -52,7 +52,7 @@ struct caif_net {
        struct caif_device_entry_list caifdevs;
 };
 
-static int caif_net_id;
+static unsigned int caif_net_id;
 static int q_high = 50; /* Percent */
 
 struct cfcnfg *get_cfcnfg(struct net *net)
index 1309d78e2a64fab1d9d01226743a26bcab6d613d..35d37b196e67f43ed8f308a59c26d4d3822d7284 100644 (file)
@@ -55,7 +55,7 @@ static struct net_generic *net_alloc_generic(void)
        return ng;
 }
 
-static int net_assign_generic(struct net *net, int id, void *data)
+static int net_assign_generic(struct net *net, unsigned int id, void *data)
 {
        struct net_generic *ng, *old_ng;
 
@@ -122,8 +122,7 @@ out:
 static void ops_free(const struct pernet_operations *ops, struct net *net)
 {
        if (ops->id && ops->size) {
-               int id = *ops->id;
-               kfree(net_generic(net, id));
+               kfree(net_generic(net, *ops->id));
        }
 }
 
@@ -881,7 +880,7 @@ again:
                        }
                        return error;
                }
-               max_gen_ptrs = max_t(unsigned int, max_gen_ptrs, *ops->id);
+               max_gen_ptrs = max(max_gen_ptrs, *ops->id);
        }
        error = __register_pernet_operations(list, ops);
        if (error) {
index 306b8f0e03c18b32846491947932418243e416f8..8e69ce4722364e77f78dd3da256680df37c733c0 100644 (file)
@@ -413,7 +413,7 @@ struct pktgen_hdr {
 };
 
 
-static int pg_net_id __read_mostly;
+static unsigned int pg_net_id __read_mostly;
 
 struct pktgen_net {
        struct net              *net;
index 576f705d81809fccc61833f7445873620af6b4eb..78fd620483353293220c971d3c8f11e9fe4a8c28 100644 (file)
@@ -113,8 +113,8 @@ MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
 static struct rtnl_link_ops ipgre_link_ops __read_mostly;
 static int ipgre_tunnel_init(struct net_device *dev);
 
-static int ipgre_net_id __read_mostly;
-static int gre_tap_net_id __read_mostly;
+static unsigned int ipgre_net_id __read_mostly;
+static unsigned int gre_tap_net_id __read_mostly;
 
 static void ipgre_err(struct sk_buff *skb, u32 info,
                      const struct tnl_ptk_info *tpi)
index 12a92e3349ed5ab322496b553abf944acd9f1d4c..823abaef006bd353cf0466f14dd3abaa26f80c07 100644 (file)
@@ -994,7 +994,7 @@ int ip_tunnel_get_iflink(const struct net_device *dev)
 }
 EXPORT_SYMBOL(ip_tunnel_get_iflink);
 
-int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
+int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id,
                                  struct rtnl_link_ops *ops, char *devname)
 {
        struct ip_tunnel_net *itn = net_generic(net, ip_tnl_net_id);
@@ -1196,7 +1196,7 @@ void ip_tunnel_uninit(struct net_device *dev)
 EXPORT_SYMBOL_GPL(ip_tunnel_uninit);
 
 /* Do least required initialization, rest of init is done in tunnel_init call */
-void ip_tunnel_setup(struct net_device *dev, int net_id)
+void ip_tunnel_setup(struct net_device *dev, unsigned int net_id)
 {
        struct ip_tunnel *tunnel = netdev_priv(dev);
        tunnel->ip_tnl_net_id = net_id;
index 5d7944f394d9af83d6209c6ab2778be9e24d3553..8b14f1404c8f7315495877a34ad6757aee4232a8 100644 (file)
@@ -46,7 +46,7 @@
 
 static struct rtnl_link_ops vti_link_ops __read_mostly;
 
-static int vti_net_id __read_mostly;
+static unsigned int vti_net_id __read_mostly;
 static int vti_tunnel_init(struct net_device *dev);
 
 static int vti_input(struct sk_buff *skb, int nexthdr, __be32 spi,
index c9392589c4157e4ac5d4c2e619b6f3ed265165be..79489f017854e917df49f9eda569add649f1fd32 100644 (file)
@@ -121,7 +121,7 @@ static bool log_ecn_error = true;
 module_param(log_ecn_error, bool, 0644);
 MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
 
-static int ipip_net_id __read_mostly;
+static unsigned int ipip_net_id __read_mostly;
 
 static int ipip_tunnel_init(struct net_device *dev);
 static struct rtnl_link_ops ipip_link_ops __read_mostly;
index 4a9e6db9df8d719a14b6aa129b78ba614587767f..e6e206fa86c84a0668fdd0eaa015a6ccc3998b45 100644 (file)
@@ -62,7 +62,7 @@ struct clusterip_config {
 static const struct file_operations clusterip_proc_fops;
 #endif
 
-static int clusterip_net_id __read_mostly;
+static unsigned int clusterip_net_id __read_mostly;
 
 struct clusterip_net {
        struct list_head configs;
index 710bc79f91131be75dc70c49c4b9459fc29cf502..75b6108234dd05a54af0ae51c7c11eaf1ca26d75 100644 (file)
@@ -64,7 +64,7 @@ MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
 #define IP6_GRE_HASH_SIZE_SHIFT  5
 #define IP6_GRE_HASH_SIZE (1 << IP6_GRE_HASH_SIZE_SHIFT)
 
-static int ip6gre_net_id __read_mostly;
+static unsigned int ip6gre_net_id __read_mostly;
 struct ip6gre_net {
        struct ip6_tnl __rcu *tunnels[4][IP6_GRE_HASH_SIZE];
 
index 259e8507d2cd0367916bb46cffd51824ff9fa3cd..d3c619eda051a9cfaa9de4b595457e36e42b3c9f 100644 (file)
@@ -83,7 +83,7 @@ static int ip6_tnl_dev_init(struct net_device *dev);
 static void ip6_tnl_dev_setup(struct net_device *dev);
 static struct rtnl_link_ops ip6_link_ops __read_mostly;
 
-static int ip6_tnl_net_id __read_mostly;
+static unsigned int ip6_tnl_net_id __read_mostly;
 struct ip6_tnl_net {
        /* the IPv6 tunnel fallback device */
        struct net_device *fb_tnl_dev;
index af3f0e011265fd5240306aea20bbfbc5c563c3b4..c476bb8e9cdb3b783f2cfe75735fcd578f7f98ab 100644 (file)
@@ -64,7 +64,7 @@ static int vti6_dev_init(struct net_device *dev);
 static void vti6_dev_setup(struct net_device *dev);
 static struct rtnl_link_ops vti6_link_ops __read_mostly;
 
-static int vti6_net_id __read_mostly;
+static unsigned int vti6_net_id __read_mostly;
 struct vti6_net {
        /* the vti6 tunnel fallback device */
        struct net_device *fb_tnl_dev;
index dc7a3449ffc1c1eceaf2c2e6e6acff4423d6d1d5..0355231162b85e58c2ccf01af598c1e94cf629c8 100644 (file)
@@ -76,7 +76,7 @@ static bool check_6rd(struct ip_tunnel *tunnel, const struct in6_addr *v6dst,
                      __be32 *v4dst);
 static struct rtnl_link_ops sit_link_ops __read_mostly;
 
-static int sit_net_id __read_mostly;
+static unsigned int sit_net_id __read_mostly;
 struct sit_net {
        struct ip_tunnel __rcu *tunnels_r_l[IP6_SIT_HASH_SIZE];
        struct ip_tunnel __rcu *tunnels_r[IP6_SIT_HASH_SIZE];
index e1c0bbe7996cf8ca00374db26488bd85e02a36ad..d7b731a78d09f3ef7941911c3e35e29f3e8ff2d8 100644 (file)
@@ -44,7 +44,7 @@ struct xfrm6_tunnel_net {
        u32 spi;
 };
 
-static int xfrm6_tunnel_net_id __read_mostly;
+static unsigned int xfrm6_tunnel_net_id __read_mostly;
 static inline struct xfrm6_tunnel_net *xfrm6_tunnel_pernet(struct net *net)
 {
        return net_generic(net, xfrm6_tunnel_net_id);
index f9c9ecb0cdd3b3eea618538fda2e884583f9bc09..c6252ed42c1de65dee149d7d869b62b96616e22a 100644 (file)
@@ -36,7 +36,7 @@
 #define _X2KEY(x) ((x) == XFRM_INF ? 0 : (x))
 #define _KEY2X(x) ((x) == 0 ? XFRM_INF : (x))
 
-static int pfkey_net_id __read_mostly;
+static unsigned int pfkey_net_id __read_mostly;
 struct netns_pfkey {
        /* List of all pfkey sockets. */
        struct hlist_head table;
index 23345d2d136a41fe1552ae25da7b718687c7167a..c296f9b606d495d59c50ee46a04e7e17b21c1530 100644 (file)
@@ -36,7 +36,7 @@ struct ip_set_net {
        bool            is_destroyed;   /* all sets are destroyed */
 };
 
-static int ip_set_net_id __read_mostly;
+static unsigned int ip_set_net_id __read_mostly;
 
 static inline struct ip_set_net *ip_set_pernet(struct net *net)
 {
index 2c1b498a7a271df0f6e3ffa86407b89ba103e9d9..db40050f8785eb9205a7bf493a71c9b956b93ab8 100644 (file)
@@ -70,7 +70,7 @@ EXPORT_SYMBOL(ip_vs_get_debug_level);
 #endif
 EXPORT_SYMBOL(ip_vs_new_conn_out);
 
-static int ip_vs_net_id __read_mostly;
+static unsigned int ip_vs_net_id __read_mostly;
 /* netns cnt used for uniqueness */
 static atomic_t ipvs_netns_cnt = ATOMIC_INIT(0);
 
index ac89769649755198f894d9232c603ec29c8c64d7..073b047314dc5c7690523f63c7fff15e4a3c4be7 100644 (file)
@@ -385,7 +385,7 @@ dccp_state_table[CT_DCCP_ROLE_MAX + 1][DCCP_PKT_SYNCACK + 1][CT_DCCP_MAX + 1] =
 };
 
 /* this module per-net specifics */
-static int dccp_net_id __read_mostly;
+static unsigned int dccp_net_id __read_mostly;
 struct dccp_net {
        struct nf_proto_net pn;
        int dccp_loose;
index ff405c9183f148d52612c8d674cc11251db8044b..87bb40a3feb58e371e3fc899ab7c8b4dd2f38859 100644 (file)
@@ -53,7 +53,7 @@ static unsigned int gre_timeouts[GRE_CT_MAX] = {
        [GRE_CT_REPLIED]        = 180*HZ,
 };
 
-static int proto_gre_net_id __read_mostly;
+static unsigned int proto_gre_net_id __read_mostly;
 struct netns_proto_gre {
        struct nf_proto_net     nf;
        rwlock_t                keymap_lock;
index 17c0ade23fd885b2866f2a3c33689a00ec704a84..d096c2d6b87bd9bde8dcb73912ed0f43501f0ccf 100644 (file)
@@ -144,7 +144,7 @@ static const u8 sctp_conntracks[2][11][SCTP_CONNTRACK_MAX] = {
        }
 };
 
-static int sctp_net_id __read_mostly;
+static unsigned int sctp_net_id        __read_mostly;
 struct sctp_net {
        struct nf_proto_net pn;
        unsigned int timeouts[SCTP_CONNTRACK_MAX];
index 8cdb4b1bf933676054bc455dd0e617b96e6d2354..7808604c70a219053c09afa388015816cf6ae008 100644 (file)
@@ -35,7 +35,7 @@ static unsigned int udplite_timeouts[UDPLITE_CT_MAX] = {
        [UDPLITE_CT_REPLIED]    = 180*HZ,
 };
 
-static int udplite_net_id __read_mostly;
+static unsigned int udplite_net_id __read_mostly;
 struct udplite_net {
        struct nf_proto_net pn;
        unsigned int timeouts[UDPLITE_CT_MAX];
index c8a4a48bced988a29cd19df06a00117ea026c6ad..7c6d1fbe38b9aafc668ca39ee6e096d64f79bc7f 100644 (file)
@@ -24,7 +24,7 @@
 #include <net/netfilter/nf_conntrack_synproxy.h>
 #include <net/netfilter/nf_conntrack_zones.h>
 
-int synproxy_net_id;
+unsigned int synproxy_net_id;
 EXPORT_SYMBOL_GPL(synproxy_net_id);
 
 bool
index 7435505037b7a509081826add82060ee2dfa587c..763cb4d54e8d45c8f59a68020d7261070a188974 100644 (file)
@@ -80,7 +80,7 @@ struct nfulnl_instance {
 
 #define INSTANCE_BUCKETS       16
 
-static int nfnl_log_net_id __read_mostly;
+static unsigned int nfnl_log_net_id __read_mostly;
 
 struct nfnl_log_net {
        spinlock_t instances_lock;
index 1e33115b399fcdb90d2173fc282ab044b60d9520..be7627b8040057c4b06b5961e7cae4c0c5b10d66 100644 (file)
@@ -77,7 +77,7 @@ struct nfqnl_instance {
 
 typedef int (*nfqnl_cmpfn)(struct nf_queue_entry *, unsigned long);
 
-static int nfnl_queue_net_id __read_mostly;
+static unsigned int nfnl_queue_net_id __read_mostly;
 
 #define INSTANCE_BUCKETS       16
 struct nfnl_queue_net {
index b89b688e9d01a2d14071563bb3e823b62dceeb17..10063408141d25bdd0f1a1241ffe6395bae753f6 100644 (file)
@@ -49,7 +49,7 @@ struct hashlimit_net {
        struct proc_dir_entry   *ip6t_hashlimit;
 };
 
-static int hashlimit_net_id;
+static unsigned int hashlimit_net_id;
 static inline struct hashlimit_net *hashlimit_pernet(struct net *net)
 {
        return net_generic(net, hashlimit_net_id);
index bf250000e08448cae65f8d1db53587d270d31d79..1d89a4eaf841a33e95247badfba064ce7dad0f63 100644 (file)
@@ -95,7 +95,7 @@ struct recent_net {
 #endif
 };
 
-static int recent_net_id __read_mostly;
+static unsigned int recent_net_id __read_mostly;
 
 static inline struct recent_net *recent_pernet(struct net *net)
 {
index 1402f1be642dfc350643bdce332d3f043d7f8d8a..2d4c4d3911c02ce91de79ac4c9ad4923d4bc2329 100644 (file)
@@ -58,7 +58,7 @@
 #include "vport-internal_dev.h"
 #include "vport-netdev.h"
 
-int ovs_net_id __read_mostly;
+unsigned int ovs_net_id __read_mostly;
 
 static struct genl_family dp_packet_genl_family;
 static struct genl_family dp_flow_genl_family;
index ab85c1cae255b8fd373a0d5e0e1d05841b5bd8d0..1c6e9377436df1e93081c825c142b712a811277b 100644 (file)
@@ -144,7 +144,7 @@ struct ovs_net {
        bool xt_label;
 };
 
-extern int ovs_net_id;
+extern unsigned int ovs_net_id;
 void ovs_lock(void);
 void ovs_unlock(void);
 
index a58680016472b88010c30a5f1708c1f8a046280f..2cb4c5dfad6f76310275b90a0da4cddc2eb92fe1 100644 (file)
@@ -44,7 +44,7 @@ struct phonet_net {
        struct phonet_routes routes;
 };
 
-static int phonet_net_id __read_mostly;
+static unsigned int phonet_net_id __read_mostly;
 
 static struct phonet_net *phonet_pernet(struct net *net)
 {
index 3296a6ac583ab37eb61ca511f71359d666b36295..1a0399dea7640beb3acd5fad7b17ac291e13a112 100644 (file)
@@ -366,7 +366,7 @@ struct rds_transport rds_tcp_transport = {
        .t_mp_capable           = 1,
 };
 
-static int rds_tcp_netid;
+static unsigned int rds_tcp_netid;
 
 /* per-network namespace private data for this module */
 struct rds_tcp_net {
index 9ff06cfbcdec9756a42d8076710405c586b21f48..1aa4ecf41baf8c1d5692c14debc91c3cac959460 100644 (file)
@@ -33,7 +33,7 @@ struct tcf_bpf_cfg {
        bool is_ebpf;
 };
 
-static int bpf_net_id;
+static unsigned int bpf_net_id;
 static struct tc_action_ops act_bpf_ops;
 
 static int tcf_bpf(struct sk_buff *skb, const struct tc_action *act,
index eae07a2e774d81ecfbbe444ae0f33385b6adb7a0..ab80629099622c47933efb36662a323f98f66773 100644 (file)
@@ -30,7 +30,7 @@
 
 #define CONNMARK_TAB_MASK     3
 
-static int connmark_net_id;
+static unsigned int connmark_net_id;
 static struct tc_action_ops act_connmark_ops;
 
 static int tcf_connmark(struct sk_buff *skb, const struct tc_action *a,
index e0defcef376d872c123b7d23f81a3b1eed207c02..a0edd80a44db4ad09862ad8335340180839e83d3 100644 (file)
@@ -42,7 +42,7 @@ static const struct nla_policy csum_policy[TCA_CSUM_MAX + 1] = {
        [TCA_CSUM_PARMS] = { .len = sizeof(struct tc_csum), },
 };
 
-static int csum_net_id;
+static unsigned int csum_net_id;
 static struct tc_action_ops act_csum_ops;
 
 static int tcf_csum_init(struct net *net, struct nlattr *nla,
index e0aa30f83c6ccdb38864fbc6a3bdbb529d9da816..e6c874a2b283f6e265b61a39f1fcd053389b9051 100644 (file)
@@ -25,7 +25,7 @@
 
 #define GACT_TAB_MASK  15
 
-static int gact_net_id;
+static unsigned int gact_net_id;
 static struct tc_action_ops act_gact_ops;
 
 #ifdef CONFIG_GACT_PROB
index 95c463cbb9a6921b63fde46e040024fe4afdbd8a..80b848d3f0964b4a9ff8c726df5731dc39631d19 100644 (file)
@@ -35,7 +35,7 @@
 
 #define IFE_TAB_MASK 15
 
-static int ife_net_id;
+static unsigned int ife_net_id;
 static int max_metacnt = IFE_META_MAX + 1;
 static struct tc_action_ops act_ife_ops;
 
index ce7ea6c1c50df52752a624c3652bfda27201c944..992ef8d624f11819e032411e72ea60aa6aa93ba1 100644 (file)
 
 #define IPT_TAB_MASK     15
 
-static int ipt_net_id;
+static unsigned int ipt_net_id;
 static struct tc_action_ops act_ipt_ops;
 
-static int xt_net_id;
+static unsigned int xt_net_id;
 static struct tc_action_ops act_xt_ops;
 
 static int ipt_init_target(struct xt_entry_target *t, char *table,
index 6073a11327251cb2baa312ff8a9bab3f94f47e5a..b2d417b8f46cdee99d8f2c4153314bc2160cb882 100644 (file)
@@ -70,7 +70,7 @@ static const struct nla_policy mirred_policy[TCA_MIRRED_MAX + 1] = {
        [TCA_MIRRED_PARMS]      = { .len = sizeof(struct tc_mirred) },
 };
 
-static int mirred_net_id;
+static unsigned int mirred_net_id;
 static struct tc_action_ops act_mirred_ops;
 
 static bool dev_is_mac_header_xmit(const struct net_device *dev)
index 8e8b0cc30704e7bbf69975932d4678f2e8caf9a1..9b6aec665495992fd6d63773890b5e897ba51819 100644 (file)
@@ -31,7 +31,7 @@
 
 #define NAT_TAB_MASK   15
 
-static int nat_net_id;
+static unsigned int nat_net_id;
 static struct tc_action_ops act_nat_ops;
 
 static const struct nla_policy nat_policy[TCA_NAT_MAX + 1] = {
index b54d56d4959b6381d35799ba84f64ea634384cce..eda322045e75e8ff2c56cea89df412e93b85c9f5 100644 (file)
@@ -25,7 +25,7 @@
 
 #define PEDIT_TAB_MASK 15
 
-static int pedit_net_id;
+static unsigned int pedit_net_id;
 static struct tc_action_ops act_pedit_ops;
 
 static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = {
index d1bd248fe1461380a473baa5cb41e64771ab2bd0..c990b73a6c85151862c30971bd3787d20dbcecd1 100644 (file)
@@ -55,7 +55,7 @@ struct tc_police_compat {
 
 /* Each policer is serialized by its individual spinlock */
 
-static int police_net_id;
+static unsigned int police_net_id;
 static struct tc_action_ops act_police_ops;
 
 static int tcf_act_police_walker(struct net *net, struct sk_buff *skb,
index 289af6f9bb3b2b0712514d6e533d351cce288062..823a73ad0c602b8e079be04934f8a57d53480da1 100644 (file)
@@ -26,7 +26,7 @@
 
 #define SIMP_TAB_MASK     7
 
-static int simp_net_id;
+static unsigned int simp_net_id;
 static struct tc_action_ops act_simp_ops;
 
 #define SIMP_MAX_DATA  32
index 024f3a3afeff62e9edb625f45a83f5b2f61a7e54..06ccae3c12eecf85383105489320537d52c4d948 100644 (file)
@@ -29,7 +29,7 @@
 
 #define SKBEDIT_TAB_MASK     15
 
-static int skbedit_net_id;
+static unsigned int skbedit_net_id;
 static struct tc_action_ops act_skbedit_ops;
 
 static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
index e7d96381c908ebbd328124c4cf59221ff2c18695..3b7074e2302487808dc1d16b01143d0b292ebe4e 100644 (file)
@@ -22,7 +22,7 @@
 
 #define SKBMOD_TAB_MASK     15
 
-static int skbmod_net_id;
+static unsigned int skbmod_net_id;
 static struct tc_action_ops act_skbmod_ops;
 
 #define MAX_EDIT_LEN ETH_HLEN
index edc720f11687273c8d135d7484490dd415415893..7af712526f01eaa9ed77f33ff6030a2fe7253713 100644 (file)
@@ -22,7 +22,7 @@
 
 #define TUNNEL_KEY_TAB_MASK     15
 
-static int tunnel_key_net_id;
+static unsigned int tunnel_key_net_id;
 static struct tc_action_ops act_tunnel_key_ops;
 
 static int tunnel_key_act(struct sk_buff *skb, const struct tc_action *a,
index b57fcbcefea1d2ae4750c8f6dc2156f5d554f8f1..19e0dba305ce8101d9db33ff0a1eaab849a730d0 100644 (file)
@@ -21,7 +21,7 @@
 
 #define VLAN_TAB_MASK     15
 
-static int vlan_net_id;
+static unsigned int vlan_net_id;
 static struct tc_action_ops act_vlan_ops;
 
 static int tcf_vlan(struct sk_buff *skb, const struct tc_action *a,
index df58268765351ebd1b4376f7504915cd1b9fff6b..394ce523174c914c6e381a780af59de00579c0c1 100644 (file)
@@ -34,7 +34,7 @@ struct sunrpc_net {
        struct proc_dir_entry *use_gssp_proc;
 };
 
-extern int sunrpc_net_id;
+extern unsigned int sunrpc_net_id;
 
 int ip_map_cache_create(struct net *);
 void ip_map_cache_destroy(struct net *);
index ee5d3d253102bf5d81a39f953248a6a6ca7a38d6..d1c330a7953a0bc9bb4e08162baf77740504b80c 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "netns.h"
 
-int sunrpc_net_id;
+unsigned int sunrpc_net_id;
 EXPORT_SYMBOL_GPL(sunrpc_net_id);
 
 static __net_init int sunrpc_init_net(struct net *net)
index 236b043a4156df151b630e979b0e8fd71addcea4..0b982d048fb9b36c8bec876c32361f264e5dac9e 100644 (file)
@@ -47,7 +47,7 @@
 #include <linux/module.h>
 
 /* configurable TIPC parameters */
-int tipc_net_id __read_mostly;
+unsigned int tipc_net_id __read_mostly;
 int sysctl_tipc_rmem[3] __read_mostly; /* min/default/max */
 
 static int __net_init tipc_init_net(struct net *net)
index a1845fb27d803973fc4a0a7a7b2a88f8b88c343c..5cc5398be7225aaaf81f0f9784ce139d9df68b74 100644 (file)
@@ -74,7 +74,7 @@ struct tipc_monitor;
 #define MAX_BEARERS             3
 #define TIPC_DEF_MON_THRESHOLD  32
 
-extern int tipc_net_id __read_mostly;
+extern unsigned int tipc_net_id __read_mostly;
 extern int sysctl_tipc_rmem[3] __read_mostly;
 extern int sysctl_tipc_named_timeout __read_mostly;