diff options
Diffstat (limited to 'usr/src/uts/common/sys/socketvar.h')
| -rw-r--r-- | usr/src/uts/common/sys/socketvar.h | 42 | 
1 files changed, 39 insertions, 3 deletions
| diff --git a/usr/src/uts/common/sys/socketvar.h b/usr/src/uts/common/sys/socketvar.h index f5c4d801de..55a182fa68 100644 --- a/usr/src/uts/common/sys/socketvar.h +++ b/usr/src/uts/common/sys/socketvar.h @@ -21,6 +21,7 @@  /*   * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2015 Joyent, Inc.   */  /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/ @@ -103,6 +104,7 @@ struct sockaddr_ux {  typedef struct sonodeops sonodeops_t;  typedef struct sonode sonode_t; +typedef boolean_t (*so_krecv_f)(sonode_t *, mblk_t *, size_t, int, void *);  struct sodirect_s; @@ -245,6 +247,10 @@ struct sonode {  	struct sof_instance	*so_filter_top;		/* top of stack */  	struct sof_instance	*so_filter_bottom;	/* bottom of stack */  	clock_t			so_filter_defertime;	/* time when deferred */ + +	/* Kernel direct receive callbacks */ +	so_krecv_f		so_krecv_cb;		/* recv callback */ +	void			*so_krecv_arg;		/* recv cb arg */  };  #define	SO_HAVE_DATA(so)						\ @@ -298,15 +304,16 @@ struct sonode {  #define	SS_OOBPEND		0x00002000 /* OOB pending or present - poll */  #define	SS_HAVEOOBDATA		0x00004000 /* OOB data present */  #define	SS_HADOOBDATA		0x00008000 /* OOB data consumed */ -#define	SS_CLOSING		0x00010000 /* in process of closing */ +#define	SS_CLOSING		0x00010000 /* in process of closing */  #define	SS_FIL_DEFER		0x00020000 /* filter deferred notification */  #define	SS_FILOP_OK		0x00040000 /* socket can attach filters */  #define	SS_FIL_RCV_FLOWCTRL	0x00080000 /* filter asserted rcv flow ctrl */ +  #define	SS_FIL_SND_FLOWCTRL	0x00100000 /* filter asserted snd flow ctrl */  #define	SS_FIL_STOP		0x00200000 /* no more filter actions */ -  #define	SS_SODIRECT		0x00400000 /* transport supports sodirect */ +#define	SS_FILOP_UNSF		0x00800000 /* block attaching unsafe filters */  #define	SS_SENTLASTREADSIG	0x01000000 /* last rx signal has been sent */  #define	SS_SENTLASTWRITESIG	0x02000000 /* last tx signal has been sent */ @@ -322,7 +329,8 @@ struct sonode {  /*   * Sockets that can fall back to TPI must ensure that fall back is not - * initiated while a thread is using a socket. + * initiated while a thread is using a socket. Otherwise this disables all + * future filter attachment.   */  #define	SO_BLOCK_FALLBACK(so, fn)				\  	ASSERT(MUTEX_NOT_HELD(&(so)->so_lock));			\ @@ -338,6 +346,24 @@ struct sonode {  		}						\  	} +/* + * Sockets that can fall back to TPI must ensure that fall back is not + * initiated while a thread is using a socket. Otherwise this disables all + * future unsafe filter attachment. Safe filters can still attach after + * we execute the function in which this macro is used. + */ +#define	SO_BLOCK_FALLBACK_SAFE(so, fn)				\ +	ASSERT(MUTEX_NOT_HELD(&(so)->so_lock));			\ +	rw_enter(&(so)->so_fallback_rwlock, RW_READER);		\ +	if ((so)->so_state & SS_FALLBACK_COMP) {		\ +		rw_exit(&(so)->so_fallback_rwlock);		\ +		return (fn);					\ +	} else if (((so)->so_state & SS_FILOP_UNSF) == 0) {	\ +		mutex_enter(&(so)->so_lock);			\ +		(so)->so_state |= SS_FILOP_UNSF;		\ +		mutex_exit(&(so)->so_lock);			\ +	} +  #define	SO_UNBLOCK_FALLBACK(so)	{			\  	rw_exit(&(so)->so_fallback_rwlock);		\  } @@ -369,6 +395,7 @@ struct sonode {  /* The modes below are only for non-streams sockets */  #define	SM_ACCEPTSUPP		0x400	/* can handle accept() */  #define	SM_SENDFILESUPP		0x800	/* Private: proto supp sendfile  */ +#define	SM_DEFERERR		0x1000	/* Private: defer so_error delivery */  /*   * Socket versions. Used by the socket library when calling _so_socket(). @@ -947,6 +974,15 @@ extern struct sonode	*socreate(struct sockparams *, int, int, int, int,  extern int	so_copyin(const void *, void *, size_t, int);  extern int	so_copyout(const void *, void *, size_t, int); +/* + * Functions to manipulate the use of direct receive callbacks. This should not + * be used outside of sockfs and ksocket. These are generally considered a use + * once interface for a socket and will cause all outstanding data on the socket + * to be flushed. + */ +extern int	so_krecv_set(sonode_t *, so_krecv_f, void *); +extern void	so_krecv_unblock(sonode_t *); +  #endif  /* | 
