--- zzzz-none-000/linux-3.10.107/net/tipc/addr.h 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/net/tipc/addr.h 2021-02-04 17:41:59.000000000 +0000 @@ -37,55 +37,37 @@ #ifndef _TIPC_ADDR_H #define _TIPC_ADDR_H +#include +#include +#include +#include +#include "core.h" + #define TIPC_ZONE_MASK 0xff000000u #define TIPC_CLUSTER_MASK 0xfffff000u -static inline u32 tipc_zone_mask(u32 addr) +static inline u32 tipc_own_addr(struct net *net) { - return addr & TIPC_ZONE_MASK; -} + struct tipc_net *tn = net_generic(net, tipc_net_id); -static inline u32 tipc_cluster_mask(u32 addr) -{ - return addr & TIPC_CLUSTER_MASK; + return tn->own_addr; } -static inline int in_own_cluster_exact(u32 addr) -{ - return !((addr ^ tipc_own_addr) >> 12); -} - -/** - * in_own_node - test for node inclusion; <0.0.0> always matches - */ -static inline int in_own_node(u32 addr) -{ - return (addr == tipc_own_addr) || !addr; -} - -/** - * in_own_cluster - test for cluster inclusion; <0.0.0> always matches - */ -static inline int in_own_cluster(u32 addr) +static inline u32 tipc_zone_mask(u32 addr) { - return in_own_cluster_exact(addr) || !addr; + return addr & TIPC_ZONE_MASK; } -/** - * addr_domain - convert 2-bit scope value to equivalent message lookup domain - * - * Needed when address of a named message must be looked up a second time - * after a network hop. - */ -static inline u32 addr_domain(u32 sc) +static inline u32 tipc_cluster_mask(u32 addr) { - if (likely(sc == TIPC_NODE_SCOPE)) - return tipc_own_addr; - if (sc == TIPC_CLUSTER_SCOPE) - return tipc_cluster_mask(tipc_own_addr); - return tipc_zone_mask(tipc_own_addr); + return addr & TIPC_CLUSTER_MASK; } +u32 tipc_own_addr(struct net *net); +int in_own_cluster(struct net *net, u32 addr); +int in_own_cluster_exact(struct net *net, u32 addr); +int in_own_node(struct net *net, u32 addr); +u32 addr_domain(struct net *net, u32 sc); int tipc_addr_domain_valid(u32); int tipc_addr_node_valid(u32 addr); int tipc_in_scope(u32 domain, u32 addr);