1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
8fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte /*
2249311b35SJack Meng  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23fcf3ce44SJohn Forte  * Use is subject to license terms.
24fcf3ce44SJohn Forte  */
25fcf3ce44SJohn Forte 
26fcf3ce44SJohn Forte #include "iscsi_thread.h"
27fcf3ce44SJohn Forte 
28fcf3ce44SJohn Forte static	void	iscsi_threads_entry(void *arg);
29fcf3ce44SJohn Forte 
30fcf3ce44SJohn Forte /*
31fcf3ce44SJohn Forte  * iscsi_thread_create - Creates the needed resources to handle a thread
32fcf3ce44SJohn Forte  */
33fcf3ce44SJohn Forte iscsi_thread_t *
iscsi_thread_create(dev_info_t * dip,char * name,iscsi_thread_ep_t entry_point,void * arg)34fcf3ce44SJohn Forte iscsi_thread_create(dev_info_t *dip, char *name,
35fcf3ce44SJohn Forte     iscsi_thread_ep_t entry_point, void *arg)
36fcf3ce44SJohn Forte {
37fcf3ce44SJohn Forte 	iscsi_thread_t		*thread;
38fcf3ce44SJohn Forte 
39fcf3ce44SJohn Forte 	thread = kmem_zalloc(sizeof (iscsi_thread_t), KM_SLEEP);
40fcf3ce44SJohn Forte 
41fcf3ce44SJohn Forte 	if (thread != NULL) {
42fcf3ce44SJohn Forte 
43fcf3ce44SJohn Forte 		thread->tq = ddi_taskq_create(dip, name, 1,
44fcf3ce44SJohn Forte 		    TASKQ_DEFAULTPRI, 0);
45fcf3ce44SJohn Forte 
46fcf3ce44SJohn Forte 		if (thread->tq != NULL) {
47fcf3ce44SJohn Forte 			thread->signature	= SIG_ISCSI_THREAD;
48fcf3ce44SJohn Forte 			thread->dip		= dip;
49fcf3ce44SJohn Forte 			thread->entry_point	= entry_point;
50fcf3ce44SJohn Forte 			thread->arg		= arg;
51fcf3ce44SJohn Forte 			thread->state		= ISCSI_THREAD_STATE_STOPPED;
52fcf3ce44SJohn Forte 			thread->sign.bitmap	= 0;
53fcf3ce44SJohn Forte 			mutex_init(&thread->mgnt.mtx, NULL, MUTEX_DRIVER, NULL);
54fcf3ce44SJohn Forte 			mutex_init(&thread->sign.mtx, NULL, MUTEX_DRIVER, NULL);
55fcf3ce44SJohn Forte 			cv_init(&thread->sign.cdv, NULL, CV_DRIVER, NULL);
56fcf3ce44SJohn Forte 		} else {
57fcf3ce44SJohn Forte 			kmem_free(thread, sizeof (iscsi_thread_t));
58fcf3ce44SJohn Forte 			thread = NULL;
59fcf3ce44SJohn Forte 		}
60fcf3ce44SJohn Forte 	}
61fcf3ce44SJohn Forte 
62fcf3ce44SJohn Forte 	return (thread);
63fcf3ce44SJohn Forte }
64fcf3ce44SJohn Forte 
65fcf3ce44SJohn Forte /*
66fcf3ce44SJohn Forte  * iscsi_thread_destroy - Releases the needed resources to handle a thread
67fcf3ce44SJohn Forte  */
68fcf3ce44SJohn Forte void
iscsi_thread_destroy(iscsi_thread_t * thread)69fcf3ce44SJohn Forte iscsi_thread_destroy(
70fcf3ce44SJohn Forte 	iscsi_thread_t		*thread
71fcf3ce44SJohn Forte )
72fcf3ce44SJohn Forte {
73fcf3ce44SJohn Forte 	ASSERT(thread != NULL);
74fcf3ce44SJohn Forte 	ASSERT(thread->signature == SIG_ISCSI_THREAD);
75fcf3ce44SJohn Forte 
76fcf3ce44SJohn Forte 	mutex_enter(&thread->mgnt.mtx);
77fcf3ce44SJohn Forte 
78fcf3ce44SJohn Forte 	switch (thread->state) {
79fcf3ce44SJohn Forte 
80fcf3ce44SJohn Forte 	case ISCSI_THREAD_STATE_STARTED:
81fcf3ce44SJohn Forte 
82fcf3ce44SJohn Forte 		/* A kill signal is sent first. */
83fcf3ce44SJohn Forte 		thread->state = ISCSI_THREAD_STATE_DESTROYING;
84fcf3ce44SJohn Forte 		mutex_enter(&thread->sign.mtx);
85fcf3ce44SJohn Forte 		if (!(thread->sign.bitmap & ISCSI_THREAD_SIGNAL_KILL)) {
86fcf3ce44SJohn Forte 			thread->sign.bitmap |= ISCSI_THREAD_SIGNAL_KILL;
87fcf3ce44SJohn Forte 			cv_signal(&thread->sign.cdv);
88fcf3ce44SJohn Forte 		}
89fcf3ce44SJohn Forte 		mutex_exit(&thread->sign.mtx);
90fcf3ce44SJohn Forte 		ddi_taskq_wait(thread->tq);
91fcf3ce44SJohn Forte 		break;
92fcf3ce44SJohn Forte 
93fcf3ce44SJohn Forte 	case ISCSI_THREAD_STATE_STOPPED:
94fcf3ce44SJohn Forte 
95fcf3ce44SJohn Forte 		/* Switch the state and wait for the thread to exit. */
96fcf3ce44SJohn Forte 		thread->state = ISCSI_THREAD_STATE_DESTROYING;
97fcf3ce44SJohn Forte 		break;
98fcf3ce44SJohn Forte 
99fcf3ce44SJohn Forte 	default:
100fcf3ce44SJohn Forte 		ASSERT(0);
101fcf3ce44SJohn Forte 		break;
102fcf3ce44SJohn Forte 	}
103fcf3ce44SJohn Forte 
104fcf3ce44SJohn Forte 	mutex_exit(&thread->mgnt.mtx);
105fcf3ce44SJohn Forte 	ddi_taskq_destroy(thread->tq);
106fcf3ce44SJohn Forte 	cv_destroy(&thread->sign.cdv);
107fcf3ce44SJohn Forte 	mutex_destroy(&thread->sign.mtx);
108fcf3ce44SJohn Forte 	mutex_destroy(&thread->mgnt.mtx);
109fcf3ce44SJohn Forte 	thread->signature = (uint32_t)~SIG_ISCSI_THREAD;
110fcf3ce44SJohn Forte 	kmem_free(thread, sizeof (iscsi_thread_t));
111fcf3ce44SJohn Forte }
112fcf3ce44SJohn Forte 
113fcf3ce44SJohn Forte /*
114fcf3ce44SJohn Forte  * iscsi_thread_start - Starts the thread given as an entry parameter
115fcf3ce44SJohn Forte  */
116fcf3ce44SJohn Forte boolean_t
iscsi_thread_start(iscsi_thread_t * thread)117fcf3ce44SJohn Forte iscsi_thread_start(
118fcf3ce44SJohn Forte 	iscsi_thread_t		*thread
119fcf3ce44SJohn Forte )
120fcf3ce44SJohn Forte {
121fcf3ce44SJohn Forte 	boolean_t		ret = B_FALSE;
122fcf3ce44SJohn Forte 
123fcf3ce44SJohn Forte 	ASSERT(thread != NULL);
124fcf3ce44SJohn Forte 	ASSERT(thread->signature == SIG_ISCSI_THREAD);
125fcf3ce44SJohn Forte 
126fcf3ce44SJohn Forte 	mutex_enter(&thread->mgnt.mtx);
127fcf3ce44SJohn Forte 
128fcf3ce44SJohn Forte 	switch (thread->state) {
129fcf3ce44SJohn Forte 
130fcf3ce44SJohn Forte 	case ISCSI_THREAD_STATE_STARTED:
131fcf3ce44SJohn Forte 
132fcf3ce44SJohn Forte 		mutex_enter(&thread->sign.mtx);
133fcf3ce44SJohn Forte 
134fcf3ce44SJohn Forte 		thread->state = ISCSI_THREAD_STATE_STOPPING;
135fcf3ce44SJohn Forte 
136fcf3ce44SJohn Forte 		if (!(thread->sign.bitmap & ISCSI_THREAD_SIGNAL_KILL)) {
137fcf3ce44SJohn Forte 			thread->sign.bitmap |= ISCSI_THREAD_SIGNAL_KILL;
138fcf3ce44SJohn Forte 			cv_signal(&thread->sign.cdv);
139fcf3ce44SJohn Forte 		}
140fcf3ce44SJohn Forte 		mutex_exit(&thread->sign.mtx);
141fcf3ce44SJohn Forte 		ddi_taskq_wait(thread->tq);
142fcf3ce44SJohn Forte 		thread->state = ISCSI_THREAD_STATE_STOPPED;
143fcf3ce44SJohn Forte 		/* FALLTHRU */
144fcf3ce44SJohn Forte 
145fcf3ce44SJohn Forte 	case ISCSI_THREAD_STATE_STOPPED:
146fcf3ce44SJohn Forte 
147fcf3ce44SJohn Forte 		thread->sign.bitmap = 0;
148fcf3ce44SJohn Forte 		thread->state	    = ISCSI_THREAD_STATE_STARTING;
149fcf3ce44SJohn Forte 
150fcf3ce44SJohn Forte 		if (ddi_taskq_dispatch(thread->tq, iscsi_threads_entry,
151fcf3ce44SJohn Forte 		    thread, DDI_SLEEP) == DDI_SUCCESS) {
152fcf3ce44SJohn Forte 			/*
153fcf3ce44SJohn Forte 			 * The dispatch succeeded.
154fcf3ce44SJohn Forte 			 */
155fcf3ce44SJohn Forte 			thread->state = ISCSI_THREAD_STATE_STARTED;
156fcf3ce44SJohn Forte 			ret = B_TRUE;
157fcf3ce44SJohn Forte 		}
158fcf3ce44SJohn Forte 		break;
159fcf3ce44SJohn Forte 
160fcf3ce44SJohn Forte 	default:
161fcf3ce44SJohn Forte 		ASSERT(0);
162fcf3ce44SJohn Forte 		break;
163fcf3ce44SJohn Forte 	}
164fcf3ce44SJohn Forte 	mutex_exit(&thread->mgnt.mtx);
165fcf3ce44SJohn Forte 	return (ret);
166fcf3ce44SJohn Forte }
167fcf3ce44SJohn Forte 
168fcf3ce44SJohn Forte /*
169fcf3ce44SJohn Forte  * iscsi_thread_stop -
170fcf3ce44SJohn Forte  */
171fcf3ce44SJohn Forte boolean_t
iscsi_thread_stop(iscsi_thread_t * thread)172fcf3ce44SJohn Forte iscsi_thread_stop(
173fcf3ce44SJohn Forte 	iscsi_thread_t		*thread
174fcf3ce44SJohn Forte )
175fcf3ce44SJohn Forte {
176fcf3ce44SJohn Forte 	boolean_t		ret = B_FALSE;
177fcf3ce44SJohn Forte 
178fcf3ce44SJohn Forte 	ASSERT(thread != NULL);
179fcf3ce44SJohn Forte 	ASSERT(thread->signature == SIG_ISCSI_THREAD);
180fcf3ce44SJohn Forte 
181fcf3ce44SJohn Forte 	mutex_enter(&thread->mgnt.mtx);
182fcf3ce44SJohn Forte 
183fcf3ce44SJohn Forte 	switch (thread->state) {
184fcf3ce44SJohn Forte 
185fcf3ce44SJohn Forte 	case ISCSI_THREAD_STATE_STARTED:
186fcf3ce44SJohn Forte 
187fcf3ce44SJohn Forte 		mutex_enter(&thread->sign.mtx);
188fcf3ce44SJohn Forte 
189fcf3ce44SJohn Forte 		thread->state = ISCSI_THREAD_STATE_STOPPING;
190fcf3ce44SJohn Forte 
191fcf3ce44SJohn Forte 		if (!(thread->sign.bitmap & ISCSI_THREAD_SIGNAL_KILL)) {
192fcf3ce44SJohn Forte 			thread->sign.bitmap |= ISCSI_THREAD_SIGNAL_KILL;
193fcf3ce44SJohn Forte 			cv_signal(&thread->sign.cdv);
194fcf3ce44SJohn Forte 		}
195fcf3ce44SJohn Forte 		mutex_exit(&thread->sign.mtx);
196fcf3ce44SJohn Forte 		ddi_taskq_wait(thread->tq);
197fcf3ce44SJohn Forte 		thread->state = ISCSI_THREAD_STATE_STOPPED;
198fcf3ce44SJohn Forte 		ret = B_TRUE;
199fcf3ce44SJohn Forte 		break;
200fcf3ce44SJohn Forte 
201fcf3ce44SJohn Forte 	case ISCSI_THREAD_STATE_STOPPED:
202fcf3ce44SJohn Forte 		ret = B_TRUE;
203fcf3ce44SJohn Forte 		break;
204fcf3ce44SJohn Forte 
205fcf3ce44SJohn Forte 	default:
206fcf3ce44SJohn Forte 		ASSERT(0);
207fcf3ce44SJohn Forte 		break;
208fcf3ce44SJohn Forte 	}
209fcf3ce44SJohn Forte 	mutex_exit(&thread->mgnt.mtx);
210fcf3ce44SJohn Forte 	return (ret);
211fcf3ce44SJohn Forte }
212fcf3ce44SJohn Forte 
213fcf3ce44SJohn Forte /*
214fcf3ce44SJohn Forte  * iscsi_thread_send_kill -
215fcf3ce44SJohn Forte  */
216fcf3ce44SJohn Forte void
iscsi_thread_send_kill(iscsi_thread_t * thread)217fcf3ce44SJohn Forte iscsi_thread_send_kill(
218fcf3ce44SJohn Forte 	iscsi_thread_t		*thread
219fcf3ce44SJohn Forte )
220fcf3ce44SJohn Forte {
221fcf3ce44SJohn Forte 	ASSERT(thread != NULL);
222fcf3ce44SJohn Forte 	ASSERT(thread->signature == SIG_ISCSI_THREAD);
223fcf3ce44SJohn Forte 
224fcf3ce44SJohn Forte 	mutex_enter(&thread->mgnt.mtx);
225fcf3ce44SJohn Forte 
226fcf3ce44SJohn Forte 	switch (thread->state) {
227fcf3ce44SJohn Forte 
228fcf3ce44SJohn Forte 	case ISCSI_THREAD_STATE_STARTED:
229fcf3ce44SJohn Forte 
230fcf3ce44SJohn Forte 		mutex_enter(&thread->sign.mtx);
231fcf3ce44SJohn Forte 		if (!(thread->sign.bitmap & ISCSI_THREAD_SIGNAL_KILL)) {
232fcf3ce44SJohn Forte 			thread->sign.bitmap |= ISCSI_THREAD_SIGNAL_KILL;
233fcf3ce44SJohn Forte 			cv_signal(&thread->sign.cdv);
234fcf3ce44SJohn Forte 		}
235fcf3ce44SJohn Forte 		mutex_exit(&thread->sign.mtx);
236fcf3ce44SJohn Forte 		break;
237fcf3ce44SJohn Forte 
238fcf3ce44SJohn Forte 	default:
239fcf3ce44SJohn Forte 		ASSERT(0);
240fcf3ce44SJohn Forte 		break;
241fcf3ce44SJohn Forte 	}
242fcf3ce44SJohn Forte 	mutex_exit(&thread->mgnt.mtx);
243fcf3ce44SJohn Forte }
244fcf3ce44SJohn Forte 
245fcf3ce44SJohn Forte /*
246fcf3ce44SJohn Forte  * iscsi_thread_send_wakeup -
247fcf3ce44SJohn Forte  */
24849311b35SJack Meng boolean_t
iscsi_thread_send_wakeup(iscsi_thread_t * thread)249fcf3ce44SJohn Forte iscsi_thread_send_wakeup(
250fcf3ce44SJohn Forte 	iscsi_thread_t		*thread
251fcf3ce44SJohn Forte )
252fcf3ce44SJohn Forte {
25349311b35SJack Meng 	boolean_t	ret = B_FALSE;
25449311b35SJack Meng 
255fcf3ce44SJohn Forte 	ASSERT(thread != NULL);
256fcf3ce44SJohn Forte 	ASSERT(thread->signature == SIG_ISCSI_THREAD);
257fcf3ce44SJohn Forte 
258fcf3ce44SJohn Forte 	mutex_enter(&thread->mgnt.mtx);
259fcf3ce44SJohn Forte 
260fcf3ce44SJohn Forte 	switch (thread->state) {
261fcf3ce44SJohn Forte 
262fcf3ce44SJohn Forte 	case ISCSI_THREAD_STATE_STARTED:
263fcf3ce44SJohn Forte 
264fcf3ce44SJohn Forte 		mutex_enter(&thread->sign.mtx);
265fcf3ce44SJohn Forte 		if (!(thread->sign.bitmap & ISCSI_THREAD_SIGNAL_WAKEUP)) {
266fcf3ce44SJohn Forte 			thread->sign.bitmap |= ISCSI_THREAD_SIGNAL_WAKEUP;
267fcf3ce44SJohn Forte 			cv_signal(&thread->sign.cdv);
268fcf3ce44SJohn Forte 		}
269fcf3ce44SJohn Forte 		mutex_exit(&thread->sign.mtx);
27049311b35SJack Meng 		ret = B_TRUE;
271fcf3ce44SJohn Forte 		break;
272fcf3ce44SJohn Forte 
273fcf3ce44SJohn Forte 	default:
274fcf3ce44SJohn Forte 		break;
275fcf3ce44SJohn Forte 	}
276fcf3ce44SJohn Forte 	mutex_exit(&thread->mgnt.mtx);
27749311b35SJack Meng 	return (ret);
278fcf3ce44SJohn Forte }
279fcf3ce44SJohn Forte 
280fcf3ce44SJohn Forte /*
281fcf3ce44SJohn Forte  * iscsi_thread_check_signals -
282fcf3ce44SJohn Forte  */
283fcf3ce44SJohn Forte uint32_t
iscsi_thread_check_signals(iscsi_thread_t * thread)284fcf3ce44SJohn Forte iscsi_thread_check_signals(
285fcf3ce44SJohn Forte 	iscsi_thread_t		*thread
286fcf3ce44SJohn Forte )
287fcf3ce44SJohn Forte {
288fcf3ce44SJohn Forte 	uint32_t		bitmap;
289fcf3ce44SJohn Forte 
290fcf3ce44SJohn Forte 	ASSERT(thread != NULL);
291fcf3ce44SJohn Forte 	ASSERT(thread->signature == SIG_ISCSI_THREAD);
292fcf3ce44SJohn Forte 
293fcf3ce44SJohn Forte 	/* Acquire the mutex before anychecking. */
294fcf3ce44SJohn Forte 	mutex_enter(&thread->sign.mtx);
295fcf3ce44SJohn Forte 	bitmap = thread->sign.bitmap;
296fcf3ce44SJohn Forte 	mutex_exit(&thread->sign.mtx);
297fcf3ce44SJohn Forte 	return (bitmap);
298fcf3ce44SJohn Forte }
299fcf3ce44SJohn Forte /*
300fcf3ce44SJohn Forte  * iscsi_thread_wait -
301fcf3ce44SJohn Forte  */
302fcf3ce44SJohn Forte int
iscsi_thread_wait(iscsi_thread_t * thread,clock_t timeout)303fcf3ce44SJohn Forte iscsi_thread_wait(
304fcf3ce44SJohn Forte 	iscsi_thread_t		*thread,
305fcf3ce44SJohn Forte 	clock_t			timeout
306fcf3ce44SJohn Forte )
307fcf3ce44SJohn Forte {
308fcf3ce44SJohn Forte 	int			rtn = 1;
309fcf3ce44SJohn Forte 
310fcf3ce44SJohn Forte 	ASSERT(thread != NULL);
311fcf3ce44SJohn Forte 	ASSERT(thread->signature == SIG_ISCSI_THREAD);
312fcf3ce44SJohn Forte 
313fcf3ce44SJohn Forte 	/* Acquire the mutex before anychecking. */
314fcf3ce44SJohn Forte 	mutex_enter(&thread->sign.mtx);
315fcf3ce44SJohn Forte 
316fcf3ce44SJohn Forte 	/* Check the signals. */
317fcf3ce44SJohn Forte 	if (thread->sign.bitmap & ISCSI_THREAD_SIGNAL_KILL) {
318fcf3ce44SJohn Forte 		goto signal_kill;
319fcf3ce44SJohn Forte 	} else if (thread->sign.bitmap & ISCSI_THREAD_SIGNAL_WAKEUP) {
320fcf3ce44SJohn Forte 		goto signal_wakeup;
321fcf3ce44SJohn Forte 	} else if (timeout == 0) {
322fcf3ce44SJohn Forte 		goto iscsi_thread_sleep_exit;
323fcf3ce44SJohn Forte 	}
324fcf3ce44SJohn Forte 
325fcf3ce44SJohn Forte 	if (timeout == -1) {
326fcf3ce44SJohn Forte 		cv_wait(&thread->sign.cdv, &thread->sign.mtx);
327fcf3ce44SJohn Forte 	} else {
328*d3d50737SRafael Vanoni 		rtn = cv_reltimedwait(&thread->sign.cdv, &thread->sign.mtx,
329*d3d50737SRafael Vanoni 		    timeout, TR_CLOCK_TICK);
330fcf3ce44SJohn Forte 	}
331fcf3ce44SJohn Forte 
332fcf3ce44SJohn Forte 	/* Check the signals. */
333fcf3ce44SJohn Forte 	if (thread->sign.bitmap & ISCSI_THREAD_SIGNAL_KILL) {
334fcf3ce44SJohn Forte 		goto signal_kill;
335fcf3ce44SJohn Forte 	} else if (thread->sign.bitmap & ISCSI_THREAD_SIGNAL_WAKEUP) {
336fcf3ce44SJohn Forte 		goto signal_wakeup;
337fcf3ce44SJohn Forte 	}
338fcf3ce44SJohn Forte 
339fcf3ce44SJohn Forte iscsi_thread_sleep_exit:
340fcf3ce44SJohn Forte 	mutex_exit(&thread->sign.mtx);
341fcf3ce44SJohn Forte 	return (rtn);
342fcf3ce44SJohn Forte 
343fcf3ce44SJohn Forte signal_kill:
344fcf3ce44SJohn Forte 	mutex_exit(&thread->sign.mtx);
345fcf3ce44SJohn Forte 	return (0);
346fcf3ce44SJohn Forte 
347fcf3ce44SJohn Forte signal_wakeup:
348fcf3ce44SJohn Forte 	thread->sign.bitmap &= ~ISCSI_THREAD_SIGNAL_WAKEUP;
349fcf3ce44SJohn Forte 	mutex_exit(&thread->sign.mtx);
350fcf3ce44SJohn Forte 	return (1);
351fcf3ce44SJohn Forte }
352fcf3ce44SJohn Forte 
353fcf3ce44SJohn Forte /*
354fcf3ce44SJohn Forte  * iscsi_threads_entry - Common entry point for all threads
355fcf3ce44SJohn Forte  */
356fcf3ce44SJohn Forte static
357fcf3ce44SJohn Forte void
iscsi_threads_entry(void * arg)358fcf3ce44SJohn Forte iscsi_threads_entry(
359fcf3ce44SJohn Forte 	void			*arg
360fcf3ce44SJohn Forte )
361fcf3ce44SJohn Forte {
362fcf3ce44SJohn Forte 	iscsi_thread_t		*thread;
363fcf3ce44SJohn Forte 
364fcf3ce44SJohn Forte 	thread = (iscsi_thread_t *)arg;
365fcf3ce44SJohn Forte 
366fcf3ce44SJohn Forte 	ASSERT(thread != NULL);
367fcf3ce44SJohn Forte 	ASSERT(thread->signature == SIG_ISCSI_THREAD);
368fcf3ce44SJohn Forte 
369fcf3ce44SJohn Forte 	(thread->entry_point)(thread, thread->arg);
370fcf3ce44SJohn Forte }
371