Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * net/tipc/bcast.c: TIPC broadcast code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 2004-2006, 2014-2017, Ericsson AB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 2004, Intel Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (c) 2005, 2010-2011, Wind River Systems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * Redistribution and use in source and binary forms, with or without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * modification, are permitted provided that the following conditions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * 1. Redistributions of source code must retain the above copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *    notice, this list of conditions and the following disclaimer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * 2. Redistributions in binary form must reproduce the above copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *    notice, this list of conditions and the following disclaimer in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *    documentation and/or other materials provided with the distribution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * 3. Neither the names of the copyright holders nor the names of its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *    contributors may be used to endorse or promote products derived from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *    this software without specific prior written permission.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * Alternatively, this software may be distributed under the terms of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * GNU General Public License ("GPL") version 2 as published by the Free
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * Software Foundation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * POSSIBILITY OF SUCH DAMAGE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <linux/tipc_config.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include "socket.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include "msg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #include "bcast.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include "link.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #include "name_table.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define BCLINK_WIN_DEFAULT  50	/* bcast link window size (default) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define BCLINK_WIN_MIN      32	/* bcast minimum link window size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) const char tipc_bclink_name[] = "broadcast-link";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) unsigned long sysctl_tipc_bc_retruni __read_mostly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  * struct tipc_bc_base - base structure for keeping broadcast send state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  * @link: broadcast send link structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * @inputq: data input queue; will only carry SOCK_WAKEUP messages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * @dests: array keeping number of reachable destinations per bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * @primary_bearer: a bearer having links to all broadcast destinations, if any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * @bcast_support: indicates if primary bearer, if any, supports broadcast
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  * @force_bcast: forces broadcast for multicast traffic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * @rcast_support: indicates if all peer nodes support replicast
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * @force_rcast: forces replicast for multicast traffic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * @rc_ratio: dest count as percentage of cluster size where send method changes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * @bc_threshold: calculated from rc_ratio; if dests > threshold use broadcast
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) struct tipc_bc_base {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	struct tipc_link *link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	struct sk_buff_head inputq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	int dests[MAX_BEARERS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	int primary_bearer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	bool bcast_support;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	bool force_bcast;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	bool rcast_support;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	bool force_rcast;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	int rc_ratio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	int bc_threshold;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) static struct tipc_bc_base *tipc_bc_base(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	return tipc_net(net)->bcbase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) /* tipc_bcast_get_mtu(): -get the MTU currently used by broadcast link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  * Note: the MTU is decremented to give room for a tunnel header, in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  * case the message needs to be sent as replicast
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) int tipc_bcast_get_mtu(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	return tipc_link_mss(tipc_bc_sndlink(net));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) void tipc_bcast_toggle_rcast(struct net *net, bool supp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	tipc_bc_base(net)->rcast_support = supp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) static void tipc_bcbase_calc_bc_threshold(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	struct tipc_bc_base *bb = tipc_bc_base(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	int cluster_size = tipc_link_bc_peers(tipc_bc_sndlink(net));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	bb->bc_threshold = 1 + (cluster_size * bb->rc_ratio / 100);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) /* tipc_bcbase_select_primary(): find a bearer with links to all destinations,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  *                               if any, and make it primary bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) static void tipc_bcbase_select_primary(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	struct tipc_bc_base *bb = tipc_bc_base(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	int all_dests =  tipc_link_bc_peers(bb->link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	int max_win = tipc_link_max_win(bb->link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	int min_win = tipc_link_min_win(bb->link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	int i, mtu, prim;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	bb->primary_bearer = INVALID_BEARER_ID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	bb->bcast_support = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	if (!all_dests)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	for (i = 0; i < MAX_BEARERS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		if (!bb->dests[i])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		mtu = tipc_bearer_mtu(net, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		if (mtu < tipc_link_mtu(bb->link)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 			tipc_link_set_mtu(bb->link, mtu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 			tipc_link_set_queue_limits(bb->link,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 						   min_win,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 						   max_win);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		bb->bcast_support &= tipc_bearer_bcast_support(net, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		if (bb->dests[i] < all_dests)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		bb->primary_bearer = i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		/* Reduce risk that all nodes select same primary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		if ((i ^ tipc_own_addr(net)) & 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	prim = bb->primary_bearer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	if (prim != INVALID_BEARER_ID)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		bb->bcast_support = tipc_bearer_bcast_support(net, prim);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) void tipc_bcast_inc_bearer_dst_cnt(struct net *net, int bearer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	struct tipc_bc_base *bb = tipc_bc_base(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	bb->dests[bearer_id]++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	tipc_bcbase_select_primary(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) void tipc_bcast_dec_bearer_dst_cnt(struct net *net, int bearer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	struct tipc_bc_base *bb = tipc_bc_base(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	bb->dests[bearer_id]--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	tipc_bcbase_select_primary(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /* tipc_bcbase_xmit - broadcast a packet queue across one or more bearers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  * Note that number of reachable destinations, as indicated in the dests[]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  * array, may transitionally differ from the number of destinations indicated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)  * in each sent buffer. We can sustain this. Excess destination nodes will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  * drop and never acknowledge the unexpected packets, and missing destinations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  * will either require retransmission (if they are just about to be added to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  * the bearer), or be removed from the buffer's 'ackers' counter (if they
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)  * just went down)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) static void tipc_bcbase_xmit(struct net *net, struct sk_buff_head *xmitq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	int bearer_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	struct tipc_bc_base *bb = tipc_bc_base(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	struct sk_buff *skb, *_skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	struct sk_buff_head _xmitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	if (skb_queue_empty(xmitq))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	/* The typical case: at least one bearer has links to all nodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	bearer_id = bb->primary_bearer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	if (bearer_id >= 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 		tipc_bearer_bc_xmit(net, bearer_id, xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	/* We have to transmit across all bearers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	__skb_queue_head_init(&_xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	for (bearer_id = 0; bearer_id < MAX_BEARERS; bearer_id++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		if (!bb->dests[bearer_id])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		skb_queue_walk(xmitq, skb) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 			_skb = pskb_copy_for_clone(skb, GFP_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 			if (!_skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 			__skb_queue_tail(&_xmitq, _skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		tipc_bearer_bc_xmit(net, bearer_id, &_xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	__skb_queue_purge(xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	__skb_queue_purge(&_xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) static void tipc_bcast_select_xmit_method(struct net *net, int dests,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 					  struct tipc_mc_method *method)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	struct tipc_bc_base *bb = tipc_bc_base(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	unsigned long exp = method->expires;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	/* Broadcast supported by used bearer/bearers? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	if (!bb->bcast_support) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		method->rcast = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	/* Any destinations which don't support replicast ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	if (!bb->rcast_support) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		method->rcast = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	/* Can current method be changed ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	method->expires = jiffies + TIPC_METHOD_EXPIRE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	if (method->mandatory)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	if (!(tipc_net(net)->capabilities & TIPC_MCAST_RBCTL) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	    time_before(jiffies, exp))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	/* Configuration as force 'broadcast' method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	if (bb->force_bcast) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 		method->rcast = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	/* Configuration as force 'replicast' method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	if (bb->force_rcast) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 		method->rcast = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	/* Configuration as 'autoselect' or default method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	/* Determine method to use now */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	method->rcast = dests <= bb->bc_threshold;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) /* tipc_bcast_xmit - broadcast the buffer chain to all external nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)  * @net: the applicable net namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)  * @pkts: chain of buffers containing message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)  * @cong_link_cnt: set to 1 if broadcast link is congested, otherwise 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)  * Consumes the buffer chain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)  * Returns 0 if success, otherwise errno: -EHOSTUNREACH,-EMSGSIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) int tipc_bcast_xmit(struct net *net, struct sk_buff_head *pkts,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 		    u16 *cong_link_cnt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	struct tipc_link *l = tipc_bc_sndlink(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	struct sk_buff_head xmitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	__skb_queue_head_init(&xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	if (tipc_link_bc_peers(l))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 		rc = tipc_link_xmit(l, pkts, &xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	tipc_bcbase_xmit(net, &xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	__skb_queue_purge(pkts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	if (rc == -ELINKCONG) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 		*cong_link_cnt = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) /* tipc_rcast_xmit - replicate and send a message to given destination nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)  * @net: the applicable net namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)  * @pkts: chain of buffers containing message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)  * @dests: list of destination nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)  * @cong_link_cnt: returns number of congested links
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  * @cong_links: returns identities of congested links
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)  * Returns 0 if success, otherwise errno
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) static int tipc_rcast_xmit(struct net *net, struct sk_buff_head *pkts,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 			   struct tipc_nlist *dests, u16 *cong_link_cnt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	struct tipc_dest *dst, *tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	struct sk_buff_head _pkts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	u32 dnode, selector;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	selector = msg_link_selector(buf_msg(skb_peek(pkts)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	__skb_queue_head_init(&_pkts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	list_for_each_entry_safe(dst, tmp, &dests->list, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 		dnode = dst->node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 		if (!tipc_msg_pskb_copy(dnode, pkts, &_pkts))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 			return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 		/* Any other return value than -ELINKCONG is ignored */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 		if (tipc_node_xmit(net, &_pkts, dnode, selector) == -ELINKCONG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 			(*cong_link_cnt)++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) /* tipc_mcast_send_sync - deliver a dummy message with SYN bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  * @net: the applicable net namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  * @skb: socket buffer to copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)  * @method: send method to be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)  * @dests: destination nodes for message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)  * Returns 0 if success, otherwise errno
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) static int tipc_mcast_send_sync(struct net *net, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 				struct tipc_mc_method *method,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 				struct tipc_nlist *dests)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	struct tipc_msg *hdr, *_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	struct sk_buff_head tmpq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	struct sk_buff *_skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	u16 cong_link_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	/* Is a cluster supporting with new capabilities ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	if (!(tipc_net(net)->capabilities & TIPC_MCAST_RBCTL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	hdr = buf_msg(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	if (msg_user(hdr) == MSG_FRAGMENTER)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 		hdr = msg_inner_hdr(hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	if (msg_type(hdr) != TIPC_MCAST_MSG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	/* Allocate dummy message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	_skb = tipc_buf_acquire(MCAST_H_SIZE, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	if (!_skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	/* Preparing for 'synching' header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	msg_set_syn(hdr, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	/* Copy skb's header into a dummy header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	skb_copy_to_linear_data(_skb, hdr, MCAST_H_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	skb_orphan(_skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	/* Reverse method for dummy message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	_hdr = buf_msg(_skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	msg_set_size(_hdr, MCAST_H_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	msg_set_is_rcast(_hdr, !msg_is_rcast(hdr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	msg_set_errcode(_hdr, TIPC_ERR_NO_PORT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	__skb_queue_head_init(&tmpq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	__skb_queue_tail(&tmpq, _skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	if (method->rcast)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 		rc = tipc_bcast_xmit(net, &tmpq, &cong_link_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 		rc = tipc_rcast_xmit(net, &tmpq, dests, &cong_link_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	/* This queue should normally be empty by now */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	__skb_queue_purge(&tmpq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) /* tipc_mcast_xmit - deliver message to indicated destination nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)  *                   and to identified node local sockets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)  * @net: the applicable net namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)  * @pkts: chain of buffers containing message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)  * @method: send method to be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)  * @dests: destination nodes for message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)  * @cong_link_cnt: returns number of encountered congested destination links
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)  * Consumes buffer chain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)  * Returns 0 if success, otherwise errno
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) int tipc_mcast_xmit(struct net *net, struct sk_buff_head *pkts,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 		    struct tipc_mc_method *method, struct tipc_nlist *dests,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 		    u16 *cong_link_cnt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	struct sk_buff_head inputq, localq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	bool rcast = method->rcast;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	struct tipc_msg *hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	skb_queue_head_init(&inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	__skb_queue_head_init(&localq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	/* Clone packets before they are consumed by next call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	if (dests->local && !tipc_msg_reassemble(pkts, &localq)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 		rc = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 		goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	/* Send according to determined transmit method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	if (dests->remote) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 		tipc_bcast_select_xmit_method(net, dests->remote, method);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 		skb = skb_peek(pkts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 		hdr = buf_msg(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 		if (msg_user(hdr) == MSG_FRAGMENTER)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 			hdr = msg_inner_hdr(hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 		msg_set_is_rcast(hdr, method->rcast);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 		/* Switch method ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 		if (rcast != method->rcast) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 			rc = tipc_mcast_send_sync(net, skb, method, dests);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 			if (unlikely(rc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 				pr_err("Unable to send SYN: method %d, rc %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 				       rcast, rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 				goto exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 		if (method->rcast)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 			rc = tipc_rcast_xmit(net, pkts, dests, cong_link_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 			rc = tipc_bcast_xmit(net, pkts, cong_link_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	if (dests->local) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 		tipc_loopback_trace(net, &localq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 		tipc_sk_mcast_rcv(net, &localq, &inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 	/* This queue should normally be empty by now */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 	__skb_queue_purge(pkts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) /* tipc_bcast_rcv - receive a broadcast packet, and deliver to rcv link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)  * RCU is locked, no other locks set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) int tipc_bcast_rcv(struct net *net, struct tipc_link *l, struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	struct tipc_msg *hdr = buf_msg(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 	struct sk_buff_head xmitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 	__skb_queue_head_init(&xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 	if (msg_mc_netid(hdr) != tipc_netid(net) || !tipc_link_is_up(l)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 		kfree_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 	if (msg_user(hdr) == BCAST_PROTOCOL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 		rc = tipc_link_bc_nack_rcv(l, skb, &xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 		rc = tipc_link_rcv(l, skb, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 	tipc_bcbase_xmit(net, &xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	/* Any socket wakeup messages ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 	if (!skb_queue_empty(inputq))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 		tipc_sk_rcv(net, inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) /* tipc_bcast_ack_rcv - receive and handle a broadcast acknowledge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)  * RCU is locked, no other locks set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) void tipc_bcast_ack_rcv(struct net *net, struct tipc_link *l,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 			struct tipc_msg *hdr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 	struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 	u16 acked = msg_bcast_ack(hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 	struct sk_buff_head xmitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 	/* Ignore bc acks sent by peer before bcast synch point was received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 	if (msg_bc_ack_invalid(hdr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 	__skb_queue_head_init(&xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 	tipc_link_bc_ack_rcv(l, acked, 0, NULL, &xmitq, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 	tipc_bcbase_xmit(net, &xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 	/* Any socket wakeup messages ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 	if (!skb_queue_empty(inputq))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 		tipc_sk_rcv(net, inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) /* tipc_bcast_synch_rcv -  check and update rcv link with peer's send state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)  * RCU is locked, no other locks set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) int tipc_bcast_sync_rcv(struct net *net, struct tipc_link *l,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 			struct tipc_msg *hdr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 			struct sk_buff_head *retrq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 	struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 	struct tipc_gap_ack_blks *ga;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 	struct sk_buff_head xmitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 	int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 	__skb_queue_head_init(&xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 	if (msg_type(hdr) != STATE_MSG) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 		tipc_link_bc_init_rcv(l, hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 	} else if (!msg_bc_ack_invalid(hdr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 		tipc_get_gap_ack_blks(&ga, l, hdr, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 		if (!sysctl_tipc_bc_retruni)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 			retrq = &xmitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 		rc = tipc_link_bc_ack_rcv(l, msg_bcast_ack(hdr),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 					  msg_bc_gap(hdr), ga, &xmitq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 					  retrq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 		rc |= tipc_link_bc_sync_rcv(l, hdr, &xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 	tipc_bcbase_xmit(net, &xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 	/* Any socket wakeup messages ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 	if (!skb_queue_empty(inputq))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 		tipc_sk_rcv(net, inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) /* tipc_bcast_add_peer - add a peer node to broadcast link and bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)  * RCU is locked, node lock is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) void tipc_bcast_add_peer(struct net *net, struct tipc_link *uc_l,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 			 struct sk_buff_head *xmitq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 	struct tipc_link *snd_l = tipc_bc_sndlink(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 	tipc_link_add_bc_peer(snd_l, uc_l, xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 	tipc_bcbase_select_primary(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 	tipc_bcbase_calc_bc_threshold(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) /* tipc_bcast_remove_peer - remove a peer node from broadcast link and bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)  * RCU is locked, node lock is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) void tipc_bcast_remove_peer(struct net *net, struct tipc_link *rcv_l)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 	struct tipc_link *snd_l = tipc_bc_sndlink(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 	struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 	struct sk_buff_head xmitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	__skb_queue_head_init(&xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 	tipc_link_remove_bc_peer(snd_l, rcv_l, &xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 	tipc_bcbase_select_primary(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 	tipc_bcbase_calc_bc_threshold(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 	tipc_bcbase_xmit(net, &xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 	/* Any socket wakeup messages ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 	if (!skb_queue_empty(inputq))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 		tipc_sk_rcv(net, inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) int tipc_bclink_reset_stats(struct net *net, struct tipc_link *l)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 	if (!l)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 		return -ENOPROTOOPT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 	tipc_link_reset_stats(l);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) static int tipc_bc_link_set_queue_limits(struct net *net, u32 max_win)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 	struct tipc_link *l = tipc_bc_sndlink(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 	if (!l)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 		return -ENOPROTOOPT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 	if (max_win < BCLINK_WIN_MIN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 		max_win = BCLINK_WIN_MIN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 	if (max_win > TIPC_MAX_LINK_WIN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 	tipc_link_set_queue_limits(l, tipc_link_min_win(l), max_win);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) static int tipc_bc_link_set_broadcast_mode(struct net *net, u32 bc_mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 	struct tipc_bc_base *bb = tipc_bc_base(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 	switch (bc_mode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 	case BCLINK_MODE_BCAST:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 		if (!bb->bcast_support)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 			return -ENOPROTOOPT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) 		bb->force_bcast = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 		bb->force_rcast = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 	case BCLINK_MODE_RCAST:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 		if (!bb->rcast_support)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 			return -ENOPROTOOPT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 		bb->force_bcast = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 		bb->force_rcast = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 	case BCLINK_MODE_SEL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) 		if (!bb->bcast_support || !bb->rcast_support)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 			return -ENOPROTOOPT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) 		bb->force_bcast = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) 		bb->force_rcast = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) static int tipc_bc_link_set_broadcast_ratio(struct net *net, u32 bc_ratio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) 	struct tipc_bc_base *bb = tipc_bc_base(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) 	if (!bb->bcast_support || !bb->rcast_support)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 		return -ENOPROTOOPT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 	if (bc_ratio > 100 || bc_ratio <= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) 	bb->rc_ratio = bc_ratio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 	tipc_bcast_lock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) 	tipc_bcbase_calc_bc_threshold(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) 	tipc_bcast_unlock(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) int tipc_nl_bc_link_set(struct net *net, struct nlattr *attrs[])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 	u32 win;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 	u32 bc_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 	u32 bc_ratio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 	struct nlattr *props[TIPC_NLA_PROP_MAX + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 	if (!attrs[TIPC_NLA_LINK_PROP])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) 	err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_LINK_PROP], props);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) 	if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 		return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 	if (!props[TIPC_NLA_PROP_WIN] &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 	    !props[TIPC_NLA_PROP_BROADCAST] &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 	    !props[TIPC_NLA_PROP_BROADCAST_RATIO]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) 	if (props[TIPC_NLA_PROP_BROADCAST]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) 		bc_mode = nla_get_u32(props[TIPC_NLA_PROP_BROADCAST]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) 		err = tipc_bc_link_set_broadcast_mode(net, bc_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 	if (!err && props[TIPC_NLA_PROP_BROADCAST_RATIO]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) 		bc_ratio = nla_get_u32(props[TIPC_NLA_PROP_BROADCAST_RATIO]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) 		err = tipc_bc_link_set_broadcast_ratio(net, bc_ratio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) 	if (!err && props[TIPC_NLA_PROP_WIN]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) 		win = nla_get_u32(props[TIPC_NLA_PROP_WIN]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) 		err = tipc_bc_link_set_queue_limits(net, win);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) 	return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) int tipc_bcast_init(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) 	struct tipc_net *tn = tipc_net(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) 	struct tipc_bc_base *bb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) 	struct tipc_link *l = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) 	bb = kzalloc(sizeof(*bb), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) 	if (!bb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) 		goto enomem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) 	tn->bcbase = bb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) 	spin_lock_init(&tipc_net(net)->bclock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) 	if (!tipc_link_bc_create(net, 0, 0, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) 				 one_page_mtu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) 				 BCLINK_WIN_DEFAULT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) 				 BCLINK_WIN_DEFAULT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) 				 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) 				 &bb->inputq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) 				 NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) 				 NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) 				 &l))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) 		goto enomem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) 	bb->link = l;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) 	tn->bcl = l;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) 	bb->rc_ratio = 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) 	bb->rcast_support = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) enomem:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) 	kfree(bb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) 	kfree(l);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) 	return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) void tipc_bcast_stop(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) 	struct tipc_net *tn = net_generic(net, tipc_net_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) 	synchronize_net();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) 	kfree(tn->bcbase);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) 	kfree(tn->bcl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) void tipc_nlist_init(struct tipc_nlist *nl, u32 self)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) 	memset(nl, 0, sizeof(*nl));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) 	INIT_LIST_HEAD(&nl->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) 	nl->self = self;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) void tipc_nlist_add(struct tipc_nlist *nl, u32 node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) 	if (node == nl->self)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) 		nl->local = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) 	else if (tipc_dest_push(&nl->list, node, 0))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) 		nl->remote++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) void tipc_nlist_del(struct tipc_nlist *nl, u32 node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) 	if (node == nl->self)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) 		nl->local = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) 	else if (tipc_dest_del(&nl->list, node, 0))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) 		nl->remote--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) void tipc_nlist_purge(struct tipc_nlist *nl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) 	tipc_dest_list_purge(&nl->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) 	nl->remote = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) 	nl->local = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) u32 tipc_bcast_get_mode(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) 	struct tipc_bc_base *bb = tipc_bc_base(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) 	if (bb->force_bcast)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) 		return BCLINK_MODE_BCAST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) 	if (bb->force_rcast)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) 		return BCLINK_MODE_RCAST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) 	if (bb->bcast_support && bb->rcast_support)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) 		return BCLINK_MODE_SEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) u32 tipc_bcast_get_broadcast_ratio(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) 	struct tipc_bc_base *bb = tipc_bc_base(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) 	return bb->rc_ratio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) void tipc_mcast_filter_msg(struct net *net, struct sk_buff_head *defq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) 			   struct sk_buff_head *inputq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) 	struct sk_buff *skb, *_skb, *tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) 	struct tipc_msg *hdr, *_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) 	bool match = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) 	u32 node, port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) 	skb = skb_peek(inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) 	if (!skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) 	hdr = buf_msg(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) 	if (likely(!msg_is_syn(hdr) && skb_queue_empty(defq)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) 	node = msg_orignode(hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) 	if (node == tipc_own_addr(net))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) 	port = msg_origport(hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) 	/* Has the twin SYN message already arrived ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) 	skb_queue_walk(defq, _skb) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) 		_hdr = buf_msg(_skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) 		if (msg_orignode(_hdr) != node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) 		if (msg_origport(_hdr) != port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) 		match = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) 	if (!match) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) 		if (!msg_is_syn(hdr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) 		__skb_dequeue(inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) 		__skb_queue_tail(defq, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) 	/* Deliver non-SYN message from other link, otherwise queue it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) 	if (!msg_is_syn(hdr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) 		if (msg_is_rcast(hdr) != msg_is_rcast(_hdr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) 		__skb_dequeue(inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) 		__skb_queue_tail(defq, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) 	/* Queue non-SYN/SYN message from same link */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) 	if (msg_is_rcast(hdr) == msg_is_rcast(_hdr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) 		__skb_dequeue(inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) 		__skb_queue_tail(defq, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) 	/* Matching SYN messages => return the one with data, if any */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) 	__skb_unlink(_skb, defq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844) 	if (msg_data_sz(hdr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) 		kfree_skb(_skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) 		__skb_dequeue(inputq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) 		kfree_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) 		__skb_queue_tail(inputq, _skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) 	/* Deliver subsequent non-SYN messages from same peer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) 	skb_queue_walk_safe(defq, _skb, tmp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) 		_hdr = buf_msg(_skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855) 		if (msg_orignode(_hdr) != node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) 		if (msg_origport(_hdr) != port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859) 		if (msg_is_syn(_hdr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) 		__skb_unlink(_skb, defq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) 		__skb_queue_tail(inputq, _skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) }