1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2009 Emulex. All rights reserved. 24 * Use is subject to License terms. 25 */ 26 27 28 #ifndef _EMLXS_THREAD_H 29 #define _EMLXS_THREAD_H 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 36 #define EMLXS_MAX_TASKQ_THREADS 4 37 38 typedef struct emlxs_thread 39 { 40 struct emlxs_hba *hba; 41 42 kthread_t *thread; 43 uint32_t flags; 44 45 void (*func) (void *); 46 void *arg1; 47 void *arg2; 48 49 kmutex_t lock; 50 kcondvar_t cv_flag; 51 } emlxs_thread_t; 52 53 54 typedef struct emlxs_taskq_thread 55 { 56 struct emlxs_taskq_thread *next; 57 struct emlxs_taskq *taskq; 58 59 kthread_t *thread; 60 uint32_t flags; 61 62 void (*func) (void *); 63 void *arg; 64 65 kmutex_t lock; 66 kcondvar_t cv_flag; 67 } emlxs_taskq_thread_t; 68 69 70 typedef struct emlxs_taskq 71 { 72 emlxs_taskq_thread_t thread_list[EMLXS_MAX_TASKQ_THREADS]; 73 74 void *hba; 75 76 emlxs_taskq_thread_t *get_head; 77 uint32_t get_count; 78 uint32_t open; 79 kmutex_t get_lock; 80 81 emlxs_taskq_thread_t *put_head; 82 uint32_t put_count; 83 kmutex_t put_lock; 84 } emlxs_taskq_t; 85 86 /* flags */ 87 #define EMLXS_THREAD_INITD 0x00000001 88 #define EMLXS_THREAD_STARTED 0x00000002 89 #define EMLXS_THREAD_ASLEEP 0x00000004 90 #define EMLXS_THREAD_BUSY 0x00000008 91 #define EMLXS_THREAD_KILLED 0x00000010 92 #define EMLXS_THREAD_ENDED 0x00000020 93 #define EMLXS_THREAD_TRIGGERED 0x80000000 94 95 #ifdef __cplusplus 96 } 97 #endif 98 99 #endif /* _EMLXS_THREAD_H */ 100