diff options
author | Ido Schimmel <idosch@mellanox.com> | 2016-12-03 18:44:59 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-12-04 03:29:35 +0300 |
commit | 1c677b3d2828a84e0360e1a07d1204531540dc03 (patch) | |
tree | 722b60bcd53e51286e982f1b6e6b8073240a5b97 /include/net/ip_fib.h | |
parent | b423cb10807b3a24b909c40f4372df88118a9875 (diff) | |
download | linux-1c677b3d2828a84e0360e1a07d1204531540dc03.tar.xz |
ipv4: fib: Add fib_info_hold() helper
As explained in the previous commit, modules are going to need to take a
reference on fib info and then drop it using fib_info_put().
Add the fib_info_hold() helper to make the code more readable and also
symmetric with fib_info_put().
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Suggested-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ip_fib.h')
-rw-r--r-- | include/net/ip_fib.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index f390c3bb05c5..6c67b9391fc0 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -397,6 +397,11 @@ static inline void fib_combine_itag(u32 *itag, const struct fib_result *res) void free_fib_info(struct fib_info *fi); +static inline void fib_info_hold(struct fib_info *fi) +{ + atomic_inc(&fi->fib_clntref); +} + static inline void fib_info_put(struct fib_info *fi) { if (atomic_dec_and_test(&fi->fib_clntref)) |