| OpenSS7 SS7 for the Common Man | © Copyright 1997-2007 OpenSS7 Corporation All Rights Reserved. Last modified: Sat, 01 Nov 2008 10:41:53 GMT | ||||||||||||||||
| |||||||||||||||||
| Manpage of M_SETOPTSDescription: Manual PageKeywords: ss7 ss7/ip ss7 over ip ss7 mtp ss7 sccp ss7 tcap sigtran mtp sccp tcap openss7 acb56 linux telephony pstn linux telephony linux nebs linux compactpciM_SETOPTSSection: Linux Fast-STREAMS DDI/DKI (9)Updated: 2008-10-31 Index Return to Main Contents NAMEM_SETOPTS - STREAMS set stream head options messageFORMATThe M_SETOPTS message block is a datab(9) structure and associated data buffer that contains structured data. An M_SETOPTS message is a normal priority message that consists of a single M_SETOPTS message block. INTERFACEDESCRIPTIONThe M_SETOPTS message is sent to the Stream head by a driver or module wanting to alter some characteristics of the Stream head. It is generated by any downstream module, and is interpreted by the Stream head. The data buffer of the message has the following structure:
struct stroptions {
uint so_flags; /* options to set */
short so_readopt; /* read option */
ushort so_wroff; /* write offset */
ssize_t so_minpsz; /* minimum read packet size */
ssize_t so_maxpsz; /* maximum read packet size */
size_t so_hiwat; /* read queue hi water mark */
size_t so_lowat; /* read queue lo water mark */
unsigned char so_band; /* band for water marks */
unsigned char so_filler[3]; /* padding */
ushort so_erropt; /* Solaris */
ssize_t so_maxblk; /* Solaris */
ushort so_copyopt; /* Solaris */
ushort so_wrpad; /* write (tail) padding */
};
where
so_flags
specifies which options are to be altered, and can be any combination of the following:
SO_ALLUpdate all options according to the values specified in the remaining files of the stroptions(9) structure. SO_READOPTSets the read options for the Stream head. The read options consist of two bit fields that determine the read mode and the read control mode for the Stream head. The read mode determines how the read(2s) system call handles messages and message boundaries. It can contain one of the following mutually exclusive flags:
The read control mode determines how the read(2s) system call handles messages on the Stream head read queue that contain control parts. It can contain one of the following mutually exclusive flags:
Read options can also be set and examined by a user program with the I_SRDOPT(7) or I_GRDOPT(7) commands to ioctl(2s) as detailed in streamio(7). SO_WROFFSpecifies a write offset (for the b_rptr member of the msgb(9) structure message block) into the message block at which data will be written. write(2s) applies this offset before writing data into the first M_DATA(9) message block passed downstream as a result of the write(2s) operation. putmsg(2) and putpmsg(2s) applies this offset before writing data into the first M_DATA(9) message block that forms part of a message before passing the message downstream. Although Linux Fast-STREAMS applies the write offset to each message in the fashion described above, the downstream module cannot always assume that M_DATA(9) message blocks contain the appropriate write offset. It is possible that the M_DATA(9) was either generated by or modified by an intervening module and that it did not contain the write offset because it was either not generated by the Stream head, or it was subsequently modified by an intervening module. The driver or module that requested a write offset should ensure that the appropriate offset exists by comparing the db_base pointer to the b_rptr pointer to ensure that the appropriate offset exists in the necessary message blocks. SO_MINPSZSets the minimum packet size associated with the Stream head read queue. The default is zero (0). This value in the Stream head read queue acts as an advisory value to the driver or module immediately below the stream head on the minimum size of M_DATA(9) messages. Note that for STREAMS-based pipes and FIFOs (with no modules pushed), the Stream head read queue is queue below the the Stream head write queue on the write side of the pipe or FIFO. This means that, although this setting has an advisory effect on the read side of a Stream, it can have a mandatory effect on the write side of a pipe or FIFO (with no modules pushed). Most drivers and modules simply ignore this advisory minimum. SO_MAXPSZSets the maximum packet size associated with the Stream head read queue. The default is INFPSZ. This value in the Stream head read queue acts as an advisory value to the driver or module immediately below the stream head on the maximum size of M_DATA(9) messages. Note that for STREAMS-based pipes and FIFOs (with no modules pushed), the Stream head read queue is queue below the the Stream head write queue on the write side of the pipe or FIFO. This means that, although this setting has an advisory effect on the read side of a Stream, it can have a mandatory effect on the write side of a pipe or FIFO (with no modules pushed). Most drivers and modules simply ignore this advisory maximum. SO_HIWATSets the high water mark, q_hiwat, for the Stream head read queue. This watermark is important to read side flow control and determines when the read side of the Stream is full. SO_LOWATSets the low water mark, q_lowat, for the Stream head read queue. This watermark is important to read side flow control and determines when the read side of the Stream should be back-enabled. SO_MREADONEnables the Stream head to generate M_READ(9) messages when processing a read(2s) system call and there is no data to be read. The message contains the number of bytes the reader is expecting as a long value stored in four data bytes. If both SO_MREADON and SO_MREADOFF are set in so_flags, SO_MREADOFF has precedence. SO_MREADOFFDisables the Stream head generation of an M_READ(9) message when processing a read(2s) system call and there is no data to be read. This is the default. If both SO_MREADON and SO_MREADOFF are set in so_flags, SO_MREADOFF has precedence. SO_NDELONSet non-STREAMS tty semantics for O_NDELAY (or O_NONBLOCK) processing on read(2s) and write(2s) system calls. This sets the STRNDEL flag in the sd_flag member of the Stream head stdata(9) structure. If both SO_NDELON and SO_NDELOFF are set in so_flags, SO_NDELOFF has precedence. If O_NDELAY (or O_NONBLOCK) is set, a read(2s) will return zero (0) if no data is waiting to be read at the Stream head. If O_NDELAY (or O_NONBLOCK) is clear, a read(2s) will block until data becomes available at the Stream head. Regardless of the state of O_NDELAY (or O_NONBLOCK), a write(2s) will block on flow control and will block if buffers are not available. SO_NDELOFFSet STREAMS semantics for O_NDELAY (or O_NONBLOCK) processing on read(2s) and write(2s) system calls. This clears the STRNDEL flag in the sd_flag member of the Stream head stdata(9) structure. This is the default for newly created Stream heads. If both SO_NDELON and SO_NDELOFF are set in so_flags, SO_NDELOFF has precedence. If O_NDELAY (or O_NONBLOCK) is set, a read(2s) will return minus one (-1) and set errno(3) to [EAGAIN] if no data is waiting to be read at the Stream head. If O_NDELAY (or O_NONBLOCK) is clear, a read(2s) will block until data becomes available at the Stream head. If O_NDELAY (or O_NONBLOCK) is set, a write(2s) will return minus one (-1) and set errno(3) to [EAGAIN] if flow control is in effect when the call is received. It will block if buffers are not available. If O_NDELAY (or O_NONBLOCK) is set and part of the buffer has been written and a flow control or buffers not available condition is encountered, write(2s) will terminate and return the number of bytes written. If O_NDELAY (or O_NONBLOCK) is clear, a write(2s) will block on flow control and will block if buffers are not available. In the STREAMS-based pipe and FIFO mechanism, the behaviour of read(2s) and write(2s) is different for the O_NDELAY (or O_NONBLOCK) flags. See read(2s) and write(2s) for details. SO_ISTTYSets the fact that the Stream is a control terminal for a process. That is, it is responsible for providing standard input, output and error connection for the process. This sets the STRISTTY flag in the sd_flag member of the Stream head stdata(9) structure. If both SO_ISNTTY and SO_ISNTTY are set in so_flags, SO_ISNTTY has precedence. SO_ISNTTYSets the fact that the Stream is a non-controlling terminal. That is, it is not responsible for the standard input, output or error of any process. This clears the STRISTTY flag in the sd_flag member of the Stream head stdata(9) structure. If both SO_ISNTTY and SO_ISNTTY are set in so_flags, SO_ISNTTY has precedence.Non-control terminals do not need to perform a large number of behaviours normally associated with ttys such as access control, job control, signals, tracking the session and group leaders and control processes, etc. In fact, ttys that are not controlling terminals can be treated largely as normal STREAMS. SO_TOSTOPSets the Stream head so that it will stop a process attempting to perform a background write to the Stream. This sets the STRTOSTOP flag in the sd_flag member of the Stream head stdata(9) structure. If both SO_TOSTOP and SO_TONSTOP are set in so_flags, SO_TONSTOP takes precedence. SO_TONSTOPResets the Stream head so that it will not stop a process an attempting to perform a background write to the Stream. This clears the STRTOSTOP flag in the sd_flag member of the Stream head stdata(9) structure. If both SO_TOSTOP and SO_TONSTOP are set in so_flags, SO_TONSTOP takes precedence. SO_BANDSpecifies that the so_minpsz, so_maxpsz, so_hiwat, so_lowat, fields and the SO_MINPSZ, SO_MAXPSZ, SO_HIWAT, SO_LOWAT, flags apply to the message band---qband(9) structure---specified in so_band. SO_DELIMSet the Stream head for message delimitation. This sets the STRDELIM flag in the sd_flag member of the stdata(9) structure. If both SO_DELIM and SO_NODELIM are set in so_flags, SO_NODELIM takes precedence. Setting the STRDELIM flag alters the Stream head behaviour for handling of read(2s) and write(2s) in byte-stream read mode. When STRDELIM is set, read(2s) will terminate on a delimited message and will not return a zero-length delimited message to the Stream head read queue on a short read. Also, when the file is set for blocking operation in byte-stream read mode, the caller will block until either nbytes have been read, a message boundary is encountered, a zero-length message is encountered, or a signal or error conditions occurs. Zero-length messages that are delimited (indicating read cessation) will not be returned to the Stream head write queue but non-delimited zero-length messages (indicating end-of-file) will. This is consistent with SVR 4[1] read(2s) behaviour. When STRDELIM and SNDMREAD are both set on the Stream head, the generation of M_READ(9) messages by the Stream head is altered.
When STRDELIM is set, write(2s) will add MSGDELIM flags to indicated delimited messages. The MSGDELIM flag is set in the last M_DATA(9) message of a full write. Partial writes do not set the MSGDELIM flag in any message. This is also true for buffers longer than q_maxpsz, where q_minpsz is zero and write(2s) breaks the write into multiple q_maxpsz-sized messages. In this case, MSGDELIM is only set on the last M_DATA(9) message in the sequence and only when a full write of nbytes occurs. SO_NODELIMReset the Stream head from message delimitation. This clears the STRDELIM flag in the sd_flag member of the stdata(9) structure. This is the default for newly created Stream heads. If both SO_DELIM and SO_NODELIM are set in so_flags, SO_NODELIM takes precedence. Clearing the STRDELIM flag alters the Stream head behaviour for handling of read(2s) and write(2s) in byte-stream read mode. When STRDELIM is clear, read(2s) will terminate when nbytes are read, some data has been read and there is no more data to be read immediately at the Stream head read queue, when a zero-length message is encountered. Message boundaries are ignored. Zero-length messages (that can only indicate end-of-file) are returned to the Stream head read queue to be consumed by a subsequent call. read(2s) only terminates on a signal or error condition when the signal or error condition is detected before data any is read. This is consistent with POSIX[2] read(2s) behaviour. When SNDMREAD is set and STRDELIM is clear, the generation of M_READ(9) messages at the Stream head and the necessary interpretation of M_READ(9) messages at the downstream driver or module are as described above under SO_MREADON . When STRDELIM is clear, write(2s) will generate no MSGDELIM flags in messages. SO_STRHOLDSets the Stream head for the message hold option. STREAMS provides a hold option that improves the performance of STREAMS when the process issues many small writes. The message hold option is enabled if the system adminstrator has changed the system control, sysctl_str_strhold, to be non-zero and if the Stream head flag STRHOLD is set by a driver or module. A downstream driver or module sets the Stream head STRHOLD bit by sending a M_SETOPTS(9) message upstream with the SO_STRHOLD flag set in the so_flags member of the stroptions(9) stucture contained in the message. (The ldterm(4) tty line discipline module does this.) The process may also issue a I_SWROPT(7) command to ioctl(2s) with the SNDHOLD flag set in the argument to enable the hold option on a particular Stream, but this is a Linux Fast-STREAMS extension. Normally the hold option can only be activated and deactivated by a downstream module or driver. The message hold option exploits the fact that allocb(9) allocates a buffer with a data size that is always equal to or greater than FASTBUF. The buffer is allocated and the data is copied into it. write(2s) then checks to see if another write(2s) of the same size will fit into the same buffer. If it will, the buffer is held temporarily on the Stream head write queue, a timer is started (usually, 10 milliseconds, but settable with the sysctl_str_rtime system control), and the Stream head is linked into the scanqhead list in the STREAMS scheduler. One of three things will then happen:
In implementation it is not too difficult to multiplex a single timer against the scanqhead list, rather than setting a timer per Stream. Solaris®[3] no longer implements this option. LiS[4] implements this option but chooses the expensive route of running a 10 millisecond timer per Stream with the feature. Since 10 milliseconds is a single tick on older Linux kernels, it is a particularly bad idea to run many single-tick timers. SO_ERROPTWhen the SO_ERROPT flag is specified in the so_flags member of the stroptions structure, the so_erropt member is interpreted by the Stream head. The so_erropt member can contain one of the following flags:
and one of the following flags:
The SO_ERROPT flag and the associated so_erropt member are Solaris®[3] specific options implemented by Linux Fast-STREAMS for compatibility. The error options can also be examine or set by the user with the I_GERROPT(7) and I_SERROPT(7) STREAMS input output controls, streamio(7). See COMPATIBILITY , below. SO_LOOPSO_LOOP is an undocumented UnixWare®[5] specific option, not implemented by Linux Fast-STREAMS. See COMPATIBILITY , below. SO_COPYOPTso_copyopt can contain zero or more of the following flags:
If both MAPINOK and NOMAPIN are set, If neither are set, the existing Stream head setting is unchanged in this regard. NOMAPIN takes precedence.
If both REMAPOK and NOREMAP are set, NOREMAP takes precedence. If neither are set, the existing Stream head setting is unchanged in this regard. Note that the MAPINOK, NOMAPIN, REMAPOK and NOREMAP flags are located in <sys/stropts.h> instead of <sys/stream.h>. SO_COPYOPT and the associated so_copyopt member of the stroptions structure are Solaris® specific options not implemented by Linux Fast-STREAMS. See COMPATIBILITY , below. SO_MAXBLKSO_MAXBLK and the associated so_maxblk member of the stroptions structure are Solaris® specific options not implemented by Linux Fast-STREAMS. Solaris® provides the capability of changing the maximum block size on a per-stream basis. Linux Fast-STREAMS takes the SVR 4.2 approach of enforcing only a global maximum block size for all streams. See COMPATIBILITY , below. SO_COWENABLESO_COWDISABLESO_COWENABLE and SO_COWDISABLE are OSF/1®[6] and HPUX®[7] specific flags that are not well documented. Linux Fast-STREAMS reserves these two flags for a zero-copy implementation at the Stream head that works as follows: When the Stream head is set for copy-on-write with the SO_COWENABLE flag, data portions of messages are mapped from user-space into kernel space and the copy-on-write characteristic set on the mapped kernel page. Any attempt to write to the page will result in a copy of the user-space page to the kernel page before writing. If no attempt is made to write to the page, and effective zero-copy architecture results in which the data can be copied directly from user space to interface devices at the driver. This mechanism is not yet implemented by Linux Fast-STREAMS, however, these two flags are reserved for such a future implementation. SO_WRPADSpecifies the write padding (for the b_wptr member of the msgb(9) structure message block) for the message block after the extent where data will be written. write(2s) applies this padding after writing data into the last M_DATA(9) message block passed downstream as a result of the write(2s) operation. putmsg(2) and putpmsg(2s) applies this padding after writing data into the last M_DATA(9) message block that forms part of a message before passing the message downstream. Although Linux Fast-STREAMS applies the write padding to each message in the fashion described above, the downstream module cannot always assume that M_DATA(9) message blocks contain the appropriate write padding. It is possible that M_DATA(9) was either generated by or modified by an intervening module and that it did not contain the write padding because it was either not generated by the Stream head, or it was subsequently modified by an intervening module. The driver or module that requested a write offset should ensure that the appropriate offset exists by comparing the db_lim pointer to the b_wptr pointer to ensure that the appropriate padding exists in the necessary message blocks. The SO_WRPAD flag and the associated so_wrpad member are specific to Linux Fast-STREAMS. SO_WRPAD and so_wrpad are similar to SO_WROFF and so_wroff with the exception that instead of adding an offset to the beginning of a data buffer for the data part of a message, (that is, specifying headroom for the buffer) SO_WRPAD and so_wrpad specify the amount of padded added to the end of the data buffer for the data part of a message, (that is, specifies the tailroom for the buffer). SO_NOCSUMSO_CSUMSO_CRC32CSpecifies the checksum algorithm to be used to calculate a partial checksum when copying data from the user into M_DATA(9) message blocks. The result of the partial checksum will be written to the b_csum member of the msgb(9) structure and the appropriate message flag (MSGCSUM or MSGCRC32C) will be set in the corresponding b_flag member. This permits a Van Jacobson style checksum and copy operation for networking protocol streams, and is used by Linux Fast-STREAMS high-performance network pseudo-device drivers. The SO_NOCSUM, SO_CSUM and SO_CRC32C flags, the b_csum member, and the MSGCSUM and MSGCRC32C message flags are specific to Linux Fast-STREAMS. SO_SKBUFFSO_NOSKBUFFSpecifies whether Linux style socket buffers (struct sk_buff) are to be allocated to form the data buffer of the data block instead of the normal kernel memory allocation associated with allocb(9). When specified, the Stream head will allocate a socket buffer and perform a call to esballoc(9) with the data buffer portion of the socket buffer described and a special frtn_t(9) structure that will free the socket buffer when the data block is freed. The stream head will also set the DB_SKBUFF flag in the db_flag member of the datab(9) structure to indicate to downstream drivers that a socket buffer has already been allocated and associated with the data block. Downstream drivers or modules that recognize the DB_SKBUFF flag can acquire a reference to the socket buffer using skb_get() or skb_clone() on the socket buffer pointer stored in db_frtn->free_arg. Note that the socket buffer is initially empty and is left by the Stream head in the state that it was when freshly allocated. This option is used by Linux Fast-STREAMS high-performance network drivers to avoid excessive handling and conversion of data buffers between STREAMS and underlying Linux packet handling. The SO_SKBUFF and SO_NOSKBUFF flags are specific to Linux Fast-STREAMS. USAGEM_SETOPTS messages cannot be generated directly by a user level process. M_SETOPTS messages arriving at a driver can be discarded (ignored and freed). M_SETOPTS messages are consumed by the Stream head. M_SETOPTS can be generated by drivers and modules. The following are guidelines for processing of the M_SETOPTS message in drivers and modules:
The M_SETOPTS message is used whenever a driver or module wishes to change a Stream head setting synchronized with the data stream. NOTICESThe zero-copy architectures offerred by the Solaris® SO_COPYOPT option, and the OSF/1® and HPUX® SO_COWENABLE and SO_COWDISABLE option, are attractive and a similar mechanism should be implemented for Linux Fast-STREAMS. SEE ALSOM_PCSETOPTS(9), datab(9), msgb(9). COMPATIBILITYThe M_SETOPTS STREAMS message is compatible with SVR 4.2 MP STREAMS, and implementations based on SVR 4, with the following portability considerations:
See STREAMS(9) for additional compatibility information. CONFORMANCEHISTORYThe M_SETOPTS message first appeared in SVR 3[11]. REFERENCES
TRADEMARKS
Other trademarks are the property of their respective owners. IDENTIFICATION
Copyright©1997-2008OpenSS7 Corp.
All Rights Reserved.
Index
This document was created by man2html, using the manual pages. Time: 05:11:23 GMT, May 20, 2013 | ||||||||||||||||
| OpenSS7 SS7 for the Common Man |
| ||||||||||||||||
| Last modified: Sat, 01 Nov 2008 10:41:53 GMT © Copyright 1997-2007 OpenSS7 Corporation All Rights Reserved. |