xref: /onnv-gate/usr/src/uts/common/io/ib/clients/rdsv3/threads.c (revision 12763:4b30642bc04e)
112198SEiji.Ota@Sun.COM /*
212198SEiji.Ota@Sun.COM  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
312198SEiji.Ota@Sun.COM  */
412198SEiji.Ota@Sun.COM 
512198SEiji.Ota@Sun.COM /*
6*12763SGiri.Adari@Sun.COM  * This file contains code imported from the OFED rds source file threads.c
7*12763SGiri.Adari@Sun.COM  * Oracle elects to have and use the contents of threads.c under and governed
8*12763SGiri.Adari@Sun.COM  * by the OpenIB.org BSD license (see below for full license text). However,
9*12763SGiri.Adari@Sun.COM  * the following notice accompanied the original version of this file:
10*12763SGiri.Adari@Sun.COM  */
11*12763SGiri.Adari@Sun.COM 
12*12763SGiri.Adari@Sun.COM /*
1312198SEiji.Ota@Sun.COM  * Copyright (c) 2006 Oracle.  All rights reserved.
1412198SEiji.Ota@Sun.COM  *
1512198SEiji.Ota@Sun.COM  * This software is available to you under a choice of one of two
1612198SEiji.Ota@Sun.COM  * licenses.  You may choose to be licensed under the terms of the GNU
1712198SEiji.Ota@Sun.COM  * General Public License (GPL) Version 2, available from the file
1812198SEiji.Ota@Sun.COM  * COPYING in the main directory of this source tree, or the
1912198SEiji.Ota@Sun.COM  * OpenIB.org BSD license below:
2012198SEiji.Ota@Sun.COM  *
2112198SEiji.Ota@Sun.COM  *     Redistribution and use in source and binary forms, with or
2212198SEiji.Ota@Sun.COM  *     without modification, are permitted provided that the following
2312198SEiji.Ota@Sun.COM  *     conditions are met:
2412198SEiji.Ota@Sun.COM  *
2512198SEiji.Ota@Sun.COM  *      - Redistributions of source code must retain the above
2612198SEiji.Ota@Sun.COM  *        copyright notice, this list of conditions and the following
2712198SEiji.Ota@Sun.COM  *        disclaimer.
2812198SEiji.Ota@Sun.COM  *
2912198SEiji.Ota@Sun.COM  *      - Redistributions in binary form must reproduce the above
3012198SEiji.Ota@Sun.COM  *        copyright notice, this list of conditions and the following
3112198SEiji.Ota@Sun.COM  *        disclaimer in the documentation and/or other materials
3212198SEiji.Ota@Sun.COM  *        provided with the distribution.
3312198SEiji.Ota@Sun.COM  *
3412198SEiji.Ota@Sun.COM  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3512198SEiji.Ota@Sun.COM  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3612198SEiji.Ota@Sun.COM  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3712198SEiji.Ota@Sun.COM  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
3812198SEiji.Ota@Sun.COM  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
3912198SEiji.Ota@Sun.COM  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
4012198SEiji.Ota@Sun.COM  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4112198SEiji.Ota@Sun.COM  * SOFTWARE.
4212198SEiji.Ota@Sun.COM  *
4312198SEiji.Ota@Sun.COM  */
4412198SEiji.Ota@Sun.COM #include <sys/rds.h>
4512198SEiji.Ota@Sun.COM #include <sys/sunddi.h>
4612198SEiji.Ota@Sun.COM 
4712198SEiji.Ota@Sun.COM #include <sys/ib/clients/rdsv3/rdsv3.h>
4812198SEiji.Ota@Sun.COM #include <sys/ib/clients/rdsv3/rdsv3_debug.h>
4912198SEiji.Ota@Sun.COM 
5012198SEiji.Ota@Sun.COM /*
5112198SEiji.Ota@Sun.COM  * All of connection management is simplified by serializing it through
5212198SEiji.Ota@Sun.COM  * work queues that execute in a connection managing thread.
5312198SEiji.Ota@Sun.COM  *
5412198SEiji.Ota@Sun.COM  * TCP wants to send acks through sendpage() in response to data_ready(),
5512198SEiji.Ota@Sun.COM  * but it needs a process context to do so.
5612198SEiji.Ota@Sun.COM  *
5712198SEiji.Ota@Sun.COM  * The receive paths need to allocate but can't drop packets (!) so we have
5812198SEiji.Ota@Sun.COM  * a thread around to block allocating if the receive fast path sees an
5912198SEiji.Ota@Sun.COM  * allocation failure.
6012198SEiji.Ota@Sun.COM  */
6112198SEiji.Ota@Sun.COM 
6212198SEiji.Ota@Sun.COM /*
6312198SEiji.Ota@Sun.COM  * Grand Unified Theory of connection life cycle:
6412198SEiji.Ota@Sun.COM  * At any point in time, the connection can be in one of these states:
6512198SEiji.Ota@Sun.COM  * DOWN, CONNECTING, UP, DISCONNECTING, ERROR
6612198SEiji.Ota@Sun.COM  *
6712198SEiji.Ota@Sun.COM  * The following transitions are possible:
6812198SEiji.Ota@Sun.COM  *  ANY		  -> ERROR
6912198SEiji.Ota@Sun.COM  *  UP		  -> DISCONNECTING
7012198SEiji.Ota@Sun.COM  *  ERROR	  -> DISCONNECTING
7112198SEiji.Ota@Sun.COM  *  DISCONNECTING -> DOWN
7212198SEiji.Ota@Sun.COM  *  DOWN	  -> CONNECTING
7312198SEiji.Ota@Sun.COM  *  CONNECTING	  -> UP
7412198SEiji.Ota@Sun.COM  *
7512198SEiji.Ota@Sun.COM  * Transition to state DISCONNECTING/DOWN:
7612198SEiji.Ota@Sun.COM  *  -	Inside the shutdown worker; synchronizes with xmit path
7712198SEiji.Ota@Sun.COM  *	through c_send_lock, and with connection management callbacks
7812198SEiji.Ota@Sun.COM  *	via c_cm_lock.
7912198SEiji.Ota@Sun.COM  *
8012198SEiji.Ota@Sun.COM  *	For receive callbacks, we rely on the underlying transport
8112198SEiji.Ota@Sun.COM  *	(TCP, IB/RDMA) to provide the necessary synchronisation.
8212198SEiji.Ota@Sun.COM  */
8312198SEiji.Ota@Sun.COM struct rdsv3_workqueue_struct_s *rdsv3_wq;
8412198SEiji.Ota@Sun.COM 
8512198SEiji.Ota@Sun.COM void
rdsv3_connect_complete(struct rdsv3_connection * conn)8612198SEiji.Ota@Sun.COM rdsv3_connect_complete(struct rdsv3_connection *conn)
8712198SEiji.Ota@Sun.COM {
8812198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF4("rdsv3_connect_complete", "Enter(conn: %p)", conn);
8912198SEiji.Ota@Sun.COM 
9012198SEiji.Ota@Sun.COM 	if (!rdsv3_conn_transition(conn, RDSV3_CONN_CONNECTING,
9112198SEiji.Ota@Sun.COM 	    RDSV3_CONN_UP)) {
9212198SEiji.Ota@Sun.COM #ifndef __lock_lint
9312320SGiri.Adari@Sun.COM 		RDSV3_DPRINTF2("rdsv3_connect_complete",
9412198SEiji.Ota@Sun.COM 		    "%s: Cannot transition to state UP, "
9512198SEiji.Ota@Sun.COM 		    "current state is %d",
9612198SEiji.Ota@Sun.COM 		    __func__,
9712198SEiji.Ota@Sun.COM 		    atomic_get(&conn->c_state));
9812198SEiji.Ota@Sun.COM #endif
9912198SEiji.Ota@Sun.COM 		conn->c_state = RDSV3_CONN_ERROR;
10012198SEiji.Ota@Sun.COM 		rdsv3_queue_work(rdsv3_wq, &conn->c_down_w);
10112198SEiji.Ota@Sun.COM 		return;
10212198SEiji.Ota@Sun.COM 	}
10312198SEiji.Ota@Sun.COM 
10412198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF2("rdsv3_connect_complete",
10512198SEiji.Ota@Sun.COM 	    "conn %p for %u.%u.%u.%u to %u.%u.%u.%u complete",
10612198SEiji.Ota@Sun.COM 	    conn, NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr));
10712198SEiji.Ota@Sun.COM 
10812198SEiji.Ota@Sun.COM 	conn->c_reconnect_jiffies = 0;
10912676SEiji.Ota@Sun.COM 	conn->c_last_connect_jiffies = ddi_get_lbolt();
11012676SEiji.Ota@Sun.COM 
11112198SEiji.Ota@Sun.COM 	set_bit(0, &conn->c_map_queued);
11212198SEiji.Ota@Sun.COM 	rdsv3_queue_delayed_work(rdsv3_wq, &conn->c_send_w, 0);
11312198SEiji.Ota@Sun.COM 	rdsv3_queue_delayed_work(rdsv3_wq, &conn->c_recv_w, 0);
11412198SEiji.Ota@Sun.COM 
11512198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF4("rdsv3_connect_complete", "Return(conn: %p)", conn);
11612198SEiji.Ota@Sun.COM }
11712198SEiji.Ota@Sun.COM 
11812198SEiji.Ota@Sun.COM /*
11912198SEiji.Ota@Sun.COM  * This random exponential backoff is relied on to eventually resolve racing
12012198SEiji.Ota@Sun.COM  * connects.
12112198SEiji.Ota@Sun.COM  *
12212198SEiji.Ota@Sun.COM  * If connect attempts race then both parties drop both connections and come
12312198SEiji.Ota@Sun.COM  * here to wait for a random amount of time before trying again.  Eventually
12412198SEiji.Ota@Sun.COM  * the backoff range will be so much greater than the time it takes to
12512198SEiji.Ota@Sun.COM  * establish a connection that one of the pair will establish the connection
12612198SEiji.Ota@Sun.COM  * before the other's random delay fires.
12712198SEiji.Ota@Sun.COM  *
12812198SEiji.Ota@Sun.COM  * Connection attempts that arrive while a connection is already established
12912198SEiji.Ota@Sun.COM  * are also considered to be racing connects.  This lets a connection from
13012198SEiji.Ota@Sun.COM  * a rebooted machine replace an existing stale connection before the transport
13112198SEiji.Ota@Sun.COM  * notices that the connection has failed.
13212198SEiji.Ota@Sun.COM  *
13312198SEiji.Ota@Sun.COM  * We should *always* start with a random backoff; otherwise a broken connection
13412198SEiji.Ota@Sun.COM  * will always take several iterations to be re-established.
13512198SEiji.Ota@Sun.COM  */
13612676SEiji.Ota@Sun.COM void
rdsv3_queue_reconnect(struct rdsv3_connection * conn)13712198SEiji.Ota@Sun.COM rdsv3_queue_reconnect(struct rdsv3_connection *conn)
13812198SEiji.Ota@Sun.COM {
13912198SEiji.Ota@Sun.COM 	unsigned long rand;
14012198SEiji.Ota@Sun.COM 
14112198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF2("rdsv3_queue_reconnect",
14212198SEiji.Ota@Sun.COM 	    "conn %p for %u.%u.%u.%u to %u.%u.%u.%u reconnect jiffies %lu",
14312198SEiji.Ota@Sun.COM 	    conn, NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr),
14412198SEiji.Ota@Sun.COM 	    conn->c_reconnect_jiffies);
14512198SEiji.Ota@Sun.COM 
14612198SEiji.Ota@Sun.COM 	set_bit(RDSV3_RECONNECT_PENDING, &conn->c_flags);
14712198SEiji.Ota@Sun.COM 	if (conn->c_reconnect_jiffies == 0) {
14812198SEiji.Ota@Sun.COM 		conn->c_reconnect_jiffies = rdsv3_sysctl_reconnect_min_jiffies;
14912198SEiji.Ota@Sun.COM 		rdsv3_queue_delayed_work(rdsv3_wq, &conn->c_conn_w, 0);
15012198SEiji.Ota@Sun.COM 		return;
15112198SEiji.Ota@Sun.COM 	}
15212198SEiji.Ota@Sun.COM 
15312198SEiji.Ota@Sun.COM 	(void) random_get_pseudo_bytes((uint8_t *)&rand, sizeof (rand));
15412414SEiji.Ota@Sun.COM 
15512198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF5("rdsv3",
15612198SEiji.Ota@Sun.COM 	    "%lu delay %lu ceil conn %p for %u.%u.%u.%u -> %u.%u.%u.%u",
15712198SEiji.Ota@Sun.COM 	    rand % conn->c_reconnect_jiffies, conn->c_reconnect_jiffies,
15812198SEiji.Ota@Sun.COM 	    conn, NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr));
15912414SEiji.Ota@Sun.COM 
16012198SEiji.Ota@Sun.COM 	rdsv3_queue_delayed_work(rdsv3_wq, &conn->c_conn_w,
16112198SEiji.Ota@Sun.COM 	    rand % conn->c_reconnect_jiffies);
16212198SEiji.Ota@Sun.COM 
16312198SEiji.Ota@Sun.COM 	conn->c_reconnect_jiffies = min(conn->c_reconnect_jiffies * 2,
16412198SEiji.Ota@Sun.COM 	    rdsv3_sysctl_reconnect_max_jiffies);
16512198SEiji.Ota@Sun.COM }
16612198SEiji.Ota@Sun.COM 
16712198SEiji.Ota@Sun.COM void
rdsv3_connect_worker(struct rdsv3_work_s * work)16812198SEiji.Ota@Sun.COM rdsv3_connect_worker(struct rdsv3_work_s *work)
16912198SEiji.Ota@Sun.COM {
17012198SEiji.Ota@Sun.COM 	struct rdsv3_connection *conn = container_of(work,
17112198SEiji.Ota@Sun.COM 	    struct rdsv3_connection, c_conn_w.work);
17212198SEiji.Ota@Sun.COM 	int ret;
17312198SEiji.Ota@Sun.COM 
17412198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF2("rdsv3_connect_worker", "Enter(work: %p)", work);
17512198SEiji.Ota@Sun.COM 
17612198SEiji.Ota@Sun.COM 	clear_bit(RDSV3_RECONNECT_PENDING, &conn->c_flags);
17712198SEiji.Ota@Sun.COM 	if (rdsv3_conn_transition(conn, RDSV3_CONN_DOWN,
17812198SEiji.Ota@Sun.COM 	    RDSV3_CONN_CONNECTING)) {
17912198SEiji.Ota@Sun.COM 		ret = conn->c_trans->conn_connect(conn);
18012414SEiji.Ota@Sun.COM 
18112198SEiji.Ota@Sun.COM 		RDSV3_DPRINTF5("rdsv3",
18212198SEiji.Ota@Sun.COM 		    "connect conn %p for %u.%u.%u.%u -> %u.%u.%u.%u "
18312198SEiji.Ota@Sun.COM 		    "ret %d", conn, NIPQUAD(conn->c_laddr),
18412198SEiji.Ota@Sun.COM 		    NIPQUAD(conn->c_faddr), ret);
18512414SEiji.Ota@Sun.COM 
18612198SEiji.Ota@Sun.COM 		RDSV3_DPRINTF2("rdsv3_connect_worker",
18712198SEiji.Ota@Sun.COM 		    "conn %p for %u.%u.%u.%u to %u.%u.%u.%u dispatched, ret %d",
18812198SEiji.Ota@Sun.COM 		    conn, NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr), ret);
18912198SEiji.Ota@Sun.COM 
19012198SEiji.Ota@Sun.COM 		if (ret) {
19112198SEiji.Ota@Sun.COM 			if (rdsv3_conn_transition(conn, RDSV3_CONN_CONNECTING,
19212198SEiji.Ota@Sun.COM 			    RDSV3_CONN_DOWN))
19312198SEiji.Ota@Sun.COM 				rdsv3_queue_reconnect(conn);
19412198SEiji.Ota@Sun.COM 			else {
19512198SEiji.Ota@Sun.COM 				RDSV3_DPRINTF2("rdsv3_connect_worker",
19612198SEiji.Ota@Sun.COM 				    "RDS: connect failed: %p", conn);
19712198SEiji.Ota@Sun.COM 				rdsv3_conn_drop(conn);
19812198SEiji.Ota@Sun.COM 			}
19912198SEiji.Ota@Sun.COM 		}
20012198SEiji.Ota@Sun.COM 	}
20112198SEiji.Ota@Sun.COM 
20212198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF2("rdsv3_connect_worker", "Return(work: %p)", work);
20312198SEiji.Ota@Sun.COM }
20412198SEiji.Ota@Sun.COM 
20512198SEiji.Ota@Sun.COM void
rdsv3_send_worker(struct rdsv3_work_s * work)20612198SEiji.Ota@Sun.COM rdsv3_send_worker(struct rdsv3_work_s *work)
20712198SEiji.Ota@Sun.COM {
20812198SEiji.Ota@Sun.COM 	struct rdsv3_connection *conn = container_of(work,
20912198SEiji.Ota@Sun.COM 	    struct rdsv3_connection, c_send_w.work);
21012198SEiji.Ota@Sun.COM 	int ret;
21112198SEiji.Ota@Sun.COM 
21212198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF4("rdsv3_send_worker", "Enter(work: %p)", work);
21312198SEiji.Ota@Sun.COM 
21412198SEiji.Ota@Sun.COM 	if (rdsv3_conn_state(conn) == RDSV3_CONN_UP) {
21512198SEiji.Ota@Sun.COM 		ret = rdsv3_send_xmit(conn);
21612198SEiji.Ota@Sun.COM 		RDSV3_DPRINTF5("rdsv3", "conn %p ret %d", conn, ret);
21712198SEiji.Ota@Sun.COM 		switch (ret) {
21812198SEiji.Ota@Sun.COM 		case -EAGAIN:
21912198SEiji.Ota@Sun.COM 			rdsv3_stats_inc(s_send_immediate_retry);
22012198SEiji.Ota@Sun.COM 			rdsv3_queue_delayed_work(rdsv3_wq, &conn->c_send_w, 0);
22112198SEiji.Ota@Sun.COM 			break;
22212198SEiji.Ota@Sun.COM 		case -ENOMEM:
22312198SEiji.Ota@Sun.COM 			rdsv3_stats_inc(s_send_delayed_retry);
22412198SEiji.Ota@Sun.COM 			rdsv3_queue_delayed_work(rdsv3_wq, &conn->c_send_w, 2);
22512198SEiji.Ota@Sun.COM 		default:
22612198SEiji.Ota@Sun.COM 			break;
22712198SEiji.Ota@Sun.COM 		}
22812198SEiji.Ota@Sun.COM 	}
22912198SEiji.Ota@Sun.COM 
23012198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF4("rdsv3_send_worker", "Return(work: %p)", work);
23112198SEiji.Ota@Sun.COM }
23212198SEiji.Ota@Sun.COM 
23312198SEiji.Ota@Sun.COM void
rdsv3_recv_worker(struct rdsv3_work_s * work)23412198SEiji.Ota@Sun.COM rdsv3_recv_worker(struct rdsv3_work_s *work)
23512198SEiji.Ota@Sun.COM {
23612198SEiji.Ota@Sun.COM 	struct rdsv3_connection *conn = container_of(work,
23712198SEiji.Ota@Sun.COM 	    struct rdsv3_connection, c_recv_w.work);
23812198SEiji.Ota@Sun.COM 	int ret;
23912198SEiji.Ota@Sun.COM 
24012198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF4("rdsv3_recv_worker", "Enter(work: %p)", work);
24112198SEiji.Ota@Sun.COM 
24212198SEiji.Ota@Sun.COM 	if (rdsv3_conn_state(conn) == RDSV3_CONN_UP) {
24312198SEiji.Ota@Sun.COM 		ret = conn->c_trans->recv(conn);
24412198SEiji.Ota@Sun.COM 		RDSV3_DPRINTF5("rdsv3", "conn %p ret %d", conn, ret);
24512198SEiji.Ota@Sun.COM 		switch (ret) {
24612198SEiji.Ota@Sun.COM 		case -EAGAIN:
24712198SEiji.Ota@Sun.COM 			rdsv3_stats_inc(s_recv_immediate_retry);
24812198SEiji.Ota@Sun.COM 			rdsv3_queue_delayed_work(rdsv3_wq, &conn->c_recv_w, 0);
24912198SEiji.Ota@Sun.COM 			break;
25012198SEiji.Ota@Sun.COM 		case -ENOMEM:
25112198SEiji.Ota@Sun.COM 			rdsv3_stats_inc(s_recv_delayed_retry);
25212198SEiji.Ota@Sun.COM 			rdsv3_queue_delayed_work(rdsv3_wq, &conn->c_recv_w, 2);
25312198SEiji.Ota@Sun.COM 		default:
25412198SEiji.Ota@Sun.COM 			break;
25512198SEiji.Ota@Sun.COM 		}
25612198SEiji.Ota@Sun.COM 	}
25712198SEiji.Ota@Sun.COM 
25812198SEiji.Ota@Sun.COM 	RDSV3_DPRINTF4("rdsv3_recv_worker", "Return(work: %p)", work);
25912198SEiji.Ota@Sun.COM }
26012198SEiji.Ota@Sun.COM 
26112198SEiji.Ota@Sun.COM void
rdsv3_shutdown_worker(struct rdsv3_work_s * work)26212676SEiji.Ota@Sun.COM rdsv3_shutdown_worker(struct rdsv3_work_s *work)
26312676SEiji.Ota@Sun.COM {
26412676SEiji.Ota@Sun.COM 	struct rdsv3_connection *conn = container_of(work,
26512676SEiji.Ota@Sun.COM 	    struct rdsv3_connection, c_down_w);
26612676SEiji.Ota@Sun.COM 	rdsv3_conn_shutdown(conn);
26712676SEiji.Ota@Sun.COM }
26812676SEiji.Ota@Sun.COM 
26912676SEiji.Ota@Sun.COM #define	time_after(a, b)	((long)(b) - (long)(a) < 0)
27012676SEiji.Ota@Sun.COM 
27112676SEiji.Ota@Sun.COM void
rdsv3_reaper_worker(struct rdsv3_work_s * work)27212676SEiji.Ota@Sun.COM rdsv3_reaper_worker(struct rdsv3_work_s *work)
27312676SEiji.Ota@Sun.COM {
27412676SEiji.Ota@Sun.COM 	struct rdsv3_connection *conn = container_of(work,
27512676SEiji.Ota@Sun.COM 	    struct rdsv3_connection, c_reap_w.work);
27612676SEiji.Ota@Sun.COM 
27712676SEiji.Ota@Sun.COM 	if (rdsv3_conn_state(conn) != RDSV3_CONN_UP &&
27812676SEiji.Ota@Sun.COM 	    !time_after(conn->c_last_connect_jiffies,
27912676SEiji.Ota@Sun.COM 	    ddi_get_lbolt() - RDSV3_REAPER_WAIT_JIFFIES)) {
28012676SEiji.Ota@Sun.COM 		rdsv3_conn_destroy(conn);
28112676SEiji.Ota@Sun.COM 	} else {
28212676SEiji.Ota@Sun.COM 		rdsv3_queue_delayed_work(rdsv3_wq, &conn->c_reap_w,
28312676SEiji.Ota@Sun.COM 		    RDSV3_REAPER_WAIT_JIFFIES);
28412676SEiji.Ota@Sun.COM 	}
28512676SEiji.Ota@Sun.COM }
28612676SEiji.Ota@Sun.COM 
28712676SEiji.Ota@Sun.COM void
rdsv3_threads_exit(void)28812198SEiji.Ota@Sun.COM rdsv3_threads_exit(void)
28912198SEiji.Ota@Sun.COM {
29012198SEiji.Ota@Sun.COM 	rdsv3_destroy_task_workqueue(rdsv3_wq);
29112198SEiji.Ota@Sun.COM }
29212198SEiji.Ota@Sun.COM 
29312198SEiji.Ota@Sun.COM int
rdsv3_threads_init(void)29412198SEiji.Ota@Sun.COM rdsv3_threads_init(void)
29512198SEiji.Ota@Sun.COM {
29612198SEiji.Ota@Sun.COM 	rdsv3_wq = rdsv3_create_task_workqueue("krdsd");
29712676SEiji.Ota@Sun.COM 	if (!rdsv3_wq)
29812198SEiji.Ota@Sun.COM 		return (-ENOMEM);
29912198SEiji.Ota@Sun.COM 
30012198SEiji.Ota@Sun.COM 	return (0);
30112198SEiji.Ota@Sun.COM }
302