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  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef _RDSV3_AF_THR_H
26 #define	_RDSV3_AF_THR_H
27 
28 /*
29  * This file is only present in Solaris
30  */
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #include <sys/sunddi.h>
38 #include <sys/callb.h>
39 #include <sys/cpuvar.h>
40 #include <sys/cpupart.h>
41 #include <sys/processor.h>
42 
43 typedef struct rdsv3_af_grp_s rdsv3_af_grp_t;
44 typedef struct rdsv3_af_thr_s rdsv3_af_thr_t;
45 typedef void (*rdsv3_af_thr_drain_func_t)(void *);
46 
47 void rdsv3_af_init(dev_info_t *dip);
48 /*
49  * create flags.
50  */
51 #define	SCQ_DEFAULT		0x0000
52 #define	SCQ_HCA_BIND_CPU	0x0001	/* bind hca to a cpu */
53 #define	SCQ_INTR_BIND_CPU	0x0002	/* bind soft cq to a cpu */
54 #define	SCQ_WRK_BIND_CPU	0x0004	/* bind worker to a cpu */
55 
56 rdsv3_af_grp_t *rdsv3_af_grp_create(ibt_hca_hdl_t hca, uint64_t id);
57 void rdsv3_af_grp_destroy(rdsv3_af_grp_t *hcagp);
58 void rdsv3_af_grp_draw(rdsv3_af_grp_t *hcagp);
59 ibt_sched_hdl_t rdsv3_af_grp_get_sched(rdsv3_af_grp_t *hcagp);
60 
61 rdsv3_af_thr_t *rdsv3_af_thr_create(rdsv3_af_thr_drain_func_t fn, void *data,
62     uint_t flag, rdsv3_af_grp_t *hcagp);
63 rdsv3_af_thr_t *rdsv3_af_intr_thr_create(rdsv3_af_thr_drain_func_t fn,
64     void *data, uint_t flag, rdsv3_af_grp_t *hcagp, ibt_cq_hdl_t ibt_cq_hdl);
65 
66 void rdsv3_af_thr_destroy(rdsv3_af_thr_t *ringp);
67 void rdsv3_af_thr_fire(rdsv3_af_thr_t *ringp);
68 
69 #ifdef	__cplusplus
70 }
71 #endif
72 
73 #endif /* _RDSV3_AF_THR_H */
74