Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tipc: Consolidate redundant functions

link_is_up() and tipc_link_is_up() have the same functionality.
Consolidate these functions.

Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
Reviewed-by: Tung Nguyen <tung.q.nguyen@endava.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Shigeru Yoshida and committed by
David S. Miller
b6c67967 534ea0a9

+10 -17
+10 -17
net/tipc/link.c
··· 241 241 LINK_SYNCHING = 0xc << 24 242 242 }; 243 243 244 - /* Link FSM state checking routines 245 - */ 246 - static int link_is_up(struct tipc_link *l) 247 - { 248 - return l->state & (LINK_ESTABLISHED | LINK_SYNCHING); 249 - } 250 - 251 244 static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb, 252 245 struct sk_buff_head *xmitq); 253 246 static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe, ··· 267 274 */ 268 275 bool tipc_link_is_up(struct tipc_link *l) 269 276 { 270 - return link_is_up(l); 277 + return l->state & (LINK_ESTABLISHED | LINK_SYNCHING); 271 278 } 272 279 273 280 bool tipc_link_peer_is_down(struct tipc_link *l) ··· 1783 1790 rcv_nxt = l->rcv_nxt; 1784 1791 win_lim = rcv_nxt + TIPC_MAX_LINK_WIN; 1785 1792 1786 - if (unlikely(!link_is_up(l))) { 1793 + if (unlikely(!tipc_link_is_up(l))) { 1787 1794 if (l->state == LINK_ESTABLISHING) 1788 1795 rc = TIPC_LINK_UP_EVT; 1789 1796 kfree_skb(skb); ··· 1841 1848 struct tipc_link *bcl = l->bc_rcvlink; 1842 1849 struct tipc_msg *hdr; 1843 1850 struct sk_buff *skb; 1844 - bool node_up = link_is_up(bcl); 1851 + bool node_up = tipc_link_is_up(bcl); 1845 1852 u16 glen = 0, bc_rcvgap = 0; 1846 1853 int dlen = 0; 1847 1854 void *data; ··· 2156 2163 if (session != curr_session) 2157 2164 return false; 2158 2165 /* Extra sanity check */ 2159 - if (!link_is_up(l) && msg_ack(hdr)) 2166 + if (!tipc_link_is_up(l) && msg_ack(hdr)) 2160 2167 return false; 2161 2168 if (!(l->peer_caps & TIPC_LINK_PROTO_SEQNO)) 2162 2169 return true; ··· 2254 2261 } 2255 2262 2256 2263 /* ACTIVATE_MSG serves as PEER_RESET if link is already down */ 2257 - if (mtyp == RESET_MSG || !link_is_up(l)) 2264 + if (mtyp == RESET_MSG || !tipc_link_is_up(l)) 2258 2265 rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT); 2259 2266 2260 2267 /* ACTIVATE_MSG takes up link if it was already locally reset */ ··· 2293 2300 if (msg_probe(hdr)) 2294 2301 l->stats.recv_probes++; 2295 2302 2296 - if (!link_is_up(l)) { 2303 + if (!tipc_link_is_up(l)) { 2297 2304 if (l->state == LINK_ESTABLISHING) 2298 2305 rc = TIPC_LINK_UP_EVT; 2299 2306 break; ··· 2380 2387 int mtyp = msg_type(hdr); 2381 2388 u16 peers_snd_nxt = msg_bc_snd_nxt(hdr); 2382 2389 2383 - if (link_is_up(l)) 2390 + if (tipc_link_is_up(l)) 2384 2391 return; 2385 2392 2386 2393 if (msg_user(hdr) == BCAST_PROTOCOL) { ··· 2408 2415 u16 peers_snd_nxt = msg_bc_snd_nxt(hdr); 2409 2416 int rc = 0; 2410 2417 2411 - if (!link_is_up(l)) 2418 + if (!tipc_link_is_up(l)) 2412 2419 return rc; 2413 2420 2414 2421 if (!msg_peer_node_is_up(hdr)) ··· 2468 2475 bool unused = false; 2469 2476 int rc = 0; 2470 2477 2471 - if (!link_is_up(r) || !r->bc_peer_is_up) 2478 + if (!tipc_link_is_up(r) || !r->bc_peer_is_up) 2472 2479 return 0; 2473 2480 2474 2481 if (gap) { ··· 2866 2873 l->tolerance = tol; 2867 2874 if (l->bc_rcvlink) 2868 2875 l->bc_rcvlink->tolerance = tol; 2869 - if (link_is_up(l)) 2876 + if (tipc_link_is_up(l)) 2870 2877 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, tol, 0, xmitq); 2871 2878 } 2872 2879