diff options
author | Alex Shi <alex.shi@linaro.org> | 2016-01-14 22:25:14 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2016-01-14 22:25:14 +0800 |
commit | f90ae1b62bedd8b57966a7be68855f2d43170db6 (patch) | |
tree | dc332d18219749a17b163d740b8713be5e8d940b /include/net/ipv6.h | |
parent | 346a8beb760237fb0fed811045ec92c799f48d54 (diff) | |
parent | 60917545df1ffc7f918550512dc4a14758f74784 (diff) |
Merge remote-tracking branch 'lts/linux-3.18.y' into linux-linaro-lsk-v3.18linux-linaro-lsk-v3.18
Diffstat (limited to 'include/net/ipv6.h')
-rw-r--r-- | include/net/ipv6.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 4292929392b0..a5169a4e9ef7 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -207,6 +207,7 @@ extern rwlock_t ip6_ra_lock; */ struct ipv6_txoptions { + atomic_t refcnt; /* Length of this structure */ int tot_len; @@ -219,7 +220,7 @@ struct ipv6_txoptions { struct ipv6_opt_hdr *dst0opt; struct ipv6_rt_hdr *srcrt; /* Routing Header */ struct ipv6_opt_hdr *dst1opt; - + struct rcu_head rcu; /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ }; @@ -252,6 +253,24 @@ struct ipv6_fl_socklist { struct rcu_head rcu; }; +static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np) +{ + struct ipv6_txoptions *opt; + + rcu_read_lock(); + opt = rcu_dereference(np->opt); + if (opt && !atomic_inc_not_zero(&opt->refcnt)) + opt = NULL; + rcu_read_unlock(); + return opt; +} + +static inline void txopt_put(struct ipv6_txoptions *opt) +{ + if (opt && atomic_dec_and_test(&opt->refcnt)) + kfree_rcu(opt, rcu); +} + struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space, struct ip6_flowlabel *fl, @@ -490,6 +509,7 @@ struct ip6_create_arg { u32 user; const struct in6_addr *src; const struct in6_addr *dst; + int iif; u8 ecn; }; |