diff options
author | Tuong Lien <tuong.t.lien@dektech.com.au> | 2019-11-08 08:05:08 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-09 01:01:59 +0300 |
commit | 2a7ee696f7b000a970dcce0cb06fdcd0a9e6ee76 (patch) | |
tree | 5db483507dfbc4b82a8097cd1c6562f2a6c0f99a /net/tipc/bearer.h | |
parent | f1ff4e80f848a2ea0622cbe2c72e44409ba90546 (diff) | |
download | linux-2a7ee696f7b000a970dcce0cb06fdcd0a9e6ee76.tar.xz |
tipc: add reference counter to bearer
As a need to support the crypto asynchronous operations in the later
commits, apart from the current RCU mechanism for bearer pointer, we
add a 'refcnt' to the bearer object as well.
So, a bearer can be hold via 'tipc_bearer_hold()' without being freed
even though the bearer or interface can be disabled in the meanwhile.
If that happens, the bearer will be released then when the crypto
operation is completed and 'tipc_bearer_put()' is called.
Acked-by: Ying Xue <ying.xue@windreiver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/bearer.h')
-rw-r--r-- | net/tipc/bearer.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index ea0f3c49cbed..faca696d422f 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h @@ -165,6 +165,7 @@ struct tipc_bearer { struct tipc_discoverer *disc; char net_plane; unsigned long up; + refcount_t refcnt; }; struct tipc_bearer_names { @@ -210,6 +211,8 @@ int tipc_media_set_window(const char *name, u32 new_value); int tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a); int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b, struct nlattr *attrs[]); +bool tipc_bearer_hold(struct tipc_bearer *b); +void tipc_bearer_put(struct tipc_bearer *b); void tipc_disable_l2_media(struct tipc_bearer *b); int tipc_l2_send_msg(struct net *net, struct sk_buff *buf, struct tipc_bearer *b, struct tipc_media_addr *dest); |