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 * 8*8f23e9faSHans Rosenfeld * You can obtain a copy of the license at 9*8f23e9faSHans Rosenfeld * http://www.opensource.org/licenses/cddl1.txt. 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 22fcf3ce44SJohn Forte /* 23*8f23e9faSHans Rosenfeld * Copyright (c) 2004-2011 Emulex. All rights reserved. 2482527734SSukumar Swaminathan * Use is subject to license terms. 25fcf3ce44SJohn Forte */ 26fcf3ce44SJohn Forte 27fcf3ce44SJohn Forte #ifndef _EMLXS_THREAD_H 28fcf3ce44SJohn Forte #define _EMLXS_THREAD_H 29fcf3ce44SJohn Forte 30fcf3ce44SJohn Forte #ifdef __cplusplus 31fcf3ce44SJohn Forte extern "C" { 32fcf3ce44SJohn Forte #endif 33fcf3ce44SJohn Forte 34fcf3ce44SJohn Forte 35291a2b48SSukumar Swaminathan #define EMLXS_MAX_TASKQ_THREADS 4 36fcf3ce44SJohn Forte 37291a2b48SSukumar Swaminathan typedef struct emlxs_thread 38291a2b48SSukumar Swaminathan { 39bb63f56eSSukumar Swaminathan struct emlxs_thread *next; 40bb63f56eSSukumar Swaminathan struct emlxs_thread *prev; 41bb63f56eSSukumar Swaminathan 42291a2b48SSukumar Swaminathan struct emlxs_hba *hba; 43fcf3ce44SJohn Forte 44291a2b48SSukumar Swaminathan kthread_t *thread; 45291a2b48SSukumar Swaminathan uint32_t flags; 46fcf3ce44SJohn Forte 47291a2b48SSukumar Swaminathan void (*func) (void *); 48291a2b48SSukumar Swaminathan void *arg1; 49291a2b48SSukumar Swaminathan void *arg2; 50fcf3ce44SJohn Forte 51291a2b48SSukumar Swaminathan kmutex_t lock; 52291a2b48SSukumar Swaminathan kcondvar_t cv_flag; 53fcf3ce44SJohn Forte } emlxs_thread_t; 54fcf3ce44SJohn Forte 55fcf3ce44SJohn Forte 56291a2b48SSukumar Swaminathan typedef struct emlxs_taskq_thread 57291a2b48SSukumar Swaminathan { 58291a2b48SSukumar Swaminathan struct emlxs_taskq_thread *next; 59291a2b48SSukumar Swaminathan struct emlxs_taskq *taskq; 60fcf3ce44SJohn Forte 61291a2b48SSukumar Swaminathan kthread_t *thread; 62291a2b48SSukumar Swaminathan uint32_t flags; 63fcf3ce44SJohn Forte 64291a2b48SSukumar Swaminathan void (*func) (void *); 65291a2b48SSukumar Swaminathan void *arg; 66fcf3ce44SJohn Forte 67291a2b48SSukumar Swaminathan kmutex_t lock; 68291a2b48SSukumar Swaminathan kcondvar_t cv_flag; 69fcf3ce44SJohn Forte } emlxs_taskq_thread_t; 70fcf3ce44SJohn Forte 71fcf3ce44SJohn Forte 72291a2b48SSukumar Swaminathan typedef struct emlxs_taskq 73291a2b48SSukumar Swaminathan { 74291a2b48SSukumar Swaminathan emlxs_taskq_thread_t thread_list[EMLXS_MAX_TASKQ_THREADS]; 75fcf3ce44SJohn Forte 76291a2b48SSukumar Swaminathan void *hba; 77fcf3ce44SJohn Forte 78291a2b48SSukumar Swaminathan emlxs_taskq_thread_t *get_head; 79291a2b48SSukumar Swaminathan uint32_t get_count; 80291a2b48SSukumar Swaminathan uint32_t open; 81291a2b48SSukumar Swaminathan kmutex_t get_lock; 82fcf3ce44SJohn Forte 83291a2b48SSukumar Swaminathan emlxs_taskq_thread_t *put_head; 84291a2b48SSukumar Swaminathan uint32_t put_count; 85291a2b48SSukumar Swaminathan kmutex_t put_lock; 86fcf3ce44SJohn Forte } emlxs_taskq_t; 87fcf3ce44SJohn Forte 88fcf3ce44SJohn Forte /* flags */ 89fcf3ce44SJohn Forte #define EMLXS_THREAD_INITD 0x00000001 90fcf3ce44SJohn Forte #define EMLXS_THREAD_STARTED 0x00000002 91fcf3ce44SJohn Forte #define EMLXS_THREAD_ASLEEP 0x00000004 92fcf3ce44SJohn Forte #define EMLXS_THREAD_BUSY 0x00000008 93fcf3ce44SJohn Forte #define EMLXS_THREAD_KILLED 0x00000010 94fcf3ce44SJohn Forte #define EMLXS_THREAD_ENDED 0x00000020 95fcf3ce44SJohn Forte #define EMLXS_THREAD_TRIGGERED 0x80000000 96bb63f56eSSukumar Swaminathan #define EMLXS_THREAD_RUN_ONCE 0x00000100 97fcf3ce44SJohn Forte 98fcf3ce44SJohn Forte #ifdef __cplusplus 99fcf3ce44SJohn Forte } 100fcf3ce44SJohn Forte #endif 101fcf3ce44SJohn Forte 102fcf3ce44SJohn Forte #endif /* _EMLXS_THREAD_H */ 103