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)  * Copyright (c) 2006, 2017 Oracle and/or its affiliates. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * This software is available to you under a choice of one of two
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * licenses.  You may choose to be licensed under the terms of the GNU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * General Public License (GPL) Version 2, available from the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * COPYING in the main directory of this source tree, or the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * OpenIB.org BSD license below:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *     Redistribution and use in source and binary forms, with or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *     without modification, are permitted provided that the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *     conditions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *      - Redistributions of source code must retain the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *        copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *        disclaimer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *      - Redistributions in binary form must reproduce the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *        copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *        disclaimer in the documentation and/or other materials
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *        provided with the distribution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <linux/in.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include <net/net_namespace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include <net/netns/generic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <linux/ipv6.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include "rds_single_path.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #include "rds.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include "loop.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) static DEFINE_SPINLOCK(loop_conns_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) static LIST_HEAD(loop_conns);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) static atomic_t rds_loop_unloading = ATOMIC_INIT(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) static void rds_loop_set_unloading(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	atomic_set(&rds_loop_unloading, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) static bool rds_loop_is_unloading(struct rds_connection *conn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	return atomic_read(&rds_loop_unloading) != 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * This 'loopback' transport is a special case for flows that originate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * and terminate on the same machine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * Connection build-up notices if the destination address is thought of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  * as a local address by a transport.  At that time it decides to use the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * loopback transport instead of the bound transport of the sending socket.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  * The loopback transport's sending path just hands the sent rds_message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * straight to the receiving path via an embedded rds_incoming.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  * Usually a message transits both the sender and receiver's conns as it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  * flows to the receiver.  In the loopback case, though, the receive path
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  * is handed the sending conn so the sense of the addresses is reversed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) static int rds_loop_xmit(struct rds_connection *conn, struct rds_message *rm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 			 unsigned int hdr_off, unsigned int sg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 			 unsigned int off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	struct scatterlist *sgp = &rm->data.op_sg[sg];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	int ret = sizeof(struct rds_header) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 			be32_to_cpu(rm->m_inc.i_hdr.h_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	/* Do not send cong updates to loopback */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	if (rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		ret = min_t(int, ret, sgp->length - conn->c_xmit_data_off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	BUG_ON(hdr_off || sg || off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	rds_inc_init(&rm->m_inc, conn, &conn->c_laddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	/* For the embedded inc. Matching put is in loop_inc_free() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	rds_message_addref(rm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	rds_recv_incoming(conn, &conn->c_laddr, &conn->c_faddr, &rm->m_inc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 			  GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	rds_send_drop_acked(conn, be64_to_cpu(rm->m_inc.i_hdr.h_sequence),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			    NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	rds_inc_put(&rm->m_inc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * See rds_loop_xmit(). Since our inc is embedded in the rm, we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * make sure the rm lives at least until the inc is done.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static void rds_loop_inc_free(struct rds_incoming *inc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	struct rds_message *rm = container_of(inc, struct rds_message, m_inc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	rds_message_put(rm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /* we need to at least give the thread something to succeed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) static int rds_loop_recv_path(struct rds_conn_path *cp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) struct rds_loop_connection {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	struct list_head loop_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	struct rds_connection *conn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)  * Even the loopback transport needs to keep track of its connections,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)  * so it can call rds_conn_destroy() on them on exit. N.B. there are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)  * 1+ loopback addresses (127.*.*.*) so it's not a bug to have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * multiple loopback conns allocated, although rather useless.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) static int rds_loop_conn_alloc(struct rds_connection *conn, gfp_t gfp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	struct rds_loop_connection *lc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	lc = kzalloc(sizeof(struct rds_loop_connection), gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	if (!lc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	INIT_LIST_HEAD(&lc->loop_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	lc->conn = conn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	conn->c_transport_data = lc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	spin_lock_irqsave(&loop_conns_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	list_add_tail(&lc->loop_node, &loop_conns);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	spin_unlock_irqrestore(&loop_conns_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static void rds_loop_conn_free(void *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	struct rds_loop_connection *lc = arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	rdsdebug("lc %p\n", lc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	spin_lock_irqsave(&loop_conns_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	list_del(&lc->loop_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	spin_unlock_irqrestore(&loop_conns_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	kfree(lc);
^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) static int rds_loop_conn_path_connect(struct rds_conn_path *cp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	rds_connect_complete(cp->cp_conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) static void rds_loop_conn_path_shutdown(struct rds_conn_path *cp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) void rds_loop_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	struct rds_loop_connection *lc, *_lc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	LIST_HEAD(tmp_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	rds_loop_set_unloading();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	synchronize_rcu();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	/* avoid calling conn_destroy with irqs off */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	spin_lock_irq(&loop_conns_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	list_splice(&loop_conns, &tmp_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	INIT_LIST_HEAD(&loop_conns);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	spin_unlock_irq(&loop_conns_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	list_for_each_entry_safe(lc, _lc, &tmp_list, loop_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		WARN_ON(lc->conn->c_passive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		rds_conn_destroy(lc->conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) static void rds_loop_kill_conns(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	struct rds_loop_connection *lc, *_lc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	LIST_HEAD(tmp_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	spin_lock_irq(&loop_conns_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	list_for_each_entry_safe(lc, _lc, &loop_conns, loop_node)  {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		struct net *c_net = read_pnet(&lc->conn->c_net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		if (net != c_net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		list_move_tail(&lc->loop_node, &tmp_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	spin_unlock_irq(&loop_conns_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	list_for_each_entry_safe(lc, _lc, &tmp_list, loop_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		WARN_ON(lc->conn->c_passive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		rds_conn_destroy(lc->conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) static void __net_exit rds_loop_exit_net(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	rds_loop_kill_conns(net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static struct pernet_operations rds_loop_net_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	.exit = rds_loop_exit_net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) int rds_loop_net_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	return register_pernet_device(&rds_loop_net_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) void rds_loop_net_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	unregister_pernet_device(&rds_loop_net_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)  * This is missing .xmit_* because loop doesn't go through generic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)  * rds_send_xmit() and doesn't call rds_recv_incoming().  .listen_stop and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  * .laddr_check are missing because transport.c doesn't iterate over
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  * rds_loop_transport.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) struct rds_transport rds_loop_transport = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	.xmit			= rds_loop_xmit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	.recv_path		= rds_loop_recv_path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	.conn_alloc		= rds_loop_conn_alloc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	.conn_free		= rds_loop_conn_free,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	.conn_path_connect	= rds_loop_conn_path_connect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	.conn_path_shutdown	= rds_loop_conn_path_shutdown,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	.inc_copy_to_user	= rds_message_inc_copy_to_user,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	.inc_free		= rds_loop_inc_free,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	.t_name			= "loopback",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	.t_type			= RDS_TRANS_LOOP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	.t_unloading		= rds_loop_is_unloading,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) };