• Ying Xue's avatar
    tipc: decouple the relationship between bearer and link · 7a2f7d18
    Ying Xue authored
    
    
    Currently on both paths of message transmission and reception, the
    read lock of tipc_net_lock must be held before bearer is accessed,
    while the write lock of tipc_net_lock has to be taken before bearer
    is configured. Although it can ensure that bearer is always valid on
    the two data paths, link and bearer is closely bound together.
    
    So as the part of effort of removing tipc_net_lock, the locking
    policy of bearer protection will be adjusted as below: on the two
    data paths, RCU is used, and on the configuration path of bearer,
    RTNL lock is applied.
    
    Now RCU just covers the path of message reception. To make it possible
    to protect the path of message transmission with RCU, link should not
    use its stored bearer pointer to access bearer, but it should use the
    bearer identity of its attached bearer as index to get bearer instance
    from bearer_list array, which can help us decouple the relationship
    between bearer and link. As a result, bearer on the path of message
    transmission can be safely protected by RCU when we access bearer_list
    array within RCU lock protection.
    
    Signed-off-by: Ying Xue's avatarYing Xue <ying.xue@windriver.com>
    Reviewed-by: default avatarJon Maloy <jon.maloy@ericsson.com>
    Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
    Tested-by: default avatarErik Hugne <erik.hugne@ericsson.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    7a2f7d18