sa(7)
NAME
sa − Sun ATM device driver
SYNOPSIS
#include <sys/stropts.h>
#include <atm/sa.h>
#include <atm/atmioctl.h>
DESCRIPTION
The sa driver is a Solaris 2.x DDI/DKI compliant MT safe STREAMS device driver. It presents a DLPI interface to the upper layers and supports M_DATA fastpath and M_DATA raw. The hardware interface supports the SunATM-155 Fiber and UTP products.
The two modes of operation that should be used by application programs are raw mode and dlpi mode. The mode is specified by the choice of encapsulation indicated with the A_ADDVC ioctl call. NULL encapsulation indicates raw mode, while LLC encapsulation indicates dlpi mode. The mode chosen defines the format in which data should be sent to the driver.
Raw mode implies that only a single mblock will be sent to the driver, containing a four-byte vpci followed by the data. When a message is received on a vpci running in raw mode, it will be directed to upper layers based on the vpci. The four-byte vpci will be sent up with the data if an ioctl call setting DLIOCRAW has been made; if DLIOCRAW has not been set, the vpci will be stripped and only the data will be sent up.
DLPI mode implies that two mblocks will be sent to the driver. The first, of type M_PROTO, contains the dlpi message type, which is dl_unitdata_req for transmit and dl_unitdata_ind for receive. The vpci is included in this mblock as well; the format for the mblock is defined in the header file <sys/dlpi.h>. The second mblock is of type M_DATA and contains the message. When the driver gets the two mblocks from the upper layer, it will remove the first mblock, add a LLC header containing the sap which has been bound to this stream (by passing down a dl_bind_req message) to the M_DATA mblock, and transmit it. On receive, the LLC header is stripped, the M_PROTO mblock is added, and the two-mblock structure is sent up the stream indicated by the sap in the LLC header.
The driver supports several of the DLPI message types defined in the <sys/dlpi.h> header file. Specifically, users of the sa driver may use the DL_ATTACH_REQ, DL_DETACH_REQ, DL_BIND_REQ, DL_UNBIND_REQ, DL_UNITDATA_IND, and DL_UNITDATA_REQ. In addition, a Sun-specific dlpi ioctl is supported, DLIOCRAW. There is no data structure associated with the DLIOCRAW ioctl; simply a strioctl struct with ic_cmd set to DLIOCRAW may be used to set a stream to raw mode.
The driver also supports the ATM-specific ioctls described below. Definitions for the ioctl commands and structures may be found in <atm/atmioctl.h>.
IOCTLS
The driver supports a set of ioctl functions which are called using the I_STR ioctl and strioctl structure as the argument. See the streamio(7) man page and the <sys/stropts.h> header file for more information on this type of ioctl call.
The commands supported in the ic_cmd field of the strioctl structure are described in the following paragraphs. The structures that the ic_dp field should point to are also described for each command.
A_ALLOCBW Allocate constant bit rate bandwidth for this stream. ic_dp should point to an a_allocbw_t structure, which is defined as:
typedef struct {
int bw;
} a_allocbw_t;
In this and all other ioctls that use amounts of bandwidth as parameters, the bandwidth amount is expressed as an integer number of megabits per second (Mbps). For the SunATM-155 products, the total bandwidth available is 135 Mbps; some bandwidth is lost to the physical layer overhead and cell headers. In addition, 2 Mbps are reserved by the ATM software stack; thus a total of 133 Mbps may be allocated by the user. All unallocated bandwidth is given to IP.
A_RELSEBW Release bandwidth that was previously allocated for this stream. ic_dp should point to an a_allocbw_t structure.
A_ADDVC Add a vpci to those serviced by this stream, and specify the encapsulation type. The encapsulation type defines the format in which data will be sent to the driver: raw mode, indicated by NULL_ENCAP, implies a single mblock with only the four-byte vpci followed immediately by the data. dlpi mode, indicated by LLC_ENCAP, implies a two-mblock message, consisting of a M_PROTO mblock followed by a M_DATA mblock containing the data. The M_PROTO mblock will contain a dlpi message type (dl_unitdata_req or dl_unitdata_ind) and the vpci; the format may be found in <sys/dlpi.h>. For the A_ADDVC ioctl call, ic_dp points to an a_addVC_t structure, which is defined as:
typedef struct {
u_long vp_vc; /∗ vpci to be added ∗/
int aal_type;/∗ null -> 0, ∗/
/∗ AAL5 -> 5 ∗/
int encap; /∗ encapsulation; see ∗/
/∗ <atm/atmioctl.h> for ∗/
/∗ possible values ∗/
int buf_type;/∗ if AAL5: ∗/
/∗ 0 -> small buf (9 k) ∗/
/∗ 1 -> big buf (9 k) ∗/
/∗ 2 -> huge buf (64 k) ∗/
/∗ if null AAL ∗/
/∗ -> # of cells ∗/
} a_addVC_t;
A_DELVC Remove a vpci from those serviced by this stream. ic_dp points to an a_delVC_t structure:
typedef struct {
u_long vp_vc;
} a_delVC_t;
A_ALLOCBW_VC
Allocate bandwidth for a specific vpci on this stream. ic_dp point to an a_allocbw_vc_t structure:
typedef struct {
int bw; /∗ Mbits/sec ∗/
int vc; /∗ vpci ∗/
} a_allocbw_vc_t;
A_RELSEBW_VC
Releases bandwidth that has been allocated for a specific vpci. The structure passed in in ic_dp should be an a_relsebw_vc_t structure, which is typedef’ed as an a_allocbw_vc_t structure:
typedef a_allocbw_vc_t a_relsebw_vc_t;
EXAMPLES
The following code fragment demonstrates opening a sa device and allocating 20 Mbits/sec of bandwidth for that stream.
#include <atm/atmioctl.h>
char dev[0x20] = "/dev/sa0";
int fd;
struct strioctl strioctl;
a_allocbw_t ap;
if ((fd = open(dev, O_RDWR)) < 0) {
exit(-1);
}
ap.bw = 20;
strioctl.ic_cmd = A_ALLOCBW;
strioctl.ic_timout = -1;
strioctl.ic_len = sizeof (a_allocbw_t);
strioctl.ic_dp = (caddr_t) ≈
if (ioctl(fd, I_STR, &strioctl) < 0) {
exit(-1);
}
SEE ALSO
sa_util(3), dlpi(7), streamio(7)
SunOS ATM_2.0 — Last change: 14 Dec 1995