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_thread *next; 41 struct emlxs_thread *prev; 42 43 struct emlxs_hba *hba; 44 45 kthread_t *thread; 46 uint32_t flags; 47 48 void (*func) (void *); 49 void *arg1; 50 void *arg2; 51 52 kmutex_t lock; 53 kcondvar_t cv_flag; 54 } emlxs_thread_t; 55 56 57 typedef struct emlxs_taskq_thread 58 { 59 struct emlxs_taskq_thread *next; 60 struct emlxs_taskq *taskq; 61 62 kthread_t *thread; 63 uint32_t flags; 64 65 void (*func) (void *); 66 void *arg; 67 68 kmutex_t lock; 69 kcondvar_t cv_flag; 70 } emlxs_taskq_thread_t; 71 72 73 typedef struct emlxs_taskq 74 { 75 emlxs_taskq_thread_t thread_list[EMLXS_MAX_TASKQ_THREADS]; 76 77 void *hba; 78 79 emlxs_taskq_thread_t *get_head; 80 uint32_t get_count; 81 uint32_t open; 82 kmutex_t get_lock; 83 84 emlxs_taskq_thread_t *put_head; 85 uint32_t put_count; 86 kmutex_t put_lock; 87 } emlxs_taskq_t; 88 89 /* flags */ 90 #define EMLXS_THREAD_INITD 0x00000001 91 #define EMLXS_THREAD_STARTED 0x00000002 92 #define EMLXS_THREAD_ASLEEP 0x00000004 93 #define EMLXS_THREAD_BUSY 0x00000008 94 #define EMLXS_THREAD_KILLED 0x00000010 95 #define EMLXS_THREAD_ENDED 0x00000020 96 #define EMLXS_THREAD_TRIGGERED 0x80000000 97 #define EMLXS_THREAD_RUN_ONCE 0x00000100 98 99 #ifdef __cplusplus 100 } 101 #endif 102 103 #endif /* _EMLXS_THREAD_H */ 104