ba(7)
NAME
ba − Sun ATM device driver
SYNOPSIS
#include <sys/stropts.h>
#include <atm/sa.h>
#include <atm/atmioctl.h>
DESCRIPTION
The ba 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 ioctl 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, 1 Mbps are reserved by the ATM software stack; thus a total of 134 Mbps may be allocated by the user. All unallocated bandwidth is given to IP. The A_ALLOCBW ioctl is supported for compatibility with software written for SunATM 1.0. The A_ALLOCBW_CBR ioctl provides a finer granularity in bandwidth allocation.
A_ALLOCBW_CBR
Allocate constant bit rate bandwidth for this stream. ic_dp should point to an a_allocbw_cbr_t structure, which is defined as:
typedef struct {
int bw;
} a_allocbw_cbr_t;
In this ioctl the bandwidth amount is expressed as an integer number of 64 kilobit per second units. For the SunATM-155 products, the total bandwidth available is 2160 x 64 Kbps; some bandwidth is lost to the physical layer overhead and cell headers. In addition, 128 Kbps are reserved by the ATM software stack; thus a total of 2158 x 64 Kbps may be allocated by the user. All unallocated bandwidth is given to IP.
A_ALLOCBW_VBR
Allocate variable bit rate bandwidth for this stream. ic_dp should point to an a_allocbw_vbr_t structure, which is defined as:
typedef struct {
int peak_bw;
int avg_bw;
int max_burst;
int priority;
} a_allocbw_vbr_t;
A_ALLOCBW_VBR implements the GCRA (Generic Cell Rate Algorithm) as defined by the ATM Forum UNI 3.0 specificaion. peak_bw specifies (in 64 Kbps units) the Peak Cell Rate. avg_bw specifies (in 64 Kbps units) the Sustainable Cell Rate. max_burst specifies the number of cells which can be sent back to back on the media, the Maximum Burst Size from the UNI spec. priority can be AVBR_HIGH_PRI or AVBR_LO_PRI. AVBR_HIGH_PRI will always get their requested bandwidth, AVBR_LO_PRI can starve if other users request all available bandwidth.
Note that the peak_bw, avg_bw, and max_burst parameters are enforced by the hardware device. Since the hardware is not infinitely programmable the driver may have to modify the requested B/W before programming the device. The driver will program the hardware avg_bw as close to the requested value as possible. peak_bw may be rounded down as necessary to meet the hardware granularity; the received peak_bw will always be less than or equal to the requested peak_bw, never greater. max_burst will be truncated at the maximum supported by the hardware; the received max_burst will always be less than or equal to the requested max_burst, never greater.
For the SunATM-155 products, the total average (sustained) bandwidth available is 2160 x 64 Kbps; some bandwidth is lost to the physical layer overhead and cell headers. In addition, 128 Kbps are reserved by the ATM software stack; thus a total of 2158 x 64 Kbps 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 an ba device and allocating 128 Kbits/sec of bandwidth for that stream.
#include <atm/atmioctl.h>
char dev[0x20] = "/dev/ba0";
int fd;
struct strioctl strioctl;
a_allocbw_t ap;
if ((fd = open(dev, O_RDWR)) < 0) {
exit(-1);
}
ap.bw = 2;
strioctl.ic_cmd = A_ALLOCBW_CBR;
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 2.0 — Last change: 14 Dec 1995