xref: /titanic_44/usr/src/uts/common/fs/sockfs/sodirect.h (revision cb8a054b1ab30d5caa746e6c44f29d4c9d3071c1)
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 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 /*
31  * University Copyright- Copyright (c) 1982, 1986, 1988
32  * The Regents of the University of California
33  * All Rights Reserved
34  *
35  * University Acknowledgment- Portions of this document are derived from
36  * software developed by the University of California, Berkeley, and its
37  * contributors.
38  */
39 
40 #ifndef _SOCKFS_SODIRECT_H
41 #define	_SOCKFS_SODIRECT_H
42 
43 /*
44  * Sodirect; used to support asynchronous DMA hardware
45  * (e.g. Intel's I/OAT).
46  */
47 
48 #ifdef	__cplusplus
49 extern "C" {
50 #endif
51 
52 typedef struct sodirect_s {
53 	boolean_t	sod_enabled;	/* sodirect_t enabled */
54 	mblk_t		*sod_uioafh;	/* To be freed list head, or NULL */
55 	mblk_t		*sod_uioaft;	/* To be freed list tail */
56 	uioa_t		sod_uioa;	/* Pending uio_t for uioa_t use */
57 } sodirect_t;
58 
59 /*
60  * Usefull macros:
61  */
62 #define	SOD_DISABLE(sodp) {		\
63 	(sodp)->sod_enabled = B_FALSE;	\
64 }
65 
66 #define	SOD_SOTOSODP(so) ((sonode_t *)so)->so_direct
67 
68 #define	SOD_UIOAFINI(sodp) {						\
69 	if ((sodp)->sod_uioa.uioa_state & UIOA_ENABLED) {		\
70 		(sodp)->sod_uioa.uioa_state &= UIOA_CLR;		\
71 		(sodp)->sod_uioa.uioa_state |= UIOA_FINI;		\
72 	}								\
73 }
74 
75 struct sonode;
76 struct sodirect_s;
77 
78 extern uio_t	*sod_rcv_init(struct sonode *, int, struct uio **);
79 extern int	sod_rcv_done(struct sonode *, struct uio *, struct uio *);
80 
81 extern void	sod_uioa_mblk_init(struct sodirect_s *, mblk_t *, size_t);
82 extern void	sod_uioa_so_init(struct sonode *, struct sodirect_s *,
83     struct uio *);
84 extern ssize_t	sod_uioa_mblk(struct sonode *, mblk_t *);
85 extern void	sod_uioa_mblk_done(struct sodirect_s *, mblk_t *);
86 
87 extern int	sod_init(void);
88 extern void	sod_sock_init(struct sonode *);
89 extern void	sod_sock_fini(struct sonode *);
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif	/* _SOCKFS_SODIRECT_H */
96