xref: /titanic_51/usr/src/uts/common/fs/sockfs/sodirect.h (revision bbc000e522dec6271bdf858a8b013d7fc4c10ed4)
1*bbc000e5SAnders Persson /*
2*bbc000e5SAnders Persson  * CDDL HEADER START
3*bbc000e5SAnders Persson  *
4*bbc000e5SAnders Persson  * The contents of this file are subject to the terms of the
5*bbc000e5SAnders Persson  * Common Development and Distribution License (the "License").
6*bbc000e5SAnders Persson  * You may not use this file except in compliance with the License.
7*bbc000e5SAnders Persson  *
8*bbc000e5SAnders Persson  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*bbc000e5SAnders Persson  * or http://www.opensolaris.org/os/licensing.
10*bbc000e5SAnders Persson  * See the License for the specific language governing permissions
11*bbc000e5SAnders Persson  * and limitations under the License.
12*bbc000e5SAnders Persson  *
13*bbc000e5SAnders Persson  * When distributing Covered Code, include this CDDL HEADER in each
14*bbc000e5SAnders Persson  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*bbc000e5SAnders Persson  * If applicable, add the following below this CDDL HEADER, with the
16*bbc000e5SAnders Persson  * fields enclosed by brackets "[]" replaced with your own identifying
17*bbc000e5SAnders Persson  * information: Portions Copyright [yyyy] [name of copyright owner]
18*bbc000e5SAnders Persson  *
19*bbc000e5SAnders Persson  * CDDL HEADER END
20*bbc000e5SAnders Persson  */
21*bbc000e5SAnders Persson 
22*bbc000e5SAnders Persson /*
23*bbc000e5SAnders Persson  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*bbc000e5SAnders Persson  * Use is subject to license terms.
25*bbc000e5SAnders Persson  */
26*bbc000e5SAnders Persson 
27*bbc000e5SAnders Persson /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28*bbc000e5SAnders Persson /*	  All Rights Reserved  	*/
29*bbc000e5SAnders Persson 
30*bbc000e5SAnders Persson /*
31*bbc000e5SAnders Persson  * University Copyright- Copyright (c) 1982, 1986, 1988
32*bbc000e5SAnders Persson  * The Regents of the University of California
33*bbc000e5SAnders Persson  * All Rights Reserved
34*bbc000e5SAnders Persson  *
35*bbc000e5SAnders Persson  * University Acknowledgment- Portions of this document are derived from
36*bbc000e5SAnders Persson  * software developed by the University of California, Berkeley, and its
37*bbc000e5SAnders Persson  * contributors.
38*bbc000e5SAnders Persson  */
39*bbc000e5SAnders Persson 
40*bbc000e5SAnders Persson #ifndef _SOCKFS_SODIRECT_H
41*bbc000e5SAnders Persson #define	_SOCKFS_SODIRECT_H
42*bbc000e5SAnders Persson 
43*bbc000e5SAnders Persson /*
44*bbc000e5SAnders Persson  * Sodirect; used to support asynchronous DMA hardware
45*bbc000e5SAnders Persson  * (e.g. Intel's I/OAT).
46*bbc000e5SAnders Persson  */
47*bbc000e5SAnders Persson 
48*bbc000e5SAnders Persson #ifdef	__cplusplus
49*bbc000e5SAnders Persson extern "C" {
50*bbc000e5SAnders Persson #endif
51*bbc000e5SAnders Persson 
52*bbc000e5SAnders Persson typedef struct sodirect_s {
53*bbc000e5SAnders Persson 	boolean_t	sod_enabled;	/* sodirect_t enabled */
54*bbc000e5SAnders Persson 	mblk_t		*sod_uioafh;	/* To be freed list head, or NULL */
55*bbc000e5SAnders Persson 	mblk_t		*sod_uioaft;	/* To be freed list tail */
56*bbc000e5SAnders Persson 	uioa_t		sod_uioa;	/* Pending uio_t for uioa_t use */
57*bbc000e5SAnders Persson } sodirect_t;
58*bbc000e5SAnders Persson 
59*bbc000e5SAnders Persson /*
60*bbc000e5SAnders Persson  * Usefull macros:
61*bbc000e5SAnders Persson  */
62*bbc000e5SAnders Persson #define	SOD_DISABLE(sodp) {		\
63*bbc000e5SAnders Persson 	(sodp)->sod_enabled = B_FALSE;	\
64*bbc000e5SAnders Persson }
65*bbc000e5SAnders Persson 
66*bbc000e5SAnders Persson #define	SOD_SOTOSODP(so) ((sonode_t *)so)->so_direct
67*bbc000e5SAnders Persson 
68*bbc000e5SAnders Persson #define	SOD_UIOAFINI(sodp) {						\
69*bbc000e5SAnders Persson 	if ((sodp)->sod_uioa.uioa_state & UIOA_ENABLED) {		\
70*bbc000e5SAnders Persson 		(sodp)->sod_uioa.uioa_state &= UIOA_CLR;		\
71*bbc000e5SAnders Persson 		(sodp)->sod_uioa.uioa_state |= UIOA_FINI;		\
72*bbc000e5SAnders Persson 	}								\
73*bbc000e5SAnders Persson }
74*bbc000e5SAnders Persson 
75*bbc000e5SAnders Persson struct sonode;
76*bbc000e5SAnders Persson struct sodirect_s;
77*bbc000e5SAnders Persson 
78*bbc000e5SAnders Persson extern uio_t	*sod_rcv_init(struct sonode *, int, struct uio **);
79*bbc000e5SAnders Persson extern int	sod_rcv_done(struct sonode *, struct uio *, struct uio *);
80*bbc000e5SAnders Persson 
81*bbc000e5SAnders Persson extern void	sod_uioa_mblk_init(struct sodirect_s *, mblk_t *, size_t);
82*bbc000e5SAnders Persson extern void	sod_uioa_so_init(struct sonode *, struct sodirect_s *,
83*bbc000e5SAnders Persson     struct uio *);
84*bbc000e5SAnders Persson extern ssize_t	sod_uioa_mblk(struct sonode *, mblk_t *);
85*bbc000e5SAnders Persson extern void	sod_uioa_mblk_done(struct sodirect_s *, mblk_t *);
86*bbc000e5SAnders Persson 
87*bbc000e5SAnders Persson extern int	sod_init(void);
88*bbc000e5SAnders Persson extern void	sod_sock_init(struct sonode *);
89*bbc000e5SAnders Persson extern void	sod_sock_fini(struct sonode *);
90*bbc000e5SAnders Persson 
91*bbc000e5SAnders Persson #ifdef	__cplusplus
92*bbc000e5SAnders Persson }
93*bbc000e5SAnders Persson #endif
94*bbc000e5SAnders Persson 
95*bbc000e5SAnders Persson #endif	/* _SOCKFS_SODIRECT_H */
96