diff options
author | Bruno Martins <bgcngm@gmail.com> | 2020-12-06 18:31:14 +0000 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2020-12-31 19:40:46 +0200 |
commit | 141849eac5defb4bb6cf6e6f1381cb24ffcfdba5 (patch) | |
tree | 991068d0b0e30be8ca5879ba6e2914b82eefd25b /drivers/net/wireguard/ratelimiter.c | |
parent | 7d982ef6fe996f837d5c0c71feb2a3f3989deee7 (diff) |
drivers: net: Modify WireGuard for backward compat
Change-Id: I1c8e130a514a7b0329f8df8099cc84f4cc8d5822
Diffstat (limited to 'drivers/net/wireguard/ratelimiter.c')
-rw-r--r-- | drivers/net/wireguard/ratelimiter.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/wireguard/ratelimiter.c b/drivers/net/wireguard/ratelimiter.c index 9baa930c8157..e33ec72a9642 100644 --- a/drivers/net/wireguard/ratelimiter.c +++ b/drivers/net/wireguard/ratelimiter.c @@ -3,6 +3,18 @@ * Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. */ +#ifdef COMPAT_CANNOT_DEPRECIATE_BH_RCU +/* We normally alias all non-_bh functions to the _bh ones in the compat layer, + * but that's not appropriate here, where we actually do want non-_bh ones. + */ +#undef synchronize_rcu +#define synchronize_rcu old_synchronize_rcu +#undef call_rcu +#define call_rcu old_call_rcu +#undef rcu_barrier +#define rcu_barrier old_rcu_barrier +#endif + #include "ratelimiter.h" #include <linux/siphash.h> #include <linux/mm.h> @@ -170,9 +182,9 @@ int wg_ratelimiter_init(void) * we borrow their wisdom about good table sizes on different systems * dependent on RAM. This calculation here comes from there. */ - table_size = (totalram_pages > (1U << 30) / PAGE_SIZE) ? 8192 : + table_size = (totalram_pages() > (1U << 30) / PAGE_SIZE) ? 8192 : max_t(unsigned long, 16, roundup_pow_of_two( - (totalram_pages << PAGE_SHIFT) / + (totalram_pages() << PAGE_SHIFT) / (1U << 14) / sizeof(struct hlist_head))); max_entries = table_size * 8; |