Chapter 2. Commands for Permanent VCs

This chapter summarizes the IRIS ATM application interface calls that support permanent virtual circuits (PVCs). These commands are described alphabetically in the sections that follow, and are summarized in Table 2-1.


Note: The IRIS ATM atmarp utility handles IP-to-VC address resolution for PVCs that carry IP traffic. When atmarp is running, the commands in Table 2-1 under the heading “Address Resolution for IP-over-ATM when atmarp is not running” do not need to be used. These commands are provided for management implementations that do not use the atmarp utility. See the atmarp man page for further details.


Table 2-1. Summary of ATM PVC ioctl() Calls

Type of Operation

Command

(or Function)

Port State

Description

More Info

Getting a link to the ATM-subsystem

open()

all

Opens a file descriptor for a device. Must be held open as long as the bound VC is active.

“open() Function” in Chapter 1

Tearing down a VC

close()

all

Closing the file descriptor causes the VC to be torn down and all resources released.

“close() Function” in Chapter 1

Managing transmission rates for HIO mezzanine (CHALLENGE) board

 

 

 

 

 

ATMIOC_SETRATEQ

up or down

Sets rate for one of the 8 rate queues.

“ATMIOC_SETRATEQ” in Chapter 5

 

ATMIOC_GETRATEQ

up

Reads rate for the indicated rate queue.

“ATMIOC_GETRATEQ” in Chapter 5

Managing PVCs

 

 

 

 

 

ATMIOC_CREATEPVC

up

Binds one pair of virtual path or virtual channel identifiers to a file descriptor.

“ATMIOC_CREATEPVC”

 

ATMIOC_GETVCCTABLEINFO

up

Retrieves information about all the VCCs currently open on the device.

“ATMIOC_GETVCCTABLEINFO”

Address resolution for IP-over-ATM when atmarp is not running

 

 

 

 

 

ATMIOC_GETARPTAB

up or down

Retrieves the entire IP-to-ATM address resolution table.

“ATMIOC_GETARPTAB”

 

ATMIOC_GETARP

up or down

Retrieves one entry from the ATM address resolution table.

“ATMIOC_GETARP”

 

ATMIOC_SETARP

up or down

Sets a static entry in IP-to-ATM address resolution table. AR table maps IP addresses to atm_laddr_t structures.

“ATMIOC_SETARP”

 

ATMIOC_DELARP

up or down

Deletes one entry from IP-to-ATM AR table.

“ATMIOC_DELARP”

Managing data

 

 

 

 

 

write()

up

Pinned down, 8-byte aligned buffer of any size. If necessary, ATM subsystem divides data into different packets for transmission.

“write() Function” in Chapter 1

 

writev()

up

Gathers data from a number of buffers for transmission as one or more packets.

“write() Function” in Chapter 1

 

read()

up

Retrieves incoming data.

“read() Function” in Chapter 1


Include Files for PVCs

The following files must be included in any program using the ATM-specific ioctl() calls:

  • “sys/atm.h”

  • “sys/atm_user.h”

  • “sys/if_atm.h” (only for applications doing IP-over-ATM)

Frequently Used Structures

Some structures are used as arguments for many of the ATM-specific ioctl() calls. For reference, these frequently used structures are described in the following section.

The atm_laddr_t Structure

The atm_laddr_t structure is the ATM subsystem's local hardware address used for IP-to-VC address resolution (that is, the IRIS ATM ARP for PVCs) commands. For IP-over-PVCs, the structure is used within the standard arpreq structure. Table 2-2 and the following paragraphs describe the atm_laddr_t structure and its usage.

Table 2-2. IRIS ATM Local Hardware Address: atm_laddr_t

Field of atm_laddr_t

Recommended Value

Comments

port

0 - 11

Port's number. The number can be determined with the /sbin/hinv command. The value must be less than ATM_MAXBD.

flags

none

Used internally by IRIS ATM software.

aal

value of AALTYPE_5

Currently, only AAL5 is supported.

vpi

0 - 255 (decimal)

Virtual path identifier.

vci

0 - 65535 (decimal)

Virtual channel identifier. The VPI/VCI combination must be currently unused, and thus, available, both locally and on the switch.

Following is an example of the arpreq structure, as defined in the if_arp.h file:

struct arpreq {
      struct sockaddr arp_pa; /* protocol address */
      struct sockaddr arp_ha; /* hardware address */
                              /* for ATM = atm_laddr_t*/
      int arp_flags;
};

Following is an example of the sockaddr structure, as defined in the socket.h file:

struct sockaddr {
      u_short sa_family; /* address family */
      char sa_data[14];  /* up to 14 bytes of direct address */
};

Following is an example of the atm_laddr structure, as defined in the atm_user.h file:

typedef struct atm_laddr {
      u_char port;  /* local port number; brd's unit nmbr*/
      u_char flags; /* flags - local use only */
      u_char aal;   /* aal type - local use only */
      u_char vpi;   /* remote VPI */
      u_short vci;  /* remote VCI */
} atm_laddr_t;

Following are values for the aal field of atm_laddr_t structure, as defined in the atm_b2h.h file (included in the atm_user.h file)

#define AALTYPE_34 0
#define AALTYPE_5 1
#define AALTYPE_CBR 6
#define AALTYPE_RAW 7

PVC Code Sample

This section provides a simple code example showing creation, use, and tear down of one PVC.

/* open a file descriptor */

      fd = open( "/dev/atm0", rw );
      if ( fd < 0 )
          perror( "couldn't open device" ),exit(1);
/* define the VC's parameters */
       vpi = <your value>
       vci = <your value>
       xmitMaxCSDU = <your value>
       recvMaxCSDU = <your value>
       cellrate_type = <your value>
       cellrate_peak_rate = <your bits-per-second/384>
       cellrate_sustainable_rate = <your bits-per-second/384>
       cellrate_maxburst_size = <your value>

/* prepare the argument for ATMIOC_CREATEPVC with VC's */
/* parameters */
      atm_createpvc_t pvcreq;
      bzero( &pvcreq, sizeof(pvcreq) );
      pvcreq.vpi = vpi;
      pvcreq.vci = vci;
      pvcreq.xmitMaxCSDU = xmitMaxCSDU;
      pvcreq.recvMaxCSDU = recvMaxCSDU;
      pvcreq.xmitcellrate.cellrate_type = cellrate_type;

/* then one of these two sets,  */
/* depending on which type was used */
/* this for CRT_PEAK_AGG or CRT_BEST_EFFORT */
      pvcreq.xmitcellrate.rate.pcr_01.pcr01 = cellrate_peak_rate;

/* or this set for CRT_PSB_AGG */
      pvcreq.xmitcellrate.rate.psb_01.pcr01 = cellrate_peak_rate;
      pvcreq.xmitcellrate.rate.psb_01.scr01 = cellrate_sustainable.rate;
      pvcreq.xmitcellrate.rate.psb_01.mbs01 = cellrate_maxburst_size;

/* create the VC */
      if ( ioctl( fd, ATMIOC_CREATEPVC, &pvcreq ) < 0 )
          perror( “couldn't ATMIOC_CREATEPVC” ),exit(
/* the VC can now be written and read
      write(fd, obuf, length); #follow the guidelines in “write() Function” in Chapter 1
      read(fd, ibuf, length ); #follow the guidelines in “read() Function” in Chapter 1
/* to tear down the VC */
      error = close( fd, rw );
      if ( error != 0 )
          perror( “couldn't close device” ),exit(1);

PVC Commands

Thie following sections describe each ATM PVC ioctl() command in detail. The commands are organized alphabetically.

ATMIOC_CREATEPVC

The ATMIOC_CREATEPVC ioctl() command creates a permanent virtual circuit. A successful call binds an open file descriptor to one (a read-only or write-only) or two (a read and a write) virtual channel connections (VCCs), creates entries in the appropriate VC tables, and allocates board resources. Each VCC is identified by a VC address: virtual path identifier (VPI) and virtual channel identifier (VCI). The call creates a single VCC when the open file descriptor is read-only or write-only; it creates two VCCs (one forward and one back, using the same VC address for each) when the file descriptor is read and write. Only one ATMIOC_CREATEPVC can be called for each open file descriptor. Only one PVC is allowed for each VPI/VCI pair. The software prevents creation of a second VCC to the same VPI/VCI pair.

For a writable file descriptor, the call fails if the requested cellrate cannot be provided by the IRIS ATM hardware subsystem, as explained in “Characteristics of the ATM-OC3c Hardware” in Chapter 1. To maximize throughput, set the size for the transmitting VC's user protocol data units (CSPDUs) to MAX_CS_PDU .

Creating a PVC for a readable file descriptor causes the ATM subsystem to send all incoming PDUs (received on the incoming VCC) up to the application. Received PDUs are buffered in the kernel in per-VC queues. Cells received for a VPI or VCI address that has not been created are discarded by the ATM subsystem.

The port must be in the up state.


Note: To tear down the VC, simply close the file descriptor. The IRIS ATM subsystem tears down the VC, releases resources, and cleans up.


Usage

Use the following format:

ioctl (fd_atm, ATMIOC_CREATEPVC, &createpvc);

createpvc is an atm_createpvc_t structure.

Argument Values

The pointer to createpvc identifies an instance of an atm_createpvc_t structure that is set up as shown in Table 2-3.

Table 2-3. Recommended Values for Arguments of the ATMIOC_CREATEPVC Command

Field of atm_createpvc_t

Recommended Value

Comments

vpi

0 - 0xFF

Virtual path identifier. Value must match the one used by the switch for this VC and, if servicing IP traffic, the one used in any local IP-to-VC address mapping file.

vci

0 - 0xFFFF

Virtual channel identifier. Value must match the one used by the switch for this VC.[a]

xmitMaxCSDU

8 up to 0x2FF8

Maximum size for user-level packets (PDUs). Value cannot be 0 or larger than MAX_CS_PDU and must be divisible by 8. Set to MAX_CS_PDU for optimal throughput.

recvMaxCSDU

8 up to 0x2FF8

Maximum size for user-level packets (PDUs). Value cannot be 0 or larger than MAX_CS_PDU and must be divisible by 8.

flags

as desired

0 = no flags; default functionality, or one or more of the following flags:

ATMPVCFL_IP indicates that the VC is servicing an IP logical network interface. If this flag is set, the ATMIOC_SETARP command must be used to bind this VPI or VCI to an IP address.

ATMPVCFL_NOSNAP indicates that 802.2 LLC/SNAP encapsulation should not be attached on the packets on this VC.

xmitcellrate

cellrate_t

Set up as described in Table 2-4.

Upon return, this value equals the out value, which is the actual value for the VC.

[a] VPI/VCI values 0/0-32 are reserved by the ATM standards for use by ATM signaling and ILMI modules.

The cellrate_t structure defines the traffic parameters for the PVC. The supported values are described in Table 2-4, where CR stands for cellrate expressed in cells per second. For the call to succeed, the specified peak cellrate must be supported by the hardware; see “Characteristics of the ATM-OC3c Hardware” in Chapter 1, for a description of the transmission rate queues and how they are configured.

Table 2-4. Supported Values for Traffic Parameters of ATMIOC_CREATEPVC

Fields of cellrate_t Structure

Possible Values

Description

cellrate_type

CRT_NULL

Zero bandwidth.

 

CRT_PEAK_AGG

Aggregate peak CR for CLP0+1. CBR traffic.

 

CRT_PSB_AGG

Aggregate peak CR, sustainable CR, and burst size for CLP 0+1. VBR traffic.

 

CRT_BEST_EFFORT

Peak CR for CLP0+1 with best-effort indication.

 

CRT_PEAK

Not supported in this release. Peak CRs for CLP0 and CLP0+1.[a]

 

CRT_PEAK_TAG

Not supported in this release. Same as CRT_PEAK, with tagging requested.

 

CRT_PSB

Not supported in this release. Peak CR for CLP0+1, sustainable CR for CLP0, burst size for CLP0.

 

CRT_PSB_TAG

Not supported in this release. Same as CRT_PSB, with tagging requested.

rate (for type CRT_PEAK_AGG)

 

 

 

struct pcr_01:

pcr01

Peak CR for CLP 0+1. Value must be supported by the IRIS ATM hardware, as described in “Characteristics of the ATM-OC3c Hardware” in Chapter 1.

rate (for type CRT_PSB_AGG)

struct psb_01:

pcr01

scr01

mbs01

Peak CR for CLP 0+1. Value must be supported by the IRIS ATM hardware, as described in “Characteristics of the ATM-OC3c Hardware” in Chapter 1.

Sustainable CR for CLP 0+1.

Maximum burst size for CLP 0+1 in cells per burst. Valid values are multiples of 32 between 1 and 2,048, inclusive. Zero is not valid.

rate (for type CRT_BEST_EFFORT)

struct pcr_01:

pcr01

Peak CR for CLP 0+1. Value must be supported by the IRIS ATM hardware, as described in “Characteristics of the ATM-OC3c Hardware” in Chapter 1.

rate (for types CRT_PEAK CRT_PEAK_TAG)

CRT_PSB

CRT_PSB_TAG

not applicable

Not supported in this release.

[a] CR or cr = cellrate expressed in cells per second. For example, a CR of 100 means that 4,800 bytes of user data (100 cells * 48 bytes of payload for each ATM cell) are transmitted each second.


Success or Failure

If successful, ATMIOC_CREATEPVC returns zero. The out values should be read.

On failure, the ioctl() call returns -1 with an error stored in errno. For descriptions of individual errors, see “Errors”.

Out Values

When the VC is successfully created, the actual values that were used to create the VC are written to the call's argument. The xmitcellrate value should be read and verified because it might be different from the requested value.

When the ATMIOC_CREATEPVC fails, the values in the argument do not change and are not meaningful.

Relevant Structures

The following code is the atm_createpvc_t structure, as defined in the sys/atm_user.h file:

typedef struct {
      u_short vpi;
      u_short vci;
      u_short xmitMaxCSDU, recvMaxCSDU;
      u_char flags;
      cellrate_t xmitcellrate;
} atm_createpvc_t;

typedef struct {
      char cellrate_type;
      union {
          /* for cellrate_type = CRT_PEAK, CRT_PEAK_TAG */
          struct {
              int pcr0;
              int pcr01;
          } pcr_0_01;

          /* for cellrate_type = CRT_PEAK_AGG, CRT_BEST_EFFORT */
          struct {
              int pcr01;
          } pcr_01;

          /* for cellrate_type = CRT_PSB, CRT_PSB_TAG */
          struct {
              int pcr01;
              int scr0;
              int mbs0;
          } psb_0_01;

          /* for cellrate_type = CRT_PSB_AGG */
          struct {
               int pcr01;
               int scr01;
               int mbs01;
          } psb_01;

      } rate;
} cellrate_t;

Errors

Possible errors include:

EADDRINUSE 

The VCI value is already in use by another VC.

EFAULT 

An error occurred as the driver was copying in the command's createpvc argument.

EINVAL 

The specified type of cellrate is not supported. Or, the specified cellrate is not valid for the type of cellrate. (For example, for a best-effort type with the IRIS ATM HIO (CHALLENGE) board, the slowest configured low-priority rate is still too fast, or for peak aggregate, all the high-priority queues are in use or are configured at a fixed value and none of their rates matches the value specified for pcr01). Or, the specified maximum CSDU size is larger than MAX_CS_PDU (that is, 12 kilobytes - 8 bytes). Or, there is no open file descriptor.

ENODEV 

The port is not up.

ENOMEM 

The port was unable to allocate enough on-board memory to complete this task.

ENOSPC 

The maximum number of supported open VCs (MAX_FWD_VCS or MAX_RVS_VCS) are already created. Or, the port is out of buffers for the PDU size specified in the argument. Or, the port is out of resources (all the bandwidth is currently occupied by other open VCs).

ATMIOC_DELARP

The ATMIOC_DELARP ioctl() command deletes one static PVC entry from the IP-to-ATM address resolution table.


Note: This command will not be supported in future releases of the IRIS ATM API. The portable method for managing the ATM ARP table is the atmarp utility.


Usage

Use the following format:

ioctl (fd_atm, ATMIOC_DELARP, &arp);

arp is an instance of arpreq.

Argument Values

The pointer to arp identifies an instance of an arpreq structure that indicates which entry in the ATM address resolution table is to be removed. The arpreq structure must be set up as described in Table 2-5.

Table 2-5. Recommended Values for Arguments of the ATMIOC_DELARP Command

Field of arpreq_t

Recommended Value

Comments

arp_pa

IP address

In sa_family field, set the protocol family to AF_INET, and, in sa_data field, provide the IP address of remote system.

arp_ha

none

This field is ignored.

arp_flags

none

 


Success or Failure

If successful, ATMIOC_DELARP returns zero.

On failure, the ioctl() returns -1 with an error stored in errno. For descriptions of individual errors, see “Errors”.

Relevant Structures

The arpreq and atm_laddr_t structures are described in “Frequently Used Structures”.

Errors

Possible errors include:

EAFNOSUPPORT 

The address family specified in the protocol portion of the arpreq structure is not AF_INET.

EFAULT 

When attempting to copy the data, an error occurred.

EINVAL 

An not valid entry occurred during processing of the address resolution. It may be that the requested address was not found in the AR table.

ENODEV 

The port was not in the up or down state.

ATMIOC_GETARP

The ATMIOC_GETARP ioctl() command retrieves the mapping for one static PVC entry from the IP-to-ATM address resolution table.


Note: This command will not be supported in future releases of the IRIS ATM API. The portable method for managing the ATM ARP table is the atmarp utility.


Usage

Use the following format:

ioctl (fd_atm, ATMIOC_GETARP, &arp);

arp is an arpreq structure.

Argument Values

The pointer to arp identifies an instance of a standard arpreq structure defining the protocol address half of the IP-to-ATM address resolution entry to be retrieved.

The arpreq structure should be set up as shown in Table 2-6.

Table 2-6. Recommended Values for Arguments of the ATMIOC_GETARP Command

Field of arpreq_t

Recommended Value

Comments

arp_pa

AF_INET and IP address

In the sa_family field, set the protocol family to AF_INET, and, in the sa_data field, provide the IP address of the remote system.

arp_ha

none

 

Out value: retrieved.

Upon return, this value equals the out value.

atm_laddr_t structure. See Table 2-2, for description.

arp_flags

none

 


Success or Failure

If successful, ATMIOC_GETARP returns zero. The out values should be read.

On failure, the ioctl() returns -1 with an error stored in errno. For descriptions of individual errors, see “Errors”.

Out Values

The retrieved PVC hardware address is written as an atm_laddr_t structure within the arp_ha field of the argument.

Relevant Structures

The arpreq and atm_laddr_t structures are described in “Frequently Used Structures”.

Errors

Possible errors include:

EAFNOSUPPORT 

The address family specified in arp_pa is not supported.

EFAULT 

When attempting to copy the data, an error occurred.

ENODEV 

The port was not in the up or down state.

ENXIO 

The arp_pa specified in the argument was not found in the ATM address resolution table.

ATMIOC_GETARPTAB

The ATMIOC_GETARPTAB ioctl() command retrieves the entire contents of the IP-to-ATM address resolution table. The retrieved entries include all PVCs that, at creation, were tagged with the ATMPVCFL_IP flag (even those that do not have an IP address assigned).


Note: This command will not be supported in future releases of the IRIS ATM API. The portable method for managing the ATM ARP table is the atmarp utility.


Usage

Use the following format:

ioctl (fd_atm, ATMIOC_GETARPTAB, &sioc);

sioc is an atmsioc_t structure.

Argument Values

The pointer to sioc identifies an instance of an atmsioc_t structure, set up as shown in Table 2-7. Within sioc, the *ptr field must be a pointer to an array of atm_arptab_t structures.

Table 2-7. Recommended Values for Arguments of the ATMIOC_GETARPTAB Command

Field of atmsioc_t

Recommended Value

Comments

*ptr

pointer to atm_arptab[ ]

Start address where retrieved ATM address resolution table is written. The out value equals the array of atm_arptab_t structures. Upon return, the out value equals the recommended value.

len

size of (atm_arptab[ATMARP_TABLESZ*2] )

Maximum possible size of table.

The out value is equal to the length of the retrieved table. Upon return, the out value equals the recommended value.


Success or Failure

If successful, ATMIOC_GETARPTAB returns zero. The out values should be read.

On failure, the ioctl() returns -1 with an error stored in errno. For descriptions of individual errors, see “Errors”.

Out Values

The len field in the argument ( sioc) is updated to contain the actual length of the retrieved data. The retrieved table is written to the atm_arptab[]. Each table entry is one atm_arptab_t structure, described in Table 2-8.

Table 2-8. Values Retrieved by the ATMIOC_GETARPTAB Command

Field in atm_arptab_t

Type

Description

iaddr

structin_addr

The out value is equal to the IP address. Upon return, the out value is equal to the type.

atmaddr

structatm_address_t

The out value is equal to the ATM address, if one exists. Upon return, the out value is equal to the type.

laddr

struct atm_laddr_t

The out value is equal to the local hardware address: VPI, VCI, PT. See “The atm_laddr_t Structure”. Upon return, the out value is equal to the type.

flags

u_char

The out value is equal to entries from Table 2-9. Upon return, the out value is equal to the type.


Table 2-9. Flags Retrieved by the ATMIOC_GETARPTAB Command

Flag

Description

COMPL

The ATM address for this IP address has been obtained.

CONN

The connection has been established for the VC.

NAK

The ATMARP server has responded that it does not recognize this endpoint.

NOSNAP

The VC is not using LLC/SNAP encapsulation.

PEND

The connection has not yet been established; it is pending setup completion.

PVC

The VC is a permanent virtual circuit, not a switched one.

VALIDATE

The IP address is in the process of being validated with InverseARP.


Relevant Structures

The atmsioc_t structure is described in the following example. The atm_arptab_t structure is described in Table 2-8, and in “The atm_laddr_t Structure”.

Following is an example of the atmsioc_t structure, as defined in the sys/atm_user.h file:

typedef struct atmsioc {
      void *ptr; /* where data is located */
      u_int len; /* size of structure at *ptr */
} atmsioc_t;

Following is an example of the atm_arptab_t structure, as defined in the if_atm.h file:

typedef struct atm_arptab {
      struct in_addr iaddr;
      atm_address_t atmaddr;
      atm_laddr_t laddr;
      u_char flags;
} atm_arptab_t;

Errors

Possible errors include:

EFAULT 

When attempting to copy the data, an error occurred.

ENODEV 

The port was not in the up or down state.

ATMIOC_GETVCCTABLEINFO

The ATMIOC_GETVCCTABLEINFO ioctl() command retrieves the entire virtual channel table (both transmit and receive VCs) from any IRIS ATM port. The port must be in the up state.

Usage

Use the following format:

ioctl (fd_atm, ATMIOC_GETVCCTABLEINFO, &sioc);

sioc is an atmsioc_t structure.

Argument Values

The pointer to sioc identifies an instance of an atmsioc_t structure. The atmsioc_t structure should be set up as summarized in Table 2-10.

Table 2-10. Recommended Values for Arguments of the ATMIOC_GETVCTAB Command

Field of atmsioc_t

Recommended Value

Comments

*ptr

pointer to vcce[]

Pointer to location for retrieved information. The out value is equal to an array of atm_vcce_t structures. Upon return, the out value equals the recommended value

len

size of (vcce[MAX_FWD_VCS++MAX_RVS_VCS]);

Maximum possible size of the table.

The out value is equal to the length of the retrieved table. Upon return, the out value equals the recommended value.


Success or Failure

If successful, ATMIOC_GETVCCTABLEINFO returns zero. The out values should be read.

On failure, the ioctl() call returns -1 with an error stored in errno. For descriptions of individual errors, see “Errors”.

Out Values

The len field in the sioc argument is updated to contain the actual length of the retrieved data, as described in Table 2-10. The retrieved data is written to the array of atm_vcce_t structures. Each table entry is one atm_vcce_t structure, as described in Table 2-11.

Table 2-11. Values Retrieved by the ATMIOC_GETVCCTABLEINFO Command

Field of atm_vcce_t

Type

Description

vpi

int

Value for VPI

vci

int

Value for VCI

xmit_cellrate

struct cellrate_t

Transmit cellrate

recv_cellrate

struct cellrate_t

Receive (backward) cellrate

xmitQOS

int

Transmit quality of service

recvQOS

int

Receive (backward) quality of service


Relevant Structures

The atmsioc_t structure and the atm_vcce_t structure, as defined in the sys/atm_user.h file, are as follows:

typedef struct atmsioc {
	void *ptr;
	u_int len;
} atmsioc_t;

typedef struct {
	int         vpi;
	int         vci;
	cellrate_t  xmit_cellrate;
	cellrate_t  recv_cellrate;
	int         xmitQOS;
	int         recvQOS;
} atm_vcce_t;

Errors

Possible errors include:

EFAULT 

An error occurred when the driver was copying the data.

EINVAL 

The len specified in the argument is too small to contain the information being retrieved.

ENODEV 

The port was not in the up state.

ATMIOC_GETVCTAB

The hardware-dependent ATMIOC_GETVCTAB ioctl() command retrieves the entire virtual channel table (both transmit and receive VCs) from an IRIS ATM HIO (CHALLENGE) board; other boards do not support this call. The board must be in the up state.


Note: This command will not be supported in future releases of the IRIS ATM API. The portable method for managing the VC table is the ATMIOC_GETVCCTABLEINFO command.


Usage

Use the following format:

ioctl (fd_atm, ATMIOC_GETVCTAB, &sioc);

sioc is an atmsioc_t structure.

Argument Values

The pointer to sioc identifies an instance of an atmsioc_t structure. The atmsioc_t structure should be set up as summarized in Table 2-12.

Table 2-12. Recommended Values for Arguments of the ATMIOC_GETVCTAB Command

Field of atmsioc_t

Recommended Value

Comments

*ptr

pointer to vct[]

Pointer to location for retrieved information. The out value equals an array of atm_vcte_t structures. Upon return, the out value equals the recommended value.

len

size of (vct[MAX_FWD_VCS+MAX_RVS_VCS ]);

Maximum possible size of the table. The out value equals the length of retrieved table. Upon return, the out value equals the recommended value.


Success or Failure

If successful, ATMIOC_GETVCTAB returns zero. The out values should be read.

On failure, the ioctl() call returns -1 with an error stored in errno. For descriptions of individual errors, see “Errors”.

Out Values

The len field in the (sioc) argument is updated to contain the actual length of the retrieved data, as described in Table 2-12. The retrieved data is written to the array of atm_vcte_t structures. Each table entry is one atm_vcte_t structure, as described in Table 2-13.

Table 2-13. Values Retrieved by the ATMIOC_GETVCTAB Command

Field of atm_vcte_t

Type

Description

cell_hdr

u_int

VPI=bits 27:20; VCI=bits 19:4; PT=bits 3:0

max_cs_pdu_size

u_int

Maximum PDU size on this VC.

burst_size

u_short

Maximum burst allowed. A burst is the maximum number of back-to-back cells transmitted at peak cellrate (CQ). 32 modulo bucket depth.

rate_queue_number

u_char

Rate queue ID. The configured rate on this queue is the peak cellrate for this VC.

avg_rate_divisor

u_char

The peak cellrate is divided by this value to give the average or sustainable cellrate for the VC (TIQ).

read_write

u_char

VCC type description:

VCTE_RW = read+write

VCTE_RO = read only

VCTE_WO = write only

aal_type

u_char

AAL type: AAL3/4, AAL5, Raw, CBR.

flags

u_char

Flags:

VCTE_IP = VC carries IP traffic

VCTE_NOTRAILERS = no AAL5 trailers or CRCs are used

VCTE_NOSNAP = packets are not encapsulated with 802.2 LLC/SNAP

ifunit_in

u_char

Logical network interface number ( if_net) that is the endpoint. Only for VCs servicing IP traffic.

vcte

u_int

Local index (number), which was provided by the driver at the time the VC was created.


Relevant Structures

The atmsioc_t structure, as defined in the sys/atm_user.h file and the atm_vcte_t structure, as defined in the sys/atm_b2h.h file (which is included in the sys/atm_user.h file), are shown in the following sample code:

typedef struct atmsioc {
      void *ptr;
      u_int len;
} atmsioc_t;

typedef struct atm_vcte {
      u_int cell_hdr;
      u_int max_cs_pdu_size;
      u_short burst_size;
      u_char rate_queue_number;
      u_char avg_rate_divisor;
      u_char read_write;
      u_char aal_type;
      u_char flags;
      u_char ifunit_in;
      u_int vcte;
} atm_vcte_t;

Errors

Possible errors include:

EFAULT 

An error occurred when the driver was copying the data.

EINVAL 

The len specified in the argument is too small to contain the information being retrieved.

ENODEV 

The board was not in the up state.

ATMIOC_SETARP

The ATMIOC_SETARP ioctl() command puts one static mapping for a PVC into the IP-to-ATM address resolution table. This command is required for any VC that had the ATMPVCFL_IP flag set when the VC was created (with ATMIOC_CREATEPVC ). The VC must already have been created with the ATMIOC_CREATEPVC call.


Note: This command will not be supported in future releases of the IRIS ATM API. The portable method for managing the ATM ARP table is the atmarp utility.


Usage

Use the following format:

ioctl (fd_atm,ATMIOC_SETARP, &arp);

The file descriptor used for fd_atm is relatively unimportant (either the file descriptor from the ATMIOC_CREATEPVC or an IP socket descriptor can be used), and arp is defined as struct arpreq.

Argument Values

The pointer to an arpreq structure, is set up as explained in Table 2-14.

Table 2-14. Recommended Values for Arguments of the ATMIOC_SETARP Command

Field of arpreq_t

Recommended Value

Comments

arp_pa

AF_INET and IP address

Within sa_data field, set the protocol family to AF_INET and provide the IP address of the remote system.

arp_ha

atm_laddr_t structure

The local hardware address for the PVC. For complete details, see Table 2-3.

arp_flags

none

 


Success or Failure

If successful, ATMIOC_SETARP returns zero.

On failure, the ioctl() command returns -1 with an error stored in errno. For descriptions of individual errors, see “Errors”.

Relevant Structures

The arpreq and atm_laddr_t structures are described in “Frequently Used Structures”.

Errors

Possible errors include:

EADDRINUSE 

The address resolution table is already full. The current entry request was not added.

EAFNOSUPPORT 

One of the sa_family fields within the arpreq indicated an address family that is not supported. Only AF_UNSPEC is supported for the arp_ha information, and only AF_INET is supported for the arp_pa area.

EFAULT 

An error occurred as the driver was trying to copy the command's argument.

EINVAL 

The port indicated in the atm_laddr_t is not valid, or the vpi/ vci pair indicated in the atm_laddr_t already exists in the table, or the specified VC is not flagged for IP use.

ENODEV 

The port was not in the up or down state.