17836SJohn.Forte@Sun.COM /* 27836SJohn.Forte@Sun.COM * CDDL HEADER START 37836SJohn.Forte@Sun.COM * 47836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the 57836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License"). 67836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License. 77836SJohn.Forte@Sun.COM * 87836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing. 107836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions 117836SJohn.Forte@Sun.COM * and limitations under the License. 127836SJohn.Forte@Sun.COM * 137836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 147836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 167836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 177836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 187836SJohn.Forte@Sun.COM * 197836SJohn.Forte@Sun.COM * CDDL HEADER END 207836SJohn.Forte@Sun.COM */ 217836SJohn.Forte@Sun.COM /* 22*10185SJack.Meng@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237836SJohn.Forte@Sun.COM * Use is subject to license terms. 247836SJohn.Forte@Sun.COM */ 257836SJohn.Forte@Sun.COM 267836SJohn.Forte@Sun.COM #ifndef _ISCSI_THREAD_H 277836SJohn.Forte@Sun.COM #define _ISCSI_THREAD_H 287836SJohn.Forte@Sun.COM 297836SJohn.Forte@Sun.COM /* 307836SJohn.Forte@Sun.COM * Block comment which describes the contents of this file. 317836SJohn.Forte@Sun.COM */ 327836SJohn.Forte@Sun.COM 337836SJohn.Forte@Sun.COM #ifdef __cplusplus 347836SJohn.Forte@Sun.COM extern "C" { 357836SJohn.Forte@Sun.COM #endif 367836SJohn.Forte@Sun.COM 377836SJohn.Forte@Sun.COM #include <sys/types.h> 387836SJohn.Forte@Sun.COM #include <sys/ddi.h> 397836SJohn.Forte@Sun.COM #include <sys/sunddi.h> 407836SJohn.Forte@Sun.COM 417836SJohn.Forte@Sun.COM #define SIG_ISCSI_THREAD 0x54485244 427836SJohn.Forte@Sun.COM 437836SJohn.Forte@Sun.COM #define ISCSI_TH_MAX_NAME_LEN 32 447836SJohn.Forte@Sun.COM 457836SJohn.Forte@Sun.COM #define ISCSI_THREAD_SIGNAL_KILL 0x00000001 467836SJohn.Forte@Sun.COM #define ISCSI_THREAD_SIGNAL_WAKEUP 0x00000002 477836SJohn.Forte@Sun.COM 487836SJohn.Forte@Sun.COM #define ISCSI_THREAD_STATE_STOPPED 0x00000001 497836SJohn.Forte@Sun.COM #define ISCSI_THREAD_STATE_STOPPING 0x00000002 507836SJohn.Forte@Sun.COM #define ISCSI_THREAD_STATE_STARTED 0x00000004 517836SJohn.Forte@Sun.COM #define ISCSI_THREAD_STATE_STARTING 0x00000008 527836SJohn.Forte@Sun.COM #define ISCSI_THREAD_STATE_DESTROYING 0x00000010 537836SJohn.Forte@Sun.COM 547836SJohn.Forte@Sun.COM struct _iscsi_thread; 557836SJohn.Forte@Sun.COM 567836SJohn.Forte@Sun.COM typedef void (*iscsi_thread_ep_t)(struct _iscsi_thread *, void *); 577836SJohn.Forte@Sun.COM 587836SJohn.Forte@Sun.COM typedef struct _iscsi_thread { 597836SJohn.Forte@Sun.COM uint32_t signature; 607836SJohn.Forte@Sun.COM uint32_t state; 617836SJohn.Forte@Sun.COM ddi_taskq_t *tq; 627836SJohn.Forte@Sun.COM iscsi_thread_ep_t entry_point; 637836SJohn.Forte@Sun.COM void *arg; 647836SJohn.Forte@Sun.COM dev_info_t *dip; 657836SJohn.Forte@Sun.COM struct { 667836SJohn.Forte@Sun.COM uint32_t bitmap; 677836SJohn.Forte@Sun.COM kmutex_t mtx; 687836SJohn.Forte@Sun.COM kcondvar_t cdv; 697836SJohn.Forte@Sun.COM } sign; 707836SJohn.Forte@Sun.COM struct { 717836SJohn.Forte@Sun.COM kmutex_t mtx; 727836SJohn.Forte@Sun.COM } mgnt; 737836SJohn.Forte@Sun.COM } iscsi_thread_t; 747836SJohn.Forte@Sun.COM 757836SJohn.Forte@Sun.COM iscsi_thread_t * 767836SJohn.Forte@Sun.COM iscsi_thread_create( 777836SJohn.Forte@Sun.COM dev_info_t *dip, 787836SJohn.Forte@Sun.COM char *name, 797836SJohn.Forte@Sun.COM iscsi_thread_ep_t entry_point, 807836SJohn.Forte@Sun.COM void *arg 817836SJohn.Forte@Sun.COM ); 827836SJohn.Forte@Sun.COM 837836SJohn.Forte@Sun.COM void 847836SJohn.Forte@Sun.COM iscsi_thread_destroy( 857836SJohn.Forte@Sun.COM iscsi_thread_t *thread 867836SJohn.Forte@Sun.COM ); 877836SJohn.Forte@Sun.COM 887836SJohn.Forte@Sun.COM boolean_t 897836SJohn.Forte@Sun.COM iscsi_thread_start( 907836SJohn.Forte@Sun.COM iscsi_thread_t *thread 917836SJohn.Forte@Sun.COM ); 927836SJohn.Forte@Sun.COM 937836SJohn.Forte@Sun.COM boolean_t 947836SJohn.Forte@Sun.COM iscsi_thread_stop( 957836SJohn.Forte@Sun.COM iscsi_thread_t *thread 967836SJohn.Forte@Sun.COM ); 977836SJohn.Forte@Sun.COM 987836SJohn.Forte@Sun.COM void 997836SJohn.Forte@Sun.COM iscsi_thread_send_kill( 1007836SJohn.Forte@Sun.COM iscsi_thread_t *thread 1017836SJohn.Forte@Sun.COM ); 1027836SJohn.Forte@Sun.COM 103*10185SJack.Meng@Sun.COM boolean_t 1047836SJohn.Forte@Sun.COM iscsi_thread_send_wakeup( 1057836SJohn.Forte@Sun.COM iscsi_thread_t *thread 1067836SJohn.Forte@Sun.COM ); 1077836SJohn.Forte@Sun.COM 1087836SJohn.Forte@Sun.COM int 1097836SJohn.Forte@Sun.COM iscsi_thread_wait( 1107836SJohn.Forte@Sun.COM iscsi_thread_t *thread, 1117836SJohn.Forte@Sun.COM clock_t timeout 1127836SJohn.Forte@Sun.COM ); 1137836SJohn.Forte@Sun.COM 1147836SJohn.Forte@Sun.COM uint32_t 1157836SJohn.Forte@Sun.COM iscsi_thread_check_signals( 1167836SJohn.Forte@Sun.COM iscsi_thread_t *thread 1177836SJohn.Forte@Sun.COM ); 1187836SJohn.Forte@Sun.COM 1197836SJohn.Forte@Sun.COM #ifdef __cplusplus 1207836SJohn.Forte@Sun.COM } 1217836SJohn.Forte@Sun.COM #endif 1227836SJohn.Forte@Sun.COM 1237836SJohn.Forte@Sun.COM #endif /* _ISCSI_THREAD_H */ 124