mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Remove netatm from HEAD as it is not MPSAFE and relies on the now removed
NET_NEEDS_GIANT. netatm has been disconnected from the build for ten months in HEAD/RELENG_7. Specifics: - netatm include files - netatm command line management tools - libatm - ATM parts in rescue and sysinstall - sample configuration files and documents - kernel support as a module or in NOTES - netgraph wrapper nodes for netatm - ctags data for netatm. - netatm-specific device drivers. MFC after: 3 weeks Reviewed by: bz Discussed with: bms, bz, harti
This commit is contained in:
parent
727acbb41b
commit
e4372ceba0
226 changed files with 1 additions and 111102 deletions
|
|
@ -211,17 +211,6 @@
|
|||
..
|
||||
netatalk
|
||||
..
|
||||
# Disabled in 7.0 as netatm is not MPSAFE.
|
||||
# netatm
|
||||
# ipatm
|
||||
# ..
|
||||
# sigpvc
|
||||
# ..
|
||||
# spans
|
||||
# ..
|
||||
# uni
|
||||
# ..
|
||||
# ..
|
||||
netgraph
|
||||
atm
|
||||
..
|
||||
|
|
|
|||
|
|
@ -189,9 +189,6 @@
|
|||
..
|
||||
IPv6
|
||||
..
|
||||
# Disabled in 7.0 as netatm is not MPSAFE.
|
||||
# atm
|
||||
# ..
|
||||
bc
|
||||
..
|
||||
bootforth
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ LDIRS= bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
|
|||
netipsec ${_netipx} netnatm ${_netncp} netsmb \
|
||||
nfs nfsclient nfsserver \
|
||||
pccard sys vm
|
||||
#LDIRS+= netatm
|
||||
|
||||
LSUBDIRS= cam/scsi \
|
||||
dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
|
||||
|
|
@ -57,7 +56,6 @@ LSUBDIRS= cam/scsi \
|
|||
security/mac_biba security/mac_bsdextended security/mac_lomac \
|
||||
security/mac_mls security/mac_partition \
|
||||
ufs/ffs ufs/ufs
|
||||
#LSUBDIRS+= netatm/ipatm netatm/sigpvc netatm/spans netatm/uni
|
||||
|
||||
LSUBSUBDIRS= dev/mpt/mpilib
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ _csu=csu
|
|||
.endif
|
||||
|
||||
.if ${MK_ATM} != "no"
|
||||
# Disabled in 7.0 as netatm is not MPSAFE.
|
||||
#_libatm= libatm
|
||||
_libngatm= libngatm
|
||||
.endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
# ===================================
|
||||
# HARP | Host ATM Research Platform
|
||||
# ===================================
|
||||
#
|
||||
# This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
# made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
# "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
# support of any kind.
|
||||
#
|
||||
# NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
# INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
# SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
# In no event shall NetworkCS be responsible for any damages, including
|
||||
# but not limited to consequential damages, arising from or relating to
|
||||
# any use of the Software or related support.
|
||||
#
|
||||
# Copyright 1994-1998 Network Computing Services, Inc.
|
||||
#
|
||||
# Copies of this Software may be made, however, the above copyright
|
||||
# notice must be reproduced on all copies.
|
||||
#
|
||||
# @(#) $Id: Makefile,v 1.5 1998/07/10 16:01:58 jpt Exp $
|
||||
# $FreeBSD$
|
||||
|
||||
LIB= atm
|
||||
SHLIB_MAJOR= 5
|
||||
SHLIBDIR?= /lib
|
||||
SRCS= atm_addr.c cache_key.c ioctl_subr.c ip_addr.c ip_checksum.c timer.c
|
||||
INCS= libatm.h
|
||||
|
||||
DPADD= ${LIBMD}
|
||||
LDADD= -lmd
|
||||
|
||||
.if ${MACHINE_ARCH} == "arm"
|
||||
WARNS?= 3
|
||||
.else
|
||||
WARNS?= 6
|
||||
.endif
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
|
@ -1,328 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
#if 0 /* original (broken) import id */
|
||||
static char *RCSid = "@(#) $Id: atm_addr.c,v 1.1 1998/07/09 21:45:18 johnc Exp $";
|
||||
#endif
|
||||
#endif
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* User Space Library Functions
|
||||
* ----------------------------
|
||||
*
|
||||
* ATM address utility functions
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libatm.h"
|
||||
|
||||
extern char *prog;
|
||||
|
||||
/*
|
||||
* Get NSAP, NSAP prefix or MAC address
|
||||
*
|
||||
* Arguments:
|
||||
* in pointer to an address in ASCII
|
||||
* out pointer to a buffer for the converted address
|
||||
* len the length of the output buffer
|
||||
*
|
||||
* Returns:
|
||||
* 0 error in format
|
||||
* len the length of the data in the output buffer
|
||||
*
|
||||
*/
|
||||
int
|
||||
get_hex_atm_addr(const char *in, u_char *out, int len)
|
||||
{
|
||||
int c_type, c_value, i, out_len, state, val = 0;
|
||||
|
||||
/*
|
||||
* Character table
|
||||
*/
|
||||
static struct {
|
||||
char c;
|
||||
int type;
|
||||
int value;
|
||||
} char_table[] = {
|
||||
{'.', 0, 0}, /* Type 0 -- period */
|
||||
{':', 0, 0}, /* Type 0 -- colon */
|
||||
{'0', 1, 0}, /* Type 1 -- hex digit */
|
||||
{'1', 1, 1},
|
||||
{'2', 1, 2},
|
||||
{'3', 1, 3},
|
||||
{'4', 1, 4},
|
||||
{'5', 1, 5},
|
||||
{'6', 1, 6},
|
||||
{'7', 1, 7},
|
||||
{'8', 1, 8},
|
||||
{'9', 1, 9},
|
||||
{'a', 1, 10},
|
||||
{'b', 1, 11},
|
||||
{'c', 1, 12},
|
||||
{'d', 1, 13},
|
||||
{'e', 1, 14},
|
||||
{'f', 1, 15},
|
||||
{'A', 1, 10},
|
||||
{'B', 1, 11},
|
||||
{'C', 1, 12},
|
||||
{'D', 1, 13},
|
||||
{'E', 1, 14},
|
||||
{'F', 1, 15},
|
||||
{'\0', 2, 0}, /* Type 2 -- end of input */
|
||||
};
|
||||
|
||||
/*
|
||||
* State table
|
||||
*/
|
||||
static struct {
|
||||
int action;
|
||||
int state;
|
||||
} state_table[3][3] = {
|
||||
/* Period Hex End */
|
||||
{ { 0, 0 }, { 1, 1 }, { 2, 0} }, /* Init */
|
||||
{ { 4, 0 }, { 3, 2 }, { 4, 0} }, /* C1 */
|
||||
{ { 0, 2 }, { 1, 1 }, { 2, 0} }, /* C2 */
|
||||
};
|
||||
|
||||
/*
|
||||
* Initialize
|
||||
*/
|
||||
state = 0;
|
||||
out_len = 0;
|
||||
if (!strncasecmp(in, "0x", 2)) {
|
||||
in += 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop through input until state table says to return
|
||||
*/
|
||||
while (1) {
|
||||
/*
|
||||
* Get the character type and value
|
||||
*/
|
||||
for (i=0; char_table[i].c; i++)
|
||||
if (char_table[i].c == *in)
|
||||
break;
|
||||
if (char_table[i].c != *in)
|
||||
return(0);
|
||||
c_type = char_table[i].type;
|
||||
c_value = char_table[i].value;
|
||||
|
||||
/*
|
||||
* Process next character based on state and type
|
||||
*/
|
||||
switch(state_table[state][c_type].action) {
|
||||
case 0:
|
||||
/*
|
||||
* Ignore the character
|
||||
*/
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/*
|
||||
* Save the character's value
|
||||
*/
|
||||
val = c_value;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/*
|
||||
* Return the assembled NSAP
|
||||
*/
|
||||
return(out_len);
|
||||
|
||||
case 3:
|
||||
/*
|
||||
* Assemble and save the output byte
|
||||
*/
|
||||
val = val << 4;
|
||||
val += c_value;
|
||||
out[out_len] = (u_char) val;
|
||||
out_len++;
|
||||
if (out_len > len)
|
||||
(void)fprintf(stderr, "%s() out_len > len (%d > %d)\n",
|
||||
__func__, out_len, len);
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
/*
|
||||
* Invalid input sequence
|
||||
*/
|
||||
return(0);
|
||||
|
||||
default:
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the next state and go on to the next character
|
||||
*/
|
||||
state = state_table[state][c_type].state;
|
||||
in++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Format an ATM address into a string
|
||||
*
|
||||
* Arguments:
|
||||
* addr pointer to an atm address
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
char *
|
||||
format_atm_addr(const Atm_addr *addr)
|
||||
{
|
||||
int i;
|
||||
const char *nsap_format;
|
||||
const Atm_addr_nsap *atm_nsap;
|
||||
const Atm_addr_e164 *atm_e164;
|
||||
const Atm_addr_spans *atm_spans;
|
||||
const Atm_addr_pvc *atm_pvc;
|
||||
static char str[256];
|
||||
union {
|
||||
int w;
|
||||
char c[4];
|
||||
} u1, u2;
|
||||
|
||||
static const char nsap_format_DCC[] = "0x%02x.%02x%02x.%02x.%02x%02x%02x.%02x%02x.%02x%02x.%02x%02x.%02x%02x%02x%02x%02x%02x.%02x";
|
||||
static const char nsap_format_ICD[] = "0x%02x.%02x%02x.%02x.%02x%02x%02x.%02x%02x.%02x%02x.%02x%02x.%02x%02x%02x%02x%02x%02x.%02x";
|
||||
static const char nsap_format_E164[] = "0x%02x.%02x%02x%02x%02x%02x%02x%02x%02x.%02x%02x.%02x%02x.%02x%02x%02x%02x%02x%02x.%02x";
|
||||
|
||||
/*
|
||||
* Clear the returned string
|
||||
*/
|
||||
bzero(str, sizeof(str));
|
||||
strcpy(str, "-");
|
||||
|
||||
/*
|
||||
* Print format is determined by address type
|
||||
*/
|
||||
switch (addr->address_format) {
|
||||
case T_ATM_ENDSYS_ADDR:
|
||||
atm_nsap = (const Atm_addr_nsap *)addr->address;
|
||||
switch(atm_nsap->aan_afi) {
|
||||
default:
|
||||
case AFI_DCC:
|
||||
nsap_format = nsap_format_DCC;
|
||||
break;
|
||||
case AFI_ICD:
|
||||
nsap_format = nsap_format_ICD;
|
||||
break;
|
||||
case AFI_E164:
|
||||
nsap_format = nsap_format_E164;
|
||||
break;
|
||||
}
|
||||
sprintf(str, nsap_format,
|
||||
atm_nsap->aan_afi,
|
||||
atm_nsap->aan_afspec[0],
|
||||
atm_nsap->aan_afspec[1],
|
||||
atm_nsap->aan_afspec[2],
|
||||
atm_nsap->aan_afspec[3],
|
||||
atm_nsap->aan_afspec[4],
|
||||
atm_nsap->aan_afspec[5],
|
||||
atm_nsap->aan_afspec[6],
|
||||
atm_nsap->aan_afspec[7],
|
||||
atm_nsap->aan_afspec[8],
|
||||
atm_nsap->aan_afspec[9],
|
||||
atm_nsap->aan_afspec[10],
|
||||
atm_nsap->aan_afspec[11],
|
||||
atm_nsap->aan_esi[0],
|
||||
atm_nsap->aan_esi[1],
|
||||
atm_nsap->aan_esi[2],
|
||||
atm_nsap->aan_esi[3],
|
||||
atm_nsap->aan_esi[4],
|
||||
atm_nsap->aan_esi[5],
|
||||
atm_nsap->aan_sel);
|
||||
break;
|
||||
|
||||
case T_ATM_E164_ADDR:
|
||||
atm_e164 = (const Atm_addr_e164 *)addr->address;
|
||||
for(i=0; i<addr->address_length; i++) {
|
||||
sprintf(&str[strlen(str)], "%c",
|
||||
atm_e164->aae_addr[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case T_ATM_SPANS_ADDR:
|
||||
/*
|
||||
* Print SPANS address as two words, xxxx.yyyy
|
||||
*/
|
||||
atm_spans = (const Atm_addr_spans *)addr->address;
|
||||
u1.c[0] = atm_spans->aas_addr[0];
|
||||
u1.c[1] = atm_spans->aas_addr[1];
|
||||
u1.c[2] = atm_spans->aas_addr[2];
|
||||
u1.c[3] = atm_spans->aas_addr[3];
|
||||
|
||||
u2.c[0] = atm_spans->aas_addr[4];
|
||||
u2.c[1] = atm_spans->aas_addr[5];
|
||||
u2.c[2] = atm_spans->aas_addr[6];
|
||||
u2.c[3] = atm_spans->aas_addr[7];
|
||||
|
||||
if (!(u1.w == 0 && u2.w == 0))
|
||||
sprintf(str, "0x%08lx.%08lx",
|
||||
(u_long)ntohl(u1.w), (u_long)ntohl(u2.w));
|
||||
break;
|
||||
|
||||
case T_ATM_PVC_ADDR:
|
||||
/*
|
||||
* Print PVC as VPI, VCI
|
||||
*/
|
||||
atm_pvc = (const Atm_addr_pvc *)addr->address;
|
||||
sprintf(str, "%d, %d",
|
||||
ATM_PVC_GET_VPI(atm_pvc),
|
||||
ATM_PVC_GET_VCI(atm_pvc));
|
||||
break;
|
||||
|
||||
case T_ATM_ABSENT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return(str);
|
||||
}
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* User Space Library Functions
|
||||
* ----------------------------
|
||||
*
|
||||
* SCSP cache key computation
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
|
||||
#include <md5.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libatm.h"
|
||||
|
||||
/*
|
||||
* Compute an SCSP cache key
|
||||
*
|
||||
* Arguments:
|
||||
* ap pointer to an Atm_addr with the ATM address
|
||||
* ip pointer to a struct in_addr with the IP address
|
||||
* ol the required length of the cache key
|
||||
* op pointer to receive cache key
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
scsp_cache_key(const Atm_addr *ap, const struct in_addr *ip, int ol, char *op)
|
||||
{
|
||||
int i, len;
|
||||
char buff[32];
|
||||
unsigned char digest[16];
|
||||
MD5_CTX context;
|
||||
|
||||
/*
|
||||
* Initialize
|
||||
*/
|
||||
bzero(buff, sizeof(buff));
|
||||
|
||||
/*
|
||||
* Copy the addresses into a buffer for MD5 computation
|
||||
*/
|
||||
len = sizeof(struct in_addr) + ap->address_length;
|
||||
if (len > (int)sizeof(buff))
|
||||
len = sizeof(buff);
|
||||
bcopy(ip, buff, sizeof(struct in_addr));
|
||||
bcopy(ap->address, &buff[sizeof(struct in_addr)],
|
||||
len - sizeof(struct in_addr));
|
||||
|
||||
/*
|
||||
* Compute the MD5 digest of the combined IP and ATM addresses
|
||||
*/
|
||||
MD5Init(&context);
|
||||
MD5Update(&context, buff, len);
|
||||
MD5Final(digest, &context);
|
||||
|
||||
/*
|
||||
* Fold the 16-byte digest to the required length
|
||||
*/
|
||||
bzero((caddr_t)op, ol);
|
||||
for (i = 0; i < 16; i++) {
|
||||
op[i % ol] = op[i % ol] ^ digest[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,461 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* User Space Library Functions
|
||||
* ----------------------------
|
||||
*
|
||||
* IOCTL subroutines
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "libatm.h"
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
extern char *prog;
|
||||
|
||||
|
||||
/*
|
||||
* Issue an informational IOCTL
|
||||
*
|
||||
* The user fills out the opcode and any subtype information. This
|
||||
* routine will allocate a buffer and issue the IOCTL. If the request
|
||||
* fails because the buffer wasn't big enough, this routine will double
|
||||
* the buffer size and retry the request repeatedly. The buffer must
|
||||
* be freed by the caller.
|
||||
*
|
||||
* Arguments:
|
||||
* req pointer to an ATM information request IOCTL structure
|
||||
* buf_len length of buffer to be allocated
|
||||
*
|
||||
* Returns:
|
||||
* -1 error encountered (reason in errno)
|
||||
* int length of the returned VCC information
|
||||
*
|
||||
*/
|
||||
ssize_t
|
||||
do_info_ioctl(struct atminfreq *req, size_t buf_len)
|
||||
{
|
||||
int rc, s;
|
||||
caddr_t buf;
|
||||
|
||||
/*
|
||||
* Open a socket for the IOCTL
|
||||
*/
|
||||
s = socket(AF_ATM, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get memory for returned information
|
||||
*/
|
||||
mem_retry:
|
||||
buf = malloc(buf_len);
|
||||
if (buf == NULL) {
|
||||
errno = ENOMEM;
|
||||
return(-1);
|
||||
}
|
||||
bzero(buf, buf_len);
|
||||
|
||||
/*
|
||||
* Set the buffer address and length in the request
|
||||
*/
|
||||
req->air_buf_addr = buf;
|
||||
req->air_buf_len = buf_len;
|
||||
|
||||
/*
|
||||
* Issue the IOCTL
|
||||
*/
|
||||
rc = ioctl(s, AIOCINFO, (caddr_t)req);
|
||||
if (rc) {
|
||||
free(buf);
|
||||
if (errno == ENOSPC) {
|
||||
buf_len = buf_len * 2;
|
||||
goto mem_retry;
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
(void)close(s);
|
||||
/*
|
||||
* Set a pointer to the returned info in the request
|
||||
* and return its length
|
||||
*/
|
||||
req->air_buf_addr = buf;
|
||||
return(req->air_buf_len);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get VCC information
|
||||
*
|
||||
* Arguments:
|
||||
* intf pointer to interface name (or null string)
|
||||
* vccp pointer to a pointer to a struct air_vcc_rsp for the
|
||||
* address of the returned VCC information
|
||||
*
|
||||
* Returns:
|
||||
* int length of the retuned VCC information
|
||||
*
|
||||
*/
|
||||
ssize_t
|
||||
get_vcc_info(const char *intf, struct air_vcc_rsp **vccp)
|
||||
{
|
||||
size_t buf_len = sizeof(struct air_vcc_rsp) * 100;
|
||||
struct atminfreq air;
|
||||
|
||||
/*
|
||||
* Initialize IOCTL request
|
||||
*/
|
||||
air.air_opcode = AIOCS_INF_VCC;
|
||||
bzero(air.air_vcc_intf, sizeof(air.air_vcc_intf));
|
||||
if (intf != NULL && strlen(intf) != 0)
|
||||
strncpy(air.air_vcc_intf, intf, IFNAMSIZ - 1);
|
||||
|
||||
buf_len = do_info_ioctl(&air, buf_len);
|
||||
|
||||
/*
|
||||
* Return a pointer to the VCC info and its length
|
||||
*/
|
||||
*vccp = (struct air_vcc_rsp *)(void *)air.air_buf_addr;
|
||||
return(buf_len);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get subnet mask
|
||||
*
|
||||
* Arguments:
|
||||
* intf pointer to an interface name
|
||||
* mask pointer to a struct sockaddr_in to receive the mask
|
||||
*
|
||||
* Returns:
|
||||
* 0 good completion
|
||||
* -1 error
|
||||
*
|
||||
*/
|
||||
int
|
||||
get_subnet_mask(const char *intf, struct sockaddr_in *mask)
|
||||
{
|
||||
int rc, s;
|
||||
struct ifreq req;
|
||||
struct sockaddr_in *ip_mask;
|
||||
|
||||
/*
|
||||
* Check parameters
|
||||
*/
|
||||
if (!intf || !mask ||
|
||||
strlen(intf) == 0 ||
|
||||
strlen(intf) > IFNAMSIZ-1)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* Open a socket for the IOCTL
|
||||
*/
|
||||
s = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (s < 0)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* Set up and issue the IOCTL
|
||||
*/
|
||||
bzero(&req, sizeof(req));
|
||||
strcpy(req.ifr_name, intf);
|
||||
rc = ioctl(s, SIOCGIFNETMASK, (caddr_t)&req);
|
||||
(void)close(s);
|
||||
if (rc)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* Give the answer back to the caller
|
||||
*/
|
||||
ip_mask = (struct sockaddr_in *)(void *)&req.ifr_addr;
|
||||
*mask = *ip_mask;
|
||||
mask->sin_family = AF_INET;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get an interface's MTU
|
||||
*
|
||||
* Arguments:
|
||||
* intf pointer to an interface name
|
||||
* mtu pointer to an int to receive the MTU
|
||||
*
|
||||
* Returns:
|
||||
* >= 0 interface MTU
|
||||
* -1 error
|
||||
*
|
||||
*/
|
||||
int
|
||||
get_mtu(const char *intf)
|
||||
{
|
||||
int rc, s;
|
||||
struct ifreq req;
|
||||
|
||||
/*
|
||||
* Check parameters
|
||||
*/
|
||||
if (!intf || strlen(intf) == 0 ||
|
||||
strlen(intf) > IFNAMSIZ-1)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* Open a socket for the IOCTL
|
||||
*/
|
||||
s = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (s < 0)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* Set up and issue the IOCTL
|
||||
*/
|
||||
bzero(&req, sizeof(req));
|
||||
strcpy(req.ifr_name, intf);
|
||||
rc = ioctl(s, SIOCGIFMTU, (caddr_t)&req);
|
||||
(void)close(s);
|
||||
|
||||
/*
|
||||
* Set the appropriate return value
|
||||
*/
|
||||
if (rc)
|
||||
return(-1);
|
||||
else
|
||||
return(req.ifr_mtu);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Verify netif name
|
||||
*
|
||||
* This routine issues an IOCTL to check whether the passed string is
|
||||
* a valid network interface name.
|
||||
*
|
||||
* Arguments:
|
||||
* req pointer to an ATM information request IOCTL structure
|
||||
*
|
||||
* Returns:
|
||||
* -1 error encountered
|
||||
* FALSE (0) the string is not a NIF name
|
||||
* TRUE (> 0) the string is a valid NIF name
|
||||
*
|
||||
*/
|
||||
int
|
||||
verify_nif_name(const char *name)
|
||||
{
|
||||
int rc, s;
|
||||
struct atminfreq air;
|
||||
struct air_netif_rsp *nif_info;
|
||||
|
||||
/*
|
||||
* Check whether name is of a valid length
|
||||
*/
|
||||
if (strlen(name) > IFNAMSIZ - 1 ||
|
||||
strlen(name) < 1) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a socket for the IOCTL
|
||||
*/
|
||||
s = socket(AF_ATM, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get memory for returned information
|
||||
*/
|
||||
nif_info = malloc(sizeof(struct air_netif_rsp));
|
||||
if (nif_info == NULL) {
|
||||
errno = ENOMEM;
|
||||
return(-1);
|
||||
}
|
||||
bzero(nif_info, sizeof(struct air_netif_rsp));
|
||||
|
||||
/*
|
||||
* Set up the request
|
||||
*/
|
||||
air.air_opcode = AIOCS_INF_NIF;
|
||||
air.air_buf_addr = (caddr_t)nif_info;
|
||||
air.air_buf_len = sizeof(struct air_netif_rsp);
|
||||
bzero(air.air_netif_intf, sizeof(air.air_netif_intf));
|
||||
strcpy(air.air_netif_intf, name);
|
||||
|
||||
/*
|
||||
* Issue the IOCTL
|
||||
*/
|
||||
rc = ioctl(s, AIOCINFO, (caddr_t)&air);
|
||||
free(nif_info);
|
||||
(void)close(s);
|
||||
|
||||
/*
|
||||
* Base return value on IOCTL return code
|
||||
*/
|
||||
if (rc)
|
||||
return(FALSE);
|
||||
else
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get Config information
|
||||
*
|
||||
* Arguments:
|
||||
* intf pointer to interface name (or null string)
|
||||
* cfgp pointer to a pointer to a struct air_cfg_rsp for the
|
||||
* address of the returned Config information
|
||||
*
|
||||
* Returns:
|
||||
* int length of returned Config information
|
||||
*
|
||||
*/
|
||||
ssize_t
|
||||
get_cfg_info(const char *intf, struct air_cfg_rsp **cfgp)
|
||||
{
|
||||
size_t buf_len = sizeof(struct air_cfg_rsp) * 4;
|
||||
struct atminfreq air;
|
||||
|
||||
/*
|
||||
* Initialize IOCTL request
|
||||
*/
|
||||
air.air_opcode = AIOCS_INF_CFG;
|
||||
bzero ( air.air_cfg_intf, sizeof(air.air_cfg_intf));
|
||||
if ( intf != NULL && strlen(intf) != 0 )
|
||||
strncpy(air.air_cfg_intf, intf, IFNAMSIZ - 1);
|
||||
|
||||
buf_len = do_info_ioctl ( &air, buf_len );
|
||||
|
||||
/*
|
||||
* Return a pointer to the Config info and its length
|
||||
*/
|
||||
*cfgp = (struct air_cfg_rsp *)(void *)air.air_buf_addr;
|
||||
return ( buf_len );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Get Physical Interface information
|
||||
*
|
||||
* Arguments:
|
||||
* intf pointer to interface name (or null string)
|
||||
* intp pointer to a pointer to a struct air_cfg_rsp for the
|
||||
* address of the returned Config information
|
||||
*
|
||||
* Returns:
|
||||
* int length of returned Config information
|
||||
*
|
||||
*/
|
||||
ssize_t
|
||||
get_intf_info(const char *intf, struct air_int_rsp **intp)
|
||||
{
|
||||
size_t buf_len = sizeof(struct air_int_rsp) * 4;
|
||||
struct atminfreq air;
|
||||
|
||||
/*
|
||||
* Initialize IOCTL request
|
||||
*/
|
||||
air.air_opcode = AIOCS_INF_INT;
|
||||
bzero ( air.air_int_intf, sizeof(air.air_int_intf));
|
||||
if ( intf != NULL && strlen(intf) != 0 )
|
||||
strncpy(air.air_int_intf, intf, IFNAMSIZ - 1);
|
||||
|
||||
buf_len = do_info_ioctl ( &air, buf_len );
|
||||
|
||||
/*
|
||||
* Return a pointer to the Physical Interface info and its length
|
||||
*/
|
||||
*intp = (struct air_int_rsp *)(void *)air.air_buf_addr;
|
||||
return ( buf_len );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get Netif information
|
||||
*
|
||||
* Arguments:
|
||||
* intf pointer to interface name (or null string)
|
||||
* netp pointer to a pointer to a struct air_netif_rsp for the
|
||||
* address of the returned Netif information
|
||||
*
|
||||
* Returns:
|
||||
* int length of returned Netif information
|
||||
*
|
||||
*/
|
||||
ssize_t
|
||||
get_netif_info(const char *intf, struct air_netif_rsp **netp)
|
||||
{
|
||||
size_t buf_len = sizeof(struct air_netif_rsp) * 10;
|
||||
struct atminfreq air;
|
||||
|
||||
/*
|
||||
* Initialize IOCTL request
|
||||
*/
|
||||
air.air_opcode = AIOCS_INF_NIF;
|
||||
bzero ( air.air_int_intf, sizeof(air.air_int_intf) );
|
||||
if ( intf != NULL && strlen(intf) != 0 )
|
||||
strncpy(air.air_int_intf, intf, IFNAMSIZ - 1);
|
||||
|
||||
buf_len = do_info_ioctl ( &air, buf_len );
|
||||
|
||||
/*
|
||||
* Return a pointer to the Netif info and its length
|
||||
*/
|
||||
*netp = (struct air_netif_rsp *) air.air_buf_addr;
|
||||
return ( buf_len );
|
||||
|
||||
}
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* User Space Library Functions
|
||||
* ----------------------------
|
||||
*
|
||||
* IP address utilities
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <stdio.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libatm.h"
|
||||
|
||||
/*
|
||||
* Get IP address
|
||||
*
|
||||
* Return an IP address in a socket address structure, given a character
|
||||
* string with a domain name or a dotted decimal number.
|
||||
*
|
||||
* Arguments:
|
||||
* p pointer to a host name or IP address
|
||||
*
|
||||
* Returns:
|
||||
* null error was encountered
|
||||
* struct sockaddr_in * a pointer to a socket address with the
|
||||
* requested IP address
|
||||
*
|
||||
*/
|
||||
struct sockaddr_in *
|
||||
get_ip_addr(const char *p)
|
||||
{
|
||||
struct hostent *ip_host;
|
||||
static struct sockaddr_in s;
|
||||
|
||||
/*
|
||||
* Get IP address of specified host name
|
||||
*/
|
||||
bzero(&s, sizeof(s));
|
||||
s.sin_family = AF_INET;
|
||||
if (p[0] >= '0' && p[0] <= '9') {
|
||||
/*
|
||||
* IP address is in dotted decimal format
|
||||
*/
|
||||
if ((s.sin_addr.s_addr = inet_addr(p)) == INADDR_NONE) {
|
||||
return((struct sockaddr_in *)0);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Host name is in domain name system format
|
||||
*/
|
||||
ip_host = gethostbyname(p);
|
||||
if (!ip_host ||
|
||||
ip_host->h_addrtype != AF_INET) {
|
||||
return((struct sockaddr_in *)0);
|
||||
}
|
||||
memcpy(&s.sin_addr.s_addr, ip_host->h_addr_list[0],
|
||||
sizeof(s.sin_addr.s_addr));
|
||||
}
|
||||
return(&s);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Format an IP address
|
||||
*
|
||||
* Return a text-formatted string with an IP address and domain name
|
||||
* given a sockaddr_in with an IP address.
|
||||
*
|
||||
* Arguments:
|
||||
* addr pointer to sockaddr_in with an IP address
|
||||
*
|
||||
* Returns:
|
||||
* char * pointer to a text-formatted string
|
||||
*
|
||||
*/
|
||||
const char *
|
||||
format_ip_addr(const struct in_addr *addr)
|
||||
{
|
||||
static char host_name[MAXHOSTNAMELEN + 18];
|
||||
char *ip_num;
|
||||
struct hostent *ip_host;
|
||||
|
||||
/*
|
||||
* Initialize
|
||||
*/
|
||||
bzero(host_name, sizeof(host_name));
|
||||
|
||||
/*
|
||||
* Check for a zero address
|
||||
*/
|
||||
if (!addr || addr->s_addr == 0) {
|
||||
return("-");
|
||||
}
|
||||
|
||||
/*
|
||||
* Get address in dotted decimal format
|
||||
*/
|
||||
ip_num = inet_ntoa(*addr);
|
||||
|
||||
/*
|
||||
* Look up name in DNS
|
||||
*/
|
||||
ip_host = gethostbyaddr((const char *)addr, sizeof(addr), AF_INET);
|
||||
if (ip_host && ip_host->h_name && strlen(ip_host->h_name)) {
|
||||
/*
|
||||
* Return host name followed by dotted decimal address
|
||||
*/
|
||||
snprintf(host_name, sizeof(host_name), "%s (%s)",
|
||||
ip_host->h_name, ip_num);
|
||||
return (host_name);
|
||||
} else {
|
||||
/*
|
||||
* No host name -- just return dotted decimal address
|
||||
*/
|
||||
return(ip_num);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* User Space Library Functions
|
||||
* ----------------------------
|
||||
*
|
||||
* IP checksum computation
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
|
||||
#include "libatm.h"
|
||||
|
||||
/*
|
||||
* Compute an IP checksum
|
||||
*
|
||||
* This code was taken from RFC 1071.
|
||||
*
|
||||
* "The following "C" code algorithm computes the checksum with an inner
|
||||
* loop that sums 16 bits at a time in a 32-bit accumulator."
|
||||
*
|
||||
* Arguments:
|
||||
* addr pointer to the buffer whose checksum is to be computed
|
||||
* count number of bytes to include in the checksum
|
||||
*
|
||||
* Returns:
|
||||
* the computed checksum
|
||||
*
|
||||
*/
|
||||
short
|
||||
ip_checksum(const char *addr, int count)
|
||||
{
|
||||
/* Compute Internet Checksum for "count" bytes
|
||||
* beginning at location "addr".
|
||||
*/
|
||||
long sum = 0;
|
||||
|
||||
while( count > 1 ) {
|
||||
/* This is the inner loop */
|
||||
sum += ntohs(* (const unsigned short *)(const void *)addr);
|
||||
addr += sizeof(unsigned short);
|
||||
count -= sizeof(unsigned short);
|
||||
}
|
||||
|
||||
/* Add left-over byte, if any */
|
||||
if( count > 0 )
|
||||
sum += * (const unsigned char *) addr;
|
||||
|
||||
/* Fold 32-bit sum to 16 bits */
|
||||
while (sum>>16)
|
||||
sum = (sum & 0xffff) + (sum >> 16);
|
||||
|
||||
return((short)~sum);
|
||||
}
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* User Space Library Functions
|
||||
* ----------------------------
|
||||
*
|
||||
* Library functions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _HARP_LIBHARP_H
|
||||
#define _HARP_LIBHARP_H
|
||||
|
||||
/*
|
||||
* Start a HARP user-space timer
|
||||
*
|
||||
* tp pointer to timer control block
|
||||
* time number of seconds for timer to run
|
||||
* fp pointer to function to call at expiration
|
||||
*/
|
||||
#define HARP_TIMER(tp, time, fp) \
|
||||
{ \
|
||||
(tp)->ht_ticks = (time); \
|
||||
(tp)->ht_mark = 0; \
|
||||
(tp)->ht_func = (fp); \
|
||||
LINK2HEAD((tp), Harp_timer, harp_timer_head, ht_next); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Cancel a HARP user-space timer
|
||||
*
|
||||
* tp pointer to timer control block
|
||||
*/
|
||||
#define HARP_CANCEL(tp) \
|
||||
{ \
|
||||
UNLINK((tp), Harp_timer, harp_timer_head, ht_next); \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* HARP user-space timer control block
|
||||
*/
|
||||
struct harp_timer {
|
||||
struct harp_timer *ht_next; /* Timer chain */
|
||||
int ht_ticks; /* Seconds till exp */
|
||||
int ht_mark; /* Processing flag */
|
||||
void (*ht_func)(struct harp_timer *); /* Function to call */
|
||||
};
|
||||
typedef struct harp_timer Harp_timer;
|
||||
|
||||
|
||||
/*
|
||||
* Externally-visible variables and functions
|
||||
*/
|
||||
|
||||
/* atm_addr.c */
|
||||
extern int get_hex_atm_addr(const char *, u_char *, int);
|
||||
extern char *format_atm_addr(const Atm_addr *);
|
||||
|
||||
/* cache_key.c */
|
||||
extern void scsp_cache_key(const Atm_addr *,
|
||||
const struct in_addr *, int, char *);
|
||||
|
||||
/* ioctl_subr.c */
|
||||
extern ssize_t do_info_ioctl(struct atminfreq *, size_t);
|
||||
extern ssize_t get_vcc_info(const char *, struct air_vcc_rsp **);
|
||||
extern int get_subnet_mask(const char *, struct sockaddr_in *);
|
||||
extern int get_mtu(const char *);
|
||||
extern int verify_nif_name(const char *);
|
||||
extern ssize_t get_cfg_info(const char *, struct air_cfg_rsp **);
|
||||
extern ssize_t get_intf_info(const char *, struct air_int_rsp **);
|
||||
extern ssize_t get_netif_info(const char *, struct air_netif_rsp **);
|
||||
|
||||
/* ip_addr.c */
|
||||
extern struct sockaddr_in *get_ip_addr(const char *);
|
||||
extern const char *format_ip_addr(const struct in_addr *);
|
||||
|
||||
/* ip_checksum.c */
|
||||
extern short ip_checksum(const char *, int);
|
||||
|
||||
/* timer.c */
|
||||
extern Harp_timer *harp_timer_head;
|
||||
extern int harp_timer_exec;
|
||||
extern void timer_proc(void);
|
||||
extern int init_timer(void);
|
||||
extern int block_timer(void);
|
||||
extern void enable_timer(int);
|
||||
|
||||
|
||||
#endif /* _HARP_LIBHARP_H */
|
||||
|
|
@ -1,258 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* User Space Library Functions
|
||||
* ----------------------------
|
||||
*
|
||||
* Timer functions
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "libatm.h"
|
||||
|
||||
Harp_timer *harp_timer_head;
|
||||
int harp_timer_exec;
|
||||
|
||||
|
||||
/*
|
||||
* Process a HARP timer tick
|
||||
*
|
||||
* This function is called via the SIGALRM signal. It increments
|
||||
* harp_timer_exec. The user should check this flag frequently and
|
||||
* call timer_proc when it is set.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
*
|
||||
*/
|
||||
static void
|
||||
timer_tick(void)
|
||||
{
|
||||
/*
|
||||
* Bump the timer flag
|
||||
*/
|
||||
harp_timer_exec++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process HARP timers
|
||||
*
|
||||
* This function is called after a SIGALRM signal is posted. It runs
|
||||
* down the list of timer entries, calling the specified functions
|
||||
* for any timers that have expired.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
*
|
||||
*/
|
||||
void
|
||||
timer_proc(void)
|
||||
{
|
||||
Harp_timer *htp;
|
||||
void (*f)(Harp_timer *);
|
||||
|
||||
/*
|
||||
* Reset marks in all timers on the queue
|
||||
*/
|
||||
for (htp = harp_timer_head; htp; htp = htp->ht_next) {
|
||||
htp->ht_mark = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Run through timer chain decrementing each timer.
|
||||
* If an expired timer is found, take the timer block
|
||||
* off the chain and call the specified function. A
|
||||
* timer's action can result in other timers being
|
||||
* cancelled (taken off the queue), so every time we
|
||||
* call a user function, we start over from the top of
|
||||
* the list.
|
||||
*/
|
||||
timer_cont:
|
||||
for (htp = harp_timer_head; htp; htp = htp->ht_next) {
|
||||
/*
|
||||
* Make sure we only process each entry once and
|
||||
* don't process entries that are put on the queue
|
||||
* by user functions we call for this tick
|
||||
*/
|
||||
if (htp->ht_mark == -1) {
|
||||
/*
|
||||
* Decrement the timer and mark that we've
|
||||
* processed the entry
|
||||
*/
|
||||
htp->ht_ticks -= harp_timer_exec;
|
||||
htp->ht_mark = 1;
|
||||
|
||||
/*
|
||||
* Check whether the timer is expired
|
||||
*/
|
||||
if (htp->ht_ticks <= 0) {
|
||||
/*
|
||||
* Unlink the timer block and call
|
||||
* the user function
|
||||
*/
|
||||
f = htp->ht_func;
|
||||
UNLINK(htp, Harp_timer, harp_timer_head,
|
||||
ht_next);
|
||||
f(htp);
|
||||
|
||||
/*
|
||||
* Start over
|
||||
*/
|
||||
goto timer_cont;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the timer exec flag
|
||||
*/
|
||||
harp_timer_exec = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Start the timer
|
||||
*
|
||||
* Set up the SIGALRM signal handler and set up the real-time
|
||||
* timer to tick once per second.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Returns:
|
||||
* 0 success
|
||||
* errno reason for failure
|
||||
*
|
||||
*/
|
||||
int
|
||||
init_timer()
|
||||
{
|
||||
int rc = 0;
|
||||
struct itimerval timeval;
|
||||
|
||||
/*
|
||||
* Clear the timer flag
|
||||
*/
|
||||
harp_timer_exec = 0;
|
||||
|
||||
/*
|
||||
* Set up signal handler
|
||||
*/
|
||||
if (signal(SIGALRM, (sig_t)timer_tick) == SIG_ERR) {
|
||||
return(errno);
|
||||
}
|
||||
|
||||
/*
|
||||
* Start timer
|
||||
*/
|
||||
timeval.it_value.tv_sec = 1;
|
||||
timeval.it_value.tv_usec = 0;
|
||||
timeval.it_interval.tv_sec = 1;
|
||||
timeval.it_interval.tv_usec = 0;
|
||||
|
||||
if (setitimer(ITIMER_REAL, &timeval,
|
||||
(struct itimerval *)0) == -1) {
|
||||
rc = errno;
|
||||
(void)signal(SIGALRM, SIG_DFL);
|
||||
}
|
||||
|
||||
return(rc);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Block timers from firing
|
||||
*
|
||||
* Block the SIGALRM signal.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Returns:
|
||||
* mask the previous blocked signal mask
|
||||
*
|
||||
*/
|
||||
int
|
||||
block_timer()
|
||||
{
|
||||
/*
|
||||
* Block the SIGALRM signal
|
||||
*/
|
||||
return(sigblock(sigmask(SIGALRM)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Re-enable timers
|
||||
*
|
||||
* Restore the signal mask (presumably one that was returned by
|
||||
* block_timer).
|
||||
*
|
||||
* Arguments:
|
||||
* mask the signal mask to be restored
|
||||
*
|
||||
* Returns:
|
||||
* mask the previous blocked signal mask
|
||||
*
|
||||
*/
|
||||
void
|
||||
enable_timer(mask)
|
||||
int mask;
|
||||
{
|
||||
/*
|
||||
* Set the signal mask
|
||||
*/
|
||||
sigsetmask(mask);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -124,9 +124,6 @@ CRUNCH_PROGS_sbin= atacontrol badsect \
|
|||
|
||||
.if ${MK_ATM} != "no"
|
||||
CRUNCH_PROGS_sbin+= atmconfig
|
||||
# Disabled in 7.0 as netatm is not MPSAFE.
|
||||
#CRUNCH_PROGS_sbin+= atm fore_dnld ilmid
|
||||
#CRUNCH_LIBS+= -latm
|
||||
.endif
|
||||
|
||||
.if ${MK_INET6_SUPPORT} != "no"
|
||||
|
|
|
|||
|
|
@ -25,9 +25,4 @@
|
|||
|
||||
SUBDIR= atmconfig
|
||||
|
||||
# Disabled in 7.0 as netatm is not MPSAFE.
|
||||
# atm \
|
||||
# fore_dnld \
|
||||
# ilmid
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
# ===================================
|
||||
# HARP | Host ATM Research Platform
|
||||
# ===================================
|
||||
#
|
||||
# This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
# made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
# "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
# support of any kind.
|
||||
#
|
||||
# NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
# INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
# SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
# In no event shall NetworkCS be responsible for any damages, including
|
||||
# but not limited to consequential damages, arising from or relating to
|
||||
# any use of the Software or related support.
|
||||
#
|
||||
# Copyright 1994-1998 Network Computing Services, Inc.
|
||||
#
|
||||
# Copies of this Software may be made, however, the above copyright
|
||||
# notice must be reproduced on all copies.
|
||||
#
|
||||
# @(#) $Id: Makefile,v 1.5 1998/07/10 16:01:58 jpt Exp $
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= atm
|
||||
SRCS= atm.c atm_fore200.c atm_inet.c atm_print.c \
|
||||
atm_set.c atm_show.c atm_subr.c
|
||||
MAN= atm.8
|
||||
|
||||
.if ${MACHINE_ARCH} == "arm"
|
||||
WARNS?= 3
|
||||
.else
|
||||
WARNS?= 6
|
||||
.endif
|
||||
|
||||
CFLAGS+= -I${.CURDIR}/../../../sys
|
||||
|
||||
DPADD= ${LIBATM}
|
||||
LDADD= -latm
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
@ -1,993 +0,0 @@
|
|||
.\"
|
||||
.\" ===================================
|
||||
.\" HARP | Host ATM Research Platform
|
||||
.\" ===================================
|
||||
.\"
|
||||
.\"
|
||||
.\" This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
.\" made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
.\" "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
.\" support of any kind.
|
||||
.\"
|
||||
.\" NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
.\" INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
.\" AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
.\" SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
.\" In no event shall NetworkCS be responsible for any damages, including
|
||||
.\" but not limited to consequential damages, arising from or relating to
|
||||
.\" any use of the Software or related support.
|
||||
.\"
|
||||
.\" Copyright 1994-1998 Network Computing Services, Inc.
|
||||
.\"
|
||||
.\" Copies of this Software may be made, however, the above copyright
|
||||
.\" notice must be reproduced on all copies.
|
||||
.\"
|
||||
.\" @(#) $FreeBSD$
|
||||
.\"
|
||||
.\"
|
||||
.de EX \"Begin example
|
||||
.ne 5
|
||||
.if n .sp 1
|
||||
.if t .sp .5
|
||||
.nf
|
||||
.in +.5i
|
||||
..
|
||||
.de EE
|
||||
.fi
|
||||
.in -.5i
|
||||
.if n .sp 1
|
||||
.if t .sp .5
|
||||
..
|
||||
.TH ATM 8 "1998-08-20" "HARP"
|
||||
.SH NAME
|
||||
atm \- user configuration and display command for HARP ATM interface
|
||||
.SH SYNOPSIS
|
||||
Interface management subcommands:
|
||||
.in +10
|
||||
.ti -5
|
||||
.B atm attach
|
||||
<interface> <sigmgr>
|
||||
.ti -5
|
||||
.B atm detach
|
||||
<interface>
|
||||
.ti -5
|
||||
.B atm set MAC
|
||||
<interface> <MAC/ESI address>
|
||||
.ti -5
|
||||
.B atm set netif
|
||||
<interface> <prefix> <count>
|
||||
.ti -5
|
||||
.B atm set prefix
|
||||
<interface> <NSAP prefix>
|
||||
.ti -5
|
||||
.B atm show config
|
||||
[<interface>]
|
||||
.ti -5
|
||||
.B atm show interface
|
||||
[<interface>]
|
||||
.ti -5
|
||||
.B atm show netif
|
||||
[<netif>]
|
||||
.ti -5
|
||||
.B atm show stats interface
|
||||
[<interface> [phy | dev | atm | aal0 | aal4 | aal5 | driver]]
|
||||
.sp
|
||||
.ti -10
|
||||
VCC management subcommands:
|
||||
.ti -5
|
||||
.B atm add PVC
|
||||
<interface> <vpi> <vci> <aal> <encaps> <owner> ...
|
||||
.ti -5
|
||||
.B atm delete PVC
|
||||
<interface> <vpi> <vci>
|
||||
.ti -5
|
||||
.B atm delete SVC
|
||||
<interface> <vpi> <vci>
|
||||
.ti -5
|
||||
.B atm show stats VCC
|
||||
[<interface> [<vpi> [<vci>]]]
|
||||
.ti -5
|
||||
.B atm show VCC
|
||||
[<interface> [<vpi> [<vci>] | SVC | PVC]]
|
||||
.sp
|
||||
.ti -10
|
||||
IP management subcommands:
|
||||
.ti -5
|
||||
.B atm add ARP
|
||||
[<netif>] <host> <ATM address>
|
||||
.ti -5
|
||||
.B atm add PVC
|
||||
<interface> <vpi> <vci> <aal> <encaps> IP <netif> [<host> | dynamic] <traffic> <params> ...
|
||||
.ti -5
|
||||
.B atm delete ARP
|
||||
[<netif>] <host>
|
||||
.ti -5
|
||||
.B atm set arpserver
|
||||
<netif> <ATM address> | local [<IP prefix> ...]
|
||||
.ti -5
|
||||
.B atm show ARP
|
||||
[<host>]
|
||||
.ti -5
|
||||
.B atm show arpserver
|
||||
[<netif>]
|
||||
.ti -5
|
||||
.B atm show IPVCC
|
||||
[<host> | <netif>]
|
||||
.ti -5
|
||||
.sp
|
||||
.ti -10
|
||||
Miscellaneous subcommands:
|
||||
.ti -5
|
||||
.B atm help
|
||||
.ti -5
|
||||
.B atm show version
|
||||
.in -10
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.I atm
|
||||
configures and displays the status of the Host ATM Research Platform
|
||||
(HARP) networking software.
|
||||
The subcommands fall into several categories:
|
||||
.PP
|
||||
\fIInterface management\fP subcommands allow manipulation of the
|
||||
ATM interface.
|
||||
Functions include assigning a signalling manager to an interface,
|
||||
setting the ATM address, associating network interfaces with
|
||||
an interface, and displaying information about interfaces.
|
||||
.PP
|
||||
\fIVCC management\fP subcommands allow for managing ATM virtual
|
||||
channel connections (VCCs).
|
||||
Functions include opening and closing VCCs and displaying information
|
||||
about them.
|
||||
.PP
|
||||
\fIIP management\fP subcommands allow for managing the interface
|
||||
between IP and the ATM software.
|
||||
Functions include displaying and manipulating the ATMARP cache,
|
||||
opening a PVC connected to IP,
|
||||
assigning an ATMARP server to a network interface,
|
||||
and displaying information about IP VCCs.
|
||||
.PP
|
||||
\fIMiscellaneous\fP subcommands allow for displaying the version
|
||||
of the ATM software and for getting help with the \fIatm\fP command.
|
||||
.SS "Signalling Managers"
|
||||
The signalling manager is responsible for the opening and closing of
|
||||
VCCs.
|
||||
Four signalling managers are supported:
|
||||
.PP
|
||||
.in +10
|
||||
.ti -5
|
||||
PVC - for PVCs only,
|
||||
.ti -5
|
||||
SPANS - supports SPANS, FORE's proprietary signalling protocol,
|
||||
.ti -5
|
||||
UNI 3.0 - supports the signalling protocol from The ATM Forum's
|
||||
\fIATM User-Network Interface Specification, Version 3.0\fP.
|
||||
.ti -5
|
||||
UNI 3.1 - supports the signalling protocol from The ATM Forum's
|
||||
\fIATM User-Network Interface Specification, Version 3.1\fP.
|
||||
.in -10
|
||||
.PP
|
||||
All four signalling managers support the opening and closing of PVCs
|
||||
(see the \fIadd\fP and \fIdelete\fP subcommands).
|
||||
.PP
|
||||
A signalling manager must be attached to a physical interface
|
||||
(see the \fIattach\fP subcommand)
|
||||
before any VCCs can be created on the interface.
|
||||
.SS "Physical and Network Interfaces"
|
||||
Two types of interfaces are supported:
|
||||
physical interfaces and network interfaces.
|
||||
A physical interface represents a physical point of attachment to an
|
||||
ATM network.
|
||||
A physical interface has an ATM address associated with it, except
|
||||
when the PVC-only signalling manager is being used.
|
||||
.PP
|
||||
A network interface is a logical interface.
|
||||
One or more network interfaces are associated with a physical
|
||||
interface; each network interface has an IP address associated with it.
|
||||
For UNI-controlled interfaces, there can be up to 256 network
|
||||
interfaces associated with a physical interface.
|
||||
In this case, the correspondence between the network interface and
|
||||
the ATM address is determined by the selector field (the last
|
||||
byte) of the physical interface's ATM address.
|
||||
For PVC-only interfaces, there can be up to 256 logical interfaces
|
||||
associated with each physical interface.
|
||||
For interfaces controlled by the SPANS signalling manager,
|
||||
there must be one and
|
||||
only one network interface associated with each physical interface.
|
||||
.SS "Keyword and Documentation Conventions"
|
||||
Command and subcommand keywords can be abbreviated by simply giving
|
||||
enough of the first part of the keyword to make it unique.
|
||||
Thus, \fIatm sh v\fB gives the same result as \fIatm show vcc\fB.
|
||||
.PP
|
||||
All keywords are case-insensitive.
|
||||
.PP
|
||||
Where a host address needs to be given to the \fIatm\fP command,
|
||||
either a DNS name or an IP address in dotted decimal format can
|
||||
be used.
|
||||
.PP
|
||||
ATM addresses are specified as strings of hex digits, with an
|
||||
optional leading "0x".
|
||||
Fields within the address may be separated by periods, but periods
|
||||
are for readability only and are ignored.
|
||||
SPANS addresses are 8 bytes long, while NSAP-format addresses
|
||||
are 20 bytes long.
|
||||
The full address, including any leading zeroes, must be given.
|
||||
For example:
|
||||
.in +5
|
||||
0x47.0005.80.ffe100.0000.f21a.0170.0020481a0170.00 (NSAP format)
|
||||
.br
|
||||
0x00000010.f2050aa9 (SPANS format)
|
||||
.in -5
|
||||
.fi
|
||||
.SH SUBCOMMANDS
|
||||
.SS Interface Management Subcommands:
|
||||
.in +5
|
||||
.ti -5
|
||||
\fIatm add PVC <interface> <vpi> <vci> <aal> <encaps> <owner> ...\fP
|
||||
.in -5
|
||||
.PP
|
||||
the format of the \fIadd PVC\fP subcommand varies depending on the
|
||||
owner of the PVC.
|
||||
See the description under "IP Management Subcommands."
|
||||
.PP
|
||||
\fIatm attach <interface> <sigmgr>\fP
|
||||
.PP
|
||||
where:
|
||||
.in +10
|
||||
.ti -5
|
||||
\fI<interface>\fP specifies the physical interface to which the
|
||||
signalling manager is to be attached,
|
||||
.ti -5
|
||||
\fI<sigmgr>\fP specifies which signalling manager is to be attached.
|
||||
Valid choices are "SIGPVC", "SPANS", "UNI30", and "UNI31".
|
||||
.in -10
|
||||
.PP
|
||||
This command attaches a signalling manager to an interface.
|
||||
Until this is done, VCCs cannot be opened or closed.
|
||||
Only one signalling manager at a time can be attached to an interface.
|
||||
.PP
|
||||
\fIatm detach <interface>\fP
|
||||
.PP
|
||||
where:
|
||||
.in +10
|
||||
.ti -5
|
||||
\fI<interface>\fP specifies the physical interface whose signalling
|
||||
manager is to be detached.
|
||||
.in -10
|
||||
.PP
|
||||
This command detaches a signalling manager from an interface.
|
||||
All VCCs that the signalling manager has created will be closed,
|
||||
and no new VCCs can be created until a signalling manager (either
|
||||
the same or a different one) is attached again.
|
||||
.PP
|
||||
\fIatm set MAC <interface> <MAC/ESI address>\fP
|
||||
.PP
|
||||
where:
|
||||
.in +10
|
||||
.ti -5
|
||||
\fI<interface>\fP specifies the physical interface whose
|
||||
MAC address is to be set,
|
||||
.ti -5
|
||||
\fI<MAC/ESI address>\fP specifies the 6-byte MAC part of the NSAP
|
||||
address for the interface.
|
||||
The MAC address is specified as a string of 12 hexadecimal
|
||||
digits with an optional leading "0x".
|
||||
Fields in the address may be separated by periods.
|
||||
.in -10
|
||||
.PP
|
||||
This command sets the MAC address for a UNI-controlled interface.
|
||||
The first 13 bytes (the prefix) of the 20-byte NSAP-format address
|
||||
are set by the \fIatm set prefix\fP command or the ILMI daemon
|
||||
(\fIilmid\fP (8)),
|
||||
the next 6 bytes (the End System Identifier (ESI)) are set by
|
||||
this command,
|
||||
and the last byte (the selector) will be determined by which
|
||||
network interface is to be associated with the address.
|
||||
.PP
|
||||
The \fIatm set MAC\fP command can be used to override the MAC
|
||||
address in the interface hardware.
|
||||
.PP
|
||||
\fIatm set netif <interface> <prefix> <count>\fP
|
||||
.PP
|
||||
where:
|
||||
.in +10
|
||||
.ti -5
|
||||
\fI<interface>\fP specifies the physical interface that the network
|
||||
interface(s) are to be associated with,
|
||||
.ti -5
|
||||
\fI<prefix>\fP specifies the invariant part of the network
|
||||
interface name,
|
||||
.ti -5
|
||||
\fI<count>\fP specifies the number of network interface to be
|
||||
created.
|
||||
.in -10
|
||||
.PP
|
||||
This command creates one or more network interfaces and associates them
|
||||
with the specified physical interface.
|
||||
The network interface names are determined by the prefix and the count.
|
||||
The names will be of the form <prefix><nn>, where <prefix> is the
|
||||
prefix specified in the \fIset\fP subcommand and <nn> is a number
|
||||
in the range 0 - <count>-1. For example, the command:
|
||||
.PP
|
||||
.ti +5
|
||||
atm set netif hfa0 ni 2
|
||||
.PP
|
||||
would create two network interfaces, named ni0 and ni1, and associate
|
||||
them with physical interface hfa0.
|
||||
.PP
|
||||
\fIatm set prefix <interface> <NSAP prefix>\fP
|
||||
.PP
|
||||
where:
|
||||
.in +10
|
||||
.ti -5
|
||||
\fI<interface>\fP specifies the physical interface whose NSAP
|
||||
prefix is to be set,
|
||||
.ti -5
|
||||
\fI<NSAP prefix>\fP specifies the first 13 bytes of the NSAP address
|
||||
for the interface.
|
||||
The prefix is specified as a string of hexadecimal digits with an
|
||||
optional leading "0x".
|
||||
Fields in the prefix may be separated by periods.
|
||||
.in -10
|
||||
.PP
|
||||
This command sets the address for a UNI-controlled interface.
|
||||
The first 13 bytes (the prefix) of the 20-byte NSAP-format address
|
||||
are set by this command,
|
||||
the next 6 bytes (the End System Identifier (ESI)) will be the
|
||||
MAC address taken from the physical interface or set by the
|
||||
\fIset MAC\fP subcommand,
|
||||
and the last byte (the selector) will be determined by which
|
||||
network interface is to be associated with the address.
|
||||
.PP
|
||||
The NSAP prefix must be set before a UNI-controlled
|
||||
interface can become active.
|
||||
This can be accomplished either by the ILMI daemon (\fIilmid\fP (8))
|
||||
or the \fIset prefix\fP subcommand.
|
||||
.PP
|
||||
.I atm show config [<interface>]
|
||||
.PP
|
||||
displays the following information:
|
||||
.PP
|
||||
.B Interface
|
||||
\- the name of the physical interface.
|
||||
.PP
|
||||
.B Vendor
|
||||
\- the name of the adapter vendor.
|
||||
.PP
|
||||
.B Model
|
||||
\- the model of the adapter.
|
||||
.PP
|
||||
.B Media
|
||||
\- the communications medium used by the adapter.
|
||||
.PP
|
||||
.B Bus
|
||||
\- the type of bus the adapter is attached to.
|
||||
.PP
|
||||
.B Serial No.
|
||||
\- the adapter's serial number.
|
||||
.PP
|
||||
.B MAC address
|
||||
\- the MAC address of the interface.
|
||||
Note that this is the MAC address encoded in the hardware of
|
||||
the adapter, even if the \fIatm set MAC\fP command has been used
|
||||
to change the effective MAC address of the interface.
|
||||
.PP
|
||||
.B Hardware version
|
||||
\- the hardware revision level reported by the interface.
|
||||
.PP
|
||||
.B Firmware version
|
||||
\- the firmware revision level reported by the interface.
|
||||
.PP
|
||||
If no parameters are specified on the \fIshow config\fP subcommand,
|
||||
the configurations of all physical interfaces will be displayed.
|
||||
If an interface name is specified, only the configuration of the given
|
||||
interface is displayed.
|
||||
.PP
|
||||
.I atm show interface [<interface>]
|
||||
.PP
|
||||
displays the following information:
|
||||
.PP
|
||||
.B Interface
|
||||
\- the name of the physical interface.
|
||||
.PP
|
||||
.B Sigmgr
|
||||
\- the name of the signalling manager which has been attached to the
|
||||
interface.
|
||||
A dash (-) is shown if no signalling manager has been attached.
|
||||
.PP
|
||||
.B State
|
||||
\- the state of the signalling manager for the interface.
|
||||
Each signalling manager has its own set of states.
|
||||
They are:
|
||||
.in +21
|
||||
.ti -16
|
||||
PVC:
|
||||
.ti -11
|
||||
ACTIVE\ ---\ The signalling manager is active.
|
||||
.ti -11
|
||||
DETACH\ ---\ The signalling manager is being detached.
|
||||
.ti -16
|
||||
SPANS:
|
||||
.ti -11
|
||||
ACTIVE\ ---\ The signalling manager is active.
|
||||
.ti -11
|
||||
DETACH\ ---\ The signalling manager is being detached.
|
||||
.ti -11
|
||||
INIT\ -----\ The signalling manager's initial state.
|
||||
.ti -11
|
||||
PROBE\ ----\ The signalling manager is attempting to make
|
||||
contact with the ATM switch.
|
||||
.ti -16
|
||||
UNI 3.0 or UNI 3.1:
|
||||
.ti -11
|
||||
NULL\ -----\ The signalling manager's initial state.
|
||||
.ti -11
|
||||
ADR_WAIT\ -\ The signalling manager is waiting for the NSAP
|
||||
prefix to be set.
|
||||
.ti -11
|
||||
INIT\ -----\ The signalling manager is attempting to establish
|
||||
contact with the switch.
|
||||
.ti -11
|
||||
ACTIVE\ ---\ The signalling manager is active.
|
||||
.ti -11
|
||||
DETACH\ ---\ The signalling manager is being detached.
|
||||
.ti -21
|
||||
.PP
|
||||
.B ATM address
|
||||
\- the ATM address of the interface.
|
||||
.PP
|
||||
.B Network interfaces
|
||||
\- the names of network interfaces, if any, associated with the
|
||||
physical interface.
|
||||
.PP
|
||||
If no parameters are specified on the \fIshow interface\fP subcommand,
|
||||
information about all physical interfaces will be displayed.
|
||||
If an interface name is specified, only information about the given
|
||||
interface is displayed.
|
||||
.PP
|
||||
.I atm show netif [<netif>]
|
||||
.PP
|
||||
displays the following information:
|
||||
.PP
|
||||
.B Net Intf
|
||||
\- the name of the network interface.
|
||||
.PP
|
||||
.B IP Address
|
||||
\- the IP address of the network interface.
|
||||
.PP
|
||||
If no parameters are specified on the \fIshow netif\fP subcommand,
|
||||
information about all network interfaces will be displayed.
|
||||
If an interface name is specified, only information about the given
|
||||
network interface is displayed.
|
||||
.PP
|
||||
\fIatm show stats interface [<interface> [phy | dev | atm | aal0 |
|
||||
aal4 | aal5 | driver]]\fP
|
||||
.PP
|
||||
displays statistics associated with one or more interfaces.
|
||||
Subject-area keywords
|
||||
(\fIphy\fP, \fIdev\fP, \fIatm\fP, \fIaal0\fP,
|
||||
\fIaal4\fP, \fIaal5\fP, or \fIdriver\fP)
|
||||
can be specified to change the scope of the statistics displayed.
|
||||
.PP
|
||||
If no subject area keyword is specified, the following information is
|
||||
displayed:
|
||||
.PP
|
||||
.B Interface
|
||||
\- the name of the physical ATM interface.
|
||||
.PP
|
||||
.B Input PDUs
|
||||
\- the number of Protocol Data Units (PDUs) which have been received
|
||||
by the interface.
|
||||
.PP
|
||||
.B Input Bytes
|
||||
\- the number of bytes which have been received by the interface.
|
||||
.PP
|
||||
.B Input Errs
|
||||
\- the number of input errors which the interface has experienced.
|
||||
.PP
|
||||
.B Output PDUs
|
||||
\- the number of Protocol Data Units (PDUs) which have been transmitted
|
||||
by the interface.
|
||||
.PP
|
||||
.B Output Bytes
|
||||
\- the number of bytes which have been transmitted by the interface.
|
||||
.PP
|
||||
.B Output Errs
|
||||
\- the number of output errors which the interface has experienced.
|
||||
.PP
|
||||
.B Cmd Errs
|
||||
\- the number of command errors which the interface has experienced.
|
||||
.PP
|
||||
If a subject-area keyword is specified, then statistics for
|
||||
that subject are displayed.
|
||||
The statistics displayed depend on the adapter.
|
||||
If requested statistics are not available for an adapter,
|
||||
an error will be noted.
|
||||
.PP
|
||||
If no parameters are specified on the \fIshow stats interface\fP
|
||||
subcommand, statistics for all ATM interfaces are displayed.
|
||||
If an interface name is specified, only statistics for the given
|
||||
interface are displayed.
|
||||
.PP
|
||||
.SS VCC Management Subcommands:
|
||||
.PP
|
||||
\fIatm delete PVC <interface> <vpi> <vci>\fP
|
||||
.br
|
||||
\fIatm delete SVC <interface> <vpi> <vci>\fP
|
||||
.PP
|
||||
where:
|
||||
.in +10
|
||||
.ti -5
|
||||
\fIPVC\fP specifies that the VCC to be closed is a PVC,
|
||||
.ti -5
|
||||
\fISVC\fP specifies that the VCC to be closed is an SVC,
|
||||
.ti -5
|
||||
\fI<interface>\fP specifies the physical interface at which the
|
||||
VCC to be closed terminates,
|
||||
.ti -5
|
||||
\fI<vpi>\fP specifies the Virtual Path Identifier (VPI) of the VCC,
|
||||
.ti -5
|
||||
\fI<vci>\fP specifies the Virtual Channel Identifier (VCI) of the VCC.
|
||||
.in -10
|
||||
.PP
|
||||
This command closes a VCC.
|
||||
The two forms differ only in that the first specifies that the
|
||||
VCC is a PVC (that was created by the \fIadd PVC\fP subcommand) and
|
||||
the second specifies that the VCC is an SVC.
|
||||
Reserved VCCs (with VCI values less than 32) cannot be closed
|
||||
with this command.
|
||||
.PP
|
||||
\fIatm show stats VCC [<interface> [<vpi> [<vci>]]]\fP
|
||||
.PP
|
||||
displays the following information:
|
||||
.PP
|
||||
.B Interface
|
||||
\- the physical interface on which the VCC terminates.
|
||||
.PP
|
||||
.B VPI
|
||||
\- the Virtual Path Identifier (VPI) for the VCC.
|
||||
.PP
|
||||
.B VCI
|
||||
\- the Virtual Channel Identifier (VCI) for the VCC.
|
||||
.PP
|
||||
.B Input PDUs
|
||||
\- the number of Protocol Data Units (PDUs) which have been received
|
||||
on the VCC.
|
||||
.PP
|
||||
.B Input Bytes
|
||||
\- the number of bytes which have been received on the VCC.
|
||||
.PP
|
||||
.B Input Errs
|
||||
\- the number of input errors which the VCC has experienced.
|
||||
.PP
|
||||
.B Output PDUs
|
||||
\- the number of Protocol Data Units (PDUs) which have been transmitted
|
||||
on the VCC.
|
||||
.PP
|
||||
.B Output Bytes
|
||||
\- the number of bytes which have been transmitted on the VCC.
|
||||
.PP
|
||||
.B Output Errs
|
||||
\- the number of output errors which the VCC has experienced.
|
||||
.PP
|
||||
If no parameters are specified on the \fIshow VCC\fP subcommand, all
|
||||
active VCCs are displayed.
|
||||
If an interface name is specified, all active VCCs for the given
|
||||
interface are displayed.
|
||||
If an interface and VPI are specified, all active VCCs for the VPI
|
||||
on the given interface are displayed.
|
||||
If an interface, VPI, and VCI are specified, only the specified VCC on
|
||||
the given interface is displayed (note that this could actually be
|
||||
two VCCs, since SPANS considers SVCs to be unidirectional).
|
||||
.PP
|
||||
\fIatm show VCC [<interface> [<vpi> [<vci>] | SVC | PVC]]\fP
|
||||
.PP
|
||||
displays the following information:
|
||||
.PP
|
||||
.B Interface
|
||||
\- the physical interface on which the VCC terminates.
|
||||
.PP
|
||||
.B VPI
|
||||
\- the Virtual Path Identifier (VPI) for the VCC.
|
||||
.PP
|
||||
.B VCI
|
||||
\- the Virtual Channel Identifier (VCI) for the VCC.
|
||||
.PP
|
||||
.B AAL
|
||||
\- the ATM Adaptation Layer (AAL) in use on the VCC.
|
||||
Possible values are null and AAL 1-5.
|
||||
.PP
|
||||
.B Type
|
||||
\- specifies whether the VCC is an SVC or a PVC.
|
||||
.PP
|
||||
.B Dir
|
||||
\- the direction of information flow on the VCC.
|
||||
VCCs can be inbound, outbound, or both.
|
||||
.PP
|
||||
.B State
|
||||
\- the state of the VCC, as reported by the signalling manager.
|
||||
Each signalling manager has its own set of states.
|
||||
They are:
|
||||
.in +21
|
||||
.ti -16
|
||||
PVC:
|
||||
.ti -11
|
||||
NULL\ -----\ No state.
|
||||
.ti -11
|
||||
ACTIVE\ ---\ The VCC is active.
|
||||
.ti -11
|
||||
FREE\ -----\ The VCC is closed and the signalling manager is waiting for
|
||||
its resources to be freed.
|
||||
.ti -16
|
||||
SPANS:
|
||||
.ti -11
|
||||
NULL\ -----\ No state.
|
||||
.ti -11
|
||||
ACTIVE\ ---\ The VCC is a PVC and is active.
|
||||
.ti -11
|
||||
ACT_DOWN\ -\ The VCC is a PVC and the interface is down.
|
||||
.ti -11
|
||||
POPEN\ ----\ The VCC is being opened.
|
||||
.ti -11
|
||||
R_POPEN\ --\ The VCC is being opened by a remote host.
|
||||
.ti -11
|
||||
OPEN\ -----\ The VCC is active.
|
||||
.ti -11
|
||||
CLOSE\ ----\ The VCC is being closed.
|
||||
.ti -11
|
||||
ABORT\ ----\ The VCC is being aborted.
|
||||
.ti -11
|
||||
FREE\ -----\ The VCC is closed and the signalling manager is waiting for
|
||||
its resources to be freed.
|
||||
.ti -16
|
||||
UNI 3.0 or UNI 3.1:
|
||||
.ti -11
|
||||
NULL\ -----\ No state.
|
||||
.ti -11
|
||||
C_INIT\ ---\ A VCC is being initiated.
|
||||
.ti -11
|
||||
C_OUT_PR\ -\ An outgoing VCC request is proceeding.
|
||||
.ti -11
|
||||
C_PRES\ ---\ A VCC is being initiated by the network.
|
||||
.ti -11
|
||||
CONN_REQ\ -\ A VCC request has been accepted by a HARP user.
|
||||
.ti -11
|
||||
C_IN_PR\ --\ An incoming VCC request is proceeding.
|
||||
.ti -11
|
||||
ACTIVE\ ---\ The VCC is active.
|
||||
.ti -11
|
||||
REL_REQ\ --\ The VCC is being closed.
|
||||
.ti -11
|
||||
REL_IND\ --\ The network is clearing a VCC.
|
||||
.ti -11
|
||||
SSCF_REC\ -\ The SSCF session on the signalling channel is in
|
||||
recovery from an error.
|
||||
.ti -11
|
||||
FREE\ -----\ The VCC is closed and the signalling manager is waiting
|
||||
for its resources to be freed.
|
||||
.ti -11
|
||||
ACT_DOWN\ -\ The VCC is a PVC and the interface is down.
|
||||
.ti -21
|
||||
.PP
|
||||
.B Encaps
|
||||
\- the encapsulation in effect on the VCC.
|
||||
Possible encapsulations are null and LLC/SNAP.
|
||||
.PP
|
||||
.B Owner
|
||||
\- the owner or owners of the VCC.
|
||||
Shows the name(s) of the function(s) using the VCC.
|
||||
.PP
|
||||
.B Destination
|
||||
\- the ATM address of the host at the remote end of the VCC.
|
||||
.PP
|
||||
If no parameters are specified on the \fIshow VCC\fP subcommand, all
|
||||
active VCCs are displayed.
|
||||
If an interface name is specified, all active VCCs for the given
|
||||
interface are displayed.
|
||||
If an interface and VPI are specified, all active VCCs for the VPI
|
||||
on the given interface are displayed.
|
||||
If an interface, VPI, and VCI are specified, only the specified VCC on
|
||||
the given interface is displayed (note that this could actually be
|
||||
two VCCs, since SPANS considers SVCs to be unidirectional).
|
||||
.PP
|
||||
.SS IP Management Subcommands:
|
||||
\fIatm add ARP [<netif>] <host> <ATM address>\fP
|
||||
.PP
|
||||
where:
|
||||
.in +10
|
||||
.ti -5
|
||||
\fI<netif>\fP is the optional name of the network interface the
|
||||
ATMARP entry is to be associated with.
|
||||
If no name is specified, a network interface is chosen depending
|
||||
on the IP address of the host being added.
|
||||
.ti -5
|
||||
\fI<host>\fP is the host name or IP address of the host to
|
||||
be added to the ATMARP table,
|
||||
.ti -5
|
||||
\fI<ATM address>\fP is the ATM address of the host.
|
||||
.in -10
|
||||
.PP
|
||||
This command adds an entry to the ATMARP table for ATM.
|
||||
The given host's IP address is associated with the given ATM address.
|
||||
When IP needs to transmit data to the host, the specified ATM
|
||||
address will be used to open an SVC.
|
||||
.PP
|
||||
The entry will be marked as permanent in the ATMARP table and will not
|
||||
be subject to aging.
|
||||
.PP
|
||||
.in +5
|
||||
.ti -5
|
||||
\fIatm add PVC <interface> <vpi> <vci> <aal> <encaps> IP <netif> [<host> | dynamic] <traffic> <params...>\fP
|
||||
.in -5
|
||||
.PP
|
||||
where:
|
||||
.in +10
|
||||
.ti -5
|
||||
\fI<interface>\fP specifies the physical interface where the PVC
|
||||
is to terminate,
|
||||
.ti -5
|
||||
\fI<vpi>\fP specifies the Virtual Path Identifier (VPI) of the PVC,
|
||||
.ti -5
|
||||
\fI<vci>\fP specifies the Virtual Channel Identifier (VCI) of the PVC,
|
||||
.ti -5
|
||||
\fI<aal>\fP specifies the ATM Adaptation Layer (AAL) for the PVC.
|
||||
Valid choices are "null" or "AAL0" for the null AAL; "AAL1" for
|
||||
AAL 1; "AAL2" for AAL 2; "AAL3", "AAL4", or "AAL3/4" for AAL 3/4;
|
||||
and "AAL5" for AAL 5,
|
||||
.ti -5
|
||||
\fI<encaps>\fP specifies the encapsulation for the PVC.
|
||||
Valid choices are "null" or "none" for null encapsulation, and
|
||||
"LLC/SNAP", "LLC", or "SNAP" for LLC/SNAP encapsulation,
|
||||
.ti -5
|
||||
\fIIP\fP specifies that the owner of the PVC is IP.
|
||||
.ti -5
|
||||
\fI<netif>\fP specifies the network interface which the PVC is
|
||||
to be associated with.
|
||||
The network interface must exist and be associated with the
|
||||
specified physical interface,
|
||||
.ti -5
|
||||
\fI<host> | dynamic\fP gives the address of the host at
|
||||
the far end of the PVC, or the word "dynamic" if its address
|
||||
is to be determined with Inverse ARP.
|
||||
If "dynamic" is specified, LLC/SNAP encapsulation must also
|
||||
be specified.
|
||||
.ti -5
|
||||
\fI<traffic>\fP is the traffic type of the PVC and may be one of
|
||||
UBR, CBR or VBR.
|
||||
Following the traffic type the traffic parameters must be given.
|
||||
For UBR and CBR this is the peak cell rate and for VBR these
|
||||
are the peak and sustainable cell rate and the maximum burst size.
|
||||
.PP
|
||||
This command creates a PVC with the specified attributes and attaches
|
||||
it to IP.
|
||||
.PP
|
||||
\fIatm delete ARP [<netif>] <host>\fP
|
||||
.PP
|
||||
where:
|
||||
.in +10
|
||||
.ti -5
|
||||
\fI<netif>\fP is the optional name of the network interface the
|
||||
ATMARP entry is associated with.
|
||||
If no name is specified, the specified host is deleted from the
|
||||
cache regardless of what network interface it is associated with.
|
||||
.ti -5
|
||||
\fI<host>\fP is the host name or IP address of the host to
|
||||
be deleted from the ATMARP table.
|
||||
.PP
|
||||
This command deletes the specified host's entry from the ATMARP table.
|
||||
.PP
|
||||
\fIatm set arpserver <netif> <ATM address> | local [<IP prefix> ...]\fP
|
||||
.PP
|
||||
where:
|
||||
.in +10
|
||||
.ti -5
|
||||
\fI<netif>\fP specifies the network interface for which the
|
||||
ATMARP server address is to be set.
|
||||
.ti -5
|
||||
\fI<ATM address>\fP specifies the ATM address of the host which is to
|
||||
provide ATMARP service.
|
||||
If "local" is specified instead of an ATM address, the host on
|
||||
which the command is issued will become the ATMARP server.
|
||||
.ti -5
|
||||
\fI<IP prefix> ...\fP is an optional list of IP prefixes
|
||||
that the ATMARP server will provide information about.
|
||||
An IP prefix is specified as a dotted decimal IP address, followed by
|
||||
a slash, followed a number specifying how many bits of the IP address
|
||||
are significant.
|
||||
For example, 10.0.0.0/8 indicates that the ATMARP server will provide
|
||||
services for all addresses on IP network 10.
|
||||
The IP subnetwork which the network interface belongs to is
|
||||
automatically included.
|
||||
.in -10
|
||||
.PP
|
||||
This command sets the address of the ATMARP server for a network
|
||||
interface.
|
||||
.PP
|
||||
.I atm show ARP [<host>]
|
||||
.PP
|
||||
displays the following information:
|
||||
.PP
|
||||
.B Net Intf
|
||||
\- the network interface which traffic for the entry will use.
|
||||
.PP
|
||||
.B Flags
|
||||
\- flags showing whether the entry is valid and whether it is
|
||||
permanent.
|
||||
\- flags giving further information about the ATMARP entry.
|
||||
The meanings of the characters in the flags are:
|
||||
.PP
|
||||
.in +5
|
||||
P - the entry is permanent
|
||||
.br
|
||||
R - the entry has been refreshed
|
||||
.br
|
||||
V - the entry is valid
|
||||
.in -5
|
||||
.PP
|
||||
.B Age
|
||||
\- the number of minutes for which the entry will remain valid.
|
||||
.PP
|
||||
.B Origin
|
||||
\- the source of the ATMARP entry.
|
||||
Possible values are:
|
||||
.in +16
|
||||
.ti -11
|
||||
LOCAL\ ----\ The entry is for an interface on the host.
|
||||
.ti -11
|
||||
PERM\ -----\ The entry is permanent.
|
||||
This is used for entries that are created with the
|
||||
\fIadd ARP\fP command.
|
||||
.ti -11
|
||||
REG\ ------\ The entry was created as the result of a host
|
||||
registering with the ATMARP server.
|
||||
.ti -11
|
||||
SCSP\ -----\ The entry was learned via SCSP.
|
||||
.ti -11
|
||||
LOOKUP\ ---\ The entry was created as the result of a host
|
||||
performing an ATMARP lookup.
|
||||
.ti -11
|
||||
PEER_RSP\ -\ The entry was created as the result of a host
|
||||
answering an InARP Request.
|
||||
.ti -11
|
||||
PEER_REQ\ -\ The entry was created as the result of a host
|
||||
sending an InARP Request.
|
||||
.in -5
|
||||
.PP
|
||||
.B ATM address
|
||||
\- the ATM address of the host the entry refers to.
|
||||
.PP
|
||||
.B IP address
|
||||
\- the IP address or domain name of the host the entry refers to.
|
||||
.PP
|
||||
If no parameters are specified on the \fIshow ARP\fP subcommand,
|
||||
the whole ATMARP table will be displayed.
|
||||
If a host name or IP address is specified, only information about the
|
||||
given host is displayed.
|
||||
.PP
|
||||
This command displays both information that has been learned dynamically
|
||||
(through one form or another of ATMARP and via SCSP) and information
|
||||
which has been configured by the user (through the \fIadd ARP\fP
|
||||
subcommand).
|
||||
.PP
|
||||
.I atm show arpserver [<netif>]
|
||||
.PP
|
||||
displays the following information:
|
||||
.PP
|
||||
.B Net Intf
|
||||
\- the network interface for which information is being displayed.
|
||||
.PP
|
||||
.B State
|
||||
\- the state of the connection to the ATMARP server.
|
||||
Possible values are:
|
||||
.in +16
|
||||
.ti -11
|
||||
NOT_CONF\ -\ No ATMARP server has been configured for the interface.
|
||||
.ti -11
|
||||
SERVER\ ---\ The host is the ATMARP server.
|
||||
.ti -11
|
||||
PEND_ADR\ -\ No ATM address has been set for the interface.
|
||||
.ti -11
|
||||
POPEN\ ----\ The host is attempting to open a VCC to the ATMARP server.
|
||||
.ti -11
|
||||
REGISTER\ -\ The host has a VCC open to the ATMARP server and is in
|
||||
the process of registering with the server.
|
||||
.ti -11
|
||||
ACTIVE\ ---\ The ATMARP server connection is active.
|
||||
.in -16
|
||||
.PP
|
||||
.B ATM Address
|
||||
\- the ATM address of the ATMARP server.
|
||||
.PP
|
||||
If no parameters are specified on the \fIshow arpserver\fP subcommand,
|
||||
the ATMARP servers for all network interfaces will be displayed.
|
||||
If an interface name is specified, only information about the given
|
||||
network interface is displayed.
|
||||
.PP
|
||||
.I atm show IPVCC [<host> | <netif>]
|
||||
.PP
|
||||
displays the following information:
|
||||
.PP
|
||||
.B Net Intf
|
||||
\- the name of the network interface at which the VCC terminates.
|
||||
.PP
|
||||
.B VPI
|
||||
\- the Virtual Path Identifier (VPI) for the VCC.
|
||||
.PP
|
||||
.B VCI
|
||||
\- the Virtual Channel Identifier (VCI) for the VCC.
|
||||
.PP
|
||||
.B State
|
||||
\- the state of the VCC.
|
||||
Possible values are:
|
||||
.in +15
|
||||
.ti -10
|
||||
PMAP\ ----\ The host has an IP packet to send and is waiting for
|
||||
an ATMARP mapping.
|
||||
.ti -10
|
||||
POPEN\ ---\ The VCC is being opened.
|
||||
.ti -10
|
||||
PACCEPT\ -\ A VCC from a remote host is being accepted.
|
||||
.ti -10
|
||||
ACTPENT\ -\ A PVC is open, but no ATMARP information is
|
||||
available for it yet.
|
||||
.ti -10
|
||||
ACTIVE\ --\ The VCC is active.
|
||||
.in -15
|
||||
.PP
|
||||
.B Flags
|
||||
\- flags giving further information about the VCC.
|
||||
The meanings of the characters in the flags are:
|
||||
.PP
|
||||
.in +5
|
||||
S - the VCC is an SVC
|
||||
.br
|
||||
P - the VCC is a PVC
|
||||
.br
|
||||
L - the VCC uses LLC/SNAP encapsulation
|
||||
.br
|
||||
M - the IP-to-ATM address mapping for the VCC is valid
|
||||
.br
|
||||
N - there is no idle timeout for the VCC
|
||||
.in -5
|
||||
.PP
|
||||
.B IP Address
|
||||
\- the name and IP address of the host at the remote end of the VCC.
|
||||
.PP
|
||||
If no parameters are specified on the \fIshow IPVCC\fP subcommand, all
|
||||
active VCCs are displayed.
|
||||
If a host name is specified, the active VCC(s) for the given
|
||||
host are displayed.
|
||||
If a network interface name is specified, the active VCC(s) for the
|
||||
given network interface are displayed.
|
||||
.PP
|
||||
.SS Miscellaneous Subcommands:
|
||||
.I atm help
|
||||
.PP
|
||||
displays a synopsis of the atm command with its subcommands
|
||||
and their parameters.
|
||||
.PP
|
||||
.I atm show version
|
||||
displays the version of the running HARP software.
|
||||
.fi
|
||||
.SH "SEE ALSO"
|
||||
\fIilmid\fP (8); \fIscspd\fP (8); \fIatmarpd\fP (8).
|
||||
.fi
|
||||
.SH BUGS
|
||||
Care must be taken to avoid confusing physical interfaces and
|
||||
network interfaces.
|
||||
.PP
|
||||
Please report any bugs to harp-bugs@magic.net.
|
||||
.fi
|
||||
.SH COPYRIGHT
|
||||
Copyright (c) 1994-1998, Network Computing Services, Inc.
|
||||
.fi
|
||||
.SH AUTHORS
|
||||
John Cavanaugh, Network Computing Services, Inc.
|
||||
.br
|
||||
Mike Spengler, Network Computing Services, Inc.
|
||||
.br
|
||||
Joe Thomas, Network Computing Services, Inc.
|
||||
.fi
|
||||
.SH ACKNOWLEDGMENTS
|
||||
This software was developed with the support of the Defense
|
||||
Advanced Research Projects Agency (DARPA).
|
||||
1143
sbin/atm/atm/atm.c
1143
sbin/atm/atm/atm.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,195 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* User configuration and display program
|
||||
* --------------------------------------
|
||||
*
|
||||
* Control blocks
|
||||
*
|
||||
*/
|
||||
|
||||
#define MAX_NIFS 256 /* Max network interfaces */
|
||||
#define MIN_VCI 32 /* Smallest non-reserved VCI */
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* User commands
|
||||
*/
|
||||
struct cmd {
|
||||
const char *name; /* Command name */
|
||||
int minp; /* Minimum number of parameters */
|
||||
int maxp; /* Maximum number of parameters */
|
||||
void (*func)(int, char **,
|
||||
const struct cmd *);/* Processing function */
|
||||
const char *help; /* User help string */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Supported signalling protocols
|
||||
*/
|
||||
struct proto {
|
||||
const char *p_name; /* Protocol name */
|
||||
u_char p_id; /* Protocol id */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Table of state names
|
||||
*/
|
||||
struct state {
|
||||
const char *s_name; /* State name */
|
||||
u_char s_id; /* State id */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Supported signalling protocol states
|
||||
*/
|
||||
struct proto_state {
|
||||
const char *p_name; /* Signalling manager name */
|
||||
const struct state *p_state; /* Protocol state table */
|
||||
const struct state *v_state; /* Protocol VCC state table */
|
||||
u_char p_id; /* Protocol ID */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Supported VCC owners
|
||||
*/
|
||||
struct owner {
|
||||
const char *o_name; /* Owner name */
|
||||
u_int o_sap; /* Owner's SAP */
|
||||
void (*o_pvcadd)(int, char **, const struct cmd *,
|
||||
struct atmaddreq *, struct air_int_rsp *);
|
||||
/* PVC ADD processing function */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Supported AALs
|
||||
*/
|
||||
struct aal {
|
||||
const char *a_name; /* AAL name */
|
||||
u_char a_id; /* AAL code */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Supported encapsulations
|
||||
*/
|
||||
struct encaps {
|
||||
const char *e_name; /* Encapsulation name */
|
||||
u_char e_id; /* Encapsulation code */
|
||||
};
|
||||
|
||||
/*
|
||||
* Supported traffic type
|
||||
*/
|
||||
struct traffics {
|
||||
const char *t_name; /* Traffic name: CBR, VBR, UBR, ... */
|
||||
uint8_t t_type; /* HARP code T_ATM_XXX */
|
||||
int t_argc; /* Number of args */
|
||||
const char *help; /* User help string */
|
||||
};
|
||||
|
||||
/*
|
||||
* External variables
|
||||
*/
|
||||
extern char *prog; /* Program invocation */
|
||||
extern char prefix[]; /* Current command prefix */
|
||||
|
||||
/*
|
||||
* Global function declarations
|
||||
*/
|
||||
|
||||
/* atm_eni.c */
|
||||
void show_eni_stats(char *, int, char **);
|
||||
|
||||
/* atm_fore200.c */
|
||||
void show_fore200_stats(char *, int, char **);
|
||||
|
||||
/* atm_inet.c */
|
||||
void ip_pvcadd(int, char **, const struct cmd *, struct atmaddreq *,
|
||||
struct air_int_rsp *);
|
||||
|
||||
/* atm_print.c */
|
||||
void print_arp_info(struct air_arp_rsp *);
|
||||
void print_asrv_info(struct air_asrv_rsp *);
|
||||
void print_cfg_info(struct air_cfg_rsp *);
|
||||
void print_intf_info(struct air_int_rsp *);
|
||||
void print_ip_vcc_info(struct air_ip_vcc_rsp *);
|
||||
void print_netif_info(struct air_netif_rsp *);
|
||||
void print_intf_stats(struct air_phy_stat_rsp *);
|
||||
void print_vcc_stats(struct air_vcc_rsp *);
|
||||
void print_vcc_info(struct air_vcc_rsp *);
|
||||
void print_version_info(struct air_version_rsp *);
|
||||
|
||||
/* atm_set.c */
|
||||
void set_arpserver(int, char **, const struct cmd *);
|
||||
void set_macaddr(int, char **, const struct cmd *);
|
||||
void set_netif(int, char **, const struct cmd *);
|
||||
void set_prefix(int, char **, const struct cmd *);
|
||||
|
||||
/* atm_show.c */
|
||||
void show_arp(int, char **, const struct cmd *);
|
||||
void show_arpserv(int, char **, const struct cmd *);
|
||||
void show_config(int, char **, const struct cmd *);
|
||||
void show_intf(int, char **, const struct cmd *);
|
||||
void show_ip_vcc(int, char **, const struct cmd *);
|
||||
void show_netif(int, char **, const struct cmd *);
|
||||
void show_vcc(int, char **, const struct cmd *);
|
||||
void show_version(int, char **, const struct cmd *);
|
||||
void show_intf_stats(int, char **, const struct cmd *);
|
||||
void show_vcc_stats(int, char **, const struct cmd *);
|
||||
|
||||
/* atm_subr.c */
|
||||
const char * get_vendor(int);
|
||||
const char * get_adapter(int);
|
||||
const char * get_media_type(int);
|
||||
const char * get_bus_type(int);
|
||||
const char * get_bus_slot_info(int, u_long);
|
||||
const char * get_adapter_name(const char *);
|
||||
int get_hex_addr(char *, u_char *, int);
|
||||
const char * format_mac_addr(const Mac_addr *);
|
||||
int parse_ip_prefix(const char *, struct in_addr *);
|
||||
size_t compress_prefix_list(struct in_addr *, size_t);
|
||||
void check_netif_name(const char *);
|
||||
void sock_error(int);
|
||||
|
||||
extern const struct aal aals[];
|
||||
extern const struct encaps encaps[];
|
||||
|
|
@ -1,596 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User configuration and display program
|
||||
* --------------------------------------
|
||||
*
|
||||
* Routines for Fore SBA-200-specific subcommands
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <libatm.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
|
||||
#include "atm.h"
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local constants
|
||||
*/
|
||||
#define SHOW_PHY 1
|
||||
#define SHOW_DEV 2
|
||||
#define SHOW_ATM 4
|
||||
#define SHOW_AAL0 8
|
||||
#define SHOW_AAL4 16
|
||||
#define SHOW_AAL5 32
|
||||
#define SHOW_DRIVER 64
|
||||
|
||||
|
||||
/*
|
||||
* Headers for statistics
|
||||
*/
|
||||
#define TAXI_STATS_HDR \
|
||||
"%s TAXI Statistics\n\
|
||||
CRC Errs Framing Errs\n"
|
||||
|
||||
#define DEV_STATS_HDR \
|
||||
"%s Device Statistics\n\
|
||||
Type 1 Type 1 Type 2 Type 2\n\
|
||||
Small Buff Large Buff Small Buff Large Buff Receive Receive\n\
|
||||
Alloc Fail Alloc Fail Alloc Fail Alloc Fail Queue Full Carrier\n"
|
||||
|
||||
#define ATM_STATS_HDR \
|
||||
"%s ATM Layer Statistics\n\
|
||||
Cells In Cells Out VPI Range VPI NoConn VCI Range VCI NoConn\n"
|
||||
|
||||
#define AAL0_STATS_HDR \
|
||||
"%s AAL 0 Statistics\n\
|
||||
Cells In Cells Out Cell Drops\n"
|
||||
|
||||
#define AAL4_STATS_HDR \
|
||||
"%s AAL 4 Statistics\n\
|
||||
CRC Proto Cell PDU PDU\n\
|
||||
Cells In Cells Out Errs Errs Drops PDUs In PDUs Out Errs Drops\n"
|
||||
|
||||
#define AAL5_STATS_HDR \
|
||||
"%s AAL 5 Statistics\n\
|
||||
CRC/Len CRC Proto PDU\n\
|
||||
Cells In Cells Out Errs Drops PDUs In PDUs Out Errs Errs Drops\n"
|
||||
|
||||
#define DRIVER_STATS_HDR \
|
||||
"%s Device Driver Statistics\n\
|
||||
No Xmit Max Seg No No No IQ No Cmd No\n\
|
||||
VCC Queue Seg Not Seg DMA VCC No Mbuf Full DMA Queue DMA\n\
|
||||
Out Full Size Align Pad Out In Buff In In Sup Full Cmd\n"
|
||||
|
||||
#define OC3_STATS_HDR \
|
||||
"%s OC-3c Statistics\n\
|
||||
Section Path Line Line Path Corr Uncorr\n\
|
||||
BIP8 BIP8 BIP24 FEBE FEBE HCS HCS\n\
|
||||
Errs Errs Errs Errs Errs Errs Errs\n"
|
||||
|
||||
static void print_fore200_taxi(struct air_vinfo_rsp *);
|
||||
static void print_fore200_oc3(struct air_vinfo_rsp *);
|
||||
static void print_fore200_dev(struct air_vinfo_rsp *);
|
||||
static void print_fore200_atm(struct air_vinfo_rsp *);
|
||||
static void print_fore200_aal0(struct air_vinfo_rsp *);
|
||||
static void print_fore200_aal4(struct air_vinfo_rsp *);
|
||||
static void print_fore200_aal5(struct air_vinfo_rsp *);
|
||||
static void print_fore200_driver(struct air_vinfo_rsp *);
|
||||
|
||||
/*
|
||||
* Process show Fore SBA-200 statistics command
|
||||
*
|
||||
* The statistics printed are vendor-specific, depending on the brand of
|
||||
* the interface card.
|
||||
*
|
||||
* Command format:
|
||||
* atm show stats interface [<interface-name> [phy | dev | atm |
|
||||
* aal0 | aal4 | aal5 | driver]]
|
||||
*
|
||||
* Arguments:
|
||||
* intf interface statistics are for
|
||||
* argc number of remaining arguments to command
|
||||
* argv pointer to remaining argument strings
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
show_fore200_stats(intf, argc, argv)
|
||||
char *intf;
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int stats_type;
|
||||
ssize_t buf_len;
|
||||
struct air_cfg_rsp *cfg;
|
||||
struct air_vinfo_rsp *stats;
|
||||
struct atminfreq air;
|
||||
|
||||
/*
|
||||
* Get statistics type qualifier
|
||||
*/
|
||||
if (!strcasecmp("phy", argv[0])) {
|
||||
stats_type = SHOW_PHY;
|
||||
} else if (!strcasecmp("dev", argv[0])) {
|
||||
stats_type = SHOW_DEV;
|
||||
} else if (!strcasecmp("atm", argv[0])) {
|
||||
stats_type = SHOW_ATM;
|
||||
} else if (!strcasecmp("aal0", argv[0])) {
|
||||
stats_type = SHOW_AAL0;
|
||||
} else if (!strcasecmp("aal4", argv[0])) {
|
||||
stats_type = SHOW_AAL4;
|
||||
} else if (!strcasecmp("aal5", argv[0])) {
|
||||
stats_type = SHOW_AAL5;
|
||||
} else if (!strcasecmp("driver", argv[0])) {
|
||||
stats_type = SHOW_DRIVER;
|
||||
} else {
|
||||
errx(1, "Illegal statistics type");
|
||||
}
|
||||
argc--; argv++;
|
||||
|
||||
/*
|
||||
* Get adapter configuration from the kernel
|
||||
*/
|
||||
bzero(&air, sizeof(air));
|
||||
air.air_opcode = AIOCS_INF_CFG;
|
||||
strcpy(air.air_cfg_intf, intf);
|
||||
buf_len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
|
||||
if (buf_len == -1) {
|
||||
switch (errno) {
|
||||
case ENOPROTOOPT:
|
||||
case EOPNOTSUPP:
|
||||
err(1, "Internal error");
|
||||
case ENXIO:
|
||||
errx(1, "%s is not an ATM device", intf);
|
||||
default:
|
||||
err(1, "ioctl (AIOCINFO)");
|
||||
}
|
||||
}
|
||||
cfg = (struct air_cfg_rsp *)(void *)air.air_buf_addr;
|
||||
|
||||
/*
|
||||
* Get vendor-specific statistics from the kernel
|
||||
*/
|
||||
bzero(&air, sizeof(air));
|
||||
air.air_opcode = AIOCS_INF_VST;
|
||||
strcpy(air.air_vinfo_intf, intf);
|
||||
buf_len = do_info_ioctl(&air, sizeof(struct air_vinfo_rsp) + 1024);
|
||||
if (buf_len == -1) {
|
||||
switch (errno) {
|
||||
case ENOPROTOOPT:
|
||||
case EOPNOTSUPP:
|
||||
err(1, "Internal error");
|
||||
case ENXIO:
|
||||
errx(1, "%s is not an ATM device", intf);
|
||||
default:
|
||||
err(1, "ioctl (AIOCINFO)");
|
||||
}
|
||||
}
|
||||
stats = (struct air_vinfo_rsp *)(void *)air.air_buf_addr;
|
||||
|
||||
/*
|
||||
* Print the statistics
|
||||
*/
|
||||
if ((size_t)buf_len < sizeof(struct air_vinfo_rsp) +
|
||||
sizeof(Fore_stats)) {
|
||||
free(stats);
|
||||
free(cfg);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (stats_type) {
|
||||
case SHOW_PHY:
|
||||
switch (cfg->acp_media) {
|
||||
case MEDIA_TAXI_100:
|
||||
case MEDIA_TAXI_140:
|
||||
print_fore200_taxi(stats);
|
||||
break;
|
||||
case MEDIA_OC3C:
|
||||
print_fore200_oc3(stats);
|
||||
break;
|
||||
case MEDIA_OC12C:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SHOW_DEV:
|
||||
print_fore200_dev(stats);
|
||||
break;
|
||||
case SHOW_ATM:
|
||||
print_fore200_atm(stats);
|
||||
break;
|
||||
case SHOW_AAL0:
|
||||
print_fore200_aal0(stats);
|
||||
break;
|
||||
case SHOW_AAL4:
|
||||
print_fore200_aal4(stats);
|
||||
break;
|
||||
case SHOW_AAL5:
|
||||
print_fore200_aal5(stats);
|
||||
break;
|
||||
case SHOW_DRIVER:
|
||||
print_fore200_driver(stats);
|
||||
break;
|
||||
}
|
||||
|
||||
free(stats);
|
||||
free(cfg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print Fore ASX-200 TAXI statistics
|
||||
*
|
||||
* Arguments:
|
||||
* vi pointer to vendor-specific statistics to print
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_fore200_taxi(vi)
|
||||
struct air_vinfo_rsp *vi;
|
||||
{
|
||||
Fore_stats *stats;
|
||||
|
||||
/*
|
||||
* Bump stats pointer past header info
|
||||
*/
|
||||
stats = (Fore_stats *)
|
||||
((u_long) vi + sizeof(struct air_vinfo_rsp));
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
printf(TAXI_STATS_HDR, get_adapter_name(vi->avsp_intf));
|
||||
|
||||
/*
|
||||
* Print the physical layer info
|
||||
*/
|
||||
printf("%10ld %12ld\n",
|
||||
stats->st_taxi.taxi_bad_crc,
|
||||
stats->st_taxi.taxi_framing);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print Fore ASX-200 OC-3c statistics
|
||||
*
|
||||
* Arguments:
|
||||
* vi pointer to vendor-specific statistics to print
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_fore200_oc3(vi)
|
||||
struct air_vinfo_rsp *vi;
|
||||
{
|
||||
Fore_stats *stats;
|
||||
|
||||
/*
|
||||
* Bump stats pointer past header info
|
||||
*/
|
||||
stats = (Fore_stats *)
|
||||
((u_long) vi + sizeof(struct air_vinfo_rsp));
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
printf(OC3_STATS_HDR, get_adapter_name(vi->avsp_intf));
|
||||
|
||||
/*
|
||||
* Print the OC-3c info
|
||||
*/
|
||||
printf("%7ld %7ld %7ld %7ld %7ld %7ld %7ld\n",
|
||||
stats->st_oc3.oc3_sect_bip8,
|
||||
stats->st_oc3.oc3_path_bip8,
|
||||
stats->st_oc3.oc3_line_bip24,
|
||||
stats->st_oc3.oc3_line_febe,
|
||||
stats->st_oc3.oc3_path_febe,
|
||||
stats->st_oc3.oc3_hec_corr,
|
||||
stats->st_oc3.oc3_hec_uncorr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print Fore ASX-200 device statistics
|
||||
*
|
||||
* Arguments:
|
||||
* vi pointer to vendor-specific statistics to print
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_fore200_dev(vi)
|
||||
struct air_vinfo_rsp *vi;
|
||||
{
|
||||
Fore_stats *stats;
|
||||
|
||||
/*
|
||||
* Bump stats pointer past header info
|
||||
*/
|
||||
stats = (Fore_stats *)
|
||||
((u_long) vi + sizeof(struct air_vinfo_rsp));
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
printf(DEV_STATS_HDR, get_adapter_name(vi->avsp_intf));
|
||||
|
||||
/*
|
||||
* Print the device info
|
||||
*/
|
||||
printf("%10ld %10ld %10ld %10ld %10ld %s\n",
|
||||
stats->st_misc.buf1_sm_fail,
|
||||
stats->st_misc.buf1_lg_fail,
|
||||
stats->st_misc.buf2_sm_fail,
|
||||
stats->st_misc.buf2_lg_fail,
|
||||
stats->st_misc.rcvd_pdu_fail,
|
||||
(stats->st_misc.carrier_status ? "On" : "Off"));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print Fore ASX-200 ATM statistics
|
||||
*
|
||||
* Arguments:
|
||||
* vi pointer to vendor-specific statistics to print
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_fore200_atm(vi)
|
||||
struct air_vinfo_rsp *vi;
|
||||
{
|
||||
Fore_stats *stats;
|
||||
|
||||
/*
|
||||
* Bump stats pointer past header info
|
||||
*/
|
||||
stats = (Fore_stats *)
|
||||
((u_long) vi + sizeof(struct air_vinfo_rsp));
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
printf(ATM_STATS_HDR, get_adapter_name(vi->avsp_intf));
|
||||
|
||||
/*
|
||||
* Print the ATM layer info
|
||||
*/
|
||||
printf("%10ld %10ld %10ld %10ld %10ld %10ld\n",
|
||||
stats->st_atm.atm_rcvd,
|
||||
stats->st_atm.atm_xmit,
|
||||
stats->st_atm.atm_vpi_range,
|
||||
stats->st_atm.atm_vpi_noconn,
|
||||
stats->st_atm.atm_vci_range,
|
||||
stats->st_atm.atm_vci_noconn);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print Fore ASX-200 AAL 0 statistics
|
||||
*
|
||||
* Arguments:
|
||||
* vi pointer to vendor-specific statistics to print
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_fore200_aal0(vi)
|
||||
struct air_vinfo_rsp *vi;
|
||||
{
|
||||
Fore_stats *stats;
|
||||
|
||||
/*
|
||||
* Bump stats pointer past header info
|
||||
*/
|
||||
stats = (Fore_stats *)
|
||||
((u_long) vi + sizeof(struct air_vinfo_rsp));
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
printf(AAL0_STATS_HDR, get_adapter_name(vi->avsp_intf));
|
||||
|
||||
/*
|
||||
* Print the AAL 0 info
|
||||
*/
|
||||
printf("%10ld %10ld %10ld\n",
|
||||
stats->st_aal0.aal0_rcvd,
|
||||
stats->st_aal0.aal0_xmit,
|
||||
stats->st_aal0.aal0_drops);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print Fore ASX-200 AAL 4 statistics
|
||||
*
|
||||
* Arguments:
|
||||
* vi pointer to vendor-specific statistics to print
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_fore200_aal4(vi)
|
||||
struct air_vinfo_rsp *vi;
|
||||
{
|
||||
Fore_stats *stats;
|
||||
|
||||
/*
|
||||
* Bump stats pointer past header info
|
||||
*/
|
||||
stats = (Fore_stats *)
|
||||
((u_long) vi + sizeof(struct air_vinfo_rsp));
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
printf(AAL4_STATS_HDR, get_adapter_name(vi->avsp_intf));
|
||||
|
||||
/*
|
||||
* Print the AAL 4 info
|
||||
*/
|
||||
printf("%10ld %10ld %5ld %5ld %5ld %9ld %9ld %5ld %5ld\n",
|
||||
stats->st_aal4.aal4_rcvd,
|
||||
stats->st_aal4.aal4_xmit,
|
||||
stats->st_aal4.aal4_crc,
|
||||
stats->st_aal4.aal4_sar_cs,
|
||||
stats->st_aal4.aal4_drops,
|
||||
stats->st_aal4.aal4_pdu_rcvd,
|
||||
stats->st_aal4.aal4_pdu_xmit,
|
||||
stats->st_aal4.aal4_pdu_errs,
|
||||
stats->st_aal4.aal4_pdu_drops);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print Fore ASX-200 AAL 5 statistics
|
||||
*
|
||||
* Arguments:
|
||||
* vi pointer to vendor-specific statistics to print
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_fore200_aal5(vi)
|
||||
struct air_vinfo_rsp *vi;
|
||||
{
|
||||
Fore_stats *stats;
|
||||
|
||||
/*
|
||||
* Bump stats pointer past header info
|
||||
*/
|
||||
stats = (Fore_stats *)
|
||||
((u_long) vi + sizeof(struct air_vinfo_rsp));
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
printf(AAL5_STATS_HDR, get_adapter_name(vi->avsp_intf));
|
||||
|
||||
/*
|
||||
* Print the AAL 5 info
|
||||
*/
|
||||
printf("%10ld %10ld %5ld %5ld %9ld %9ld %5ld %5ld %5ld\n",
|
||||
stats->st_aal5.aal5_rcvd,
|
||||
stats->st_aal5.aal5_xmit,
|
||||
stats->st_aal5.aal5_crc_len,
|
||||
stats->st_aal5.aal5_drops,
|
||||
stats->st_aal5.aal5_pdu_rcvd,
|
||||
stats->st_aal5.aal5_pdu_xmit,
|
||||
stats->st_aal5.aal5_pdu_crc,
|
||||
stats->st_aal5.aal5_pdu_errs,
|
||||
stats->st_aal5.aal5_pdu_drops);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print Fore ASX-200 device driver statistics
|
||||
*
|
||||
* Arguments:
|
||||
* vi pointer to vendor-specific statistics to print
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_fore200_driver(vi)
|
||||
struct air_vinfo_rsp *vi;
|
||||
{
|
||||
Fore_stats *stats;
|
||||
|
||||
/*
|
||||
* Bump stats pointer past header info
|
||||
*/
|
||||
stats = (Fore_stats *)
|
||||
((u_long) vi + sizeof(struct air_vinfo_rsp));
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
printf(DRIVER_STATS_HDR, get_adapter_name(vi->avsp_intf));
|
||||
|
||||
/*
|
||||
* Print the driver info
|
||||
*/
|
||||
printf("%4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld\n",
|
||||
stats->st_drv.drv_xm_notact,
|
||||
stats->st_drv.drv_xm_full,
|
||||
stats->st_drv.drv_xm_maxpdu,
|
||||
stats->st_drv.drv_xm_segnoal,
|
||||
stats->st_drv.drv_xm_seglen,
|
||||
stats->st_drv.drv_xm_segdma,
|
||||
stats->st_drv.drv_rv_novcc,
|
||||
stats->st_drv.drv_rv_nosbf,
|
||||
stats->st_drv.drv_rv_nomb,
|
||||
stats->st_drv.drv_rv_ifull,
|
||||
stats->st_drv.drv_bf_segdma,
|
||||
stats->st_drv.drv_cm_full,
|
||||
stats->st_drv.drv_cm_nodma);
|
||||
|
||||
}
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User configuration and display program
|
||||
* --------------------------------------
|
||||
*
|
||||
* IP support
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <libatm.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
|
||||
#include "atm.h"
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Process add command for a TCP/IP PVC
|
||||
*
|
||||
* Command format:
|
||||
* atm add pvc <intf> <vpi> <vci> <aal> <encaps> IP <netif>
|
||||
* <IP addr> | dynamic
|
||||
*
|
||||
* Arguments:
|
||||
* argc number of remaining arguments to command
|
||||
* argv pointer to remaining argument strings
|
||||
* cmdp pointer to command description
|
||||
* app pointer to AIOCAPVC structure
|
||||
* intp pointer to air_int_rsp structure with information
|
||||
* about the physical interface that is the PVC is for.
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
ip_pvcadd(int argc, char **argv, const struct cmd *cmdp,
|
||||
struct atmaddreq *app, struct air_int_rsp *intp)
|
||||
{
|
||||
char *cp;
|
||||
char nhelp[128];
|
||||
u_int netif_no;
|
||||
u_int i, netif_pref_len;
|
||||
|
||||
/*
|
||||
* Yet more validation
|
||||
*/
|
||||
if (argc < 2) {
|
||||
strcpy(nhelp, cmdp->help);
|
||||
cp = strstr(nhelp, "<netif>");
|
||||
if (cp)
|
||||
strcpy(cp, "ip {dyn|<dst>}");
|
||||
fprintf(stderr, "%s: Invalid number of arguments:\n",
|
||||
prog);
|
||||
fprintf(stderr, "\tformat is: %s%s %s\n",
|
||||
prefix, cmdp->name, nhelp);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate and set network interface
|
||||
*/
|
||||
bzero(app->aar_pvc_intf, sizeof(app->aar_pvc_intf));
|
||||
netif_pref_len = strlen(intp->anp_nif_pref);
|
||||
cp = &argv[0][netif_pref_len];
|
||||
netif_no = (u_int)strtoul(cp, NULL, 10);
|
||||
for (i = 0; i < strlen(cp); i++) {
|
||||
if (cp[i] < '0' || cp[i] > '9') {
|
||||
netif_no = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strlen(argv[0]) > sizeof(app->aar_pvc_intf) - 1)
|
||||
errx(1, "Illegal network interface name '%s'", argv[0]);
|
||||
|
||||
if (strncasecmp(intp->anp_nif_pref, argv[0], netif_pref_len) ||
|
||||
strlen(argv[0]) <= netif_pref_len || netif_no >= intp->anp_nif_cnt)
|
||||
errx(1, "network interface %s is not associated with "
|
||||
"interface %s", argv[0], intp->anp_intf);
|
||||
|
||||
strcpy(app->aar_pvc_intf, argv[0]);
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
/*
|
||||
* Set PVC destination address
|
||||
*/
|
||||
bzero(&app->aar_pvc_dst, sizeof(struct sockaddr));
|
||||
if (strcasecmp(argv[0], "dynamic") == 0 ||
|
||||
strcasecmp(argv[0], "dyn") == 0) {
|
||||
|
||||
/*
|
||||
* Destination is dynamically determined
|
||||
*/
|
||||
app->aar_pvc_flags |= PVC_DYN;
|
||||
} else {
|
||||
|
||||
/*
|
||||
* Get destination IP address
|
||||
*/
|
||||
struct sockaddr_in *sain, *ret;
|
||||
|
||||
sain = (struct sockaddr_in *)(void *)&app->aar_pvc_dst;
|
||||
ret = get_ip_addr(argv[0]);
|
||||
if (ret == NULL)
|
||||
errx(1, "%s: bad ip address '%s'", argv[-1], argv[0]);
|
||||
sain->sin_addr.s_addr = ret->sin_addr.s_addr;
|
||||
}
|
||||
argc--; argv++;
|
||||
}
|
||||
|
||||
|
|
@ -1,891 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User configuration and display program
|
||||
* --------------------------------------
|
||||
*
|
||||
* Print routines for "show" subcommand
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sigmgr.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_vc.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
#include <netatm/ipatm/ipatm_var.h>
|
||||
#include <netatm/sigpvc/sigpvc_var.h>
|
||||
#include <netatm/spans/spans_var.h>
|
||||
#include <netatm/uni/uniip_var.h>
|
||||
#include <netatm/uni/unisig_var.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <libatm.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "atm.h"
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
#define ARP_HDR \
|
||||
"Net Intf Flags Age Origin\n"
|
||||
|
||||
#define ASRV_HDR \
|
||||
"Net Intf State ATM Address\n"
|
||||
|
||||
#define CFG_HDR \
|
||||
"Intf Vendor Model Media Bus Serial No\n"
|
||||
|
||||
#define IP_VCC_HDR \
|
||||
"Net Intf VPI VCI State Flags IP Address\n"
|
||||
|
||||
#define INTF_HDR \
|
||||
"Interface Sigmgr State\n"
|
||||
|
||||
#define NETIF_HDR \
|
||||
"Net Intf Phy Intf IP Address\n"
|
||||
|
||||
#define VCC_HDR \
|
||||
"Interface VPI VCI AAL Type Dir State Encaps Owner\n"
|
||||
|
||||
#define VCC_STATS_HDR \
|
||||
" Input Input Input Output Output Output\n\
|
||||
Interface VPI VCI PDUs Bytes Errs PDUs Bytes Errs\n"
|
||||
|
||||
#define VERSION_HDR \
|
||||
"Version\n"
|
||||
|
||||
#define PHY_STATS_HDR \
|
||||
" Input Input Input Output Output Output Cmd\n\
|
||||
Interface PDUs Bytes Errs PDUs Bytes Errs Errs\n"
|
||||
|
||||
/*
|
||||
* Local variables
|
||||
*/
|
||||
static int arp_hdr = 0;
|
||||
static int asrv_hdr = 0;
|
||||
static int cfg_hdr = 0;
|
||||
static int ip_vcc_hdr = 0;
|
||||
static int netif_hdr = 0;
|
||||
static int vcc_hdr = 0;
|
||||
static int vcc_stats_hdr = 0;
|
||||
static int phy_stats_hdr = 0;
|
||||
static int version_hdr = 0;
|
||||
|
||||
/*
|
||||
* SIGPVC state definitions
|
||||
*/
|
||||
static const struct state sigpvc_states[] = {
|
||||
{ "ACTIVE", SIGPVC_ACTIVE },
|
||||
{ "DETACH", SIGPVC_DETACH },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* SPANS state definitions
|
||||
*/
|
||||
static const struct state spans_states[] = {
|
||||
{ "ACTIVE", SPANS_ACTIVE },
|
||||
{ "DETACH", SPANS_DETACH },
|
||||
{ "INIT", SPANS_INIT },
|
||||
{ "PROBE", SPANS_PROBE },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* UNISIG state definitions
|
||||
*/
|
||||
static const struct state unisig_states[] = {
|
||||
{ "NULL", UNISIG_NULL },
|
||||
{ "ADR_WAIT", UNISIG_ADDR_WAIT },
|
||||
{ "INIT", UNISIG_INIT },
|
||||
{ "ACTIVE", UNISIG_ACTIVE },
|
||||
{ "DETACH", UNISIG_DETACH },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* SIGPVC VCC state definitions
|
||||
*/
|
||||
static const struct state sigpvc_vcc_states[] = {
|
||||
{ "NULL", VCCS_NULL },
|
||||
{ "ACTIVE", VCCS_ACTIVE },
|
||||
{ "FREE", VCCS_FREE },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* SPANS VCC state definitions
|
||||
*/
|
||||
static const struct state spans_vcc_states[] = {
|
||||
{ "NULL", SPANS_VC_NULL },
|
||||
{ "ACTIVE", SPANS_VC_ACTIVE },
|
||||
{ "ACT_DOWN", SPANS_VC_ACT_DOWN },
|
||||
{ "POPEN", SPANS_VC_POPEN },
|
||||
{ "R_POPEN", SPANS_VC_R_POPEN },
|
||||
{ "OPEN", SPANS_VC_OPEN },
|
||||
{ "CLOSE", SPANS_VC_CLOSE },
|
||||
{ "ABORT", SPANS_VC_ABORT },
|
||||
{ "FREE", SPANS_VC_FREE },
|
||||
{0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* UNISIG VCC state definitions
|
||||
*/
|
||||
static const struct state unisig_vcc_states[] = {
|
||||
{ "NULL", UNI_NULL },
|
||||
{ "C_INIT", UNI_CALL_INITIATED },
|
||||
{ "C_OUT_PR", UNI_CALL_OUT_PROC },
|
||||
{ "C_DELIV", UNI_CALL_DELIVERED },
|
||||
{ "C_PRES", UNI_CALL_PRESENT },
|
||||
{ "C_REC", UNI_CALL_RECEIVED },
|
||||
{ "CONN_REQ", UNI_CONNECT_REQUEST },
|
||||
{ "C_IN_PR", UNI_CALL_IN_PROC },
|
||||
{ "ACTIVE", UNI_ACTIVE },
|
||||
{ "REL_REQ", UNI_RELEASE_REQUEST },
|
||||
{ "REL_IND", UNI_RELEASE_IND },
|
||||
{ "SSCF_REC", UNI_SSCF_RECOV },
|
||||
{ "FREE", UNI_FREE },
|
||||
{ "ACTIVE", UNI_PVC_ACTIVE },
|
||||
{ "ACT_DOWN", UNI_PVC_ACT_DOWN },
|
||||
{0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* IP VCC state definitions
|
||||
*/
|
||||
static const struct state ip_vcc_states[] = {
|
||||
{ "FREE", IPVCC_FREE },
|
||||
{ "PMAP", IPVCC_PMAP },
|
||||
{ "POPEN", IPVCC_POPEN },
|
||||
{ "PACCEPT", IPVCC_PACCEPT },
|
||||
{ "ACTPENT", IPVCC_ACTPENT },
|
||||
{ "ACTIVE", IPVCC_ACTIVE },
|
||||
{ "CLOSED", IPVCC_CLOSED },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* ARP server state definitions
|
||||
*/
|
||||
static const struct state arpserver_states[] = {
|
||||
{ "NOT_CONF", UIAS_NOTCONF },
|
||||
{ "SERVER", UIAS_SERVER_ACTIVE },
|
||||
{ "PEND_ADR", UIAS_CLIENT_PADDR },
|
||||
{ "POPEN", UIAS_CLIENT_POPEN },
|
||||
{ "REGISTER", UIAS_CLIENT_REGISTER },
|
||||
{ "ACTIVE", UIAS_CLIENT_ACTIVE },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* Supported signalling managers
|
||||
*/
|
||||
static const struct proto_state proto_states[] = {
|
||||
{ "SIGPVC", sigpvc_states, sigpvc_vcc_states, ATM_SIG_PVC },
|
||||
{ "SPANS", spans_states, spans_vcc_states, ATM_SIG_SPANS },
|
||||
{ "UNI 3.0", unisig_states, unisig_vcc_states, ATM_SIG_UNI30 },
|
||||
{ "UNI 3.1", unisig_states, unisig_vcc_states, ATM_SIG_UNI31 },
|
||||
{ "UNI 4.0", unisig_states, unisig_vcc_states, ATM_SIG_UNI40 },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* ATMARP origin values
|
||||
*/
|
||||
static const struct state arp_origins[] = {
|
||||
{ "LOCAL", UAO_LOCAL },
|
||||
{ "PERM", UAO_PERM },
|
||||
{ "REG", UAO_REGISTER },
|
||||
{ "SCSP", UAO_SCSP },
|
||||
{ "LOOKUP", UAO_LOOKUP },
|
||||
{ "PEER_RSP", UAO_PEER_RSP },
|
||||
{ "PEER_REQ", UAO_PEER_REQ },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Print ARP table information
|
||||
*
|
||||
* Arguments:
|
||||
* ai pointer to a struct air_arp_rsp
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_arp_info(ai)
|
||||
struct air_arp_rsp *ai;
|
||||
{
|
||||
int i;
|
||||
const char *atm_addr, *ip_addr, *origin;
|
||||
char age[8], flags[32];
|
||||
struct sockaddr_in *sain;
|
||||
|
||||
/*
|
||||
* Print a header if it hasn't been done yet.
|
||||
*/
|
||||
if (!arp_hdr) {
|
||||
printf(ARP_HDR);
|
||||
arp_hdr = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the addresses
|
||||
*/
|
||||
atm_addr = format_atm_addr(&ai->aap_addr);
|
||||
sain = (struct sockaddr_in *)(void *)&ai->aap_arp_addr;
|
||||
ip_addr = format_ip_addr(&sain->sin_addr);
|
||||
|
||||
/*
|
||||
* Decode the flags
|
||||
*/
|
||||
bzero(flags, sizeof(flags));
|
||||
if (ai->aap_flags & ARPF_VALID) {
|
||||
strcat(flags, "V");
|
||||
}
|
||||
if (ai->aap_flags & ARPF_REFRESH) {
|
||||
strcat(flags, "R");
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the origin
|
||||
*/
|
||||
for (i=0; arp_origins[i].s_name != NULL &&
|
||||
ai->aap_origin != arp_origins[i].s_id;
|
||||
i++);
|
||||
if (arp_origins[i].s_name) {
|
||||
origin = arp_origins[i].s_name;
|
||||
} else {
|
||||
origin = "-";
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the age
|
||||
*/
|
||||
bzero(age, sizeof(age));
|
||||
if (!(ai->aap_flags & ARPF_VALID)) {
|
||||
strcpy(age, "-");
|
||||
} else {
|
||||
sprintf(age, "%d", ai->aap_age);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the ARP information
|
||||
*/
|
||||
printf("%-8s %-5s %3s %s\n ATM address = %s\n IP address = %s\n",
|
||||
ai->aap_intf,
|
||||
flags,
|
||||
age,
|
||||
origin,
|
||||
atm_addr,
|
||||
ip_addr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print ARP server information
|
||||
*
|
||||
* Arguments:
|
||||
* si pointer to a struct air_asrv_rsp
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_asrv_info(si)
|
||||
struct air_asrv_rsp *si;
|
||||
{
|
||||
int i;
|
||||
const char *atm_addr, *state;
|
||||
struct in_addr *addr;
|
||||
|
||||
/*
|
||||
* Print a header if it hasn't been done yet.
|
||||
*/
|
||||
if (!asrv_hdr) {
|
||||
printf(ASRV_HDR);
|
||||
asrv_hdr = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the ATM address of the ARP server
|
||||
*/
|
||||
atm_addr = format_atm_addr(&si->asp_addr);
|
||||
|
||||
/*
|
||||
* Format the server state
|
||||
*/
|
||||
for (i=0; arpserver_states[i].s_name != NULL &&
|
||||
si->asp_state != arpserver_states[i].s_id;
|
||||
i++);
|
||||
if (arpserver_states[i].s_name) {
|
||||
state = arpserver_states[i].s_name;
|
||||
} else {
|
||||
state = "-";
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the ARP server information
|
||||
*/
|
||||
printf("%-8s %-8s %s\n",
|
||||
si->asp_intf,
|
||||
state,
|
||||
atm_addr);
|
||||
|
||||
/*
|
||||
* Format and print the LIS prefixes
|
||||
*/
|
||||
if (si->asp_nprefix) {
|
||||
addr = (struct in_addr *)((u_long)si +
|
||||
sizeof(struct air_asrv_rsp));
|
||||
printf(" LIS = ");
|
||||
for (i = 0; i < si->asp_nprefix; i++) {
|
||||
printf("%s", inet_ntoa(*addr));
|
||||
addr++;
|
||||
printf("/0x%0lx", (u_long)ntohl(addr->s_addr));
|
||||
addr++;
|
||||
if (i < si->asp_nprefix -1)
|
||||
printf(", ");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print adapter configuration information
|
||||
*
|
||||
* Arguments:
|
||||
* si pointer to a struct air_cfg_rsp
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_cfg_info(si)
|
||||
struct air_cfg_rsp *si;
|
||||
{
|
||||
const char *adapter, *bus, *media, *vendor;
|
||||
|
||||
/*
|
||||
* Print a header if it hasn't been done yet.
|
||||
*/
|
||||
if (!cfg_hdr) {
|
||||
printf(CFG_HDR);
|
||||
cfg_hdr = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the vendor name and adapter type
|
||||
*/
|
||||
vendor = get_vendor(si->acp_vendor);
|
||||
adapter = get_adapter(si->acp_device);
|
||||
|
||||
/*
|
||||
* Format the communications medium
|
||||
*/
|
||||
media = get_media_type(si->acp_media);
|
||||
bus = get_bus_type(si->acp_bustype);
|
||||
|
||||
/*
|
||||
* Print the ARP server information
|
||||
*/
|
||||
printf("%-8s %-8s %-8s %-14s %-4s %ld\n",
|
||||
si->acp_intf,
|
||||
vendor,
|
||||
adapter,
|
||||
media,
|
||||
bus,
|
||||
si->acp_serial);
|
||||
printf(" MAC address = %s\n",
|
||||
format_mac_addr(&si->acp_macaddr));
|
||||
printf(" Hardware version = %s\n", si->acp_hard_vers);
|
||||
printf(" Firmware version = %s\n", si->acp_firm_vers);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print interface information
|
||||
*
|
||||
* Arguments:
|
||||
* ni pointer to a struct air_int_rsp
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_intf_info(ni)
|
||||
struct air_int_rsp *ni;
|
||||
{
|
||||
int i;
|
||||
char nif_names[(IFNAMSIZ *2)+4];
|
||||
char *atm_addr;
|
||||
const char *sigmgr = "-";
|
||||
const char *state_name = "-";
|
||||
const struct state *s_t;
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
printf(INTF_HDR);
|
||||
|
||||
/*
|
||||
* Translate signalling manager name
|
||||
*/
|
||||
for (i=0; proto_states[i].p_state != NULL; i++)
|
||||
if (ni->anp_sig_proto == proto_states[i].p_id)
|
||||
break;
|
||||
if (proto_states[i].p_state != NULL)
|
||||
sigmgr = proto_states[i].p_name;
|
||||
|
||||
/*
|
||||
* Get the signalling manager state
|
||||
*/
|
||||
if (proto_states[i].p_state != NULL) {
|
||||
s_t = proto_states[i].p_state;
|
||||
for (i=0; s_t[i].s_name != NULL; i++)
|
||||
if (ni->anp_sig_state == s_t[i].s_id)
|
||||
break;
|
||||
if (s_t[i].s_name != NULL)
|
||||
state_name = s_t[i].s_name;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the ATM address
|
||||
*/
|
||||
atm_addr = format_atm_addr(&ni->anp_addr);
|
||||
|
||||
/*
|
||||
* Get the range of NIFs on the physical interface
|
||||
*/
|
||||
bzero(nif_names, sizeof(nif_names));
|
||||
if (strlen(ni->anp_nif_pref) == 0) {
|
||||
strcpy(nif_names, "-");
|
||||
} else {
|
||||
strcpy(nif_names, ni->anp_nif_pref);
|
||||
strcat(nif_names, "0");
|
||||
if (ni->anp_nif_cnt > 1) {
|
||||
strcat(nif_names, " - ");
|
||||
strcat(nif_names, ni->anp_nif_pref);
|
||||
sprintf(&nif_names[strlen(nif_names)], "%d",
|
||||
ni->anp_nif_cnt-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print the interface information
|
||||
*/
|
||||
printf("%-9s %-7s %s\n",
|
||||
ni->anp_intf,
|
||||
sigmgr,
|
||||
state_name);
|
||||
printf(" ATM address = %s\n", atm_addr);
|
||||
printf(" Network interfaces: %s\n", nif_names);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print IP address map information
|
||||
*
|
||||
* Arguments:
|
||||
* ai pointer to a struct air_arp_rsp
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_ip_vcc_info(ai)
|
||||
struct air_ip_vcc_rsp *ai;
|
||||
{
|
||||
int i;
|
||||
const char *ip_addr, *state;
|
||||
char flags[32], vpi_vci[16];
|
||||
struct sockaddr_in *sain;
|
||||
|
||||
/*
|
||||
* Print a header if it hasn't been done yet.
|
||||
*/
|
||||
if (!ip_vcc_hdr) {
|
||||
printf(IP_VCC_HDR);
|
||||
ip_vcc_hdr = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the IP address
|
||||
*/
|
||||
sain = (struct sockaddr_in *)(void *)&ai->aip_dst_addr;
|
||||
ip_addr = format_ip_addr(&sain->sin_addr);
|
||||
|
||||
/*
|
||||
* Format the VPI/VCI
|
||||
*/
|
||||
if (ai->aip_vpi == 0 && ai->aip_vci == 0) {
|
||||
strcpy(vpi_vci, " - -");
|
||||
} else {
|
||||
sprintf(vpi_vci, "%3d %5d", ai->aip_vpi, ai->aip_vci);
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode VCC flags
|
||||
*/
|
||||
bzero(flags, sizeof(flags));
|
||||
if (ai->aip_flags & IVF_PVC) {
|
||||
strcat(flags, "P");
|
||||
}
|
||||
if (ai->aip_flags & IVF_SVC) {
|
||||
strcat(flags, "S");
|
||||
}
|
||||
if (ai->aip_flags & IVF_LLC) {
|
||||
strcat(flags, "L");
|
||||
}
|
||||
if (ai->aip_flags & IVF_MAPOK) {
|
||||
strcat(flags, "M");
|
||||
}
|
||||
if (ai->aip_flags & IVF_NOIDLE) {
|
||||
strcat(flags, "N");
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the state of the VCC
|
||||
*/
|
||||
for (i=0; ip_vcc_states[i].s_name != NULL &&
|
||||
ai->aip_state != ip_vcc_states[i].s_id;
|
||||
i++);
|
||||
if (ip_vcc_states[i].s_name) {
|
||||
state = ip_vcc_states[i].s_name;
|
||||
} else {
|
||||
state = "-";
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the IP VCC information
|
||||
*/
|
||||
printf("%-8s %9s %-7s %-5s %s\n",
|
||||
ai->aip_intf,
|
||||
vpi_vci,
|
||||
state,
|
||||
flags,
|
||||
ip_addr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print network interface information
|
||||
*
|
||||
* Arguments:
|
||||
* ni pointer to a struct air_int_rsp
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_netif_info(ni)
|
||||
struct air_netif_rsp *ni;
|
||||
{
|
||||
const char *ip_addr;
|
||||
struct sockaddr_in *sain;
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
if (!netif_hdr) {
|
||||
netif_hdr++;
|
||||
printf(NETIF_HDR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the protocol address
|
||||
*/
|
||||
sain = (struct sockaddr_in *)(void *)&ni->anp_proto_addr;
|
||||
ip_addr = format_ip_addr(&sain->sin_addr);
|
||||
|
||||
/*
|
||||
* Print the network interface information
|
||||
*/
|
||||
printf("%-8s %-8s %s\n",
|
||||
ni->anp_intf,
|
||||
ni->anp_phy_intf,
|
||||
ip_addr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print physical interface statistics
|
||||
*
|
||||
* Arguments:
|
||||
* pi pointer to a struct air_phy_stat_rsp
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_intf_stats(pi)
|
||||
struct air_phy_stat_rsp *pi;
|
||||
{
|
||||
/*
|
||||
* Print a header if it hasn't already been done
|
||||
*/
|
||||
if (!phy_stats_hdr) {
|
||||
printf(PHY_STATS_HDR);
|
||||
phy_stats_hdr = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the interface statistics
|
||||
*/
|
||||
printf("%-9s %7lld %8lld %5lld %7lld %8lld %5lld %5lld\n",
|
||||
pi->app_intf,
|
||||
(unsigned long long)pi->app_ipdus,
|
||||
(unsigned long long)pi->app_ibytes,
|
||||
(unsigned long long)pi->app_ierrors,
|
||||
(unsigned long long)pi->app_opdus,
|
||||
(unsigned long long)pi->app_obytes,
|
||||
(unsigned long long)pi->app_oerrors,
|
||||
(unsigned long long)pi->app_cmderrors);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print VCC statistics
|
||||
*
|
||||
* Arguments:
|
||||
* vi pointer to VCC statistics to print
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_vcc_stats(vi)
|
||||
struct air_vcc_rsp *vi;
|
||||
{
|
||||
|
||||
/*
|
||||
* Print a header if it hasn't already been done
|
||||
*/
|
||||
if (!vcc_stats_hdr) {
|
||||
printf(VCC_STATS_HDR);
|
||||
vcc_stats_hdr = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the VCC statistics
|
||||
*/
|
||||
printf("%-9s %3d %4d",
|
||||
vi->avp_intf,
|
||||
vi->avp_vpi,
|
||||
vi->avp_vci);
|
||||
if ( vi->avp_type & VCC_IN )
|
||||
printf ( " %7ld %8ld %5ld",
|
||||
vi->avp_ipdus,
|
||||
vi->avp_ibytes,
|
||||
vi->avp_ierrors);
|
||||
else
|
||||
printf ( " - - -" );
|
||||
|
||||
if ( vi->avp_type & VCC_OUT )
|
||||
printf ( " %7ld %8ld %5ld\n",
|
||||
vi->avp_opdus,
|
||||
vi->avp_obytes,
|
||||
vi->avp_oerrors);
|
||||
else
|
||||
printf ( " - - -\n" );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print VCC information
|
||||
*
|
||||
* Arguments:
|
||||
* vi pointer to a struct air_vcc_rsp
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_vcc_info(vi)
|
||||
struct air_vcc_rsp *vi;
|
||||
{
|
||||
int i;
|
||||
const char *aal_name = "-" , *encaps_name = "-", *owner_name = "-";
|
||||
const char *state_name = "-", *type_name = "-";
|
||||
char dir_name[10];
|
||||
const struct state *s_t;
|
||||
|
||||
/*
|
||||
* Print a header if it hasn't already been done
|
||||
*/
|
||||
if (!vcc_hdr) {
|
||||
printf(VCC_HDR);
|
||||
vcc_hdr = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate AAL
|
||||
*/
|
||||
for (i=0; aals[i].a_name != NULL; i++)
|
||||
if (vi->avp_aal == aals[i].a_id)
|
||||
break;
|
||||
if (aals[i].a_name)
|
||||
aal_name = aals[i].a_name;
|
||||
|
||||
/*
|
||||
* Translate VCC type
|
||||
*/
|
||||
if (vi->avp_type & VCC_PVC)
|
||||
type_name = "PVC";
|
||||
else if (vi->avp_type & VCC_SVC)
|
||||
type_name = "SVC";
|
||||
/*
|
||||
* Translate VCC direction
|
||||
*/
|
||||
bzero(dir_name, sizeof(dir_name));
|
||||
if (vi->avp_type & VCC_IN)
|
||||
strcat(dir_name, "In");
|
||||
if (vi->avp_type & VCC_OUT)
|
||||
strcat(dir_name, "Out");
|
||||
if (strlen(dir_name) == 0)
|
||||
strcpy(dir_name, "-");
|
||||
|
||||
/*
|
||||
* Translate state
|
||||
*/
|
||||
for (i=0; proto_states[i].p_state != NULL; i++)
|
||||
if (vi->avp_sig_proto == proto_states[i].p_id)
|
||||
break;
|
||||
if (proto_states[i].p_state) {
|
||||
s_t = proto_states[i].v_state;
|
||||
for (i=0; s_t[i].s_name != NULL; i++)
|
||||
if (vi->avp_state == s_t[i].s_id)
|
||||
break;
|
||||
if (s_t[i].s_name)
|
||||
state_name = s_t[i].s_name;
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate encapsulation
|
||||
*/
|
||||
for (i=0; encaps[i].e_name != NULL; i++)
|
||||
if (vi->avp_encaps == encaps[i].e_id)
|
||||
break;
|
||||
if (encaps[i].e_name)
|
||||
encaps_name = encaps[i].e_name;
|
||||
|
||||
/*
|
||||
* Print the VCC information
|
||||
*/
|
||||
printf("%-9s %3d %5d %-4s %-4s %-5s %-8s %-8s ",
|
||||
vi->avp_intf,
|
||||
vi->avp_vpi,
|
||||
vi->avp_vci,
|
||||
aal_name,
|
||||
type_name,
|
||||
dir_name,
|
||||
state_name,
|
||||
encaps_name);
|
||||
|
||||
/*
|
||||
* Print VCC owners' names
|
||||
*/
|
||||
for (i = 0, owner_name = vi->avp_owners;
|
||||
i < O_CNT - 1 && strlen(owner_name);
|
||||
i++, owner_name += (T_ATM_APP_NAME_LEN + 1)) {
|
||||
if (i > 0)
|
||||
printf(", ");
|
||||
printf("%s", owner_name);
|
||||
}
|
||||
if (i == 0)
|
||||
printf("-");
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* Print destination address if it's an SVC
|
||||
*/
|
||||
if (vi->avp_type & VCC_SVC) {
|
||||
printf(" Dest = %s\n",
|
||||
format_atm_addr(&vi->avp_daddr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print network interface information
|
||||
*
|
||||
* Arguments:
|
||||
* ni pointer to a struct air_int_rsp
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
print_version_info(vi)
|
||||
struct air_version_rsp *vi;
|
||||
{
|
||||
char version_str[80];
|
||||
|
||||
/*
|
||||
* Print a header
|
||||
*/
|
||||
if (!version_hdr) {
|
||||
version_hdr++;
|
||||
printf(VERSION_HDR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the interface information
|
||||
*/
|
||||
sprintf(version_str, "%d.%d",
|
||||
ATM_VERS_MAJ(vi->avp_version),
|
||||
ATM_VERS_MIN(vi->avp_version));
|
||||
printf("%7s\n", version_str);
|
||||
}
|
||||
|
|
@ -1,528 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User configuration and display program
|
||||
* --------------------------------------
|
||||
*
|
||||
* Routines for "set" subcommand
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <libatm.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "atm.h"
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Process ATM ARP server set command
|
||||
*
|
||||
* Command format:
|
||||
* atm set arpserver <interface_name> <atm-address> <IP prefix> ...
|
||||
*
|
||||
* Arguments:
|
||||
* argc number of arguments to command
|
||||
* argv pointer to argument strings
|
||||
* cmdp pointer to command description
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
set_arpserver(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||
{
|
||||
int rc, s;
|
||||
u_int i;
|
||||
ssize_t len;
|
||||
size_t prefix_len = 0;
|
||||
char *intf;
|
||||
Atm_addr server;
|
||||
struct sockaddr_in *lis;
|
||||
struct sockaddr_in if_mask;
|
||||
struct atmsetreq asr;
|
||||
struct atminfreq air;
|
||||
struct air_netif_rsp *int_info;
|
||||
struct {
|
||||
struct in_addr ip_addr;
|
||||
struct in_addr ip_mask;
|
||||
} prefix_buf[64];;
|
||||
|
||||
/*
|
||||
* Validate interface name
|
||||
*/
|
||||
check_netif_name(argv[0]);
|
||||
intf = argv[0];
|
||||
argc--; argv++;
|
||||
|
||||
/*
|
||||
* Get the ARP server's ATM address
|
||||
*/
|
||||
bzero(&server, sizeof(server));
|
||||
if (strcasecmp(argv[0], "local")) {
|
||||
/*
|
||||
* ARP server NSAP address is provided
|
||||
*/
|
||||
server.address_format = T_ATM_ENDSYS_ADDR;
|
||||
server.address_length = sizeof(Atm_addr_nsap);
|
||||
if (get_hex_atm_addr(argv[0],
|
||||
(u_char *)server.address,
|
||||
sizeof(Atm_addr_nsap)) !=
|
||||
sizeof(Atm_addr_nsap)) {
|
||||
fprintf(stderr, "%s: Invalid ARP server address\n",
|
||||
prog);
|
||||
exit(1);
|
||||
}
|
||||
if (argc > 1) {
|
||||
fprintf(stderr, "%s: Invalid number of arguments\n",
|
||||
prog);
|
||||
exit(1);
|
||||
}
|
||||
prefix_len = 0;
|
||||
} else {
|
||||
argc--; argv++;
|
||||
|
||||
/*
|
||||
* This host is the ARP server
|
||||
*/
|
||||
server.address_format = T_ATM_ABSENT;
|
||||
server.address_length = 0;
|
||||
|
||||
/*
|
||||
* Get interface information from the kernel. We need
|
||||
* to get the IP address and the subnet mask associated
|
||||
* with the network interface and insert them into the
|
||||
* list of permitted LIS prefixes.
|
||||
*/
|
||||
bzero(&air, sizeof(air));
|
||||
air.air_opcode = AIOCS_INF_NIF;
|
||||
strcpy(air.air_int_intf, intf);
|
||||
len = do_info_ioctl(&air, sizeof(struct air_netif_rsp));
|
||||
if (len == -1) {
|
||||
fprintf(stderr, "%s: ", prog);
|
||||
switch (errno) {
|
||||
case ENOPROTOOPT:
|
||||
case EOPNOTSUPP:
|
||||
perror("Internal error");
|
||||
break;
|
||||
case ENXIO:
|
||||
fprintf(stderr, "%s is not an ATM device\n",
|
||||
intf);
|
||||
break;
|
||||
default:
|
||||
perror("ioctl (AIOCINFO)");
|
||||
break;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
int_info = (struct air_netif_rsp *) air.air_buf_addr;
|
||||
lis = (struct sockaddr_in *)(void *)&int_info->anp_proto_addr;
|
||||
prefix_buf[0].ip_addr = lis->sin_addr;
|
||||
free(int_info);
|
||||
|
||||
rc = get_subnet_mask(intf, &if_mask);
|
||||
if (rc) {
|
||||
fprintf(stderr, "%s: Can't get subnet mask for %s\n",
|
||||
prog, intf);
|
||||
}
|
||||
prefix_buf[0].ip_mask = if_mask.sin_addr;
|
||||
prefix_buf[0].ip_addr.s_addr &=
|
||||
prefix_buf[0].ip_mask.s_addr;
|
||||
|
||||
/*
|
||||
* Get the prefixes of the LISs that we'll support
|
||||
*/
|
||||
for (i = 1; argc; i++, argc--, argv++) {
|
||||
rc = parse_ip_prefix(argv[0],
|
||||
(struct in_addr *)&prefix_buf[i]);
|
||||
if (rc != 0) {
|
||||
fprintf(stderr, "%s: Invalid IP prefix value \'%s\'\n",
|
||||
prog, argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compress the prefix list
|
||||
*/
|
||||
prefix_len = compress_prefix_list((struct in_addr *)prefix_buf,
|
||||
i * sizeof(struct in_addr) * 2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build ioctl request
|
||||
*/
|
||||
bzero(&asr, sizeof(asr));
|
||||
asr.asr_opcode = AIOCS_SET_ASV;
|
||||
strncpy(asr.asr_arp_intf, intf, sizeof(asr.asr_arp_intf));
|
||||
asr.asr_arp_addr = server;
|
||||
asr.asr_arp_subaddr.address_format = T_ATM_ABSENT;
|
||||
asr.asr_arp_subaddr.address_length = 0;
|
||||
if (prefix_len)
|
||||
asr.asr_arp_pbuf = (caddr_t)prefix_buf;
|
||||
else
|
||||
asr.asr_arp_pbuf = (caddr_t)0;
|
||||
asr.asr_arp_plen = prefix_len;
|
||||
|
||||
/*
|
||||
* Pass the new ARP server address to the kernel
|
||||
*/
|
||||
s = socket(AF_ATM, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
sock_error(errno);
|
||||
}
|
||||
if (ioctl(s, AIOCSET, (caddr_t)&asr) < 0) {
|
||||
fprintf(stderr, "%s: ", prog);
|
||||
switch (errno) {
|
||||
case EOPNOTSUPP:
|
||||
case EPROTONOSUPPORT:
|
||||
perror("Internal error");
|
||||
break;
|
||||
case EINVAL:
|
||||
fprintf(stderr, "Invalid parameter\n");
|
||||
break;
|
||||
case ENOMEM:
|
||||
fprintf(stderr, "Kernel memory exhausted\n");
|
||||
break;
|
||||
case ENETDOWN:
|
||||
fprintf(stderr, "ATM network is inoperable\n");
|
||||
break;
|
||||
case EPERM:
|
||||
fprintf(stderr, "Must be super user to use set subcommand\n");
|
||||
break;
|
||||
case ENXIO:
|
||||
fprintf(stderr, "%s is not an ATM interface\n", intf);
|
||||
break;
|
||||
case ENOENT:
|
||||
fprintf(stderr, "Signalling manager not attached\n");
|
||||
break;
|
||||
case ENOPROTOOPT:
|
||||
fprintf(stderr,
|
||||
"%s does not have an IP address configured\n",
|
||||
intf);
|
||||
break;
|
||||
default:
|
||||
perror("Ioctl (AIOCSET) ARPSERVER address");
|
||||
break;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
(void)close(s);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process set MAC address command
|
||||
*
|
||||
* Command format:
|
||||
* atm set mac <interface_name> <MAC address>
|
||||
*
|
||||
* Arguments:
|
||||
* argc number of remaining arguments to command
|
||||
* argv pointer to remaining argument strings
|
||||
* cmdp pointer to command description
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
set_macaddr(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||
{
|
||||
int s;
|
||||
char *intf;
|
||||
struct mac_addr mac;
|
||||
struct atmsetreq asr;
|
||||
|
||||
/*
|
||||
* Validate interface name
|
||||
*/
|
||||
if (strlen(argv[0]) > sizeof(asr.asr_mac_intf) - 1) {
|
||||
fprintf(stderr, "%s: Illegal interface name\n", prog);
|
||||
exit(1);
|
||||
}
|
||||
intf = argv[0];
|
||||
argc--; argv++;
|
||||
|
||||
/*
|
||||
* Get the MAC address provided by the user
|
||||
*/
|
||||
if (get_hex_atm_addr(argv[0], (u_char *)&mac, sizeof(mac)) !=
|
||||
sizeof(mac)) {
|
||||
fprintf(stderr, "%s: Invalid MAC address\n", prog);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build ioctl request
|
||||
*/
|
||||
asr.asr_opcode = AIOCS_SET_MAC;
|
||||
strncpy(asr.asr_mac_intf, intf, sizeof(asr.asr_mac_intf));
|
||||
bcopy(&mac, &asr.asr_mac_addr, sizeof(asr.asr_mac_addr));
|
||||
|
||||
/*
|
||||
* Pass the new address to the kernel
|
||||
*/
|
||||
s = socket(AF_ATM, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
sock_error(errno);
|
||||
}
|
||||
if (ioctl(s, AIOCSET, (caddr_t)&asr) < 0) {
|
||||
fprintf(stderr, "%s: ", prog);
|
||||
switch (errno) {
|
||||
case EOPNOTSUPP:
|
||||
case EPROTONOSUPPORT:
|
||||
perror("Internal error");
|
||||
break;
|
||||
case EADDRINUSE:
|
||||
fprintf(stderr, "Interface must be detached to set MAC addres\n");
|
||||
break;
|
||||
case EINVAL:
|
||||
fprintf(stderr, "Invalid parameter\n");
|
||||
break;
|
||||
case ENOMEM:
|
||||
fprintf(stderr, "Kernel memory exhausted\n");
|
||||
break;
|
||||
case ENETDOWN:
|
||||
fprintf(stderr, "ATM network is inoperable\n");
|
||||
break;
|
||||
case EPERM:
|
||||
fprintf(stderr, "Must be super user to use set subcommand\n");
|
||||
break;
|
||||
case ENXIO:
|
||||
fprintf(stderr, "%s is not an ATM device\n",
|
||||
argv[0]);
|
||||
break;
|
||||
default:
|
||||
perror("Ioctl (AIOCSET) MAC address");
|
||||
break;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
(void)close(s);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process network interface set command
|
||||
*
|
||||
* Command format:
|
||||
* atm set netif <interface_name> <prefix_name> <count>
|
||||
*
|
||||
* Arguments:
|
||||
* argc number of arguments to command
|
||||
* argv pointer to argument strings
|
||||
* cmdp pointer to command description
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
set_netif(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||
{
|
||||
struct atmsetreq anr;
|
||||
char str[16];
|
||||
char *cp;
|
||||
int s;
|
||||
u_long nifs;
|
||||
|
||||
/*
|
||||
* Set IOCTL opcode
|
||||
*/
|
||||
anr.asr_opcode = AIOCS_SET_NIF;
|
||||
|
||||
/*
|
||||
* Validate interface name
|
||||
*/
|
||||
if (strlen(argv[0]) > sizeof(anr.asr_nif_intf) - 1) {
|
||||
fprintf(stderr, "%s: Illegal interface name\n", prog);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(anr.asr_nif_intf, argv[0]);
|
||||
argc--; argv++;
|
||||
|
||||
/*
|
||||
* Validate network interface name prefix
|
||||
*/
|
||||
if ((strlen(argv[0]) > sizeof(anr.asr_nif_pref) - 1) ||
|
||||
(strpbrk(argv[0], "0123456789"))) {
|
||||
fprintf(stderr, "%s: Illegal network interface prefix\n", prog);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(anr.asr_nif_pref, argv[0]);
|
||||
argc--; argv++;
|
||||
|
||||
/*
|
||||
* Validate interface count
|
||||
*/
|
||||
errno = 0;
|
||||
nifs = strtoul(argv[0], &cp, 0);
|
||||
if (errno != 0 || *cp != '\0' || nifs > MAX_NIFS) {
|
||||
fprintf(stderr, "%s: Invalid interface count\n", prog);
|
||||
exit(1);
|
||||
}
|
||||
anr.asr_nif_cnt = nifs;
|
||||
|
||||
/*
|
||||
* Make sure the resulting name won't be too long
|
||||
*/
|
||||
sprintf(str, "%lu", nifs - 1);
|
||||
if ((strlen(str) + strlen(anr.asr_nif_pref)) >
|
||||
sizeof(anr.asr_nif_intf) - 1) {
|
||||
fprintf(stderr, "%s: Network interface prefix too long\n", prog);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tell the kernel to do it
|
||||
*/
|
||||
s = socket(AF_ATM, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
sock_error(errno);
|
||||
}
|
||||
if (ioctl(s, AIOCSET, (caddr_t)&anr) < 0) {
|
||||
fprintf(stderr, "%s: ", prog);
|
||||
perror("ioctl (AIOCSET) set NIF");
|
||||
exit(1);
|
||||
}
|
||||
(void)close(s);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process set NSAP prefix command
|
||||
*
|
||||
* Command format:
|
||||
* atm set nsap <interface_name> <NSAP prefix>
|
||||
*
|
||||
* Arguments:
|
||||
* argc number of remaining arguments to command
|
||||
* argv pointer to remaining argument strings
|
||||
* cmdp pointer to command description
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
set_prefix(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||
{
|
||||
int s;
|
||||
char *intf;
|
||||
u_char pfx[13];
|
||||
struct atmsetreq asr;
|
||||
|
||||
/*
|
||||
* Validate interface name
|
||||
*/
|
||||
if (strlen(argv[0]) > sizeof(asr.asr_prf_intf) - 1) {
|
||||
fprintf(stderr, "%s: Illegal interface name\n", prog);
|
||||
exit(1);
|
||||
}
|
||||
intf = argv[0];
|
||||
argc--; argv++;
|
||||
|
||||
/*
|
||||
* Get the prefix provided by the user
|
||||
*/
|
||||
if (get_hex_atm_addr(argv[0], pfx, sizeof(pfx)) != sizeof(pfx)) {
|
||||
fprintf(stderr, "%s: Invalid NSAP prefix\n", prog);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build ioctl request
|
||||
*/
|
||||
asr.asr_opcode = AIOCS_SET_PRF;
|
||||
strncpy(asr.asr_prf_intf, intf, sizeof(asr.asr_prf_intf));
|
||||
bcopy(pfx, asr.asr_prf_pref, sizeof(asr.asr_prf_pref));
|
||||
|
||||
/*
|
||||
* Pass the new prefix to the kernel
|
||||
*/
|
||||
s = socket(AF_ATM, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
sock_error(errno);
|
||||
}
|
||||
if (ioctl(s, AIOCSET, (caddr_t)&asr) < 0) {
|
||||
fprintf(stderr, "%s: ", prog);
|
||||
switch (errno) {
|
||||
case EOPNOTSUPP:
|
||||
case EPROTONOSUPPORT:
|
||||
perror("Internal error");
|
||||
break;
|
||||
case EALREADY:
|
||||
fprintf(stderr, "NSAP prefix is already set\n");
|
||||
break;
|
||||
case EINVAL:
|
||||
fprintf(stderr, "Invalid parameter\n");
|
||||
break;
|
||||
case ENOMEM:
|
||||
fprintf(stderr, "Kernel memory exhausted\n");
|
||||
break;
|
||||
case ENETDOWN:
|
||||
fprintf(stderr, "ATM network is inoperable\n");
|
||||
break;
|
||||
case EPERM:
|
||||
fprintf(stderr, "Must be super user to use set subcommand\n");
|
||||
break;
|
||||
case ENXIO:
|
||||
fprintf(stderr, "%s is not an ATM device\n",
|
||||
argv[0]);
|
||||
break;
|
||||
default:
|
||||
perror("Ioctl (AIOCSET) NSAP prefix");
|
||||
break;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
(void)close(s);
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,626 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User configuration and display program
|
||||
* --------------------------------------
|
||||
*
|
||||
* General subroutines
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <libatm.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "atm.h"
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Table entry definition
|
||||
*/
|
||||
typedef struct {
|
||||
int type;
|
||||
const char *name;
|
||||
} tbl_ent;
|
||||
|
||||
|
||||
/*
|
||||
* Table to translate vendor codes to ASCII
|
||||
*/
|
||||
static const tbl_ent vendors[] = {
|
||||
{ VENDOR_UNKNOWN, "Unknown" },
|
||||
{ VENDOR_FORE, "Fore" },
|
||||
{ VENDOR_ENI, "ENI" },
|
||||
{ VENDOR_IDT, "IDT" },
|
||||
{ VENDOR_PROSUM, "ProSum" },
|
||||
{ VENDOR_NETGRAPH, "Netgraph" },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Table to translate adapter codes to ASCII
|
||||
*/
|
||||
static const tbl_ent adapter_types[] = {
|
||||
{ DEV_UNKNOWN, "Unknown" },
|
||||
{ DEV_FORE_SBA200E, "SBA-200E" },
|
||||
{ DEV_FORE_SBA200, "SBA-200" },
|
||||
{ DEV_FORE_PCA200E, "PCA-200E" },
|
||||
{ DEV_FORE_ESA200E, "ESA-200E" },
|
||||
{ DEV_ENI_155P, "ENI-155p" },
|
||||
{ DEV_IDT_155, "IDT" },
|
||||
{ DEV_PROATM_25, "PROATM-25" },
|
||||
{ DEV_PROATM_155, "PROATM-155" },
|
||||
{ DEV_VATMPIF, "VATMPIF" },
|
||||
{ DEV_FORE_LE25, "ForeLE-25" },
|
||||
{ DEV_FORE_LE155, "ForeLE-155" },
|
||||
{ DEV_IDT_25, "NICStAR-25" },
|
||||
{ DEV_IDTABR_25, "IDT77252-25" },
|
||||
{ DEV_IDTABR_155, "IDT77252-155" },
|
||||
{ DEV_FORE_HE155, "ForeHE-155" },
|
||||
{ DEV_FORE_HE622, "ForeHE-622" },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Table to translate medium types to ASCII
|
||||
*/
|
||||
static const tbl_ent media_types[] = {
|
||||
{ MEDIA_UNKNOWN, "Unknown" },
|
||||
{ MEDIA_TAXI_100, "100 Mbps 4B/5B" },
|
||||
{ MEDIA_TAXI_140, "140 Mbps 4B/5B" },
|
||||
{ MEDIA_OC3C, "OC-3c" },
|
||||
{ MEDIA_OC12C, "OC-12c" },
|
||||
{ MEDIA_UTP155, "155 Mbps UTP" },
|
||||
{ MEDIA_UTP25, "25.6 Mbps UTP" },
|
||||
{ MEDIA_VIRTUAL, "Virtual Link" },
|
||||
{ MEDIA_DSL, "xDSL" },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Table to translate bus types to ASCII
|
||||
*/
|
||||
static const tbl_ent bus_types[] = {
|
||||
{ BUS_UNKNOWN, "Unknown" },
|
||||
{ BUS_SBUS_B16, "SBus" },
|
||||
{ BUS_SBUS_B32, "SBus" },
|
||||
{ BUS_PCI, "PCI" },
|
||||
{ BUS_EISA, "EISA" },
|
||||
{ BUS_USB, "USB" },
|
||||
{ BUS_VIRTUAL, "Virtual" },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Get interface vendor name
|
||||
*
|
||||
* Return a character string with a vendor name, given a vendor code.
|
||||
*
|
||||
* Arguments:
|
||||
* vendor vendor ID
|
||||
*
|
||||
* Returns:
|
||||
* char * pointer to a string with the vendor name
|
||||
*
|
||||
*/
|
||||
const char *
|
||||
get_vendor(int vendor)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; vendors[i].name; i++) {
|
||||
if (vendors[i].type == vendor)
|
||||
return(vendors[i].name);
|
||||
}
|
||||
|
||||
return("-");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get adapter type
|
||||
*
|
||||
* Arguments:
|
||||
* dev adapter code
|
||||
*
|
||||
* Returns:
|
||||
* char * pointer to a string with the adapter type
|
||||
*
|
||||
*/
|
||||
const char *
|
||||
get_adapter(int dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; adapter_types[i].name; i++) {
|
||||
if (adapter_types[i].type == dev)
|
||||
return(adapter_types[i].name);
|
||||
}
|
||||
|
||||
return("-");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get communication medium type
|
||||
*
|
||||
* Arguments:
|
||||
* media medium code
|
||||
*
|
||||
* Returns:
|
||||
* char * pointer to a string with the name of the medium
|
||||
*
|
||||
*/
|
||||
const char *
|
||||
get_media_type(int media)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; media_types[i].name; i++) {
|
||||
if (media_types[i].type == media)
|
||||
return(media_types[i].name);
|
||||
}
|
||||
|
||||
return("-");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get bus type
|
||||
*
|
||||
* Arguments:
|
||||
* bus bus type code
|
||||
*
|
||||
* Returns:
|
||||
* char * pointer to a string with the bus type
|
||||
*
|
||||
*/
|
||||
const char *
|
||||
get_bus_type(int bus)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; bus_types[i].name; i++) {
|
||||
if (bus_types[i].type == bus)
|
||||
return(bus_types[i].name);
|
||||
}
|
||||
|
||||
return("-");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get adapter ID
|
||||
*
|
||||
* Get a string giving the adapter's vendor and type.
|
||||
*
|
||||
* Arguments:
|
||||
* intf interface name
|
||||
*
|
||||
* Returns:
|
||||
* char * pointer to a string identifying the adapter
|
||||
*
|
||||
*/
|
||||
const char *
|
||||
get_adapter_name(const char *intf)
|
||||
{
|
||||
size_t buf_len;
|
||||
struct atminfreq air;
|
||||
struct air_cfg_rsp *cfg;
|
||||
static char name[256];
|
||||
|
||||
/*
|
||||
* Initialize
|
||||
*/
|
||||
bzero(&air, sizeof(air));
|
||||
bzero(name, sizeof(name));
|
||||
|
||||
/*
|
||||
* Get configuration information from the kernel
|
||||
*/
|
||||
air.air_opcode = AIOCS_INF_CFG;
|
||||
strcpy(air.air_cfg_intf, intf);
|
||||
buf_len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
|
||||
if (buf_len < sizeof(struct air_cfg_rsp))
|
||||
return("-");
|
||||
cfg = (struct air_cfg_rsp *)(void *)air.air_buf_addr;
|
||||
|
||||
/*
|
||||
* Build a string describing the adapter
|
||||
*/
|
||||
strcpy(name, get_vendor(cfg->acp_vendor));
|
||||
strcat(name, " ");
|
||||
strcat(name, get_adapter(cfg->acp_device));
|
||||
|
||||
free(cfg);
|
||||
|
||||
return(name);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Format a MAC address into a string
|
||||
*
|
||||
* Arguments:
|
||||
* addr pointer to a MAC address
|
||||
*
|
||||
* Returns:
|
||||
* the address of a string representing the MAC address
|
||||
*
|
||||
*/
|
||||
const char *
|
||||
format_mac_addr(const Mac_addr *addr)
|
||||
{
|
||||
static char str[256];
|
||||
|
||||
/*
|
||||
* Check for null pointer
|
||||
*/
|
||||
if (!addr)
|
||||
return("-");
|
||||
|
||||
/*
|
||||
* Clear the returned string
|
||||
*/
|
||||
bzero(str, sizeof(str));
|
||||
|
||||
/*
|
||||
* Format the address
|
||||
*/
|
||||
sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
addr->ma_data[0],
|
||||
addr->ma_data[1],
|
||||
addr->ma_data[2],
|
||||
addr->ma_data[3],
|
||||
addr->ma_data[4],
|
||||
addr->ma_data[5]);
|
||||
|
||||
return(str);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse an IP prefix designation in the form nnn.nnn.nnn.nnn/mm
|
||||
*
|
||||
* Arguments:
|
||||
* cp pointer to prefix designation string
|
||||
* op pointer to a pair of in_addrs for the result
|
||||
*
|
||||
* Returns:
|
||||
* 0 success
|
||||
* -1 prefix was invalid
|
||||
*
|
||||
*/
|
||||
int
|
||||
parse_ip_prefix(const char *cp, struct in_addr *op)
|
||||
{
|
||||
int len;
|
||||
char *mp;
|
||||
struct in_addr ip_addr;
|
||||
|
||||
static u_long masks[33] = {
|
||||
0x0,
|
||||
0x80000000,
|
||||
0xc0000000,
|
||||
0xe0000000,
|
||||
0xf0000000,
|
||||
0xf8000000,
|
||||
0xfc000000,
|
||||
0xfe000000,
|
||||
0xff000000,
|
||||
0xff800000,
|
||||
0xffc00000,
|
||||
0xffe00000,
|
||||
0xfff00000,
|
||||
0xfff80000,
|
||||
0xfffc0000,
|
||||
0xfffe0000,
|
||||
0xffff0000,
|
||||
0xffff8000,
|
||||
0xffffc000,
|
||||
0xffffe000,
|
||||
0xfffff000,
|
||||
0xfffff800,
|
||||
0xfffffc00,
|
||||
0xfffffe00,
|
||||
0xffffff00,
|
||||
0xffffff80,
|
||||
0xffffffc0,
|
||||
0xffffffe0,
|
||||
0xfffffff0,
|
||||
0xfffffff8,
|
||||
0xfffffffc,
|
||||
0xfffffffe,
|
||||
0xffffffff
|
||||
};
|
||||
|
||||
/*
|
||||
* Find the slash that marks the start of the mask
|
||||
*/
|
||||
mp = strchr(cp, '/');
|
||||
if (mp) {
|
||||
*mp = '\0';
|
||||
mp++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert the IP-address part of the prefix
|
||||
*/
|
||||
ip_addr.s_addr = inet_addr(cp);
|
||||
if (ip_addr.s_addr == INADDR_NONE)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* Set the default mask length
|
||||
*/
|
||||
if (IN_CLASSA(ntohl(ip_addr.s_addr)))
|
||||
len = 8;
|
||||
else if (IN_CLASSB(ntohl(ip_addr.s_addr)))
|
||||
len = 16;
|
||||
else if (IN_CLASSC(ntohl(ip_addr.s_addr)))
|
||||
len = 24;
|
||||
else
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* Get the mask length
|
||||
*/
|
||||
if (mp) {
|
||||
len = atoi(mp);
|
||||
if (len < 1 || len > 32)
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Select the mask and copy the IP address into the
|
||||
* result buffer, ANDing it with the mask
|
||||
*/
|
||||
op[1].s_addr = htonl(masks[len]);
|
||||
op[0].s_addr = ip_addr.s_addr & op[1].s_addr;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Compress a list of IP network prefixes
|
||||
*
|
||||
* Arguments:
|
||||
* ipp pointer to list of IP address/mask pairs
|
||||
* ipc length of list
|
||||
*
|
||||
* Returns:
|
||||
* length of compressed list
|
||||
*
|
||||
*/
|
||||
size_t
|
||||
compress_prefix_list(struct in_addr *ipp, size_t ilen)
|
||||
{
|
||||
u_int i, j, n;
|
||||
struct in_addr *ip1, *ip2, *m1, *m2;
|
||||
|
||||
/*
|
||||
* Figure out how many pairs there are
|
||||
*/
|
||||
n = ilen / (sizeof(struct in_addr) * 2);
|
||||
|
||||
/*
|
||||
* Check each pair of address/mask pairs to make sure
|
||||
* none contains the other
|
||||
*/
|
||||
for (i = 0; i < n; i++) {
|
||||
ip1 = &ipp[i*2];
|
||||
m1 = &ipp[i*2+1];
|
||||
|
||||
/*
|
||||
* If we've already eliminated this address,
|
||||
* skip the checks
|
||||
*/
|
||||
if (ip1->s_addr == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Try all possible second members of the pair
|
||||
*/
|
||||
for (j = i + 1; j < n; j++) {
|
||||
ip2 = &ipp[j*2];
|
||||
m2 = &ipp[j*2+1];
|
||||
|
||||
/*
|
||||
* If we've already eliminated the second
|
||||
* address, just skip the checks
|
||||
*/
|
||||
if (ip2->s_addr == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Compare the address/mask pairs
|
||||
*/
|
||||
if (m1->s_addr == m2->s_addr) {
|
||||
/*
|
||||
* Masks are equal
|
||||
*/
|
||||
if (ip1->s_addr == ip2->s_addr) {
|
||||
ip2->s_addr = 0;
|
||||
m2->s_addr = 0;
|
||||
}
|
||||
} else if (ntohl(m1->s_addr) <
|
||||
ntohl(m2->s_addr)) {
|
||||
/*
|
||||
* m1 is shorter
|
||||
*/
|
||||
if ((ip2->s_addr & m1->s_addr) ==
|
||||
ip1->s_addr) {
|
||||
ip2->s_addr = 0;
|
||||
m2->s_addr = 0;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* m1 is longer
|
||||
*/
|
||||
if ((ip1->s_addr & m2->s_addr) ==
|
||||
ip2->s_addr) {
|
||||
ip1->s_addr = 0;
|
||||
m1->s_addr = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now pull up the list, eliminating zeroed entries
|
||||
*/
|
||||
for (i = 0, j = 0; i < n; i++) {
|
||||
ip1 = &ipp[i*2];
|
||||
m1 = &ipp[i*2+1];
|
||||
ip2 = &ipp[j*2];
|
||||
m2 = &ipp[j*2+1];
|
||||
if (ip1->s_addr != 0) {
|
||||
if (i != j) {
|
||||
*ip2 = *ip1;
|
||||
*m2 = *m1;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
return(j * sizeof(struct in_addr) * 2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Make sure a user-supplied parameter is a valid network interface
|
||||
* name
|
||||
*
|
||||
* When a socket call fails, print an error message and exit
|
||||
*
|
||||
* Arguments:
|
||||
* nif pointer to network interface name
|
||||
*
|
||||
* Returns:
|
||||
* none exits if name is not valid
|
||||
*
|
||||
*/
|
||||
void
|
||||
check_netif_name(const char *nif)
|
||||
{
|
||||
int rc;
|
||||
|
||||
/*
|
||||
* Look up the name in the kernel
|
||||
*/
|
||||
rc = verify_nif_name(nif);
|
||||
|
||||
/*
|
||||
* Check the result
|
||||
*/
|
||||
if (rc > 0) {
|
||||
/*
|
||||
* Name is OK
|
||||
*/
|
||||
return;
|
||||
} else if (rc == 0) {
|
||||
/*
|
||||
* Name is not valid
|
||||
*/
|
||||
fprintf(stderr, "%s: Invalid network interface name %s\n",
|
||||
prog, nif);
|
||||
} else {
|
||||
/*
|
||||
* Error performing IOCTL
|
||||
*/
|
||||
fprintf(stderr, "%s: ", prog);
|
||||
switch(errno) {
|
||||
case ENOPROTOOPT:
|
||||
case EOPNOTSUPP:
|
||||
perror("Internal error");
|
||||
break;
|
||||
case ENXIO:
|
||||
fprintf(stderr, "%s is not an ATM device\n",
|
||||
nif);
|
||||
break;
|
||||
default:
|
||||
perror("ioctl (AIOCINFO)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Socket error handler
|
||||
*
|
||||
* When a socket call fails, print an error message and exit
|
||||
*
|
||||
* Arguments:
|
||||
* err an errno describing the error
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
sock_error(int err)
|
||||
{
|
||||
fprintf(stderr, "%s: ", prog);
|
||||
|
||||
switch (err) {
|
||||
|
||||
case EPROTONOSUPPORT:
|
||||
fprintf(stderr, "ATM protocol support not loaded\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
perror("socket");
|
||||
break;
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
$FreeBSD$
|
||||
|
||||
This copyright applies to the microcode image in the file pca200e.c.
|
||||
|
||||
(Copyright Notice)
|
||||
|
||||
Copyright (c) 1995-2000 FORE Systems, Inc., as an unpublished work.
|
||||
|
||||
This notice does not imply unrestricted or public access to these
|
||||
materials which are a trade secret of FORE Systems, Inc. or its
|
||||
subsidiaries or affiliates (together referred to as "FORE"), and
|
||||
which may not be reproduced, used, sold or transferred to any third
|
||||
party without FORE's prior written consent. All rights reserved.
|
||||
|
||||
U.S. Government Restricted Rights.
|
||||
|
||||
If you are licensing the Software on behalf of the U.S. Government
|
||||
("Government"), the following provisions apply to you. If the
|
||||
software is supplied to the Department of Defense ("DoD"), it is
|
||||
classified as "Commercial Computer Software" under paragraph
|
||||
252.227-7014 of the DoD Supplement to the Federal Acquisition
|
||||
Regulations ("DFARS") (or any successor regulations) and the
|
||||
Government is acquiring only the license rights granted herein (the
|
||||
license rights customarily provided to non-Government users). If
|
||||
the Software is supplied to any unit or agency of the Government
|
||||
other than the DoD, it is classified as "Restricted Computer
|
||||
Software" and the Government's rights in the Software are defined
|
||||
in paragraph 52.227-19 of the Federal Acquisition Regulations
|
||||
("FAR") (or any successor regulations) or, in the cases of NASA,
|
||||
in paragraph 18.52.227-86 of the NASA Supplement to the FAR (or
|
||||
any successor regulations).
|
||||
|
||||
FORE Systems is a registered trademark, and ForeRunner, ForeRunnerLE,
|
||||
and ForeThought are trademarks of FORE Systems, Inc. All other
|
||||
brands or product names are trademarks or registered trademarks of
|
||||
their respective holders.
|
||||
|
||||
(End Copyright Notice)
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
# ===================================
|
||||
# HARP | Host ATM Research Platform
|
||||
# ===================================
|
||||
#
|
||||
# This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
# made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
# "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
# support of any kind.
|
||||
#
|
||||
# NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
# INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
# SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
# In no event shall NetworkCS be responsible for any damages, including
|
||||
# but not limited to consequential damages, arising from or relating to
|
||||
# any use of the Software or related support.
|
||||
#
|
||||
# Copyright 1994-1998 Network Computing Services, Inc.
|
||||
#
|
||||
# Copies of this Software may be made, however, the above copyright
|
||||
# notice must be reproduced on all copies.
|
||||
#
|
||||
# @(#) $Id: Makefile,v 1.5 1998/07/10 16:01:58 jpt Exp $
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= fore_dnld
|
||||
MAN= fore_dnld.8
|
||||
SRCS= fore_dnld.c pca200e.c
|
||||
|
||||
WARNS?= 6
|
||||
CFLAGS+= -I${.CURDIR}/../../../sys
|
||||
|
||||
DPADD= ${LIBATM}
|
||||
LDADD= -latm
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
.\"
|
||||
.\" ===================================
|
||||
.\" HARP | Host ATM Research Platform
|
||||
.\" ===================================
|
||||
.\"
|
||||
.\"
|
||||
.\" This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
.\" made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
.\" "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
.\" support of any kind.
|
||||
.\"
|
||||
.\" NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
.\" INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
.\" AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
.\" SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
.\" In no event shall NetworkCS be responsible for any damages, including
|
||||
.\" but not limited to consequential damages, arising from or relating to
|
||||
.\" any use of the Software or related support.
|
||||
.\"
|
||||
.\" Copyright 1994-1998 Network Computing Services, Inc.
|
||||
.\"
|
||||
.\" Copies of this Software may be made, however, the above copyright
|
||||
.\" notice must be reproduced on all copies.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 3, 1996
|
||||
.Dt FORE_DNLD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm fore_dnld
|
||||
.Nd "download FORE Systems' microcode into host ATM adapter"
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl 3
|
||||
.Op Fl i Ar intf
|
||||
.Op Fl d Ar path
|
||||
.Op Fl f Ar objfile
|
||||
.Op Fl r
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility downloads FORE Systems' microcode into the host ATM adapter(s).
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width indent
|
||||
.It Fl i Ar intf
|
||||
Specify which ATM interface to download microcode to.
|
||||
Default is to load microcode into all FORE Systems host adapters.
|
||||
.It Fl d Ar path
|
||||
Specify the path to prepend to the
|
||||
.Ar objfile
|
||||
name.
|
||||
Default is to use current directory.
|
||||
.It Fl f Ar objfile
|
||||
Specify the microcode binary file.
|
||||
Defaults are:
|
||||
.Pa sba200.obj
|
||||
for SBA-200 adapters,
|
||||
.Pa sba200e.obj
|
||||
for SBA-200E adapters, and
|
||||
.Pa pca200e.bin
|
||||
for PCA-200E adapters.
|
||||
.El
|
||||
.Sh NOTES
|
||||
For the PCA200E adapter, if no file is specified on the command
|
||||
line a built-in copy of version 4.1.12 microcode is used.
|
||||
When the
|
||||
option
|
||||
.Fl 3
|
||||
is specified version 3.0.1 microcode is used instead.
|
||||
.Pp
|
||||
Microcode as distributed by FORE Systems is not ready for downloading
|
||||
directly into SBA host ATM adapters.
|
||||
Instead, the supplied microcode needs
|
||||
to be processed with the
|
||||
.Xr objcopy 1
|
||||
command to create an image suitable
|
||||
for downloading.
|
||||
Arguments to
|
||||
.Xr objcopy 1
|
||||
are
|
||||
.Dq Li "-S -l -Fcoff" .
|
||||
.Pp
|
||||
Microcode as
|
||||
distributed by FORE Systems for the PCA host ATM adapter does not need
|
||||
to be processed.
|
||||
.Sh FILES
|
||||
.Bl -tag -width indent
|
||||
.It Pa ~fore/etc/objcopy
|
||||
command to process FORE Systems supplied microcode.
|
||||
.It Pa ~fore/etc/sba200*.ucode*
|
||||
microcode as supplied by FORE Systems for SBA
|
||||
adapters.
|
||||
.It Pa ~fore/i386/pca200e.bin
|
||||
microcode as supplied by FORE Systems for PCA
|
||||
adapters.
|
||||
.It Pa ~harp/doc/Install
|
||||
HARP installation instructions.
|
||||
.El
|
||||
.Sh COPYRIGHT
|
||||
Copyright (c) 1994-1998, Network Computing Services, Inc.
|
||||
.Sh AUTHORS
|
||||
.An John Cavanaugh ,
|
||||
Minnesota Supercomputer Center, Inc.
|
||||
.An Mike Spengler ,
|
||||
Minnesota Supercomputer Center, Inc.
|
||||
.An Joe Thomas ,
|
||||
Minnesota Supercomputer Center, Inc.
|
||||
.Sh ACKNOWLEDGMENTS
|
||||
This software was developed under the sponsorship of the
|
||||
Defense Advanced Research Projects Agency (DARPA) under
|
||||
contract numbers F19628-92-C-0072 and F19628-95-C-0215.
|
||||
.Sh BUGS
|
||||
None known.
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,40 +0,0 @@
|
|||
# ===================================
|
||||
# HARP | Host ATM Research Platform
|
||||
# ===================================
|
||||
#
|
||||
# This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
# made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
# "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
# support of any kind.
|
||||
#
|
||||
# NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
# INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
# SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
# In no event shall NetworkCS be responsible for any damages, including
|
||||
# but not limited to consequential damages, arising from or relating to
|
||||
# any use of the Software or related support.
|
||||
#
|
||||
# Copyright 1994-1998 Network Computing Services, Inc.
|
||||
#
|
||||
# Copies of this Software may be made, however, the above copyright
|
||||
# notice must be reproduced on all copies.
|
||||
#
|
||||
# @(#) $Id: Makefile,v 1.5 1998/07/10 16:01:58 jpt Exp $
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= ilmid
|
||||
MAN= ilmid.8
|
||||
|
||||
.if ${MACHINE_ARCH} == "arm"
|
||||
WARNS?= 3
|
||||
.else
|
||||
WARNS?= 6
|
||||
.endif
|
||||
|
||||
CFLAGS+= -I${.CURDIR}/../../../sys
|
||||
|
||||
DPADD= ${LIBATM}
|
||||
LDADD= -latm
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
.\"
|
||||
.\" ===================================
|
||||
.\" HARP | Host ATM Research Platform
|
||||
.\" ===================================
|
||||
.\"
|
||||
.\"
|
||||
.\" This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
.\" made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
.\" "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
.\" support of any kind.
|
||||
.\"
|
||||
.\" NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
.\" INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
.\" AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
.\" SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
.\" In no event shall NetworkCS be responsible for any damages, including
|
||||
.\" but not limited to consequential damages, arising from or relating to
|
||||
.\" any use of the Software or related support.
|
||||
.\"
|
||||
.\" Copyright 1994-1998 Network Computing Services, Inc.
|
||||
.\"
|
||||
.\" Copies of this Software may be made, however, the above copyright
|
||||
.\" notice must be reproduced on all copies.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 14, 1998
|
||||
.Dt ILMID 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ilmid
|
||||
.Nd "simple ILMI ATM address registration daemon"
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl d Ar level
|
||||
.Op Fl f
|
||||
.Op Fl r
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility is a HARP ATM daemon that performs the ILMI ATM address registration
|
||||
procedures with an ATM network switch.
|
||||
It is normally invoked at boot time
|
||||
from the ATM startup script.
|
||||
.Pp
|
||||
For each ATM interface with a UNI signalling manager attached,
|
||||
.Nm
|
||||
will open an ILMI PVC (VPI = 0, VCI = 16) and register the interface's
|
||||
ATM address with the switch.
|
||||
As part of the address registration procedure,
|
||||
the ATM switch will notify the endsystem (local host) of the
|
||||
.Dq "network prefix"
|
||||
portion of the endsystem's ATM address and
|
||||
.Nm
|
||||
will notify the switch of the endsystem's
|
||||
.Dq "user part"
|
||||
of its address
|
||||
(typically the interface card MAC address).
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width indent
|
||||
.It Fl d Ar level
|
||||
Specify the debug level for optional protocol tracing.
|
||||
Messages are
|
||||
written to
|
||||
.Pa /var/log/ilmid .
|
||||
.It Fl f
|
||||
Causes
|
||||
.Nm
|
||||
to run in the foreground.
|
||||
.It Fl r
|
||||
Causes
|
||||
.Nm
|
||||
to issue a coldStart TRAP on all ATM interfaces it is able to open and exit.
|
||||
.El
|
||||
.Sh NOTES
|
||||
This daemon does not fully conform to the ATM Forum ILMI specifications.
|
||||
In particular, it
|
||||
does not make any queries of the network side to ensure
|
||||
that the ATM Address table is empty.
|
||||
It also does not implement any
|
||||
of the ATM Forum MIB that is specified as part of ILMI.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
utility will increment the debug level when it receives a
|
||||
.Dv SIGUSR1
|
||||
signal and will
|
||||
decrement the debug level when it receives a
|
||||
.Dv SIGUSR2
|
||||
signal.
|
||||
.Sh SEE ALSO
|
||||
The ATM Forum,
|
||||
.%T "ATM User-Network Interface, Version 3.1 (UNI 3.1) Specification"
|
||||
for details on the ILMI protocols and address registration
|
||||
procedures.
|
||||
.Sh COPYRIGHT
|
||||
Copyright (c) 1994-1998, Network Computing Services, Inc.
|
||||
.Sh AUTHORS
|
||||
.An John Cavanaugh ,
|
||||
Network Computing Services, Inc.
|
||||
.An Mike Spengler ,
|
||||
Network Computing Services, Inc.
|
||||
.An Joseph Thomas ,
|
||||
Network Computing Services, Inc.
|
||||
.Sh ACKNOWLEDGMENTS
|
||||
This software was developed with the support of the
|
||||
Defense Advanced Research Projects Agency (DARPA).
|
||||
.Sh BUGS
|
||||
Please report any bugs to
|
||||
.Aq harp\-bugs@magic.net .
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -34,9 +34,6 @@ LDIRS= BSD_daemon \
|
|||
startslip \
|
||||
sunrpc
|
||||
|
||||
# Disabled in 7.0 as netatm is not MPSAFE.
|
||||
#LDIRS+= atm
|
||||
|
||||
XFILES= BSD_daemon/FreeBSD.pfa \
|
||||
BSD_daemon/README \
|
||||
BSD_daemon/beastie.eps \
|
||||
|
|
@ -239,17 +236,6 @@ XFILES= BSD_daemon/FreeBSD.pfa \
|
|||
sunrpc/sort/sort.x \
|
||||
sunrpc/sort/sort_proc.c
|
||||
|
||||
# Disabled in 7.0 as netatm is not MPSAFE.
|
||||
#XFILES+= atm/NOTES \
|
||||
# atm/README \
|
||||
# atm/Startup \
|
||||
# atm/atm-config.sh \
|
||||
# atm/atm-sockets.txt \
|
||||
# atm/cpcs-design.txt \
|
||||
# atm/fore-microcode.txt \
|
||||
# atm/sscf-design.txt \
|
||||
# atm/sscop-design.txt
|
||||
|
||||
BINDIR= ${SHAREDIR}/examples
|
||||
|
||||
NO_OBJ=
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
HARP Notes
|
||||
1998-09-14
|
||||
|
||||
This is a list of currently known incompatibilities and miscellaneous gotchas
|
||||
in HARP.
|
||||
|
||||
To report new items, please send mail to harp-bugs@magic.net.
|
||||
|
||||
================================================================================
|
||||
|
||||
|
||||
Efficient Driver and DMA sizes
|
||||
==============================
|
||||
|
||||
The Efficient adapter moves PDUs between host memory and adapter memory with
|
||||
the help of DMA descriptor lists. Each DMA descriptor consists of two words.
|
||||
Word 0 contains a DMA type identifier and a repetition count. Word 1 contains
|
||||
the physical (not virtual) host buffer address. Each DMA type is really an
|
||||
encoding of the burst size for the DMA. (See /usr/src/sys/dev/hea/eni.h for
|
||||
more on the DMA types.) HARP was originally developed using burst sizes of
|
||||
8_WORD, 4_WORD, and 1_WORD sizes. Each DMA request would be built to first
|
||||
move as much data as possible using an 8_WORD burst. This should leave 0-7
|
||||
words left over. If there were more than 3 words remaining, a 4_WORD DMA burst
|
||||
would be scheduled. The remaining data must then be 0-3 words in length and
|
||||
would be moved with 1_WORD bursts. The use of large burst sizes makes more
|
||||
efficient use of DMA by performing the same amount of work in fewer cycles.
|
||||
|
||||
Several users have reported problems with DMA which were characterized by error
|
||||
messages of the form:
|
||||
|
||||
"eni_output: Transmit drain queue is full. Resources will be lost."
|
||||
or
|
||||
"eni_output: not enough room in DMA queue".
|
||||
|
||||
It was determined that these systems do not support the use of four- or
|
||||
eight-word DMA bursts. To resolve this problem, HARP now #ifdef's around the
|
||||
8_WORD and 4_WORD DMA setup and #undef's both values by default. This results
|
||||
in the default operation of the Efficient driver to use only 1_WORD DMA bursts.
|
||||
|
||||
If you wish to experiment with larger DMA bursts, you can edit the file
|
||||
/usr/src/sys/dev/hea/eni_transmit.c and change the #undef to a #define for
|
||||
DMA_USE_8WORD and/or DMA_USE_4WORD. You will need to rebuild and install your
|
||||
kernel for this change to take effect.
|
||||
|
||||
We are exploring solutions which would allow HARP to determine which DMA bursts
|
||||
are supported by the system at run-time. This would allow the Efficient device
|
||||
driver to make use of larger, more efficient burst sizes where supported
|
||||
without halting on systems which can't support the larger sizes.
|
||||
|
||||
|
||||
|
||||
@(#) $FreeBSD$
|
||||
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
|
||||
===================================
|
||||
HARP | Host ATM Research Platform
|
||||
===================================
|
||||
|
||||
HARP 3
|
||||
|
||||
|
||||
What is this stuff?
|
||||
-------------------
|
||||
The Advanced Networking Group (ANG) at the Minnesota Supercomputer Center,
|
||||
Inc. (MSCI), as part of its work on the MAGIC Gigabit Testbed, developed
|
||||
the Host ATM Research Platform (HARP) software, which allows IP hosts to
|
||||
communicate over ATM networks using standard protocols. It is intended to
|
||||
be a high-quality platform for IP/ATM research.
|
||||
|
||||
HARP provides a way for IP hosts to connect to ATM networks. It supports
|
||||
standard methods of communication using IP over ATM. A host's standard IP
|
||||
software sends and receives datagrams via a HARP ATM interface. HARP provides
|
||||
functionality similar to (and typically replaces) vendor-provided ATM device
|
||||
driver software.
|
||||
|
||||
HARP includes full source code, making it possible for researchers to
|
||||
experiment with different approaches to running IP over ATM. HARP is
|
||||
self-contained; it requires no other licenses or commercial software packages.
|
||||
|
||||
HARP implements support for the IETF Classical IP model for using IP over ATM
|
||||
networks, including:
|
||||
|
||||
o IETF ATMARP address resolution client
|
||||
o IETF ATMARP address resolution server
|
||||
o IETF SCSP/ATMARP server
|
||||
o UNI 3.1 and 3.0 signalling protocols
|
||||
o Fore Systems's SPANS signalling protocol
|
||||
|
||||
|
||||
|
||||
What's supported
|
||||
----------------
|
||||
The following are supported by HARP 3:
|
||||
|
||||
o ATM Host Interfaces
|
||||
- FORE Systems, Inc. SBA-200 and SBA-200E ATM SBus Adapters
|
||||
- FORE Systems, Inc. PCA-200E ATM PCI Adapters
|
||||
- Efficient Networks, Inc. ENI-155p ATM PCI Adapters
|
||||
|
||||
o ATM Signalling Protocols
|
||||
- The ATM Forum UNI 3.1 signalling protocol
|
||||
- The ATM Forum UNI 3.0 signalling protocol
|
||||
- The ATM Forum ILMI address registration
|
||||
- FORE Systems's proprietary SPANS signalling protocol
|
||||
- Permanent Virtual Channels (PVCs)
|
||||
|
||||
o IETF "Classical IP and ARP over ATM" model
|
||||
- RFC 1483, "Multiprotocol Encapsulation over ATM Adaptation Layer 5"
|
||||
- RFC 1577, "Classical IP and ARP over ATM"
|
||||
- RFC 1626, "Default IP MTU for use over ATM AAL5"
|
||||
- RFC 1755, "ATM Signaling Support for IP over ATM"
|
||||
- RFC 2225, "Classical IP and ARP over ATM"
|
||||
- RFC 2334, "Server Cache Synchronization Protocol (SCSP)"
|
||||
- Internet Draft draft-ietf-ion-scsp-atmarp-00.txt,
|
||||
"A Distributed ATMARP Service Using SCSP"
|
||||
|
||||
o ATM Sockets interface
|
||||
- The file atm-sockets.txt contains further information
|
||||
|
||||
|
||||
What's not supported
|
||||
--------------------
|
||||
The following major features of the above list are not currently supported:
|
||||
|
||||
o UNI point-to-multipoint support
|
||||
o Driver support for Traffic Control/Quality of Service
|
||||
o SPANS multicast and MPP support
|
||||
o SPANS signalling using Efficient adapters
|
||||
|
||||
|
||||
For further information
|
||||
-----------------------
|
||||
For additional information about HARP, please see:
|
||||
|
||||
http://www.msci.magic.net
|
||||
|
||||
|
||||
Suggestions and Problem Reports
|
||||
-------------------------------
|
||||
While HARP is made available "as is" and is not supported, ANG is continuing
|
||||
development of HARP. We welcome suggestions for new or enhanced features,
|
||||
summaries of your experience with HARP, as well as reports of problems which
|
||||
you may experience. Feel free to contact us at harp-bugs@magic.net.
|
||||
|
||||
ANG is maintaining a mail list of those who wish to share their experiences
|
||||
with HARP, learn of others' experiences, or receive information about future
|
||||
releases of HARP. The HARP mailing list is at harp@magic.net. To be added
|
||||
to the list, send email to harp-request@magic.net.
|
||||
|
||||
|
||||
Acknowledgments
|
||||
---------------
|
||||
This software was developed under the sponsorship of the Defense Advanced
|
||||
Research Projects Agency (DARPA).
|
||||
|
||||
|
||||
Citing HARP
|
||||
-----------
|
||||
When citing HARP in published works, please use the following citation:
|
||||
|
||||
Host ATM Research Platform (HARP), Network Computing Services, Inc.
|
||||
This software was developed with the support of the Defense Advanced
|
||||
Research Projects Agency (DARPA).
|
||||
|
||||
|
||||
Copyright and Permitted Use
|
||||
---------------------------
|
||||
The Host ATM Research Platform ("HARP") software (the "Software") is
|
||||
made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
"AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
support of any kind.
|
||||
|
||||
NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
In no event shall NetworkCS be responsible for any damages, including
|
||||
but not limited to consequential damages, arising from or relating to
|
||||
any use of the Software or related support.
|
||||
|
||||
Copyright 1994-1998 Network Computing Services, Inc.
|
||||
|
||||
Copies of this Software may be made, however, the above copyright
|
||||
notice must be reproduced on all copies.
|
||||
|
||||
Portions of this Software include materials copyrighted by the Regents of
|
||||
the University of California and by Sun Microsystems, Inc. The applicable
|
||||
copyright notices are reproduced in the files where the material appears.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@(#) $FreeBSD$
|
||||
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
HARP ATM Startup Configuration Instructions
|
||||
===========================================
|
||||
|
||||
The following steps are required in order to use the HARP ATM software.
|
||||
See the file atm-config.sh for an example ATM startup script.
|
||||
|
||||
1. Each ATM physical interface must be configured with one or more network
|
||||
interfaces. The physical interfaces are named:
|
||||
|
||||
FORE Systems: hfa0, hfa1, ...
|
||||
Efficient Networks: hea0, hea1, ...
|
||||
|
||||
The network interface names and the number of network interfaces for a
|
||||
particular physical interface are specified via the atm command. The
|
||||
network interface name prefix may be any alphabetic string, but the
|
||||
generated network interface names must be unique amongst all network
|
||||
interfaces, including non-ATM interfaces.
|
||||
|
||||
To configure the network interfaces, type:
|
||||
|
||||
atm set netif <interface_name> <netif_prefix> <netif_count>
|
||||
|
||||
For example, the command:
|
||||
|
||||
atm set netif hfa0 ni 3
|
||||
|
||||
will generate the network interfaces ni0, ni1 and ni2 on the physical
|
||||
interface hfa0.
|
||||
|
||||
For further details, see the man page atm(8).
|
||||
|
||||
|
||||
2. Each ATM network interface (netif) must be configured with an IP network
|
||||
address. Each network interface must be on a different IP subnet.
|
||||
|
||||
To configure the network interface, type:
|
||||
|
||||
ifconfig <netif_name> <IP_address> up
|
||||
|
||||
|
||||
3. Each ATM physical interface must have a signalling manager attached. The
|
||||
interfaces may have the same or different signalling managers.
|
||||
|
||||
To attach a signalling manager, type:
|
||||
|
||||
atm attach <interface_name> <signalling_manager_name>
|
||||
|
||||
where <signalling_manager_name> may be:
|
||||
|
||||
sigpvc - to only support PVCs on the interface;
|
||||
spans - to run FORE Systems SPANS signalling protocol across
|
||||
the interface, plus support of PVCs;
|
||||
uni30 - to run ATM Forum UNI 3.0 signalling protocol across
|
||||
the interface, plus support of PVCs;
|
||||
uni31 - to run ATM Forum UNI 3.1 signalling protocol across
|
||||
the interface, plus support of PVCs;
|
||||
|
||||
For further details, see the man page atm(8).
|
||||
|
||||
|
||||
4. Each of the host's PVCs (if any) must be defined.
|
||||
|
||||
To define a PVC, type:
|
||||
|
||||
atm add pvc <interface_name> <vpi> <vci> <aal> <encaps> <owner> ....
|
||||
|
||||
where <interface_name> is the name of the ATM physical interface
|
||||
over which the PVC is being defined;
|
||||
<vpi> is the VPI value for the PVC;
|
||||
<vci> is the VCI value for the PVC;
|
||||
<aal> is the AAL type which the PVC endpoints will use;
|
||||
<encaps> is the encapsulation which the PVC endpoints will use;
|
||||
<owner> specifies the the owner of the PVC, which may be:
|
||||
ip - the PVC is used for IP traffic;
|
||||
|
||||
additional parameters may be required, depending on the PVC owner:
|
||||
|
||||
for owner=ip,
|
||||
<netif_name> is the name of the PVC's network interface;
|
||||
<dst> specifies the IP address at the remote end of this PVC;
|
||||
|
||||
For further details, see the man page atm(8).
|
||||
|
||||
|
||||
5. HARP includes an ILMI daemon, which will perform host address registration
|
||||
with the ATM switch for ATM Forum UNI interfaces. If ILMI support is
|
||||
available and activated in the ATM switch and the ILMI daemon is running
|
||||
(see ilmid(8)), no further registration procedures are required.
|
||||
The 'atm set prefix' command is not needed in this case.
|
||||
|
||||
If ILMI address registration support is not available or activated, then
|
||||
the host must be manually registered with its switch. There should be
|
||||
a user command available on the switch in order to do the registration.
|
||||
|
||||
For example, if you are using a FORE Systems switch, you should enter
|
||||
the following AMI command:
|
||||
|
||||
> conf nsap route new <host_nsap> 152 <switch_port> 0
|
||||
|
||||
If you are using a Cisco LightStream 1010 switch, you would use the
|
||||
following configuration command:
|
||||
|
||||
> atm route <host_nsap> atm <atm_interface_#> internal
|
||||
|
||||
For ATM Forum UNI interfaces, the 'atm set prefix' command must also
|
||||
be issued when not using ILMI address registration.
|
||||
|
||||
|
||||
6. HARP includes support for the Server Cache Synchronization Protocol (SCSP),
|
||||
which can synchronize the ATMARP caches of multiple ATMARP servers.
|
||||
Obviously, this is only useful on hosts which are ATMARP servers.
|
||||
|
||||
To run SCSP between servers, two daemons, scspd and atmarpd, must be
|
||||
started. Scspd implements the SCSP protocol and atmarpd provides an
|
||||
interface between scspd and the ATMARP server in the kernel. Scspd
|
||||
requires a configuration file. It will look for a configuration
|
||||
file at /etc/scspd.conf unless told otherwise.
|
||||
|
||||
An example of commands to start the two daemons is:
|
||||
|
||||
# scspd
|
||||
# atmarpd <netif>
|
||||
|
||||
See the man pages scspd(8) and atmarpd(8) for further information.
|
||||
|
||||
@(#) $FreeBSD$
|
||||
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
#
|
||||
# ===================================
|
||||
# HARP | Host ATM Research Platform
|
||||
# ===================================
|
||||
#
|
||||
#
|
||||
# This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
# made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
# "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
# support of any kind.
|
||||
#
|
||||
# NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
# INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
# SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
# In no event shall NetworkCS be responsible for any damages, including
|
||||
# but not limited to consequential damages, arising from or relating to
|
||||
# any use of the Software or related support.
|
||||
#
|
||||
# Copyright 1994-1998 Network Computing Services, Inc.
|
||||
#
|
||||
# Copies of this Software may be made, however, the above copyright
|
||||
# notice must be reproduced on all copies.
|
||||
#
|
||||
# @(#) $FreeBSD$
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# Sample script to load and configure ATM software
|
||||
#
|
||||
|
||||
#
|
||||
# Download FORE microcode into adapter(s)
|
||||
#
|
||||
# This step is only required if you are using FORE ATM adapters.
|
||||
# This assumes that the FORE microcode file pca200e.bin is in /etc.
|
||||
# See the file fore-microcode.txt for further details.
|
||||
#
|
||||
/sbin/fore_dnld -d /etc
|
||||
|
||||
#
|
||||
# Define network interfaces
|
||||
#
|
||||
/sbin/atm set netif hfa0 <netif_prefix> 1
|
||||
|
||||
#
|
||||
# Configure physical interfaces
|
||||
#
|
||||
/sbin/atm attach hfa0 uni31
|
||||
|
||||
#
|
||||
# Start ILMI daemon (optional)
|
||||
#
|
||||
/sbin/ilmid
|
||||
|
||||
#
|
||||
# Set ATM address prefix
|
||||
#
|
||||
# Only need to set prefix if using UNI and not using ILMI daemon
|
||||
#
|
||||
#/sbin/atm set prefix hfa0 <nsap_prefix>
|
||||
|
||||
#
|
||||
# Configure network interfaces
|
||||
#
|
||||
/sbin/ifconfig <netif> <ip_addr> netmask + up
|
||||
/sbin/atm set arpserver <netif> <atm_address>
|
||||
|
||||
#
|
||||
# Configure PVCs (optional)
|
||||
#
|
||||
#/sbin/atm add pvc hfa0 <vpi> <vci> aal5 null ip <netif> <ip_addr>
|
||||
|
||||
#
|
||||
# Start SCSP daemons (optional)
|
||||
#
|
||||
# This step is only required if your host is configured as an ATMARP server
|
||||
# and you wish to synchronize its cache with the cache(s) of some other
|
||||
# server(s). Scspd will look for its configuration file at /etc/scspd.conf.
|
||||
#
|
||||
#/usr/sbin/scspd
|
||||
#/usr/sbin/atmarpd <netif> ...
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,572 +0,0 @@
|
|||
|
||||
HARP Native ATM Sockets API
|
||||
===========================
|
||||
|
||||
ATM sockets are an extension to the traditional BSD sockets API to allow
|
||||
direct user-level access to native ATM protocol services. The ATM sockets
|
||||
extensions are implemented via the addition of a new protocol family (PF_ATM)
|
||||
and a new socket address structure (struct sockaddr_atm).
|
||||
|
||||
The HARP implementation of native ATM sockets capabilities is intended to be
|
||||
conformant with The Open Group specifications (with known differences listed
|
||||
below) as defined in the following document:
|
||||
|
||||
The Open Group: Networking Services (XNS) Issue 5
|
||||
ISBN 1-85912-165-9
|
||||
http://www.rdg.opengroup.org/public/pubs/catalog/c523.htm
|
||||
|
||||
And in particular, it is based on the following ATM-specific sections in the
|
||||
above document:
|
||||
|
||||
ATM Transport Protocol Information for Sockets
|
||||
ATM Transport Protocol Information for XTI
|
||||
ATM Transport Headers
|
||||
|
||||
The ATM sockets API is an implementation based on the definitions and
|
||||
descriptions set forth in the following document:
|
||||
|
||||
The ATM Forum: Native ATM Services: Semantic Description, Version 1.0
|
||||
af-saa-0048.000
|
||||
http://www.atmforum.com/atmforum/specs/approved.html
|
||||
|
||||
|
||||
Using the HARP Implementation
|
||||
-----------------------------
|
||||
This document only provides the HARP-specific information necessary for using
|
||||
the ATM sockets API. Please refer to the XNS document described above for
|
||||
all of the general interface specifications. There is also sample source
|
||||
code for an ATM sockets application included at the end of this document.
|
||||
|
||||
All user definitions for the HARP ATM sockets implementation are contained
|
||||
in the file /usr/include/netatm/atm.h. This file must be included in the
|
||||
user's C program source file. In this file, all HARP extensions to the base
|
||||
XNS specifications are denoted with a comment string of "XNS_EXT".
|
||||
|
||||
|
||||
HARP Extensions to XNS Issue 5
|
||||
------------------------------
|
||||
o Socket address structure for ATM addresses
|
||||
|
||||
An ATM socket address structure was not specifically defined by XNS,
|
||||
although the t_atm_sap structure was defined to be used as an ATM protocol
|
||||
address. Thus, HARP has defined an ATM socket address (using address
|
||||
family AF_ATM) as a 'struct sockaddr_atm', which contains 'struct t_atm_sap'
|
||||
as the protocol address. This structure (properly cast) must be used on
|
||||
all ATM socket system calls requiring a 'struct sockaddr' parameter.
|
||||
|
||||
o Network Interface Selection socket option (T_ATM_NET_INTF)
|
||||
|
||||
This option is used to specify the name of the network interface to be
|
||||
used to route an outgoing ATM call using a socket connection. This option
|
||||
is only needed when there are multiple ATM network interfaces defined on a
|
||||
system. If this option is not set, then the first network interface on
|
||||
the first physical ATM interface defined will be used.
|
||||
|
||||
See the sample application below for an example of the use of this option.
|
||||
|
||||
o LLC Multiplexing socket option (T_ATM_LLC)
|
||||
|
||||
For LLC encapsulated VCCs (BLLI Layer 2 Protocol == T_ATM_BLLI2_I8802),
|
||||
HARP has implemented an LLC multiplexing facility. In order to use this
|
||||
multiplexing facility, a user must issue a setsockopt() call specifying the
|
||||
T_ATM_LLC option before the connect() or listen() system call is invoked.
|
||||
|
||||
If using the LLC multiplexor, the user will only receive PDUs which match
|
||||
the LLC header information specified in the socket option. The kernel
|
||||
multiplexing software will strip the LLC header from all inbound PDUs and
|
||||
add the specified LLC header to all outgoing PDUs - the user will never see
|
||||
the LLC header.
|
||||
|
||||
For listening sockets, the listener will be notified for all incoming LLC
|
||||
calls (which also meet the other incoming call distribution selection
|
||||
criteria), since the LLC header information is only carried in the data
|
||||
PDUs, not in the signalling protocol.
|
||||
|
||||
The T_ATM_LLC_SHARING flag is used to denote whether this user wishes to
|
||||
share the VCC with other LLC users requesting similar connection attributes
|
||||
to the same destination.
|
||||
|
||||
o Application Name socket option (T_ATM_APP_NAME)
|
||||
|
||||
This option is used to associate an identifier string (typically, the
|
||||
application's name) with an open ATM socket. Currently, it is only used
|
||||
for the "Owner" field in the output of the 'atm show vcc' command. If this
|
||||
option is not set, then the "Owner" field will default to "(AAL5)".
|
||||
|
||||
See the sample application below for an example of the use of this option.
|
||||
|
||||
o PVC support
|
||||
|
||||
The XNS document specifically does not provide support for ATM PVCs.
|
||||
However, due in part to internal HARP requirements (the ILMI daemon), PVC
|
||||
sockets are supported under the HARP implementation.
|
||||
|
||||
To support PVC sockets, there is a new address format (T_ATM_PVC_ADDR) and
|
||||
address definition (Atm_addr_pvc). Since there is no actual signalling
|
||||
involved in setting up a PVC, a PVC socket connection only defines the
|
||||
local socket-to-pvc connection - the remainder of the virtual circuit through
|
||||
the ATM network to the remote endpoint must be defined independent of the
|
||||
local socket creation. PVC socket connections are only allowed via the
|
||||
connect() system call - listen()/accept() sockets cannot be supported.
|
||||
Also, since there are no circuit parameters signalled, most of the
|
||||
setsockopt() options are silently ignored.
|
||||
|
||||
o SPANS support
|
||||
|
||||
HARP has added ATM socket support for the FORE-proprietary SPANS address
|
||||
format (T_ATM_SPANS_ADDR). A SPANS socket can only be established over
|
||||
an ATM physical interface which is using the SPANS signalling manager.
|
||||
There is limited ATM socket option support - the socket options can be set,
|
||||
but most are silently ignored, since they are not applicable to the SPANS
|
||||
protocols. The SPANS socket address support has not been thoroughly tested.
|
||||
|
||||
o Miscellaneous user convenience typedefs, macros and defines
|
||||
|
||||
|
||||
XNS Issue 5 Features Not Supported in HARP
|
||||
------------------------------------------
|
||||
o ATM_PROTO_SSCOP
|
||||
|
||||
The socket protocol for reliable data transport (ATM_PROTO_SSCOP) is not
|
||||
supported in this HARP release. There is some initial skeleton code for
|
||||
SSCOP support, but it was not completed.
|
||||
|
||||
o Multipoint connections
|
||||
|
||||
The core HARP code does not provide support for multipoint connections, so,
|
||||
obviously, multipoint socket connections are also not supported.
|
||||
|
||||
The non-supported socket options are:
|
||||
o T_ATM_ADD_LEAF
|
||||
o T_ATM_DROP_LEAF
|
||||
o T_ATM_LEAF_IND
|
||||
|
||||
The non-supported socket option values are:
|
||||
o For the T_ATM_BEARER_CAP socket option:
|
||||
o connection_configuration == T_ATM_1_TO_MANY
|
||||
|
||||
|
||||
Example ATM Socket Application
|
||||
------------------------------
|
||||
The following are simple example client and server applications using the ATM
|
||||
socket API.
|
||||
|
||||
/*
|
||||
* ATM API sample client application
|
||||
*
|
||||
* This application will open an ATM socket to a server, send a text string
|
||||
* in a PDU and then read one PDU from the socket and print its contents.
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/atm.h>
|
||||
|
||||
#define MAX_LEN 4096 /* Maximum PDU length */
|
||||
#define MY_ID 11 /* BLLI Layer 2 protocol */
|
||||
#define MY_APPL "Client"
|
||||
|
||||
Atm_addr_nsap dst_addr = {
|
||||
0x47,
|
||||
#error FIX ME: Replace the 2 lines below with your nsap prefix and esi address
|
||||
{0x00,0x05,0x80,0xff,0xdc,0x00,0x00,0x00,0x00,0x02,0xff,0xff},
|
||||
{0x11,0x22,0x33,0x44,0x55,0x66},
|
||||
0x00
|
||||
};
|
||||
|
||||
static char message[] = "A message from the client";
|
||||
|
||||
void
|
||||
print_cause(int s)
|
||||
{
|
||||
struct t_atm_cause cause;
|
||||
int optlen;
|
||||
|
||||
optlen = sizeof(cause);
|
||||
if (getsockopt(s, T_ATM_SIGNALING, T_ATM_CAUSE, &cause, &optlen) < 0) {
|
||||
perror("getsockopt(cause)");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Cause: coding=%d loc=%d cause=%d diag=(%d,%d,%d,%d)\n",
|
||||
cause.coding_standard, cause.location, cause.cause_value,
|
||||
cause.diagnostics[0], cause.diagnostics[1],
|
||||
cause.diagnostics[2], cause.diagnostics[3]);
|
||||
}
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
struct sockaddr_atm satm;
|
||||
struct t_atm_aal5 aal5;
|
||||
struct t_atm_traffic traffic;
|
||||
struct t_atm_bearer bearer;
|
||||
struct t_atm_qos qos;
|
||||
struct t_atm_net_intf netintf;
|
||||
struct t_atm_app_name appname;
|
||||
char buffer[MAX_LEN+1];
|
||||
int s, n, optlen;
|
||||
|
||||
/*
|
||||
* Create socket
|
||||
*/
|
||||
s = socket(AF_ATM, SOCK_SEQPACKET, ATM_PROTO_AAL5);
|
||||
if (s < 0) {
|
||||
perror("socket");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up destination SAP
|
||||
*/
|
||||
bzero((caddr_t) &satm, sizeof(satm));
|
||||
satm.satm_family = AF_ATM;
|
||||
#if (defined(BSD) && (BSD >= 199103))
|
||||
satm.satm_len = sizeof(satm);
|
||||
#endif
|
||||
/* Destination ATM address */
|
||||
satm.satm_addr.t_atm_sap_addr.SVE_tag_addr = T_ATM_PRESENT;
|
||||
satm.satm_addr.t_atm_sap_addr.SVE_tag_selector = T_ATM_PRESENT;
|
||||
satm.satm_addr.t_atm_sap_addr.address_format = T_ATM_ENDSYS_ADDR;
|
||||
satm.satm_addr.t_atm_sap_addr.address_length = sizeof(Atm_addr_nsap);
|
||||
bcopy((caddr_t)&dst_addr,
|
||||
(caddr_t)satm.satm_addr.t_atm_sap_addr.address,
|
||||
sizeof(dst_addr));
|
||||
|
||||
/* BLLI Layer-2 protocol */
|
||||
satm.satm_addr.t_atm_sap_layer2.SVE_tag = T_ATM_PRESENT;
|
||||
satm.satm_addr.t_atm_sap_layer2.ID_type = T_ATM_USER_ID;
|
||||
satm.satm_addr.t_atm_sap_layer2.ID.user_defined_ID = MY_ID;
|
||||
|
||||
/* BLLI Layer-3 protocol */
|
||||
satm.satm_addr.t_atm_sap_layer3.SVE_tag = T_ATM_ABSENT;
|
||||
|
||||
/* BHLI protocol */
|
||||
satm.satm_addr.t_atm_sap_appl.SVE_tag = T_ATM_ABSENT;
|
||||
|
||||
/*
|
||||
* Set up connection parameters
|
||||
*/
|
||||
aal5.forward_max_SDU_size = MAX_LEN;
|
||||
aal5.backward_max_SDU_size = MAX_LEN;
|
||||
aal5.SSCS_type = T_ATM_NULL;
|
||||
optlen = sizeof(aal5);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_AAL5, (caddr_t)&aal5,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(aal5)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
traffic.forward.PCR_high_priority = T_ATM_ABSENT;
|
||||
traffic.forward.PCR_all_traffic = 100000;
|
||||
traffic.forward.SCR_high_priority = T_ATM_ABSENT;
|
||||
traffic.forward.SCR_all_traffic = T_ATM_ABSENT;
|
||||
traffic.forward.MBS_high_priority = T_ATM_ABSENT;
|
||||
traffic.forward.MBS_all_traffic = T_ATM_ABSENT;
|
||||
traffic.forward.tagging = T_NO;
|
||||
traffic.backward.PCR_high_priority = T_ATM_ABSENT;
|
||||
traffic.backward.PCR_all_traffic = 100000;
|
||||
traffic.backward.SCR_high_priority = T_ATM_ABSENT;
|
||||
traffic.backward.SCR_all_traffic = T_ATM_ABSENT;
|
||||
traffic.backward.MBS_high_priority = T_ATM_ABSENT;
|
||||
traffic.backward.MBS_all_traffic = T_ATM_ABSENT;
|
||||
traffic.backward.tagging = T_NO;
|
||||
traffic.best_effort = T_YES;
|
||||
optlen = sizeof(traffic);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_TRAFFIC, (caddr_t)&traffic,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(traffic)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
bearer.bearer_class = T_ATM_CLASS_X;
|
||||
bearer.traffic_type = T_ATM_NULL;
|
||||
bearer.timing_requirements = T_ATM_NULL;
|
||||
bearer.clipping_susceptibility = T_NO;
|
||||
bearer.connection_configuration = T_ATM_1_TO_1;
|
||||
optlen = sizeof(bearer);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_BEARER_CAP, (caddr_t)&bearer,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(bearer)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
qos.coding_standard = T_ATM_NETWORK_CODING;
|
||||
qos.forward.qos_class = T_ATM_QOS_CLASS_0;
|
||||
qos.backward.qos_class = T_ATM_QOS_CLASS_0;
|
||||
optlen = sizeof(qos);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_QOS, (caddr_t)&qos,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(qos)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef REMOVE_TO_USE_NET_INTF
|
||||
#error FIX ME: Replace the ni0 below with the local atm network interface name
|
||||
strncpy(netintf.net_intf, "ni0", IFNAMSIZ);
|
||||
optlen = sizeof(netintf);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_NET_INTF, (caddr_t)&netintf,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(net_intf)");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
strncpy(appname.app_name, MY_APPL, T_ATM_APP_NAME_LEN);
|
||||
optlen = sizeof(appname);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_APP_NAME, (caddr_t)&appname,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(app_name)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now try to connect to destination
|
||||
*/
|
||||
if (connect(s, (struct sockaddr *) &satm, sizeof(satm)) < 0) {
|
||||
perror("connect");
|
||||
print_cause(s);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Exchange message with peer
|
||||
*/
|
||||
if (write(s, message, sizeof(message)) != sizeof(message)) {
|
||||
perror("write");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((n = read(s, buffer, MAX_LEN)) < 0) {
|
||||
perror("read");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
buffer[n] = '\0';
|
||||
printf("received %d bytes: <%s>\n", n, buffer);
|
||||
|
||||
/*
|
||||
* Finish up
|
||||
*/
|
||||
if (close(s) < 0) {
|
||||
perror("close");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ATM API sample server application
|
||||
*
|
||||
* This application will loop forever listening for connections on an ATM
|
||||
* socket. When a new connection arrives, it will send a string in a PDU,
|
||||
* read one PDU from the socket and print its contents.
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/atm.h>
|
||||
|
||||
#define MAX_LEN 4096 /* Maximum PDU length */
|
||||
#define MY_ID 11 /* BLLI Layer 2 protocol */
|
||||
#define MY_APPL "Server"
|
||||
|
||||
static char message[] = "A message from the server";
|
||||
|
||||
void
|
||||
print_cause(int s)
|
||||
{
|
||||
struct t_atm_cause cause;
|
||||
int optlen;
|
||||
|
||||
optlen = sizeof(cause);
|
||||
if (getsockopt(s, T_ATM_SIGNALING, T_ATM_CAUSE, &cause, &optlen) < 0) {
|
||||
perror("getsockopt(cause)");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Cause: coding=%d loc=%d cause=%d diag=(%d,%d,%d,%d)\n",
|
||||
cause.coding_standard, cause.location, cause.cause_value,
|
||||
cause.diagnostics[0], cause.diagnostics[1],
|
||||
cause.diagnostics[2], cause.diagnostics[3]);
|
||||
}
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
struct sockaddr_atm satm;
|
||||
struct t_atm_aal5 aal5;
|
||||
struct t_atm_traffic traffic;
|
||||
struct t_atm_bearer bearer;
|
||||
struct t_atm_qos qos;
|
||||
struct t_atm_net_intf netintf;
|
||||
struct t_atm_app_name appname;
|
||||
char buffer[MAX_LEN+1];
|
||||
int s, n, optlen;
|
||||
|
||||
/*
|
||||
* Create socket
|
||||
*/
|
||||
s = socket(AF_ATM, SOCK_SEQPACKET, ATM_PROTO_AAL5);
|
||||
if (s < 0) {
|
||||
perror("socket");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up destination SAP
|
||||
*/
|
||||
bzero((caddr_t) &satm, sizeof(satm));
|
||||
satm.satm_family = AF_ATM;
|
||||
#if (defined(BSD) && (BSD >= 199103))
|
||||
satm.satm_len = sizeof(satm);
|
||||
#endif
|
||||
/* Destination ATM address */
|
||||
satm.satm_addr.t_atm_sap_addr.SVE_tag_addr = T_ATM_ANY;
|
||||
satm.satm_addr.t_atm_sap_addr.SVE_tag_selector = T_ATM_ANY;
|
||||
|
||||
/* BLLI Layer-2 protocol */
|
||||
satm.satm_addr.t_atm_sap_layer2.SVE_tag = T_ATM_PRESENT;
|
||||
satm.satm_addr.t_atm_sap_layer2.ID_type = T_ATM_USER_ID;
|
||||
satm.satm_addr.t_atm_sap_layer2.ID.user_defined_ID = MY_ID;
|
||||
|
||||
/* BLLI Layer-3 protocol */
|
||||
satm.satm_addr.t_atm_sap_layer3.SVE_tag = T_ATM_ABSENT;
|
||||
|
||||
/* BHLI protocol */
|
||||
satm.satm_addr.t_atm_sap_appl.SVE_tag = T_ATM_ABSENT;
|
||||
|
||||
/*
|
||||
* Set up connection parameters
|
||||
*/
|
||||
aal5.forward_max_SDU_size = MAX_LEN;
|
||||
aal5.backward_max_SDU_size = MAX_LEN;
|
||||
aal5.SSCS_type = T_ATM_NULL;
|
||||
optlen = sizeof(aal5);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_AAL5, (caddr_t)&aal5,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(aal5)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
traffic.forward.PCR_high_priority = T_ATM_ABSENT;
|
||||
traffic.forward.PCR_all_traffic = 100000;
|
||||
traffic.forward.SCR_high_priority = T_ATM_ABSENT;
|
||||
traffic.forward.SCR_all_traffic = T_ATM_ABSENT;
|
||||
traffic.forward.MBS_high_priority = T_ATM_ABSENT;
|
||||
traffic.forward.MBS_all_traffic = T_ATM_ABSENT;
|
||||
traffic.forward.tagging = T_NO;
|
||||
traffic.backward.PCR_high_priority = T_ATM_ABSENT;
|
||||
traffic.backward.PCR_all_traffic = 100000;
|
||||
traffic.backward.SCR_high_priority = T_ATM_ABSENT;
|
||||
traffic.backward.SCR_all_traffic = T_ATM_ABSENT;
|
||||
traffic.backward.MBS_high_priority = T_ATM_ABSENT;
|
||||
traffic.backward.MBS_all_traffic = T_ATM_ABSENT;
|
||||
traffic.backward.tagging = T_NO;
|
||||
traffic.best_effort = T_YES;
|
||||
optlen = sizeof(traffic);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_TRAFFIC, (caddr_t)&traffic,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(traffic)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
bearer.bearer_class = T_ATM_CLASS_X;
|
||||
bearer.traffic_type = T_ATM_NULL;
|
||||
bearer.timing_requirements = T_ATM_NULL;
|
||||
bearer.clipping_susceptibility = T_NO;
|
||||
bearer.connection_configuration = T_ATM_1_TO_1;
|
||||
optlen = sizeof(bearer);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_BEARER_CAP, (caddr_t)&bearer,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(bearer)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
qos.coding_standard = T_ATM_NETWORK_CODING;
|
||||
qos.forward.qos_class = T_ATM_QOS_CLASS_0;
|
||||
qos.backward.qos_class = T_ATM_QOS_CLASS_0;
|
||||
optlen = sizeof(qos);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_QOS, (caddr_t)&qos,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(qos)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
strncpy(appname.app_name, MY_APPL, T_ATM_APP_NAME_LEN);
|
||||
optlen = sizeof(appname);
|
||||
if (setsockopt(s, T_ATM_SIGNALING, T_ATM_APP_NAME, (caddr_t)&appname,
|
||||
optlen) < 0) {
|
||||
perror("setsockopt(app_name)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now try to bind/listen
|
||||
*/
|
||||
if (bind(s, (struct sockaddr *) &satm, sizeof(satm)) < 0) {
|
||||
perror("bind");
|
||||
exit(1);
|
||||
}
|
||||
if (listen(s, 4) < 0) {
|
||||
perror("listen");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (; ; ) {
|
||||
struct sockaddr_atm claddr;
|
||||
int clsock, cllen;
|
||||
|
||||
/* Wait for incoming call */
|
||||
cllen = sizeof(claddr);
|
||||
clsock = accept(s, (struct sockaddr *) &claddr, &cllen);
|
||||
if (clsock < 0) {
|
||||
perror("accept");
|
||||
exit(1);
|
||||
}
|
||||
printf("Server: new connection\n");
|
||||
|
||||
/*
|
||||
* Exchange message with peer
|
||||
*/
|
||||
if (write(clsock, message, sizeof(message)) != sizeof(message)) {
|
||||
perror("write");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((n = read(clsock, buffer, MAX_LEN)) < 0) {
|
||||
perror("read");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
buffer[n] = '\0';
|
||||
printf("received %d bytes: <%s>\n", n, buffer);
|
||||
|
||||
sleep(1);
|
||||
|
||||
/*
|
||||
* Finish up
|
||||
*/
|
||||
if (close(clsock) < 0) {
|
||||
perror("close");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
close(s);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@(#) $FreeBSD$
|
||||
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
|
||||
CPCS Design
|
||||
===========
|
||||
|
||||
SAP_CPCS Interface
|
||||
------------------
|
||||
This is the stack SAP interface between an AAL CPCS provider and an AAL CPCS
|
||||
user. The stack commands defined for this interface are modeled after the
|
||||
AAL3/4 and AAL5 protocol specification primitives CPCS-xxx. See the protocol
|
||||
specification documents referenced below for full descriptions of the CPCS
|
||||
interface.
|
||||
|
||||
|
||||
o The following stack commands are sent from a CPCS user to the CPCS provider:
|
||||
|
||||
Stack Command: CPCS_INIT
|
||||
Description: Initialize a SAP instance. This should be the first stack
|
||||
command issued across the SAP instance after the service stack
|
||||
has been successfully instantiated.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: CPCS_TERM
|
||||
Description: Terminate a SAP instance. This must be the last stack command
|
||||
issued across the SAP instance. The stack instance will be
|
||||
deleted upon completion of this command.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: CPCS_UNITDATA_INV
|
||||
Description: Request that an SDU be sent to the remote AAL user.
|
||||
Argument 1: Pointer to an mbuf chain containing the user SDU.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: CPCS_UABORT_INV
|
||||
Description: Not supported.
|
||||
Argument 1: N/A
|
||||
Argument 2: N/A
|
||||
|
||||
|
||||
o The following stack commands are sent from the CPCS provider to a CPCS user:
|
||||
|
||||
Stack Command: CPCS_UNITDATA_SIG
|
||||
Description: Indication that an SDU has been received from the remote AAL
|
||||
user.
|
||||
Argument 1: Pointer to an mbuf chain containing the peer's SDU.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: CPCS_UABORT_SIG
|
||||
Description: Not supported.
|
||||
Argument 1: N/A
|
||||
Argument 2: N/A
|
||||
|
||||
|
||||
Stack Command: CPCS_PABORT_SIG
|
||||
Description: Not supported.
|
||||
Argument 1: N/A
|
||||
Argument 2: N/A
|
||||
|
||||
|
||||
|
||||
Protocol Specifications
|
||||
-----------------------
|
||||
See I.363.
|
||||
|
||||
|
||||
|
||||
Implementation Limitations
|
||||
--------------------------
|
||||
o The CPCS-LP, CPCS-CI and CPCS-UU parameters are not supported.
|
||||
|
||||
o The Streaming Mode service is not supported.
|
||||
|
||||
o The Abort service is not supported.
|
||||
|
||||
|
||||
@(#) $FreeBSD$
|
||||
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
|
||||
HARP and FORE Systems Microcode
|
||||
===============================
|
||||
|
||||
ATM adapters from FORE Systems use Intel i960 embedded processors and
|
||||
require that application software (herein called "microcode") be downloaded
|
||||
and executed on the adapter. The interface between the microcode and the host
|
||||
device driver is specified in the FORE ATM Adaptation Layer Interface (AALI)
|
||||
(available from ftp.fore.com:/pub/docs/port). HARP uses microcode supplied
|
||||
by FORE Systems. The HARP device driver for the FORE adapter (hfa) conforms
|
||||
to the AALI specification.
|
||||
|
||||
As part of the HARP ATM initialization procedure, the HARP 'fore_dnld' utility
|
||||
must be invoked in order to load the microcode file into each FORE adapter.
|
||||
However, the microcode file is NOT included in the FreeBSD distribution. It is
|
||||
the user's responsibility to obtain and install the FORE microcode file. Below
|
||||
are notes to assist users in finding and installing microcode known to work
|
||||
with HARP.
|
||||
|
||||
FORE microcode files can be obtained from either FORE's web site
|
||||
(http://www.fore.com) or the CD distributed with new FORE adapters.
|
||||
When using FORE's web site, you must have a valid login to access the
|
||||
TACtics Online section of the site. The software download section is
|
||||
available via the 'Services & Support'->'TACtics Online'->Software links.
|
||||
|
||||
If you are currently using HARP and already have a working microcode file,
|
||||
that microcode will continue to work with this release of HARP.
|
||||
|
||||
|
||||
PCA200E
|
||||
-------
|
||||
|
||||
From the FORE web pages, the following PCA200E adapter distributions
|
||||
are known to have microcode which will work with HARP:
|
||||
|
||||
pc_adapter->OS/2->archive->os2_4.0.2_1.20.200.zip
|
||||
unzip the file and execute the command:
|
||||
|
||||
cp -p <unzip_directory>/Drivers/PCA200E.BIN /etc/pca200e.bin
|
||||
|
||||
pc_adapter->'Windows NT'->archive->pca2e_12.zip
|
||||
unzip the file and execute the command:
|
||||
|
||||
cp -p <unzip_directory>/NT/I386/PCA200E.BIN /etc/pca200e.bin
|
||||
|
||||
|
||||
The following distributions from the FORE web pages are known to have
|
||||
microcode which will NOT work with HARP:
|
||||
|
||||
pc_adapter:
|
||||
OS/2:
|
||||
release:
|
||||
os2_4.1.0_1.74.zip
|
||||
Windows95:
|
||||
archive:
|
||||
pc-w95_5.0.0.16432.zip
|
||||
win95_4.0.3_1.04.200.zip
|
||||
win95_4.1.6_1.16.zip
|
||||
release:
|
||||
pc-w95_4.1.6_27.zip
|
||||
Windows NT:
|
||||
archive:
|
||||
pc-nt_5.0.0_16342.zip
|
||||
winnt_4.0.3_1.05.200.zip
|
||||
winnt_4.1.2_1.27.zip
|
||||
winnt_4.1.6_1.16.zip
|
||||
release:
|
||||
pc-nt_4.1.6_27.zip
|
||||
pc-nt_i386_5.0.0_25096.zip
|
||||
|
||||
|
||||
From the "ForeRunner 200E for PC/Mac" distribution CD-ROM, the following
|
||||
PCA200E adapter distributions are known to have microcode which will work
|
||||
with HARP (assuming the CD-ROM is mounted on /cdrom):
|
||||
|
||||
/cdrom/rel4.0/os2/
|
||||
execute the command:
|
||||
|
||||
cp -p /cdrom/rel4.0/os2/drivers/pca200e.bin /etc/pca200e.bin
|
||||
|
||||
|
||||
Note: Windows-based files are supplied in a compressed form. If the
|
||||
'fore_dnld' command complains about an unrecognized header format, you should
|
||||
try to uncompress the microcode file. To do so, move the file in binary mode
|
||||
to a DOS/Windows machine and use the DOS command 'expand' to uncompress the
|
||||
file. The command syntax is:
|
||||
|
||||
expand <in-file> <out-file>
|
||||
|
||||
Move the resulting <out-file> in binary mode back to the HARP machine as
|
||||
/etc/pca200e.bin and try to initialize the ATM system again.
|
||||
|
||||
@(#) $FreeBSD$
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
|
||||
SSCF UNI Design
|
||||
===============
|
||||
|
||||
SAP_SSCF_UNI Interface
|
||||
----------------------
|
||||
This is the stack SAP interface between the UNI signalling layer (eg. Q.2931)
|
||||
and the SSCF module. The stack commands defined for this interface are modeled
|
||||
after the SSCF protocol specification primitives AAL-xxx. See the protocol
|
||||
specification documents referenced below for full descriptions of the SSCF UNI
|
||||
interface presented to the signalling user.
|
||||
|
||||
|
||||
o The following stack commands are sent from the signalling module to SSCF:
|
||||
|
||||
Stack Command: SSCF_UNI_INIT
|
||||
Description: Initialize a SAP instance. This should be the first stack
|
||||
command issued across the SAP instance after the service stack
|
||||
has been successfully instantiated.
|
||||
Argument 1: Specifies the UNI version to be used for this stack instance.
|
||||
(enum uni_vers)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCF_UNI_TERM
|
||||
Description: Terminate a SAP instance. This must be the last stack command
|
||||
issued across the SAP instance. The stack instance will be
|
||||
deleted upon completion of this command.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCF_UNI_ESTABLISH_REQ
|
||||
Description: Request the establishment of an assured SAAL connection to the
|
||||
SAAL peer entity.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCF_UNI_RELEASE_REQ
|
||||
Description: Request the termination of an assured SAAL connection to the
|
||||
SAAL peer entity.
|
||||
Argument 1: Specifies whether future session establishment indications from
|
||||
the SAAL peer should be processed. Valid values are
|
||||
SSCF_UNI_ESTIND_YES or SSCF_UNI_ESTIND_NO. (int)
|
||||
Note that this is a local implementation parameter only.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCF_UNI_DATA_REQ
|
||||
Description: Request that an assured SDU be sent to the SAAL peer.
|
||||
Argument 1: Pointer to an mbuf chain containing the user SDU.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCF_UNI_UNITDATA_REQ
|
||||
Description: Request that an unacknowledged SDU be sent to the SAAL peer.
|
||||
Argument 1: Pointer to an mbuf chain containing the user SDU.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
o The following stack commands are sent from SSCF to the signalling module:
|
||||
|
||||
Stack Command: SSCF_UNI_ESTABLISH_IND
|
||||
Description: Indication that an assured SAAL connection has been established
|
||||
by the SAAL peer entity.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCF_UNI_ESTABLISH_CNF
|
||||
Description: Confirmation of an assured SAAL connection establishment,
|
||||
previously requested via an SSCF_UNI_ESTABLISH_REQ command.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCF_UNI_RELEASE_IND
|
||||
Description: Indication that an assured SAAL connection has been terminated
|
||||
by the SAAL peer entity.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCF_UNI_RELEASE_CNF
|
||||
Description: Confirmation of an assured SAAL connection termination,
|
||||
previously requested via an SSCF_UNI_RELEASE_REQ command.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCF_UNI_DATA_IND
|
||||
Description: Indication that an assured SDU has been received from the
|
||||
SAAL peer.
|
||||
Argument 1: Pointer to an mbuf chain containing the peer's SDU.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCF_UNI_UNITDATA_IND
|
||||
Description: Indication that an unacknowledged SDU has been received from
|
||||
the SAAL peer.
|
||||
Argument 1: Pointer to an mbuf chain containing the peer's SDU.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
|
||||
Protocol Specifications
|
||||
-----------------------
|
||||
For UNI_VERS_3_0, see Q.SAAL2.
|
||||
For UNI_VERS_3_1, see Q.2130.
|
||||
|
||||
|
||||
|
||||
Implementation Limitations
|
||||
--------------------------
|
||||
o The Parameter Data parameter is not supported for the following primitives:
|
||||
AAL-ESTABLISH request
|
||||
AAL-ESTABLISH indication
|
||||
AAL-ESTABLISH confirm
|
||||
AAL-RELEASE request
|
||||
AAL-RELEASE indication
|
||||
|
||||
|
||||
@(#) $FreeBSD$
|
||||
|
||||
|
|
@ -1,220 +0,0 @@
|
|||
|
||||
SSCOP Design
|
||||
============
|
||||
|
||||
SAP_SSCOP Interface
|
||||
-------------------
|
||||
This is the stack SAP interface between the SSCOP module and an SSCOP user
|
||||
module (eg. SSCF). The stack commands defined for this interface are modeled
|
||||
after the SSCOP protocol specification primitives AA-xxx. See the protocol
|
||||
specification documents referenced below for full descriptions of the SSCOP
|
||||
interface presented to an SSCF.
|
||||
|
||||
|
||||
o The following stack commands are sent from an SSCF to SSCOP:
|
||||
|
||||
Stack Command: SSCOP_INIT
|
||||
Description: Initialize a SAP instance. This should be the first stack
|
||||
command issued across the SAP instance after the service stack
|
||||
has been successfully instantiated.
|
||||
Argument 1: Specifies the SSCOP version to be used for this stack instance.
|
||||
(enum sscop_vers)
|
||||
Argument 2: Pointer to a structure containing the SSCOP protocol parameter
|
||||
values to be used for this instance. (struct sscop_parms *)
|
||||
|
||||
|
||||
Stack Command: SSCOP_TERM
|
||||
Description: Terminate a SAP instance. This must be the last stack command
|
||||
issued across the SAP instance. The stack instance will be
|
||||
deleted upon completion of this command.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_ESTABLISH_REQ
|
||||
Description: Request the establishment of an SSCOP connection for assured
|
||||
information transfer to the remote peer entity.
|
||||
Argument 1: Pointer to an mbuf chain containing any SSCOP User-to-User
|
||||
Information (SSCOP-UU / UUI) data to be sent to the peer.
|
||||
Must be coded as SSCOP_UU_NULL. (struct mbuf *)
|
||||
Argument 2: Buffer Release (BR) parameter. Must be coded as SSCOP_BR_YES.
|
||||
(int)
|
||||
|
||||
|
||||
Stack Command: SSCOP_ESTABLISH_RSP
|
||||
Description: Response indicating that an SSCOP connection establishment
|
||||
request from the remote peer is acceptable.
|
||||
Argument 1: Pointer to an mbuf chain containing any SSCOP User-to-User
|
||||
Information (SSCOP-UU / UUI) data to be sent to the peer.
|
||||
Must be coded as SSCOP_UU_NULL. (struct mbuf *)
|
||||
Argument 2: Buffer Release (BR) parameter. Must be coded as SSCOP_BR_YES.
|
||||
(int)
|
||||
|
||||
|
||||
Stack Command: SSCOP_RELEASE_REQ
|
||||
Description: Request the termination of an SSCOP connection with the
|
||||
remote peer entity.
|
||||
Argument 1: Pointer to an mbuf chain containing any SSCOP User-to-User
|
||||
Information (SSCOP-UU / UUI) data to be sent to the peer.
|
||||
Must be coded as SSCOP_UU_NULL. (struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_DATA_REQ
|
||||
Description: Request that an assured SDU be sent to the remote peer.
|
||||
Argument 1: Pointer to an mbuf chain containing the user SDU.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_RESYNC_REQ
|
||||
Description: Request the resynchronization of an SSCOP connection.
|
||||
Argument 1: Pointer to an mbuf chain containing any SSCOP User-to-User
|
||||
Information (SSCOP-UU / UUI) data to be sent to the peer.
|
||||
Must be coded as SSCOP_UU_NULL. (struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_RESYNC_RSP
|
||||
Description: Acknowledge the remote peer's resynchronization of an SSCOP
|
||||
connection.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_RECOVER_RSP (Q.2110 only)
|
||||
Description: Acknowledge the indication that the SSCOP connection has
|
||||
recovered from SSCOP protocol errors.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_UNITDATA_REQ
|
||||
Description: Request that an unacknowledged SDU be sent to the remote peer.
|
||||
Argument 1: Pointer to an mbuf chain containing the user SDU.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_RETRIEVE_REQ
|
||||
Description: Not supported.
|
||||
Argument 1: N/A
|
||||
Argument 2: N/A
|
||||
|
||||
|
||||
o The following stack commands are sent from SSCOP to an SSCF:
|
||||
|
||||
Stack Command: SSCOP_ESTABLISH_IND
|
||||
Description: Indication that a request to establish an SSCOP connection has
|
||||
been received from the remote peer entity.
|
||||
Argument 1: Pointer to an mbuf chain containing any SSCOP User-to-User
|
||||
Information (SSCOP-UU / UUI) data received from the peer.
|
||||
(struct mbuf *)
|
||||
Argument 2: Source of establish request (Q.SAAL1 only). Valid values are
|
||||
SSCOP_SOURCE_SSCOP or SSCOP_SOURCE_USER. (int)
|
||||
|
||||
|
||||
Stack Command: SSCOP_ESTABLISH_CNF
|
||||
Description: Confirmation from the remote peer of an SSCOP connection
|
||||
establishment, previously requested via an SSCOP_ESTABLISH_REQ
|
||||
command.
|
||||
Argument 1: Pointer to an mbuf chain containing any SSCOP User-to-User
|
||||
Information (SSCOP-UU / UUI) data received from the peer.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_RELEASE_IND
|
||||
Description: Indication that an SSCOP connection has been terminated by
|
||||
the remote peer entity.
|
||||
Argument 1: Pointer to an mbuf chain containing any SSCOP User-to-User
|
||||
Information (SSCOP-UU / UUI) data received from the peer.
|
||||
(struct mbuf *)
|
||||
Argument 2: Source of release request. Valid values are SSCOP_SOURCE_SSCOP
|
||||
or SSCOP_SOURCE_USER. (int)
|
||||
|
||||
|
||||
Stack Command: SSCOP_RELEASE_CNF
|
||||
Description: Confirmation from the remote peer of an SSCOP connection
|
||||
termination, previously requested via an SSCOP_RELEASE_REQ
|
||||
command.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_DATA_IND
|
||||
Description: Indication that an assured SDU has been received from the
|
||||
remote peer.
|
||||
Argument 1: Pointer to an mbuf chain containing the peer's SDU.
|
||||
(struct mbuf *)
|
||||
Argument 2: Sequence number of the received SDU. (sscop_seq)
|
||||
|
||||
|
||||
Stack Command: SSCOP_RESYNC_IND
|
||||
Description: Indication that the remote peer has requested the
|
||||
resynchronization of the SSCOP connection.
|
||||
Argument 1: Pointer to an mbuf chain containing any SSCOP User-to-User
|
||||
Information (SSCOP-UU / UUI) data received from the peer.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_RESYNC_CNF
|
||||
Description: Confirmation from the remote peer that an SSCOP connection
|
||||
has been resynchronized.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_RECOVER_IND (Q.2110 only)
|
||||
Description: Indication that an SSCOP connection has recovered from SSCOP
|
||||
protocol errors.
|
||||
Argument 1: Not used.
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_UNITDATA_IND
|
||||
Description: Indication that an unacknowledged SDU has been received from
|
||||
the remote peer.
|
||||
Argument 1: Pointer to an mbuf chain containing the peer's SDU.
|
||||
(struct mbuf *)
|
||||
Argument 2: Not used.
|
||||
|
||||
|
||||
Stack Command: SSCOP_RETRIEVE_IND
|
||||
Description: Not supported.
|
||||
Argument 1: N/A
|
||||
Argument 2: N/A
|
||||
|
||||
|
||||
Stack Command: SSCOP_RETRIEVECMP_IND
|
||||
Description: Not supported.
|
||||
Argument 1: N/A
|
||||
Argument 2: N/A
|
||||
|
||||
|
||||
|
||||
Protocol Specifications
|
||||
-----------------------
|
||||
For SSCOP_VERS_QSAAL, see Q.SAAL1.
|
||||
For SSCOP_VERS_Q2110, see Q.2110.
|
||||
|
||||
|
||||
|
||||
Implementation Limitations
|
||||
--------------------------
|
||||
o The following signals are not supported:
|
||||
AA-RETRIEVE
|
||||
AA-RETRIEVE COMPLETE
|
||||
AA-RELEASEBUF (Q.SAAL1 only)
|
||||
MAA-UNITDATA
|
||||
|
||||
o Does not support sending the SSCOP-UU/UUI parameter, must be set to NULL
|
||||
|
||||
o For the AA-ESTABLISH request and response signals, only BR=YES is supported
|
||||
|
||||
o For the AA-DATA request signal, only PR=NO is supported (Q.SAAL1 only)
|
||||
|
||||
|
||||
@(#) $FreeBSD$
|
||||
|
||||
|
|
@ -197,7 +197,6 @@ MAN= aac.4 \
|
|||
ng_atm.4 \
|
||||
ngatmbase.4 \
|
||||
ng_atmllc.4 \
|
||||
ng_atmpif.4 \
|
||||
ng_bluetooth.4 \
|
||||
ng_bpf.4 \
|
||||
ng_bridge.4 \
|
||||
|
|
|
|||
|
|
@ -1,161 +0,0 @@
|
|||
.\"
|
||||
.\" Copyright (c) 2001-2003
|
||||
.\" Harti Brandt.
|
||||
.\" Vincent Jardin.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" Author: Hartmut Brandt <harti@FreeBSD.org>
|
||||
.\" Author: Vincent Jardin <vjardin@free.fr>
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.\" ng_atmpif(4) man page
|
||||
.\"
|
||||
.Dd August 7, 2003
|
||||
.Dt NG_ATMPIF 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ng_atmpif
|
||||
.Nd netgraph HARP/ATM Virtual Physical Interface
|
||||
.Sh SYNOPSIS
|
||||
.In sys/types.h
|
||||
.In netatm/atm_if.h
|
||||
.In netgraph/atm/ng_atmpif.h
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm atmpif
|
||||
netgraph node type allows the emulation of
|
||||
.Xr atm 8
|
||||
(netatm/HARP) Physical devices (PIF) to be connected to the
|
||||
.Xr netgraph 4
|
||||
networking subsystem.
|
||||
Moreover, it includes protection of the PDU against duplication and
|
||||
desequencement.
|
||||
It supports up to 65535 VCs and up to 255 VPs.
|
||||
AAL0, AAL3/4 and AAL5
|
||||
emulation are provided.
|
||||
In order to optimize CPU, this node does not emulate the SAR layer.
|
||||
.Pp
|
||||
The purpose of this node is to help in debugging and testing the HARP
|
||||
stack when one does not have an ATM board or when the available boards do not
|
||||
have enough features.
|
||||
.Pp
|
||||
When a node
|
||||
is created, a PIF is created automatically.
|
||||
It is named
|
||||
.Li hvaX .
|
||||
It has the same features as any other HARP devices.
|
||||
The PIF is removed when the node is removed.
|
||||
.Sh HOOKS
|
||||
There is only one hook:
|
||||
.Va link .
|
||||
This hook can be connected to any other
|
||||
Netgraph node.
|
||||
For example, in order
|
||||
to test the HARP stack over UDP, it can be connected on a
|
||||
.Xr ng_ksocket 4
|
||||
node.
|
||||
.Sh CONTROL MESSAGES
|
||||
This node type supports the generic messages plus the following:
|
||||
.Pp
|
||||
.Bl -tag -width indent -compact
|
||||
.It Dv NGM_ATMPIF_SET_CONFIG Pq Li setconfig
|
||||
Configures the debugging features of the node and a virtual
|
||||
Peak Cell Rate (PCR).
|
||||
It uses the same structure as
|
||||
.Dv NGM_ATMPIF_GET_CONFIG .
|
||||
.Pp
|
||||
.It Dv NGM_ATMPIF_GET_CONFIG Pq Li getconfig
|
||||
Returns a structure defining the configuration of the interface:
|
||||
.Bd -literal
|
||||
struct ng_vatmpif_config {
|
||||
uint8_t debug; /* debug bit field (see below) */
|
||||
uint32_t pcr; /* peak cell rate */
|
||||
Mac_addr macaddr; /* Mac Address */
|
||||
};
|
||||
.Ed
|
||||
Note that the following debugging flags can be used:
|
||||
.Pp
|
||||
.Bl -tag -width ".Dv VATMPIF_DEBUG_PACKET" -offset indent -compact
|
||||
.It Dv VATMPIF_DEBUG_NONE
|
||||
disable debugging
|
||||
.It Dv VATMPIF_DEBUG_PACKET
|
||||
enable debugging
|
||||
.El
|
||||
.Pp
|
||||
.It Dv NGM_ATMPIF_GET_LINK_STATUS Pq Li getlinkstatus
|
||||
Returns the last received sequence number, the last sent sequence
|
||||
number and the current total PCR that is reserved among all the VCCs
|
||||
of the interface.
|
||||
.Bd -literal
|
||||
struct ng_atmpif_link_status {
|
||||
uint32_t InSeq; /* last received sequence number + 1 */
|
||||
uint32_t OutSeq; /* last sent sequence number */
|
||||
uint32_t cur_pcr; /* slot's reserved PCR */
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
.It Dv NGM_ATMPIF_GET_STATS Pq Li getstats
|
||||
.It Dv NGM_ATMPIF_CLR_STATS Pq Li clrstats
|
||||
.It Dv NGM_ATMPIF_GETCLR_STATS Pq Li getclrstats
|
||||
It returns the node's statistics, it clears them or it returns and resets
|
||||
their values to 0.
|
||||
The following stats are provided.
|
||||
.Bd -literal
|
||||
struct hva_stats_ng {
|
||||
uint32_t ng_errseq; /* Duplicate or out of order */
|
||||
uint32_t ng_lostpdu; /* PDU lost detected */
|
||||
uint32_t ng_badpdu; /* Unknown PDU type */
|
||||
uint32_t ng_rx_novcc; /* Draining PDU on closed VCC */
|
||||
uint32_t ng_rx_iqfull; /* PDU drops no room in atm_intrq */
|
||||
uint32_t ng_tx_rawcell; /* PDU raw cells transmitted */
|
||||
uint32_t ng_rx_rawcell; /* PDU raw cells received */
|
||||
uint64_t ng_tx_pdu; /* PDU transmitted */
|
||||
uint64_t ng_rx_pdu; /* PDU received */
|
||||
};
|
||||
struct hva_stats_atm {
|
||||
uint64_t atm_xmit; /* Cells transmitted */
|
||||
uint64_t atm_rcvd; /* Cells received */
|
||||
};
|
||||
struct hva_stats_aal5 {
|
||||
uint64_t aal5_xmit; /* Cells transmitted */
|
||||
uint64_t aal5_rcvd; /* Cells received */
|
||||
uint32_t aal5_crc_len; /* Cells with CRC/length errors */
|
||||
uint32_t aal5_drops; /* Cell drops */
|
||||
uint64_t aal5_pdu_xmit; /* CS PDUs transmitted */
|
||||
uint64_t aal5_pdu_rcvd; /* CS PDUs received */
|
||||
uint32_t aal5_pdu_crc; /* CS PDUs with CRC errors */
|
||||
uint32_t aal5_pdu_errs; /* CS layer protocol errors */
|
||||
uint32_t aal5_pdu_drops; /* CS PDUs dropped */
|
||||
};
|
||||
.Ed
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr natm 4 ,
|
||||
.Xr netgraph 4 ,
|
||||
.Xr ng_ksocket 4 ,
|
||||
.Xr ngctl 8
|
||||
.Sh AUTHORS
|
||||
.An Harti Brandt Aq harti@FreeBSD.org
|
||||
.An Vincent Jardin Aq vjardin@wanadoo.fr
|
||||
|
|
@ -306,10 +306,6 @@ machine-specific C include files
|
|||
miscellaneous network C include files
|
||||
.It Pa netatalk/
|
||||
Appletalk protocol
|
||||
.It Pa netatm/
|
||||
ATM include files;
|
||||
see
|
||||
.Xr atm 8
|
||||
.It Pa netinet/
|
||||
C include files for Internet standard protocols;
|
||||
see
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ SUBDIR= boot
|
|||
|
||||
# Directories to include in cscope name file and TAGS.
|
||||
CSCOPEDIRS= boot bsm cam compat conf contrib crypto ddb dev fs gdb geom \
|
||||
gnu i4b isa kern libkern modules net net80211 netatalk netatm \
|
||||
gnu i4b isa kern libkern modules net net80211 netatalk \
|
||||
netgraph netinet netinet6 netipsec netipx netnatm netncp \
|
||||
netsmb nfs nfs4client nfsclient nfsserver opencrypto pccard \
|
||||
pci rpc security sys ufs vm ${ARCHDIR}
|
||||
|
|
|
|||
|
|
@ -910,38 +910,6 @@ options DUMMYNET
|
|||
# zero_copy(9) for more details.
|
||||
options ZERO_COPY_SOCKETS
|
||||
|
||||
#
|
||||
# ATM (HARP version) options
|
||||
#
|
||||
# XXX: These have been disabled in FreeBSD 7.0 as they are not MPSAFE.
|
||||
#
|
||||
# ATM_CORE includes the base ATM functionality code. This must be included
|
||||
# for ATM support.
|
||||
#
|
||||
# ATM_IP includes support for running IP over ATM.
|
||||
#
|
||||
# At least one (and usually only one) of the following signalling managers
|
||||
# must be included (note that all signalling managers include PVC support):
|
||||
# ATM_SIGPVC includes support for the PVC-only signalling manager `sigpvc'.
|
||||
# ATM_SPANS includes support for the `spans' signalling manager, which runs
|
||||
# the FORE Systems's proprietary SPANS signalling protocol.
|
||||
# ATM_UNI includes support for the `uni30' and `uni31' signalling managers,
|
||||
# which run the ATM Forum UNI 3.x signalling protocols.
|
||||
#
|
||||
# The `hfa' driver provides support for the FORE Systems, Inc.
|
||||
# PCA-200E ATM PCI Adapter.
|
||||
#
|
||||
# The `harp' pseudo-driver makes all NATM interface drivers available to HARP.
|
||||
#
|
||||
#options ATM_CORE #core ATM protocol family
|
||||
#options ATM_IP #IP over ATM support
|
||||
#options ATM_SIGPVC #SIGPVC signalling manager
|
||||
#options ATM_SPANS #SPANS signalling manager
|
||||
#options ATM_UNI #UNI signalling manager
|
||||
|
||||
#device hfa #FORE PCA-200E ATM PCI
|
||||
#device harp #Pseudo-interface for NATM
|
||||
|
||||
|
||||
#####################################################################
|
||||
# FILESYSTEM OPTIONS
|
||||
|
|
|
|||
103
sys/conf/files
103
sys/conf/files
|
|
@ -667,28 +667,11 @@ dev/flash/at45d.c optional at45d
|
|||
dev/fxp/if_fxp.c optional fxp
|
||||
dev/gem/if_gem.c optional gem
|
||||
dev/gem/if_gem_pci.c optional gem pci
|
||||
#dev/harp/if_harp.c optional harp pci
|
||||
dev/hatm/if_hatm.c optional hatm pci
|
||||
dev/hatm/if_hatm_intr.c optional hatm pci
|
||||
dev/hatm/if_hatm_ioctl.c optional hatm pci
|
||||
dev/hatm/if_hatm_rx.c optional hatm pci
|
||||
dev/hatm/if_hatm_tx.c optional hatm pci
|
||||
#dev/hfa/fore_buffer.c optional hfa
|
||||
#dev/hfa/fore_command.c optional hfa
|
||||
#dev/hfa/fore_globals.c optional hfa
|
||||
#dev/hfa/fore_if.c optional hfa
|
||||
#dev/hfa/fore_init.c optional hfa
|
||||
#dev/hfa/fore_intr.c optional hfa
|
||||
#dev/hfa/fore_output.c optional hfa
|
||||
#dev/hfa/fore_receive.c optional hfa
|
||||
#dev/hfa/fore_stats.c optional hfa
|
||||
#dev/hfa/fore_timer.c optional hfa
|
||||
#dev/hfa/fore_transmit.c optional hfa
|
||||
#dev/hfa/fore_vcm.c optional hfa
|
||||
##dev/hfa/hfa_eisa.c optional hfa eisa
|
||||
#dev/hfa/hfa_freebsd.c optional hfa
|
||||
#dev/hfa/hfa_pci.c optional hfa pci
|
||||
##dev/hfa/hfa_sbus.c optional hfa sbus
|
||||
dev/hifn/hifn7751.c optional hifn
|
||||
dev/hme/if_hme.c optional hme
|
||||
dev/hme/if_hme_pci.c optional hme pci
|
||||
|
|
@ -1891,92 +1874,6 @@ netatalk/ddp_input.c optional netatalk
|
|||
netatalk/ddp_output.c optional netatalk
|
||||
netatalk/ddp_pcb.c optional netatalk
|
||||
netatalk/ddp_usrreq.c optional netatalk
|
||||
#
|
||||
# netatm has been disconnected from the build until it is MPSAFE, or
|
||||
# alternatively, until it is removed.
|
||||
#
|
||||
#netatm/atm_aal5.c optional atm_core
|
||||
#netatm/atm_cm.c optional atm_core
|
||||
#netatm/atm_device.c optional atm_core
|
||||
#netatm/atm_if.c optional atm_core
|
||||
#netatm/atm_proto.c optional atm_core
|
||||
#netatm/atm_signal.c optional atm_core
|
||||
#netatm/atm_socket.c optional atm_core
|
||||
#netatm/atm_subr.c optional atm_core
|
||||
#netatm/atm_usrreq.c optional atm_core
|
||||
#netatm/ipatm/ipatm_event.c optional atm_ip atm_core
|
||||
#netatm/ipatm/ipatm_if.c optional atm_ip atm_core
|
||||
#netatm/ipatm/ipatm_input.c optional atm_ip atm_core
|
||||
#netatm/ipatm/ipatm_load.c optional atm_ip atm_core
|
||||
#netatm/ipatm/ipatm_output.c optional atm_ip atm_core
|
||||
#netatm/ipatm/ipatm_usrreq.c optional atm_ip atm_core
|
||||
#netatm/ipatm/ipatm_vcm.c optional atm_ip atm_core
|
||||
#netatm/sigpvc/sigpvc_if.c optional atm_sigpvc atm_core
|
||||
#netatm/sigpvc/sigpvc_subr.c optional atm_sigpvc atm_core
|
||||
#netatm/spans/spans_arp.c optional atm_spans atm_core \
|
||||
# dependency "spans_xdr.h"
|
||||
#netatm/spans/spans_cls.c optional atm_spans atm_core
|
||||
#netatm/spans/spans_if.c optional atm_spans atm_core
|
||||
#netatm/spans/spans_kxdr.c optional atm_spans atm_core
|
||||
#netatm/spans/spans_msg.c optional atm_spans atm_core
|
||||
#netatm/spans/spans_print.c optional atm_spans atm_core
|
||||
#netatm/spans/spans_proto.c optional atm_spans atm_core
|
||||
#netatm/spans/spans_subr.c optional atm_spans atm_core
|
||||
#netatm/spans/spans_util.c optional atm_spans atm_core
|
||||
#spans_xdr.h optional atm_spans atm_core \
|
||||
# before-depend \
|
||||
# dependency "$S/netatm/spans/spans_xdr.x" \
|
||||
# compile-with "rpcgen -h -C $S/netatm/spans/spans_xdr.x | grep -v rpc/rpc.h > spans_xdr.h" \
|
||||
# clean "spans_xdr.h" \
|
||||
# no-obj no-implicit-rule
|
||||
#spans_xdr.c optional atm_spans atm_core \
|
||||
# before-depend \
|
||||
# dependency "$S/netatm/spans/spans_xdr.x" \
|
||||
# compile-with "rpcgen -c -C $S/netatm/spans/spans_xdr.x | grep -v rpc/rpc.h > spans_xdr.c" \
|
||||
# clean "spans_xdr.c" \
|
||||
# no-obj no-implicit-rule local
|
||||
#spans_xdr.o optional atm_spans atm_core \
|
||||
# dependency "$S/netatm/spans/spans_xdr.x" \
|
||||
# compile-with "${NORMAL_C}" \
|
||||
# no-implicit-rule local
|
||||
#netatm/uni/q2110_sigaa.c optional atm_uni atm_core
|
||||
#netatm/uni/q2110_sigcpcs.c optional atm_uni atm_core
|
||||
#netatm/uni/q2110_subr.c optional atm_uni atm_core
|
||||
#netatm/uni/qsaal1_sigaa.c optional atm_uni atm_core
|
||||
#netatm/uni/qsaal1_sigcpcs.c optional atm_uni atm_core
|
||||
#netatm/uni/qsaal1_subr.c optional atm_uni atm_core
|
||||
#netatm/uni/sscf_uni.c optional atm_uni atm_core
|
||||
#netatm/uni/sscf_uni_lower.c optional atm_uni atm_core
|
||||
#netatm/uni/sscf_uni_upper.c optional atm_uni atm_core
|
||||
#netatm/uni/sscop.c optional atm_uni atm_core
|
||||
#netatm/uni/sscop_lower.c optional atm_uni atm_core
|
||||
#netatm/uni/sscop_pdu.c optional atm_uni atm_core
|
||||
#netatm/uni/sscop_sigaa.c optional atm_uni atm_core
|
||||
#netatm/uni/sscop_sigcpcs.c optional atm_uni atm_core
|
||||
#netatm/uni/sscop_subr.c optional atm_uni atm_core
|
||||
#netatm/uni/sscop_timer.c optional atm_uni atm_core
|
||||
#netatm/uni/sscop_upper.c optional atm_uni atm_core
|
||||
#netatm/uni/uni_load.c optional atm_uni atm_core
|
||||
#netatm/uni/uniarp.c optional atm_uni atm_core
|
||||
#netatm/uni/uniarp_cache.c optional atm_uni atm_core
|
||||
#netatm/uni/uniarp_input.c optional atm_uni atm_core
|
||||
#netatm/uni/uniarp_output.c optional atm_uni atm_core
|
||||
#netatm/uni/uniarp_timer.c optional atm_uni atm_core
|
||||
#netatm/uni/uniarp_vcm.c optional atm_uni atm_core
|
||||
#netatm/uni/uniip.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_decode.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_encode.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_if.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_mbuf.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_msg.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_print.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_proto.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_sigmgr_state.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_subr.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_util.c optional atm_uni atm_core
|
||||
#netatm/uni/unisig_vc_state.c optional atm_uni atm_core
|
||||
#netgraph/atm/atmpif/ng_atmpif.c optional netgraph_atm_atmpif
|
||||
#netgraph/atm/atmpif/ng_atmpif_harp.c optional netgraph_atm_atmpif
|
||||
netgraph/atm/ccatm/ng_ccatm.c optional ngatm_ccatm \
|
||||
compile-with "${NORMAL_C} -I$S/contrib/ngatm"
|
||||
netgraph/atm/ng_atm.c optional ngatm_atm
|
||||
|
|
|
|||
|
|
@ -497,13 +497,6 @@ ZERO_COPY_SOCKETS opt_zero.h
|
|||
TI_PRIVATE_JUMBOS opt_ti.h
|
||||
TI_JUMBO_HDRSPLIT opt_ti.h
|
||||
|
||||
# ATM (HARP version) - disabled as not MPSAFE in 7.0
|
||||
#ATM_CORE opt_atm.h
|
||||
#ATM_IP opt_atm.h
|
||||
#ATM_SIGPVC opt_atm.h
|
||||
#ATM_SPANS opt_atm.h
|
||||
#ATM_UNI opt_atm.h
|
||||
|
||||
# XXX Conflict: # of devices vs network protocol (Native ATM).
|
||||
# This makes "atm.h" unusable.
|
||||
NATM
|
||||
|
|
|
|||
|
|
@ -1,661 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2003
|
||||
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Author: Harti Brandt <harti@freebsd.org>
|
||||
*
|
||||
* HARP pseudo-driver. This driver when loaded attaches to all ngATM drivers
|
||||
* in the system and creates a HARP physical interface for each of them.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/netisr.h>
|
||||
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <netatm/atm_vc.h>
|
||||
|
||||
#include <net/if_atm.h>
|
||||
|
||||
#define HARP_MTU 9188
|
||||
|
||||
/*
|
||||
* Physical interface softc
|
||||
*/
|
||||
struct harp_softc {
|
||||
Cmn_unit cmn;
|
||||
struct ifnet *parent;
|
||||
LIST_ENTRY(harp_softc) link;
|
||||
};
|
||||
|
||||
struct harp_vcc {
|
||||
struct cmn_vcc cmn;
|
||||
};
|
||||
|
||||
MODULE_VERSION(harp, 1);
|
||||
MODULE_DEPEND(harp, atm, 1, 1, 1);
|
||||
|
||||
/* hooks from if_atmsubr.c */
|
||||
extern void (*atm_harp_input_p)(struct ifnet *ifp, struct mbuf **m,
|
||||
struct atm_pseudohdr *ah, void *rxhand);
|
||||
extern void (*atm_harp_attach_p)(struct ifnet *);
|
||||
extern void (*atm_harp_detach_p)(struct ifnet *);
|
||||
|
||||
static MALLOC_DEFINE(M_HARP, "harp", "Harp pseudo interface");
|
||||
|
||||
static uma_zone_t harp_nif_zone;
|
||||
static uma_zone_t harp_vcc_zone;
|
||||
|
||||
/* List of all existing 'harp' interfaces */
|
||||
static LIST_HEAD(, harp_softc) harp_softc_list =
|
||||
LIST_HEAD_INITIALIZER(harp_softc_list);
|
||||
|
||||
static struct stack_defn harp_svaal5 = {
|
||||
NULL,
|
||||
SAP_CPCS_AAL5,
|
||||
SDF_TERM,
|
||||
atm_dev_inst,
|
||||
atm_dev_lower,
|
||||
NULL,
|
||||
0,
|
||||
};
|
||||
|
||||
static struct stack_defn *harp_services = &harp_svaal5;
|
||||
|
||||
/*
|
||||
* Map between constants
|
||||
*/
|
||||
static const struct {
|
||||
u_int vendor;
|
||||
u_int api;
|
||||
u_int dev;
|
||||
} map_devs[] = {
|
||||
[ATM_DEVICE_UNKNOWN] =
|
||||
{ VENDOR_UNKNOWN, VENDAPI_UNKNOWN, DEV_UNKNOWN },
|
||||
[ATM_DEVICE_PCA200E] =
|
||||
{ VENDOR_FORE, VENDAPI_FORE_1, DEV_FORE_PCA200E },
|
||||
[ATM_DEVICE_HE155] =
|
||||
{ VENDOR_FORE, VENDAPI_FORE_2, DEV_FORE_HE155 },
|
||||
[ATM_DEVICE_HE622] =
|
||||
{ VENDOR_FORE, VENDAPI_FORE_2, DEV_FORE_HE622 },
|
||||
[ATM_DEVICE_ENI155P] =
|
||||
{ VENDOR_ENI, VENDAPI_ENI_1, DEV_ENI_155P },
|
||||
[ATM_DEVICE_ADP155P] =
|
||||
{ VENDOR_ENI, VENDAPI_ENI_1, DEV_ENI_155P },
|
||||
[ATM_DEVICE_FORELE25] =
|
||||
{ VENDOR_FORE, VENDAPI_IDT_1, DEV_FORE_LE25 },
|
||||
[ATM_DEVICE_FORELE155] =
|
||||
{ VENDOR_FORE, VENDAPI_IDT_1, DEV_FORE_LE155 },
|
||||
[ATM_DEVICE_NICSTAR25] =
|
||||
{ VENDOR_IDT, VENDAPI_IDT_1, DEV_IDT_25 },
|
||||
[ATM_DEVICE_NICSTAR155] =
|
||||
{ VENDOR_IDT, VENDAPI_IDT_1, DEV_IDT_155 },
|
||||
[ATM_DEVICE_IDTABR25] =
|
||||
{ VENDOR_IDT, VENDAPI_IDT_2, DEV_IDTABR_25 },
|
||||
[ATM_DEVICE_IDTABR155] =
|
||||
{ VENDOR_IDT, VENDAPI_IDT_2, DEV_IDTABR_155 },
|
||||
[ATM_DEVICE_PROATM25] =
|
||||
{ VENDOR_PROSUM, VENDAPI_IDT_2, DEV_PROATM_25 },
|
||||
[ATM_DEVICE_PROATM155] =
|
||||
{ VENDOR_PROSUM, VENDAPI_IDT_2, DEV_PROATM_155 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Return zero if this interface is ok for us.
|
||||
* XXX This should go away when we have full ngATM-ified the en driver.
|
||||
*/
|
||||
static int
|
||||
harp_check_if(const struct ifnet *ifp)
|
||||
{
|
||||
if (ifp->if_type == IFT_ATM && strcmp(ifp->if_dname, "en"))
|
||||
return (0);
|
||||
else
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Instantiate a VCC stack.
|
||||
*
|
||||
* Could check for correct attributes here.
|
||||
*/
|
||||
static int
|
||||
harp_instvcc(Cmn_unit *up, Cmn_vcc *vp)
|
||||
{
|
||||
struct harp_softc *sc;
|
||||
|
||||
if (up == NULL || vp == NULL || vp->cv_connvc == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
sc = (struct harp_softc *)up;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a VCC.
|
||||
*/
|
||||
static int
|
||||
harp_openvcc(Cmn_unit *up, Cmn_vcc *vp)
|
||||
{
|
||||
struct harp_softc *sc;
|
||||
struct atmio_openvcc data;
|
||||
Atm_attributes *attrib;
|
||||
struct vccb *vccinf;
|
||||
const struct ifatm_mib *mib;
|
||||
int err;
|
||||
|
||||
if (up == NULL || vp == NULL || vp->cv_connvc == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
sc = (struct harp_softc *)up;
|
||||
mib = sc->parent->if_linkmib;
|
||||
|
||||
attrib = &vp->cv_connvc->cvc_attr;
|
||||
vccinf = vp->cv_connvc->cvc_vcc;
|
||||
|
||||
if (attrib == NULL || vccinf == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
if (vccinf->vc_vpi >= (1 << mib->vpi_bits) ||
|
||||
vccinf->vc_vci >= (1 << mib->vci_bits))
|
||||
return (EINVAL);
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
|
||||
switch (attrib->aal.type) {
|
||||
|
||||
case ATM_AAL0:
|
||||
data.param.aal = ATMIO_AAL_0;
|
||||
break;
|
||||
|
||||
case ATM_AAL5:
|
||||
data.param.aal = ATMIO_AAL_5;
|
||||
break;
|
||||
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
data.param.vpi = vccinf->vc_vpi;
|
||||
data.param.vci = vccinf->vc_vci;
|
||||
data.param.rmtu = HARP_MTU;
|
||||
data.param.tmtu = HARP_MTU;
|
||||
|
||||
switch (attrib->bearer.v.bearer_class) {
|
||||
|
||||
case T_ATM_CLASS_C:
|
||||
data.param.traffic = ATMIO_TRAFFIC_VBR;
|
||||
break;
|
||||
|
||||
case T_ATM_CLASS_X:
|
||||
switch (attrib->bearer.v.traffic_type) {
|
||||
|
||||
case T_ATM_CBR:
|
||||
data.param.traffic = ATMIO_TRAFFIC_CBR;
|
||||
break;
|
||||
|
||||
case T_ATM_VBR:
|
||||
data.param.traffic = ATMIO_TRAFFIC_VBR;
|
||||
break;
|
||||
|
||||
case T_ATM_ABR:
|
||||
/* not really supported by HARP */
|
||||
return (EINVAL);
|
||||
|
||||
default:
|
||||
case T_ATM_UBR:
|
||||
data.param.traffic = ATMIO_TRAFFIC_UBR;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
data.param.tparam.pcr = attrib->traffic.v.forward.PCR_all_traffic;
|
||||
data.param.tparam.scr = attrib->traffic.v.forward.SCR_all_traffic;
|
||||
data.param.tparam.mbs = attrib->traffic.v.forward.MBS_all_traffic;
|
||||
|
||||
data.rxhand = sc;
|
||||
data.param.flags = ATMIO_FLAG_HARP;
|
||||
|
||||
err = (*sc->parent->if_ioctl)(sc->parent, SIOCATMOPENVCC,
|
||||
(caddr_t)&data);
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* Close VCC
|
||||
*/
|
||||
static int
|
||||
harp_closevcc(Cmn_unit *up, Cmn_vcc *vp)
|
||||
{
|
||||
struct harp_softc *sc;
|
||||
struct atmio_closevcc data;
|
||||
int err;
|
||||
|
||||
if (vp == NULL || vp->cv_connvc == NULL ||
|
||||
vp->cv_connvc->cvc_vcc == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
sc = (struct harp_softc *)up;
|
||||
|
||||
data.vpi = vp->cv_connvc->cvc_vcc->vc_vpi;
|
||||
data.vci = vp->cv_connvc->cvc_vcc->vc_vci;
|
||||
|
||||
err = (*sc->parent->if_ioctl)(sc->parent, SIOCATMCLOSEVCC,
|
||||
(caddr_t)&data);
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* IOCTLs
|
||||
*/
|
||||
static int
|
||||
harp_ioctl(int code, caddr_t addr, caddr_t arg)
|
||||
{
|
||||
return (ENOSYS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Output data
|
||||
*/
|
||||
static void
|
||||
harp_output(Cmn_unit *cu, Cmn_vcc *cv, KBuffer *m)
|
||||
{
|
||||
struct harp_softc *sc = (struct harp_softc *)cu;
|
||||
struct atm_pseudohdr *aph;
|
||||
int error;
|
||||
int mlen;
|
||||
|
||||
if (cv == NULL || cv->cv_connvc == NULL ||
|
||||
cv->cv_connvc->cvc_vcc == NULL) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
M_ASSERTPKTHDR(m);
|
||||
|
||||
/*
|
||||
* Harp seems very broken with regard to mbuf handling. The length
|
||||
* in the packet header is mostly broken here so recompute it.
|
||||
*/
|
||||
m->m_pkthdr.len = mlen = m_length(m, NULL);
|
||||
|
||||
/*
|
||||
* Prepend pseudo-hdr. Drivers don't care about the flags.
|
||||
*/
|
||||
M_PREPEND(m, sizeof(*aph), M_DONTWAIT);
|
||||
if (m == NULL)
|
||||
return;
|
||||
|
||||
aph = mtod(m, struct atm_pseudohdr *);
|
||||
ATM_PH_VPI(aph) = cv->cv_connvc->cvc_vcc->vc_vpi;
|
||||
ATM_PH_SETVCI(aph, cv->cv_connvc->cvc_vcc->vc_vci);
|
||||
ATM_PH_FLAGS(aph) = 0;
|
||||
|
||||
error = atm_output(sc->parent, m, NULL, NULL);
|
||||
|
||||
if (error) {
|
||||
printf("%s: error %d\n", __func__, error);
|
||||
sc->cmn.cu_pif.pif_oerrors++;
|
||||
cv->cv_connvc->cvc_vcc->vc_oerrors++;
|
||||
if (cv->cv_connvc->cvc_vcc->vc_nif)
|
||||
ANIF2IFP(cv->cv_connvc->cvc_vcc->vc_nif)->if_oerrors++;
|
||||
return;
|
||||
}
|
||||
|
||||
/* statistics */
|
||||
sc->cmn.cu_pif.pif_opdus++;
|
||||
sc->cmn.cu_pif.pif_obytes += mlen;
|
||||
cv->cv_connvc->cvc_vcc->vc_opdus++;
|
||||
cv->cv_connvc->cvc_vcc->vc_obytes += mlen;
|
||||
if (cv->cv_connvc->cvc_vcc->vc_nif) {
|
||||
cv->cv_connvc->cvc_vcc->vc_nif->nif_obytes += mlen;
|
||||
ANIF2IFP(cv->cv_connvc->cvc_vcc->vc_nif)->if_obytes += mlen;
|
||||
ANIF2IFP(cv->cv_connvc->cvc_vcc->vc_nif)->if_opackets++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Attach a new interface
|
||||
*/
|
||||
static void
|
||||
harp_attach(struct ifnet *parent)
|
||||
{
|
||||
struct harp_softc *sc;
|
||||
const struct ifatm_mib *mib;
|
||||
int error;
|
||||
|
||||
if (harp_check_if(parent) != 0)
|
||||
return;
|
||||
|
||||
sc = malloc(sizeof(*sc), M_HARP, M_WAITOK | M_ZERO);
|
||||
|
||||
sc->parent = parent;
|
||||
sc->cmn.cu_unit = parent->if_dunit;
|
||||
sc->cmn.cu_mtu = HARP_MTU;
|
||||
sc->cmn.cu_ioctl = harp_ioctl;
|
||||
sc->cmn.cu_instvcc = harp_instvcc;
|
||||
sc->cmn.cu_openvcc = harp_openvcc;
|
||||
sc->cmn.cu_closevcc = harp_closevcc;
|
||||
sc->cmn.cu_output = harp_output;
|
||||
sc->cmn.cu_vcc_zone = harp_vcc_zone;
|
||||
sc->cmn.cu_nif_zone = harp_nif_zone;
|
||||
sc->cmn.cu_softc = sc;
|
||||
|
||||
/* config */
|
||||
mib = parent->if_linkmib;
|
||||
if (mib->device >= sizeof(map_devs) / sizeof(map_devs[0])) {
|
||||
sc->cmn.cu_config.ac_vendor = VENDOR_UNKNOWN;
|
||||
sc->cmn.cu_config.ac_vendapi = VENDAPI_UNKNOWN;
|
||||
sc->cmn.cu_config.ac_device = DEV_UNKNOWN;
|
||||
} else {
|
||||
sc->cmn.cu_config.ac_vendor = map_devs[mib->device].vendor;
|
||||
sc->cmn.cu_config.ac_vendapi = map_devs[mib->device].api;
|
||||
sc->cmn.cu_config.ac_device = map_devs[mib->device].dev;
|
||||
}
|
||||
|
||||
switch (mib->media) {
|
||||
|
||||
case IFM_ATM_UTP_25:
|
||||
sc->cmn.cu_config.ac_media = MEDIA_UTP25;;
|
||||
break;
|
||||
|
||||
case IFM_ATM_TAXI_100:
|
||||
sc->cmn.cu_config.ac_media = MEDIA_TAXI_100;
|
||||
break;
|
||||
|
||||
case IFM_ATM_TAXI_140:
|
||||
sc->cmn.cu_config.ac_media = MEDIA_TAXI_140;
|
||||
break;
|
||||
|
||||
case IFM_ATM_MM_155:
|
||||
case IFM_ATM_SM_155:
|
||||
sc->cmn.cu_config.ac_media = MEDIA_OC3C;
|
||||
break;
|
||||
|
||||
case IFM_ATM_MM_622:
|
||||
case IFM_ATM_SM_622:
|
||||
sc->cmn.cu_config.ac_media = MEDIA_OC12C;
|
||||
break;
|
||||
|
||||
case IFM_ATM_UTP_155:
|
||||
sc->cmn.cu_config.ac_media = MEDIA_UTP155;
|
||||
break;
|
||||
|
||||
default:
|
||||
sc->cmn.cu_config.ac_media = MEDIA_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
sc->cmn.cu_config.ac_bustype = BUS_PCI;
|
||||
sc->cmn.cu_pif.pif_pcr = mib->pcr;
|
||||
sc->cmn.cu_pif.pif_maxvpi = (1 << mib->vpi_bits) - 1;
|
||||
sc->cmn.cu_pif.pif_maxvci = (1 << mib->vci_bits) - 1;
|
||||
|
||||
snprintf(sc->cmn.cu_config.ac_hard_vers,
|
||||
sizeof(sc->cmn.cu_config.ac_hard_vers), "0x%lx",
|
||||
(u_long)mib->hw_version);
|
||||
snprintf(sc->cmn.cu_config.ac_firm_vers,
|
||||
sizeof(sc->cmn.cu_config.ac_firm_vers), "0x%lx",
|
||||
(u_long)mib->sw_version);
|
||||
sc->cmn.cu_config.ac_serial = mib->serial;
|
||||
sc->cmn.cu_config.ac_ram = 0;
|
||||
sc->cmn.cu_config.ac_ramsize = 0;
|
||||
|
||||
sc->cmn.cu_config.ac_macaddr.ma_data[0] =
|
||||
sc->cmn.cu_pif.pif_macaddr.ma_data[0] = mib->esi[0];
|
||||
sc->cmn.cu_config.ac_macaddr.ma_data[1] =
|
||||
sc->cmn.cu_pif.pif_macaddr.ma_data[1] = mib->esi[1];
|
||||
sc->cmn.cu_config.ac_macaddr.ma_data[2] =
|
||||
sc->cmn.cu_pif.pif_macaddr.ma_data[2] = mib->esi[2];
|
||||
sc->cmn.cu_config.ac_macaddr.ma_data[3] =
|
||||
sc->cmn.cu_pif.pif_macaddr.ma_data[3] = mib->esi[3];
|
||||
sc->cmn.cu_config.ac_macaddr.ma_data[4] =
|
||||
sc->cmn.cu_pif.pif_macaddr.ma_data[4] = mib->esi[4];
|
||||
sc->cmn.cu_config.ac_macaddr.ma_data[5] =
|
||||
sc->cmn.cu_pif.pif_macaddr.ma_data[5] = mib->esi[5];
|
||||
|
||||
error = atm_physif_register(&sc->cmn, parent->if_dname, harp_services);
|
||||
if (error) {
|
||||
log(LOG_ERR, "%s: pif registration failed %d\n",
|
||||
parent->if_dname, error);
|
||||
free(sc, M_HARP);
|
||||
return;
|
||||
}
|
||||
LIST_INSERT_HEAD(&harp_softc_list, sc, link);
|
||||
|
||||
sc->cmn.cu_flags |= CUF_INITED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroy a cloned device
|
||||
*/
|
||||
static void
|
||||
harp_detach(struct ifnet *ifp)
|
||||
{
|
||||
struct harp_softc *sc;
|
||||
int error;
|
||||
|
||||
LIST_FOREACH(sc, &harp_softc_list, link)
|
||||
if (sc->parent == ifp)
|
||||
break;
|
||||
if (sc == NULL)
|
||||
return;
|
||||
|
||||
error = atm_physif_deregister(&sc->cmn);
|
||||
if (error)
|
||||
log(LOG_ERR, "%s: de-registration failed %d\n", ifp->if_dname,
|
||||
error);
|
||||
|
||||
LIST_REMOVE(sc, link);
|
||||
|
||||
free(sc, M_HARP);
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass PDU up the stack
|
||||
*/
|
||||
static void
|
||||
harp_recv_stack(void *tok, KBuffer *m)
|
||||
{
|
||||
Cmn_vcc *vcc = tok;
|
||||
int err;
|
||||
|
||||
M_ASSERTPKTHDR(m);
|
||||
STACK_CALL(CPCS_UNITDATA_SIG, vcc->cv_upper, vcc->cv_toku,
|
||||
vcc->cv_connvc, (intptr_t)m, 0, err);
|
||||
if (err) {
|
||||
printf("%s: error %d\n", __func__, err);
|
||||
KB_FREEALL(m);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Possible input from NATM
|
||||
*/
|
||||
static void
|
||||
harp_input(struct ifnet *ifp, struct mbuf **mp, struct atm_pseudohdr *ah,
|
||||
void *rxhand)
|
||||
{
|
||||
struct harp_softc *sc = rxhand;
|
||||
Cmn_vcc *vcc;
|
||||
char *cp;
|
||||
u_int pfxlen;
|
||||
struct mbuf *m, *m0;
|
||||
int mlen;
|
||||
|
||||
if ((ATM_PH_FLAGS(ah) & ATMIO_FLAG_HARP) == 0)
|
||||
return;
|
||||
|
||||
/* grab the packet */
|
||||
m = *mp;
|
||||
*mp = NULL;
|
||||
|
||||
if (sc->parent != ifp) {
|
||||
printf("%s: parent=%p ifp=%p\n", __func__, sc->parent, ifp);
|
||||
goto drop;
|
||||
}
|
||||
|
||||
vcc = atm_dev_vcc_find(&sc->cmn, ATM_PH_VPI(ah),
|
||||
ATM_PH_VCI(ah), VCC_IN);
|
||||
if (vcc == NULL) {
|
||||
printf("%s: VCC %u/%u not found\n", __func__,ATM_PH_VPI(ah),
|
||||
ATM_PH_VCI(ah));
|
||||
goto drop;
|
||||
}
|
||||
|
||||
/* fit two pointers into the mbuf - assume, that the the data is
|
||||
* pointer aligned. If it doesn't fit into the first mbuf, prepend
|
||||
* another one.
|
||||
* Don't count the new fields in the packet length (XXX)
|
||||
*/
|
||||
mlen = m->m_pkthdr.len;
|
||||
pfxlen = sizeof(atm_intr_func_t) + sizeof(void *);
|
||||
if (M_LEADINGSPACE(m) < pfxlen) {
|
||||
MGETHDR(m0, 0, MT_DATA);
|
||||
if (m0 == NULL) {
|
||||
printf("%s: no leading space in buffer\n", __func__);
|
||||
goto drop;
|
||||
}
|
||||
m0->m_len = 0;
|
||||
m0->m_next = m;
|
||||
|
||||
M_MOVE_PKTHDR(m0, m);
|
||||
|
||||
m = m0;
|
||||
}
|
||||
m->m_len += pfxlen;
|
||||
m->m_data -= pfxlen;
|
||||
cp = mtod(m, char *);
|
||||
*((atm_intr_func_t *)cp) = harp_recv_stack;
|
||||
cp += sizeof(atm_intr_func_t);
|
||||
*((void **)cp) = (void *)vcc;
|
||||
|
||||
/* count the packet */
|
||||
sc->cmn.cu_pif.pif_ipdus++;
|
||||
sc->cmn.cu_pif.pif_ibytes += mlen;
|
||||
vcc->cv_connvc->cvc_vcc->vc_ipdus++;
|
||||
vcc->cv_connvc->cvc_vcc->vc_ibytes += mlen;
|
||||
if (vcc->cv_connvc->cvc_vcc->vc_nif) {
|
||||
vcc->cv_connvc->cvc_vcc->vc_nif->nif_ibytes += mlen;
|
||||
ANIF2IFP(vcc->cv_connvc->cvc_vcc->vc_nif)->if_ipackets++;
|
||||
ANIF2IFP(vcc->cv_connvc->cvc_vcc->vc_nif)->if_ibytes += mlen;
|
||||
}
|
||||
|
||||
/* hand it off */
|
||||
netisr_dispatch(NETISR_ATM, m);
|
||||
return;
|
||||
|
||||
drop:
|
||||
m_freem(m);
|
||||
}
|
||||
|
||||
/*
|
||||
* Module loading/unloading
|
||||
*/
|
||||
static int
|
||||
harp_modevent(module_t mod, int event, void *data)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
|
||||
switch (event) {
|
||||
|
||||
case MOD_LOAD:
|
||||
harp_nif_zone = uma_zcreate("harp nif", sizeof(struct atm_nif),
|
||||
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
|
||||
if (harp_nif_zone == NULL)
|
||||
panic("%s: nif_zone", __func__);
|
||||
|
||||
harp_vcc_zone = uma_zcreate("harp vcc", sizeof(struct harp_vcc),
|
||||
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
|
||||
if (harp_vcc_zone == NULL)
|
||||
panic("%s: vcc_zone", __func__);
|
||||
|
||||
/* Create harp interfaces for all existing ATM interfaces */
|
||||
TAILQ_FOREACH(ifp, &ifnet, if_link)
|
||||
harp_attach(ifp);
|
||||
|
||||
atm_harp_attach_p = harp_attach;
|
||||
atm_harp_detach_p = harp_detach;
|
||||
atm_harp_input_p = harp_input;
|
||||
break;
|
||||
|
||||
case MOD_UNLOAD:
|
||||
atm_harp_attach_p = NULL;
|
||||
atm_harp_detach_p = NULL;
|
||||
atm_harp_input_p = NULL;
|
||||
|
||||
while (!LIST_EMPTY(&harp_softc_list))
|
||||
harp_detach(LIST_FIRST(&harp_softc_list)->parent);
|
||||
|
||||
uma_zdestroy(harp_nif_zone);
|
||||
uma_zdestroy(harp_vcc_zone);
|
||||
|
||||
break;
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static moduledata_t harp_mod = {
|
||||
"if_harp",
|
||||
harp_modevent,
|
||||
0
|
||||
};
|
||||
|
||||
DECLARE_MODULE(harp, harp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Protocol and implementation definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FORE_H
|
||||
#define _FORE_H
|
||||
|
||||
#ifndef FORE_DEV_NAME
|
||||
#define FORE_DEV_NAME "hfa"
|
||||
#endif
|
||||
|
||||
#define FORE_MAX_UNITS 8 /* Maximum number of devices we support */
|
||||
#define FORE_MIN_UCODE 0x20300 /* Minimum microcode version we support */
|
||||
|
||||
#define FORE_IFF_MTU 9188 /* Network interface MTU */
|
||||
#define FORE_MAX_VCC 1024 /* Maximum number of open VCCs */
|
||||
#define FORE_MAX_VPI 0 /* Maximum VPI value */
|
||||
#define FORE_MAX_VCI 1023 /* Maximum VCI value */
|
||||
#define FORE_DEF_RATE 0x00000000 /* Default rate control = disabled */
|
||||
|
||||
#define XMIT_QUELEN 32 /* Length of transmit queue */
|
||||
#define RECV_QUELEN 32 /* Length of receive queue */
|
||||
#define CMD_QUELEN 8 /* Length of command queue */
|
||||
|
||||
#define FORE_TIME_TICK 5 /* Watchdog timer tick (seconds) */
|
||||
#define FORE_WATCHDOG 3 /* Device watchdog timeout (ticks) */
|
||||
#define FORE_RECV_RETRY 3 /* Wait for receive queue entry retry count */
|
||||
#define FORE_RECV_DELAY 10 /* Wait for receive queue entry delay (usec) */
|
||||
|
||||
|
||||
/*
|
||||
* Receive Buffer strategies
|
||||
*/
|
||||
#define BUF_MIN_VCC 4 /* Minimum for buffer supply calculations */
|
||||
|
||||
#define BUF_DATA_ALIGN 4 /* Fore-required data alignment */
|
||||
|
||||
/*
|
||||
* Strategy 1 Small - mbuf
|
||||
* Strategy 1 Large - cluster mbuf
|
||||
*
|
||||
* XXX buffer controls - the RECV_MAX_SEGS calculation comes out wrong
|
||||
* using the true buffer size values if the CP really only does full-cell
|
||||
* filling of a particular buffer - we must clarify this...it also appears
|
||||
* the minimum buffer size is 64, even if the CP can only fit in 1 cell.
|
||||
*/
|
||||
#define SIZEOF_Buf_handle 16 /* XXX sizeof(Buf_handle) */
|
||||
|
||||
#undef m_ext
|
||||
typedef struct m_ext M_ext;
|
||||
#define m_ext M_dat.MH.MH_dat.MH_ext
|
||||
#define BUF1_SM_HOFF (sizeof(struct m_hdr)) /* Buffer-to-handle offset */
|
||||
#define BUF1_SM_HDR (sizeof(struct m_hdr) + sizeof(struct pkthdr))
|
||||
#define BUF1_SM_LEN (MHLEN)
|
||||
#define BUF1_LG_HOFF (sizeof(struct m_hdr) + sizeof(struct pkthdr) \
|
||||
+ sizeof(M_ext)) /* Buffer-to-handle offset */
|
||||
/*
|
||||
* BUF1_SM_DOFF - CP data offset into buffer data space
|
||||
* BUF1_SM_SIZE - Buffer size
|
||||
*
|
||||
* These should be defined as follows, but we need compile-time constants:
|
||||
*
|
||||
* #define BUF1_SM_DOFF (roundup(BUF1_SM_HOFF + SIZEOF_Buf_handle,
|
||||
* BUF_DATA_ALIGN) - BUF1_SM_HDR)
|
||||
* #define BUF1_SM_SIZE MAX(BUF1_SM_LEN - BUF1_SM_DOFF, 64)
|
||||
*
|
||||
*/
|
||||
#define BUF1_SM_DOFF (SIZEOF_Buf_handle)
|
||||
#define BUF1_SM_SIZE (BUF1_SM_LEN - BUF1_SM_DOFF)
|
||||
|
||||
#define BUF1_SM_QUELEN 16 /* Entries in supply queue */
|
||||
#define BUF1_SM_CPPOOL 256 /* Buffers in CP-resident pool */
|
||||
#define BUF1_SM_ENTSIZE 8 /* Buffers in each supply queue entry */
|
||||
|
||||
#define BUF1_LG_DOFF 0 /* CP data offset into mbuf data space */
|
||||
#define BUF1_LG_SIZE MCLBYTES /* Buffer size */
|
||||
#define BUF1_LG_QUELEN 16 /* Entries in supply queue */
|
||||
#define BUF1_LG_CPPOOL 512 /* Buffers in CP-resident pool */
|
||||
#define BUF1_LG_ENTSIZE 8 /* Buffers in each supply queue entry */
|
||||
|
||||
#endif /* _FORE_H */
|
||||
|
|
@ -1,606 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* ATM Adaptation Layer Interface (AALI) definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FORE_AALI_H
|
||||
#define _FORE_AALI_H
|
||||
|
||||
/*
|
||||
* This file contains the definitions required by the FORE ATM Adaptation
|
||||
* Layer Interface (AALI) specification.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Addressing/Pointer definitions
|
||||
*
|
||||
* The CP memory only supports 32-bit word accesses (read and write) - thus,
|
||||
* all memory must be defined and accessed as 32-bit words. Also, since the
|
||||
* data transfers are word-sized, we must take care of byte-swapping issues
|
||||
* from/to little-endian hosts (the CP is an i960 processor, ie big-endian).
|
||||
*
|
||||
* All pointers to CP memory areas are actually offsets from the start of
|
||||
* the adapter RAM address space.
|
||||
*
|
||||
* All CP-resident data structures are declared volatile.
|
||||
*/
|
||||
typedef void * H_addr; /* Host-resident address */
|
||||
typedef unsigned long H_dma; /* Host-resident DMA address */
|
||||
typedef unsigned long CP_word; /* CP-resident word */
|
||||
typedef unsigned long CP_addr; /* CP-resident CP memory offset */
|
||||
typedef unsigned long CP_dma; /* CP-resident DMA address */
|
||||
|
||||
|
||||
/*
|
||||
* Structure defining the CP's shared memory interface to the mon960 program
|
||||
*/
|
||||
struct mon960 {
|
||||
CP_word mon_xmitmon; /* Uart - host to mon960 (see below) */
|
||||
CP_word mon_xmithost; /* Uart - mon960 to host (see below) */
|
||||
CP_word mon_bstat; /* Boot status word (see below) */
|
||||
CP_addr mon_appl; /* Pointer to application memory area */
|
||||
CP_word mon_ver; /* Mon960 firmware version */
|
||||
};
|
||||
typedef volatile struct mon960 Mon960;
|
||||
|
||||
/*
|
||||
* Pseudo-UART usage
|
||||
*/
|
||||
#define UART_READY 0x00000000 /* UART is ready for more data */
|
||||
#define UART_VALID 0x01000000 /* UART character is valid */
|
||||
#define UART_DATAMASK 0x000000ff /* UART character data mask */
|
||||
|
||||
/*
|
||||
* Boot Status Word
|
||||
*/
|
||||
#define BOOT_COLDSTART 0xc01dc01d /* CP is performing cold start */
|
||||
#define BOOT_MONREADY 0x02201958 /* Monitor is waiting for commands */
|
||||
#define BOOT_FAILTEST 0xadbadbad /* Monitor failed self-test */
|
||||
#define BOOT_RUNNING 0xce11feed /* Microcode downloaded and running */
|
||||
|
||||
#define BOOT_LOOPS 20 /* Loops to wait for CP to boot */
|
||||
#define BOOT_DELAY 100000 /* Delay (us) for each boot loop */
|
||||
|
||||
|
||||
/*
|
||||
* Supported AALs
|
||||
*/
|
||||
enum fore_aal {
|
||||
FORE_AAL_0 = 0, /* Cell Service */
|
||||
FORE_AAL_4 = 4, /* AAL 3/4 */
|
||||
FORE_AAL_5 = 5 /* AAL 5 */
|
||||
};
|
||||
typedef enum fore_aal Fore_aal;
|
||||
|
||||
|
||||
/*
|
||||
* Buffer strategy definition
|
||||
*/
|
||||
struct buf_strategy {
|
||||
CP_word bfs_quelen; /* Buffer supply queue entries */
|
||||
CP_word bfs_bufsize; /* Buffer size */
|
||||
CP_word bfs_cppool; /* Buffers in CP-resident pool */
|
||||
CP_word bfs_entsize; /* Buffers in each supply queue entry */
|
||||
};
|
||||
typedef volatile struct buf_strategy Buf_strategy;
|
||||
|
||||
/*
|
||||
* Buffer strategy id
|
||||
*/
|
||||
#define BUF_STRAT_1 0 /* Buffer strategy one */
|
||||
#define BUF_STRAT_2 1 /* Buffer strategy two */
|
||||
|
||||
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Common Queue Element
|
||||
*
|
||||
* Used for Transmit, Receive and Buffer Supply Queues
|
||||
*/
|
||||
struct com_queue {
|
||||
CP_dma cq_descr; /* Pointer to element descriptor */
|
||||
CP_dma cq_status; /* Pointer to element status word */
|
||||
};
|
||||
typedef volatile struct com_queue Com_queue;
|
||||
|
||||
|
||||
/*
|
||||
* Queue element status word
|
||||
*/
|
||||
typedef volatile unsigned long Q_status;
|
||||
|
||||
#define QSTAT_PENDING 0x01 /* Operation is pending */
|
||||
#define QSTAT_COMPLETED 0x02 /* Operation successfully completed */
|
||||
#define QSTAT_FREE 0x04 /* Queue element is free/unused */
|
||||
#define QSTAT_ERROR 0x08 /* Operation encountered an error */
|
||||
|
||||
#define QSTAT_ALIGN 4
|
||||
|
||||
|
||||
/*
|
||||
* PDU Transmit Queue
|
||||
*/
|
||||
|
||||
/*
|
||||
* PDU Transmit Queue Element
|
||||
*/
|
||||
typedef volatile struct com_queue Xmit_queue;
|
||||
|
||||
|
||||
/*
|
||||
* PDU Transmit buffer segment descriptor
|
||||
*/
|
||||
struct xmit_seg_descr {
|
||||
H_dma xsd_buffer; /* Buffer's DMA address */
|
||||
u_int xsd_len; /* Data length in buffer */
|
||||
};
|
||||
typedef struct xmit_seg_descr Xmit_seg_descr;
|
||||
|
||||
#define XMIT_SEG_ALIGN 4
|
||||
|
||||
|
||||
/*
|
||||
* PDU Transmit descriptor header
|
||||
*/
|
||||
struct xmit_descr_hdr {
|
||||
u_long xdh_cell_hdr; /* Cell header (minus HEC) */
|
||||
u_long xdh_spec; /* Transmit specification (see below) */
|
||||
u_long xdh_rate; /* Rate control (data/idle cell ratio)*/
|
||||
u_long xdh_pad; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef struct xmit_descr_hdr Xmit_descr_hdr;
|
||||
|
||||
|
||||
#define XMIT_BLK_BITS 5 /* Bits to encode block size */
|
||||
#define XMIT_MAX_BLK_BITS 4 /* Max bits we can use */
|
||||
#define XMIT_BLK_SIZE (1 << XMIT_BLK_BITS)
|
||||
#define XMIT_SEGS_TO_BLKS(nseg) \
|
||||
((((nseg) * sizeof(Xmit_seg_descr)) \
|
||||
+ sizeof(Xmit_descr_hdr) + (XMIT_BLK_SIZE - 1)) \
|
||||
>> XMIT_BLK_BITS)
|
||||
#define XMIT_MAX_BLKS ((1 << XMIT_MAX_BLK_BITS) - 1)
|
||||
#define XMIT_HDR_SEGS ((XMIT_BLK_SIZE - sizeof(Xmit_descr_hdr)) \
|
||||
/ sizeof(Xmit_seg_descr))
|
||||
#define XMIT_BLK_SEGS (XMIT_BLK_SIZE / sizeof(Xmit_seg_descr))
|
||||
#define XMIT_EXTRA_SEGS ((XMIT_MAX_BLKS - 1) * XMIT_BLK_SEGS)
|
||||
#define XMIT_MAX_SEGS (XMIT_EXTRA_SEGS + XMIT_HDR_SEGS)
|
||||
|
||||
|
||||
/*
|
||||
* PDU Transmit descriptor
|
||||
*/
|
||||
struct xmit_descr {
|
||||
Xmit_descr_hdr xd_hdr; /* Descriptor header */
|
||||
Xmit_seg_descr xd_seg[XMIT_MAX_SEGS]; /* PDU segments */
|
||||
};
|
||||
typedef struct xmit_descr Xmit_descr;
|
||||
|
||||
#define xd_cell_hdr xd_hdr.xdh_cell_hdr
|
||||
#define xd_spec xd_hdr.xdh_spec
|
||||
#define xd_rate xd_hdr.xdh_rate
|
||||
|
||||
/*
|
||||
* Transmit specification
|
||||
*
|
||||
* Bits 0-15 - Total PDU length
|
||||
* Bits 16-23 - Number of transmit segments
|
||||
* Bits 24-27 - AAL type
|
||||
* Bits 28-31 - Interrupt flag
|
||||
*/
|
||||
#define XDS_SET_SPEC(i,a,n,l) (((i) << 28) | ((a) << 24) | ((n) << 16) | (l))
|
||||
#define XDS_GET_LEN(s) ((s) & 0xffff)
|
||||
#define XDS_GET_SEGS(s) (((s) >> 16) & 0xff)
|
||||
#define XDS_GET_AAL(s) (((s) >> 24) & 0xf)
|
||||
#define XDS_GET_INTR(s) (((s) >> 28) & 0xf)
|
||||
|
||||
#define XMIT_MAX_PDULEN 65535
|
||||
#define XMIT_DESCR_ALIGN 32
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* PDU Receive Queue
|
||||
*/
|
||||
|
||||
/*
|
||||
* PDU Receive Queue Element
|
||||
*/
|
||||
typedef volatile struct com_queue Recv_queue;
|
||||
|
||||
|
||||
/*
|
||||
* Receive PDU buffer segment description
|
||||
*/
|
||||
struct recv_seg_descr {
|
||||
H_addr rsd_handle; /* Buffer handle (from supply) */
|
||||
u_int rsd_len; /* Data length in buffer */
|
||||
};
|
||||
typedef struct recv_seg_descr Recv_seg_descr;
|
||||
|
||||
|
||||
/*
|
||||
* PDU Receive descriptor header
|
||||
*/
|
||||
struct recv_descr_hdr {
|
||||
u_long rdh_cell_hdr; /* Cell header (minus HEC) */
|
||||
u_long rdh_nsegs; /* Number of receive segments */
|
||||
};
|
||||
typedef struct recv_descr_hdr Recv_descr_hdr;
|
||||
|
||||
|
||||
#define RECV_BLK_SIZE 32
|
||||
#define RECV_HDR_SEGS ((RECV_BLK_SIZE - sizeof(Recv_descr_hdr)) \
|
||||
/ sizeof(Recv_seg_descr))
|
||||
#define RECV_BLK_SEGS (RECV_BLK_SIZE / sizeof(Recv_seg_descr))
|
||||
#define RECV_MAX_LG_SEGS ((FORE_IFF_MTU - BUF1_SM_SIZE \
|
||||
+ (BUF1_LG_SIZE - 1)) / BUF1_LG_SIZE)
|
||||
#define RECV_EXTRA_BLKS (((RECV_MAX_LG_SEGS + 1 - RECV_HDR_SEGS) \
|
||||
+ (RECV_BLK_SEGS - 1)) / RECV_BLK_SEGS)
|
||||
#define RECV_EXTRA_SEGS (RECV_EXTRA_BLKS * RECV_BLK_SEGS)
|
||||
#define RECV_MAX_SEGS (RECV_EXTRA_SEGS + RECV_HDR_SEGS)
|
||||
|
||||
|
||||
/*
|
||||
* PDU Receive descriptor
|
||||
*/
|
||||
struct recv_descr {
|
||||
Recv_descr_hdr rd_hdr; /* Descriptor header */
|
||||
Recv_seg_descr rd_seg[RECV_MAX_SEGS]; /* PDU segments */
|
||||
};
|
||||
typedef struct recv_descr Recv_descr;
|
||||
|
||||
#define rd_cell_hdr rd_hdr.rdh_cell_hdr
|
||||
#define rd_nsegs rd_hdr.rdh_nsegs
|
||||
|
||||
#define RECV_DESCR_ALIGN 32
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Buffer Supply Queue
|
||||
*/
|
||||
|
||||
/*
|
||||
* Buffer Supply Queue Element
|
||||
*/
|
||||
typedef volatile struct com_queue Buf_queue;
|
||||
|
||||
|
||||
/*
|
||||
* Buffer supply descriptor for supplying receive buffers
|
||||
*/
|
||||
struct buf_descr {
|
||||
H_addr bsd_handle; /* Host-specific buffer handle */
|
||||
H_dma bsd_buffer; /* Buffer DMA address */
|
||||
};
|
||||
typedef struct buf_descr Buf_descr;
|
||||
|
||||
#define BUF_DESCR_ALIGN 32
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Command Queue
|
||||
*/
|
||||
|
||||
/*
|
||||
* Command Codes
|
||||
*/
|
||||
typedef volatile unsigned long Cmd_code;
|
||||
|
||||
#define CMD_INIT 0x01 /* Initialize microcode */
|
||||
#define CMD_ACT_VCCIN 0x02 /* Activate incoming VCC */
|
||||
#define CMD_ACT_VCCOUT 0x03 /* Activate outgoing VCC */
|
||||
#define CMD_DACT_VCCIN 0x04 /* Deactivate incoming VCC */
|
||||
#define CMD_DACT_VCCOUT 0x05 /* Deactivate outgoing VCC */
|
||||
#define CMD_GET_STATS 0x06 /* Get adapter statistics */
|
||||
#define CMD_SET_OC3_REG 0x07 /* Set SUNI OC3 registers */
|
||||
#define CMD_GET_OC3_REG 0x08 /* Get SUNI OC3 registers */
|
||||
#define CMD_GET_PROM 0x09 /* Get PROM data */
|
||||
#define CMD_ZERO_STATS4 0x09 /* FT 4 Zero stats (unimpl) */
|
||||
#define CMD_GET_PROM4 0x0a /* FT 4 Get PROM data */
|
||||
#define CMD_INTR_REQ 0x80 /* Request host interrupt */
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
||||
/*
|
||||
* Structure defining the parameters for the Initialize command
|
||||
*/
|
||||
struct init_parms {
|
||||
CP_word init_cmd; /* Command code */
|
||||
CP_word init_status; /* Completion status */
|
||||
CP_word init_indisc; /* Not used */
|
||||
CP_word init_numvcc; /* Number of VCC's supported */
|
||||
CP_word init_cmd_elem; /* # of command queue elements */
|
||||
CP_word init_xmit_elem; /* # of transmit queue elements */
|
||||
CP_word init_recv_elem; /* # of receive queue elements */
|
||||
CP_word init_recv_ext; /* # of extra receive descr SEGMENTS */
|
||||
CP_word init_xmit_ext; /* # of extra transmit descr SEGMENTS */
|
||||
CP_word init_cls_vcc; /* Not used */
|
||||
CP_word init_pad[2]; /* Pad to quad-word boundary */
|
||||
Buf_strategy init_buf1s; /* Buffer strategy - 1 small */
|
||||
Buf_strategy init_buf1l; /* Buffer strategy - 1 large */
|
||||
Buf_strategy init_buf2s; /* Buffer strategy - 2 small */
|
||||
Buf_strategy init_buf2l; /* Buffer strategy - 2 large */
|
||||
};
|
||||
typedef volatile struct init_parms Init_parms;
|
||||
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Structure defining the parameters for the Activate commands
|
||||
*/
|
||||
struct activate_parms {
|
||||
CP_word act_spec; /* Command specification (see below) */
|
||||
CP_word act_vccid; /* VCC id (VPI=0,VCI=id) */
|
||||
CP_word act_batch; /* # cells in batch (AAL=NULL) */
|
||||
CP_word act_pad; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef volatile struct activate_parms Activate_parms;
|
||||
|
||||
/*
|
||||
* Activate command specification
|
||||
*
|
||||
* Bits 0-7 - command code
|
||||
* Bits 8-15 - AAL type
|
||||
* Bits 16-23 - buffer strategy
|
||||
* Bits 24-31 - reserved
|
||||
*/
|
||||
#define ACT_SET_SPEC(b,a,c) (((b) << 16) | ((a) << 8) | (c))
|
||||
#define ACT_GET_CMD(s) ((s) & 0xff)
|
||||
#define ACT_GET_AAL(s) (((s) >> 8) & 0xff)
|
||||
#define ACT_GET_STRAT(s) (((s) >> 16) & 0xff)
|
||||
|
||||
|
||||
/*
|
||||
* Structure defining the parameters for the Deactivate commands
|
||||
*/
|
||||
struct dactivate_parms {
|
||||
CP_word dact_cmd; /* Command code */
|
||||
CP_word dact_vccid; /* VCC id (VPI=0,VCI=id) */
|
||||
CP_word dact_pad[2]; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef volatile struct dactivate_parms Dactivate_parms;
|
||||
|
||||
|
||||
/*
|
||||
* Structure defining the parameters for the Get Statistics command
|
||||
*/
|
||||
struct stats_parms {
|
||||
CP_word stats_cmd; /* Command code */
|
||||
CP_dma stats_buffer; /* DMA address of host stats buffer */
|
||||
CP_word stats_pad[2]; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef volatile struct stats_parms Stats_parms;
|
||||
|
||||
|
||||
/*
|
||||
* Structure defining the parameters for the SUNI OC3 commands
|
||||
*/
|
||||
struct suni_parms {
|
||||
CP_word suni_spec; /* Command specification (see below) */
|
||||
CP_dma suni_buffer; /* DMA address of host SUNI buffer */
|
||||
CP_word suni_pad[2]; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef volatile struct suni_parms Suni_parms;
|
||||
|
||||
/*
|
||||
* SUNI OC3 command specification
|
||||
*
|
||||
* Bits 0-7 - command code
|
||||
* Bits 8-15 - SUNI register number
|
||||
* Bits 16-23 - Value(s) to set in register
|
||||
* Bits 24-31 - Mask selecting value bits
|
||||
*/
|
||||
#define SUNI_SET_SPEC(m,v,r,c) (((m) << 24) | ((v) << 16) | ((r) << 8) | (c))
|
||||
#define SUNI_GET_CMD(s) ((s) & 0xff)
|
||||
#define SUNI_GET_REG(s) (((s) >> 8) & 0xff)
|
||||
#define SUNI_GET_VALUE(s) (((s) >> 16) & 0xff)
|
||||
#define SUNI_GET_MASK(s) (((s) >> 24) & 0xff)
|
||||
|
||||
|
||||
/*
|
||||
* Structure defining the parameters for the Get Prom command
|
||||
*/
|
||||
struct prom_parms {
|
||||
CP_word prom_cmd; /* Command code */
|
||||
CP_dma prom_buffer; /* DMA address of host prom buffer */
|
||||
CP_word prom_pad[2]; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef volatile struct prom_parms Prom_parms;
|
||||
|
||||
|
||||
/*
|
||||
* Command Queue Element
|
||||
*/
|
||||
struct cmd_queue {
|
||||
union { /* Command-specific parameters */
|
||||
Activate_parms cmdqu_act;
|
||||
Dactivate_parms cmdqu_dact;
|
||||
Stats_parms cmdqu_stats;
|
||||
Suni_parms cmdqu_suni;
|
||||
Prom_parms cmdqu_prom;
|
||||
} cmdq_u;
|
||||
CP_dma cmdq_status; /* Pointer to element status word */
|
||||
CP_word cmdq_pad[3]; /* Pad to quad-word boundary */
|
||||
};
|
||||
#define cmdq_act cmdq_u.cmdqu_act
|
||||
#define cmdq_dact cmdq_u.cmdqu_dact
|
||||
#define cmdq_stats cmdq_u.cmdqu_stats
|
||||
#define cmdq_suni cmdq_u.cmdqu_suni
|
||||
#define cmdq_prom cmdq_u.cmdqu_prom
|
||||
typedef volatile struct cmd_queue Cmd_queue;
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Structure defining the CP's shared memory interface to the
|
||||
* AALI firmware program (downloaded microcode)
|
||||
*/
|
||||
struct aali {
|
||||
CP_addr aali_cmd_q; /* Pointer to command queue */
|
||||
CP_addr aali_xmit_q; /* Pointer to transmit queue */
|
||||
CP_addr aali_recv_q; /* Pointer to receive queue */
|
||||
CP_addr aali_buf1s_q; /* Pointer to strategy-1 small queue */
|
||||
CP_addr aali_buf1l_q; /* Pointer to strategy-1 large queue */
|
||||
CP_addr aali_buf2s_q; /* Pointer to strategy-2 small queue */
|
||||
CP_addr aali_buf2l_q; /* Pointer to strategy-2 large queue */
|
||||
CP_word aali_intr_ena; /* Enables interrupts if non-zero */
|
||||
CP_word aali_intr_sent; /* Interrupt issued if non-zero */
|
||||
CP_addr aali_heap; /* Pointer to application heap */
|
||||
CP_word aali_heaplen; /* Length of application heap */
|
||||
CP_word aali_hostlog; /* FORE internal use */
|
||||
CP_word aali_heartbeat; /* Monitor microcode health */
|
||||
CP_word aali_ucode_ver; /* Microcode firmware version */
|
||||
CP_word aali_mon_ver; /* Mon960 version */
|
||||
CP_word aali_xmit_tput; /* FORE internal use */
|
||||
|
||||
/* This must be on a quad-word boundary */
|
||||
Init_parms aali_init; /* Initialize command parameters */
|
||||
};
|
||||
typedef volatile struct aali Aali;
|
||||
|
||||
|
||||
/*
|
||||
* CP maintained statistics - DMA'd to host with CMD_GET_STATS command
|
||||
*/
|
||||
struct stats_taxi {
|
||||
u_long taxi_bad_crc; /* Bad header CRC errors */
|
||||
u_long taxi_framing; /* Framing errors */
|
||||
u_long taxi_pad[2]; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef struct stats_taxi Stats_taxi;
|
||||
|
||||
struct stats_oc3 {
|
||||
u_long oc3_sect_bip8; /* Section 8-bit intrlv parity errors */
|
||||
u_long oc3_path_bip8; /* Path 8-bit intrlv parity errors */
|
||||
u_long oc3_line_bip24; /* Line 24-bit intrlv parity errors */
|
||||
u_long oc3_line_febe; /* Line far-end block errors */
|
||||
u_long oc3_path_febe; /* Path far-end block errors */
|
||||
u_long oc3_hec_corr; /* Correctible HEC errors */
|
||||
u_long oc3_hec_uncorr; /* Uncorrectible HEC errors */
|
||||
u_long oc3_pad; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef struct stats_oc3 Stats_oc3;
|
||||
|
||||
struct stats_atm {
|
||||
u_long atm_xmit; /* Cells transmitted */
|
||||
u_long atm_rcvd; /* Cells received */
|
||||
u_long atm_vpi_range; /* Cell drops - VPI out of range */
|
||||
u_long atm_vpi_noconn; /* Cell drops - no connect for VPI */
|
||||
u_long atm_vci_range; /* Cell drops - VCI out of range */
|
||||
u_long atm_vci_noconn; /* Cell drops - no connect for VCI */
|
||||
u_long atm_pad[2]; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef struct stats_atm Stats_atm;
|
||||
|
||||
struct stats_aal0 {
|
||||
u_long aal0_xmit; /* Cells transmitted */
|
||||
u_long aal0_rcvd; /* Cells received */
|
||||
u_long aal0_drops; /* Cell drops */
|
||||
u_long aal0_pad; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef struct stats_aal0 Stats_aal0;
|
||||
|
||||
struct stats_aal4 {
|
||||
u_long aal4_xmit; /* Cells transmitted */
|
||||
u_long aal4_rcvd; /* Cells received */
|
||||
u_long aal4_crc; /* Cells with payload CRC errors */
|
||||
u_long aal4_sar_cs; /* Cells with SAR/CS errors */
|
||||
u_long aal4_drops; /* Cell drops */
|
||||
u_long aal4_pdu_xmit; /* CS PDUs transmitted */
|
||||
u_long aal4_pdu_rcvd; /* CS PDUs received */
|
||||
u_long aal4_pdu_errs; /* CS layer protocol errors */
|
||||
u_long aal4_pdu_drops; /* CS PDUs dropped */
|
||||
u_long aal4_pad[3]; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef struct stats_aal4 Stats_aal4;
|
||||
|
||||
struct stats_aal5 {
|
||||
u_long aal5_xmit; /* Cells transmitted */
|
||||
u_long aal5_rcvd; /* Cells received */
|
||||
u_long aal5_crc_len; /* Cells with CRC/length errors */
|
||||
u_long aal5_drops; /* Cell drops */
|
||||
u_long aal5_pdu_xmit; /* CS PDUs transmitted */
|
||||
u_long aal5_pdu_rcvd; /* CS PDUs received */
|
||||
u_long aal5_pdu_crc; /* CS PDUs with CRC errors */
|
||||
u_long aal5_pdu_errs; /* CS layer protocol errors */
|
||||
u_long aal5_pdu_drops; /* CS PDUs dropped */
|
||||
u_long aal5_pad[3]; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef struct stats_aal5 Stats_aal5;
|
||||
|
||||
struct stats_misc {
|
||||
u_long buf1_sm_fail; /* Alloc fail: buffer strat 1 small */
|
||||
u_long buf1_lg_fail; /* Alloc fail: buffer strat 1 large */
|
||||
u_long buf2_sm_fail; /* Alloc fail: buffer strat 2 small */
|
||||
u_long buf2_lg_fail; /* Alloc fail: buffer strat 2 large */
|
||||
u_long rcvd_pdu_fail; /* Received PDU allocation failure */
|
||||
u_long carrier_status; /* Carrier status */
|
||||
u_long misc_pad[2]; /* Pad to quad-word boundary */
|
||||
};
|
||||
typedef struct stats_misc Stats_misc;
|
||||
|
||||
struct fore_cp_stats {
|
||||
Stats_taxi st_cp_taxi; /* TAXI layer statistics */
|
||||
Stats_oc3 st_cp_oc3; /* OC3 layer statistics */
|
||||
Stats_atm st_cp_atm; /* ATM layer statistics */
|
||||
Stats_aal0 st_cp_aal0; /* AAL0 layer statistics */
|
||||
Stats_aal4 st_cp_aal4; /* AAL3/4 layer statistics */
|
||||
Stats_aal5 st_cp_aal5; /* AAL5 layer statistics */
|
||||
Stats_misc st_cp_misc; /* Miscellaneous statistics */
|
||||
};
|
||||
typedef struct fore_cp_stats Fore_cp_stats;
|
||||
|
||||
#define FORE_STATS_ALIGN 32
|
||||
|
||||
/*
|
||||
* CP PROM data - DMA'd to host with CMD_GET_PROM command
|
||||
*/
|
||||
struct fore_prom {
|
||||
u_long pr_hwver; /* Hardware version number */
|
||||
u_long pr_serno; /* Serial number */
|
||||
u_char pr_mac[8]; /* MAC address */
|
||||
};
|
||||
typedef struct fore_prom Fore_prom;
|
||||
|
||||
#define FORE_PROM_ALIGN 32
|
||||
|
||||
#endif /* _FORE_AALI_H */
|
||||
|
|
@ -1,786 +0,0 @@
|
|||
/*-
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Buffer Supply queue management
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
static void fore_buf_drain(Fore_unit *);
|
||||
static void fore_buf_supply_1s(Fore_unit *);
|
||||
static void fore_buf_supply_1l(Fore_unit *);
|
||||
|
||||
|
||||
/*
|
||||
* Allocate Buffer Supply Queues Data Structures
|
||||
*
|
||||
* Here we are allocating memory for both Strategy 1 Small and Large
|
||||
* structures contiguously.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* 0 allocations successful
|
||||
* else allocation failed
|
||||
*/
|
||||
int
|
||||
fore_buf_allocate(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
caddr_t memp;
|
||||
vm_paddr_t pmemp;
|
||||
|
||||
/*
|
||||
* Allocate non-cacheable memory for buffer supply status words
|
||||
*/
|
||||
memp = atm_dev_alloc(
|
||||
sizeof(Q_status) * (BUF1_SM_QUELEN + BUF1_LG_QUELEN),
|
||||
QSTAT_ALIGN, ATM_DEV_NONCACHE);
|
||||
if (memp == NULL) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_buf1s_stat = (Q_status *) memp;
|
||||
fup->fu_buf1l_stat = ((Q_status *) memp) + BUF1_SM_QUELEN;
|
||||
|
||||
pmemp = vtophys(fup->fu_buf1s_stat);
|
||||
if (pmemp == 0) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_buf1s_statd = pmemp;
|
||||
|
||||
pmemp = vtophys(fup->fu_buf1l_stat);
|
||||
if (pmemp == 0) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_buf1l_statd = pmemp;
|
||||
|
||||
/*
|
||||
* Allocate memory for buffer supply descriptors
|
||||
*/
|
||||
memp = atm_dev_alloc(sizeof(Buf_descr) *
|
||||
((BUF1_SM_QUELEN * BUF1_SM_ENTSIZE) +
|
||||
(BUF1_LG_QUELEN * BUF1_LG_ENTSIZE)),
|
||||
BUF_DESCR_ALIGN, 0);
|
||||
if (memp == NULL) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_buf1s_desc = (Buf_descr *) memp;
|
||||
fup->fu_buf1l_desc = ((Buf_descr *) memp) +
|
||||
(BUF1_SM_QUELEN * BUF1_SM_ENTSIZE);
|
||||
|
||||
pmemp = vtophys(fup->fu_buf1s_desc);
|
||||
if (pmemp == 0) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_buf1s_descd = pmemp;
|
||||
|
||||
pmemp = vtophys(fup->fu_buf1l_desc);
|
||||
if (pmemp == 0) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_buf1l_descd = pmemp;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Buffer Supply Queues Initialization
|
||||
*
|
||||
* Allocate and initialize the host-resident buffer supply queue structures
|
||||
* and then initialize the CP-resident queue structures.
|
||||
*
|
||||
* Called at interrupt level.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_buf_initialize(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
Aali *aap = fup->fu_aali;
|
||||
Buf_queue *cqp;
|
||||
H_buf_queue *hbp;
|
||||
Buf_descr *bdp;
|
||||
vm_paddr_t bdp_dma;
|
||||
Q_status *qsp;
|
||||
vm_paddr_t qsp_dma;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Initialize Strategy 1 Small Queues
|
||||
*/
|
||||
|
||||
/*
|
||||
* Point to CP-resident buffer supply queue
|
||||
*/
|
||||
cqp = (Buf_queue *)(fup->fu_ram + CP_READ(aap->aali_buf1s_q));
|
||||
|
||||
/*
|
||||
* Point to host-resident buffer supply queue structures
|
||||
*/
|
||||
hbp = fup->fu_buf1s_q;
|
||||
qsp = fup->fu_buf1s_stat;
|
||||
qsp_dma = fup->fu_buf1s_statd;
|
||||
bdp = fup->fu_buf1s_desc;
|
||||
bdp_dma = fup->fu_buf1s_descd;
|
||||
|
||||
/*
|
||||
* Loop thru all queue entries and do whatever needs doing
|
||||
*/
|
||||
for (i = 0; i < BUF1_SM_QUELEN; i++) {
|
||||
|
||||
/*
|
||||
* Set queue status word to free
|
||||
*/
|
||||
*qsp = QSTAT_FREE;
|
||||
|
||||
/*
|
||||
* Set up host queue entry and link into ring
|
||||
*/
|
||||
hbp->hbq_cpelem = cqp;
|
||||
hbp->hbq_status = qsp;
|
||||
hbp->hbq_descr = bdp;
|
||||
hbp->hbq_descr_dma = bdp_dma;
|
||||
if (i == (BUF1_SM_QUELEN - 1))
|
||||
hbp->hbq_next = fup->fu_buf1s_q;
|
||||
else
|
||||
hbp->hbq_next = hbp + 1;
|
||||
|
||||
/*
|
||||
* Now let the CP into the game
|
||||
*/
|
||||
cqp->cq_status = (CP_dma) CP_WRITE(qsp_dma);
|
||||
|
||||
/*
|
||||
* Bump all queue pointers
|
||||
*/
|
||||
hbp++;
|
||||
qsp++;
|
||||
qsp_dma += sizeof(Q_status);
|
||||
bdp += BUF1_SM_ENTSIZE;
|
||||
bdp_dma += BUF1_SM_ENTSIZE * sizeof(Buf_descr);
|
||||
cqp++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize queue pointers
|
||||
*/
|
||||
fup->fu_buf1s_head = fup->fu_buf1s_tail = fup->fu_buf1s_q;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize Strategy 1 Large Queues
|
||||
*/
|
||||
|
||||
/*
|
||||
* Point to CP-resident buffer supply queue
|
||||
*/
|
||||
cqp = (Buf_queue *)(fup->fu_ram + CP_READ(aap->aali_buf1l_q));
|
||||
|
||||
/*
|
||||
* Point to host-resident buffer supply queue structures
|
||||
*/
|
||||
hbp = fup->fu_buf1l_q;
|
||||
qsp = fup->fu_buf1l_stat;
|
||||
qsp_dma = fup->fu_buf1l_statd;
|
||||
bdp = fup->fu_buf1l_desc;
|
||||
bdp_dma = fup->fu_buf1l_descd;
|
||||
|
||||
/*
|
||||
* Loop thru all queue entries and do whatever needs doing
|
||||
*/
|
||||
for (i = 0; i < BUF1_LG_QUELEN; i++) {
|
||||
|
||||
/*
|
||||
* Set queue status word to free
|
||||
*/
|
||||
*qsp = QSTAT_FREE;
|
||||
|
||||
/*
|
||||
* Set up host queue entry and link into ring
|
||||
*/
|
||||
hbp->hbq_cpelem = cqp;
|
||||
hbp->hbq_status = qsp;
|
||||
hbp->hbq_descr = bdp;
|
||||
hbp->hbq_descr_dma = bdp_dma;
|
||||
if (i == (BUF1_LG_QUELEN - 1))
|
||||
hbp->hbq_next = fup->fu_buf1l_q;
|
||||
else
|
||||
hbp->hbq_next = hbp + 1;
|
||||
|
||||
/*
|
||||
* Now let the CP into the game
|
||||
*/
|
||||
cqp->cq_status = (CP_dma) CP_WRITE(qsp_dma);
|
||||
|
||||
/*
|
||||
* Bump all queue pointers
|
||||
*/
|
||||
hbp++;
|
||||
qsp++;
|
||||
qsp_dma += sizeof(Q_status);
|
||||
bdp += BUF1_LG_ENTSIZE;
|
||||
bdp_dma += BUF1_LG_ENTSIZE * sizeof(Buf_descr);
|
||||
cqp++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize queue pointers
|
||||
*/
|
||||
fup->fu_buf1l_head = fup->fu_buf1l_tail = fup->fu_buf1l_q;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Supply Buffers to CP
|
||||
*
|
||||
* This function will resupply the CP with buffers to be used to
|
||||
* store incoming data.
|
||||
*
|
||||
* May be called in interrupt state.
|
||||
* Must be called with interrupts locked out.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_buf_supply(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
|
||||
/*
|
||||
* First, clean out the supply queues
|
||||
*/
|
||||
fore_buf_drain(fup);
|
||||
|
||||
/*
|
||||
* Then, supply the buffers for each queue
|
||||
*/
|
||||
fore_buf_supply_1s(fup);
|
||||
fore_buf_supply_1l(fup);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Supply Strategy 1 Small Buffers to CP
|
||||
*
|
||||
* May be called in interrupt state.
|
||||
* Must be called with interrupts locked out.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
static void
|
||||
fore_buf_supply_1s(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
H_buf_queue *hbp;
|
||||
Buf_queue *cqp;
|
||||
Buf_descr *bdp;
|
||||
Buf_handle *bhp;
|
||||
KBuffer *m;
|
||||
int nvcc, nbuf, i;
|
||||
|
||||
/*
|
||||
* Figure out how many buffers we should be giving to the CP.
|
||||
* We're basing this calculation on the current number of open
|
||||
* VCCs thru this device, with certain minimum and maximum values
|
||||
* enforced. This will then allow us to figure out how many more
|
||||
* buffers we need to supply to the CP. This will be rounded up
|
||||
* to fill a supply queue entry.
|
||||
*/
|
||||
nvcc = MAX(fup->fu_open_vcc, BUF_MIN_VCC);
|
||||
nbuf = nvcc * 4;
|
||||
nbuf = MIN(nbuf, BUF1_SM_CPPOOL);
|
||||
nbuf -= fup->fu_buf1s_cnt;
|
||||
nbuf = roundup(nbuf, BUF1_SM_ENTSIZE);
|
||||
|
||||
/*
|
||||
* OK, now supply the buffers to the CP
|
||||
*/
|
||||
while (nbuf > 0) {
|
||||
|
||||
/*
|
||||
* Acquire a supply queue entry
|
||||
*/
|
||||
hbp = fup->fu_buf1s_tail;
|
||||
if (!((*hbp->hbq_status) & QSTAT_FREE))
|
||||
break;
|
||||
bdp = hbp->hbq_descr;
|
||||
|
||||
/*
|
||||
* Get a buffer for each descriptor in the queue entry
|
||||
*/
|
||||
for (i = 0; i < BUF1_SM_ENTSIZE; i++, bdp++) {
|
||||
caddr_t cp;
|
||||
|
||||
/*
|
||||
* Get a small buffer
|
||||
*/
|
||||
KB_ALLOCPKT(m, BUF1_SM_SIZE, KB_F_NOWAIT, KB_T_DATA);
|
||||
if (m == 0) {
|
||||
break;
|
||||
}
|
||||
KB_HEADSET(m, BUF1_SM_DOFF);
|
||||
|
||||
/*
|
||||
* Point to buffer handle structure
|
||||
*/
|
||||
bhp = (Buf_handle *)((caddr_t)m + BUF1_SM_HOFF);
|
||||
bhp->bh_type = BHT_S1_SMALL;
|
||||
|
||||
/*
|
||||
* Setup buffer descriptor
|
||||
*/
|
||||
bdp->bsd_handle = bhp;
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
bhp->bh_dma = bdp->bsd_buffer = vtophys(cp);
|
||||
if (bdp->bsd_buffer == 0) {
|
||||
/*
|
||||
* Unable to assign dma address - free up
|
||||
* this descriptor's buffer
|
||||
*/
|
||||
fup->fu_stats->st_drv.drv_bf_segdma++;
|
||||
KB_FREEALL(m);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* All set, so queue buffer (handle)
|
||||
*/
|
||||
ENQUEUE(bhp, Buf_handle, bh_qelem, fup->fu_buf1s_bq);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we we're not able to fill all the descriptors for
|
||||
* an entry, free up what's been partially built
|
||||
*/
|
||||
if (i != BUF1_SM_ENTSIZE) {
|
||||
caddr_t cp;
|
||||
|
||||
/*
|
||||
* Clean up each used descriptor
|
||||
*/
|
||||
for (bdp = hbp->hbq_descr; i; i--, bdp++) {
|
||||
|
||||
bhp = bdp->bsd_handle;
|
||||
|
||||
DEQUEUE(bhp, Buf_handle, bh_qelem,
|
||||
fup->fu_buf1s_bq);
|
||||
|
||||
m = (KBuffer *)
|
||||
((caddr_t)bhp - BUF1_SM_HOFF);
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
KB_FREEALL(m);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, we've got an entry ready for the CP.
|
||||
* So claim the host queue entry and setup the CP-resident
|
||||
* queue entry. The CP will (potentially) grab the supplied
|
||||
* buffers when the descriptor pointer is set.
|
||||
*/
|
||||
fup->fu_buf1s_tail = hbp->hbq_next;
|
||||
(*hbp->hbq_status) = QSTAT_PENDING;
|
||||
cqp = hbp->hbq_cpelem;
|
||||
cqp->cq_descr = (CP_dma) CP_WRITE((u_long)hbp->hbq_descr_dma);
|
||||
|
||||
/*
|
||||
* Update counters, etc for supplied buffers
|
||||
*/
|
||||
fup->fu_buf1s_cnt += BUF1_SM_ENTSIZE;
|
||||
nbuf -= BUF1_SM_ENTSIZE;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Supply Strategy 1 Large Buffers to CP
|
||||
*
|
||||
* May be called in interrupt state.
|
||||
* Must be called with interrupts locked out.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
static void
|
||||
fore_buf_supply_1l(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
H_buf_queue *hbp;
|
||||
Buf_queue *cqp;
|
||||
Buf_descr *bdp;
|
||||
Buf_handle *bhp;
|
||||
KBuffer *m;
|
||||
int nvcc, nbuf, i;
|
||||
|
||||
/*
|
||||
* Figure out how many buffers we should be giving to the CP.
|
||||
* We're basing this calculation on the current number of open
|
||||
* VCCs thru this device, with certain minimum and maximum values
|
||||
* enforced. This will then allow us to figure out how many more
|
||||
* buffers we need to supply to the CP. This will be rounded up
|
||||
* to fill a supply queue entry.
|
||||
*/
|
||||
nvcc = MAX(fup->fu_open_vcc, BUF_MIN_VCC);
|
||||
nbuf = nvcc * 4 * RECV_MAX_SEGS;
|
||||
nbuf = MIN(nbuf, BUF1_LG_CPPOOL);
|
||||
nbuf -= fup->fu_buf1l_cnt;
|
||||
nbuf = roundup(nbuf, BUF1_LG_ENTSIZE);
|
||||
|
||||
/*
|
||||
* OK, now supply the buffers to the CP
|
||||
*/
|
||||
while (nbuf > 0) {
|
||||
|
||||
/*
|
||||
* Acquire a supply queue entry
|
||||
*/
|
||||
hbp = fup->fu_buf1l_tail;
|
||||
if (!((*hbp->hbq_status) & QSTAT_FREE))
|
||||
break;
|
||||
bdp = hbp->hbq_descr;
|
||||
|
||||
/*
|
||||
* Get a buffer for each descriptor in the queue entry
|
||||
*/
|
||||
for (i = 0; i < BUF1_LG_ENTSIZE; i++, bdp++) {
|
||||
caddr_t cp;
|
||||
|
||||
/*
|
||||
* Get a cluster buffer
|
||||
*/
|
||||
KB_ALLOCEXT(m, BUF1_LG_SIZE, KB_F_NOWAIT, KB_T_DATA);
|
||||
if (m == 0) {
|
||||
break;
|
||||
}
|
||||
KB_HEADSET(m, BUF1_LG_DOFF);
|
||||
|
||||
/*
|
||||
* Point to buffer handle structure
|
||||
*/
|
||||
bhp = (Buf_handle *)((caddr_t)m + BUF1_LG_HOFF);
|
||||
bhp->bh_type = BHT_S1_LARGE;
|
||||
|
||||
/*
|
||||
* Setup buffer descriptor
|
||||
*/
|
||||
bdp->bsd_handle = bhp;
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
bhp->bh_dma = bdp->bsd_buffer = vtophys(cp);
|
||||
if (bdp->bsd_buffer == 0) {
|
||||
/*
|
||||
* Unable to assign dma address - free up
|
||||
* this descriptor's buffer
|
||||
*/
|
||||
fup->fu_stats->st_drv.drv_bf_segdma++;
|
||||
KB_FREEALL(m);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* All set, so queue buffer (handle)
|
||||
*/
|
||||
ENQUEUE(bhp, Buf_handle, bh_qelem, fup->fu_buf1l_bq);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we we're not able to fill all the descriptors for
|
||||
* an entry, free up what's been partially built
|
||||
*/
|
||||
if (i != BUF1_LG_ENTSIZE) {
|
||||
caddr_t cp;
|
||||
|
||||
/*
|
||||
* Clean up each used descriptor
|
||||
*/
|
||||
for (bdp = hbp->hbq_descr; i; i--, bdp++) {
|
||||
bhp = bdp->bsd_handle;
|
||||
|
||||
DEQUEUE(bhp, Buf_handle, bh_qelem,
|
||||
fup->fu_buf1l_bq);
|
||||
|
||||
m = (KBuffer *)
|
||||
((caddr_t)bhp - BUF1_LG_HOFF);
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
KB_FREEALL(m);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, we've got an entry ready for the CP.
|
||||
* So claim the host queue entry and setup the CP-resident
|
||||
* queue entry. The CP will (potentially) grab the supplied
|
||||
* buffers when the descriptor pointer is set.
|
||||
*/
|
||||
fup->fu_buf1l_tail = hbp->hbq_next;
|
||||
(*hbp->hbq_status) = QSTAT_PENDING;
|
||||
cqp = hbp->hbq_cpelem;
|
||||
cqp->cq_descr = (CP_dma) CP_WRITE((u_long)hbp->hbq_descr_dma);
|
||||
|
||||
/*
|
||||
* Update counters, etc for supplied buffers
|
||||
*/
|
||||
fup->fu_buf1l_cnt += BUF1_LG_ENTSIZE;
|
||||
nbuf -= BUF1_LG_ENTSIZE;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Drain Buffer Supply Queues
|
||||
*
|
||||
* This function will free all completed entries at the head of each
|
||||
* buffer supply queue. Since we consider the CP to "own" the buffers
|
||||
* once we put them on a supply queue and since a completed supply queue
|
||||
* entry is only telling us that the CP has accepted the buffers that we
|
||||
* gave to it, there's not much to do here.
|
||||
*
|
||||
* May be called in interrupt state.
|
||||
* Must be called with interrupts locked out.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
static void
|
||||
fore_buf_drain(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
H_buf_queue *hbp;
|
||||
|
||||
/*
|
||||
* Drain Strategy 1 Small Queue
|
||||
*/
|
||||
|
||||
/*
|
||||
* Process each completed entry
|
||||
*/
|
||||
while (*fup->fu_buf1s_head->hbq_status & QSTAT_COMPLETED) {
|
||||
|
||||
hbp = fup->fu_buf1s_head;
|
||||
|
||||
if (*hbp->hbq_status & QSTAT_ERROR) {
|
||||
/*
|
||||
* XXX - what does this mean???
|
||||
*/
|
||||
log(LOG_ERR, "fore_buf_drain: buf1s queue error\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark this entry free for use and bump head pointer
|
||||
* to the next entry in the queue
|
||||
*/
|
||||
*hbp->hbq_status = QSTAT_FREE;
|
||||
fup->fu_buf1s_head = hbp->hbq_next;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Drain Strategy 1 Large Queue
|
||||
*/
|
||||
|
||||
/*
|
||||
* Process each completed entry
|
||||
*/
|
||||
while (*fup->fu_buf1l_head->hbq_status & QSTAT_COMPLETED) {
|
||||
|
||||
hbp = fup->fu_buf1l_head;
|
||||
|
||||
if (*hbp->hbq_status & QSTAT_ERROR) {
|
||||
/*
|
||||
* XXX - what does this mean???
|
||||
*/
|
||||
log(LOG_ERR, "fore_buf_drain: buf1l queue error\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark this entry free for use and bump head pointer
|
||||
* to the next entry in the queue
|
||||
*/
|
||||
*hbp->hbq_status = QSTAT_FREE;
|
||||
fup->fu_buf1l_head = hbp->hbq_next;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free Buffer Supply Queue Data Structures
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_buf_free(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
Buf_handle *bhp;
|
||||
KBuffer *m;
|
||||
|
||||
/*
|
||||
* Free any previously supplied and not returned buffers
|
||||
*/
|
||||
if (fup->fu_flags & CUF_INITED) {
|
||||
|
||||
/*
|
||||
* Run through Strategy 1 Small queue
|
||||
*/
|
||||
while ((bhp = Q_HEAD(fup->fu_buf1s_bq, Buf_handle)) != NULL) {
|
||||
caddr_t cp;
|
||||
|
||||
/*
|
||||
* Back off to buffer
|
||||
*/
|
||||
m = (KBuffer *)((caddr_t)bhp - BUF1_SM_HOFF);
|
||||
|
||||
/*
|
||||
* Dequeue handle and free buffer
|
||||
*/
|
||||
DEQUEUE(bhp, Buf_handle, bh_qelem, fup->fu_buf1s_bq);
|
||||
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
KB_FREEALL(m);
|
||||
}
|
||||
|
||||
/*
|
||||
* Run through Strategy 1 Large queue
|
||||
*/
|
||||
while ((bhp = Q_HEAD(fup->fu_buf1l_bq, Buf_handle)) != NULL) {
|
||||
caddr_t cp;
|
||||
|
||||
/*
|
||||
* Back off to buffer
|
||||
*/
|
||||
m = (KBuffer *)((caddr_t)bhp - BUF1_LG_HOFF);
|
||||
|
||||
/*
|
||||
* Dequeue handle and free buffer
|
||||
*/
|
||||
DEQUEUE(bhp, Buf_handle, bh_qelem, fup->fu_buf1l_bq);
|
||||
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
KB_FREEALL(m);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the status words
|
||||
*/
|
||||
if (fup->fu_buf1s_stat) {
|
||||
atm_dev_free((volatile void *)fup->fu_buf1s_stat);
|
||||
fup->fu_buf1s_stat = NULL;
|
||||
fup->fu_buf1s_statd = 0;
|
||||
fup->fu_buf1l_stat = NULL;
|
||||
fup->fu_buf1l_statd = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the transmit descriptors
|
||||
*/
|
||||
if (fup->fu_buf1s_desc) {
|
||||
atm_dev_free(fup->fu_buf1s_desc);
|
||||
fup->fu_buf1s_desc = NULL;
|
||||
fup->fu_buf1s_descd = 0;
|
||||
fup->fu_buf1l_desc = NULL;
|
||||
fup->fu_buf1l_descd = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1,466 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Command queue management
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_vc.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables
|
||||
*/
|
||||
static struct t_atm_cause fore_cause = {
|
||||
T_ATM_ITU_CODING,
|
||||
T_ATM_LOC_USER,
|
||||
T_ATM_CAUSE_TEMPORARY_FAILURE,
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Allocate Command Queue Data Structures
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* 0 allocations successful
|
||||
* else allocation failed
|
||||
*/
|
||||
int
|
||||
fore_cmd_allocate(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
caddr_t memp;
|
||||
vm_paddr_t pmemp;
|
||||
|
||||
/*
|
||||
* Allocate non-cacheable memory for command status words
|
||||
*/
|
||||
memp = atm_dev_alloc(sizeof(Q_status) * CMD_QUELEN,
|
||||
QSTAT_ALIGN, ATM_DEV_NONCACHE);
|
||||
if (memp == NULL) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_cmd_stat = (Q_status *) memp;
|
||||
|
||||
pmemp = vtophys(fup->fu_cmd_stat);
|
||||
if (pmemp == 0) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_cmd_statd = pmemp;
|
||||
|
||||
/*
|
||||
* Allocate memory for statistics buffer
|
||||
*/
|
||||
memp = atm_dev_alloc(sizeof(Fore_stats), FORE_STATS_ALIGN, 0);
|
||||
if (memp == NULL) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_stats = (Fore_stats *) memp;
|
||||
|
||||
/*
|
||||
* Allocate memory for PROM buffer
|
||||
*/
|
||||
memp = atm_dev_alloc(sizeof(Fore_prom), FORE_PROM_ALIGN, 0);
|
||||
if (memp == NULL) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_prom = (Fore_prom *) memp;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Command Queue Initialization
|
||||
*
|
||||
* Allocate and initialize the host-resident command queue structures
|
||||
* and then initialize the CP-resident queue structures.
|
||||
*
|
||||
* Called at interrupt level.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_cmd_initialize(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
Aali *aap = fup->fu_aali;
|
||||
Cmd_queue *cqp;
|
||||
H_cmd_queue *hcp;
|
||||
Q_status *qsp;
|
||||
vm_paddr_t qsp_dma;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Point to CP-resident command queue
|
||||
*/
|
||||
cqp = (Cmd_queue *)(fup->fu_ram + CP_READ(aap->aali_cmd_q));
|
||||
|
||||
/*
|
||||
* Point to host-resident command queue structures
|
||||
*/
|
||||
hcp = fup->fu_cmd_q;
|
||||
qsp = fup->fu_cmd_stat;
|
||||
qsp_dma = fup->fu_cmd_statd;
|
||||
|
||||
/*
|
||||
* Loop thru all queue entries and do whatever needs doing
|
||||
*/
|
||||
for (i = 0; i < CMD_QUELEN; i++) {
|
||||
|
||||
/*
|
||||
* Set queue status word to free
|
||||
*/
|
||||
*qsp = QSTAT_FREE;
|
||||
|
||||
/*
|
||||
* Set up host queue entry and link into ring
|
||||
*/
|
||||
hcp->hcq_cpelem = cqp;
|
||||
hcp->hcq_status = qsp;
|
||||
if (i == (CMD_QUELEN - 1))
|
||||
hcp->hcq_next = fup->fu_cmd_q;
|
||||
else
|
||||
hcp->hcq_next = hcp + 1;
|
||||
|
||||
/*
|
||||
* Now let the CP into the game
|
||||
*/
|
||||
cqp->cmdq_status = (CP_dma) CP_WRITE(qsp_dma);
|
||||
|
||||
/*
|
||||
* Bump all queue pointers
|
||||
*/
|
||||
hcp++;
|
||||
qsp++;
|
||||
qsp_dma += sizeof(Q_status);
|
||||
cqp++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize queue pointers
|
||||
*/
|
||||
fup->fu_cmd_head = fup->fu_cmd_tail = fup->fu_cmd_q;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Drain Command Queue
|
||||
*
|
||||
* This function will process and free all completed entries at the head
|
||||
* of the command queue.
|
||||
*
|
||||
* May be called in interrupt state.
|
||||
* Must be called with interrupts locked out.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_cmd_drain(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
H_cmd_queue *hcp;
|
||||
Fore_vcc *fvp;
|
||||
|
||||
/*
|
||||
* Process each completed entry
|
||||
* ForeThought 4 may set QSTAT_ERROR without QSTAT_COMPLETED.
|
||||
*/
|
||||
while (*fup->fu_cmd_head->hcq_status & (QSTAT_COMPLETED | QSTAT_ERROR)) {
|
||||
|
||||
hcp = fup->fu_cmd_head;
|
||||
|
||||
/*
|
||||
* Process command completion
|
||||
*/
|
||||
switch (hcp->hcq_code) {
|
||||
|
||||
case CMD_ACT_VCCIN:
|
||||
case CMD_ACT_VCCOUT:
|
||||
fvp = hcp->hcq_arg;
|
||||
if (*hcp->hcq_status & QSTAT_ERROR) {
|
||||
/*
|
||||
* VCC activation failed - just abort vcc
|
||||
*/
|
||||
if (fvp)
|
||||
atm_cm_abort(fvp->fv_connvc,
|
||||
&fore_cause);
|
||||
fup->fu_pif.pif_cmderrors++;
|
||||
} else {
|
||||
/*
|
||||
* Successful VCC activation
|
||||
*/
|
||||
if (fvp) {
|
||||
fvp->fv_state = CVS_ACTIVE;
|
||||
fup->fu_open_vcc++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_DACT_VCCIN:
|
||||
case CMD_DACT_VCCOUT:
|
||||
fvp = hcp->hcq_arg;
|
||||
if (*hcp->hcq_status & QSTAT_ERROR) {
|
||||
/*
|
||||
* VCC dactivation failed - whine
|
||||
*/
|
||||
log(LOG_ERR,
|
||||
"fore_cmd_drain: DACT failed, vcc=(%d,%d)\n",
|
||||
fvp->fv_connvc->cvc_vcc->vc_vpi,
|
||||
fvp->fv_connvc->cvc_vcc->vc_vci);
|
||||
fup->fu_pif.pif_cmderrors++;
|
||||
} else {
|
||||
/*
|
||||
* Successful VCC dactivation - so what?
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_GET_STATS:
|
||||
if (*hcp->hcq_status & QSTAT_ERROR) {
|
||||
/*
|
||||
* Couldn't get stats
|
||||
*/
|
||||
fup->fu_pif.pif_cmderrors++;
|
||||
fup->fu_stats_ret = EIO;
|
||||
} else {
|
||||
/*
|
||||
* Stats are now in unit buffer
|
||||
*/
|
||||
fup->fu_stats_ret = 0;
|
||||
}
|
||||
fup->fu_flags &= ~FUF_STATCMD;
|
||||
|
||||
/*
|
||||
* Flush received stats data
|
||||
*/
|
||||
#ifdef VAC
|
||||
if (vac)
|
||||
vac_pageflush((addr_t)fup->fu_stats);
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
/*
|
||||
* Little endian machines receives the stats in
|
||||
* wrong byte order. Instead of swapping in user
|
||||
* land, swap here so that everything going out
|
||||
* of the kernel is in correct host order.
|
||||
*/
|
||||
{
|
||||
u_long *bp = (u_long *)fup->fu_stats;
|
||||
int loop;
|
||||
|
||||
for ( loop = 0; loop < sizeof(Fore_cp_stats)/
|
||||
sizeof(long); loop++, bp++ )
|
||||
*bp = ntohl(*bp);
|
||||
}
|
||||
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
|
||||
|
||||
/*
|
||||
* Poke whoever is waiting on the stats
|
||||
*/
|
||||
wakeup(&fup->fu_stats);
|
||||
break;
|
||||
|
||||
case CMD_GET_PROM:
|
||||
if (fup->fu_ft4)
|
||||
goto unknown;
|
||||
goto prom;
|
||||
|
||||
case CMD_GET_PROM4:
|
||||
if (!fup->fu_ft4)
|
||||
goto unknown;
|
||||
prom:
|
||||
if (*hcp->hcq_status & QSTAT_ERROR) {
|
||||
/*
|
||||
* Couldn't get PROM data
|
||||
*/
|
||||
fup->fu_pif.pif_cmderrors++;
|
||||
log(LOG_ERR,
|
||||
"fore_cmd_drain: %s%d: GET_PROM failed\n",
|
||||
fup->fu_pif.pif_name,
|
||||
fup->fu_pif.pif_unit);
|
||||
} else {
|
||||
Fore_prom *fp = fup->fu_prom;
|
||||
|
||||
/*
|
||||
* Flush received PROM data
|
||||
*/
|
||||
#ifdef VAC
|
||||
if (vac)
|
||||
vac_pageflush((addr_t)fp);
|
||||
#endif
|
||||
/*
|
||||
* Copy PROM info into config areas
|
||||
*/
|
||||
bcopy(&fp->pr_mac[2],
|
||||
&fup->fu_pif.pif_macaddr,
|
||||
sizeof(struct mac_addr));
|
||||
fup->fu_config.ac_macaddr =
|
||||
fup->fu_pif.pif_macaddr;
|
||||
snprintf(fup->fu_config.ac_hard_vers,
|
||||
sizeof(fup->fu_config.ac_hard_vers),
|
||||
"%ld.%ld.%ld",
|
||||
(fp->pr_hwver >> 16) & 0xff,
|
||||
(fp->pr_hwver >> 8) & 0xff,
|
||||
fp->pr_hwver & 0xff);
|
||||
fup->fu_config.ac_serial = fp->pr_serno;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
unknown:
|
||||
log(LOG_ERR, "fore_cmd_drain: unknown command %ld\n",
|
||||
hcp->hcq_code);
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark this entry free for use and bump head pointer
|
||||
* to the next entry in the queue
|
||||
*/
|
||||
*hcp->hcq_status = QSTAT_FREE;
|
||||
fup->fu_cmd_head = hcp->hcq_next;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free Command Queue Data Structures
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_cmd_free(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
H_cmd_queue *hcp;
|
||||
|
||||
/*
|
||||
* Deal with any commands left on the queue
|
||||
*/
|
||||
if (fup->fu_flags & CUF_INITED) {
|
||||
while (*fup->fu_cmd_head->hcq_status != QSTAT_FREE) {
|
||||
hcp = fup->fu_cmd_head;
|
||||
|
||||
switch (hcp->hcq_code) {
|
||||
|
||||
case CMD_GET_STATS:
|
||||
/*
|
||||
* Just in case someone is sleeping on this
|
||||
*/
|
||||
fup->fu_stats_ret = EIO;
|
||||
wakeup(&fup->fu_stats);
|
||||
break;
|
||||
}
|
||||
|
||||
*hcp->hcq_status = QSTAT_FREE;
|
||||
fup->fu_cmd_head = hcp->hcq_next;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the statistics buffer
|
||||
*/
|
||||
if (fup->fu_stats) {
|
||||
atm_dev_free(fup->fu_stats);
|
||||
fup->fu_stats = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the PROM buffer
|
||||
*/
|
||||
if (fup->fu_prom) {
|
||||
atm_dev_free(fup->fu_prom);
|
||||
fup->fu_prom = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the status words
|
||||
*/
|
||||
if (fup->fu_cmd_stat) {
|
||||
atm_dev_free((volatile void *)fup->fu_cmd_stat);
|
||||
fup->fu_cmd_stat = NULL;
|
||||
fup->fu_cmd_statd = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
/*-
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Global variable definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
|
||||
#include <vm/uma.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Device unit table
|
||||
*/
|
||||
Fore_unit *fore_units[FORE_MAX_UNITS] = {NULL};
|
||||
int fore_nunits = 0;
|
||||
|
||||
|
||||
/*
|
||||
* ATM Interface services
|
||||
*/
|
||||
static struct stack_defn fore_svaal5 = {
|
||||
NULL,
|
||||
SAP_CPCS_AAL5,
|
||||
SDF_TERM,
|
||||
atm_dev_inst,
|
||||
atm_dev_lower,
|
||||
NULL,
|
||||
0,
|
||||
};
|
||||
static struct stack_defn fore_svaal4 = {
|
||||
&fore_svaal5,
|
||||
SAP_CPCS_AAL3_4,
|
||||
SDF_TERM,
|
||||
atm_dev_inst,
|
||||
atm_dev_lower,
|
||||
NULL,
|
||||
0,
|
||||
};
|
||||
static struct stack_defn fore_svaal0 = {
|
||||
&fore_svaal4,
|
||||
SAP_ATM,
|
||||
SDF_TERM,
|
||||
atm_dev_inst,
|
||||
atm_dev_lower,
|
||||
NULL,
|
||||
0,
|
||||
};
|
||||
struct stack_defn *fore_services = &fore_svaal0;
|
||||
|
||||
|
||||
/*
|
||||
* Storage pools
|
||||
*/
|
||||
uma_zone_t fore_nif_zone;
|
||||
uma_zone_t fore_vcc_zone;
|
||||
|
||||
/*
|
||||
* Watchdog timer
|
||||
*/
|
||||
struct atm_time fore_timer = {0, 0};
|
||||
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Network interface layer support
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_ioctl.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Handle netatm core service interface ioctl requests
|
||||
*
|
||||
* Called at splnet.
|
||||
*
|
||||
* Arguments:
|
||||
* code ioctl function (sub)code
|
||||
* data data to/from ioctl
|
||||
* arg optional code-specific argument
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed successfully
|
||||
* error request failed - reason code
|
||||
*/
|
||||
int
|
||||
fore_atm_ioctl(code, data, arg)
|
||||
int code;
|
||||
caddr_t data;
|
||||
caddr_t arg;
|
||||
{
|
||||
struct atminfreq *aip = (struct atminfreq *)data;
|
||||
struct atm_pif *pip;
|
||||
Fore_unit *fup;
|
||||
caddr_t buf = aip->air_buf_addr;
|
||||
struct air_vinfo_rsp *avr;
|
||||
size_t count;
|
||||
size_t len;
|
||||
size_t buf_len = aip->air_buf_len;
|
||||
int err = 0;
|
||||
char ifname[2*IFNAMSIZ];
|
||||
|
||||
|
||||
ATM_DEBUG2("fore_atm_ioctl: code=%d, opcode=%d\n",
|
||||
code, aip->air_opcode);
|
||||
|
||||
switch ( aip->air_opcode ) {
|
||||
|
||||
case AIOCS_INF_VST:
|
||||
/*
|
||||
* Get vendor statistics
|
||||
*/
|
||||
pip = (struct atm_pif *)arg;
|
||||
fup = (Fore_unit *)pip;
|
||||
if ( pip == NULL )
|
||||
return ( ENXIO );
|
||||
snprintf ( ifname, sizeof(ifname),
|
||||
"%s%d", pip->pif_name, pip->pif_unit );
|
||||
|
||||
/*
|
||||
* Cast response structure onto user's buffer
|
||||
*/
|
||||
avr = (struct air_vinfo_rsp *)buf;
|
||||
|
||||
/*
|
||||
* How large is the response structure?
|
||||
*/
|
||||
len = sizeof(struct air_vinfo_rsp);
|
||||
|
||||
/*
|
||||
* Sanity check - enough room for response structure?
|
||||
*/
|
||||
if ( buf_len < len )
|
||||
return ( ENOSPC );
|
||||
|
||||
/*
|
||||
* Copy interface name into response structure
|
||||
*/
|
||||
if ((err = copyout ( ifname, avr->avsp_intf, IFNAMSIZ)) != 0)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Advance the buffer address and decrement the size
|
||||
*/
|
||||
buf += len;
|
||||
buf_len -= len;
|
||||
|
||||
/*
|
||||
* Get the vendor stats from the hardware
|
||||
*/
|
||||
count = 0;
|
||||
if ( ( err = fore_get_stats ( fup ) ) == 0 )
|
||||
{
|
||||
/*
|
||||
* Stick as much of it as we have room for
|
||||
* into the response
|
||||
*/
|
||||
count = min ( sizeof(Fore_stats), buf_len );
|
||||
|
||||
/*
|
||||
* Copy stats into user's buffer. Return value is
|
||||
* amount of data copied.
|
||||
*/
|
||||
if ((err = copyout((caddr_t)fup->fu_stats, buf, count)) != 0)
|
||||
break;
|
||||
buf += count;
|
||||
buf_len -= count;
|
||||
if ( count < sizeof(Fore_stats) )
|
||||
err = ENOSPC;
|
||||
}
|
||||
|
||||
/*
|
||||
* Record amount we're returning as vendor info...
|
||||
*/
|
||||
if ((err = copyout(&count, &avr->avsp_len, sizeof(count))) != 0)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Update the reply pointers and lengths
|
||||
*/
|
||||
aip->air_buf_addr = buf;
|
||||
aip->air_buf_len = buf_len;
|
||||
break;
|
||||
|
||||
default:
|
||||
err = ENOSYS; /* Operation not supported */
|
||||
break;
|
||||
}
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free Fore-specific device resources
|
||||
*
|
||||
* Frees all dynamically acquired resources for a device unit. Before
|
||||
* this function is called, the CP will have been reset and our interrupt
|
||||
* vectors removed.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
fore_interface_free(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
|
||||
/*
|
||||
* Free up all of our allocated memory
|
||||
*/
|
||||
fore_xmit_free(fup);
|
||||
fore_recv_free(fup);
|
||||
fore_buf_free(fup);
|
||||
fore_cmd_free(fup);
|
||||
|
||||
/*
|
||||
* Clear device initialized
|
||||
*/
|
||||
if (fup->fu_flags & CUF_INITED) {
|
||||
fup->fu_flags &= ~CUF_INITED;
|
||||
}
|
||||
|
||||
if (fup->fu_flags & FUF_STATCMD) {
|
||||
fup->fu_flags &= ~FUF_STATCMD;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Local driver include files and global declarations
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FORE_INCLUDE_H
|
||||
#define _FORE_INCLUDE_H
|
||||
|
||||
/*
|
||||
* Global function declarations
|
||||
*/
|
||||
/* fore_buffer.c */
|
||||
int fore_buf_allocate(Fore_unit *);
|
||||
void fore_buf_initialize(Fore_unit *);
|
||||
void fore_buf_supply(Fore_unit *);
|
||||
void fore_buf_free(Fore_unit *);
|
||||
|
||||
/* fore_command.c */
|
||||
int fore_cmd_allocate(Fore_unit *);
|
||||
void fore_cmd_initialize(Fore_unit *);
|
||||
void fore_cmd_drain(Fore_unit *);
|
||||
void fore_cmd_free(Fore_unit *);
|
||||
|
||||
/* fore_if.c */
|
||||
int fore_atm_ioctl(int, caddr_t, caddr_t);
|
||||
void fore_interface_free(Fore_unit *);
|
||||
|
||||
/* fore_init.c */
|
||||
void fore_initialize(Fore_unit *);
|
||||
void fore_initialize_complete(Fore_unit *);
|
||||
|
||||
/* fore_intr.c */
|
||||
void fore_intr(void *);
|
||||
void fore_watchdog(Fore_unit *);
|
||||
|
||||
/* fore_load.c */
|
||||
|
||||
/* fore_output.c */
|
||||
void fore_output(Cmn_unit *, Cmn_vcc *, KBuffer *);
|
||||
|
||||
/* fore_receive.c */
|
||||
int fore_recv_allocate(Fore_unit *);
|
||||
void fore_recv_initialize(Fore_unit *);
|
||||
void fore_recv_drain(Fore_unit *);
|
||||
void fore_recv_free(Fore_unit *);
|
||||
|
||||
/* fore_stats.c */
|
||||
int fore_get_stats(Fore_unit *);
|
||||
|
||||
/* fore_timer.c */
|
||||
void fore_timeout(struct atm_time *);
|
||||
|
||||
/* fore_transmit.c */
|
||||
int fore_xmit_allocate(Fore_unit *);
|
||||
void fore_xmit_initialize(Fore_unit *);
|
||||
void fore_xmit_drain(Fore_unit *);
|
||||
void fore_xmit_free(Fore_unit *);
|
||||
|
||||
/* fore_vcm.c */
|
||||
int fore_instvcc(Cmn_unit *, Cmn_vcc *);
|
||||
int fore_openvcc(Cmn_unit *, Cmn_vcc *);
|
||||
int fore_closevcc(Cmn_unit *, Cmn_vcc *);
|
||||
|
||||
|
||||
/*
|
||||
* Global variable declarations
|
||||
*/
|
||||
extern Fore_device fore_devices[];
|
||||
extern Fore_unit *fore_units[];
|
||||
extern int fore_nunits;
|
||||
extern struct stack_defn *fore_services;
|
||||
extern uma_zone_t fore_nif_zone;
|
||||
extern uma_zone_t fore_vcc_zone;
|
||||
extern struct atm_time fore_timer;
|
||||
|
||||
#endif /* _FORE_INCLUDE_H */
|
||||
|
|
@ -1,380 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Cell Processor (CP) initialization routines
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
static void fore_get_prom(Fore_unit *);
|
||||
|
||||
|
||||
/*
|
||||
* Begin CP Initialization
|
||||
*
|
||||
* This function will poll for the successful downloading and starting of
|
||||
* the CP microcode program. After the microcode is running, we will allocate
|
||||
* any needed kernel memory (must do it in non-interrupt mode), build the CP
|
||||
* queue configurations and issue an Initialize command to the CP.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_initialize(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
Aali *aap;
|
||||
Init_parms *inp;
|
||||
caddr_t errmsg;
|
||||
u_long vers;
|
||||
u_int c, wait;
|
||||
#define MAX_WAIT 100
|
||||
|
||||
/*
|
||||
* Must wait until firmware has been downloaded and is running
|
||||
*/
|
||||
if (CP_READ(fup->fu_mon->mon_bstat) != BOOT_RUNNING) {
|
||||
|
||||
/*
|
||||
* Try again later
|
||||
*/
|
||||
fup->fu_thandle =
|
||||
timeout((KTimeout_ret(*)(void *))fore_initialize,
|
||||
(void *)fup, hz);
|
||||
return;
|
||||
} else
|
||||
callout_handle_init(&fup->fu_thandle);
|
||||
|
||||
/*
|
||||
* Allocate queues and whatever else is needed
|
||||
*/
|
||||
if (fore_xmit_allocate(fup)) {
|
||||
errmsg = "transmit queue allocation";
|
||||
goto failed;
|
||||
}
|
||||
if (fore_recv_allocate(fup)) {
|
||||
errmsg = "receive queue allocation";
|
||||
goto failed;
|
||||
}
|
||||
if (fore_buf_allocate(fup)) {
|
||||
errmsg = "buffer supply queue allocation";
|
||||
goto failed;
|
||||
}
|
||||
if (fore_cmd_allocate(fup)) {
|
||||
errmsg = "command queue allocation";
|
||||
goto failed;
|
||||
}
|
||||
|
||||
/*
|
||||
* CP microcode is downloaded - locate shared memory interface
|
||||
*/
|
||||
aap = (Aali *)(fup->fu_ram + CP_READ(fup->fu_mon->mon_appl));
|
||||
fup->fu_aali = aap;
|
||||
|
||||
/*
|
||||
* Pick out any interesting info from the microcode
|
||||
*/
|
||||
vers = CP_READ(aap->aali_ucode_ver);
|
||||
if (vers < FORE_MIN_UCODE) {
|
||||
errmsg = "unsupported microcode version";
|
||||
goto failed;
|
||||
}
|
||||
snprintf(fup->fu_config.ac_firm_vers,
|
||||
sizeof(fup->fu_config.ac_firm_vers), "%ld.%ld.%ld",
|
||||
(vers >> 16) & 0xff, (vers >> 8) & 0xff, vers & 0xff);
|
||||
|
||||
if (((vers >> 16) & 0xff) == 4)
|
||||
fup->fu_ft4 = 1;
|
||||
else
|
||||
fup->fu_ft4 = 0;
|
||||
|
||||
#ifdef notdef
|
||||
/*
|
||||
* Turn on CP debugging
|
||||
*/
|
||||
aap->aali_hostlog = 1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Build the initialization block
|
||||
*/
|
||||
inp = &aap->aali_init;
|
||||
inp->init_numvcc = CP_WRITE(FORE_MAX_VCC);
|
||||
inp->init_cmd_elem = CP_WRITE(CMD_QUELEN);
|
||||
inp->init_xmit_elem = CP_WRITE(XMIT_QUELEN);
|
||||
inp->init_recv_elem = CP_WRITE(RECV_QUELEN);
|
||||
inp->init_recv_ext = CP_WRITE(RECV_EXTRA_SEGS);
|
||||
inp->init_xmit_ext = CP_WRITE(XMIT_EXTRA_SEGS);
|
||||
inp->init_buf1s.bfs_quelen = CP_WRITE(BUF1_SM_QUELEN);
|
||||
inp->init_buf1s.bfs_bufsize = CP_WRITE(BUF1_SM_SIZE);
|
||||
inp->init_buf1s.bfs_cppool = CP_WRITE(BUF1_SM_CPPOOL);
|
||||
inp->init_buf1s.bfs_entsize = CP_WRITE(BUF1_SM_ENTSIZE);
|
||||
inp->init_buf1l.bfs_quelen = CP_WRITE(BUF1_LG_QUELEN);
|
||||
inp->init_buf1l.bfs_bufsize = CP_WRITE(BUF1_LG_SIZE);
|
||||
inp->init_buf1l.bfs_cppool = CP_WRITE(BUF1_LG_CPPOOL);
|
||||
inp->init_buf1l.bfs_entsize = CP_WRITE(BUF1_LG_ENTSIZE);
|
||||
inp->init_buf2s.bfs_quelen = CP_WRITE(0);
|
||||
inp->init_buf2s.bfs_bufsize = CP_WRITE(0);
|
||||
inp->init_buf2s.bfs_cppool = CP_WRITE(0);
|
||||
inp->init_buf2s.bfs_entsize = CP_WRITE(0);
|
||||
inp->init_buf2l.bfs_quelen = CP_WRITE(0);
|
||||
inp->init_buf2l.bfs_bufsize = CP_WRITE(0);
|
||||
inp->init_buf2l.bfs_cppool = CP_WRITE(0);
|
||||
inp->init_buf2l.bfs_entsize = CP_WRITE(0);
|
||||
|
||||
/*
|
||||
* Enable device interrupts
|
||||
*/
|
||||
aap->aali_intr_ena = CP_WRITE(1);
|
||||
|
||||
/*
|
||||
* Issue the Initialize command to the CP and wait for
|
||||
* the CP to interrupt to signal completion
|
||||
*/
|
||||
inp->init_status = CP_WRITE(QSTAT_PENDING);
|
||||
|
||||
if (!fup->fu_ft4) {
|
||||
inp->init_cmd = CP_WRITE(CMD_INIT | CMD_INTR_REQ);
|
||||
return;
|
||||
}
|
||||
inp->init_cmd = CP_WRITE(CMD_INIT);
|
||||
|
||||
/*
|
||||
* With the ForeThought 4.X image it appears that we need to
|
||||
* busy wait on the initializisation command to complete.
|
||||
* Otherwise the command queue address (the first word
|
||||
* of the queue structure) will be mangled.
|
||||
*/
|
||||
c = 0;
|
||||
for (wait = 0; wait < MAX_WAIT; wait++) {
|
||||
c = CP_READ(inp->init_status);
|
||||
if (c & QSTAT_COMPLETED)
|
||||
break;
|
||||
DELAY(1000);
|
||||
}
|
||||
if (c & QSTAT_ERROR) {
|
||||
log(LOG_ERR, "fore initialization failed: intf=%s%d, "
|
||||
"hbeat=0x%lx\n", fup->fu_pif.pif_name,
|
||||
fup->fu_pif.pif_unit, (u_long)CP_READ(aap->aali_heartbeat));
|
||||
fore_interface_free(fup);
|
||||
return;
|
||||
}
|
||||
if (!(c & QSTAT_COMPLETED)) {
|
||||
log(LOG_ERR, "fore initialization timed out: intf=%s%d, "
|
||||
"hbeat=0x%lx\n", fup->fu_pif.pif_name, fup->fu_pif.pif_unit,
|
||||
(u_long)CP_READ(aap->aali_heartbeat));
|
||||
fore_interface_free(fup);
|
||||
return;
|
||||
}
|
||||
fore_initialize_complete(fup);
|
||||
return;
|
||||
|
||||
failed:
|
||||
/*
|
||||
* Initialization failure
|
||||
*/
|
||||
fore_interface_free(fup);
|
||||
log(LOG_ERR, "fore initialization failed: intf=%s%d, err=%s\n",
|
||||
fup->fu_pif.pif_name, fup->fu_pif.pif_unit, errmsg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Complete CP Initialization
|
||||
*
|
||||
* Called after the CP has successfully completed processing of the
|
||||
* Initialize command. We will now finish off our part of the
|
||||
* initialization process by setting up all the host-based queue
|
||||
* management structures.
|
||||
*
|
||||
* Called at interrupt level.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_initialize_complete(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
Aali *aap = fup->fu_aali;
|
||||
|
||||
/*
|
||||
* Log an initialization failure
|
||||
*/
|
||||
if (CP_READ(aap->aali_init.init_status) & QSTAT_ERROR) {
|
||||
|
||||
log(LOG_ERR,
|
||||
"fore initialization failed: intf=%s%d, hbeat=0x%lx\n",
|
||||
fup->fu_pif.pif_name, fup->fu_pif.pif_unit,
|
||||
(u_long)CP_READ(aap->aali_heartbeat));
|
||||
return;
|
||||
}
|
||||
|
||||
ATM_DEBUG1("heap=0x%lx\n", aap->aali_heap);
|
||||
ATM_DEBUG1("heaplen=0x%lx\n", aap->aali_heaplen);
|
||||
ATM_DEBUG1("cmd_q=0x%lx\n", aap->aali_cmd_q);
|
||||
ATM_DEBUG1("xmit_q=0x%lx\n", aap->aali_xmit_q);
|
||||
ATM_DEBUG1("recv_q=0x%lx\n", aap->aali_recv_q);
|
||||
ATM_DEBUG1("buf1s_q=0x%lx\n", aap->aali_buf1s_q);
|
||||
ATM_DEBUG1("buf1l_q=0x%lx\n", aap->aali_buf1l_q);
|
||||
ATM_DEBUG1("buf2s_q=0x%lx\n", aap->aali_buf2s_q);
|
||||
ATM_DEBUG1("buf2l_q=0x%lx\n", aap->aali_buf2l_q);
|
||||
|
||||
/*
|
||||
* Initialize all of our queues
|
||||
*/
|
||||
fore_xmit_initialize(fup);
|
||||
fore_recv_initialize(fup);
|
||||
fore_buf_initialize(fup);
|
||||
fore_cmd_initialize(fup);
|
||||
|
||||
/*
|
||||
* Mark device initialization completed
|
||||
*/
|
||||
fup->fu_flags |= CUF_INITED;
|
||||
|
||||
fore_get_prom(fup);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get device PROM values from CP
|
||||
*
|
||||
* This function will issue a GET_PROM command to the CP in order to
|
||||
* initiate the DMA transfer of the CP's PROM structure to the host.
|
||||
* This will be called after CP initialization has completed.
|
||||
* There is (currently) no retry if this fails.
|
||||
*
|
||||
* It took me some time to find out that FT3 and FT4 use different
|
||||
* operation codes for GET_PROM.
|
||||
*
|
||||
* Called at interrupt level.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
static void
|
||||
fore_get_prom(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
H_cmd_queue *hcp;
|
||||
Cmd_queue *cqp;
|
||||
|
||||
/*
|
||||
* Queue command at end of command queue
|
||||
*/
|
||||
hcp = fup->fu_cmd_tail;
|
||||
if ((*hcp->hcq_status) & QSTAT_FREE) {
|
||||
|
||||
/*
|
||||
* Queue entry available, so set our view of things up
|
||||
*/
|
||||
if (fup->fu_ft4)
|
||||
hcp->hcq_code = CMD_GET_PROM4;
|
||||
else
|
||||
hcp->hcq_code = CMD_GET_PROM;
|
||||
hcp->hcq_arg = NULL;
|
||||
fup->fu_cmd_tail = hcp->hcq_next;
|
||||
|
||||
/*
|
||||
* Now set the CP-resident queue entry - the CP will grab
|
||||
* the command when the op-code is set.
|
||||
*/
|
||||
cqp = hcp->hcq_cpelem;
|
||||
(*hcp->hcq_status) = QSTAT_PENDING;
|
||||
|
||||
fup->fu_promd = vtophys(fup->fu_prom);
|
||||
if (fup->fu_promd == 0) {
|
||||
fup->fu_stats->st_drv.drv_cm_nodma++;
|
||||
return;
|
||||
}
|
||||
cqp->cmdq_prom.prom_buffer = (CP_dma) CP_WRITE(fup->fu_promd);
|
||||
cqp->cmdq_prom.prom_cmd = CP_WRITE(hcp->hcq_code | CMD_INTR_REQ);
|
||||
|
||||
} else {
|
||||
/*
|
||||
* Command queue full
|
||||
*/
|
||||
fup->fu_stats->st_drv.drv_cm_full++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1,268 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Interrupt processing
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
#if defined(sun)
|
||||
/*
|
||||
* Polling interrupt routine
|
||||
*
|
||||
* Polling interrupts are handled by calling all interrupt service
|
||||
* routines for a given level until someone claims to have "handled" the
|
||||
* interrupt.
|
||||
*
|
||||
* Called at interrupt level.
|
||||
*
|
||||
* Arguments:
|
||||
* none
|
||||
*
|
||||
* Returns:
|
||||
* 1 an interrupt has been serviced
|
||||
* 0 no interrupts serviced
|
||||
*
|
||||
*/
|
||||
int
|
||||
fore_poll()
|
||||
{
|
||||
int serviced = 0;
|
||||
int unit;
|
||||
|
||||
/*
|
||||
* See if any of our devices are interrupting
|
||||
*/
|
||||
for ( unit = 0; unit < fore_nunits; unit++ )
|
||||
{
|
||||
Fore_unit *fup = fore_units[unit];
|
||||
|
||||
if (fup == NULL)
|
||||
continue;
|
||||
|
||||
serviced += fore_intr((void *)fup);
|
||||
}
|
||||
|
||||
/*
|
||||
* Indicate if we handled an interrupt
|
||||
*/
|
||||
return (serviced ? 1 : 0);
|
||||
}
|
||||
#endif /* defined(sun) */
|
||||
|
||||
|
||||
/*
|
||||
* Device interrupt routine
|
||||
*
|
||||
* Called at interrupt level.
|
||||
*
|
||||
* Arguments:
|
||||
* arg pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* 1 device interrupt was serviced
|
||||
* 0 no interrupts serviced
|
||||
*
|
||||
*/
|
||||
#if (defined(BSD) && (BSD <= 199306))
|
||||
int
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
fore_intr(arg)
|
||||
void *arg;
|
||||
{
|
||||
Fore_unit *fup = arg;
|
||||
Aali *aap;
|
||||
#if (defined(BSD) && (BSD <= 199306))
|
||||
int serviced = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Try to prevent stuff happening after we've paniced
|
||||
*/
|
||||
if (panicstr) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get to the microcode shared memory interface
|
||||
*/
|
||||
if ((aap = fup->fu_aali) == NULL)
|
||||
goto done;
|
||||
|
||||
/*
|
||||
* Has this card issued an interrupt??
|
||||
*/
|
||||
if (*fup->fu_psr) {
|
||||
|
||||
/*
|
||||
* Indicate that we've serviced an interrupt.
|
||||
*/
|
||||
#if (defined(BSD) && (BSD <= 199306))
|
||||
serviced = 1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Clear the device interrupt
|
||||
*/
|
||||
if (fup->fu_config.ac_device == DEV_FORE_PCA200E)
|
||||
PCA200E_HCR_SET(*fup->fu_ctlreg, PCA200E_CLR_HBUS_INT);
|
||||
aap->aali_intr_sent = CP_WRITE(0);
|
||||
|
||||
/*
|
||||
* Reset the watchdog timer
|
||||
*/
|
||||
fup->fu_timer = FORE_WATCHDOG;
|
||||
|
||||
/*
|
||||
* Device initialization handled separately
|
||||
*/
|
||||
if ((fup->fu_flags & CUF_INITED) == 0) {
|
||||
|
||||
if (fup->fu_ft4)
|
||||
/* may not happen */
|
||||
goto done;
|
||||
|
||||
/*
|
||||
* We're just initializing device now, so see if
|
||||
* the initialization command has completed
|
||||
*/
|
||||
if (CP_READ(aap->aali_init.init_status) &
|
||||
QSTAT_COMPLETED)
|
||||
fore_initialize_complete(fup);
|
||||
|
||||
/*
|
||||
* If we're still not inited, none of the host
|
||||
* queues are setup yet
|
||||
*/
|
||||
if ((fup->fu_flags & CUF_INITED) == 0)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* Drain the queues of completed work
|
||||
*/
|
||||
fore_cmd_drain(fup);
|
||||
fore_recv_drain(fup);
|
||||
fore_xmit_drain(fup);
|
||||
|
||||
/*
|
||||
* Supply more buffers to the CP
|
||||
*/
|
||||
fore_buf_supply(fup);
|
||||
}
|
||||
|
||||
done:
|
||||
#if (defined(BSD) && (BSD <= 199306))
|
||||
return(serviced);
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Watchdog timeout routine
|
||||
*
|
||||
* Called when we haven't heard from the card in a while. Just in case
|
||||
* we missed an interrupt, we'll drain the queues and try to resupply the
|
||||
* CP with more receive buffers. If the CP is partially wedged, hopefully
|
||||
* this will be enough to get it going again.
|
||||
*
|
||||
* Called with interrupts locked out.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
fore_watchdog(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
/*
|
||||
* Try to prevent stuff happening after we've paniced
|
||||
*/
|
||||
if (panicstr) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the watchdog timer
|
||||
*/
|
||||
fup->fu_timer = FORE_WATCHDOG;
|
||||
|
||||
/*
|
||||
* If the device is initialized, nudge it (wink, wink)
|
||||
*/
|
||||
if (fup->fu_flags & CUF_INITED) {
|
||||
|
||||
/*
|
||||
* Drain the queues of completed work
|
||||
*/
|
||||
fore_cmd_drain(fup);
|
||||
fore_recv_drain(fup);
|
||||
fore_xmit_drain(fup);
|
||||
|
||||
/*
|
||||
* Supply more buffers to the CP
|
||||
*/
|
||||
fore_buf_supply(fup);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,479 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* PDU output processing
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_vc.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
static KBuffer * fore_xmit_segment(Fore_unit *, KBuffer *,
|
||||
H_xmit_queue *, int *, int *);
|
||||
static void fore_seg_dma_free(H_xmit_queue *, KBuffer *, int);
|
||||
|
||||
|
||||
/*
|
||||
* Output a PDU
|
||||
*
|
||||
* This function is called via the common driver code after receiving a
|
||||
* stack *_DATA* command. The common code has already validated most of
|
||||
* the request so we just need to check a few more Fore-specific details.
|
||||
* Then we just build a transmit descriptor request for the PDU and issue
|
||||
* the command to the CP.
|
||||
*
|
||||
* Arguments:
|
||||
* cup pointer to device common unit
|
||||
* cvp pointer to common VCC entry
|
||||
* m pointer to output PDU buffer chain head
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
fore_output(cup, cvp, m)
|
||||
Cmn_unit *cup;
|
||||
Cmn_vcc *cvp;
|
||||
KBuffer *m;
|
||||
{
|
||||
Fore_unit *fup = (Fore_unit *)cup;
|
||||
Fore_vcc *fvp = (Fore_vcc *)cvp;
|
||||
struct vccb *vcp;
|
||||
H_xmit_queue *hxp;
|
||||
Xmit_queue *cqp;
|
||||
Xmit_descr *xdp;
|
||||
int retry, nsegs, pdulen;
|
||||
int s;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (atm_dev_print)
|
||||
atm_dev_pdu_print(cup, cvp, m, "fore_output");
|
||||
#endif
|
||||
|
||||
vcp = fvp->fv_connvc->cvc_vcc;
|
||||
|
||||
/*
|
||||
* If we're still waiting for activation to finish, delay for
|
||||
* a little while before we toss the PDU
|
||||
*/
|
||||
if (fvp->fv_state == CVS_INITED) {
|
||||
retry = 3;
|
||||
while (retry-- && (fvp->fv_state == CVS_INITED))
|
||||
DELAY(1000);
|
||||
if (fvp->fv_state != CVS_ACTIVE) {
|
||||
/*
|
||||
* Activation still hasn't finished, oh well....
|
||||
*/
|
||||
fup->fu_stats->st_drv.drv_xm_notact++;
|
||||
vcp->vc_oerrors++;
|
||||
if (vcp->vc_nif)
|
||||
ANIF2IFP(vcp->vc_nif)->if_oerrors++;
|
||||
KB_FREEALL(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Queue PDU at end of transmit queue
|
||||
*
|
||||
* If queue is full we'll delay a bit before tossing the PDU
|
||||
*/
|
||||
s = splnet();
|
||||
hxp = fup->fu_xmit_tail;
|
||||
if (!((*hxp->hxq_status) & QSTAT_FREE)) {
|
||||
|
||||
fup->fu_stats->st_drv.drv_xm_full++;
|
||||
retry = 3;
|
||||
do {
|
||||
DELAY(1000);
|
||||
|
||||
DEVICE_LOCK((Cmn_unit *)fup);
|
||||
fore_xmit_drain(fup);
|
||||
DEVICE_UNLOCK((Cmn_unit *)fup);
|
||||
|
||||
} while (--retry && (!((*hxp->hxq_status) & QSTAT_FREE)));
|
||||
|
||||
if (!((*hxp->hxq_status) & QSTAT_FREE)) {
|
||||
/*
|
||||
* Queue is still full, bye-bye PDU
|
||||
*/
|
||||
fup->fu_pif.pif_oerrors++;
|
||||
vcp->vc_oerrors++;
|
||||
if (vcp->vc_nif)
|
||||
ANIF2IFP(vcp->vc_nif)->if_oerrors++;
|
||||
KB_FREEALL(m);
|
||||
(void) splx(s);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We've got a free transmit queue entry
|
||||
*/
|
||||
|
||||
/*
|
||||
* Now build the transmit segment descriptors for this PDU
|
||||
*/
|
||||
m = fore_xmit_segment(fup, m, hxp, &nsegs, &pdulen);
|
||||
if (m == NULL) {
|
||||
/*
|
||||
* The build failed, buffer chain has been freed
|
||||
*/
|
||||
vcp->vc_oerrors++;
|
||||
if (vcp->vc_nif)
|
||||
ANIF2IFP(vcp->vc_nif)->if_oerrors++;
|
||||
(void) splx(s);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up the descriptor header
|
||||
*/
|
||||
xdp = hxp->hxq_descr;
|
||||
xdp->xd_cell_hdr = ATM_HDR_SET(vcp->vc_vpi, vcp->vc_vci, 0, 0);
|
||||
xdp->xd_spec = XDS_SET_SPEC(0, fvp->fv_aal, nsegs, pdulen);
|
||||
xdp->xd_rate = fvp->rate;
|
||||
|
||||
/*
|
||||
* Everything is ready to go, so officially claim the host queue
|
||||
* entry and setup the CP-resident queue entry. The CP will grab
|
||||
* the PDU when the descriptor pointer is set.
|
||||
*/
|
||||
fup->fu_xmit_tail = hxp->hxq_next;
|
||||
hxp->hxq_buf = m;
|
||||
hxp->hxq_vcc = fvp;
|
||||
(*hxp->hxq_status) = QSTAT_PENDING;
|
||||
cqp = hxp->hxq_cpelem;
|
||||
cqp->cq_descr = (CP_dma)
|
||||
CP_WRITE((u_long)hxp->hxq_descr_dma | XMIT_SEGS_TO_BLKS(nsegs));
|
||||
|
||||
(void) splx(s);
|
||||
|
||||
/*
|
||||
* See if there are any completed queue entries
|
||||
*/
|
||||
DEVICE_LOCK((Cmn_unit *)fup);
|
||||
fore_xmit_drain(fup);
|
||||
DEVICE_UNLOCK((Cmn_unit *)fup);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Build Transmit Segment Descriptors
|
||||
*
|
||||
* This function will take a supplied buffer chain of data to be transmitted
|
||||
* and build the transmit segment descriptors for the data. This will include
|
||||
* the dreaded operation of ensuring that the data for each transmit segment
|
||||
* is full-word aligned and (except for the last segment) is an integral number
|
||||
* of words in length. If the data isn't already aligned and sized as
|
||||
* required, then the data must be shifted (copied) into place - a sure
|
||||
* performance killer. Note that we rely on the fact that all buffer data
|
||||
* areas are allocated with (at least) full-word alignments/lengths.
|
||||
*
|
||||
* If any errors are encountered, the buffer chain will be freed.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit
|
||||
* m pointer to output PDU buffer chain head
|
||||
* hxp pointer to host transmit queue entry
|
||||
* segp pointer to return the number of transmit segments
|
||||
* lenp pointer to return the pdu length
|
||||
*
|
||||
* Returns:
|
||||
* m build successful, pointer to (possibly new) head of
|
||||
* output PDU buffer chain
|
||||
* NULL build failed, buffer chain freed
|
||||
*
|
||||
*/
|
||||
static KBuffer *
|
||||
fore_xmit_segment(fup, m, hxp, segp, lenp)
|
||||
Fore_unit *fup;
|
||||
KBuffer *m;
|
||||
H_xmit_queue *hxp;
|
||||
int *segp;
|
||||
int *lenp;
|
||||
{
|
||||
Xmit_descr *xdp = hxp->hxq_descr;
|
||||
Xmit_seg_descr *xsp;
|
||||
H_dma *sdmap;
|
||||
KBuffer *m0, *m1, *mprev;
|
||||
caddr_t cp, bfr;
|
||||
vm_paddr_t dma;
|
||||
int pdulen, nsegs, len, align;
|
||||
int compressed = 0;
|
||||
|
||||
m0 = m;
|
||||
|
||||
retry:
|
||||
xsp = xdp->xd_seg;
|
||||
sdmap = hxp->hxq_dma;
|
||||
mprev = NULL;
|
||||
pdulen = 0;
|
||||
nsegs = 0;
|
||||
|
||||
/*
|
||||
* Loop thru each buffer in the chain, performing the necessary
|
||||
* data positioning and then building a segment descriptor for
|
||||
* that data.
|
||||
*/
|
||||
while (m) {
|
||||
/*
|
||||
* Get rid of any zero-length buffers
|
||||
*/
|
||||
if (KB_LEN(m) == 0) {
|
||||
if (mprev) {
|
||||
KB_UNLINK(m, mprev, m1);
|
||||
} else {
|
||||
KB_UNLINKHEAD(m, m1);
|
||||
m0 = m1;
|
||||
}
|
||||
m = m1;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure we don't try to use too many segments
|
||||
*/
|
||||
if (nsegs >= XMIT_MAX_SEGS) {
|
||||
/*
|
||||
* First, free already allocated DMA addresses
|
||||
*/
|
||||
fore_seg_dma_free(hxp, m0, nsegs);
|
||||
|
||||
/*
|
||||
* Try to compress buffer chain (but only once)
|
||||
*/
|
||||
if (compressed) {
|
||||
KB_FREEALL(m0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
fup->fu_stats->st_drv.drv_xm_maxpdu++;
|
||||
|
||||
m = atm_dev_compress(m0);
|
||||
if (m == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build segment descriptors for compressed chain
|
||||
*/
|
||||
m0 = m;
|
||||
compressed = 1;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get start of data onto full-word alignment
|
||||
*/
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
if ((align = ((uintptr_t)cp) & (XMIT_SEG_ALIGN - 1)) != 0) {
|
||||
/*
|
||||
* Gotta slide the data up
|
||||
*/
|
||||
fup->fu_stats->st_drv.drv_xm_segnoal++;
|
||||
bfr = cp - align;
|
||||
bcopy(cp, bfr, KB_LEN(m));
|
||||
KB_HEADMOVE(m, -align);
|
||||
} else {
|
||||
/*
|
||||
* Data already aligned
|
||||
*/
|
||||
bfr = cp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now work on getting the data length correct
|
||||
*/
|
||||
len = KB_LEN(m);
|
||||
while ((align = (len & (XMIT_SEG_ALIGN - 1))) &&
|
||||
(m1 = KB_NEXT(m))) {
|
||||
|
||||
/*
|
||||
* Have to move some data from following buffer(s)
|
||||
* to word-fill this buffer
|
||||
*/
|
||||
int ncopy = MIN(XMIT_SEG_ALIGN - align, KB_LEN(m1));
|
||||
|
||||
if (ncopy) {
|
||||
/*
|
||||
* Move data to current buffer
|
||||
*/
|
||||
caddr_t dest;
|
||||
|
||||
fup->fu_stats->st_drv.drv_xm_seglen++;
|
||||
KB_DATASTART(m1, cp, caddr_t);
|
||||
dest = bfr + len;
|
||||
KB_HEADADJ(m1, -ncopy);
|
||||
KB_TAILADJ(m, ncopy);
|
||||
len += ncopy;
|
||||
while (ncopy--) {
|
||||
*dest++ = *cp++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we've drained the buffer, free it
|
||||
*/
|
||||
if (KB_LEN(m1) == 0) {
|
||||
KBuffer *m2;
|
||||
|
||||
KB_UNLINK(m1, m, m2);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, build the segment descriptor
|
||||
*/
|
||||
|
||||
/*
|
||||
* Round last segment to fullword length (if needed)
|
||||
*/
|
||||
if (len & (XMIT_SEG_ALIGN - 1))
|
||||
xsp->xsd_len = KB_LEN(m) =
|
||||
(len + XMIT_SEG_ALIGN) & ~(XMIT_SEG_ALIGN - 1);
|
||||
else
|
||||
xsp->xsd_len = KB_LEN(m) = len;
|
||||
|
||||
/*
|
||||
* Get a DMA address for the data
|
||||
*/
|
||||
dma = vtophys(bfr);
|
||||
if (dma == 0) {
|
||||
fup->fu_stats->st_drv.drv_xm_segdma++;
|
||||
fore_seg_dma_free(hxp, m0, nsegs);
|
||||
KB_FREEALL(m0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now we're really ready to call it a segment
|
||||
*/
|
||||
*sdmap++ = xsp->xsd_buffer = (H_dma) dma;
|
||||
|
||||
/*
|
||||
* Bump counters and get ready for next buffer
|
||||
*/
|
||||
pdulen += len;
|
||||
nsegs++;
|
||||
xsp++;
|
||||
mprev = m;
|
||||
m = KB_NEXT(m);
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate PDU length
|
||||
*/
|
||||
if (pdulen > XMIT_MAX_PDULEN) {
|
||||
fup->fu_stats->st_drv.drv_xm_maxpdu++;
|
||||
fore_seg_dma_free(hxp, m0, nsegs);
|
||||
KB_FREEALL(m0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the good news to the caller
|
||||
*/
|
||||
*segp = nsegs;
|
||||
*lenp = pdulen;
|
||||
|
||||
return (m0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free Transmit Segment Queue DMA addresses
|
||||
*
|
||||
* Arguments:
|
||||
* hxp pointer to host transmit queue entry
|
||||
* m0 pointer to output PDU buffer chain head
|
||||
* nsegs number of processed transmit segments
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
static void
|
||||
fore_seg_dma_free(hxp, m0, nsegs)
|
||||
H_xmit_queue *hxp;
|
||||
KBuffer *m0;
|
||||
int nsegs;
|
||||
{
|
||||
KBuffer *m = m0;
|
||||
H_dma *sdmap = hxp->hxq_dma;
|
||||
caddr_t cp;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nsegs; i++) {
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
m = KB_NEXT(m);
|
||||
sdmap++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,595 +0,0 @@
|
|||
/*-
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Receive queue management
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <net/if.h>
|
||||
#include <net/netisr.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_vc.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
static void fore_recv_stack(void *, KBuffer *);
|
||||
|
||||
|
||||
/*
|
||||
* Allocate Receive Queue Data Structures
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* 0 allocations successful
|
||||
* else allocation failed
|
||||
*/
|
||||
int
|
||||
fore_recv_allocate(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
caddr_t memp;
|
||||
vm_paddr_t pmemp;
|
||||
|
||||
/*
|
||||
* Allocate non-cacheable memory for receive status words
|
||||
*/
|
||||
memp = atm_dev_alloc(sizeof(Q_status) * RECV_QUELEN,
|
||||
QSTAT_ALIGN, ATM_DEV_NONCACHE);
|
||||
if (memp == NULL) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_recv_stat = (Q_status *) memp;
|
||||
|
||||
pmemp = vtophys(fup->fu_recv_stat);
|
||||
if (pmemp == 0) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_recv_statd = pmemp;
|
||||
|
||||
/*
|
||||
* Allocate memory for receive descriptors
|
||||
*/
|
||||
memp = atm_dev_alloc(sizeof(Recv_descr) * RECV_QUELEN,
|
||||
RECV_DESCR_ALIGN, 0);
|
||||
if (memp == NULL) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_recv_desc = (Recv_descr *) memp;
|
||||
|
||||
pmemp = vtophys(fup->fu_recv_desc);
|
||||
if (pmemp == 0) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_recv_descd = pmemp;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Receive Queue Initialization
|
||||
*
|
||||
* Allocate and initialize the host-resident receive queue structures
|
||||
* and then initialize the CP-resident queue structures.
|
||||
*
|
||||
* Called at interrupt level.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_recv_initialize(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
Aali *aap = fup->fu_aali;
|
||||
Recv_queue *cqp;
|
||||
H_recv_queue *hrp;
|
||||
Recv_descr *rdp;
|
||||
vm_paddr_t rdp_dma;
|
||||
Q_status *qsp;
|
||||
vm_paddr_t qsp_dma;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Point to CP-resident receive queue
|
||||
*/
|
||||
cqp = (Recv_queue *)(fup->fu_ram + CP_READ(aap->aali_recv_q));
|
||||
|
||||
/*
|
||||
* Point to host-resident receive queue structures
|
||||
*/
|
||||
hrp = fup->fu_recv_q;
|
||||
qsp = fup->fu_recv_stat;
|
||||
qsp_dma = fup->fu_recv_statd;
|
||||
rdp = fup->fu_recv_desc;
|
||||
rdp_dma = fup->fu_recv_descd;
|
||||
|
||||
/*
|
||||
* Loop thru all queue entries and do whatever needs doing
|
||||
*/
|
||||
for (i = 0; i < RECV_QUELEN; i++) {
|
||||
|
||||
/*
|
||||
* Set queue status word to free
|
||||
*/
|
||||
*qsp = QSTAT_FREE;
|
||||
|
||||
/*
|
||||
* Set up host queue entry and link into ring
|
||||
*/
|
||||
hrp->hrq_cpelem = cqp;
|
||||
hrp->hrq_status = qsp;
|
||||
hrp->hrq_descr = rdp;
|
||||
hrp->hrq_descr_dma = rdp_dma;
|
||||
if (i == (RECV_QUELEN - 1))
|
||||
hrp->hrq_next = fup->fu_recv_q;
|
||||
else
|
||||
hrp->hrq_next = hrp + 1;
|
||||
|
||||
/*
|
||||
* Now let the CP into the game
|
||||
*/
|
||||
cqp->cq_descr = (CP_dma) CP_WRITE(rdp_dma);
|
||||
cqp->cq_status = (CP_dma) CP_WRITE(qsp_dma);
|
||||
|
||||
/*
|
||||
* Bump all queue pointers
|
||||
*/
|
||||
hrp++;
|
||||
qsp++;
|
||||
qsp_dma += sizeof(Q_status);
|
||||
rdp++;
|
||||
rdp_dma += sizeof(Recv_descr);
|
||||
cqp++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize queue pointers
|
||||
*/
|
||||
fup->fu_recv_head = fup->fu_recv_q;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Drain Receive Queue
|
||||
*
|
||||
* This function will process all completed entries at the head of the
|
||||
* receive queue. The received segments will be linked into a received
|
||||
* PDU buffer chain and it will then be passed up the PDU's VCC stack for
|
||||
* processing by the next higher protocol layer.
|
||||
*
|
||||
* May be called in interrupt state.
|
||||
* Must be called with interrupts locked out.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_recv_drain(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
H_recv_queue *hrp = NULL;
|
||||
Recv_descr *rdp;
|
||||
Recv_seg_descr *rsp;
|
||||
Buf_handle *bhp;
|
||||
Fore_vcc *fvp;
|
||||
struct vccb *vcp;
|
||||
KBuffer *m, *mhead, *mtail;
|
||||
caddr_t cp;
|
||||
u_long hdr, nsegs;
|
||||
u_int seglen, type0;
|
||||
int i, pdulen, retries = 0, error;
|
||||
|
||||
/* Silence the compiler */
|
||||
mtail = NULL;
|
||||
type0 = 0;
|
||||
|
||||
/*
|
||||
* Process each completed entry
|
||||
*/
|
||||
retry:
|
||||
while (*fup->fu_recv_head->hrq_status & QSTAT_COMPLETED) {
|
||||
|
||||
/*
|
||||
* Get completed entry's receive descriptor
|
||||
*/
|
||||
hrp = fup->fu_recv_head;
|
||||
rdp = hrp->hrq_descr;
|
||||
|
||||
#ifdef VAC
|
||||
/*
|
||||
* Cache flush receive descriptor
|
||||
*/
|
||||
if (vac) {
|
||||
vac_flush((addr_t)rdp, sizeof(Recv_descr));
|
||||
}
|
||||
#endif
|
||||
|
||||
hdr = rdp->rd_cell_hdr;
|
||||
nsegs = rdp->rd_nsegs;
|
||||
|
||||
pdulen = 0;
|
||||
error = 0;
|
||||
mhead = NULL;
|
||||
|
||||
/*
|
||||
* Locate incoming VCC for this PDU
|
||||
*/
|
||||
fvp = (Fore_vcc *) atm_dev_vcc_find((Cmn_unit *)fup,
|
||||
ATM_HDR_GET_VPI(hdr), ATM_HDR_GET_VCI(hdr), VCC_IN);
|
||||
|
||||
/*
|
||||
* Check for a receive error
|
||||
*
|
||||
* Apparently the receive descriptor itself contains valid
|
||||
* information, but the received pdu data is probably bogus.
|
||||
* We'll arrange for the receive buffer segments to be tossed.
|
||||
*/
|
||||
if (*hrp->hrq_status & QSTAT_ERROR) {
|
||||
|
||||
fup->fu_pif.pif_ierrors++;
|
||||
if (fvp) {
|
||||
vcp = fvp->fv_connvc->cvc_vcc;
|
||||
vcp->vc_ierrors++;
|
||||
if (vcp->vc_nif)
|
||||
ANIF2IFP(vcp->vc_nif)->if_ierrors++;
|
||||
}
|
||||
ATM_DEBUG1("fore receive error: hdr=0x%lx\n", hdr);
|
||||
error = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Build PDU buffer chain from receive segments
|
||||
*/
|
||||
for (i = 0, rsp = rdp->rd_seg; i < nsegs; i++, rsp++) {
|
||||
|
||||
bhp = rsp->rsd_handle;
|
||||
seglen = rsp->rsd_len;
|
||||
|
||||
/*
|
||||
* Remove buffer from our supplied queue and get
|
||||
* to the underlying buffer
|
||||
*/
|
||||
switch (bhp->bh_type) {
|
||||
|
||||
case BHT_S1_SMALL:
|
||||
DEQUEUE(bhp, Buf_handle, bh_qelem,
|
||||
fup->fu_buf1s_bq);
|
||||
fup->fu_buf1s_cnt--;
|
||||
m = (KBuffer *) ((caddr_t)bhp - BUF1_SM_HOFF);
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
break;
|
||||
|
||||
case BHT_S1_LARGE:
|
||||
DEQUEUE(bhp, Buf_handle, bh_qelem,
|
||||
fup->fu_buf1l_bq);
|
||||
fup->fu_buf1l_cnt--;
|
||||
m = (KBuffer *) ((caddr_t)bhp - BUF1_LG_HOFF);
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
break;
|
||||
|
||||
default:
|
||||
log(LOG_ERR,
|
||||
"fore_recv_drain: bhp=%p type=0x%x\n",
|
||||
bhp, bhp->bh_type);
|
||||
panic("fore_recv_drain: bad buffer type");
|
||||
}
|
||||
|
||||
/*
|
||||
* Toss any zero-length or receive error buffers
|
||||
*/
|
||||
if ((seglen == 0) || error) {
|
||||
KB_FREEALL(m);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Link buffer into chain
|
||||
*/
|
||||
if (mhead == NULL) {
|
||||
type0 = bhp->bh_type;
|
||||
KB_LINKHEAD(m, mhead);
|
||||
mhead = m;
|
||||
} else {
|
||||
KB_LINK(m, mtail);
|
||||
}
|
||||
KB_LEN(m) = seglen;
|
||||
pdulen += seglen;
|
||||
mtail = m;
|
||||
|
||||
/*
|
||||
* Flush received buffer data
|
||||
*/
|
||||
#ifdef VAC
|
||||
if (vac) {
|
||||
addr_t dp;
|
||||
|
||||
KB_DATASTART(m, dp, addr_t);
|
||||
vac_pageflush(dp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure we've got a non-null PDU
|
||||
*/
|
||||
if (mhead == NULL) {
|
||||
goto free_ent;
|
||||
}
|
||||
|
||||
/*
|
||||
* We only support user data PDUs (for now)
|
||||
*/
|
||||
if (hdr & ATM_HDR_SET_PT(ATM_PT_NONUSER)) {
|
||||
KB_FREEALL(mhead);
|
||||
goto free_ent;
|
||||
}
|
||||
|
||||
/*
|
||||
* Toss the data if there's no VCC
|
||||
*/
|
||||
if (fvp == NULL) {
|
||||
fup->fu_stats->st_drv.drv_rv_novcc++;
|
||||
KB_FREEALL(mhead);
|
||||
goto free_ent;
|
||||
}
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (atm_dev_print)
|
||||
atm_dev_pdu_print((Cmn_unit *)fup, (Cmn_vcc *)fvp,
|
||||
mhead, "fore_recv");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Make sure we have our queueing headroom at the front
|
||||
* of the buffer chain
|
||||
*/
|
||||
if (type0 != BHT_S1_SMALL) {
|
||||
|
||||
/*
|
||||
* Small buffers already have headroom built-in, but
|
||||
* if CP had to use a large buffer for the first
|
||||
* buffer, then we have to allocate a buffer here to
|
||||
* contain the headroom.
|
||||
*/
|
||||
fup->fu_stats->st_drv.drv_rv_nosbf++;
|
||||
|
||||
KB_ALLOCPKT(m, BUF1_SM_SIZE, KB_F_NOWAIT, KB_T_DATA);
|
||||
if (m == NULL) {
|
||||
fup->fu_stats->st_drv.drv_rv_nomb++;
|
||||
KB_FREEALL(mhead);
|
||||
goto free_ent;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put new buffer at head of PDU chain
|
||||
*/
|
||||
KB_LINKHEAD(m, mhead);
|
||||
KB_LEN(m) = 0;
|
||||
KB_HEADSET(m, BUF1_SM_DOFF);
|
||||
mhead = m;
|
||||
}
|
||||
|
||||
/*
|
||||
* It looks like we've got a valid PDU - count it quick!!
|
||||
*/
|
||||
mhead->m_pkthdr.rcvif = NULL;
|
||||
mhead->m_pkthdr.csum_flags = 0;
|
||||
SLIST_INIT(&mhead->m_pkthdr.tags);
|
||||
KB_PLENSET(mhead, pdulen);
|
||||
fup->fu_pif.pif_ipdus++;
|
||||
fup->fu_pif.pif_ibytes += pdulen;
|
||||
vcp = fvp->fv_connvc->cvc_vcc;
|
||||
vcp->vc_ipdus++;
|
||||
vcp->vc_ibytes += pdulen;
|
||||
if (vcp->vc_nif) {
|
||||
vcp->vc_nif->nif_ibytes += pdulen;
|
||||
ANIF2IFP(vcp->vc_nif)->if_ipackets++;
|
||||
#if (defined(BSD) && (BSD >= 199103))
|
||||
ANIF2IFP(vcp->vc_nif)->if_ibytes += pdulen;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* The STACK_CALL needs to happen at splnet() in order
|
||||
* for the stack sequence processing to work. Schedule an
|
||||
* interrupt queue callback at splnet() since we are
|
||||
* currently at device level.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Prepend callback function pointer and token value to buffer.
|
||||
* We have already guaranteed that the space is available
|
||||
* in the first buffer.
|
||||
* Don't count this extra fields in m_pkthdr.len (XXX)
|
||||
*/
|
||||
mhead->m_data -= sizeof(atm_intr_func_t) + sizeof(void *);
|
||||
mhead->m_len += sizeof(atm_intr_func_t) + sizeof(void *);
|
||||
cp = mtod(mhead, caddr_t);
|
||||
*((atm_intr_func_t *)cp) = fore_recv_stack;
|
||||
cp += sizeof(atm_intr_func_t);
|
||||
*((void **)cp) = (void *)fvp;
|
||||
|
||||
/*
|
||||
* Schedule callback
|
||||
*/
|
||||
if (netisr_queue(NETISR_ATM, mhead)) { /* (0) on success. */
|
||||
fup->fu_stats->st_drv.drv_rv_ifull++;
|
||||
goto free_ent;
|
||||
}
|
||||
|
||||
free_ent:
|
||||
/*
|
||||
* Mark this entry free for use and bump head pointer
|
||||
* to the next entry in the queue
|
||||
*/
|
||||
*hrp->hrq_status = QSTAT_FREE;
|
||||
hrp->hrq_cpelem->cq_descr =
|
||||
(CP_dma) CP_WRITE((u_long)hrp->hrq_descr_dma);
|
||||
fup->fu_recv_head = hrp->hrq_next;
|
||||
}
|
||||
|
||||
/*
|
||||
* Nearly all of the interrupts generated by the CP will be due
|
||||
* to PDU reception. However, we may receive an interrupt before
|
||||
* the CP has completed the status word DMA to host memory. Thus,
|
||||
* if we haven't processed any PDUs during this interrupt, we will
|
||||
* wait a bit for completed work on the receive queue, rather than
|
||||
* having to field an extra interrupt very soon.
|
||||
*/
|
||||
if (hrp == NULL) {
|
||||
if (++retries <= FORE_RECV_RETRY) {
|
||||
DELAY(FORE_RECV_DELAY);
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Pass Incoming PDU up Stack
|
||||
*
|
||||
* This function is called via the core ATM interrupt queue callback
|
||||
* set in fore_recv_drain(). It will pass the supplied incoming
|
||||
* PDU up the incoming VCC's stack.
|
||||
*
|
||||
* Called at splnet.
|
||||
*
|
||||
* Arguments:
|
||||
* tok token to identify stack instantiation
|
||||
* m pointer to incoming PDU buffer chain
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
static void
|
||||
fore_recv_stack(tok, m)
|
||||
void *tok;
|
||||
KBuffer *m;
|
||||
{
|
||||
Fore_vcc *fvp = (Fore_vcc *)tok;
|
||||
int err;
|
||||
|
||||
/*
|
||||
* Send the data up the stack
|
||||
*/
|
||||
STACK_CALL(CPCS_UNITDATA_SIG, fvp->fv_upper,
|
||||
fvp->fv_toku, fvp->fv_connvc, (intptr_t)m, 0, err);
|
||||
if (err)
|
||||
KB_FREEALL(m);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free Receive Queue Data Structures
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_recv_free(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
/*
|
||||
* We'll just let fore_buf_free() take care of freeing any
|
||||
* buffers sitting on the receive queue (which are also still
|
||||
* on the fu_*_bq queue).
|
||||
*/
|
||||
if (fup->fu_flags & CUF_INITED) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the status words
|
||||
*/
|
||||
if (fup->fu_recv_stat) {
|
||||
atm_dev_free((volatile void *)fup->fu_recv_stat);
|
||||
fup->fu_recv_stat = NULL;
|
||||
fup->fu_recv_statd = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the receive descriptors
|
||||
*/
|
||||
if (fup->fu_recv_desc) {
|
||||
atm_dev_free(fup->fu_recv_desc);
|
||||
fup->fu_recv_desc = NULL;
|
||||
fup->fu_recv_descd = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1,190 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Slave Interface definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FORE_SLAVE_H
|
||||
#define _FORE_SLAVE_H
|
||||
|
||||
/*
|
||||
* This file contains the (mostly hardware) definitions for each of the
|
||||
* supported 200-series slave interfaces.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Structure defining the supported FORE 200-series interfaces
|
||||
*/
|
||||
struct fore_device {
|
||||
char *fd_name; /* Device name (from PROM) */
|
||||
Atm_device fd_devtyp; /* Device type */
|
||||
};
|
||||
typedef struct fore_device Fore_device;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Common definitions
|
||||
* ------------------
|
||||
*/
|
||||
#define MON960_BASE 0x400 /* Address offset of Mon960 */
|
||||
#define AALI_BASE 0x4d40 /* Address offset of Aali */
|
||||
|
||||
typedef volatile unsigned int Fore_reg; /* Slave control register */
|
||||
typedef volatile unsigned char Fore_mem; /* Slave memory */
|
||||
|
||||
|
||||
/*
|
||||
* SBA-200E SBus Slave Interface
|
||||
* -----------------------------
|
||||
*/
|
||||
|
||||
#define SBA200E_PROM_NAME "FORE,sba-200e"
|
||||
|
||||
/*
|
||||
* SBA-200E Host Control Register (HCR)
|
||||
*/
|
||||
#define SBA200E_READ_BITS 0x1ff /* Valid read data bits */
|
||||
#define SBA200E_WRITE_BITS 0x01f /* Valid write data bits */
|
||||
#define SBA200E_STICKY_BITS 0x013 /* Sticky data bits */
|
||||
|
||||
/* Read access */
|
||||
#define SBA200E_SBUS_INTR_RD 0x100 /* State of SBus interrupt */
|
||||
#define SBA200E_TEST_MODE 0x080 /* Device is in test-mode */
|
||||
#define SBA200E_IFIFO_FULL 0x040 /* Input FIFO almost full (when 0) */
|
||||
#define SBA200E_ESP_HOLD_RD 0x020 /* State of ESP bus hold */
|
||||
#define SBA200E_SBUS_ENA_RD 0x010 /* State of SBus interrupt enable */
|
||||
#define SBA200E_OFIFO_FULL 0x008 /* Output FIFO almost full */
|
||||
#define SBA200E_SELFTEST_FAIL 0x004 /* i960 self-test failed (when 0) */
|
||||
#define SBA200E_HOLD_LOCK_RD 0x002 /* State of i960 hold lock signal */
|
||||
#define SBA200E_RESET_RD 0x001 /* State of board reset signal */
|
||||
|
||||
/* Write access - bit set (clear) */
|
||||
#define SBA200E_SBUS_ENA 0x010 /* Enable (disable) SBus interrupts */
|
||||
#define SBA200E_CLR_SBUS_INTR 0x008 /* Clear SBus interrupt */
|
||||
#define SBA200E_I960_INTR 0x004 /* Issue interrupt to i960 */
|
||||
#define SBA200E_HOLD_LOCK 0x002 /* Set (clear) i960 hold lock signal */
|
||||
#define SBA200E_RESET 0x001 /* Set (clear) board reset signal */
|
||||
|
||||
#define SBA200E_HCR_INIT(hcr,bits) \
|
||||
((hcr) = (SBA200E_WRITE_BITS & (bits)))
|
||||
#define SBA200E_HCR_SET(hcr,bits) \
|
||||
((hcr) = (((hcr) & SBA200E_STICKY_BITS) | (bits)))
|
||||
#define SBA200E_HCR_CLR(hcr,bits) \
|
||||
((hcr) = ((hcr) & (SBA200E_STICKY_BITS ^ (bits))))
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* SBA-200 SBus Slave Interface
|
||||
* ----------------------------
|
||||
*/
|
||||
|
||||
#define SBA200_PROM_NAME "FORE,sba-200"
|
||||
|
||||
/*
|
||||
* SBA-200 Board Control Register (BCR)
|
||||
*/
|
||||
/* Write access - bit set */
|
||||
#define SBA200_CLR_SBUS_INTR 0x04 /* Clear SBus interrupt */
|
||||
#define SBA200_RESET 0x01 /* Assert board reset signal */
|
||||
|
||||
/* Write access - bit clear */
|
||||
#define SBA200_RESET_CLR 0x00 /* Clear board reset signal */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* PCA-200E PCI Bus Slave Interface
|
||||
* --------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* PCI Identifiers
|
||||
*/
|
||||
#define FORE_VENDOR_ID 0x1127
|
||||
|
||||
/*
|
||||
* PCA-200E PCI Configuration Space
|
||||
*/
|
||||
#define PCA200E_PCI_MEMBASE 0x10 /* Memory base address */
|
||||
#define PCA200E_PCI_MCTL 0x40 /* Master control */
|
||||
|
||||
/*
|
||||
* PCA-200E Address Space
|
||||
*/
|
||||
#define PCA200E_RAM_SIZE 0x100000
|
||||
#define PCA200E_HCR_OFFSET 0x100000
|
||||
#define PCA200E_IMASK_OFFSET 0x100004
|
||||
#define PCA200E_PSR_OFFSET 0x100008
|
||||
#define PCA200E_MMAP_SIZE 0x10000c
|
||||
|
||||
/*
|
||||
* PCA-200E Master Control
|
||||
*/
|
||||
#define PCA200E_MCTL_SWAP 0x4000 /* Convert Slave endianess */
|
||||
|
||||
/*
|
||||
* PCA-200E Host Control Register (HCR)
|
||||
*/
|
||||
#define PCA200E_READ_BITS 0x0ff /* Valid read data bits */
|
||||
#define PCA200E_WRITE_BITS 0x01f /* Valid write data bits */
|
||||
#define PCA200E_STICKY_BITS 0x000 /* Sticky data bits */
|
||||
|
||||
/* Read access */
|
||||
#define PCA200E_TEST_MODE 0x080 /* Device is in test-mode */
|
||||
#define PCA200E_IFIFO_FULL 0x040 /* Input FIFO almost full */
|
||||
#define PCA200E_ESP_HOLD_RD 0x020 /* State of ESP hold bus */
|
||||
#define PCA200E_OFIFO_FULL 0x010 /* Output FIFO almost full */
|
||||
#define PCA200E_HOLD_ACK 0x008 /* State of Hold Ack */
|
||||
#define PCA200E_SELFTEST_FAIL 0x004 /* i960 self-test failed */
|
||||
#define PCA200E_HOLD_LOCK_RD 0x002 /* State of i960 hold lock signal */
|
||||
#define PCA200E_RESET_BD 0x001 /* State of board reset signal */
|
||||
|
||||
/* Write access */
|
||||
#define PCA200E_CLR_HBUS_INT 0x010 /* Clear host bus interrupt */
|
||||
#define PCA200E_I960_INTRA 0x008 /* Set slave interrupt A */
|
||||
#define PCA200E_I960_INTRB 0x004 /* Set slave interrupt B */
|
||||
#define PCA200E_HOLD_LOCK 0x002 /* Set (clear) i960 hold lock signal */
|
||||
#define PCA200E_RESET 0x001 /* Set (clear) board reset signal */
|
||||
|
||||
#define PCA200E_HCR_INIT(hcr,bits) \
|
||||
((hcr) = (PCA200E_WRITE_BITS & (bits)))
|
||||
#define PCA200E_HCR_SET(hcr,bits) \
|
||||
((hcr) = (bits))
|
||||
#define PCA200E_HCR_CLR(hcr,bits) \
|
||||
((hcr) = 0)
|
||||
|
||||
#endif /* _FORE_SLAVE_H */
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
/*-
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Device statistics routines
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Get device statistics from CP
|
||||
*
|
||||
* This function will issue a GET_STATS command to the CP in order to
|
||||
* initiate the DMA transfer of the CP's statistics structure to the host.
|
||||
* We will then sleep pending command completion. This must only be called
|
||||
* from the ioctl system call handler.
|
||||
*
|
||||
* Called at splnet.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* 0 stats retrieval successful
|
||||
* errno stats retrieval failed - reason indicated
|
||||
*
|
||||
*/
|
||||
int
|
||||
fore_get_stats(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
H_cmd_queue *hcp;
|
||||
Cmd_queue *cqp;
|
||||
int s, sst;
|
||||
|
||||
ATM_DEBUG1("fore_get_stats: fup=%p\n", fup);
|
||||
|
||||
/*
|
||||
* Make sure device has been initialized
|
||||
*/
|
||||
if ((fup->fu_flags & CUF_INITED) == 0) {
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
/*
|
||||
* If someone has already initiated a stats request, we'll
|
||||
* just wait for that one to complete
|
||||
*/
|
||||
s = splimp();
|
||||
if (fup->fu_flags & FUF_STATCMD) {
|
||||
|
||||
#if (defined(BSD) && (BSD >= 199103))
|
||||
sst = tsleep((caddr_t)&fup->fu_stats, PWAIT|PCATCH, "fore", 0);
|
||||
#else
|
||||
sst = sleep((caddr_t)&fup->fu_stats, PWAIT|PCATCH);
|
||||
if (sst != 0)
|
||||
sst = EINTR;
|
||||
#endif
|
||||
(void) splx(s);
|
||||
return (sst ? sst : fup->fu_stats_ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Limit stats gathering to once a second or so
|
||||
*/
|
||||
if (time_second == fup->fu_stats_time) {
|
||||
(void) splx(s);
|
||||
return (0);
|
||||
} else
|
||||
fup->fu_stats_time = time_second;
|
||||
|
||||
/*
|
||||
* Queue command at end of command queue
|
||||
*/
|
||||
hcp = fup->fu_cmd_tail;
|
||||
if ((*hcp->hcq_status) & QSTAT_FREE) {
|
||||
vm_paddr_t dma;
|
||||
|
||||
/*
|
||||
* Queue entry available, so set our view of things up
|
||||
*/
|
||||
hcp->hcq_code = CMD_GET_STATS;
|
||||
hcp->hcq_arg = NULL;
|
||||
fup->fu_cmd_tail = hcp->hcq_next;
|
||||
|
||||
/*
|
||||
* Now set the CP-resident queue entry - the CP will grab
|
||||
* the command when the op-code is set.
|
||||
*/
|
||||
cqp = hcp->hcq_cpelem;
|
||||
(*hcp->hcq_status) = QSTAT_PENDING;
|
||||
|
||||
dma = vtophys(fup->fu_stats);
|
||||
if (dma == 0) {
|
||||
fup->fu_stats->st_drv.drv_cm_nodma++;
|
||||
(void) splx(s);
|
||||
return (EIO);
|
||||
}
|
||||
fup->fu_statsd = dma;
|
||||
cqp->cmdq_stats.stats_buffer = (CP_dma) CP_WRITE(dma);
|
||||
|
||||
fup->fu_flags |= FUF_STATCMD;
|
||||
cqp->cmdq_stats.stats_cmd =
|
||||
CP_WRITE(CMD_GET_STATS | CMD_INTR_REQ);
|
||||
|
||||
/*
|
||||
* Now wait for command to finish
|
||||
*/
|
||||
#if (defined(BSD) && (BSD >= 199103))
|
||||
sst = tsleep((caddr_t)&fup->fu_stats, PWAIT|PCATCH, "fore", 0);
|
||||
#else
|
||||
sst = sleep((caddr_t)&fup->fu_stats, PWAIT|PCATCH);
|
||||
if (sst != 0)
|
||||
sst = EINTR;
|
||||
#endif
|
||||
(void) splx(s);
|
||||
return (sst ? sst : fup->fu_stats_ret);
|
||||
|
||||
} else {
|
||||
/*
|
||||
* Command queue full
|
||||
*/
|
||||
fup->fu_stats->st_drv.drv_cm_full++;
|
||||
(void) splx(s);
|
||||
return (EIO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Driver statistics definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FORE_STATS_H
|
||||
#define _FORE_STATS_H
|
||||
|
||||
|
||||
/*
|
||||
* Fore Driver Statistics
|
||||
*/
|
||||
struct Stats_driver {
|
||||
u_long drv_xm_notact; /* PDU drops out - VCC not active */
|
||||
u_long drv_xm_full; /* Xmit queue full */
|
||||
u_long drv_xm_maxpdu; /* PDU drops out - max segment/size */
|
||||
u_long drv_xm_segnoal; /* Non-aligned segments */
|
||||
u_long drv_xm_seglen; /* Padded length segments */
|
||||
u_long drv_xm_segdma; /* PDU drops out - no dma address */
|
||||
u_long drv_rv_novcc; /* PDU drops in - no VCC */
|
||||
u_long drv_rv_nosbf; /* No small buffers */
|
||||
u_long drv_rv_nomb; /* PDU drops in - no buffer */
|
||||
u_long drv_rv_ifull; /* PDU drops in - intr queue full */
|
||||
u_long drv_bf_segdma; /* Buffer supply - no dma address */
|
||||
u_long drv_cm_full; /* Command queue full */
|
||||
u_long drv_cm_nodma; /* Command failed - no dma address */
|
||||
};
|
||||
typedef struct Stats_driver Stats_driver;
|
||||
|
||||
|
||||
/*
|
||||
* Fore Device Statistics
|
||||
*
|
||||
* This structure is used by pass all statistics (including CP maintained
|
||||
* and driver maintained) data to user space (atm command).
|
||||
*/
|
||||
struct fore_stats {
|
||||
Fore_cp_stats st_cpstat; /* CP stats */
|
||||
Stats_driver st_drv; /* Driver maintained stats */
|
||||
};
|
||||
typedef struct fore_stats Fore_stats;
|
||||
|
||||
#define st_taxi st_cpstat.st_cp_taxi
|
||||
#define st_oc3 st_cpstat.st_cp_oc3
|
||||
#define st_atm st_cpstat.st_cp_atm
|
||||
#define st_aal0 st_cpstat.st_cp_aal0
|
||||
#define st_aal4 st_cpstat.st_cp_aal4
|
||||
#define st_aal5 st_cpstat.st_cp_aal5
|
||||
#define st_misc st_cpstat.st_cp_misc
|
||||
|
||||
#endif /* _FORE_STATS_H */
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
/*-
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Timer processing
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Process a Fore timer tick
|
||||
*
|
||||
* This function is called every FORE_TIME_TICK seconds in order to update
|
||||
* all of the unit watchdog timers.
|
||||
*
|
||||
* Called at splnet.
|
||||
*
|
||||
* Arguments:
|
||||
* tip pointer to fore timer control block
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
fore_timeout(tip)
|
||||
struct atm_time *tip;
|
||||
{
|
||||
Fore_unit *fup;
|
||||
int i;
|
||||
|
||||
|
||||
/*
|
||||
* Schedule next timeout
|
||||
*/
|
||||
atm_timeout(&fore_timer, ATM_HZ * FORE_TIME_TICK, fore_timeout);
|
||||
|
||||
/*
|
||||
* Run through all units, updating each active timer.
|
||||
* If an expired timer is found, notify that unit.
|
||||
*/
|
||||
for (i = 0; i < fore_nunits; i++) {
|
||||
|
||||
if ((fup = fore_units[i]) == NULL)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Decrement timer, if it's active
|
||||
*/
|
||||
if (fup->fu_timer && (--fup->fu_timer == 0)) {
|
||||
|
||||
/*
|
||||
* Timeout occurred - go check out the queues
|
||||
*/
|
||||
ATM_DEBUG0("fore_timeout\n");
|
||||
DEVICE_LOCK((Cmn_unit *)fup);
|
||||
fore_watchdog(fup);
|
||||
DEVICE_UNLOCK((Cmn_unit *)fup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,383 +0,0 @@
|
|||
/*-
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Transmit queue management
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_vc.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Allocate Transmit Queue Data Structures
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* 0 allocations successful
|
||||
* else allocation failed
|
||||
*/
|
||||
int
|
||||
fore_xmit_allocate(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
void *memp;
|
||||
vm_paddr_t pmemp;
|
||||
H_xmit_queue *hxp;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Allocate non-cacheable memory for transmit status words
|
||||
*/
|
||||
memp = atm_dev_alloc(sizeof(Q_status) * XMIT_QUELEN,
|
||||
QSTAT_ALIGN, ATM_DEV_NONCACHE);
|
||||
if (memp == NULL) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_xmit_stat = (Q_status *) memp;
|
||||
|
||||
pmemp = vtophys(fup->fu_xmit_stat);
|
||||
if (pmemp == 0) {
|
||||
return (1);
|
||||
}
|
||||
fup->fu_xmit_statd = pmemp;
|
||||
|
||||
/*
|
||||
* Allocate memory for transmit descriptors
|
||||
*
|
||||
* We will allocate the transmit descriptors individually rather than
|
||||
* as a single memory block, which will often be larger than a memory
|
||||
* page. On some systems (eg. FreeBSD) the physical addresses of
|
||||
* adjacent virtual memory pages are not contiguous.
|
||||
*/
|
||||
hxp = fup->fu_xmit_q;
|
||||
for (i = 0; i < XMIT_QUELEN; i++, hxp++) {
|
||||
|
||||
/*
|
||||
* Allocate a transmit descriptor for this queue entry
|
||||
*/
|
||||
hxp->hxq_descr = atm_dev_alloc(sizeof(Xmit_descr),
|
||||
XMIT_DESCR_ALIGN, 0);
|
||||
if (hxp->hxq_descr == NULL) {
|
||||
return (1);
|
||||
}
|
||||
|
||||
hxp->hxq_descr_dma = vtophys(hxp->hxq_descr);
|
||||
if (hxp->hxq_descr_dma == 0) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Transmit Queue Initialization
|
||||
*
|
||||
* Allocate and initialize the host-resident transmit queue structures
|
||||
* and then initialize the CP-resident queue structures.
|
||||
*
|
||||
* Called at interrupt level.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_xmit_initialize(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
Aali *aap = fup->fu_aali;
|
||||
Xmit_queue *cqp;
|
||||
H_xmit_queue *hxp;
|
||||
Q_status *qsp;
|
||||
vm_paddr_t qsp_dma;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Point to CP-resident transmit queue
|
||||
*/
|
||||
cqp = (Xmit_queue *)(fup->fu_ram + CP_READ(aap->aali_xmit_q));
|
||||
|
||||
/*
|
||||
* Point to host-resident transmit queue structures
|
||||
*/
|
||||
hxp = fup->fu_xmit_q;
|
||||
qsp = fup->fu_xmit_stat;
|
||||
qsp_dma = fup->fu_xmit_statd;
|
||||
|
||||
/*
|
||||
* Loop thru all queue entries and do whatever needs doing
|
||||
*/
|
||||
for (i = 0; i < XMIT_QUELEN; i++) {
|
||||
|
||||
/*
|
||||
* Set queue status word to free
|
||||
*/
|
||||
*qsp = QSTAT_FREE;
|
||||
|
||||
/*
|
||||
* Set up host queue entry and link into ring
|
||||
*/
|
||||
hxp->hxq_cpelem = cqp;
|
||||
hxp->hxq_status = qsp;
|
||||
if (i == (XMIT_QUELEN - 1))
|
||||
hxp->hxq_next = fup->fu_xmit_q;
|
||||
else
|
||||
hxp->hxq_next = hxp + 1;
|
||||
|
||||
/*
|
||||
* Now let the CP into the game
|
||||
*/
|
||||
cqp->cq_status = (CP_dma) CP_WRITE(qsp_dma);
|
||||
|
||||
/*
|
||||
* Bump all queue pointers
|
||||
*/
|
||||
hxp++;
|
||||
qsp++;
|
||||
qsp_dma += sizeof(Q_status);
|
||||
cqp++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize queue pointers
|
||||
*/
|
||||
fup->fu_xmit_head = fup->fu_xmit_tail = fup->fu_xmit_q;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Drain Transmit Queue
|
||||
*
|
||||
* This function will free all completed entries at the head of the
|
||||
* transmit queue. Freeing the entry includes releasing the transmit
|
||||
* buffers (buffer chain) back to the kernel.
|
||||
*
|
||||
* May be called in interrupt state.
|
||||
* Must be called with interrupts locked out.
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_xmit_drain(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
H_xmit_queue *hxp;
|
||||
H_dma *sdmap;
|
||||
Fore_vcc *fvp;
|
||||
struct vccb *vcp;
|
||||
KBuffer *m;
|
||||
|
||||
/*
|
||||
* Process each completed entry
|
||||
*/
|
||||
while (*fup->fu_xmit_head->hxq_status & QSTAT_COMPLETED) {
|
||||
|
||||
hxp = fup->fu_xmit_head;
|
||||
|
||||
/*
|
||||
* Release the entry's DMA addresses and buffer chain
|
||||
*/
|
||||
for (m = hxp->hxq_buf, sdmap = hxp->hxq_dma; m;
|
||||
m = KB_NEXT(m), sdmap++) {
|
||||
caddr_t cp;
|
||||
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
}
|
||||
KB_FREEALL(hxp->hxq_buf);
|
||||
|
||||
/*
|
||||
* Get VCC over which data was sent (may be null if
|
||||
* VCC has been closed in the meantime)
|
||||
*/
|
||||
fvp = hxp->hxq_vcc;
|
||||
|
||||
/*
|
||||
* Now collect some statistics
|
||||
*/
|
||||
if (*hxp->hxq_status & QSTAT_ERROR) {
|
||||
/*
|
||||
* CP ran into problems, not much we can do
|
||||
* other than record the event
|
||||
*/
|
||||
fup->fu_pif.pif_oerrors++;
|
||||
if (fvp) {
|
||||
vcp = fvp->fv_connvc->cvc_vcc;
|
||||
vcp->vc_oerrors++;
|
||||
if (vcp->vc_nif)
|
||||
ANIF2IFP(vcp->vc_nif)->if_oerrors++;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Good transmission
|
||||
*/
|
||||
int len = XDS_GET_LEN(hxp->hxq_descr->xd_spec);
|
||||
|
||||
fup->fu_pif.pif_opdus++;
|
||||
fup->fu_pif.pif_obytes += len;
|
||||
if (fvp) {
|
||||
vcp = fvp->fv_connvc->cvc_vcc;
|
||||
vcp->vc_opdus++;
|
||||
vcp->vc_obytes += len;
|
||||
if (vcp->vc_nif) {
|
||||
vcp->vc_nif->nif_obytes += len;
|
||||
ANIF2IFP(vcp->vc_nif)->if_opackets++;
|
||||
#if (defined(BSD) && (BSD >= 199103))
|
||||
ANIF2IFP(vcp->vc_nif)->if_obytes += len;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark this entry free for use and bump head pointer
|
||||
* to the next entry in the queue
|
||||
*/
|
||||
*hxp->hxq_status = QSTAT_FREE;
|
||||
fup->fu_xmit_head = hxp->hxq_next;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free Transmit Queue Data Structures
|
||||
*
|
||||
* Arguments:
|
||||
* fup pointer to device unit structure
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
fore_xmit_free(fup)
|
||||
Fore_unit *fup;
|
||||
{
|
||||
H_xmit_queue *hxp;
|
||||
H_dma *sdmap;
|
||||
KBuffer *m;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Free any transmit buffers left on the queue
|
||||
*/
|
||||
if (fup->fu_flags & CUF_INITED) {
|
||||
while (*fup->fu_xmit_head->hxq_status != QSTAT_FREE) {
|
||||
|
||||
hxp = fup->fu_xmit_head;
|
||||
|
||||
/*
|
||||
* Release the entry's DMA addresses and buffer chain
|
||||
*/
|
||||
for (m = hxp->hxq_buf, sdmap = hxp->hxq_dma; m;
|
||||
m = KB_NEXT(m), sdmap++) {
|
||||
caddr_t cp;
|
||||
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
}
|
||||
KB_FREEALL(hxp->hxq_buf);
|
||||
|
||||
*hxp->hxq_status = QSTAT_FREE;
|
||||
fup->fu_xmit_head = hxp->hxq_next;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the status words
|
||||
*/
|
||||
if (fup->fu_xmit_stat) {
|
||||
atm_dev_free((volatile void *)fup->fu_xmit_stat);
|
||||
fup->fu_xmit_stat = NULL;
|
||||
fup->fu_xmit_statd = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the transmit descriptors
|
||||
*/
|
||||
hxp = fup->fu_xmit_q;
|
||||
for (i = 0; i < XMIT_QUELEN; i++, hxp++) {
|
||||
|
||||
/*
|
||||
* Free the transmit descriptor for this queue entry
|
||||
*/
|
||||
if (hxp->hxq_descr_dma) {
|
||||
hxp->hxq_descr_dma = 0;
|
||||
}
|
||||
|
||||
if (hxp->hxq_descr) {
|
||||
atm_dev_free(hxp->hxq_descr);
|
||||
hxp->hxq_descr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1,274 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Host protocol control blocks
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FORE_VAR_H
|
||||
#define _FORE_VAR_H
|
||||
|
||||
/*
|
||||
* Device VCC Entry
|
||||
*
|
||||
* Contains the common and Fore-specific information for each VCC
|
||||
* which is opened through a Fore device.
|
||||
*/
|
||||
struct fore_vcc {
|
||||
struct cmn_vcc fv_cmn; /* Common VCC stuff */
|
||||
Fore_aal fv_aal; /* CP version of AAL */
|
||||
uint32_t rate; /* Rate control (data/idle cell ratio) */
|
||||
};
|
||||
typedef struct fore_vcc Fore_vcc;
|
||||
|
||||
#define fv_next fv_cmn.cv_next
|
||||
#define fv_toku fv_cmn.cv_toku
|
||||
#define fv_upper fv_cmn.cv_upper
|
||||
#define fv_connvc fv_cmn.cv_connvc
|
||||
#define fv_state fv_cmn.cv_state
|
||||
#define fv_flags fv_cmn.cv_flags
|
||||
|
||||
/*
|
||||
* VCC Flags
|
||||
*/
|
||||
#define FVF_ACTCMD 0x01 /* Activate command issued */
|
||||
|
||||
|
||||
/*
|
||||
* Host Transmit Queue Element
|
||||
*
|
||||
* Defines the host's view of the CP PDU Transmit Queue
|
||||
*/
|
||||
struct h_xmit_queue {
|
||||
struct h_xmit_queue *hxq_next; /* Next element in queue */
|
||||
Xmit_queue *hxq_cpelem; /* CP queue element */
|
||||
Q_status *hxq_status; /* Element status word */
|
||||
Xmit_descr *hxq_descr; /* Element's transmit descriptor */
|
||||
vm_paddr_t hxq_descr_dma; /* Element's transmit descriptor */
|
||||
Fore_vcc *hxq_vcc; /* Data's VCC */
|
||||
KBuffer *hxq_buf; /* Data's buffer chain head */
|
||||
H_dma hxq_dma[XMIT_MAX_SEGS]; /* DMA addresses for segments */
|
||||
};
|
||||
typedef struct h_xmit_queue H_xmit_queue;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Host Receive Queue Element
|
||||
*
|
||||
* Defines the host's view of the CP PDU Receive Queue
|
||||
*/
|
||||
struct h_recv_queue {
|
||||
struct h_recv_queue *hrq_next; /* Next element in queue */
|
||||
Recv_queue *hrq_cpelem; /* CP queue element */
|
||||
Q_status *hrq_status; /* Element status word */
|
||||
Recv_descr *hrq_descr; /* Element's receive descriptor */
|
||||
vm_paddr_t hrq_descr_dma; /* Element's receive descriptor */
|
||||
};
|
||||
typedef struct h_recv_queue H_recv_queue;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Host Buffer Supply Queue Element
|
||||
*
|
||||
* Defines the host's view of the CP Buffer Supply Queue
|
||||
*/
|
||||
struct h_buf_queue {
|
||||
struct h_buf_queue *hbq_next; /* Next element in queue */
|
||||
Buf_queue *hbq_cpelem; /* CP queue element */
|
||||
Q_status *hbq_status; /* Element status word */
|
||||
Buf_descr *hbq_descr; /* Element's buffer descriptor array */
|
||||
vm_paddr_t hbq_descr_dma; /* Element's buffer descriptor array */
|
||||
};
|
||||
typedef struct h_buf_queue H_buf_queue;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Host Command Queue Element
|
||||
*
|
||||
* Defines the host's view of the CP Command Queue
|
||||
*/
|
||||
struct h_cmd_queue {
|
||||
struct h_cmd_queue *hcq_next; /* Next element in queue */
|
||||
Cmd_queue *hcq_cpelem; /* CP queue element */
|
||||
Q_status *hcq_status; /* Element status word */
|
||||
Cmd_code hcq_code; /* Command code */
|
||||
void *hcq_arg; /* Command-specific argument */
|
||||
};
|
||||
typedef struct h_cmd_queue H_cmd_queue;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Host Buffer Handle
|
||||
*
|
||||
* For each buffer supplied to the CP, there will be one of these structures
|
||||
* embedded into the non-data portion of the buffer. This will allow us to
|
||||
* track which buffers are currently "controlled" by the CP. The address of
|
||||
* this structure will supplied to/returned from the CP as the buffer handle.
|
||||
*/
|
||||
struct buf_handle {
|
||||
Qelem_t bh_qelem; /* Queuing element */
|
||||
u_int bh_type; /* Buffer type (see below) */
|
||||
H_dma bh_dma; /* Buffer DMA address */
|
||||
};
|
||||
typedef struct buf_handle Buf_handle;
|
||||
#define SIZEOF_Buf_handle 16
|
||||
|
||||
/*
|
||||
* Buffer Types
|
||||
*/
|
||||
#define BHT_S1_SMALL 1 /* Buffer strategy 1, small */
|
||||
#define BHT_S1_LARGE 2 /* Buffer strategy 1, large */
|
||||
#define BHT_S2_SMALL 3 /* Buffer strategy 2, small */
|
||||
#define BHT_S2_LARGE 4 /* Buffer strategy 2, large */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Device Unit Structure
|
||||
*
|
||||
* Contains all the information for a single device (adapter).
|
||||
*/
|
||||
struct fore_unit {
|
||||
Cmn_unit fu_cmn; /* Common unit stuff */
|
||||
Fore_reg *fu_ctlreg; /* Device control register */
|
||||
Fore_reg *fu_imask; /* Interrupt mask register */
|
||||
Fore_reg *fu_psr; /* PCI specific register */
|
||||
#ifdef COMPAT_OLDPCI
|
||||
pcici_t fu_pcitag; /* PCI tag */
|
||||
#endif
|
||||
Fore_mem *fu_ram; /* Device RAM */
|
||||
u_int fu_ramsize; /* Size of device RAM */
|
||||
Mon960 *fu_mon; /* Monitor program interface */
|
||||
Aali *fu_aali; /* Microcode program interface */
|
||||
u_int fu_timer; /* Watchdog timer value */
|
||||
|
||||
/* Transmit Queue */
|
||||
H_xmit_queue fu_xmit_q[XMIT_QUELEN]; /* Host queue */
|
||||
H_xmit_queue *fu_xmit_head; /* Queue head */
|
||||
H_xmit_queue *fu_xmit_tail; /* Queue tail */
|
||||
Q_status *fu_xmit_stat; /* Status array (host) */
|
||||
vm_paddr_t fu_xmit_statd; /* Status array (DMA) */
|
||||
|
||||
/* Receive Queue */
|
||||
H_recv_queue fu_recv_q[RECV_QUELEN]; /* Host queue */
|
||||
H_recv_queue *fu_recv_head; /* Queue head */
|
||||
Q_status *fu_recv_stat; /* Status array (host) */
|
||||
vm_paddr_t fu_recv_statd; /* Status array (DMA) */
|
||||
Recv_descr *fu_recv_desc; /* Descriptor array (host) */
|
||||
vm_paddr_t fu_recv_descd; /* Descriptor array (DMA) */
|
||||
|
||||
/* Buffer Supply Queue - Strategy 1 Small */
|
||||
H_buf_queue fu_buf1s_q[BUF1_SM_QUELEN]; /* Host queue */
|
||||
H_buf_queue *fu_buf1s_head; /* Queue head */
|
||||
H_buf_queue *fu_buf1s_tail; /* Queue tail */
|
||||
Q_status *fu_buf1s_stat; /* Status array (host) */
|
||||
vm_paddr_t fu_buf1s_statd;/* Status array (DMA) */
|
||||
Buf_descr *fu_buf1s_desc; /* Descriptor array (host) */
|
||||
vm_paddr_t fu_buf1s_descd;/* Descriptor array (DMA) */
|
||||
Queue_t fu_buf1s_bq; /* Queue of supplied buffers */
|
||||
u_int fu_buf1s_cnt; /* Count of supplied buffers */
|
||||
|
||||
/* Buffer Supply Queue - Strategy 1 Large */
|
||||
H_buf_queue fu_buf1l_q[BUF1_LG_QUELEN]; /* Host queue */
|
||||
H_buf_queue *fu_buf1l_head; /* Queue head */
|
||||
H_buf_queue *fu_buf1l_tail; /* Queue tail */
|
||||
Q_status *fu_buf1l_stat; /* Status array (host) */
|
||||
vm_paddr_t fu_buf1l_statd;/* Status array (DMA) */
|
||||
Buf_descr *fu_buf1l_desc; /* Descriptor array (host) */
|
||||
vm_paddr_t fu_buf1l_descd;/* Descriptor array (DMA) */
|
||||
Queue_t fu_buf1l_bq; /* Queue of supplied buffers */
|
||||
u_int fu_buf1l_cnt; /* Count of supplied buffers */
|
||||
|
||||
/* Command Queue */
|
||||
H_cmd_queue fu_cmd_q[CMD_QUELEN]; /* Host queue */
|
||||
H_cmd_queue *fu_cmd_head; /* Queue head */
|
||||
H_cmd_queue *fu_cmd_tail; /* Queue tail */
|
||||
Q_status *fu_cmd_stat; /* Status array (host) */
|
||||
vm_paddr_t fu_cmd_statd; /* Status array (DMA) */
|
||||
|
||||
Fore_stats *fu_stats; /* Device statistics buffer */
|
||||
vm_paddr_t fu_statsd; /* Device statistics buffer (DMA) */
|
||||
time_t fu_stats_time; /* Last stats request timestamp */
|
||||
int fu_stats_ret; /* Stats request return code */
|
||||
Fore_prom *fu_prom; /* Device PROM buffer */
|
||||
vm_paddr_t fu_promd; /* Device PROM buffer (DMA) */
|
||||
struct callout_handle fu_thandle; /* Timer handle */
|
||||
int fu_ft4; /* Running ForeThought 4 firmware */
|
||||
|
||||
/* shaping enable */
|
||||
u_int fu_shape;
|
||||
u_int fu_num_shaped; /* number of shaped VCCs */
|
||||
};
|
||||
typedef struct fore_unit Fore_unit;
|
||||
|
||||
#define fu_pif fu_cmn.cu_pif
|
||||
#define fu_unit fu_cmn.cu_unit
|
||||
#define fu_flags fu_cmn.cu_flags
|
||||
#define fu_mtu fu_cmn.cu_mtu
|
||||
#define fu_open_vcc fu_cmn.cu_open_vcc
|
||||
#define fu_vcc fu_cmn.cu_vcc
|
||||
#define fu_intrpri fu_cmn.cu_intrpri
|
||||
#define fu_savepri fu_cmn.cu_savepri
|
||||
#define fu_vcc_zone fu_cmn.cu_vcc_zone
|
||||
#define fu_nif_zone fu_cmn.cu_nif_zone
|
||||
#define fu_ioctl fu_cmn.cu_ioctl
|
||||
#define fu_instvcc fu_cmn.cu_instvcc
|
||||
#define fu_openvcc fu_cmn.cu_openvcc
|
||||
#define fu_closevcc fu_cmn.cu_closevcc
|
||||
#define fu_output fu_cmn.cu_output
|
||||
#define fu_config fu_cmn.cu_config
|
||||
#define fu_softc fu_cmn.cu_softc
|
||||
|
||||
/*
|
||||
* Device flags (in addition to CUF_* flags)
|
||||
*/
|
||||
#define FUF_STATCMD 0x80 /* Statistics request in progress */
|
||||
|
||||
/*
|
||||
* Shaping values
|
||||
*/
|
||||
#define FUS_NO_SHAPING 0
|
||||
#define FUS_SHAPE_ONE 1
|
||||
#define FUS_SHAPE_ALL 2
|
||||
|
||||
/*
|
||||
* Macros to access CP memory
|
||||
*/
|
||||
#define CP_READ(x) ntohl((u_long)(x))
|
||||
#define CP_WRITE(x) htonl((u_long)(x))
|
||||
|
||||
#endif /* _FORE_VAR_H */
|
||||
|
|
@ -1,531 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FORE Systems 200-Series Adapter Support
|
||||
* ---------------------------------------
|
||||
*
|
||||
* Virtual Channel Management
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_vc.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("@(#) $FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* VCC Stack Instantiation
|
||||
*
|
||||
* This function is called via the common driver code during a device VCC
|
||||
* stack instantiation. The common code has already validated some of
|
||||
* the request so we just need to check a few more Fore-specific details.
|
||||
*
|
||||
* Called at splnet.
|
||||
*
|
||||
* Arguments:
|
||||
* cup pointer to device common unit
|
||||
* cvp pointer to common VCC entry
|
||||
*
|
||||
* Returns:
|
||||
* 0 instantiation successful
|
||||
* err instantiation failed - reason indicated
|
||||
*
|
||||
*/
|
||||
int
|
||||
fore_instvcc(cup, cvp)
|
||||
Cmn_unit *cup;
|
||||
Cmn_vcc *cvp;
|
||||
{
|
||||
Fore_vcc *fvp = (Fore_vcc *)cvp;
|
||||
Atm_attributes *ap = &fvp->fv_connvc->cvc_attr;
|
||||
|
||||
/*
|
||||
* Validate requested AAL
|
||||
*/
|
||||
switch (ap->aal.type) {
|
||||
|
||||
case ATM_AAL0:
|
||||
fvp->fv_aal = FORE_AAL_0;
|
||||
break;
|
||||
|
||||
case ATM_AAL3_4:
|
||||
fvp->fv_aal = FORE_AAL_4;
|
||||
if ((ap->aal.v.aal4.forward_max_SDU_size > FORE_IFF_MTU) ||
|
||||
(ap->aal.v.aal4.backward_max_SDU_size > FORE_IFF_MTU))
|
||||
return (EINVAL);
|
||||
break;
|
||||
|
||||
case ATM_AAL5:
|
||||
fvp->fv_aal = FORE_AAL_5;
|
||||
if ((ap->aal.v.aal5.forward_max_SDU_size > FORE_IFF_MTU) ||
|
||||
(ap->aal.v.aal5.backward_max_SDU_size > FORE_IFF_MTU))
|
||||
return (EINVAL);
|
||||
break;
|
||||
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static const u_int rate_tab[255] = {
|
||||
353207, /* 0 */
|
||||
312501, /* 1 */ 312501, /* 2 */
|
||||
312501, /* 3 */ 312501, /* 4 */
|
||||
312501, /* 5 */ 312501, /* 6 */
|
||||
312501, /* 7 */ 312501, /* 8 */
|
||||
312501, /* 9 */ 312501, /* 10 */
|
||||
312501, /* 11 */ 312501, /* 12 */
|
||||
312501, /* 13 */ 312501, /* 14 */
|
||||
312501, /* 15 */ 312501, /* 16 */
|
||||
312501, /* 17 */ 284091, /* 18 */
|
||||
284091, /* 19 */ 284091, /* 20 */
|
||||
284091, /* 21 */ 284091, /* 22 */
|
||||
284091, /* 23 */ 284091, /* 24 */
|
||||
284091, /* 25 */ 284091, /* 26 */
|
||||
284091, /* 27 */ 284091, /* 28 */
|
||||
284091, /* 29 */ 284091, /* 30 */
|
||||
284091, /* 31 */ 284091, /* 32 */
|
||||
284091, /* 33 */ 284091, /* 34 */
|
||||
284091, /* 35 */ 284091, /* 36 */
|
||||
284091, /* 37 */ 284091, /* 38 */
|
||||
260417, /* 39 */ 260417, /* 40 */
|
||||
260417, /* 41 */ 260417, /* 42 */
|
||||
260417, /* 43 */ 260417, /* 44 */
|
||||
260417, /* 45 */ 260417, /* 46 */
|
||||
260417, /* 47 */ 260417, /* 48 */
|
||||
260417, /* 49 */ 260417, /* 50 */
|
||||
260417, /* 51 */ 260417, /* 52 */
|
||||
260417, /* 53 */ 260417, /* 54 */
|
||||
260417, /* 55 */ 240385, /* 56 */
|
||||
240385, /* 57 */ 240385, /* 58 */
|
||||
240385, /* 59 */ 240385, /* 60 */
|
||||
240385, /* 61 */ 240385, /* 62 */
|
||||
240385, /* 63 */ 240385, /* 64 */
|
||||
240385, /* 65 */ 240385, /* 66 */
|
||||
240385, /* 67 */ 240385, /* 68 */
|
||||
240385, /* 69 */ 240385, /* 70 */
|
||||
223215, /* 71 */ 223215, /* 72 */
|
||||
223215, /* 73 */ 223215, /* 74 */
|
||||
223215, /* 75 */ 223215, /* 76 */
|
||||
223215, /* 77 */ 223215, /* 78 */
|
||||
223215, /* 79 */ 223215, /* 80 */
|
||||
223215, /* 81 */ 223215, /* 82 */
|
||||
223215, /* 83 */ 208334, /* 84 */
|
||||
208334, /* 85 */ 208334, /* 86 */
|
||||
208334, /* 87 */ 208334, /* 88 */
|
||||
208334, /* 89 */ 208334, /* 90 */
|
||||
208334, /* 91 */ 208334, /* 92 */
|
||||
208334, /* 93 */ 208334, /* 94 */
|
||||
195313, /* 95 */ 195313, /* 96 */
|
||||
195313, /* 97 */ 195313, /* 98 */
|
||||
195313, /* 101 */ 195313, /* 102 */
|
||||
195313, /* 103 */ 183824, /* 104 */
|
||||
183824, /* 105 */ 183824, /* 106 */
|
||||
183824, /* 107 */ 183824, /* 108 */
|
||||
183824, /* 109 */ 183824, /* 110 */
|
||||
183824, /* 111 */ 183824, /* 112 */
|
||||
173612, /* 113 */ 173612, /* 114 */
|
||||
173612, /* 115 */ 173612, /* 116 */
|
||||
173612, /* 117 */ 173612, /* 118 */
|
||||
173612, /* 119 */ 173612, /* 120 */
|
||||
164474, /* 121 */ 164474, /* 122 */
|
||||
164474, /* 123 */ 164474, /* 124 */
|
||||
164474, /* 125 */ 164474, /* 126 */
|
||||
164474, /* 127 */ 156250, /* 128 */
|
||||
156250, /* 129 */ 156250, /* 130 */
|
||||
156250, /* 131 */ 156250, /* 132 */
|
||||
156250, /* 133 */ 148810, /* 134 */
|
||||
148810, /* 135 */ 148810, /* 136 */
|
||||
148810, /* 137 */ 148810, /* 138 */
|
||||
148810, /* 139 */ 142046, /* 140 */
|
||||
142046, /* 141 */ 142046, /* 142 */
|
||||
142046, /* 143 */ 142046, /* 144 */
|
||||
135870, /* 145 */ 135870, /* 146 */
|
||||
135870, /* 147 */ 135870, /* 148 */
|
||||
130209, /* 149 */ 130209, /* 150 */
|
||||
130209, /* 151 */ 130209, /* 152 */
|
||||
130209, /* 153 */ 125000, /* 154 */
|
||||
125000, /* 155 */ 125000, /* 156 */
|
||||
125000, /* 157 */ 120193, /* 158 */
|
||||
120193, /* 159 */ 120193, /* 160 */
|
||||
115741, /* 161 */ 115741, /* 162 */
|
||||
115741, /* 163 */ 115741, /* 164 */
|
||||
111608, /* 165 */ 111608, /* 166 */
|
||||
111608, /* 167 */ 107759, /* 168 */
|
||||
107759, /* 169 */ 107759, /* 170 */
|
||||
104167, /* 171 */ 104167, /* 172 */
|
||||
104167, /* 173 */ 100807, /* 174 */
|
||||
100807, /* 175 */ 97657, /* 176 */
|
||||
97657, /* 177 */ 97657, /* 178 */
|
||||
94697, /* 179 */ 94697, /* 180 */
|
||||
91912, /* 181 */ 91912, /* 182 */
|
||||
89286, /* 183 */ 89286, /* 184 */
|
||||
86806, /* 185 */ 86806, /* 186 */
|
||||
84460, /* 187 */ 84460, /* 188 */
|
||||
82237, /* 189 */ 82237, /* 190 */
|
||||
80129, /* 191 */ 78125, /* 192 */
|
||||
78126, /* 193 */ 76220, /* 194 */
|
||||
74405, /* 195 */ 74405, /* 196 */
|
||||
72675, /* 197 */ 71023, /* 198 */
|
||||
69445, /* 199 */ 69445, /* 200 */
|
||||
67935, /* 201 */ 66490, /* 202 */
|
||||
65105, /* 203 */ 63776, /* 204 */
|
||||
62500, /* 205 */ 61275, /* 206 */
|
||||
60097, /* 207 */ 58963, /* 208 */
|
||||
57871, /* 209 */ 56819, /* 210 */
|
||||
54825, /* 211 */ 53880, /* 212 */
|
||||
52967, /* 213 */ 51230, /* 214 */
|
||||
50404, /* 215 */ 48829, /* 216 */
|
||||
47349, /* 217 */ 46642, /* 218 */
|
||||
45290, /* 219 */ 44015, /* 220 */
|
||||
42809, /* 221 */ 41119, /* 222 */
|
||||
40065, /* 223 */ 39063, /* 224 */
|
||||
37651, /* 225 */ 36338, /* 226 */
|
||||
35113, /* 227 */ 33968, /* 228 */
|
||||
32553, /* 229 */ 31250, /* 230 */
|
||||
30049, /* 231 */ 28936, /* 232 */
|
||||
27655, /* 233 */ 26261, /* 234 */
|
||||
25000, /* 235 */ 23855, /* 236 */
|
||||
22645, /* 237 */ 21259, /* 238 */
|
||||
20033, /* 239 */ 18826, /* 240 */
|
||||
17557, /* 241 */ 16277, /* 242 */
|
||||
15025, /* 243 */ 13767, /* 244 */
|
||||
12551, /* 245 */ 11282, /* 246 */
|
||||
10017, /* 247 */ 8779, /* 248 */
|
||||
7531, /* 249 */ 6263, /* 250 */
|
||||
5017, /* 251 */ 3761, /* 252 */
|
||||
2509, /* 253 */ 1254, /* 254 */
|
||||
};
|
||||
|
||||
/*
|
||||
* Find the best match of the high part of the Rate Control Information
|
||||
*
|
||||
* This function is called when a VC is opened in order to help
|
||||
* in converting Fore's rate to PCR.
|
||||
* The Fore's Rate Control Information is encoded as 32-bit field
|
||||
* comprised of two 16-bit subfields.
|
||||
*
|
||||
* Arguments:
|
||||
* *pcr Peak Cell Rate, will be updated with actual value
|
||||
*
|
||||
* Returns:
|
||||
* descr the rate descriptor
|
||||
*
|
||||
*/
|
||||
static uint32_t
|
||||
pcr2rate(int32_t *pcr)
|
||||
{
|
||||
u_int i;
|
||||
|
||||
if (*pcr >= rate_tab[0]) {
|
||||
/* special case link rate */
|
||||
*pcr = rate_tab[0];
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(rate_tab) / sizeof(rate_tab[0]); i++)
|
||||
if (*pcr >= rate_tab[i])
|
||||
break;
|
||||
if (i == sizeof(rate_tab) / sizeof(rate_tab[0])) {
|
||||
/* smaller than smallest */
|
||||
i--;
|
||||
}
|
||||
/* update with the actual value */
|
||||
*pcr = rate_tab[i];
|
||||
return ((255 - i) << 16) | i;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a VCC
|
||||
*
|
||||
* This function is called via the common driver code after receiving a
|
||||
* stack *_INIT command. The common code has already validated most of
|
||||
* the request so we just need to check a few more Fore-specific details.
|
||||
* Then we just issue the command to the CP. Note that we can't wait around
|
||||
* for the CP to process the command, so we return success for now and abort
|
||||
* the connection if the command later fails.
|
||||
*
|
||||
* Called at splimp.
|
||||
*
|
||||
* Arguments:
|
||||
* cup pointer to device common unit
|
||||
* cvp pointer to common VCC entry
|
||||
*
|
||||
* Returns:
|
||||
* 0 open successful
|
||||
* else open failed
|
||||
*
|
||||
*/
|
||||
int
|
||||
fore_openvcc(cup, cvp)
|
||||
Cmn_unit *cup;
|
||||
Cmn_vcc *cvp;
|
||||
{
|
||||
Fore_unit *fup = (Fore_unit *)cup;
|
||||
Fore_vcc *fvp = (Fore_vcc *)cvp;
|
||||
H_cmd_queue *hcp;
|
||||
Cmd_queue *cqp;
|
||||
struct vccb *vcp;
|
||||
|
||||
vcp = fvp->fv_connvc->cvc_vcc;
|
||||
|
||||
ATM_DEBUG4("fore_openvcc: fup=%p, fvp=%p, vcc=(%d,%d)\n",
|
||||
fup, fvp, vcp->vc_vpi, vcp->vc_vci);
|
||||
|
||||
/*
|
||||
* Validate the VPI and VCI values
|
||||
*/
|
||||
if ((vcp->vc_vpi > fup->fu_pif.pif_maxvpi) ||
|
||||
(vcp->vc_vci > fup->fu_pif.pif_maxvci)) {
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the PCR (but only for outgoing VCCs)
|
||||
*/
|
||||
fvp->rate = FORE_DEF_RATE;
|
||||
if ((vcp->vc_type & VCC_OUT) && cvp->cv_connvc) {
|
||||
Atm_attributes *attr = &cvp->cv_connvc->cvc_attr;
|
||||
|
||||
if (attr && attr->traffic.v.forward.PCR_all_traffic > 0 &&
|
||||
attr->traffic.v.forward.PCR_all_traffic < rate_tab[0] &&
|
||||
(fup->fu_shape == FUS_SHAPE_ALL ||
|
||||
(fup->fu_shape == FUS_SHAPE_ONE &&
|
||||
fup->fu_num_shaped == 0))) {
|
||||
fvp->rate = pcr2rate(&attr->traffic.v.forward.
|
||||
PCR_all_traffic);
|
||||
fup->fu_num_shaped++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Only need to tell the CP about incoming VCCs
|
||||
*/
|
||||
if ((vcp->vc_type & VCC_IN) == 0) {
|
||||
DEVICE_LOCK((Cmn_unit *)fup);
|
||||
fup->fu_open_vcc++;
|
||||
fvp->fv_state = CVS_ACTIVE;
|
||||
DEVICE_UNLOCK((Cmn_unit *)fup);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Queue command at end of command queue
|
||||
*/
|
||||
hcp = fup->fu_cmd_tail;
|
||||
if ((*hcp->hcq_status) & QSTAT_FREE) {
|
||||
|
||||
/*
|
||||
* Queue entry available, so set our view of things up
|
||||
*/
|
||||
hcp->hcq_code = CMD_ACT_VCCIN;
|
||||
hcp->hcq_arg = fvp;
|
||||
fup->fu_cmd_tail = hcp->hcq_next;
|
||||
fvp->fv_flags |= FVF_ACTCMD;
|
||||
|
||||
/*
|
||||
* Now set the CP-resident queue entry - the CP will grab
|
||||
* the command when the op-code is set.
|
||||
*/
|
||||
cqp = hcp->hcq_cpelem;
|
||||
(*hcp->hcq_status) = QSTAT_PENDING;
|
||||
cqp->cmdq_act.act_vccid = CP_WRITE(vcp->vc_vci);
|
||||
if (fvp->fv_aal == FORE_AAL_0)
|
||||
cqp->cmdq_act.act_batch = CP_WRITE(1);
|
||||
cqp->cmdq_act.act_spec = CP_WRITE(
|
||||
ACT_SET_SPEC(BUF_STRAT_1, fvp->fv_aal,
|
||||
CMD_ACT_VCCIN | CMD_INTR_REQ));
|
||||
} else {
|
||||
/*
|
||||
* Command queue full
|
||||
*/
|
||||
fup->fu_stats->st_drv.drv_cm_full++;
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Close a VCC
|
||||
*
|
||||
* This function is called via the common driver code after receiving a
|
||||
* stack *_TERM command. The common code has already validated most of
|
||||
* the request so we just need to check a few more Fore-specific details.
|
||||
* Then we just issue the command to the CP. Note that we can't wait around
|
||||
* for the CP to process the command, so we return success for now and whine
|
||||
* if the command later fails.
|
||||
*
|
||||
* Called at splimp.
|
||||
*
|
||||
* Arguments:
|
||||
* cup pointer to device common unit
|
||||
* cvp pointer to common VCC entry
|
||||
*
|
||||
* Returns:
|
||||
* 0 close successful
|
||||
* else close failed
|
||||
*
|
||||
*/
|
||||
int
|
||||
fore_closevcc(cup, cvp)
|
||||
Cmn_unit *cup;
|
||||
Cmn_vcc *cvp;
|
||||
{
|
||||
Fore_unit *fup = (Fore_unit *)cup;
|
||||
Fore_vcc *fvp = (Fore_vcc *)cvp;
|
||||
H_xmit_queue *hxp;
|
||||
H_cmd_queue *hcp;
|
||||
Cmd_queue *cqp;
|
||||
struct vccb *vcp;
|
||||
int i, err = 0;
|
||||
|
||||
vcp = fvp->fv_connvc->cvc_vcc;
|
||||
|
||||
ATM_DEBUG4("fore_closevcc: fup=%p, fvp=%p, vcc=(%d,%d)\n",
|
||||
fup, fvp, vcp->vc_vpi, vcp->vc_vci);
|
||||
|
||||
DEVICE_LOCK((Cmn_unit *)fup);
|
||||
|
||||
/*
|
||||
* Clear any references to this VCC in our transmit queue
|
||||
*/
|
||||
for (hxp = fup->fu_xmit_head, i = 0;
|
||||
(*hxp->hxq_status != QSTAT_FREE) && (i < XMIT_QUELEN);
|
||||
hxp = hxp->hxq_next, i++) {
|
||||
if (hxp->hxq_vcc == fvp) {
|
||||
hxp->hxq_vcc = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear any references to this VCC in our command queue
|
||||
*/
|
||||
for (hcp = fup->fu_cmd_head, i = 0;
|
||||
(*hcp->hcq_status != QSTAT_FREE) && (i < CMD_QUELEN);
|
||||
hcp = hcp->hcq_next, i++) {
|
||||
switch (hcp->hcq_code) {
|
||||
|
||||
case CMD_ACT_VCCIN:
|
||||
case CMD_ACT_VCCOUT:
|
||||
if (hcp->hcq_arg == fvp) {
|
||||
hcp->hcq_arg = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If this VCC has been previously activated, then we need to tell
|
||||
* the CP to deactivate it.
|
||||
*/
|
||||
if (fvp->fv_flags & FVF_ACTCMD) {
|
||||
|
||||
/*
|
||||
* Queue command at end of command queue
|
||||
*/
|
||||
hcp = fup->fu_cmd_tail;
|
||||
if ((*hcp->hcq_status) & QSTAT_FREE) {
|
||||
|
||||
/*
|
||||
* Queue entry available, so set our view of things up
|
||||
*/
|
||||
hcp->hcq_code = CMD_DACT_VCCIN;
|
||||
hcp->hcq_arg = fvp;
|
||||
fup->fu_cmd_tail = hcp->hcq_next;
|
||||
|
||||
/*
|
||||
* Now set the CP-resident queue entry - the CP will
|
||||
* grab the command when the op-code is set.
|
||||
*/
|
||||
cqp = hcp->hcq_cpelem;
|
||||
(*hcp->hcq_status) = QSTAT_PENDING;
|
||||
cqp->cmdq_dact.dact_vccid = CP_WRITE(vcp->vc_vci);
|
||||
cqp->cmdq_dact.dact_cmd =
|
||||
CP_WRITE(CMD_DACT_VCCIN|CMD_INTR_REQ);
|
||||
} else {
|
||||
/*
|
||||
* Command queue full
|
||||
*
|
||||
* If we get here, we'll be getting out-of-sync with
|
||||
* the CP because we can't (for now at least) do
|
||||
* anything about close errors in the common code.
|
||||
* This won't be too bad, since we'll just toss any
|
||||
* PDUs received from the VCC and the sigmgr's will
|
||||
* always get open failures when trying to use this
|
||||
* (vpi,vci)...oh, well...always gotta have that one
|
||||
* last bug to fix! XXX
|
||||
*/
|
||||
fup->fu_stats->st_drv.drv_cm_full++;
|
||||
err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Finish up...
|
||||
*/
|
||||
if (fvp->fv_state == CVS_ACTIVE)
|
||||
fup->fu_open_vcc--;
|
||||
|
||||
if (fvp->rate != 0)
|
||||
fup->fu_num_shaped--;
|
||||
|
||||
DEVICE_UNLOCK((Cmn_unit *)fup);
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
|
@ -1,134 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2002 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
|
||||
#include <dev/eisa/eisa_busreg.h>
|
||||
#include <dev/eisa/eisa_busvar.h>
|
||||
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#include <dev/hfa/hfa_freebsd.h>
|
||||
|
||||
static int hfa_eisa_probe(device_t);
|
||||
static int hfa_eisa_attach(device_t);
|
||||
|
||||
static int
|
||||
hfa_eisa_probe (device_t dev)
|
||||
{
|
||||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
hfa_eisa_attach (device_t dev)
|
||||
{
|
||||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static device_method_t hfa_eisa_methods[] = {
|
||||
DEVMETHOD(device_probe, hfa_eisa_probe),
|
||||
DEVMETHOD(device_attach, hfa_eisa_attach),
|
||||
|
||||
DEVMETHOD(device_detach, hfa_detach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t hfa_eisa_driver = {
|
||||
"hfa",
|
||||
hfa_eisa_methods,
|
||||
sizeof(struct hfa_softc)
|
||||
};
|
||||
|
||||
DRIVER_MODULE(hfa, eisa, hfa_eisa_driver, hfa_devclass, 0, 0);
|
||||
MODULE_DEPEND(hfa, hfa, 1, 1, 1);
|
||||
MODULE_DEPEND(hfa, eisa, 1, 1, 1);
|
||||
|
|
@ -1,466 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2002 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#include <dev/hfa/hfa_freebsd.h>
|
||||
|
||||
devclass_t hfa_devclass;
|
||||
|
||||
static int hfa_modevent(module_t, int, void *);
|
||||
|
||||
SYSCTL_DECL(_hw_atm);
|
||||
|
||||
/*
|
||||
* Sysctl handler for the traffic shaping option
|
||||
*/
|
||||
static int
|
||||
hfa_sysctl_shape(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct hfa_softc *sc = arg1;
|
||||
int error;
|
||||
u_int new;
|
||||
|
||||
error = SYSCTL_OUT(req, &sc->fup.fu_shape , sizeof(sc->fup.fu_shape));
|
||||
if (error != 0 || req->newptr == NULL) {
|
||||
return (error);
|
||||
}
|
||||
|
||||
error = SYSCTL_IN(req, &new, sizeof(new));
|
||||
if (error != 0) {
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (new > FUS_SHAPE_ALL) {
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
sc->fup.fu_shape = new;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
hfa_alloc (device_t dev)
|
||||
{
|
||||
struct hfa_softc *sc;
|
||||
int error;
|
||||
|
||||
sc = (struct hfa_softc *)device_get_softc(dev);
|
||||
error = 0;
|
||||
|
||||
sc->mem = bus_alloc_resource_any(dev, sc->mem_type, &sc->mem_rid,
|
||||
RF_ACTIVE);
|
||||
if (sc->mem == NULL) {
|
||||
device_printf(dev, "Unable to allocate memory resource.\n");
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
if (sc->irq == NULL) {
|
||||
device_printf(dev, "Unable to allocate interrupt resource.\n");
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make the sysctl tree
|
||||
*/
|
||||
if ((sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
|
||||
SYSCTL_STATIC_CHILDREN(_hw_atm), OID_AUTO,
|
||||
device_get_nameunit(dev), CTLFLAG_RW, 0, "")) == NULL)
|
||||
goto fail;
|
||||
|
||||
if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
|
||||
OID_AUTO, "shape", CTLFLAG_RW | CTLTYPE_UINT, sc, 0,
|
||||
hfa_sysctl_shape, "IU", "traffic shaping") == NULL)
|
||||
goto fail;
|
||||
|
||||
mtx_init(&sc->mtx, device_get_nameunit(dev), "Interrupt lock", MTX_DEF|MTX_RECURSE);
|
||||
|
||||
fail:
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
hfa_free (device_t dev)
|
||||
{
|
||||
struct hfa_softc *sc;
|
||||
|
||||
sc = (struct hfa_softc *)device_get_softc(dev);
|
||||
|
||||
if (sc->mem)
|
||||
bus_release_resource(dev, sc->mem_type, sc->mem_rid, sc->mem);
|
||||
if (sc->irq_ih)
|
||||
bus_teardown_intr(dev, sc->irq, sc->irq_ih);
|
||||
if (sc->irq)
|
||||
bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);
|
||||
|
||||
/*
|
||||
* Destroy the mutex.
|
||||
*/
|
||||
if (mtx_initialized(&sc->mtx) != 0)
|
||||
mtx_destroy(&sc->mtx);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
hfa_attach (device_t dev)
|
||||
{
|
||||
struct hfa_softc *sc;
|
||||
Fore_unit *fup;
|
||||
int error;
|
||||
int err_count;
|
||||
|
||||
sc = (struct hfa_softc *)device_get_softc(dev);
|
||||
fup = &sc->fup;
|
||||
error = 0;
|
||||
err_count = BOOT_LOOPS;
|
||||
|
||||
/*
|
||||
* Start initializing it
|
||||
*/
|
||||
fup->fu_unit = device_get_unit(dev);
|
||||
fup->fu_mtu = FORE_IFF_MTU;
|
||||
fup->fu_vcc_zone = fore_vcc_zone;
|
||||
fup->fu_nif_zone = fore_nif_zone;
|
||||
fup->fu_ioctl = fore_atm_ioctl;
|
||||
fup->fu_instvcc = fore_instvcc;
|
||||
fup->fu_openvcc = fore_openvcc;
|
||||
fup->fu_closevcc = fore_closevcc;
|
||||
fup->fu_output = fore_output;
|
||||
fup->fu_softc = (void *)sc;
|
||||
|
||||
callout_handle_init(&fup->fu_thandle);
|
||||
|
||||
/*
|
||||
* Poke the hardware - boot the CP and prepare it for downloading
|
||||
*/
|
||||
hfa_reset(dev);
|
||||
|
||||
/*
|
||||
* Wait for the monitor to perform self-test
|
||||
*/
|
||||
while (CP_READ(fup->fu_mon->mon_bstat) != BOOT_MONREADY) {
|
||||
if (CP_READ(fup->fu_mon->mon_bstat) == BOOT_FAILTEST) {
|
||||
device_printf(dev, "failed self-test\n");
|
||||
goto fail;
|
||||
} else if ( --err_count == 0 ) {
|
||||
device_printf(dev, "unable to boot - status=0x%lx\n",
|
||||
(u_long)CP_READ(fup->fu_mon->mon_bstat));
|
||||
goto fail;
|
||||
}
|
||||
DELAY ( BOOT_DELAY );
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the adapter config info - at least as much as we can
|
||||
*/
|
||||
fup->fu_config.ac_vendor = VENDOR_FORE;
|
||||
fup->fu_config.ac_vendapi = VENDAPI_FORE_1;
|
||||
fup->fu_config.ac_media = MEDIA_OC3C;
|
||||
fup->fu_pif.pif_pcr = ATM_PCR_OC3C;
|
||||
|
||||
/*
|
||||
* Save device ram info for user-level programs
|
||||
*/
|
||||
fup->fu_config.ac_ram = (long)fup->fu_ram;
|
||||
fup->fu_config.ac_ramsize = fup->fu_ramsize;
|
||||
|
||||
/*
|
||||
* Set device capabilities
|
||||
*/
|
||||
fup->fu_pif.pif_maxvpi = FORE_MAX_VPI;
|
||||
fup->fu_pif.pif_maxvci = FORE_MAX_VCI;
|
||||
|
||||
/*
|
||||
* Register this interface with ATM core services
|
||||
*/
|
||||
error = atm_physif_register((Cmn_unit *)fup, FORE_DEV_NAME, fore_services);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
||||
fore_units[device_get_unit(dev)] = fup;
|
||||
fore_nunits++;
|
||||
|
||||
/*
|
||||
* Initialize the CP microcode program.
|
||||
*/
|
||||
fore_initialize(fup);
|
||||
|
||||
fail:
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
hfa_detach (device_t dev)
|
||||
{
|
||||
struct hfa_softc *sc;
|
||||
Fore_unit *fup;
|
||||
int error;
|
||||
|
||||
sc = (struct hfa_softc *)device_get_softc(dev);
|
||||
fup = &sc->fup;
|
||||
error = 0;
|
||||
|
||||
/*
|
||||
* De-Register this interface with ATM core services
|
||||
*/
|
||||
error = atm_physif_deregister((Cmn_unit *)fup);
|
||||
|
||||
/*
|
||||
* Reset the board and return it to cold_start state.
|
||||
* Hopefully, this will prevent use of resources as
|
||||
* we're trying to free things up.
|
||||
*/
|
||||
hfa_reset(dev);
|
||||
|
||||
/*
|
||||
* Lock out all device interrupts
|
||||
*/
|
||||
DEVICE_LOCK((Cmn_unit *)fup);
|
||||
|
||||
/*
|
||||
* Remove any pending timeout()'s
|
||||
*/
|
||||
(void)untimeout((KTimeout_ret(*)(void *))fore_initialize,
|
||||
(void *)fup, fup->fu_thandle);
|
||||
|
||||
hfa_free(dev);
|
||||
|
||||
DEVICE_UNLOCK((Cmn_unit *)fup);
|
||||
|
||||
/*
|
||||
* Free any Fore-specific device resources
|
||||
*/
|
||||
fore_interface_free(fup);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
void
|
||||
hfa_intr (void * arg)
|
||||
{
|
||||
struct hfa_softc *sc;
|
||||
|
||||
sc = (struct hfa_softc *)arg;
|
||||
|
||||
HFA_LOCK(sc);
|
||||
fore_intr(&sc->fup);
|
||||
HFA_UNLOCK(sc);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
hfa_reset (device_t dev)
|
||||
{
|
||||
struct hfa_softc *sc;
|
||||
Fore_unit *fup;
|
||||
|
||||
sc = (struct hfa_softc *)device_get_softc(dev);
|
||||
fup = &sc->fup;
|
||||
HFA_LOCK(sc);
|
||||
|
||||
/*
|
||||
* Reset the board and return it to cold_start state
|
||||
*/
|
||||
if (fup->fu_mon)
|
||||
fup->fu_mon->mon_bstat = CP_WRITE(BOOT_COLDSTART);
|
||||
|
||||
if (fup->fu_ctlreg) {
|
||||
|
||||
switch (fup->fu_config.ac_device) {
|
||||
case DEV_FORE_ESA200E:
|
||||
|
||||
break;
|
||||
|
||||
case DEV_FORE_SBA200E:
|
||||
/*
|
||||
* Reset i960 by setting and clearing RESET
|
||||
*/
|
||||
SBA200E_HCR_INIT(*fup->fu_ctlreg, SBA200E_RESET);
|
||||
SBA200E_HCR_CLR(*fup->fu_ctlreg, SBA200E_RESET);
|
||||
break;
|
||||
|
||||
case DEV_FORE_SBA200:
|
||||
/*
|
||||
* Reset i960 by setting and clearing RESET
|
||||
*
|
||||
* SBA200 will NOT reset if bit is OR'd in!
|
||||
*/
|
||||
*fup->fu_ctlreg = SBA200_RESET;
|
||||
*fup->fu_ctlreg = SBA200_RESET_CLR;
|
||||
break;
|
||||
|
||||
case DEV_FORE_PCA200E:
|
||||
/*
|
||||
* Reset i960 by setting and clearing RESET
|
||||
*/
|
||||
PCA200E_HCR_INIT(*fup->fu_ctlreg, PCA200E_RESET);
|
||||
DELAY(10000);
|
||||
PCA200E_HCR_CLR(*fup->fu_ctlreg, PCA200E_RESET);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
HFA_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
hfa_modevent (module_t mod, int type, void *data)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
|
||||
switch (type) {
|
||||
case MOD_LOAD:
|
||||
/*
|
||||
* Verify software version
|
||||
*/
|
||||
if (atm_version != ATM_VERSION) {
|
||||
printf("hfa: version mismatch: fore=%d.%d kernel=%d.%d\n",
|
||||
ATM_VERS_MAJ(ATM_VERSION),
|
||||
ATM_VERS_MIN(ATM_VERSION),
|
||||
ATM_VERS_MAJ(atm_version),
|
||||
ATM_VERS_MIN(atm_version));
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
fore_nif_zone = uma_zcreate("fore nif", sizeof(struct atm_nif), NULL,
|
||||
NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
|
||||
if (fore_nif_zone == NULL)
|
||||
panic("hfa_modevent:uma_zcreate nif");
|
||||
uma_zone_set_max(fore_nif_zone, 52);
|
||||
|
||||
fore_vcc_zone = uma_zcreate("fore vcc", sizeof(Fore_vcc), NULL,
|
||||
NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
|
||||
if (fore_vcc_zone == NULL)
|
||||
panic("hfa_modevent: uma_zcreate vcc");
|
||||
uma_zone_set_max(fore_vcc_zone, 100);
|
||||
|
||||
/*
|
||||
* Start up watchdog timer
|
||||
*/
|
||||
atm_timeout(&fore_timer, ATM_HZ * FORE_TIME_TICK, fore_timeout);
|
||||
|
||||
break;
|
||||
case MOD_UNLOAD:
|
||||
/*
|
||||
* Stop watchdog timer
|
||||
*/
|
||||
atm_untimeout(&fore_timer);
|
||||
|
||||
uma_zdestroy(fore_nif_zone);
|
||||
uma_zdestroy(fore_vcc_zone);
|
||||
|
||||
break;
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
break;
|
||||
}
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static moduledata_t hfa_moduledata = {
|
||||
"hfa",
|
||||
hfa_modevent,
|
||||
NULL
|
||||
};
|
||||
DECLARE_MODULE(hfa, hfa_moduledata, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
|
||||
MODULE_VERSION(hfa, 1);
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2002 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
struct hfa_softc {
|
||||
device_t dev;
|
||||
|
||||
struct resource * mem;
|
||||
int mem_rid;
|
||||
int mem_type;
|
||||
|
||||
struct resource * irq;
|
||||
int irq_rid;
|
||||
void * irq_ih;
|
||||
|
||||
struct mtx mtx;
|
||||
|
||||
Fore_unit fup;
|
||||
|
||||
/* sysctl support */
|
||||
struct sysctl_ctx_list sysctl_ctx;
|
||||
struct sysctl_oid * sysctl_tree;
|
||||
};
|
||||
|
||||
#define HFA_LOCK(_sc) mtx_lock(&(_sc)->mtx)
|
||||
#define HFA_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx)
|
||||
|
||||
extern devclass_t hfa_devclass;
|
||||
|
||||
int hfa_alloc (device_t);
|
||||
int hfa_free (device_t);
|
||||
|
||||
int hfa_attach (device_t);
|
||||
int hfa_detach (device_t);
|
||||
|
||||
void hfa_intr (void *);
|
||||
void hfa_reset (device_t);
|
||||
|
|
@ -1,213 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2002 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#include <dev/hfa/hfa_freebsd.h>
|
||||
|
||||
static int hfa_pci_probe(device_t);
|
||||
static int hfa_pci_attach(device_t);
|
||||
|
||||
#define FORE_PCA200EPC_ID 0x0300
|
||||
|
||||
static int
|
||||
hfa_pci_probe (dev)
|
||||
device_t dev;
|
||||
{
|
||||
if ((pci_get_vendor(dev) == FORE_VENDOR_ID) &&
|
||||
(pci_get_device(dev) == FORE_PCA200EPC_ID)) {
|
||||
device_set_desc(dev, "FORE Systems PCA-200EPC ATM");
|
||||
return (BUS_PROBE_DEFAULT);
|
||||
}
|
||||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
hfa_pci_attach (dev)
|
||||
device_t dev;
|
||||
{
|
||||
struct hfa_softc *sc;
|
||||
Fore_unit *fup;
|
||||
u_int32_t command;
|
||||
vm_offset_t va;
|
||||
int error;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
fup = &sc->fup;
|
||||
error = 0;
|
||||
|
||||
pci_enable_busmaster(dev);
|
||||
|
||||
sc->mem_rid = PCA200E_PCI_MEMBASE;
|
||||
sc->mem_type = SYS_RES_MEMORY;
|
||||
sc->irq_rid = 0;
|
||||
|
||||
error = hfa_alloc(dev);
|
||||
if (error) {
|
||||
device_printf(dev, "hfa_alloc() failed.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
va = (vm_offset_t) rman_get_virtual(sc->mem);
|
||||
|
||||
fup->fu_ram = (Fore_mem *)va;
|
||||
fup->fu_ramsize = PCA200E_RAM_SIZE;
|
||||
fup->fu_mon = (Mon960 *)(fup->fu_ram + MON960_BASE);
|
||||
fup->fu_ctlreg = (Fore_reg *)(va + PCA200E_HCR_OFFSET);
|
||||
fup->fu_imask = (Fore_reg *)(va + PCA200E_IMASK_OFFSET);
|
||||
fup->fu_psr = (Fore_reg *)(va + PCA200E_PSR_OFFSET);
|
||||
|
||||
/*
|
||||
* Convert Endianess of Slave RAM accesses
|
||||
*/
|
||||
command = pci_read_config(dev, PCA200E_PCI_MCTL, 4);
|
||||
command |= PCA200E_MCTL_SWAP;
|
||||
pci_write_config(dev, PCA200E_PCI_MCTL, command, 4);
|
||||
|
||||
/*
|
||||
* Map interrupt in
|
||||
*/
|
||||
error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET,
|
||||
NULL, hfa_intr, sc, &sc->irq_ih);
|
||||
if (error) {
|
||||
device_printf(dev, "Interrupt handler setup failed.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
fup->fu_config.ac_bustype = BUS_PCI;
|
||||
fup->fu_config.ac_busslot = (pci_get_bus(dev) << 8)| pci_get_slot(dev);
|
||||
|
||||
switch (pci_get_device(dev)) {
|
||||
case FORE_PCA200EPC_ID:
|
||||
fup->fu_config.ac_device = DEV_FORE_PCA200E;
|
||||
break;
|
||||
default:
|
||||
fup->fu_config.ac_device = DEV_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
error = hfa_attach(dev);
|
||||
if (error) {
|
||||
device_printf(dev, "hfa_attach() failed.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
fail:
|
||||
hfa_detach(dev);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static device_method_t hfa_pci_methods[] = {
|
||||
DEVMETHOD(device_probe, hfa_pci_probe),
|
||||
DEVMETHOD(device_attach, hfa_pci_attach),
|
||||
|
||||
DEVMETHOD(device_detach, hfa_detach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t hfa_pci_driver = {
|
||||
"hfa",
|
||||
hfa_pci_methods,
|
||||
sizeof(struct hfa_softc)
|
||||
};
|
||||
|
||||
DRIVER_MODULE(hfa, pci, hfa_pci_driver, hfa_devclass, 0, 0);
|
||||
MODULE_DEPEND(hfa, hfa, 1, 1, 1);
|
||||
MODULE_DEPEND(hfa, pci, 1, 1, 1);
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2002 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/*-
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
||||
#include <sparc64/sbus/sbusreg.h>
|
||||
#include <sparc64/sbus/sbusvar.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
|
||||
#include <dev/hfa/fore.h>
|
||||
#include <dev/hfa/fore_aali.h>
|
||||
#include <dev/hfa/fore_slave.h>
|
||||
#include <dev/hfa/fore_stats.h>
|
||||
#include <dev/hfa/fore_var.h>
|
||||
#include <dev/hfa/fore_include.h>
|
||||
|
||||
#include <dev/hfa/hfa_freebsd.h>
|
||||
|
||||
static int hfa_sbus_probe(device_t);
|
||||
static int hfa_sbus_attach(device_t);
|
||||
|
||||
static int
|
||||
hfa_sbus_probe (device_t dev)
|
||||
{
|
||||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
hfa_sbus_attach (device_t dev)
|
||||
{
|
||||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static device_method_t hfa_sbus_methods[] = {
|
||||
DEVMETHOD(device_probe, hfa_sbus_probe),
|
||||
DEVMETHOD(device_attach, hfa_sbus_attach),
|
||||
|
||||
DEVMETHOD(device_detach, hfa_detach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t hfa_sbus_driver = {
|
||||
"hfa",
|
||||
hfa_sbus_methods,
|
||||
sizeof(struct hfa_softc)
|
||||
};
|
||||
|
||||
DRIVER_MODULE(hfa, sbus, hfa_sbus_driver, hfa_devclass, 0, 0);
|
||||
MODULE_DEPEND(hfa, hfa, 1, 1, 1);
|
||||
MODULE_DEPEND(hfa, sbus, 1, 1, 1);
|
||||
3311
sys/dev/idt/idt.c
3311
sys/dev/idt/idt.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,765 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2000, 2001 Richard Hodges and Matriplex, inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Matriplex, inc.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* This driver is derived from the Nicstar driver by Mark Tinguely, and
|
||||
* some of the original driver still exists here. Those portions are...
|
||||
* Copyright (c) 1996, 1997, 1998, 1999 Mark Tinguely
|
||||
* All rights reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/netisr.h>
|
||||
#include <net/if_var.h>
|
||||
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
#include <netatm/atm_vc.h>
|
||||
|
||||
#include <dev/idt/idtreg.h>
|
||||
#include <dev/idt/idtvar.h>
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* HARP-specific definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#define IDT_DEV_NAME "idt"
|
||||
|
||||
#define IDT_IFF_MTU 9188
|
||||
#define IDT_MAX_VCI 1023 /* 0 - 1023 */
|
||||
#define IDT_MAX_VPI 0
|
||||
|
||||
#define iv_next iv_cmn.cv_next
|
||||
#define iv_toku iv_cmn.cv_toku
|
||||
#define iv_upper iv_cmn.cv_upper
|
||||
#define iv_vccb iv_cmn.cv_connvc /* HARP 3.0 */
|
||||
#define iv_state iv_cmn.cv_state
|
||||
#define iu_pif iu_cmn.cu_pif
|
||||
#define iu_unit iu_cmn.cu_unit
|
||||
#define iu_flags iu_cmn.cu_flags
|
||||
#define iu_mtu iu_cmn.cu_mtu
|
||||
#define iu_open_vcc iu_cmn.cu_open_vcc
|
||||
#define iu_instvcc iu_cmn.cu_instvcc /* HARP 3.0 */
|
||||
#define iu_vcc iu_cmn.cu_vcc
|
||||
#define iu_vcc_zone iu_cmn.cu_vcc_zone
|
||||
#define iu_nif_zone iu_cmn.cu_nif_zone
|
||||
#define iu_ioctl iu_cmn.cu_ioctl
|
||||
#define iu_openvcc iu_cmn.cu_openvcc
|
||||
#define iu_closevcc iu_cmn.cu_closevcc
|
||||
#define iu_output iu_cmn.cu_output
|
||||
#define iu_config iu_cmn.cu_config
|
||||
#define iu_softc iu_cmn.cu_softc
|
||||
|
||||
/*
|
||||
* ATM Interface services
|
||||
*/
|
||||
static struct stack_defn idt_svaal5 = {
|
||||
NULL,
|
||||
SAP_CPCS_AAL5,
|
||||
SDF_TERM,
|
||||
atm_dev_inst,
|
||||
atm_dev_lower,
|
||||
NULL,
|
||||
0,
|
||||
};
|
||||
static struct stack_defn idt_svaal4 = {
|
||||
&idt_svaal5,
|
||||
SAP_CPCS_AAL3_4,
|
||||
SDF_TERM,
|
||||
atm_dev_inst,
|
||||
atm_dev_lower,
|
||||
NULL,
|
||||
0,
|
||||
};
|
||||
static struct stack_defn idt_svaal0 = {
|
||||
&idt_svaal4,
|
||||
SAP_ATM,
|
||||
SDF_TERM,
|
||||
atm_dev_inst,
|
||||
atm_dev_lower,
|
||||
NULL,
|
||||
0,
|
||||
};
|
||||
struct stack_defn *idt_services = &idt_svaal0;
|
||||
|
||||
extern uma_zone_t idt_nif_zone;
|
||||
extern uma_zone_t idt_vcc_zone;
|
||||
|
||||
static int idt_atm_bearerclass(struct attr_bearer *);
|
||||
#ifdef T_ATM_BUFQUEUE
|
||||
static CONNECTION *idt_atm_harpconn(Cmn_unit *, Cmn_vcc *);
|
||||
#endif
|
||||
static int idt_atm_ioctl(int, caddr_t, caddr_t);
|
||||
|
||||
static void idt_output(Cmn_unit *, Cmn_vcc *, KBuffer *);
|
||||
static int idt_openvcc(Cmn_unit *, Cmn_vcc *);
|
||||
static int idt_closevcc(Cmn_unit *, Cmn_vcc *);
|
||||
static int idt_instvcc(Cmn_unit *, Cmn_vcc *);
|
||||
|
||||
static void idt_recv_stack(void *, KBuffer *);
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* HARP GLUE SECTION
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* Handle netatm core service interface ioctl requests
|
||||
*
|
||||
* Called at splnet.
|
||||
*
|
||||
* Arguments:
|
||||
* code ioctl function (sub)code
|
||||
* data data to/from ioctl
|
||||
* arg optional code-specific argument
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed successfully
|
||||
* error request failed - reason code
|
||||
*
|
||||
*/
|
||||
static int
|
||||
idt_atm_ioctl(int code, caddr_t addr, caddr_t arg)
|
||||
{
|
||||
#ifdef T_ATM_BUFQUEUE
|
||||
CONNECTION *connection;
|
||||
TX_QUEUE *txq;
|
||||
struct mbuf *m;
|
||||
Cmn_unit *cup;
|
||||
Cmn_vcc *cvp;
|
||||
int retval;
|
||||
#endif
|
||||
|
||||
switch (code) {
|
||||
|
||||
#ifdef T_ATM_BUFQUEUE
|
||||
case T_ATM_BUFQUEUE:
|
||||
cup = (Cmn_unit *) addr;
|
||||
cvp = (Cmn_vcc *) arg;
|
||||
connection = idt_atm_harpconn(cup, cvp);
|
||||
if (connection == NULL)
|
||||
return (-1);
|
||||
retval = 0;
|
||||
txq = connection->queue;
|
||||
if (txq == NULL)
|
||||
return (-1);
|
||||
for (m = txq->mget; m != NULL; m = m->m_nextpkt)
|
||||
retval += m->m_pkthdr.len;
|
||||
return (retval);
|
||||
#endif
|
||||
}
|
||||
|
||||
return (ENOSYS);
|
||||
}
|
||||
|
||||
#ifdef T_ATM_BUFQUEUE
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Get connection pointer from Cmn_unit and Cmn_vcc
|
||||
*
|
||||
* in: Cmn_unit and Cmn_vcc
|
||||
* out: connection (NULL=error)
|
||||
*
|
||||
* Date first: 05/31/2001 last: 05/31/2001
|
||||
*/
|
||||
|
||||
static CONNECTION *
|
||||
idt_atm_harpconn(Cmn_unit * cup, Cmn_vcc * cvp)
|
||||
{
|
||||
struct vccb *vccinf; /* from HARP struct */
|
||||
IDT *idt;
|
||||
int vpi;
|
||||
int vci;
|
||||
|
||||
idt = (IDT *) cup;
|
||||
if (idt == NULL || cvp == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (cvp->cv_connvc == NULL)
|
||||
return (NULL);
|
||||
|
||||
vccinf = cvp->cv_connvc->cvc_vcc;
|
||||
|
||||
if (vccinf == NULL)
|
||||
return (NULL);
|
||||
|
||||
vpi = vccinf->vc_vpi;
|
||||
vci = vccinf->vc_vci;
|
||||
|
||||
return (idt_connect_find(idt, vpi, vci));
|
||||
}
|
||||
#endif /* T_ATM_BUFQUEUE */
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Get CBR/VBR/UBR class from bearer attribute
|
||||
*
|
||||
* in:
|
||||
* out: NICCBR/NICVBR/NICABR/NICUBR
|
||||
*
|
||||
* Date first: 06/12/2001 last: 06/13/2001
|
||||
*/
|
||||
|
||||
static int
|
||||
idt_atm_bearerclass(struct attr_bearer * bearer)
|
||||
{
|
||||
switch (bearer->v.bearer_class) {
|
||||
case T_ATM_CLASS_A:return (NICCBR);
|
||||
case T_ATM_CLASS_C:
|
||||
if (idt_sysctl_vbriscbr)
|
||||
return (NICCBR); /* use CBR slots for VBR VC's */
|
||||
else
|
||||
return (NICVBR);
|
||||
case T_ATM_CLASS_X:
|
||||
if (bearer->v.traffic_type == T_ATM_CBR)
|
||||
return (NICCBR);
|
||||
if (bearer->v.traffic_type == T_ATM_VBR)
|
||||
return (NICVBR);
|
||||
return (NICUBR);
|
||||
}
|
||||
return (NICUBR);
|
||||
}
|
||||
|
||||
/* The flag idt_sysctl_vbriscbr allows us to set up a CBR VC as if it were
|
||||
* VBR. This is primarily to avoid cell loss at a switch that cannot seem
|
||||
* to buffer one or two cells of jitter. This jitter is created when many
|
||||
* CBR slots have been taken, and a new CBR VC cannot use the optimally
|
||||
* spaced slots, and has to use nearby slots instead.
|
||||
*
|
||||
* In this case, we want to use the VC SCR as the CBR value. The PCR and MBS
|
||||
* is only of interest to the switch.
|
||||
*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Initialize HARP service
|
||||
* called from device attach
|
||||
*/
|
||||
|
||||
int
|
||||
idt_harp_init(nicstar_reg_t *idt)
|
||||
{
|
||||
long long tsc_val;
|
||||
u_char idt_mac[6];
|
||||
int i;
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
|
||||
/*
|
||||
* Start initializing it
|
||||
*/
|
||||
idt->iu_unit = device_get_unit(idt->dev);
|
||||
idt->iu_mtu = IDT_IFF_MTU;
|
||||
idt->iu_ioctl = idt_atm_ioctl;
|
||||
idt->iu_openvcc = idt_openvcc;
|
||||
idt->iu_instvcc = idt_instvcc;
|
||||
idt->iu_closevcc = idt_closevcc;
|
||||
idt->iu_output = idt_output;
|
||||
idt->iu_vcc_zone = idt_vcc_zone;
|
||||
idt->iu_nif_zone = idt_nif_zone;
|
||||
idt->iu_softc = (void *)idt;
|
||||
|
||||
/*
|
||||
* Copy serial number into config space
|
||||
*/
|
||||
idt->iu_config.ac_serial = 0;
|
||||
|
||||
idt->iu_config.ac_vendor = VENDOR_IDT;
|
||||
idt->iu_config.ac_vendapi = VENDAPI_IDT_1;
|
||||
idt->iu_config.ac_device = DEV_IDT_155;
|
||||
idt->iu_config.ac_media = MEDIA_UNKNOWN;
|
||||
idt->iu_config.ac_bustype = BUS_PCI;
|
||||
|
||||
idt->iu_pif.pif_pcr = idt->cellrate_rmax; /* ATM_PCR_OC3C; */
|
||||
idt->iu_pif.pif_maxvpi = idt->conn_maxvpi;
|
||||
idt->iu_pif.pif_maxvci = idt->conn_maxvci;
|
||||
|
||||
snprintf(idt->iu_config.ac_hard_vers,
|
||||
sizeof(idt->iu_config.ac_hard_vers),
|
||||
idt->hardware);
|
||||
snprintf(idt->iu_config.ac_firm_vers,
|
||||
sizeof(idt->iu_config.ac_firm_vers),
|
||||
IDT_VERSION);
|
||||
/*
|
||||
* Save device ram info for user-level programs NOTE: This really
|
||||
* points to start of EEPROM and includes all the device registers
|
||||
* in the lower 2 Megabytes.
|
||||
*/
|
||||
idt->iu_config.ac_ram = 0;
|
||||
idt->iu_config.ac_ramsize = 0;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
idt_mac[i] = nicstar_eeprom_rd(idt, (0x6c + i));
|
||||
}
|
||||
|
||||
/* looks like bad MAC */
|
||||
if ((idt_mac[3] | idt_mac[4] | idt_mac[5]) == 0) {
|
||||
GET_RDTSC(tsc_val); /* 24 bits on 500mhz CPU is about
|
||||
* 30msec */
|
||||
idt_mac[0] = 0x00;
|
||||
idt_mac[1] = 0x20;
|
||||
idt_mac[2] = 0x48; /* use Fore prefix */
|
||||
idt_mac[3] = (tsc_val >> 16) & 0xff;
|
||||
idt_mac[4] = (tsc_val >> 8) & 0xff;
|
||||
idt_mac[5] = (tsc_val) & 0xff;
|
||||
device_printf(idt->dev,
|
||||
"Cannot read MAC address from EEPROM, generating it.\n");
|
||||
}
|
||||
bcopy(&idt_mac, &idt->iu_pif.pif_macaddr.ma_data, sizeof(idt_mac));
|
||||
|
||||
device_printf(idt->dev, "MAC address %6D, HWrev=%d\n",
|
||||
(u_int8_t *)&idt->iu_pif.pif_macaddr.ma_data, ":",
|
||||
idt->pci_rev);
|
||||
|
||||
idt->iu_config.ac_macaddr = idt->iu_pif.pif_macaddr;
|
||||
|
||||
/*
|
||||
* Register this interface with ATM core services
|
||||
*/
|
||||
error = atm_physif_register(&idt->iu_cmn, IDT_DEV_NAME, idt_services);
|
||||
if (error != 0) {
|
||||
/*
|
||||
* Registration failed - back everything out
|
||||
*/
|
||||
|
||||
log(LOG_ERR, "%s(): atm_physif_register failed\n", __func__);
|
||||
return (error);
|
||||
}
|
||||
idt->iu_flags |= CUF_INITED;
|
||||
|
||||
#if BSD >= 199506
|
||||
/*
|
||||
* Add hook to out shutdown function at_shutdown (
|
||||
* (bootlist_fn)idt_pci_shutdown, idt, SHUTDOWN_POST_SYNC );
|
||||
*/
|
||||
#endif
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Output data
|
||||
*/
|
||||
|
||||
static void
|
||||
idt_output(Cmn_unit * cmnunit, Cmn_vcc * cmnvcc, KBuffer * m)
|
||||
{
|
||||
struct vccb *vccinf; /* from HARP struct */
|
||||
IDT *idt;
|
||||
int vpi;
|
||||
int vci;
|
||||
int flags;
|
||||
|
||||
idt = (IDT *) cmnunit;
|
||||
flags = 0;
|
||||
|
||||
if (cmnvcc == NULL) {
|
||||
device_printf(idt->dev, "idt_output arg error #1\n");
|
||||
goto bad;
|
||||
}
|
||||
if (cmnvcc->cv_connvc == NULL) {
|
||||
device_printf(idt->dev, "idt_output arg error #2\n");
|
||||
goto bad;
|
||||
}
|
||||
vccinf = cmnvcc->cv_connvc->cvc_vcc;
|
||||
if (vccinf == NULL) {
|
||||
device_printf(idt->dev, "idt_output arg error #3\n");
|
||||
goto bad;
|
||||
}
|
||||
vpi = vccinf->vc_vpi;
|
||||
vci = vccinf->vc_vci;
|
||||
|
||||
#ifdef CVF_MPEG2TS /* option to split bufs into small TS bufs */
|
||||
if (cmnvcc->cv_flags & CVF_MPEG2TS)
|
||||
flags = 1;
|
||||
#endif
|
||||
|
||||
idt_transmit(idt, m, vpi, vci, flags);
|
||||
|
||||
return;
|
||||
bad:
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Open VCC
|
||||
*/
|
||||
|
||||
static int
|
||||
idt_openvcc(Cmn_unit * cmnunit, Cmn_vcc * cmnvcc)
|
||||
{
|
||||
Atm_attributes *attrib; /* from HARP struct */
|
||||
struct vccb *vccinf; /* from HARP struct */
|
||||
CONNECTION *connection;
|
||||
IDT *idt;
|
||||
int vpi;
|
||||
int vci;
|
||||
int class; /* NICCBR, NICVBR, or NICUBR */
|
||||
|
||||
idt = (IDT *) cmnunit;
|
||||
|
||||
if (cmnvcc == NULL || cmnvcc->cv_connvc == NULL) {
|
||||
printf("idt_openvcc: bad request #1.\n");
|
||||
return (1);
|
||||
}
|
||||
attrib = &cmnvcc->cv_connvc->cvc_attr;
|
||||
vccinf = cmnvcc->cv_connvc->cvc_vcc;
|
||||
|
||||
if (attrib == NULL || vccinf == NULL) {
|
||||
printf("idt_openvcc: bad request #2.\n");
|
||||
return (1);
|
||||
}
|
||||
vpi = vccinf->vc_vpi;
|
||||
vci = vccinf->vc_vci;
|
||||
|
||||
connection = idt_connect_find(idt, vpi, vci);
|
||||
if (connection == NULL) {
|
||||
printf("idt_openvcc: vpi/vci invalid: %d/%d\n", vpi, vci);
|
||||
return (1);
|
||||
}
|
||||
if (connection->status) {
|
||||
printf("idt_openvcc: connection already open %d/%d\n", vpi, vci);
|
||||
return (1);
|
||||
}
|
||||
connection->status = 1;
|
||||
connection->recv = NULL;
|
||||
connection->rlen = 0;
|
||||
connection->maxpdu = 20000;
|
||||
connection->aal = IDTAAL5;
|
||||
connection->traf_pcr = attrib->traffic.v.forward.PCR_all_traffic;
|
||||
connection->traf_scr = attrib->traffic.v.forward.SCR_all_traffic;
|
||||
connection->vccinf = vccinf; /* 12/15/2000 */
|
||||
|
||||
if (connection->traf_pcr <= 0)
|
||||
connection->traf_pcr = connection->traf_scr;
|
||||
if (connection->traf_scr <= 0)
|
||||
connection->traf_scr = connection->traf_pcr;
|
||||
|
||||
class = idt_atm_bearerclass(&attrib->bearer);
|
||||
if (vpi == 0 && vci == 5)
|
||||
class = NICABR; /* higher priority than UBR */
|
||||
if (vpi == 0 && vci == 16)
|
||||
class = NICABR;
|
||||
|
||||
if (connection->traf_pcr < 0) { /* neither PCR nor SCR given */
|
||||
connection->traf_pcr = 1;
|
||||
connection->traf_scr = 1;
|
||||
class = NICUBR; /* so give it lowest priority */
|
||||
}
|
||||
connection->class = class;
|
||||
|
||||
if (idt_connect_txopen(idt, connection)) {
|
||||
device_printf(idt->dev, "cannot open connection for %d/%d\n",
|
||||
vpi, vci);
|
||||
return (1);
|
||||
}
|
||||
if (idt_sysctl_logvcs)
|
||||
printf("idt_openvcc: %d/%d, PCR=%d, SCR=%d\n", vpi, vci,
|
||||
connection->traf_pcr, connection->traf_scr);
|
||||
idt_connect_opencls(idt, connection, 1); /* open entry in rcv
|
||||
* connect table */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* We really don't handle ABR, but use it as a higher priority UBR. The
|
||||
* idea is that a UBR connection that gives a PCR (like 0/16) should
|
||||
* be given preference over a UBR connection that wants "everything else".
|
||||
*
|
||||
* Note that CLASS_X is typically UBR, but the traffic type information
|
||||
* element may still specify CBR or VBR.
|
||||
*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Close VCC
|
||||
*/
|
||||
|
||||
static int
|
||||
idt_closevcc(Cmn_unit * cmnunit, Cmn_vcc * cmnvcc)
|
||||
{
|
||||
CONNECTION *connection;
|
||||
nicstar_reg_t *idt = (nicstar_reg_t *) cmnunit;
|
||||
int vpi;
|
||||
int vci;
|
||||
|
||||
if (cmnvcc && cmnvcc->cv_connvc && cmnvcc->cv_connvc->cvc_vcc) {
|
||||
vpi = cmnvcc->cv_connvc->cvc_vcc->vc_vpi;
|
||||
vci = cmnvcc->cv_connvc->cvc_vcc->vc_vci;
|
||||
} else {
|
||||
printf("idt_closevcc: bad vcivpi\n");
|
||||
return (0);
|
||||
}
|
||||
connection = idt_connect_find(idt, vpi, vci);
|
||||
|
||||
if (connection == NULL) {
|
||||
printf("idt_closevcc: vpi/vci invalid: %d/%d\n", vpi, vci);
|
||||
return (0);
|
||||
}
|
||||
idt_connect_opencls(idt, connection, 0); /* close entry in rcv
|
||||
* connect table */
|
||||
|
||||
if (connection->status == 0)
|
||||
printf("idt_closevcc: close on empty connection %d/%d\n", vpi, vci);
|
||||
if (connection->recv != NULL)
|
||||
m_freem(connection->recv); /* recycle mbuf of partial PDU */
|
||||
idt_connect_txclose(idt, connection);
|
||||
connection->status = 0;
|
||||
connection->recv = NULL;
|
||||
connection->rlen = 0;
|
||||
connection->maxpdu = 0;
|
||||
connection->aal = 0;
|
||||
connection->traf_pcr = 0;
|
||||
connection->traf_scr = 0;
|
||||
|
||||
if (idt_sysctl_logvcs)
|
||||
printf("idt_closevcc: vpi=%d vci=%d\n", vpi, vci);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* VCC Stack Instantiation
|
||||
*
|
||||
* This function is called via the common driver code during a device VCC
|
||||
* stack instantiation. The common code has already validated some of
|
||||
* the request so we just need to check a few more IDT-specific details.
|
||||
*
|
||||
* Called at splnet.
|
||||
*
|
||||
* Arguments:
|
||||
* cup pointer to device common unit
|
||||
* cvp pointer to common VCC entry
|
||||
*
|
||||
* Returns:
|
||||
* 0 instantiation successful
|
||||
* err instantiation failed - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
idt_instvcc(Cmn_unit * cmnunit, Cmn_vcc * cmnvcc)
|
||||
{
|
||||
Atm_attributes *attrib; /* from HARP struct */
|
||||
IDT *idt;
|
||||
int class, pcr, scr;
|
||||
int slots_vc, slots_cur, slots_max;
|
||||
|
||||
if (cmnvcc == NULL)
|
||||
return (EINVAL);
|
||||
if (cmnvcc->cv_connvc == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
idt = (IDT *) cmnunit;
|
||||
if (idt == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
attrib = &cmnvcc->cv_connvc->cvc_attr;
|
||||
|
||||
if (attrib == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
pcr = attrib->traffic.v.forward.PCR_all_traffic;
|
||||
scr = attrib->traffic.v.forward.SCR_all_traffic;
|
||||
|
||||
if (pcr <= 0)
|
||||
pcr = scr; /* if PCR missing, default to SCR */
|
||||
if (pcr <= 0)
|
||||
pcr = 1;
|
||||
if (scr <= 0)
|
||||
scr = pcr;
|
||||
|
||||
class = idt_atm_bearerclass(&attrib->bearer);
|
||||
if (class == NICCBR) {
|
||||
slots_max = idt->txslots_max;
|
||||
slots_cur = idt->txslots_cur;
|
||||
slots_vc = idt_slots_cbr(idt, scr); /* 06/13/2001: now using
|
||||
* SCR */
|
||||
if (slots_vc + slots_cur > slots_max) {
|
||||
if (idt_sysctl_logvcs)
|
||||
device_printf(idt->dev,
|
||||
"Insufficient bandwidth (vc=%d cur=%d max=%d)\n",
|
||||
slots_vc, slots_cur, slots_max);
|
||||
return (EINVAL);
|
||||
}
|
||||
}
|
||||
/* This part was take from /sys/dev/hfa/fore_vcm.c */
|
||||
|
||||
switch (attrib->aal.type) {
|
||||
case ATM_AAL0:
|
||||
break;
|
||||
case ATM_AAL3_4:
|
||||
if ((attrib->aal.v.aal4.forward_max_SDU_size > IDT_IFF_MTU) ||
|
||||
(attrib->aal.v.aal4.backward_max_SDU_size > IDT_IFF_MTU))
|
||||
return (EINVAL);
|
||||
break;
|
||||
case ATM_AAL5:
|
||||
if ((attrib->aal.v.aal5.forward_max_SDU_size > IDT_IFF_MTU) ||
|
||||
(attrib->aal.v.aal5.backward_max_SDU_size > IDT_IFF_MTU))
|
||||
return (EINVAL);
|
||||
break;
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass Incoming PDU up Stack
|
||||
*
|
||||
* This function is called via the core ATM interrupt queue callback
|
||||
* set in fore_recv_drain(). It will pass the supplied incoming
|
||||
* PDU up the incoming VCC's stack.
|
||||
*
|
||||
* Called at splnet.
|
||||
*
|
||||
* Arguments:
|
||||
* tok token to identify stack instantiation
|
||||
* m pointer to incoming PDU buffer chain
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
static void
|
||||
idt_recv_stack(void *tok, KBuffer * m)
|
||||
{
|
||||
Idt_vcc *ivp = (Idt_vcc *) tok;
|
||||
int err;
|
||||
|
||||
if ((m->m_flags & M_PKTHDR) == 0) {
|
||||
printf("idt_recv_stack: Warning - mbuf chain has no header.\n");
|
||||
KB_FREEALL(m);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Send the data up the stack
|
||||
*/
|
||||
STACK_CALL(CPCS_UNITDATA_SIG, ivp->iv_upper,
|
||||
ivp->iv_toku, ivp->iv_vccb, (int)m, 0, err);
|
||||
if (err)
|
||||
KB_FREEALL(m);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Enqueue received PDU for HARP to handle
|
||||
*
|
||||
* in: IDT device, mbuf, vpi, vci
|
||||
*
|
||||
* Date last: 12/14/2000
|
||||
*/
|
||||
|
||||
void
|
||||
idt_receive(nicstar_reg_t * idt, struct mbuf * m, int vpi, int vci)
|
||||
{
|
||||
caddr_t cp;
|
||||
Cmn_vcc *vcc;
|
||||
int space;
|
||||
|
||||
/*
|
||||
* The STACK_CALL needs to happen at splnet() in order for the stack
|
||||
* sequence processing to work. Schedule an interrupt queue
|
||||
* callback at splnet() since we are currently at device level.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Prepend callback function pointer and token value to buffer. We
|
||||
* have already guaranteed that the space is available in the first
|
||||
* buffer.
|
||||
*/
|
||||
|
||||
/*
|
||||
* vcc = atm_dev_vcc_find(&idt->iu_cmn, (vpivci>> 16), vpivci &
|
||||
* 0xffff, VCC_IN);
|
||||
*/
|
||||
|
||||
vcc = atm_dev_vcc_find(&idt->iu_cmn, vpi, vci, VCC_IN);
|
||||
|
||||
if (vcc == NULL) { /* harp stack not ready or no vcc */
|
||||
printf("idt_receive: no VCC %d/%d\n", vpi, vci);
|
||||
KB_FREEALL(m);
|
||||
return;
|
||||
}
|
||||
space = m->m_data - idt_mbuf_base(m);
|
||||
if (space < sizeof(atm_intr_func_t) + sizeof(int)) {
|
||||
printf("idt_receive: NOT enough buffer space (%d).\n", space);
|
||||
KB_FREEALL(m);
|
||||
return;
|
||||
}
|
||||
KB_HEADADJ(m, sizeof(atm_intr_func_t) + sizeof(int));
|
||||
KB_DATASTART(m, cp, caddr_t);
|
||||
*((atm_intr_func_t *) cp) = idt_recv_stack;
|
||||
cp += sizeof(atm_intr_func_t);
|
||||
|
||||
*((void **)cp) = (void *)vcc;
|
||||
|
||||
/*
|
||||
* Schedule callback
|
||||
*/
|
||||
netisr_queue(NETISR_ATM, m); /* mbuf is free'd on failure. */
|
||||
}
|
||||
|
|
@ -1,323 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2000, 2001 Richard Hodges and Matriplex, inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Matriplex, inc.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* This driver is derived from the Nicstar driver by Mark Tinguely, and
|
||||
* some of the original driver still exists here. Those portions are...
|
||||
* Copyright (c) 1996, 1997, 1998, 1999 Mark Tinguely
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
#include <dev/idt/idtreg.h>
|
||||
#include <dev/idt/idtvar.h>
|
||||
|
||||
#define IDT_VID 0x111d
|
||||
#define IDT_NICSTAR_DID 0x0001
|
||||
|
||||
struct pci_type {
|
||||
u_int16_t pci_vid;
|
||||
u_int16_t pci_did;
|
||||
char * pci_name;
|
||||
} pci_devs[] = {
|
||||
{ IDT_VID, IDT_NICSTAR_DID, "IDT IDT77201/211 NICStAR ATM Adapter" },
|
||||
{ 0, 0, NULL }
|
||||
};
|
||||
|
||||
uma_zone_t idt_nif_zone;
|
||||
uma_zone_t idt_vcc_zone;
|
||||
|
||||
static int idt_probe (device_t);
|
||||
static int idt_attach (device_t);
|
||||
static int idt_detach (device_t);
|
||||
static int idt_shutdown (device_t);
|
||||
static void idt_free (device_t);
|
||||
static int idt_modevent (module_t, int, void *);
|
||||
|
||||
static int
|
||||
idt_probe(device_t dev)
|
||||
{
|
||||
struct pci_type *t = pci_devs;
|
||||
|
||||
while(t->pci_name != NULL) {
|
||||
if ((pci_get_vendor(dev) == t->pci_vid) &&
|
||||
(pci_get_device(dev) == t->pci_did)) {
|
||||
device_set_desc(dev, t->pci_name);
|
||||
return(BUS_PROBE_DEFAULT);
|
||||
}
|
||||
t++;
|
||||
}
|
||||
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Attach device
|
||||
*
|
||||
* Date first: 11/14/2000 last: 06/10/2001
|
||||
*/
|
||||
|
||||
static int
|
||||
idt_attach(device_t dev)
|
||||
{
|
||||
struct idt_softc *sc;
|
||||
int error;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
sc->dev = dev;
|
||||
error = 0;
|
||||
|
||||
pci_enable_busmaster(dev);
|
||||
|
||||
/* count = 2 (times 32 PCI clocks) */
|
||||
pci_write_config(dev, PCIR_LATTIMER, 0x20, 1);
|
||||
|
||||
/* Map IDT registers */
|
||||
sc->mem_rid = 0x14;
|
||||
sc->mem_type = SYS_RES_MEMORY;
|
||||
sc->mem = bus_alloc_resource_any(dev, sc->mem_type, &sc->mem_rid,
|
||||
RF_ACTIVE);
|
||||
if (sc->mem == NULL) {
|
||||
device_printf(dev, "could not map registers.\n");
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
sc->bustag = rman_get_bustag(sc->mem);
|
||||
sc->bushandle = rman_get_bushandle(sc->mem);
|
||||
|
||||
/* Map interrupt */
|
||||
sc->irq_rid = 0;
|
||||
sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid,
|
||||
RF_ACTIVE | RF_SHAREABLE);
|
||||
if (sc->irq == NULL) {
|
||||
device_printf(dev, "could not map interrupt.\n");
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, NULL, nicstar_intr,
|
||||
sc, &sc->irq_ih);
|
||||
if (error) {
|
||||
device_printf(dev, "could not setup irq.\n");
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sc->virt_baseaddr = (vm_offset_t)rman_get_virtual(sc->mem);
|
||||
sc->cmd_reg = sc->virt_baseaddr + REGCMD; /* old reg */
|
||||
sc->stat_reg = sc->virt_baseaddr + REGSTAT; /* old reg */
|
||||
sc->reg_cmd = (u_long *)(sc->virt_baseaddr + REGCMD);
|
||||
sc->reg_stat = (u_long *)(sc->virt_baseaddr + REGSTAT);
|
||||
sc->reg_cfg = (u_long *)(sc->virt_baseaddr + REGCFG);
|
||||
sc->reg_data = (u_long *)(sc->virt_baseaddr + 0);
|
||||
sc->reg_tsqh = (u_long *)(sc->virt_baseaddr + REGTSQH);
|
||||
sc->reg_gp = (u_long *)(sc->virt_baseaddr + REGGP);
|
||||
sc->pci_rev = pci_get_revid(dev);
|
||||
sc->timer_wrap = 0;
|
||||
|
||||
callout_handle_init(&sc->ch);
|
||||
|
||||
phys_init(sc); /* initialize the hardware */
|
||||
nicstar_init(sc); /* allocate and initialize */
|
||||
|
||||
error = idt_harp_init(sc);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
||||
return (0);
|
||||
fail:
|
||||
idt_free(dev);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Detach device
|
||||
*
|
||||
* Date first: 11/14/2000 last: 11/14/2000
|
||||
*/
|
||||
|
||||
static int
|
||||
idt_detach(device_t dev)
|
||||
{
|
||||
struct idt_softc *sc;
|
||||
int error;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
error = 0;
|
||||
|
||||
/*
|
||||
* De-Register this interface with ATM core services
|
||||
*/
|
||||
error = atm_physif_deregister(&sc->iu_cmn);
|
||||
|
||||
idt_device_stop(sc); /* Stop the device */
|
||||
|
||||
/*
|
||||
* Lock out all device interrupts.
|
||||
*/
|
||||
DEVICE_LOCK(&sc->iu_cmn);
|
||||
idt_free(dev);
|
||||
idt_release_mem(sc);
|
||||
DEVICE_UNLOCK(&sc->iu_cmn);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Shutdown device
|
||||
*
|
||||
* Date first: 11/14/2000 last: 11/14/2000
|
||||
*/
|
||||
|
||||
static int
|
||||
idt_shutdown(device_t dev)
|
||||
{
|
||||
|
||||
struct idt_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
idt_device_stop(sc); /* Stop the device */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
idt_free (device_t dev)
|
||||
{
|
||||
struct idt_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
if (sc->irq_ih)
|
||||
bus_teardown_intr(dev, sc->irq, sc->irq_ih);
|
||||
if (sc->irq)
|
||||
bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);
|
||||
if (sc->mem)
|
||||
bus_release_resource(dev, sc->mem_type, sc->mem_rid, sc->mem);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
idt_modevent (module_t mod, int type, void *data)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
|
||||
switch (type) {
|
||||
case MOD_LOAD:
|
||||
idt_nif_zone = uma_zcreate("idt nif",
|
||||
sizeof(struct atm_nif),
|
||||
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
|
||||
if (idt_nif_zone == NULL)
|
||||
panic("hfa_modevent:uma_zcreate nif");
|
||||
uma_zone_set_max(idt_nif_zone, 20);
|
||||
|
||||
idt_vcc_zone = uma_zcreate("idt vcc",
|
||||
sizeof(Idt_vcc),
|
||||
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
|
||||
if (idt_vcc_zone == NULL)
|
||||
panic("hfa_modevent: uma_zcreate vcc");
|
||||
uma_zone_set_max(idt_vcc_zone, 100);
|
||||
|
||||
break;
|
||||
|
||||
case MOD_UNLOAD:
|
||||
uma_zdestroy(idt_nif_zone);
|
||||
uma_zdestroy(idt_vcc_zone);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static device_method_t idt_methods[] = {
|
||||
DEVMETHOD(device_probe, idt_probe),
|
||||
DEVMETHOD(device_attach, idt_attach),
|
||||
DEVMETHOD(device_detach, idt_detach),
|
||||
DEVMETHOD(device_shutdown, idt_shutdown),
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static driver_t idt_driver = {
|
||||
"idt",
|
||||
idt_methods,
|
||||
sizeof(struct idt_softc)
|
||||
};
|
||||
|
||||
static devclass_t idt_devclass;
|
||||
|
||||
DRIVER_MODULE(idt, pci, idt_driver, idt_devclass, idt_modevent, 0);
|
||||
MODULE_VERSION(idt, 1);
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2000, 2001 Richard Hodges and Matriplex, inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Matriplex, inc.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* This driver is derived from the Nicstar driver by Mark Tinguely, and
|
||||
* some of the original driver still exists here. Those portions are...
|
||||
* Copyright (c) 1996, 1997, 1998, 1999 Mark Tinguely
|
||||
* All rights reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define IDT_VERSION "IDT 1.101"
|
||||
#define CBR_VERBOSE 1 /* show CBR time slots */
|
||||
|
||||
#define IDT_MAX_CBRSLOTS 2100 /* no smaller than value assigned to card */
|
||||
#define IDT_MAX_CBRQUEUE 64 /* max number of CBR connections: 1k each */
|
||||
|
||||
/* AAL types */
|
||||
#define IDTAAL0 0
|
||||
#define IDTAAL1 1
|
||||
#define IDTAAL3_4 3
|
||||
#define IDTAAL5 5
|
||||
|
||||
#define NICCBR 1
|
||||
#define NICVBR 2
|
||||
#define NICABR 3
|
||||
#define NICUBR 4
|
||||
|
||||
/* NICStAR Operation Registers */
|
||||
#define REGCMD 0x10 /* command w */
|
||||
#define REGCFG 0x14 /* configuration r/w */
|
||||
#define REGSTAT 0x18 /* status r/w */
|
||||
#define REGRSQB 0x1c /* RSQ base w */
|
||||
#define REGRSQT 0x20 /* RSQ tail r */
|
||||
#define REGRSQH 0x24 /* RSQ head w */
|
||||
#define REGCDC 0x28 /* cell drop cnt r/c */
|
||||
#define REGVPEC 0x2c /* vci/vpi er cnt r/c */
|
||||
#define REGICC 0x30 /* invalid cell r/c */
|
||||
#define REGRAWT 0x34 /* raw cell tail r */
|
||||
#define REGTMR 0x38 /* timer r */
|
||||
#define REGTSTB 0x3c /* TST base r/w */
|
||||
#define REGTSQB 0x40 /* TSQ base w */
|
||||
#define REGTSQT 0x44 /* TSQ tail r */
|
||||
#define REGTSQH 0x48 /* TSQ head w */
|
||||
#define REGGP 0x4c /* general purp r/w */
|
||||
#define REGVMSK 0x50 /* vci/vpi mask w */
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2000, 2001 Richard Hodges and Matriplex, inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Matriplex, inc.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* This driver is derived from the Nicstar driver by Mark Tinguely, and
|
||||
* some of the original driver still exists here. Those portions are...
|
||||
* Copyright (c) 1996, 1997, 1998, 1999 Mark Tinguely
|
||||
* All rights reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* This driver supports the Fore LE155, LE25, and IDT 77211 cards.
|
||||
*
|
||||
* ATM CBR connections are supported, and bandwidth is allocated in
|
||||
* slots of 64k each. Three VBR queues handle traffic for VBR and
|
||||
* UBR. Two UBR queues prioritize UBR traffic. ILMI and signalling
|
||||
* get the higher priority queue, as well as UBR traffic that specifies
|
||||
* a peak cell rate. All other UBR traffic goes into the lower queue.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* New data types
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
struct mbuf *mget; /* head of mbuf queue, pull mbufs from here */
|
||||
struct mbuf **mput; /* tail (ptr to m_nextpkt) put mbufs here */
|
||||
u_long scd; /* segmentation channel descriptor address */
|
||||
u_long *scq_base; /* segmentation channel queue base address */
|
||||
u_long *scq_next; /* next address */
|
||||
u_long *scq_last; /* last address written */
|
||||
int scq_len; /* size of SCQ buffer (64 or 512) */
|
||||
int scq_cur; /* current number entries in SCQ buffer */
|
||||
int rate; /* cells per second allocated to this queue */
|
||||
int vbr_m; /* VBR m/n = max duty cycle for queue */
|
||||
int vbr_n; /* 1 <= m <= 7 and 1 <= n <= 127 */
|
||||
} TX_QUEUE;
|
||||
|
||||
/* To avoid expensive SRAM reads, scq_cur tracks the number of SCQ entries
|
||||
* in use. Only idt_transmit_top may increase this, and only idt_intr_tsq
|
||||
* may decrease it.
|
||||
*/
|
||||
|
||||
/* mbuf chains on the queue use the fields:
|
||||
* m_next is the usual pointer to next mbuf
|
||||
* m_nextpkt is the next packet on the queue
|
||||
* m_pkthdr.rcvif is a pointer to the connection
|
||||
* m_pkthdr.header is a pointer to the TX queue
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
struct vccb *vccinf;
|
||||
char status; /* zero if closed */
|
||||
char vpi;
|
||||
u_short vci;
|
||||
TX_QUEUE *queue; /* transmit queue for this connection */
|
||||
struct mbuf *recv; /* current receive mbuf, or NULL */
|
||||
int rlen; /* current receive length */
|
||||
int maxpdu; /* largest PDU we will ever see */
|
||||
int traf_pcr; /* peak cell rate */
|
||||
int traf_scr; /* sustained cell rate */
|
||||
u_char aal; /* AAL for this connection */
|
||||
u_char class; /* T_ATM_CBR, T_ATM_VBR, or T_ATM_UBR */
|
||||
u_char flg_mpeg2ts:1; /* send data as 2 TS == 8 AAL5 cells */
|
||||
u_char flg_clp:1; /* CLP flag for outbound cells */
|
||||
} CONNECTION;
|
||||
|
||||
#define MAX_CONNECTION 4096 /* max number of connections */
|
||||
|
||||
#define GET_RDTSC(var) {__asm__ volatile("rdtsc":"=A"(var)); }
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Device softc structure
|
||||
*/
|
||||
|
||||
struct idt_softc {
|
||||
/* HARP data */
|
||||
/* XXX: must be first member of struct. */
|
||||
Cmn_unit iu_cmn; /* Common unit stuff */
|
||||
|
||||
#if 0
|
||||
struct arpcom idt_ac; /* ifnet for device */
|
||||
#endif
|
||||
|
||||
/* Device data */
|
||||
device_t dev;
|
||||
int debug;
|
||||
|
||||
struct resource * mem;
|
||||
int mem_rid;
|
||||
int mem_type;
|
||||
bus_space_tag_t bustag;
|
||||
bus_space_handle_t bushandle;
|
||||
|
||||
struct resource * irq;
|
||||
int irq_rid;
|
||||
void * irq_ih;
|
||||
|
||||
struct callout_handle ch;
|
||||
|
||||
struct mtx mtx;
|
||||
|
||||
vm_offset_t virt_baseaddr; /* nicstar register virtual address */
|
||||
vm_offset_t cmd_reg; /* command register offset 0x14 */
|
||||
vm_offset_t stat_reg; /* status register offset 0x60 */
|
||||
vm_offset_t fixbuf; /* buffer that holds TSQ, RSQ, variable SCQ */
|
||||
|
||||
u_long timer_wrap; /* keep track of wrapped timers */
|
||||
u_long rsqh; /* Recieve Status Queue, reg is write-only */
|
||||
|
||||
CONNECTION *connection; /* connection table */
|
||||
int conn_maxvpi; /* number of VPI values */
|
||||
int conn_maxvci; /* number of VCI values */
|
||||
int cellrate_rmax; /* max RX cells per second */
|
||||
int cellrate_tmax; /* max TX cells per second */
|
||||
int cellrate_rcur; /* current committed RX cellrate */
|
||||
int cellrate_tcur; /* current committed TX cellrate */
|
||||
int txslots_max; /* number of CBR TX slots for interface */
|
||||
int txslots_cur; /* current CBR TX slots in use */
|
||||
TX_QUEUE cbr_txqb[IDT_MAX_CBRQUEUE];
|
||||
TX_QUEUE *cbr_slot[IDT_MAX_CBRSLOTS];
|
||||
TX_QUEUE *cbr_free[IDT_MAX_CBRQUEUE];
|
||||
TX_QUEUE queue_vbr;
|
||||
TX_QUEUE queue_abr;
|
||||
TX_QUEUE queue_ubr;
|
||||
vm_offset_t cbr_base; /* base of memory for CBR TX queues */
|
||||
int cbr_size; /* size of memory for CBR TX queues */
|
||||
int cbr_freect;
|
||||
u_long raw_headp; /* head of raw cell queue, physical */
|
||||
struct mbuf *raw_headm; /* head of raw cell queue, virtual */
|
||||
u_long *tsq_base; /* virtual TSQ base address */
|
||||
u_long *tsq_head; /* virtual TSQ head pointer */
|
||||
int tsq_size; /* number of TSQ entries (1024) */
|
||||
volatile u_long *reg_cfg;
|
||||
volatile u_long *reg_cmd;
|
||||
volatile u_long *reg_data;
|
||||
volatile u_long *reg_tsqh;
|
||||
volatile u_long *reg_gp;
|
||||
volatile u_long *reg_stat;
|
||||
struct mbuf **mcheck;
|
||||
|
||||
int sram; /* amount of SRAM */
|
||||
int pci_rev; /* hardware revision ID */
|
||||
char *hardware; /* hardware description string */
|
||||
u_char flg_le25:1; /* flag indicates LE25 instead of LE155 */
|
||||
u_char flg_igcrc:1; /* ignore receive CRC errors */
|
||||
};
|
||||
|
||||
typedef struct idt_softc nicstar_reg_t;
|
||||
typedef struct idt_softc IDT;
|
||||
|
||||
#define iu_pif iu_cmn.cu_pif
|
||||
#define stats_ipdus iu_pif.pif_ipdus
|
||||
#define stats_opdus iu_pif.pif_opdus
|
||||
#define stats_ibytes iu_pif.pif_ibytes
|
||||
#define stats_obytes iu_pif.pif_obytes
|
||||
#define stats_ierrors iu_pif.pif_ierrors
|
||||
#define stats_oerrors iu_pif.pif_oerrors
|
||||
#define stats_cmderrors iu_pif.pif_cmderrors
|
||||
|
||||
/*
|
||||
* Device VCC Entry
|
||||
*
|
||||
* Contains the common and IDT-specific information for each VCC
|
||||
* which is opened through an IDT device.
|
||||
*/
|
||||
struct nidt_vcc {
|
||||
struct cmn_vcc iv_cmn; /* Common VCC stuff */
|
||||
};
|
||||
|
||||
typedef struct nidt_vcc Idt_vcc;
|
||||
|
||||
extern int idt_sysctl_logvcs;
|
||||
extern int idt_sysctl_vbriscbr;
|
||||
|
||||
void nicstar_intr(void *);
|
||||
void phys_init(nicstar_reg_t * const);
|
||||
void nicstar_init(nicstar_reg_t * const);
|
||||
int idt_harp_init(nicstar_reg_t * const);
|
||||
void idt_device_stop(IDT *);
|
||||
void idt_release_mem(IDT *);
|
||||
|
||||
CONNECTION *idt_connect_find(IDT *, int, int);
|
||||
caddr_t idt_mbuf_base(struct mbuf *);
|
||||
int idt_slots_cbr(IDT *, int);
|
||||
|
||||
int idt_connect_opencls(IDT *, CONNECTION *, int);
|
||||
int idt_connect_txopen(IDT *, CONNECTION *);
|
||||
int idt_connect_txclose(IDT *, CONNECTION *);
|
||||
|
||||
int nicstar_eeprom_rd(nicstar_reg_t * const, u_long);
|
||||
|
||||
void idt_receive(IDT *, struct mbuf *, int, int);
|
||||
void idt_transmit(IDT *, struct mbuf *, int, int, int);
|
||||
|
|
@ -41,7 +41,6 @@ COMM= ${SYS}/dev/advansys/*.[ch] \
|
|||
${SYS}/kern/*.[ch] \
|
||||
${SYS}/net/*.[ch] \
|
||||
${SYS}/netatalk/*.[ch] \
|
||||
${SYS}/netatm/*.[ch] \
|
||||
${SYS}/netinet/*.[ch] \
|
||||
${SYS}/netinet6/*.[ch] \
|
||||
${SYS}/netipsec/*.[ch] \
|
||||
|
|
@ -60,7 +59,6 @@ COMMDIR1= ${SYS}/conf \
|
|||
${SYS}/kern \
|
||||
${SYS}/net \
|
||||
${SYS}/netatalk \
|
||||
${SYS}/netatm \
|
||||
${SYS}/netinet \
|
||||
${SYS}/netinet6 \
|
||||
${SYS}/netipsec \
|
||||
|
|
|
|||
|
|
@ -93,9 +93,7 @@ SUBDIR= ${_3dfx} \
|
|||
fxp \
|
||||
gem \
|
||||
geom \
|
||||
${_harp} \
|
||||
hatm \
|
||||
${_hfa} \
|
||||
hifn \
|
||||
hme \
|
||||
${_hptiop} \
|
||||
|
|
@ -106,7 +104,6 @@ SUBDIR= ${_3dfx} \
|
|||
${_ibcs2} \
|
||||
${_ichwd} \
|
||||
${_ida} \
|
||||
${_idt} \
|
||||
${_ie} \
|
||||
if_bridge \
|
||||
if_disc \
|
||||
|
|
@ -340,11 +337,6 @@ _vpo= vpo
|
|||
_ufs= ufs
|
||||
.endif
|
||||
|
||||
# Disabled in 7.0 as netatm is not MPSAFE.
|
||||
#if ${MK_ATM} != "no"
|
||||
#_harp= harp
|
||||
#.endif
|
||||
|
||||
.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
|
||||
.if exists(${.CURDIR}/../opencrypto)
|
||||
_crypto= crypto
|
||||
|
|
@ -405,8 +397,6 @@ _ep= ep
|
|||
_exca= exca
|
||||
_ext2fs= ext2fs
|
||||
_fe= fe
|
||||
# Disabled due to non-MPSAFEty in 7.0
|
||||
#_hfa= hfa
|
||||
_i2c= i2c
|
||||
_ibcs2= ibcs2
|
||||
_ie= ie
|
||||
|
|
@ -476,8 +466,6 @@ _hptmv= hptmv
|
|||
_hptrr= hptrr
|
||||
_ichwd= ichwd
|
||||
_ida= ida
|
||||
# Disabled due to non-MPSAFEty in 7.0
|
||||
#_idt= idt
|
||||
_iir= iir
|
||||
_ipmi= ipmi
|
||||
_ips= ips
|
||||
|
|
@ -611,7 +599,6 @@ _em= em
|
|||
_ep= ep
|
||||
_exca= exca
|
||||
_fe= fe
|
||||
_hfa= hfa
|
||||
_igb= igb
|
||||
_iir= iir
|
||||
_mly= mly
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
# $FreeBSD$
|
||||
#
|
||||
# Author: Harti Brandt <brandt@fokus.gmd.de>
|
||||
#
|
||||
.PATH: ${.CURDIR}/../../dev/harp
|
||||
|
||||
KMOD= if_harp
|
||||
SRCS= if_harp.c device_if.h
|
||||
|
||||
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../include
|
||||
CFLAGS+= -DDEBUG -DINVARIANTS
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
# $FreeBSD$
|
||||
|
||||
SUBDIR= ${eisa} hfa pci ${sbus}
|
||||
|
||||
.ifdef notyet
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
eisa= eisa
|
||||
.endif
|
||||
|
||||
.if ${MACHINE} == "sparc64"
|
||||
sbus= sbus
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# $FreeBSD$
|
||||
|
||||
.include "../Makefile.inc"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/hfa
|
||||
|
||||
KMOD= hfa_eisa
|
||||
SRCS= hfa_eisa.c eisa_if.h device_if.h bus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/hfa
|
||||
|
||||
KMOD= hfa
|
||||
SRCS= hfa_freebsd.c \
|
||||
fore_buffer.c fore_init.c fore_receive.c fore_vcm.c \
|
||||
fore_command.c fore_intr.c fore_stats.c \
|
||||
fore_globals.c fore_timer.c \
|
||||
fore_if.c fore_output.c fore_transmit.c \
|
||||
device_if.h bus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/hfa
|
||||
|
||||
KMOD= hfa_pci
|
||||
SRCS= hfa_pci.c pci_if.h device_if.h bus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/hfa
|
||||
|
||||
KMOD= hfa_sbus
|
||||
SRCS= hfa_sbus.c device_if.h bus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../dev/idt
|
||||
|
||||
KMOD= idt
|
||||
SRCS= idt_pci.c idt_harp.c idt.c
|
||||
SRCS+= pci_if.h device_if.h bus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
|
@ -8,7 +8,4 @@ SUBDIR= \
|
|||
sscop \
|
||||
uni
|
||||
|
||||
# atmpif disabled due to non-MPSAFEty in 7.0
|
||||
# atmpif \
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
# $FreeBSD$
|
||||
#
|
||||
# Author: Harti Brandt <harti@freebsd.org>
|
||||
#
|
||||
.PATH: ${.CURDIR}/../../../../netgraph/atm/atmpif
|
||||
|
||||
KMOD= ng_atmpif
|
||||
SRCS= ng_atmpif.c ng_atmpif_harp.c
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
649
sys/netatm/atm.h
649
sys/netatm/atm.h
|
|
@ -1,649 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Core ATM Services
|
||||
* -----------------
|
||||
*
|
||||
* ATM address family definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _NETATM_ATM_H
|
||||
#define _NETATM_ATM_H
|
||||
|
||||
|
||||
/*
|
||||
* The definitions in this file are intended to conform to the
|
||||
* specifications defined in:
|
||||
*
|
||||
* The Open Group, Networking Services (XNS) Issue 5
|
||||
*
|
||||
* ATM Transport Protocol Information for Sockets
|
||||
*
|
||||
* which is Copyright (c) 1997, The Open Group.
|
||||
*
|
||||
* All extensions contained in this file to the base specification
|
||||
* are denoted with a comment string of "XNS_EXT".
|
||||
*/
|
||||
|
||||
/*
|
||||
* ATM socket protocols
|
||||
*/
|
||||
#define ATM_PROTO_AAL5 0x5301 /* AAL type 5 protocol */
|
||||
#define ATM_PROTO_SSCOP 0x5302 /* SSCOP protocol */
|
||||
|
||||
|
||||
/*
|
||||
* ATM address defintions
|
||||
*/
|
||||
/*
|
||||
* General format of an ATM address
|
||||
*/
|
||||
#define ATM_ADDR_LEN 20 /* Size of address field (XNS_EXT) */
|
||||
|
||||
struct t_atm_addr {
|
||||
int8_t address_format; /* Address format (see below) */
|
||||
u_int8_t address_length; /* Length of address field */
|
||||
u_int8_t address[ATM_ADDR_LEN]; /* Address field */
|
||||
};
|
||||
typedef struct t_atm_addr Atm_addr; /* XNS_EXT */
|
||||
|
||||
/*
|
||||
* ATM address formats
|
||||
*/
|
||||
#define T_ATM_ABSENT (-1) /* No address present */
|
||||
#define T_ATM_ENDSYS_ADDR 1 /* ATM Endsystem */
|
||||
#define T_ATM_NSAP_ADDR 1 /* NSAP */
|
||||
#define T_ATM_E164_ADDR 2 /* E.164 */
|
||||
#define T_ATM_SPANS_ADDR 3 /* FORE SPANS (XNS_EXT) */
|
||||
#define T_ATM_PVC_ADDR 4 /* PVC (VPI,VCI) (XNS_EXT) */
|
||||
|
||||
/*
|
||||
* ATM Endsystem / NSAP address format
|
||||
*/
|
||||
struct atm_addr_nsap { /* XNS_EXT */
|
||||
u_char aan_afi; /* Authority and Format Identifier */
|
||||
/* (see below) */
|
||||
u_char aan_afspec[12]; /* AFI specific fields */
|
||||
u_char aan_esi[6]; /* End System Identifier */
|
||||
u_char aan_sel; /* Selector */
|
||||
};
|
||||
typedef struct atm_addr_nsap Atm_addr_nsap;
|
||||
|
||||
/*
|
||||
* AFI codes
|
||||
*/
|
||||
#define AFI_DCC 0x39 /* DCC ATM Format (XNS_EXT) */
|
||||
#define AFI_ICD 0x47 /* ICD ATM Format (XNS_EXT) */
|
||||
#define AFI_E164 0x45 /* E.164 ATM Format (XNS_EXT) */
|
||||
|
||||
/*
|
||||
* E.164 address format
|
||||
*/
|
||||
struct atm_addr_e164 { /* XNS_EXT */
|
||||
u_char aae_addr[15]; /* E.164 address */
|
||||
};
|
||||
typedef struct atm_addr_e164 Atm_addr_e164;
|
||||
|
||||
/*
|
||||
* SPANS address format
|
||||
*/
|
||||
struct atm_addr_spans { /* XNS_EXT */
|
||||
u_char aas_addr[8]; /* See SPANS code for specific fields */
|
||||
};
|
||||
typedef struct atm_addr_spans Atm_addr_spans;
|
||||
|
||||
/*
|
||||
* PVC address format
|
||||
*/
|
||||
struct atm_addr_pvc { /* XNS_EXT */
|
||||
u_int8_t aap_vpi[2]; /* VPI */
|
||||
u_int8_t aap_vci[2]; /* VCI */
|
||||
};
|
||||
typedef struct atm_addr_pvc Atm_addr_pvc;
|
||||
|
||||
#define ATM_PVC_GET_VPI(addr) /* XNS_EXT */ \
|
||||
((u_int16_t)(((addr)->aap_vpi[0] << 8) | (addr)->aap_vpi[1]))
|
||||
#define ATM_PVC_GET_VCI(addr) /* XNS_EXT */ \
|
||||
((u_int16_t)(((addr)->aap_vci[0] << 8) | (addr)->aap_vci[1]))
|
||||
#define ATM_PVC_SET_VPI(addr,vpi) { /* XNS_EXT */ \
|
||||
(addr)->aap_vpi[0] = ((vpi) >> 8) & 0xff; \
|
||||
(addr)->aap_vpi[1] = (vpi) & 0xff; \
|
||||
}
|
||||
#define ATM_PVC_SET_VCI(addr,vci) { /* XNS_EXT */ \
|
||||
(addr)->aap_vci[0] = ((vci) >> 8) & 0xff; \
|
||||
(addr)->aap_vci[1] = (vci) & 0xff; \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ATM service access point (SAP)
|
||||
*
|
||||
* A SAP address consists of SAP Vector Elements (SVE). Each SVE consists
|
||||
* of the following fields:
|
||||
* o tag - defines the interpretation of the SVE;
|
||||
* o length - the length of the SVE value field;
|
||||
* o value - the value associated with the SVE;
|
||||
*
|
||||
* All of the possible SAP field values are either defined below
|
||||
* or in the corresponding option value definitions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ATM Address and Selector SVE
|
||||
*/
|
||||
struct t_atm_sap_addr {
|
||||
int8_t SVE_tag_addr; /* SVE tag (address) */
|
||||
int8_t SVE_tag_selector; /* SVE tag (selector) */
|
||||
/* Address/selector value */
|
||||
int8_t address_format; /* Address format */
|
||||
u_int8_t address_length; /* Length of address field */
|
||||
u_int8_t address[ATM_ADDR_LEN]; /* Address field */
|
||||
};
|
||||
|
||||
/*
|
||||
* B-LLI Layer 2 SVE
|
||||
*/
|
||||
struct t_atm_sap_layer2 {
|
||||
int8_t SVE_tag; /* SVE tag */
|
||||
u_int8_t ID_type; /* Layer 2 protocol discriminator */
|
||||
union { /* Layer 2 protocol */
|
||||
u_int8_t simple_ID; /* ITU */
|
||||
u_int8_t user_defined_ID;/* User-defined */
|
||||
} ID;
|
||||
};
|
||||
|
||||
/*
|
||||
* B-LLI Layer 3 SVE
|
||||
*/
|
||||
struct t_atm_sap_layer3 {
|
||||
int8_t SVE_tag; /* SVE tag */
|
||||
u_int8_t ID_type; /* Layer 3 protocol discriminator */
|
||||
union { /* Layer 3 protocol */
|
||||
u_int8_t simple_ID; /* ITU */
|
||||
u_int8_t IPI_ID; /* ISO IPI */
|
||||
struct { /* IEEE 802.1 SNAP ID */
|
||||
u_int8_t OUI[3];
|
||||
u_int8_t PID[2];
|
||||
} SNAP_ID;
|
||||
u_int8_t user_defined_ID;/* User-defined */
|
||||
} ID;
|
||||
};
|
||||
|
||||
/*
|
||||
* B_HLI SVE
|
||||
*/
|
||||
struct t_atm_sap_appl {
|
||||
int8_t SVE_tag; /* SVE tag */
|
||||
u_int8_t ID_type; /* High Layer type discriminator */
|
||||
union { /* High Layer type */
|
||||
u_int8_t ISO_ID[8]; /* ISO */
|
||||
struct { /* Vendor-specific */
|
||||
u_int8_t OUI[3];
|
||||
u_int8_t app_ID[4];
|
||||
} vendor_ID;
|
||||
u_int8_t user_defined_ID[8];/* User-defined */
|
||||
} ID;
|
||||
};
|
||||
|
||||
/*
|
||||
* ATM SAP (protocol) address structure
|
||||
*/
|
||||
struct t_atm_sap {
|
||||
struct t_atm_sap_addr t_atm_sap_addr;
|
||||
struct t_atm_sap_layer2 t_atm_sap_layer2;
|
||||
struct t_atm_sap_layer3 t_atm_sap_layer3;
|
||||
struct t_atm_sap_appl t_atm_sap_appl;
|
||||
};
|
||||
|
||||
/*
|
||||
* SVE Tag values
|
||||
*/
|
||||
#define T_ATM_ABSENT (-1) /* Value field invalid; match none */
|
||||
#define T_ATM_PRESENT (-2) /* Value field valid; match value */
|
||||
#define T_ATM_ANY (-3) /* Value field invalid; match any */
|
||||
|
||||
|
||||
/*
|
||||
* ATM socket address
|
||||
*/
|
||||
struct sockaddr_atm { /* XNS_EXT */
|
||||
u_char satm_len; /* Length of socket structure */
|
||||
u_char satm_family; /* Address family */
|
||||
struct t_atm_sap satm_addr; /* Protocol address */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* ATM socket options for use with [gs]etsockopt()
|
||||
*/
|
||||
#define T_ATM_SIGNALING 0x5301 /* Option level */
|
||||
|
||||
#define T_ATM_AAL5 1 /* ATM adaptation layer 5 */
|
||||
#define T_ATM_TRAFFIC 2 /* ATM traffic descriptor */
|
||||
#define T_ATM_BEARER_CAP 3 /* ATM service capabilities */
|
||||
#define T_ATM_BHLI 4 /* Higher-layer protocol */
|
||||
#define T_ATM_BLLI 5 /* Lower-layer protocol */
|
||||
#define T_ATM_DEST_ADDR 6 /* Call responder's address */
|
||||
#define T_ATM_DEST_SUB 7 /* Call responder's subaddress */
|
||||
#define T_ATM_ORIG_ADDR 8 /* Call initiator's address */
|
||||
#define T_ATM_ORIG_SUB 9 /* Call initiator's subaddress */
|
||||
#define T_ATM_CALLER_ID 10 /* Caller's ID attributes */
|
||||
#define T_ATM_CAUSE 11 /* Cause of disconection */
|
||||
#define T_ATM_QOS 12 /* Quality of service */
|
||||
#define T_ATM_TRANSIT 13 /* Choice of public carrier */
|
||||
#define T_ATM_ADD_LEAF 14 /* Add leaf to connection */
|
||||
#define T_ATM_DROP_LEAF 15 /* Remove leaf from connection */
|
||||
#define T_ATM_LEAF_IND 16 /* Indication of leaf status */
|
||||
#define T_ATM_NET_INTF 17 /* Network interface XNS_EXT */
|
||||
#define T_ATM_LLC 18 /* LLC multiplexing XNS_EXT */
|
||||
#define T_ATM_APP_NAME 19 /* Application name XNS_EXT */
|
||||
|
||||
|
||||
/*
|
||||
* Common socket option values
|
||||
*
|
||||
* See API specification for individual option applicability/meaning
|
||||
*/
|
||||
#define T_ATM_ABSENT (-1) /* No option value present */
|
||||
#define T_ATM_NULL 0 /* Option value is null */
|
||||
#define T_NO 0 /* Option is not requested */
|
||||
#define T_YES 1 /* Option is requested */
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_AAL5 option value structure
|
||||
*/
|
||||
struct t_atm_aal5 {
|
||||
int32_t forward_max_SDU_size;
|
||||
int32_t backward_max_SDU_size;
|
||||
int32_t SSCS_type;
|
||||
};
|
||||
|
||||
/*
|
||||
* T_ATM_AAL5 option values
|
||||
*/
|
||||
/* SSCS_type */
|
||||
#define T_ATM_SSCS_SSCOP_REL 1 /* SSCOP assured operation */
|
||||
#define T_ATM_SSCS_SSCOP_UNREL 2 /* SSCOP non-assured operation */
|
||||
#define T_ATM_SSCS_FR 4 /* Frame relay */
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_TRAFFIC option value structure
|
||||
*/
|
||||
struct t_atm_traffic_substruct {
|
||||
int32_t PCR_high_priority;
|
||||
int32_t PCR_all_traffic;
|
||||
int32_t SCR_high_priority;
|
||||
int32_t SCR_all_traffic;
|
||||
int32_t MBS_high_priority;
|
||||
int32_t MBS_all_traffic;
|
||||
int32_t tagging;
|
||||
};
|
||||
|
||||
struct t_atm_traffic {
|
||||
struct t_atm_traffic_substruct forward;
|
||||
struct t_atm_traffic_substruct backward;
|
||||
u_int8_t best_effort;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_BEARER_CAP option value structure
|
||||
*/
|
||||
struct t_atm_bearer {
|
||||
u_int8_t bearer_class;
|
||||
u_int8_t traffic_type;
|
||||
u_int8_t timing_requirements;
|
||||
u_int8_t clipping_susceptibility;
|
||||
u_int8_t connection_configuration;
|
||||
};
|
||||
|
||||
/*
|
||||
* T_ATM_BEARER_CAP option values
|
||||
*/
|
||||
/* bearer_class */
|
||||
#define T_ATM_CLASS_A 0x01 /* Bearer class A */
|
||||
#define T_ATM_CLASS_C 0x03 /* Bearer class C */
|
||||
#define T_ATM_CLASS_X 0x10 /* Bearer class X */
|
||||
|
||||
/* traffic_type */
|
||||
#define T_ATM_CBR 0x01 /* Constant bit rate */
|
||||
#define T_ATM_VBR 0x02 /* Variable bit rate */
|
||||
#define T_ATM_ABR 0x03 /* Available Bit Rate */
|
||||
#define T_ATM_UBR 0x04 /* Unspecified bit rate */
|
||||
|
||||
/* timing_requirements */
|
||||
#define T_ATM_END_TO_END 0x01 /* End-to-end timing required */
|
||||
#define T_ATM_NO_END_TO_END 0x02 /* End-to-end timing not required */
|
||||
|
||||
/* connection_configuration */
|
||||
#define T_ATM_1_TO_1 0x00 /* Point-to-point connection */
|
||||
#define T_ATM_1_TO_MANY 0x01 /* Point-to-multipoint connection */
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_BHLI option value structure
|
||||
*/
|
||||
struct t_atm_bhli {
|
||||
int32_t ID_type;
|
||||
union {
|
||||
u_int8_t ISO_ID[8];
|
||||
struct {
|
||||
u_int8_t OUI[3];
|
||||
u_int8_t app_ID[4];
|
||||
} vendor_ID;
|
||||
u_int8_t user_defined_ID[8];
|
||||
} ID;
|
||||
};
|
||||
|
||||
/*
|
||||
* T_ATM_BHLI option values
|
||||
*/
|
||||
/* ID_type */
|
||||
#define T_ATM_ISO_APP_ID 0 /* ISO codepoint */
|
||||
#define T_ATM_USER_APP_ID 1 /* User-specific codepoint */
|
||||
#define T_ATM_VENDOR_APP_ID 3 /* Vendor-specific codepoint */
|
||||
|
||||
/*
|
||||
* T_ATM_BLLI option value structure
|
||||
*/
|
||||
struct t_atm_blli {
|
||||
struct {
|
||||
int8_t ID_type;
|
||||
union {
|
||||
u_int8_t simple_ID;
|
||||
u_int8_t user_defined_ID;
|
||||
} ID;
|
||||
int8_t mode;
|
||||
int8_t window_size;
|
||||
} layer_2_protocol;
|
||||
struct {
|
||||
int8_t ID_type;
|
||||
union {
|
||||
u_int8_t simple_ID;
|
||||
int32_t IPI_ID;
|
||||
struct {
|
||||
u_int8_t OUI[3];
|
||||
u_int8_t PID[2];
|
||||
} SNAP_ID;
|
||||
u_int8_t user_defined_ID;
|
||||
} ID;
|
||||
int8_t mode;
|
||||
int8_t packet_size;
|
||||
int8_t window_size;
|
||||
} layer_3_protocol;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_BLLI option values
|
||||
*/
|
||||
/* layer_[23]_protocol.ID_type */
|
||||
#define T_ATM_SIMPLE_ID 1 /* ID via ITU encoding */
|
||||
#define T_ATM_IPI_ID 2 /* ID via ISO/IEC TR 9577 */
|
||||
#define T_ATM_SNAP_ID 3 /* ID via SNAP */
|
||||
#define T_ATM_USER_ID 4 /* ID via user codepoints */
|
||||
|
||||
/* layer_[23]_protocol.mode */
|
||||
#define T_ATM_BLLI_NORMAL_MODE 1
|
||||
#define T_ATM_BLLI_EXTENDED_MODE 2
|
||||
|
||||
/* layer_2_protocol.simple_ID */
|
||||
#define T_ATM_BLLI2_I1745 1 /* I.1745 */
|
||||
#define T_ATM_BLLI2_Q921 2 /* Q.921 */
|
||||
#define T_ATM_BLLI2_X25_LINK 6 /* X.25, link layer */
|
||||
#define T_ATM_BLLI2_X25_MLINK 7 /* X.25, multilink */
|
||||
#define T_ATM_BLLI2_LAPB 8 /* Extended LAPB */
|
||||
#define T_ATM_BLLI2_HDLC_ARM 9 /* I.4335, ARM */
|
||||
#define T_ATM_BLLI2_HDLC_NRM 10 /* I.4335, NRM */
|
||||
#define T_ATM_BLLI2_HDLC_ABM 11 /* I.4335, ABM */
|
||||
#define T_ATM_BLLI2_I8802 12 /* I.8802 */
|
||||
#define T_ATM_BLLI2_X75 13 /* X.75 */
|
||||
#define T_ATM_BLLI2_Q922 14 /* Q.922 */
|
||||
#define T_ATM_BLLI2_I7776 17 /* I.7776 */
|
||||
|
||||
/* layer_3_protocol.simple_ID */
|
||||
#define T_ATM_BLLI3_X25 6 /* X.25 */
|
||||
#define T_ATM_BLLI3_I8208 7 /* I.8208 */
|
||||
#define T_ATM_BLLI3_X223 8 /* X.223 */
|
||||
#define T_ATM_BLLI3_I8473 9 /* I.8473 */
|
||||
#define T_ATM_BLLI3_T70 10 /* T.70 */
|
||||
#define T_ATM_BLLI3_I9577 11 /* I.9577 */
|
||||
|
||||
/* layer_3_protocol.packet_size */
|
||||
#define T_ATM_PACKET_SIZE_16 4
|
||||
#define T_ATM_PACKET_SIZE_32 5
|
||||
#define T_ATM_PACKET_SIZE_64 6
|
||||
#define T_ATM_PACKET_SIZE_128 7
|
||||
#define T_ATM_PACKET_SIZE_256 8
|
||||
#define T_ATM_PACKET_SIZE_512 9
|
||||
#define T_ATM_PACKET_SIZE_1024 10
|
||||
#define T_ATM_PACKET_SIZE_2048 11
|
||||
#define T_ATM_PACKET_SIZE_4096 12
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_CALLER_ID option value structure
|
||||
*/
|
||||
struct t_atm_caller_id {
|
||||
int8_t presentation;
|
||||
u_int8_t screening;
|
||||
};
|
||||
|
||||
/*
|
||||
* T_ATM_CALLER_ID option values
|
||||
*/
|
||||
/* presentation */
|
||||
#define T_ATM_PRES_ALLOWED 0
|
||||
#define T_ATM_PRES_RESTRICTED 1
|
||||
#define T_ATM_PRES_UNAVAILABLE 2
|
||||
/* screening */
|
||||
#define T_ATM_USER_ID_NOT_SCREENED 0
|
||||
#define T_ATM_USER_ID_PASSED_SCREEN 1
|
||||
#define T_ATM_USER_ID_FAILED_SCREEN 2
|
||||
#define T_ATM_NETWORK_PROVIDED_ID 3
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_CAUSE option value structure
|
||||
*/
|
||||
struct t_atm_cause {
|
||||
int8_t coding_standard;
|
||||
u_int8_t location;
|
||||
u_int8_t cause_value;
|
||||
u_int8_t diagnostics[4];
|
||||
};
|
||||
|
||||
/*
|
||||
* T_ATM_CAUSE option values
|
||||
*/
|
||||
/* coding_standard */
|
||||
#define T_ATM_ITU_CODING 0
|
||||
#define T_ATM_NETWORK_CODING 3
|
||||
|
||||
/* location */
|
||||
#define T_ATM_LOC_USER 0
|
||||
#define T_ATM_LOC_LOCAL_PRIVATE_NET 1
|
||||
#define T_ATM_LOC_LOCAL_PUBLIC_NET 2
|
||||
#define T_ATM_LOC_TRANSIT_NET 3
|
||||
#define T_ATM_LOC_REMOTE_PUBLIC_NET 4
|
||||
#define T_ATM_LOC_REMOTE_PRIVATE_NET 5
|
||||
#define T_ATM_LOC_INTERNATIONAL_NET 7
|
||||
#define T_ATM_LOC_BEYOND_INTERWORKING 10
|
||||
|
||||
/* cause_value */
|
||||
#define T_ATM_CAUSE_UNALLOCATED_NUMBER 1
|
||||
#define T_ATM_CAUSE_NO_ROUTE_TO_TRANSIT_NETWORK 2
|
||||
#define T_ATM_CAUSE_NO_ROUTE_TO_DESTINATION 3
|
||||
#define T_ATM_CAUSE_NORMAL_CALL_CLEARING 16
|
||||
#define T_ATM_CAUSE_USER_BUSY 17
|
||||
#define T_ATM_CAUSE_NO_USER_RESPONDING 18
|
||||
#define T_ATM_CAUSE_CALL_REJECTED 21
|
||||
#define T_ATM_CAUSE_NUMBER_CHANGED 22
|
||||
#define T_ATM_CAUSE_ALL_CALLS_WITHOUT_CALLER_ID_REJECTED 23
|
||||
#define T_ATM_CAUSE_DESTINATION_OUT_OF_ORDER 27
|
||||
#define T_ATM_CAUSE_INVALID_NUMBER_FORMAT 28
|
||||
#define T_ATM_CAUSE_RESPONSE_TO_STATUS_ENQUIRY 30
|
||||
#define T_ATM_CAUSE_UNSPECIFIED_NORMAL 31
|
||||
#define T_ATM_CAUSE_REQUESTED_VPCI_VCI_NOT_AVAILABLE 35
|
||||
#define T_ATM_CAUSE_VPCI_VCI_ASSIGNMENT_FAILURE 36
|
||||
#define T_ATM_CAUSE_USER_CELL_RATE_NOT_AVAILABLE 37
|
||||
#define T_ATM_CAUSE_NETWORK_OUT_OF_ORDER 38
|
||||
#define T_ATM_CAUSE_TEMPORARY_FAILURE 41
|
||||
#define T_ATM_CAUSE_ACCESS_INFO_DISCARDED 43
|
||||
#define T_ATM_CAUSE_NO_VPCI_VCI_AVAILABLE 45
|
||||
#define T_ATM_CAUSE_UNSPECIFIED_RESOURCE_UNAVAILABLE 47
|
||||
#define T_ATM_CAUSE_QUALITY_OF_SERVICE_UNAVAILABLE 49
|
||||
#define T_ATM_CAUSE_BEARER_CAPABILITY_NOT_AUTHORIZED 57
|
||||
#define T_ATM_CAUSE_BEARER_CAPABILITY_UNAVAILABLE 58
|
||||
#define T_ATM_CAUSE_SERVICE_OR_OPTION_UNAVAILABLE 63
|
||||
#define T_ATM_CAUSE_BEARER_CAPABILITY_NOT_IMPLEMENTED 65
|
||||
#define T_ATM_CAUSE_INVALID_TRAFFIC_PARAMETERS 73
|
||||
#define T_ATM_CAUSE_AAL_PARAMETERS_NOT_SUPPORTED 78
|
||||
#define T_ATM_CAUSE_INVALID_CALL_REFERENCE_VALUE 81
|
||||
#define T_ATM_CAUSE_IDENTIFIED_CHANNEL_DOES_NOT_EXIST 82
|
||||
#define T_ATM_CAUSE_INCOMPATIBLE_DESTINATION 88
|
||||
#define T_ATM_CAUSE_INVALID_ENDPOINT_REFERENCE 89
|
||||
#define T_ATM_CAUSE_INVALID_TRANSIT_NETWORK_SELECTION 91
|
||||
#define T_ATM_CAUSE_TOO_MANY_PENDING_ADD_PARTY_REQUESTS 92
|
||||
#define T_ATM_CAUSE_MANDITORY_INFO_ELEMENT_MISSING 96
|
||||
#define T_ATM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED 97
|
||||
#define T_ATM_CAUSE_INFO_ELEMENT_NOT_IMPLEMENTED 99
|
||||
#define T_ATM_CAUSE_INVALID_INFO_ELEMENT_CONTENTS 100
|
||||
#define T_ATM_CAUSE_MESSAGE_INCOMPATIBLE_WITH_CALL_STATE 101
|
||||
#define T_ATM_CAUSE_RECOVERY_ON_TIMER_EXPIRY 102
|
||||
#define T_ATM_CAUSE_INCORRECT_MESSAGE_LENGTH 104
|
||||
#define T_ATM_CAUSE_UNSPECIFIED_PROTOCOL_ERROR 111
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_QOS option value structure
|
||||
*/
|
||||
struct t_atm_qos_substruct {
|
||||
int32_t qos_class;
|
||||
};
|
||||
|
||||
struct t_atm_qos {
|
||||
int8_t coding_standard;
|
||||
struct t_atm_qos_substruct forward;
|
||||
struct t_atm_qos_substruct backward;
|
||||
};
|
||||
|
||||
/*
|
||||
* T_ATM_QOS option values
|
||||
*/
|
||||
/* qos_class */
|
||||
#define T_ATM_QOS_CLASS_0 0
|
||||
#define T_ATM_QOS_CLASS_1 1
|
||||
#define T_ATM_QOS_CLASS_2 2
|
||||
#define T_ATM_QOS_CLASS_3 3
|
||||
#define T_ATM_QOS_CLASS_4 4
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_TRANSIT structure
|
||||
*/
|
||||
#define T_ATM_MAX_NET_ID 4 /* XNS_EXT */
|
||||
struct t_atm_transit {
|
||||
u_int8_t length;
|
||||
u_int8_t network_id[T_ATM_MAX_NET_ID];
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_ADD_LEAF option value structure
|
||||
*/
|
||||
struct t_atm_add_leaf {
|
||||
int32_t leaf_ID;
|
||||
struct t_atm_addr leaf_address;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* T_ATM_DROP_LEAF option value structure
|
||||
*/
|
||||
struct t_atm_drop_leaf {
|
||||
int32_t leaf_ID;
|
||||
int32_t reason;
|
||||
};
|
||||
|
||||
/*
|
||||
* T_ATM_LEAF_IND option value structure
|
||||
*/
|
||||
struct t_atm_leaf_ind {
|
||||
int32_t status;
|
||||
int32_t leaf_ID;
|
||||
int32_t reason;
|
||||
};
|
||||
|
||||
/*
|
||||
* T_ATM_LEAF_IND option values
|
||||
*/
|
||||
/* status */
|
||||
#define T_LEAF_NOCHANGE 0
|
||||
#define T_LEAF_CONNECTED 1
|
||||
#define T_LEAF_DISCONNECTED 2
|
||||
|
||||
/*
|
||||
* T_ATM_NET_INTF option value structure (XNS_EXT)
|
||||
*/
|
||||
struct t_atm_net_intf { /* XNS_EXT */
|
||||
char net_intf[IFNAMSIZ];
|
||||
};
|
||||
|
||||
/*
|
||||
* T_ATM_LLC option value structure (XNS_EXT)
|
||||
*/
|
||||
#define T_ATM_LLC_MIN_LEN 3
|
||||
#define T_ATM_LLC_MAX_LEN 8
|
||||
|
||||
struct t_atm_llc { /* XNS_EXT */
|
||||
u_int8_t flags; /* LLC flags (see below) */
|
||||
u_int8_t llc_len; /* Length of LLC information */
|
||||
u_int8_t llc_info[T_ATM_LLC_MAX_LEN]; /* LLC information */
|
||||
};
|
||||
|
||||
/*
|
||||
* T_ATM_LLC option values
|
||||
*/
|
||||
/* flags */
|
||||
#define T_ATM_LLC_SHARING 0x01 /* LLC sharing allowed */
|
||||
|
||||
/*
|
||||
* T_ATM_APP_NAME option value structure (XNS_EXT)
|
||||
*/
|
||||
#define T_ATM_APP_NAME_LEN 8
|
||||
struct t_atm_app_name { /* XNS_EXT */
|
||||
char app_name[T_ATM_APP_NAME_LEN];
|
||||
};
|
||||
|
||||
#endif /* _NETATM_ATM_H */
|
||||
|
|
@ -1,941 +0,0 @@
|
|||
/*-
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Core ATM Services
|
||||
* -----------------
|
||||
*
|
||||
* ATM AAL5 socket protocol processing
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sx.h>
|
||||
#include <sys/systm.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
u_long atm_aal5_sendspace = 64 * 1024; /* XXX */
|
||||
u_long atm_aal5_recvspace = 64 * 1024; /* XXX */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
static int atm_aal5_attach(struct socket *, int, struct thread *td);
|
||||
static void atm_aal5_detach(struct socket *);
|
||||
static int atm_aal5_bind(struct socket *, struct sockaddr *,
|
||||
struct thread *td);
|
||||
static int atm_aal5_listen(struct socket *, int backlog,
|
||||
struct thread *td);
|
||||
static int atm_aal5_connect(struct socket *, struct sockaddr *,
|
||||
struct thread *td);
|
||||
static int atm_aal5_accept(struct socket *, struct sockaddr **);
|
||||
static int atm_aal5_disconnect(struct socket *);
|
||||
static int atm_aal5_shutdown(struct socket *);
|
||||
static int atm_aal5_send(struct socket *, int, KBuffer *,
|
||||
struct sockaddr *, KBuffer *, struct thread *td);
|
||||
static void atm_aal5_abort(struct socket *);
|
||||
static int atm_aal5_control(struct socket *, u_long, caddr_t,
|
||||
struct ifnet *, struct thread *td);
|
||||
static int atm_aal5_sense(struct socket *, struct stat *);
|
||||
static int atm_aal5_sockaddr(struct socket *, struct sockaddr **);
|
||||
static int atm_aal5_peeraddr(struct socket *, struct sockaddr **);
|
||||
static int atm_aal5_incoming(void *, Atm_connection *,
|
||||
Atm_attributes *, void **);
|
||||
static void atm_aal5_cpcs_data(void *, KBuffer *);
|
||||
static caddr_t atm_aal5_getname(void *);
|
||||
static void atm_aal5_close(struct socket *);
|
||||
|
||||
|
||||
/*
|
||||
* New-style socket request routines
|
||||
*/
|
||||
struct pr_usrreqs atm_aal5_usrreqs = {
|
||||
.pru_abort = atm_aal5_abort,
|
||||
.pru_accept = atm_aal5_accept,
|
||||
.pru_attach = atm_aal5_attach,
|
||||
.pru_bind = atm_aal5_bind,
|
||||
.pru_connect = atm_aal5_connect,
|
||||
.pru_control = atm_aal5_control,
|
||||
.pru_detach = atm_aal5_detach,
|
||||
.pru_disconnect = atm_aal5_disconnect,
|
||||
.pru_listen = atm_aal5_listen,
|
||||
.pru_peeraddr = atm_aal5_peeraddr,
|
||||
.pru_send = atm_aal5_send,
|
||||
.pru_sense = atm_aal5_sense,
|
||||
.pru_shutdown = atm_aal5_shutdown,
|
||||
.pru_sockaddr = atm_aal5_sockaddr,
|
||||
.pru_close = atm_aal5_close,
|
||||
};
|
||||
|
||||
/*
|
||||
* Local variables
|
||||
*/
|
||||
static Atm_endpoint atm_aal5_endpt = {
|
||||
NULL,
|
||||
ENDPT_SOCK_AAL5,
|
||||
NULL,
|
||||
atm_aal5_getname,
|
||||
atm_sock_connected,
|
||||
atm_sock_cleared,
|
||||
atm_aal5_incoming,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
atm_aal5_cpcs_data,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static Atm_attributes atm_aal5_defattr = {
|
||||
NULL, /* nif */
|
||||
CMAPI_CPCS, /* api */
|
||||
0, /* api_init */
|
||||
0, /* headin */
|
||||
0, /* headout */
|
||||
{ /* aal */
|
||||
T_ATM_PRESENT,
|
||||
ATM_AAL5
|
||||
},
|
||||
{ /* traffic */
|
||||
T_ATM_ABSENT,
|
||||
},
|
||||
{ /* bearer */
|
||||
T_ATM_ABSENT,
|
||||
},
|
||||
{ /* bhli */
|
||||
T_ATM_ABSENT
|
||||
},
|
||||
{ /* blli */
|
||||
T_ATM_ABSENT,
|
||||
T_ATM_ABSENT,
|
||||
},
|
||||
{ /* llc */
|
||||
T_ATM_ABSENT,
|
||||
},
|
||||
{ /* called */
|
||||
T_ATM_ABSENT,
|
||||
{
|
||||
T_ATM_ABSENT,
|
||||
0
|
||||
},
|
||||
{
|
||||
T_ATM_ABSENT,
|
||||
0
|
||||
}
|
||||
},
|
||||
{ /* calling */
|
||||
T_ATM_ABSENT
|
||||
},
|
||||
{ /* qos */
|
||||
T_ATM_ABSENT,
|
||||
},
|
||||
{ /* transit */
|
||||
T_ATM_ABSENT
|
||||
},
|
||||
{ /* cause */
|
||||
T_ATM_ABSENT
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Handy common code macros
|
||||
*/
|
||||
#ifdef DIAGNOSTIC
|
||||
#define ATM_INTRO(f) \
|
||||
int s, err = 0; \
|
||||
s = splnet(); \
|
||||
ATM_DEBUG2("aal5 socket %s (%p)\n", f, so); \
|
||||
/* \
|
||||
* Stack queue should have been drained \
|
||||
*/ \
|
||||
if (atm_stackq_head != NULL) \
|
||||
panic("atm_aal5: stack queue not empty"); \
|
||||
;
|
||||
#else /* !DIAGNOSTIC */
|
||||
#define ATM_INTRO(f) \
|
||||
int s, err = 0; \
|
||||
s = splnet(); \
|
||||
;
|
||||
#endif /* DIAGNOSTIC */
|
||||
|
||||
#define ATM_INTRO_NOERR(f) \
|
||||
int s; \
|
||||
s = splnet(); \
|
||||
;
|
||||
|
||||
#define ATM_OUTRO() \
|
||||
/* \
|
||||
* Drain any deferred calls \
|
||||
*/ \
|
||||
STACK_DRAIN(); \
|
||||
(void) splx(s); \
|
||||
return (err); \
|
||||
;
|
||||
|
||||
#define ATM_OUTRO_NOERR() \
|
||||
/* \
|
||||
* Drain any deferred calls \
|
||||
*/ \
|
||||
STACK_DRAIN(); \
|
||||
(void) splx(s); \
|
||||
;
|
||||
|
||||
#define ATM_RETERR(errno) { \
|
||||
err = errno; \
|
||||
goto out; \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Attach protocol to socket
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* proto protocol identifier
|
||||
* p pointer to process
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_attach(so, proto, td)
|
||||
struct socket *so;
|
||||
int proto;
|
||||
struct thread *td;
|
||||
{
|
||||
Atm_pcb *atp;
|
||||
|
||||
ATM_INTRO("attach");
|
||||
|
||||
/*
|
||||
* Do general attach stuff
|
||||
*/
|
||||
err = atm_sock_attach(so, atm_aal5_sendspace, atm_aal5_recvspace);
|
||||
if (err)
|
||||
ATM_RETERR(err);
|
||||
|
||||
/*
|
||||
* Finish up any protocol specific stuff
|
||||
*/
|
||||
atp = sotoatmpcb(so);
|
||||
atp->atp_type = ATPT_AAL5;
|
||||
|
||||
/*
|
||||
* Set default connection attributes
|
||||
*/
|
||||
atp->atp_attr = atm_aal5_defattr;
|
||||
strncpy(atp->atp_name, "(AAL5)", T_ATM_APP_NAME_LEN);
|
||||
|
||||
out:
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Detach protocol from socket
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static void
|
||||
atm_aal5_detach(so)
|
||||
struct socket *so;
|
||||
{
|
||||
ATM_INTRO_NOERR("detach");
|
||||
|
||||
atm_sock_detach(so);
|
||||
|
||||
ATM_OUTRO_NOERR();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Bind address to socket
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* addr pointer to protocol address
|
||||
* p pointer to process
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_bind(so, addr, td)
|
||||
struct socket *so;
|
||||
struct sockaddr *addr;
|
||||
struct thread *td;
|
||||
{
|
||||
ATM_INTRO("bind");
|
||||
|
||||
err = atm_sock_bind(so, addr);
|
||||
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Listen for incoming connections
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* p pointer to process
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_listen(so, backlog, td)
|
||||
struct socket *so;
|
||||
int backlog;
|
||||
struct thread *td;
|
||||
{
|
||||
ATM_INTRO("listen");
|
||||
|
||||
err = atm_sock_listen(so, &atm_aal5_endpt, backlog);
|
||||
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Connect socket to peer
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* addr pointer to protocol address
|
||||
* p pointer to process
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_connect(so, addr, td)
|
||||
struct socket *so;
|
||||
struct sockaddr *addr;
|
||||
struct thread *td;
|
||||
{
|
||||
Atm_pcb *atp;
|
||||
|
||||
ATM_INTRO("connect");
|
||||
|
||||
atp = sotoatmpcb(so);
|
||||
|
||||
/*
|
||||
* Resize send socket buffer to maximum sdu size
|
||||
*/
|
||||
if (atp->atp_attr.aal.tag == T_ATM_PRESENT) {
|
||||
long size;
|
||||
|
||||
size = atp->atp_attr.aal.v.aal5.forward_max_SDU_size;
|
||||
if (size != T_ATM_ABSENT)
|
||||
if (!sbreserve(&so->so_snd, size, so, td)) {
|
||||
err = ENOBUFS;
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Now get the socket connected
|
||||
*/
|
||||
err = atm_sock_connect(so, addr, &atm_aal5_endpt);
|
||||
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Accept pending connection
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* addr pointer to pointer to contain protocol address
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_accept(so, addr)
|
||||
struct socket *so;
|
||||
struct sockaddr **addr;
|
||||
{
|
||||
ATM_INTRO("accept");
|
||||
|
||||
/*
|
||||
* Everything is pretty much done already, we just need to
|
||||
* return the caller's address to the user.
|
||||
*/
|
||||
err = atm_sock_peeraddr(so, addr);
|
||||
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Disconnect connected socket
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_disconnect(so)
|
||||
struct socket *so;
|
||||
{
|
||||
ATM_INTRO("disconnect");
|
||||
|
||||
err = atm_sock_disconnect(so);
|
||||
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Shut down socket data transmission
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_shutdown(so)
|
||||
struct socket *so;
|
||||
{
|
||||
ATM_INTRO("shutdown");
|
||||
|
||||
socantsendmore(so);
|
||||
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Send user data
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* flags send data flags
|
||||
* m pointer to buffer containing user data
|
||||
* addr pointer to protocol address
|
||||
* control pointer to buffer containing protocol control data
|
||||
* p pointer to process
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_send(so, flags, m, addr, control, td)
|
||||
struct socket *so;
|
||||
int flags;
|
||||
KBuffer *m;
|
||||
struct sockaddr *addr;
|
||||
KBuffer *control;
|
||||
struct thread *td;
|
||||
{
|
||||
Atm_pcb *atp;
|
||||
|
||||
ATM_INTRO("send");
|
||||
|
||||
/*
|
||||
* We don't support any control functions
|
||||
*/
|
||||
if (control) {
|
||||
int clen;
|
||||
|
||||
clen = KB_LEN(control);
|
||||
KB_FREEALL(control);
|
||||
if (clen) {
|
||||
KB_FREEALL(m);
|
||||
ATM_RETERR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We also don't support any flags or send-level addressing
|
||||
*/
|
||||
if (flags || addr) {
|
||||
KB_FREEALL(m);
|
||||
ATM_RETERR(EINVAL);
|
||||
}
|
||||
|
||||
/*
|
||||
* All we've got left is the data, so push it out
|
||||
*/
|
||||
atp = sotoatmpcb(so);
|
||||
err = atm_cm_cpcs_data(atp->atp_conn, m);
|
||||
if (err) {
|
||||
/*
|
||||
* Output problem, drop packet
|
||||
*/
|
||||
atm_sock_stat.as_outdrop[atp->atp_type]++;
|
||||
KB_FREEALL(m);
|
||||
}
|
||||
|
||||
out:
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Abnormally terminate service
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static void
|
||||
atm_aal5_abort(so)
|
||||
struct socket *so;
|
||||
{
|
||||
ATM_INTRO_NOERR("abort");
|
||||
|
||||
(void)atm_sock_disconnect(so);
|
||||
so->so_error = ECONNABORTED;
|
||||
|
||||
ATM_OUTRO_NOERR();
|
||||
}
|
||||
|
||||
static void
|
||||
atm_aal5_close(so)
|
||||
struct socket *so;
|
||||
{
|
||||
ATM_INTRO_NOERR("close");
|
||||
|
||||
(void)atm_sock_disconnect(so);
|
||||
|
||||
ATM_OUTRO_NOERR();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Do control operation - ioctl system call
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* cmd ioctl code
|
||||
* data pointer to code specific parameter data area
|
||||
* ifp pointer to ifnet structure if it's an interface ioctl
|
||||
* p pointer to process
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_control(so, cmd, data, ifp, td)
|
||||
struct socket *so;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
struct ifnet *ifp;
|
||||
struct thread *td;
|
||||
{
|
||||
ATM_INTRO("control");
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
default:
|
||||
err = EOPNOTSUPP;
|
||||
}
|
||||
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
/*
|
||||
* Sense socket status - fstat system call
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* st pointer to file status structure
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_sense(so, st)
|
||||
struct socket *so;
|
||||
struct stat *st;
|
||||
{
|
||||
ATM_INTRO("sense");
|
||||
|
||||
/*
|
||||
* Just return the max sdu size for the connection
|
||||
*/
|
||||
st->st_blksize = so->so_snd.sb_hiwat;
|
||||
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Retrieve local socket address
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* addr pointer to pointer to contain protocol address
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_sockaddr(so, addr)
|
||||
struct socket *so;
|
||||
struct sockaddr **addr;
|
||||
{
|
||||
ATM_INTRO("sockaddr");
|
||||
|
||||
err = atm_sock_sockaddr(so, addr);
|
||||
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Retrieve peer socket address
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* addr pointer to pointer to contain protocol address
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_peeraddr(so, addr)
|
||||
struct socket *so;
|
||||
struct sockaddr **addr;
|
||||
{
|
||||
ATM_INTRO("peeraddr");
|
||||
|
||||
err = atm_sock_peeraddr(so, addr);
|
||||
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process Incoming Calls
|
||||
*
|
||||
* This function will receive control when an incoming call has been matched
|
||||
* to one of our registered listen parameter blocks. Assuming the call passes
|
||||
* acceptance criteria and all required resources are available, we will
|
||||
* create a new protocol control block and socket association. We must
|
||||
* then await notification of the final SVC setup results. If any
|
||||
* problems are encountered, we will just tell the connection manager to
|
||||
* reject the call.
|
||||
*
|
||||
* Called at splnet.
|
||||
*
|
||||
* Arguments:
|
||||
* tok owner's matched listening token
|
||||
* cop pointer to incoming call's connection block
|
||||
* ap pointer to incoming call's attributes
|
||||
* tokp pointer to location to store our connection token
|
||||
*
|
||||
* Returns:
|
||||
* 0 call is accepted
|
||||
* errno call rejected - reason indicated
|
||||
*
|
||||
*/
|
||||
static int
|
||||
atm_aal5_incoming(tok, cop, ap, tokp)
|
||||
void *tok;
|
||||
Atm_connection *cop;
|
||||
Atm_attributes *ap;
|
||||
void **tokp;
|
||||
{
|
||||
Atm_pcb *atp0 = tok, *atp;
|
||||
struct socket *so;
|
||||
int err = 0;
|
||||
|
||||
/*
|
||||
* Allocate a new socket and pcb for this connection.
|
||||
*
|
||||
* Note that our attach function will be called via sonewconn
|
||||
* and it will allocate and setup most of the pcb.
|
||||
*/
|
||||
atm_sock_stat.as_inconn[atp0->atp_type]++;
|
||||
so = sonewconn(atp0->atp_socket, 0);
|
||||
|
||||
if (so) {
|
||||
/*
|
||||
* Finish pcb setup and pass pcb back to CM
|
||||
*/
|
||||
atp = sotoatmpcb(so);
|
||||
atp->atp_conn = cop;
|
||||
atp->atp_attr = *atp0->atp_conn->co_lattr;
|
||||
strncpy(atp->atp_name, atp0->atp_name, T_ATM_APP_NAME_LEN);
|
||||
*tokp = atp;
|
||||
} else {
|
||||
err = ECONNABORTED;
|
||||
atm_sock_stat.as_connfail[atp0->atp_type]++;
|
||||
}
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process Socket VCC Input Data
|
||||
*
|
||||
* Arguments:
|
||||
* tok owner's connection token (atm_pcb)
|
||||
* m pointer to input packet buffer chain
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
static void
|
||||
atm_aal5_cpcs_data(tok, m)
|
||||
void *tok;
|
||||
KBuffer *m;
|
||||
{
|
||||
Atm_pcb *atp = tok;
|
||||
struct socket *so;
|
||||
int len;
|
||||
|
||||
so = atp->atp_socket;
|
||||
|
||||
KB_PLENGET(m, len);
|
||||
|
||||
/*
|
||||
* Ensure that the socket is able to receive data and
|
||||
* that there's room in the socket buffer
|
||||
*/
|
||||
if (((so->so_state & SS_ISCONNECTED) == 0) ||
|
||||
(so->so_rcv.sb_state & SBS_CANTRCVMORE) ||
|
||||
(len > sbspace(&so->so_rcv))) {
|
||||
atm_sock_stat.as_indrop[atp->atp_type]++;
|
||||
KB_FREEALL(m);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Queue the data and notify the user
|
||||
*/
|
||||
sbappendrecord(&so->so_rcv, m);
|
||||
sorwakeup(so);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process getsockopt/setsockopt system calls
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* sopt pointer to socket option info
|
||||
*
|
||||
* Returns:
|
||||
* 0 request processed
|
||||
* errno error processing request - reason indicated
|
||||
*
|
||||
*/
|
||||
int
|
||||
atm_aal5_ctloutput(so, sopt)
|
||||
struct socket *so;
|
||||
struct sockopt *sopt;
|
||||
{
|
||||
Atm_pcb *atp;
|
||||
|
||||
ATM_INTRO("ctloutput");
|
||||
|
||||
/*
|
||||
* Make sure this is for us
|
||||
*/
|
||||
if (sopt->sopt_level != T_ATM_SIGNALING) {
|
||||
ATM_RETERR(EINVAL);
|
||||
}
|
||||
atp = sotoatmpcb(so);
|
||||
if (atp == NULL) {
|
||||
ATM_RETERR(ENOTCONN);
|
||||
}
|
||||
|
||||
switch (sopt->sopt_dir) {
|
||||
|
||||
case SOPT_SET:
|
||||
/*
|
||||
* setsockopt()
|
||||
*/
|
||||
|
||||
/*
|
||||
* Validate socket state
|
||||
*/
|
||||
switch (sopt->sopt_name) {
|
||||
|
||||
case T_ATM_ADD_LEAF:
|
||||
case T_ATM_DROP_LEAF:
|
||||
if ((so->so_state & SS_ISCONNECTED) == 0) {
|
||||
ATM_RETERR(ENOTCONN);
|
||||
}
|
||||
break;
|
||||
|
||||
case T_ATM_CAUSE:
|
||||
case T_ATM_APP_NAME:
|
||||
break;
|
||||
|
||||
default:
|
||||
if (so->so_state & SS_ISCONNECTED) {
|
||||
ATM_RETERR(EISCONN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate and save user-supplied option data
|
||||
*/
|
||||
err = atm_sock_setopt(so, sopt, atp);
|
||||
|
||||
break;
|
||||
|
||||
case SOPT_GET:
|
||||
/*
|
||||
* getsockopt()
|
||||
*/
|
||||
|
||||
/*
|
||||
* Return option data
|
||||
*/
|
||||
err = atm_sock_getopt(so, sopt, atp);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
ATM_OUTRO();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize AAL5 Sockets
|
||||
*
|
||||
* Arguments:
|
||||
* none
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
atm_aal5_init()
|
||||
{
|
||||
/*
|
||||
* Register our endpoint
|
||||
*/
|
||||
if (atm_endpoint_register(&atm_aal5_endpt))
|
||||
panic("atm_aal5_init: register");
|
||||
|
||||
/*
|
||||
* Set default connection attributes
|
||||
*/
|
||||
atm_aal5_defattr.aal.v.aal5.forward_max_SDU_size = T_ATM_ABSENT;
|
||||
atm_aal5_defattr.aal.v.aal5.backward_max_SDU_size = T_ATM_ABSENT;
|
||||
atm_aal5_defattr.aal.v.aal5.SSCS_type = T_ATM_NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get Connection's Application/Owner Name
|
||||
*
|
||||
* Arguments:
|
||||
* tok owner's connection token (atm_pcb)
|
||||
*
|
||||
* Returns:
|
||||
* addr pointer to string containing our name
|
||||
*
|
||||
*/
|
||||
static caddr_t
|
||||
atm_aal5_getname(tok)
|
||||
void *tok;
|
||||
{
|
||||
Atm_pcb *atp = tok;
|
||||
|
||||
return (atp->atp_name);
|
||||
}
|
||||
|
||||
3502
sys/netatm/atm_cm.c
3502
sys/netatm/atm_cm.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,351 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Core ATM Services
|
||||
* -----------------
|
||||
*
|
||||
* ATM Connection Management definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _NETATM_ATM_CM_H
|
||||
#define _NETATM_ATM_CM_H
|
||||
|
||||
/*
|
||||
* Forward declaration
|
||||
*/
|
||||
struct atm_connection;
|
||||
struct atm_attributes;
|
||||
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Structure used to define a kernel ATM endpoint service module and its
|
||||
* associated entry points. An endpoint service is defined as a kernel
|
||||
* entity which will serve as the endpoint of an ATM connection, i.e. it is
|
||||
* responsible for issuing/receiving requests to/from the connection manager.
|
||||
*/
|
||||
struct atm_endpoint {
|
||||
struct atm_endpoint *ep_next; /* Next in registry list */
|
||||
u_int ep_id; /* Endpoint ID (see below) */
|
||||
|
||||
/* Exported functions: Miscellaneous */
|
||||
int (*ep_ioctl) /* Ioctl */
|
||||
(int, caddr_t, caddr_t);
|
||||
caddr_t (*ep_getname) /* Get application/owner name */
|
||||
(void *);
|
||||
|
||||
/* Exported functions: Connection Manager Control API */
|
||||
void (*ep_connected) /* Call connected */
|
||||
(void *);
|
||||
void (*ep_cleared) /* Call cleared */
|
||||
(void *, struct t_atm_cause *);
|
||||
int (*ep_incoming) /* Incoming call */
|
||||
(void *, struct atm_connection *,
|
||||
struct atm_attributes *, void **);
|
||||
int (*ep_addparty) /* Add Party notification */
|
||||
(void *, int, int);
|
||||
int (*ep_dropparty) /* Drop Party notification */
|
||||
(void *, int, int);
|
||||
|
||||
/* Exported functions: Connection Manager Data API: CPCS */
|
||||
void (*ep_cpcs_ctl) /* Control operation */
|
||||
(int, void *, void *);
|
||||
void (*ep_cpcs_data) /* Received data */
|
||||
(void *, KBuffer *);
|
||||
|
||||
/* Exported functions: Connection Manager Data API: SAAL */
|
||||
void (*ep_saal_ctl) /* Control operation */
|
||||
(int, void *, void *);
|
||||
void (*ep_saal_data) /* Received data */
|
||||
(void *, KBuffer *);
|
||||
|
||||
/* Exported functions: Connection Manager Data API: SSCOP */
|
||||
void (*ep_sscop_ctl) /* Control operation */
|
||||
(int, void *, void *, void *);
|
||||
void (*ep_sscop_data) /* Received data */
|
||||
(void *, KBuffer *, u_int);
|
||||
};
|
||||
typedef struct atm_endpoint Atm_endpoint;
|
||||
#endif /* _KERNEL */
|
||||
|
||||
/*
|
||||
* Endpoint IDs
|
||||
*/
|
||||
#define ENDPT_UNKNOWN 0 /* Unknown */
|
||||
#define ENDPT_IP 1 /* IP over ATM */
|
||||
#define ENDPT_ATMARP 2 /* ATMARP */
|
||||
#define ENDPT_SPANS_SIG 3 /* SPANS Signalling */
|
||||
#define ENDPT_SPANS_CLS 4 /* SPANS CLS */
|
||||
#define ENDPT_UNI_SIG 5 /* UNI Signalling */
|
||||
#define ENDPT_SOCK_AAL5 6 /* Socket - AAL5 */
|
||||
#define ENDPT_SOCK_SSCOP 7 /* Socket - SSCOP */
|
||||
#define ENDPT_MAX 7
|
||||
|
||||
|
||||
/*
|
||||
* ATM Connection Attributes
|
||||
*
|
||||
* Note: Attribute tag values are the same as the SVE_tag values.
|
||||
* Unless otherwise specified, attribute field values are the same
|
||||
* as the corresponding socket option values.
|
||||
* The above values are all defined in netatm/atm.h.
|
||||
*/
|
||||
|
||||
/* AAL Attributes */
|
||||
struct t_atm_aal4 {
|
||||
int32_t forward_max_SDU_size;
|
||||
int32_t backward_max_SDU_size;
|
||||
int32_t SSCS_type;
|
||||
int32_t mid_low;
|
||||
int32_t mid_high;
|
||||
};
|
||||
|
||||
struct attr_aal {
|
||||
int tag; /* Attribute tag */
|
||||
Aal_t type; /* AAL type (discriminator) */
|
||||
union {
|
||||
struct t_atm_aal4 aal4;
|
||||
struct t_atm_aal5 aal5;
|
||||
} v; /* Attribute value */
|
||||
};
|
||||
|
||||
/* Traffic Descriptor Attributes */
|
||||
struct attr_traffic {
|
||||
int tag; /* Attribute tag */
|
||||
struct t_atm_traffic v; /* Attribute value */
|
||||
};
|
||||
|
||||
/* Broadband Bearer Attributes */
|
||||
struct attr_bearer {
|
||||
int tag; /* Attribute tag */
|
||||
struct t_atm_bearer v; /* Attribute value */
|
||||
};
|
||||
|
||||
/* Broadband High Layer Information Attributes */
|
||||
struct attr_bhli {
|
||||
int tag; /* Attribute tag */
|
||||
struct t_atm_bhli v; /* Attribute value */
|
||||
};
|
||||
|
||||
/* Broadband Low Layer Information Attributes */
|
||||
struct attr_blli {
|
||||
int tag_l2; /* Layer 2 attribute tag */
|
||||
int tag_l3; /* Layer 3 attribute tag */
|
||||
struct t_atm_blli v; /* Attribute value */
|
||||
};
|
||||
|
||||
/* Logical Link Control Attributes (multiplexing use only, not signalled) */
|
||||
struct attr_llc {
|
||||
int tag; /* Attribute tag */
|
||||
struct t_atm_llc v; /* Attribute value */
|
||||
};
|
||||
|
||||
/* Called Party Attributes */
|
||||
struct attr_called {
|
||||
int tag; /* Attribute tag */
|
||||
Atm_addr addr; /* Called party address */
|
||||
Atm_addr subaddr; /* Called party subaddress */
|
||||
};
|
||||
|
||||
/* Calling Party Attributes */
|
||||
struct attr_calling {
|
||||
int tag; /* Attribute tag */
|
||||
Atm_addr addr; /* Calling party address */
|
||||
Atm_addr subaddr; /* Calling party subaddress */
|
||||
struct t_atm_caller_id cid; /* Caller ID */
|
||||
};
|
||||
|
||||
/* Quality of Service Attributes */
|
||||
struct attr_qos {
|
||||
int tag; /* Attribute tag */
|
||||
struct t_atm_qos v; /* Attribute value */
|
||||
};
|
||||
|
||||
/* Transit Network Attributes */
|
||||
struct attr_transit {
|
||||
int tag; /* Attribute tag */
|
||||
struct t_atm_transit v; /* Attribute value */
|
||||
};
|
||||
|
||||
/* Cause Attributes */
|
||||
struct attr_cause {
|
||||
int tag; /* Attribute tag */
|
||||
struct t_atm_cause v; /* Attribute value */
|
||||
};
|
||||
|
||||
|
||||
struct atm_attributes {
|
||||
struct atm_nif *nif; /* Network interface */
|
||||
u_int api; /* Connect Mgr Data API (see below) */
|
||||
int api_init;/* API initialization parameter */
|
||||
u_short headin; /* Input buffer headroom */
|
||||
u_short headout;/* Output buffer headroom */
|
||||
struct attr_aal aal; /* AAL attributes */
|
||||
struct attr_traffic traffic;/* Traffic descriptor attributes */
|
||||
struct attr_bearer bearer; /* Broadband bearer attributes */
|
||||
struct attr_bhli bhli; /* Broadband high layer attributes */
|
||||
struct attr_blli blli; /* Broadband low layer attributes */
|
||||
struct attr_llc llc; /* Logical link control attributes */
|
||||
struct attr_called called; /* Called party attributes */
|
||||
struct attr_calling calling;/* Calling party attributes */
|
||||
struct attr_qos qos; /* Quality of service attributes */
|
||||
struct attr_transit transit;/* Transit network attributes */
|
||||
struct attr_cause cause; /* Cause attributes */
|
||||
};
|
||||
typedef struct atm_attributes Atm_attributes;
|
||||
|
||||
/*
|
||||
* Connection Manager Data APIs
|
||||
*/
|
||||
#define CMAPI_CPCS 0 /* AAL CPCS */
|
||||
#define CMAPI_SAAL 1 /* Signalling AAL */
|
||||
#define CMAPI_SSCOP 2 /* Reliable data (SSCOP) */
|
||||
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* ATM Connection Instance
|
||||
*
|
||||
* There will be one connection block for each endpoint <-> Connection Manager
|
||||
* API instance. Note that with connection multiplexors (e.g. LLC), there
|
||||
* may be multiple connections per VCC.
|
||||
*/
|
||||
struct atm_connection {
|
||||
struct atm_connection *co_next; /* Multiplexor/listen queue link */
|
||||
struct atm_connection *co_mxh; /* Connection multiplexor head */
|
||||
u_char co_flags; /* Connection flags (see below) */
|
||||
u_char co_state; /* User <-> CM state (see below) */
|
||||
Encaps_t co_mpx; /* Multiplexor type */
|
||||
void *co_toku; /* Endpoint's session token */
|
||||
Atm_endpoint *co_endpt; /* Endpoint service */
|
||||
struct atm_connvc *co_connvc; /* Connection VCC */
|
||||
struct attr_llc co_llc; /* Connection LLC header */
|
||||
Atm_attributes *co_lattr; /* Listening attributes */
|
||||
};
|
||||
typedef struct atm_connection Atm_connection;
|
||||
|
||||
/*
|
||||
* Connection Flags
|
||||
*/
|
||||
#define COF_P2P 0x01 /* Point-to-point */
|
||||
#define COF_P2MP 0x02 /* Point-to-multipoint */
|
||||
|
||||
/*
|
||||
* Endpoint <-> Connection Manager States
|
||||
*/
|
||||
#define COS_FREE 0 /* Not allocated */
|
||||
#define COS_OUTCONN 1 /* Outgoing connection pending */
|
||||
#define COS_LISTEN 2 /* Listening for connection */
|
||||
#define COS_INCONN 3 /* Incoming connection pending */
|
||||
#define COS_INACCEPT 4 /* Incoming connection accepted */
|
||||
#define COS_ACTIVE 5 /* Connection active */
|
||||
#define COS_CLEAR 6 /* Connection is clearing */
|
||||
|
||||
|
||||
/*
|
||||
* ATM Connection VCC Instance
|
||||
*
|
||||
* There will be one connection-vcc block for each VCC created by the
|
||||
* Connection Manager. For multiplexed connections, there may be multiple
|
||||
* connection blocks associated with each connection-vcc. This block is
|
||||
* used to control the Connection Manager <-> VCC interface, including the
|
||||
* interfaces to stack management and the signalling manager.
|
||||
*/
|
||||
struct atm_connvc {
|
||||
Qelem_t cvc_q; /* Queueing links */
|
||||
Atm_connection *cvc_conn; /* Connection head */
|
||||
struct vccb *cvc_vcc; /* VCC for connection */
|
||||
struct sigmgr *cvc_sigmgr; /* VCC signalling manager */
|
||||
u_char cvc_flags; /* Connection flags (see below) */
|
||||
u_char cvc_state; /* CM - VCC state (see below) */
|
||||
void *cvc_tokl; /* Stack lower layer token */
|
||||
void (*cvc_lower) /* Stack lower layer handler */
|
||||
(int, void *, intptr_t, intptr_t);
|
||||
u_short cvc_upcnt; /* Up stack calls in progress */
|
||||
u_short cvc_downcnt; /* Down stack calls in progress */
|
||||
KBuffer *cvc_rcvq; /* Packet receive queue */
|
||||
int cvc_rcvqlen; /* Receive queue length */
|
||||
Atm_attributes cvc_attr; /* VCC attributes */
|
||||
struct atm_time cvc_time; /* Timer controls */
|
||||
};
|
||||
typedef struct atm_connvc Atm_connvc;
|
||||
|
||||
/*
|
||||
* Connection Flags
|
||||
*/
|
||||
#define CVCF_ABORTING 0x01 /* VCC abort is pending */
|
||||
#define CVCF_INCOMQ 0x02 /* VCC is on incoming queue */
|
||||
#define CVCF_CONNQ 0x04 /* VCC is on connection queue */
|
||||
#define CVCF_CALLER 0x08 /* We are the call originator */
|
||||
|
||||
/*
|
||||
* Connection Manager <-> VCC States
|
||||
*/
|
||||
#define CVCS_FREE 0 /* Not allocated */
|
||||
#define CVCS_SETUP 1 /* Call setup pending */
|
||||
#define CVCS_INIT 2 /* Stack INIT pending */
|
||||
#define CVCS_INCOMING 3 /* Incoming call present */
|
||||
#define CVCS_ACCEPT 4 /* Incoming call accepted */
|
||||
#define CVCS_REJECT 5 /* Incoming call rejected */
|
||||
#define CVCS_ACTIVE 6 /* Stack active */
|
||||
#define CVCS_RELEASE 7 /* Connection release pending */
|
||||
#define CVCS_CLEAR 8 /* Call has been cleared */
|
||||
#define CVCS_TERM 9 /* Stack TERM pending */
|
||||
|
||||
|
||||
/*
|
||||
* Connection VCC variables
|
||||
*/
|
||||
#define CVC_RCVQ_MAX 3 /* Max length of receive queue */
|
||||
|
||||
|
||||
/*
|
||||
* Timer macros
|
||||
*/
|
||||
#define CVC_TIMER(s, t) atm_timeout(&(s)->cvc_time, (t), atm_cm_timeout)
|
||||
#define CVC_CANCEL(s) atm_untimeout(&(s)->cvc_time)
|
||||
|
||||
|
||||
/*
|
||||
* Connection Manager Statistics
|
||||
*/
|
||||
struct atm_cm_stat {
|
||||
u_long cms_llcdrop; /* Packets dropped by llc demux'ing */
|
||||
u_long cms_llcid; /* Packets with unknown llc id */
|
||||
u_long cms_rcvconn; /* Packets dropped, bad conn state */
|
||||
u_long cms_rcvconnvc; /* Packets dropped, bad connvc state */
|
||||
};
|
||||
|
||||
void atm_cm_init(void);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _NETATM_ATM_CM_H */
|
||||
|
|
@ -1,816 +0,0 @@
|
|||
/*-
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Core ATM Services
|
||||
* -----------------
|
||||
*
|
||||
* ATM device support functions
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <net/if.h>
|
||||
#include <net/bpf.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_vc.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
|
||||
/*
|
||||
* Private structures for managing allocated kernel memory resources
|
||||
*
|
||||
* For each allocation of kernel memory, one Mem_ent will be used.
|
||||
* The Mem_ent structures will be allocated in blocks inside of a
|
||||
* Mem_blk structure.
|
||||
*/
|
||||
#define MEM_NMEMENT 10 /* How many Mem_ent's in a Mem_blk */
|
||||
|
||||
struct mem_ent {
|
||||
void *me_kaddr; /* Allocated memory address */
|
||||
u_int me_ksize; /* Allocated memory length */
|
||||
void *me_uaddr; /* Memory address returned to caller */
|
||||
u_int me_flags; /* Flags (see below) */
|
||||
};
|
||||
typedef struct mem_ent Mem_ent;
|
||||
|
||||
/*
|
||||
* Memory entry flags
|
||||
*/
|
||||
#define MEF_NONCACHE 1 /* Memory is noncacheable */
|
||||
|
||||
|
||||
struct mem_blk {
|
||||
struct mem_blk *mb_next; /* Next block in chain */
|
||||
Mem_ent mb_mement[MEM_NMEMENT]; /* Allocated memory entries */
|
||||
};
|
||||
typedef struct mem_blk Mem_blk;
|
||||
|
||||
static Mem_blk *atm_mem_head = NULL;
|
||||
|
||||
static struct t_atm_cause atm_dev_cause = {
|
||||
T_ATM_ITU_CODING,
|
||||
T_ATM_LOC_USER,
|
||||
T_ATM_CAUSE_VPCI_VCI_ASSIGNMENT_FAILURE,
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
extern struct ifqueue atm_intrq;
|
||||
|
||||
/*
|
||||
* ATM Device Stack Instantiation
|
||||
*
|
||||
* Called at splnet.
|
||||
*
|
||||
* Arguments
|
||||
* ssp pointer to array of stack definition pointers
|
||||
* for connection
|
||||
* ssp[0] points to upper layer's stack definition
|
||||
* ssp[1] points to this layer's stack definition
|
||||
* ssp[2] points to lower layer's stack definition
|
||||
* cvcp pointer to connection vcc for this stack
|
||||
*
|
||||
* Returns
|
||||
* 0 instantiation successful
|
||||
* err instantiation failed - reason indicated
|
||||
*
|
||||
*/
|
||||
int
|
||||
atm_dev_inst(ssp, cvcp)
|
||||
struct stack_defn **ssp;
|
||||
Atm_connvc *cvcp;
|
||||
{
|
||||
Cmn_unit *cup = (Cmn_unit *)cvcp->cvc_attr.nif->nif_pif;
|
||||
Cmn_vcc *cvp;
|
||||
int err;
|
||||
|
||||
/*
|
||||
* Check to see if device has been initialized
|
||||
*/
|
||||
if ((cup->cu_flags & CUF_INITED) == 0)
|
||||
return ( EIO );
|
||||
|
||||
/*
|
||||
* Validate lower SAP
|
||||
*/
|
||||
/*
|
||||
* Device driver is the lowest layer - no need to validate
|
||||
*/
|
||||
|
||||
/*
|
||||
* Validate PVC vpi.vci
|
||||
*/
|
||||
if (cvcp->cvc_attr.called.addr.address_format == T_ATM_PVC_ADDR) {
|
||||
/*
|
||||
* Look through existing circuits - return error if found
|
||||
*/
|
||||
Atm_addr_pvc *pp;
|
||||
|
||||
pp = (Atm_addr_pvc *)cvcp->cvc_attr.called.addr.address;
|
||||
if (atm_dev_vcc_find(cup, ATM_PVC_GET_VPI(pp),
|
||||
ATM_PVC_GET_VCI(pp), 0))
|
||||
return ( EADDRINUSE );
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate our SAP type
|
||||
*/
|
||||
switch ((*(ssp+1))->sd_sap) {
|
||||
case SAP_CPCS_AAL3_4:
|
||||
case SAP_CPCS_AAL5:
|
||||
case SAP_ATM:
|
||||
break;
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a VCC control block
|
||||
* This can happen from a callout so don't wait here.
|
||||
*/
|
||||
cvp = uma_zalloc(cup->cu_vcc_zone, M_NOWAIT);
|
||||
if (cvp == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
cvp->cv_state = CVS_INST;
|
||||
cvp->cv_toku = (*ssp)->sd_toku;
|
||||
cvp->cv_upper = (*ssp)->sd_upper;
|
||||
cvp->cv_connvc = cvcp;
|
||||
|
||||
/*
|
||||
* Let device have a look at the connection request
|
||||
*/
|
||||
err = (*cup->cu_instvcc)(cup, cvp);
|
||||
if (err) {
|
||||
uma_zfree(cup->cu_vcc_zone, cvp);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* Looks good so far, so link in device VCC
|
||||
*/
|
||||
LINK2TAIL ( cvp, Cmn_vcc, cup->cu_vcc, cv_next );
|
||||
|
||||
/*
|
||||
* Save my token
|
||||
*/
|
||||
(*++ssp)->sd_toku = cvp;
|
||||
|
||||
/*
|
||||
* Pass instantiation down the stack
|
||||
*/
|
||||
/*
|
||||
* No need - we're the lowest point.
|
||||
*/
|
||||
/* err = (*(ssp + 1))->sd_inst(ssp, cvcp); */
|
||||
|
||||
/*
|
||||
* Save the lower layer's interface info
|
||||
*/
|
||||
/*
|
||||
* No need - we're the lowest point
|
||||
*/
|
||||
/* cvp->cv_lower = (*++ssp)->sd_lower; */
|
||||
/* cvp->cv_tok1 = (*ssp)->sd_toku; */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ATM Device Stack Command Handler
|
||||
*
|
||||
* Arguments
|
||||
* cmd stack command code
|
||||
* tok session token (Cmn_vcc)
|
||||
* arg1 command specific argument
|
||||
* arg2 command specific argument
|
||||
*
|
||||
* Returns
|
||||
* none
|
||||
*
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
atm_dev_lower(cmd, tok, arg1, arg2)
|
||||
int cmd;
|
||||
void *tok;
|
||||
intptr_t arg1;
|
||||
intptr_t arg2;
|
||||
{
|
||||
Cmn_vcc *cvp = (Cmn_vcc *)tok;
|
||||
Atm_connvc *cvcp = cvp->cv_connvc;
|
||||
Cmn_unit *cup = (Cmn_unit *)cvcp->cvc_attr.nif->nif_pif;
|
||||
struct vccb *vcp;
|
||||
u_int state;
|
||||
int s;
|
||||
|
||||
switch ( cmd ) {
|
||||
|
||||
case CPCS_INIT:
|
||||
/*
|
||||
* Sanity check
|
||||
*/
|
||||
if ( cvp->cv_state != CVS_INST ) {
|
||||
log ( LOG_ERR,
|
||||
"atm_dev_lower: INIT: tok=%p, state=%d\n",
|
||||
tok, cvp->cv_state );
|
||||
break;
|
||||
}
|
||||
|
||||
vcp = cvp->cv_connvc->cvc_vcc;
|
||||
|
||||
/*
|
||||
* Validate SVC vpi.vci
|
||||
*/
|
||||
if ( vcp->vc_type & VCC_SVC ) {
|
||||
|
||||
if (atm_dev_vcc_find(cup, vcp->vc_vpi, vcp->vc_vci,
|
||||
vcp->vc_type & (VCC_IN | VCC_OUT))
|
||||
!= cvp){
|
||||
log ( LOG_ERR,
|
||||
"atm_dev_lower: dup SVC (%d,%d) tok=%p\n",
|
||||
vcp->vc_vpi, vcp->vc_vci, tok );
|
||||
atm_cm_abort(cvp->cv_connvc, &atm_dev_cause);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Tell the device to open the VCC
|
||||
*/
|
||||
cvp->cv_state = CVS_INITED;
|
||||
s = splimp();
|
||||
if ((*cup->cu_openvcc)(cup, cvp)) {
|
||||
atm_cm_abort(cvp->cv_connvc, &atm_dev_cause);
|
||||
(void) splx(s);
|
||||
break;
|
||||
}
|
||||
(void) splx(s);
|
||||
break;
|
||||
|
||||
case CPCS_TERM: {
|
||||
KBuffer *m, *prev, *next;
|
||||
int *ip;
|
||||
|
||||
s = splimp();
|
||||
|
||||
/*
|
||||
* Disconnect the VCC - ignore return code
|
||||
*/
|
||||
if ((cvp->cv_state == CVS_INITED) ||
|
||||
(cvp->cv_state == CVS_ACTIVE)) {
|
||||
(void) (*cup->cu_closevcc)(cup, cvp);
|
||||
}
|
||||
cvp->cv_state = CVS_TERM;
|
||||
|
||||
/*
|
||||
* Remove from interface list
|
||||
*/
|
||||
UNLINK ( cvp, Cmn_vcc, cup->cu_vcc, cv_next );
|
||||
|
||||
/*
|
||||
* Free any buffers from this VCC on the ATM interrupt queue
|
||||
*/
|
||||
prev = NULL;
|
||||
IF_LOCK(&atm_intrq);
|
||||
for (m = atm_intrq.ifq_head; m; m = next) {
|
||||
next = KB_QNEXT(m);
|
||||
|
||||
/*
|
||||
* See if this entry is for the terminating VCC
|
||||
*/
|
||||
KB_DATASTART(m, ip, int *);
|
||||
ip++;
|
||||
if (*ip == (intptr_t)cvp) {
|
||||
/*
|
||||
* Yep, so dequeue the entry
|
||||
*/
|
||||
if (prev == NULL)
|
||||
atm_intrq.ifq_head = next;
|
||||
else
|
||||
KB_QNEXT(prev) = next;
|
||||
|
||||
if (next == NULL)
|
||||
atm_intrq.ifq_tail = prev;
|
||||
|
||||
atm_intrq.ifq_len--;
|
||||
|
||||
/*
|
||||
* Free the unwanted buffers
|
||||
*/
|
||||
KB_FREEALL(m);
|
||||
} else {
|
||||
prev = m;
|
||||
}
|
||||
}
|
||||
IF_UNLOCK(&atm_intrq);
|
||||
(void) splx(s);
|
||||
|
||||
/*
|
||||
* Free VCC resources
|
||||
*/
|
||||
uma_zfree(cup->cu_vcc_zone, cvp);
|
||||
break;
|
||||
}
|
||||
|
||||
case CPCS_UNITDATA_INV:
|
||||
|
||||
/*
|
||||
* Sanity check
|
||||
*
|
||||
* Use temp state variable since we dont want to lock out
|
||||
* interrupts, but initial VC activation interrupt may
|
||||
* happen here, changing state somewhere in the middle.
|
||||
*/
|
||||
state = cvp->cv_state;
|
||||
if ((state != CVS_ACTIVE) &&
|
||||
(state != CVS_INITED)) {
|
||||
log ( LOG_ERR,
|
||||
"atm_dev_lower: UNITDATA: tok=%p, state=%d\n",
|
||||
tok, state );
|
||||
KB_FREEALL((KBuffer *)arg1);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send the packet to the interface's bpf if this vc has one.
|
||||
*/
|
||||
if (cvcp->cvc_vcc != NULL && cvcp->cvc_vcc->vc_nif != NULL) {
|
||||
struct ifnet *ifp =
|
||||
(struct ifnet *)cvcp->cvc_vcc->vc_nif;
|
||||
|
||||
BPF_MTAP(ifp, (KBuffer *)arg1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hand the data off to the device
|
||||
*/
|
||||
(*cup->cu_output)(cup, cvp, (KBuffer *)arg1);
|
||||
|
||||
break;
|
||||
|
||||
case CPCS_UABORT_INV:
|
||||
log ( LOG_ERR,
|
||||
"atm_dev_lower: unimplemented stack cmd 0x%x, tok=%p\n",
|
||||
cmd, tok );
|
||||
break;
|
||||
|
||||
default:
|
||||
log ( LOG_ERR,
|
||||
"atm_dev_lower: unknown stack cmd 0x%x, tok=%p\n",
|
||||
cmd, tok );
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Allocate kernel memory block
|
||||
*
|
||||
* This function will allocate a kernel memory block of the type specified
|
||||
* in the flags parameter. The returned address will point to a memory
|
||||
* block of the requested size and alignment. The memory block will also
|
||||
* be zeroed. The alloc/free functions will manage/mask both the OS-specific
|
||||
* kernel memory management requirements and the bookkeeping required to
|
||||
* deal with data alignment issues.
|
||||
*
|
||||
* This function should not be called from interrupt level.
|
||||
*
|
||||
* Arguments:
|
||||
* size size of memory block to allocate
|
||||
* align data alignment requirement
|
||||
* flags allocation flags (ATM_DEV_*)
|
||||
*
|
||||
* Returns:
|
||||
* uaddr pointer to aligned memory block
|
||||
* NULL unable to allocate memory
|
||||
*
|
||||
*/
|
||||
void *
|
||||
atm_dev_alloc(size, align, flags)
|
||||
u_int size;
|
||||
u_int align;
|
||||
u_int flags;
|
||||
{
|
||||
Mem_blk *mbp;
|
||||
Mem_ent *mep;
|
||||
u_int kalign, ksize;
|
||||
int s, i;
|
||||
|
||||
s = splimp();
|
||||
|
||||
/*
|
||||
* Find a free Mem_ent
|
||||
*/
|
||||
mep = NULL;
|
||||
for (mbp = atm_mem_head; mbp && mep == NULL; mbp = mbp->mb_next) {
|
||||
for (i = 0; i < MEM_NMEMENT; i++) {
|
||||
if (mbp->mb_mement[i].me_uaddr == NULL) {
|
||||
mep = &mbp->mb_mement[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If there are no free Mem_ent's, then allocate a new Mem_blk
|
||||
* and link it into the chain
|
||||
*/
|
||||
if (mep == NULL) {
|
||||
mbp = malloc(sizeof(Mem_blk), M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
if (mbp == NULL) {
|
||||
log(LOG_ERR, "atm_dev_alloc: Mem_blk failure\n");
|
||||
(void) splx(s);
|
||||
return (NULL);
|
||||
}
|
||||
mbp->mb_next = atm_mem_head;
|
||||
atm_mem_head = mbp;
|
||||
mep = mbp->mb_mement;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now we need to get the kernel's allocation alignment minimum
|
||||
*
|
||||
* This is obviously very OS-specific stuff
|
||||
*/
|
||||
kalign = MINALLOCSIZE;
|
||||
|
||||
/*
|
||||
* Figure out how much memory we must allocate to satify the
|
||||
* user's size and alignment needs
|
||||
*/
|
||||
if (align <= kalign)
|
||||
ksize = size;
|
||||
else
|
||||
ksize = size + align - kalign;
|
||||
|
||||
/*
|
||||
* Finally, go get the memory
|
||||
*/
|
||||
if (flags & ATM_DEV_NONCACHE) {
|
||||
mep->me_kaddr = malloc(ksize, M_DEVBUF, M_NOWAIT);
|
||||
} else {
|
||||
mep->me_kaddr = malloc(ksize, M_DEVBUF, M_NOWAIT);
|
||||
}
|
||||
|
||||
if (mep->me_kaddr == NULL) {
|
||||
log(LOG_ERR, "atm_dev_alloc: %skernel memory unavailable\n",
|
||||
(flags & ATM_DEV_NONCACHE) ? "non-cacheable " : "");
|
||||
(void) splx(s);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate correct alignment address to pass back to user
|
||||
*/
|
||||
mep->me_uaddr = (void *) roundup((uintptr_t)mep->me_kaddr, align);
|
||||
mep->me_ksize = ksize;
|
||||
mep->me_flags = flags;
|
||||
|
||||
/*
|
||||
* Clear memory for user
|
||||
*/
|
||||
bzero(mep->me_uaddr, size);
|
||||
|
||||
ATM_DEBUG4("atm_dev_alloc: size=%d, align=%d, flags=%d, uaddr=%p\n",
|
||||
size, align, flags, mep->me_uaddr);
|
||||
|
||||
(void) splx(s);
|
||||
|
||||
return (mep->me_uaddr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free kernel memory block
|
||||
*
|
||||
* This function will free a kernel memory block previously allocated by
|
||||
* the atm_dev_alloc function.
|
||||
*
|
||||
* This function should not be called from interrupt level.
|
||||
*
|
||||
* Arguments:
|
||||
* uaddr pointer to allocated aligned memory block
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
atm_dev_free(uaddr)
|
||||
volatile void *uaddr;
|
||||
{
|
||||
Mem_blk *mbp;
|
||||
Mem_ent *mep;
|
||||
int s, i;
|
||||
|
||||
ATM_DEBUG1("atm_dev_free: uaddr=%p\n", uaddr);
|
||||
|
||||
s = splimp();
|
||||
|
||||
/*
|
||||
* Protect ourselves...
|
||||
*/
|
||||
if (uaddr == NULL)
|
||||
panic("atm_dev_free: trying to free null address");
|
||||
|
||||
/*
|
||||
* Find our associated entry
|
||||
*/
|
||||
mep = NULL;
|
||||
for (mbp = atm_mem_head; mbp && mep == NULL; mbp = mbp->mb_next) {
|
||||
for (i = 0; i < MEM_NMEMENT; i++) {
|
||||
if (mbp->mb_mement[i].me_uaddr == uaddr) {
|
||||
mep = &mbp->mb_mement[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we didn't find our entry, then unceremoniously let the caller
|
||||
* know they screwed up (it certainly couldn't be a bug here...)
|
||||
*/
|
||||
if (mep == NULL)
|
||||
panic("atm_dev_free: trying to free unknown address");
|
||||
|
||||
/*
|
||||
* Give the memory space back to the kernel
|
||||
*/
|
||||
if (mep->me_flags & ATM_DEV_NONCACHE) {
|
||||
free(mep->me_kaddr, M_DEVBUF);
|
||||
} else {
|
||||
free(mep->me_kaddr, M_DEVBUF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free our entry
|
||||
*/
|
||||
mep->me_uaddr = NULL;
|
||||
|
||||
(void) splx(s);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compress buffer chain
|
||||
*
|
||||
* This function will compress a supplied buffer chain into a minimum number
|
||||
* of kernel buffers. Typically, this function will be used because the
|
||||
* number of buffers in an output buffer chain is too large for a device's
|
||||
* DMA capabilities. This should only be called as a last resort, since
|
||||
* all the data copying will surely kill any hopes of decent performance.
|
||||
*
|
||||
* Arguments:
|
||||
* m pointer to source buffer chain
|
||||
*
|
||||
* Returns:
|
||||
* n pointer to compressed buffer chain
|
||||
*
|
||||
*/
|
||||
KBuffer *
|
||||
atm_dev_compress(m)
|
||||
KBuffer *m;
|
||||
{
|
||||
KBuffer *n, *n0, **np;
|
||||
int len, space;
|
||||
caddr_t src, dst;
|
||||
|
||||
n = n0 = NULL;
|
||||
np = &n0;
|
||||
dst = NULL;
|
||||
space = 0;
|
||||
|
||||
/*
|
||||
* Copy each source buffer into compressed chain
|
||||
*/
|
||||
while (m) {
|
||||
|
||||
if (space == 0) {
|
||||
|
||||
/*
|
||||
* Allocate another buffer for compressed chain
|
||||
*/
|
||||
KB_ALLOCEXT(n, ATM_DEV_CMPR_LG, KB_F_NOWAIT, KB_T_DATA);
|
||||
if (n) {
|
||||
space = ATM_DEV_CMPR_LG;
|
||||
} else {
|
||||
KB_ALLOC(n, ATM_DEV_CMPR_SM, KB_F_NOWAIT,
|
||||
KB_T_DATA);
|
||||
if (n) {
|
||||
space = ATM_DEV_CMPR_SM;
|
||||
} else {
|
||||
/*
|
||||
* Unable to get any new buffers, so
|
||||
* just return the partially compressed
|
||||
* chain and hope...
|
||||
*/
|
||||
*np = m;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
KB_HEADSET(n, 0);
|
||||
KB_LEN(n) = 0;
|
||||
KB_BFRSTART(n, dst, caddr_t);
|
||||
|
||||
*np = n;
|
||||
np = &KB_NEXT(n);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy what we can from source buffer
|
||||
*/
|
||||
len = MIN(space, KB_LEN(m));
|
||||
KB_DATASTART(m, src, caddr_t);
|
||||
bcopy(src, dst, len);
|
||||
|
||||
/*
|
||||
* Adjust for copied data
|
||||
*/
|
||||
dst += len;
|
||||
space -= len;
|
||||
|
||||
KB_HEADADJ(m, -len);
|
||||
KB_TAILADJ(n, len);
|
||||
|
||||
/*
|
||||
* If we've exhausted our current source buffer, free it
|
||||
* and move to the next one
|
||||
*/
|
||||
if (KB_LEN(m) == 0) {
|
||||
KB_FREEONE(m, m);
|
||||
}
|
||||
}
|
||||
|
||||
return (n0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Locate VCC entry
|
||||
*
|
||||
* This function will return the VCC entry for a specified interface and
|
||||
* VPI/VCI value.
|
||||
*
|
||||
* Arguments:
|
||||
* cup pointer to interface unit structure
|
||||
* vpi VPI value
|
||||
* vci VCI value
|
||||
* type VCC type
|
||||
*
|
||||
* Returns:
|
||||
* vcp pointer to located VCC entry matching
|
||||
* NULL no VCC found
|
||||
*
|
||||
*/
|
||||
Cmn_vcc *
|
||||
atm_dev_vcc_find(cup, vpi, vci, type)
|
||||
Cmn_unit *cup;
|
||||
u_int vpi;
|
||||
u_int vci;
|
||||
u_int type;
|
||||
{
|
||||
Cmn_vcc *cvp;
|
||||
int s = splnet();
|
||||
|
||||
/*
|
||||
* Go find VCC
|
||||
*
|
||||
* (Probably should stick in a hash table some time)
|
||||
*/
|
||||
for (cvp = cup->cu_vcc; cvp; cvp = cvp->cv_next) {
|
||||
struct vccb *vcp;
|
||||
|
||||
vcp = cvp->cv_connvc->cvc_vcc;
|
||||
if ((vcp->vc_vci == vci) && (vcp->vc_vpi == vpi) &&
|
||||
((vcp->vc_type & type) == type))
|
||||
break;
|
||||
}
|
||||
|
||||
(void) splx(s);
|
||||
return (cvp);
|
||||
}
|
||||
|
||||
|
||||
#ifdef notdef
|
||||
/*
|
||||
* Module unloading notification
|
||||
*
|
||||
* This function must be called just prior to unloading the module from
|
||||
* memory. All allocated memory will be freed here and anything else that
|
||||
* needs cleaning up.
|
||||
*
|
||||
* Arguments:
|
||||
* none
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
atm_unload()
|
||||
{
|
||||
Mem_blk *mbp;
|
||||
Mem_ent *mep;
|
||||
int s, i;
|
||||
|
||||
s = splimp();
|
||||
|
||||
/*
|
||||
* Free up all of our memory management storage
|
||||
*/
|
||||
while (mbp = atm_mem_head) {
|
||||
|
||||
/*
|
||||
* Make sure users have freed up all of their memory
|
||||
*/
|
||||
for (i = 0; i < MEM_NMEMENT; i++) {
|
||||
if (mbp->mb_mement[i].me_uaddr != NULL) {
|
||||
panic("atm_unload: unfreed memory");
|
||||
}
|
||||
}
|
||||
|
||||
atm_mem_head = mbp->mb_next;
|
||||
|
||||
/*
|
||||
* Hand this block back to the kernel
|
||||
*/
|
||||
free((caddr_t)mbp, M_DEVBUF);
|
||||
}
|
||||
|
||||
(void) splx(s);
|
||||
|
||||
return;
|
||||
}
|
||||
#endif /* notdef */
|
||||
|
||||
|
||||
/*
|
||||
* Print a PDU
|
||||
*
|
||||
* Arguments:
|
||||
* cup pointer to device unit
|
||||
* cvp pointer to VCC control block
|
||||
* m pointer to pdu buffer chain
|
||||
* msg pointer to message string
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*
|
||||
*/
|
||||
void
|
||||
atm_dev_pdu_print(const Cmn_unit *cup, const Cmn_vcc *cvp,
|
||||
const KBuffer *m, const char *msg)
|
||||
{
|
||||
char buf[128];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s vcc=(%d,%d)", msg,
|
||||
cvp->cv_connvc->cvc_vcc->vc_vpi,
|
||||
cvp->cv_connvc->cvc_vcc->vc_vci);
|
||||
|
||||
atm_pdu_print(m, buf);
|
||||
}
|
||||
1147
sys/netatm/atm_if.c
1147
sys/netatm/atm_if.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,369 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Core ATM Services
|
||||
* -----------------
|
||||
*
|
||||
* ATM Physical and Network Interface definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _NETATM_ATM_IF_H
|
||||
#define _NETATM_ATM_IF_H
|
||||
|
||||
/*
|
||||
* Handy constants
|
||||
*/
|
||||
#define ATM_NIF_MTU 9180 /* Default network interface MTU */
|
||||
|
||||
#define ATM_PCR_25 59111 /* Peak Cell Rate for 25.6 Mbs */
|
||||
#define ATM_PCR_DS3 (12*8000) /* 12 cells in 1/8000 sec */
|
||||
#define ATM_PCR_TAXI100 227273 /* Peak Cell Rate for 100 Mbs TAXI */
|
||||
#define ATM_PCR_TAXI140 318181 /* Peak Cell Rate for 140 Mbs TAXI */
|
||||
#define ATM_PCR_OC3C 353207 /* Peak Cell Rate for OC3c */
|
||||
#define ATM_PCR_OC12C 1416905 /* Peak Cell Rate for OC12c */
|
||||
|
||||
|
||||
/*
|
||||
* Media Access Control (MAC) address
|
||||
*/
|
||||
struct mac_addr {
|
||||
u_char ma_data[6]; /* MAC address */
|
||||
};
|
||||
typedef struct mac_addr Mac_addr;
|
||||
|
||||
|
||||
/*
|
||||
* Adapter vendor identifiers
|
||||
*/
|
||||
enum atm_vendor {
|
||||
VENDOR_UNKNOWN, /* Unknown vendor */
|
||||
VENDOR_FORE, /* FORE Systems, Inc. */
|
||||
VENDOR_ENI, /* Efficient Networks, Inc. */
|
||||
VENDOR_IDT, /* Integrated Device Technology, Inc. */
|
||||
VENDOR_PROSUM, /* Prosum, Inc. */
|
||||
VENDOR_NETGRAPH /* Netgraph device */
|
||||
};
|
||||
typedef enum atm_vendor Atm_vendor;
|
||||
|
||||
|
||||
/*
|
||||
* Adapter vendor interface identifiers
|
||||
*/
|
||||
enum atm_vendapi {
|
||||
VENDAPI_UNKNOWN, /* Unknown interface */
|
||||
VENDAPI_FORE_1, /* FORE - 200 Series */
|
||||
VENDAPI_ENI_1, /* ENI - Midway */
|
||||
VENDAPI_IDT_1, /* IDT - NICStAR */
|
||||
VENDAPI_IDT_2, /* IDT 77252 */
|
||||
VENDAPI_NETGRAPH_1, /* Netgraph API v1 */
|
||||
VENDAPI_FORE_2, /* FORE - HE Series */
|
||||
};
|
||||
typedef enum atm_vendapi Atm_vendapi;
|
||||
|
||||
|
||||
/*
|
||||
* Adapter device model identifiers
|
||||
*/
|
||||
enum atm_device {
|
||||
DEV_UNKNOWN, /* Unknown device */
|
||||
DEV_FORE_SBA200E, /* FORE SBA-200E */
|
||||
DEV_FORE_SBA200, /* FORE SBA-200 */
|
||||
DEV_FORE_PCA200E, /* FORE PCA-200E */
|
||||
DEV_FORE_ESA200E, /* FORE ESA-200E */
|
||||
DEV_ENI_155P, /* ENI-155p */
|
||||
DEV_IDT_155, /* IDT NICStAR */
|
||||
DEV_PROATM_25, /* Prosum boards based on IDT 77252 */
|
||||
DEV_PROATM_155, /* Prosum boards based on IDT 77252 */
|
||||
DEV_VATMPIF, /* Virtual ATM Physical IF */
|
||||
DEV_FORE_LE25, /* ForeLE-25 */
|
||||
DEV_FORE_LE155, /* ForeLE-155 */
|
||||
DEV_IDT_25, /* IDT NICStAR */
|
||||
DEV_IDTABR_25, /* IDT 77252 evaluation board */
|
||||
DEV_IDTABR_155, /* IDT 77252 evaluation board */
|
||||
DEV_FORE_HE155, /* ForeRunnerHE-155 */
|
||||
DEV_FORE_HE622, /* ForeRunnerHE-622 */
|
||||
};
|
||||
typedef enum atm_device Atm_device;
|
||||
|
||||
|
||||
/*
|
||||
* Adapter media identifiers
|
||||
*/
|
||||
enum atm_media {
|
||||
MEDIA_UNKNOWN, /* Unknown media type */
|
||||
MEDIA_TAXI_100, /* TAXI - 100 Mbps */
|
||||
MEDIA_TAXI_140, /* TAXI - 140 Mbps */
|
||||
MEDIA_OC3C, /* OC-3C */
|
||||
MEDIA_OC12C, /* OC-12C */
|
||||
MEDIA_UTP155, /* UTP-155 */
|
||||
MEDIA_UTP25, /* UTP-25.6 */
|
||||
MEDIA_VIRTUAL, /* Virtual Link */
|
||||
MEDIA_DSL /* xDSL */
|
||||
};
|
||||
typedef enum atm_media Atm_media;
|
||||
|
||||
|
||||
/*
|
||||
* Bus type identifiers
|
||||
*/
|
||||
enum atm_bus {
|
||||
BUS_UNKNOWN, /* Unknown bus type */
|
||||
BUS_SBUS_B16, /* SBus: 16 byte (4 word) max burst */
|
||||
BUS_SBUS_B32, /* SBus: 32 byte (8 word) max burst */
|
||||
BUS_PCI, /* PCI */
|
||||
BUS_EISA, /* EISA */
|
||||
BUS_USB, /* USB */
|
||||
BUS_VIRTUAL /* Virtual Bus */
|
||||
};
|
||||
typedef enum atm_bus Atm_bus;
|
||||
|
||||
|
||||
#define VERSION_LEN 16 /* Length of version info string */
|
||||
|
||||
|
||||
/*
|
||||
* ATM adapter configuration information structure
|
||||
*/
|
||||
struct atm_config {
|
||||
Atm_vendor ac_vendor; /* Vendor */
|
||||
Atm_vendapi ac_vendapi; /* Vendor interface */
|
||||
Atm_device ac_device; /* Device model */
|
||||
Atm_media ac_media; /* Media type */
|
||||
u_long ac_serial; /* Serial number */
|
||||
Atm_bus ac_bustype; /* Bus type */
|
||||
u_long ac_busslot; /* Bus slot info (bus type dependent) */
|
||||
u_long ac_ram; /* Device ram offset */
|
||||
u_long ac_ramsize; /* Device ram size */
|
||||
Mac_addr ac_macaddr; /* MAC address */
|
||||
char ac_hard_vers[VERSION_LEN]; /* Hardware version */
|
||||
char ac_firm_vers[VERSION_LEN]; /* Firmware version */
|
||||
};
|
||||
typedef struct atm_config Atm_config;
|
||||
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#include <vm/uma.h>
|
||||
|
||||
/*
|
||||
* Common structure used to define each physical ATM device interface.
|
||||
* This structure will (normally) be embedded at the top of each driver's
|
||||
* device-specific interface structure.
|
||||
*/
|
||||
struct atm_pif {
|
||||
struct atm_pif *pif_next; /* Next registered atm interface */
|
||||
const char *pif_name; /* Device name */
|
||||
short pif_unit; /* Device unit number */
|
||||
u_char pif_flags; /* Interface flags (see below) */
|
||||
struct sigmgr *pif_sigmgr; /* Signalling Manager for interface */
|
||||
struct siginst *pif_siginst; /* Signalling protocol instance */
|
||||
struct stack_defn *pif_services; /* Interface's stack services */
|
||||
struct mac_addr pif_macaddr; /* Interface's MAC address */
|
||||
struct atm_nif *pif_nif; /* List of network interfaces */
|
||||
struct atm_pif *pif_grnext; /* Next atm device in group */
|
||||
|
||||
/* Exported functions */
|
||||
int (*pif_ioctl) /* Interface ioctl handler */
|
||||
(int, caddr_t, caddr_t);
|
||||
|
||||
/* Interface statistics */
|
||||
u_quad_t pif_ipdus; /* PDUs received from interface */
|
||||
u_quad_t pif_opdus; /* PDUs sent to interface */
|
||||
u_quad_t pif_ibytes; /* Bytes received from interface */
|
||||
u_quad_t pif_obytes; /* Bytes sent to interface */
|
||||
u_quad_t pif_ierrors; /* Errors receiving from interface */
|
||||
u_quad_t pif_oerrors; /* Errors sending to interface */
|
||||
u_quad_t pif_cmderrors; /* Interface command errors */
|
||||
caddr_t pif_cardstats; /* Card specific statistics */
|
||||
|
||||
/* Interface capabilities */
|
||||
u_short pif_maxvpi; /* Maximum VPI value supported */
|
||||
u_short pif_maxvci; /* Maximum VCI value supported */
|
||||
u_int pif_pcr; /* Peak Cell Rate */
|
||||
};
|
||||
|
||||
/*
|
||||
* Physical interface flags
|
||||
*/
|
||||
#define PIF_UP 0x01 /* Interface is up */
|
||||
#define PIF_LOOPBACK 0x02 /* Loopback local packets */
|
||||
|
||||
|
||||
/*
|
||||
* Structure defining an ATM network interface. This structure is used as
|
||||
* the hook between the standard BSD network layer interface mechanism and
|
||||
* the ATM device layer. There may be one or more network interfaces for
|
||||
* each physical ATM interface.
|
||||
*/
|
||||
struct atm_nif {
|
||||
struct ifnet *nif_ifp; /* Network interface */
|
||||
struct atm_pif *nif_pif; /* Our physical interface */
|
||||
char nif_name[IFNAMSIZ];/* Network interface name */
|
||||
u_char nif_sel; /* Interface's address selector */
|
||||
struct atm_nif *nif_pnext; /* Next net interface on phys i/f */
|
||||
|
||||
/* Interface statistics (in addition to ifnet stats) */
|
||||
long nif_ibytes; /* Bytes received from interface */
|
||||
long nif_obytes; /* Bytes sent to interface */
|
||||
};
|
||||
#define ANIF2IFP(an) ((an)->nif_ifp)
|
||||
#define IFP2ANIF(ifp) ((struct atm_nif *)(ifp)->if_softc)
|
||||
|
||||
/*
|
||||
* Common Device VCC Entry
|
||||
*
|
||||
* Contains the common information for each VCC which is opened
|
||||
* through a particular device.
|
||||
*/
|
||||
struct cmn_vcc {
|
||||
struct cmn_vcc *cv_next; /* Next in list */
|
||||
void *cv_toku; /* Upper layer's token */
|
||||
void (*cv_upper) /* Upper layer's interface */
|
||||
(int, void *, intptr_t, intptr_t);
|
||||
Atm_connvc *cv_connvc; /* Associated connection VCC */
|
||||
u_char cv_state; /* VCC state (see below) */
|
||||
u_char cv_flags; /* VCC flags (see below) */
|
||||
};
|
||||
typedef struct cmn_vcc Cmn_vcc;
|
||||
|
||||
/*
|
||||
* VCC States
|
||||
*/
|
||||
#define CVS_FREE 0 /* Not allocated */
|
||||
#define CVS_INST 1 /* Instantiated, waiting for INIT */
|
||||
#define CVS_INITED 2 /* Initialized, waiting for driver */
|
||||
#define CVS_ACTIVE 3 /* Device activated by driver */
|
||||
#define CVS_PTERM 4 /* Waiting for TERM */
|
||||
#define CVS_TERM 5 /* Terminated */
|
||||
|
||||
/*
|
||||
* VCC Flags
|
||||
*/
|
||||
#define CVF_RSVD 0x0f /* Reserved for device-specific use */
|
||||
|
||||
|
||||
/*
|
||||
* Common Device Unit Structure
|
||||
*
|
||||
* Contains the common information for a single device (adapter).
|
||||
*/
|
||||
struct cmn_unit {
|
||||
struct atm_pif cu_pif; /* Physical interface */
|
||||
u_int cu_unit; /* Local unit number */
|
||||
u_char cu_flags; /* Device flags (see below) */
|
||||
u_int cu_mtu; /* Interface MTU */
|
||||
|
||||
u_int cu_open_vcc; /* Open VCC count */
|
||||
Cmn_vcc *cu_vcc; /* List of VCC's on interface */
|
||||
|
||||
u_int cu_intrpri; /* Highest unit interrupt priority */
|
||||
int cu_savepri; /* Saved priority for locking device */
|
||||
|
||||
uma_zone_t cu_vcc_zone; /* Device VCC zone */
|
||||
uma_zone_t cu_nif_zone; /* Device NIF zone */
|
||||
|
||||
int (*cu_ioctl) /* Interface ioctl handler */
|
||||
(int, caddr_t, caddr_t);
|
||||
int (*cu_instvcc) /* VCC stack instantion handler */
|
||||
(struct cmn_unit *, Cmn_vcc *);
|
||||
int (*cu_openvcc) /* Open VCC handler */
|
||||
(struct cmn_unit *, Cmn_vcc *);
|
||||
int (*cu_closevcc) /* Close VCC handler */
|
||||
(struct cmn_unit *, Cmn_vcc *);
|
||||
void (*cu_output) /* Data output handler */
|
||||
(struct cmn_unit *, Cmn_vcc *, KBuffer *);
|
||||
|
||||
Atm_config cu_config; /* Device configuration data */
|
||||
|
||||
void * cu_softc; /* pointer to driver state */
|
||||
};
|
||||
typedef struct cmn_unit Cmn_unit;
|
||||
|
||||
/*
|
||||
* Device flags
|
||||
*/
|
||||
#define CUF_REGISTER 0x01 /* Device is registered */
|
||||
#define CUF_INITED 0x02 /* Device is initialized */
|
||||
|
||||
|
||||
/*
|
||||
* Structure used to define a network convergence module and its associated
|
||||
* entry points. A convergence module is used to provide the interface
|
||||
* translations necessary between the ATM system and the BSD network layer
|
||||
* interface mechanism. There will be one network convergence module for
|
||||
* each protocol address family supporting ATM connections.
|
||||
*/
|
||||
struct atm_ncm {
|
||||
struct atm_ncm *ncm_next; /* Next in registry list */
|
||||
u_short ncm_family; /* Protocol family */
|
||||
/* Exported functions */
|
||||
int (*ncm_ifoutput) /* Interface if_output handler */
|
||||
(struct ifnet *, KBuffer *, struct sockaddr *);
|
||||
int (*ncm_stat) /* Network i/f status handler */
|
||||
(int, struct atm_nif *, intptr_t);
|
||||
};
|
||||
|
||||
/*
|
||||
* ncm_stat() commands
|
||||
*/
|
||||
#define NCM_ATTACH 1 /* Attaching a new net i/f */
|
||||
#define NCM_DETACH 2 /* Detaching a current net i/f */
|
||||
#define NCM_SETADDR 3 /* Net i/f address change */
|
||||
#define NCM_SIGATTACH 4 /* Attaching a signalling manager */
|
||||
#define NCM_SIGDETACH 5 /* Detaching a signalling manager */
|
||||
|
||||
|
||||
/*
|
||||
* atm_dev_alloc() parameters
|
||||
*/
|
||||
#define ATM_DEV_NONCACHE 1 /* Allocate non-cacheable memory */
|
||||
|
||||
/*
|
||||
* atm_dev_compress() buffer allocation sizes
|
||||
*/
|
||||
#define ATM_DEV_CMPR_LG MCLBYTES /* Size of large buffers */
|
||||
#define ATM_DEV_CMPR_SM MLEN /* Size of small buffers */
|
||||
|
||||
/*
|
||||
* Macros to lock out device interrupts
|
||||
*/
|
||||
#define DEVICE_LOCK(u) ((u)->cu_savepri = splimp())
|
||||
#define DEVICE_UNLOCK(u) ((void) splx((u)->cu_savepri))
|
||||
|
||||
/*
|
||||
* Macro to schedule the ATM interrupt queue handler
|
||||
*/
|
||||
typedef void (atm_intr_t)(void *, KBuffer *); /* Callback function type */
|
||||
typedef atm_intr_t *atm_intr_func_t; /* Pointer to callback function */
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _NETATM_ATM_IF_H */
|
||||
|
|
@ -1,430 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Core ATM Services
|
||||
* -----------------
|
||||
*
|
||||
* PF_ATM socket ioctl definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _NETATM_ATM_IOCTL_H
|
||||
#define _NETATM_ATM_IOCTL_H
|
||||
|
||||
|
||||
/*
|
||||
* Structure for PF_ATM configure (AIOCCFG) socket ioctls
|
||||
*/
|
||||
struct atmcfgreq {
|
||||
int acr_opcode; /* Sub-operation */
|
||||
union {
|
||||
struct {
|
||||
/* Configure - attach */
|
||||
char acru_att_intf[IFNAMSIZ];/* Interface name */
|
||||
u_char acru_att_proto; /* Signalling protocol */
|
||||
} acru_att;
|
||||
struct {
|
||||
/* Configure - detach */
|
||||
char acru_det_intf[IFNAMSIZ];/* Interface name */
|
||||
} acru_det;
|
||||
} acr_u;
|
||||
};
|
||||
#define acr_att_intf acr_u.acru_att.acru_att_intf
|
||||
#define acr_att_proto acr_u.acru_att.acru_att_proto
|
||||
#define acr_det_intf acr_u.acru_det.acru_det_intf
|
||||
|
||||
|
||||
/*
|
||||
* Structure for PF_ATM set (AIOCSET) socket ioctls
|
||||
*/
|
||||
struct atmsetreq {
|
||||
int asr_opcode; /* Sub-operation */
|
||||
union {
|
||||
/* ARP server */
|
||||
struct {
|
||||
char asru_arp_intf[IFNAMSIZ];/* Interface name */
|
||||
Atm_addr asru_arp_addr; /* ARP srvr address */
|
||||
Atm_addr asru_arp_subaddr;/* ARP srvr subaddr */
|
||||
caddr_t asru_arp_pbuf; /* Prefix buffer addr */
|
||||
size_t asru_arp_plen; /* Prefix buffer len */
|
||||
} asru_asrvr;
|
||||
/* MAC address */
|
||||
struct {
|
||||
char asru_mac_intf[IFNAMSIZ];/* Interface name */
|
||||
struct mac_addr asru_mac_addr; /* MAC address */
|
||||
} asru_mac;
|
||||
/* Network interface */
|
||||
struct {
|
||||
char asru_nif_intf[IFNAMSIZ];/* Interface name */
|
||||
char asru_nif_pref[IFNAMSIZ];/* I/f prefix name */
|
||||
u_int asru_nif_cnt; /* Number of i/fs */
|
||||
} asru_nif;
|
||||
/* NSAP prefix */
|
||||
struct {
|
||||
char asru_prf_intf[IFNAMSIZ];/* Interface name */
|
||||
u_char asru_prf_pref[13]; /* NSAP prefix */
|
||||
} asru_prf;
|
||||
} asr_u;
|
||||
};
|
||||
#define asr_arp_intf asr_u.asru_asrvr.asru_arp_intf
|
||||
#define asr_arp_addr asr_u.asru_asrvr.asru_arp_addr
|
||||
#define asr_arp_pbuf asr_u.asru_asrvr.asru_arp_pbuf
|
||||
#define asr_arp_plen asr_u.asru_asrvr.asru_arp_plen
|
||||
#define asr_arp_subaddr asr_u.asru_asrvr.asru_arp_subaddr
|
||||
#define asr_mac_intf asr_u.asru_mac.asru_mac_intf
|
||||
#define asr_mac_addr asr_u.asru_mac.asru_mac_addr
|
||||
#define asr_nif_intf asr_u.asru_nif.asru_nif_intf
|
||||
#define asr_nif_pref asr_u.asru_nif.asru_nif_pref
|
||||
#define asr_nif_cnt asr_u.asru_nif.asru_nif_cnt
|
||||
#define asr_prf_intf asr_u.asru_prf.asru_prf_intf
|
||||
#define asr_prf_pref asr_u.asru_prf.asru_prf_pref
|
||||
|
||||
|
||||
/*
|
||||
* Structure for PF_ATM add (AIOCADD) socket ioctls
|
||||
*/
|
||||
struct atmaddreq {
|
||||
int aar_opcode; /* Sub-operation */
|
||||
union {
|
||||
/* Add PVC */
|
||||
struct {
|
||||
char aaru_pvc_intf[IFNAMSIZ];/* Interface name */
|
||||
u_short aaru_pvc_vpi; /* VPI value */
|
||||
u_short aaru_pvc_vci; /* VCI value */
|
||||
struct sockaddr aaru_pvc_dst; /* Destination addr */
|
||||
Sap_t aaru_pvc_sap; /* Endpoint SAP */
|
||||
Aal_t aaru_pvc_aal; /* AAL */
|
||||
Encaps_t aaru_pvc_encaps; /* Encapsulation */
|
||||
u_char aaru_pvc_flags; /* Flags (see below) */
|
||||
uint8_t aaru_pvc_traffic_type; /* traffic type */
|
||||
struct t_atm_traffic aaru_pvc_traffic; /* traffic parameters */
|
||||
} aaru_add_pvc;
|
||||
|
||||
/* Add ARP table entry */
|
||||
struct {
|
||||
char aaru_arp_intf[IFNAMSIZ];/* Interface name */
|
||||
struct sockaddr aaru_arp_dst; /* IP addr */
|
||||
Atm_addr aaru_arp_addr; /* ATM addr */
|
||||
u_char aaru_arp_origin; /* Entry origin */
|
||||
} aaru_add_arp;
|
||||
} aar_u;
|
||||
};
|
||||
#define aar_pvc_intf aar_u.aaru_add_pvc.aaru_pvc_intf
|
||||
#define aar_pvc_vpi aar_u.aaru_add_pvc.aaru_pvc_vpi
|
||||
#define aar_pvc_vci aar_u.aaru_add_pvc.aaru_pvc_vci
|
||||
#define aar_pvc_dst aar_u.aaru_add_pvc.aaru_pvc_dst
|
||||
#define aar_pvc_sap aar_u.aaru_add_pvc.aaru_pvc_sap
|
||||
#define aar_pvc_aal aar_u.aaru_add_pvc.aaru_pvc_aal
|
||||
#define aar_pvc_encaps aar_u.aaru_add_pvc.aaru_pvc_encaps
|
||||
#define aar_pvc_flags aar_u.aaru_add_pvc.aaru_pvc_flags
|
||||
#define aar_pvc_traffic_type aar_u.aaru_add_pvc.aaru_pvc_traffic_type
|
||||
#define aar_pvc_traffic aar_u.aaru_add_pvc.aaru_pvc_traffic
|
||||
#define aar_arp_intf aar_u.aaru_add_arp.aaru_arp_intf
|
||||
#define aar_arp_dst aar_u.aaru_add_arp.aaru_arp_dst
|
||||
#define aar_arp_addr aar_u.aaru_add_arp.aaru_arp_addr
|
||||
#define aar_arp_origin aar_u.aaru_add_arp.aaru_arp_origin
|
||||
|
||||
/* PVC flags */
|
||||
#define PVC_DYN 0x01 /* Dest addr is dynamic */
|
||||
|
||||
|
||||
/*
|
||||
* Structure for PF_ATM delete (AIOCDEL) socket ioctls
|
||||
*/
|
||||
struct atmdelreq {
|
||||
int adr_opcode; /* Sub-operation */
|
||||
union {
|
||||
/* Delete PVC */
|
||||
struct {
|
||||
char adru_pvc_intf[IFNAMSIZ];/* Interface name */
|
||||
u_short adru_pvc_vpi; /* VPI value */
|
||||
u_short adru_pvc_vci; /* VCI value */
|
||||
} adru_del_pvc;
|
||||
|
||||
/* Delete SVC */
|
||||
struct {
|
||||
char adru_svc_intf[IFNAMSIZ];/* Interface name */
|
||||
u_short adru_svc_vpi; /* VPI value */
|
||||
u_short adru_svc_vci; /* VCI value */
|
||||
} adru_del_svc;
|
||||
|
||||
/* Delete ARP table entry */
|
||||
struct {
|
||||
char adru_arp_intf[IFNAMSIZ];/* Interface name */
|
||||
struct sockaddr adru_arp_dst; /* IP addr */
|
||||
} adru_del_arp;
|
||||
} adr_u;
|
||||
};
|
||||
#define adr_pvc_intf adr_u.adru_del_pvc.adru_pvc_intf
|
||||
#define adr_pvc_vpi adr_u.adru_del_pvc.adru_pvc_vpi
|
||||
#define adr_pvc_vci adr_u.adru_del_pvc.adru_pvc_vci
|
||||
#define adr_svc_intf adr_u.adru_del_svc.adru_svc_intf
|
||||
#define adr_svc_vpi adr_u.adru_del_svc.adru_svc_vpi
|
||||
#define adr_svc_vci adr_u.adru_del_svc.adru_svc_vci
|
||||
#define adr_arp_intf adr_u.adru_del_arp.adru_arp_intf
|
||||
#define adr_arp_dst adr_u.adru_del_arp.adru_arp_dst
|
||||
|
||||
|
||||
/*
|
||||
* Structure for PF_ATM information (AIOCINFO) socket ioctls
|
||||
*/
|
||||
struct atminfreq {
|
||||
int air_opcode; /* Sub-operation */
|
||||
caddr_t air_buf_addr; /* Buffer for returned info */
|
||||
size_t air_buf_len; /* Buffer length */
|
||||
union {
|
||||
/* Vendor info */
|
||||
char airu_vinfo_intf[IFNAMSIZ];/* Interface name */
|
||||
/* IP VCC */
|
||||
struct sockaddr airu_ip_addr; /* Destination host */
|
||||
/* ARP table */
|
||||
struct {
|
||||
struct sockaddr airu_arp_addr; /* Destination host */
|
||||
u_char airu_arp_flags; /* Flags (see below) */
|
||||
} airu_arp;
|
||||
/* ARP server */
|
||||
char airu_asrv_intf[IFNAMSIZ];/* Interface name */
|
||||
/* Interface */
|
||||
char airu_int_intf[IFNAMSIZ];/* Interface name */
|
||||
/* VCC */
|
||||
char airu_vcc_intf[IFNAMSIZ];/* Interface name */
|
||||
/* Configuration */
|
||||
char airu_cfg_intf[IFNAMSIZ];/* Interface name */
|
||||
/* Network interface */
|
||||
char airu_netif_intf[IFNAMSIZ];/* Interface name */
|
||||
/* Physical interface statistics */
|
||||
char airu_physt_intf[IFNAMSIZ];/* Interface name */
|
||||
} air_u;
|
||||
};
|
||||
#define air_vinfo_intf air_u.airu_vinfo_intf
|
||||
#define air_ip_addr air_u.airu_ip_addr
|
||||
#define air_arp_addr air_u.airu_arp.airu_arp_addr
|
||||
#define air_arp_flags air_u.airu_arp.airu_arp_flags
|
||||
#define air_asrv_intf air_u.airu_asrv_intf
|
||||
#define air_int_intf air_u.airu_int_intf
|
||||
#define air_vcc_intf air_u.airu_vcc_intf
|
||||
#define air_cfg_intf air_u.airu_cfg_intf
|
||||
#define air_netif_intf air_u.airu_netif_intf
|
||||
#define air_physt_intf air_u.airu_physt_intf
|
||||
|
||||
/* ARP table info flags */
|
||||
#define ARP_RESET_REF 0x01 /* Reset refresh status */
|
||||
|
||||
|
||||
/*
|
||||
* Structures returned by information requests
|
||||
*/
|
||||
|
||||
/*
|
||||
* Vendor-specific interface information
|
||||
*/
|
||||
struct air_vinfo_rsp {
|
||||
char avsp_intf[IFNAMSIZ]; /* Interface name */
|
||||
size_t avsp_len; /* Length of returned
|
||||
Vendor Info block */
|
||||
/* Vendor info ... */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* ARP table information
|
||||
*/
|
||||
struct air_arp_rsp {
|
||||
struct sockaddr aap_arp_addr; /* Destination host */
|
||||
char aap_intf[IFNAMSIZ]; /* Interface name */
|
||||
u_char aap_flags; /* Flags (see below) */
|
||||
u_char aap_origin; /* Entry origin (see below) */
|
||||
u_char aap_age; /* Aging timeout (minutes) */
|
||||
Atm_addr aap_addr; /* ATM address */
|
||||
Atm_addr aap_subaddr; /* ATM subaddress */
|
||||
};
|
||||
|
||||
/*
|
||||
* ARP entry flags
|
||||
*/
|
||||
#define ARPF_VALID 0x01 /* Entry is valid */
|
||||
#define ARPF_REFRESH 0x02 /* Entry has been refreshed */
|
||||
|
||||
/*
|
||||
* ARP entry origin
|
||||
*/
|
||||
#define ARP_ORIG_PERM 50 /* Permanent entry */
|
||||
|
||||
/*
|
||||
* IP VCC information
|
||||
*/
|
||||
struct air_ip_vcc_rsp {
|
||||
struct sockaddr aip_dst_addr; /* Destination host */
|
||||
char aip_intf[IFNAMSIZ]; /* Interface name */
|
||||
u_short aip_vpi; /* VPI value */
|
||||
u_short aip_vci; /* VCI value */
|
||||
u_char aip_sig_proto; /* Signalling protocol */
|
||||
u_char aip_flags; /* Flags (IVF_*) */
|
||||
u_char aip_state; /* IP VCC state */
|
||||
};
|
||||
|
||||
/*
|
||||
* ARP server information
|
||||
*/
|
||||
struct air_asrv_rsp {
|
||||
char asp_intf[IFNAMSIZ]; /* Interface name */
|
||||
Atm_addr asp_addr; /* Server ATM address */
|
||||
Atm_addr asp_subaddr; /* Server ATM subaddress */
|
||||
int asp_state; /* Server state */
|
||||
int asp_nprefix; /* Number of prefix entries */
|
||||
};
|
||||
|
||||
/*
|
||||
* Interface information
|
||||
*/
|
||||
struct air_int_rsp {
|
||||
char anp_intf[IFNAMSIZ]; /* Interface name */
|
||||
Atm_addr anp_addr; /* ATM address */
|
||||
Atm_addr anp_subaddr; /* ATM subaddress */
|
||||
u_char anp_sig_proto; /* Signalling protocol */
|
||||
u_char anp_sig_state; /* Signalling protocol state */
|
||||
char anp_nif_pref[IFNAMSIZ]; /* Netif prefix */
|
||||
u_int anp_nif_cnt; /* No. of netifs */
|
||||
};
|
||||
|
||||
/*
|
||||
* Network interface information
|
||||
*/
|
||||
struct air_netif_rsp {
|
||||
char anp_intf[IFNAMSIZ]; /* Interface name */
|
||||
struct sockaddr anp_proto_addr; /* Protocol address */
|
||||
char anp_phy_intf[IFNAMSIZ]; /* Interface name */
|
||||
};
|
||||
|
||||
/*
|
||||
* VCC information
|
||||
* Todo: add avp_traffic_type and avp_traffic. Update unisig_if.c,
|
||||
* spans_if.c and sigpvc_if.c
|
||||
*/
|
||||
#define O_CNT 8
|
||||
struct air_vcc_rsp {
|
||||
char avp_intf[IFNAMSIZ]; /* Interface name */
|
||||
u_short avp_vpi; /* VPI value */
|
||||
u_short avp_vci; /* VCI value */
|
||||
u_char avp_type; /* Type (SVC or PVC) */
|
||||
u_char avp_aal; /* AAL */
|
||||
u_char avp_sig_proto; /* Signalling protocol */
|
||||
Encaps_t avp_encaps; /* Encapsulation */
|
||||
u_char avp_state; /* State (sig mgr specific) */
|
||||
char avp_owners[(T_ATM_APP_NAME_LEN+1)*O_CNT];/* VCC users */
|
||||
Atm_addr avp_daddr; /* Address of far end */
|
||||
Atm_addr avp_dsubaddr; /* Subaddress of far end */
|
||||
u_long avp_ipdus; /* PDUs received from VCC */
|
||||
u_long avp_opdus; /* PDUs sent to VCC */
|
||||
u_long avp_ibytes; /* Bytes received from VCC */
|
||||
u_long avp_obytes; /* Bytes sent to VCC */
|
||||
u_long avp_ierrors; /* Errors receiving from VCC */
|
||||
u_long avp_oerrors; /* Errors sending to VCC */
|
||||
time_t avp_tstamp; /* State transition timestamp */
|
||||
};
|
||||
|
||||
/*
|
||||
* Adapter configuration information
|
||||
*/
|
||||
struct air_cfg_rsp {
|
||||
char acp_intf[IFNAMSIZ]; /* Interface name */
|
||||
Atm_config acp_cfg; /* Config info */
|
||||
};
|
||||
#define acp_vendor acp_cfg.ac_vendor
|
||||
#define acp_vendapi acp_cfg.ac_vendapi
|
||||
#define acp_device acp_cfg.ac_device
|
||||
#define acp_media acp_cfg.ac_media
|
||||
#define acp_serial acp_cfg.ac_serial
|
||||
#define acp_bustype acp_cfg.ac_bustype
|
||||
#define acp_busslot acp_cfg.ac_busslot
|
||||
#define acp_ram acp_cfg.ac_ram
|
||||
#define acp_ramsize acp_cfg.ac_ramsize
|
||||
#define acp_macaddr acp_cfg.ac_macaddr
|
||||
#define acp_hard_vers acp_cfg.ac_hard_vers
|
||||
#define acp_firm_vers acp_cfg.ac_firm_vers
|
||||
|
||||
/*
|
||||
* Version information
|
||||
*/
|
||||
struct air_version_rsp {
|
||||
int avp_version; /* Software version */
|
||||
};
|
||||
|
||||
/*
|
||||
* Physical interface statistics
|
||||
*/
|
||||
struct air_phy_stat_rsp {
|
||||
char app_intf[IFNAMSIZ]; /* Interface name */
|
||||
u_quad_t app_ipdus; /* PDUs received from I/F */
|
||||
u_quad_t app_opdus; /* PDUs sent to I/F */
|
||||
u_quad_t app_ibytes; /* Bytes received from I/F */
|
||||
u_quad_t app_obytes; /* Bytes sent to I/F */
|
||||
u_quad_t app_ierrors; /* Errors receiving from I/F */
|
||||
u_quad_t app_oerrors; /* Errors sending to I/F */
|
||||
u_quad_t app_cmderrors; /* I/F command errors */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* PF_ATM sub-operation codes
|
||||
*/
|
||||
#define AIOCS_CFG_ATT 1
|
||||
#define AIOCS_CFG_DET 2
|
||||
#define AIOCS_ADD_PVC 32
|
||||
#define AIOCS_ADD_ARP 33
|
||||
#define AIOCS_DEL_PVC 64
|
||||
#define AIOCS_DEL_SVC 65
|
||||
#define AIOCS_DEL_ARP 66
|
||||
#define AIOCS_SET_ASV 96
|
||||
#define AIOCS_SET_NIF 97
|
||||
#define AIOCS_SET_PRF 98
|
||||
#define AIOCS_SET_MAC 99
|
||||
#define AIOCS_INF_VST 160
|
||||
#define AIOCS_INF_IPM 161
|
||||
#define AIOCS_INF_ARP 162
|
||||
#define AIOCS_INF_ASV 163
|
||||
#define AIOCS_INF_INT 164
|
||||
#define AIOCS_INF_VCC 165
|
||||
#define AIOCS_INF_CFG 166
|
||||
#define AIOCS_INF_NIF 167
|
||||
#define AIOCS_INF_PIS 168
|
||||
#define AIOCS_INF_VER 169
|
||||
|
||||
|
||||
/*
|
||||
* PF_ATM ioctls
|
||||
*/
|
||||
#define AIOCCFG _IOW('A', 128, struct atmcfgreq)/* Configure i/f */
|
||||
#define AIOCADD _IOW('A', 129, struct atmaddreq)/* Add (e.g. PVC) */
|
||||
#define AIOCDEL _IOW('A', 130, struct atmdelreq)/* Delete */
|
||||
#define AIOCSET _IOW('A', 132, struct atmsetreq)/* Set (e.g. net i/f) */
|
||||
#define AIOCINFO _IOWR('A', 133, struct atminfreq)/* Show kernel info */
|
||||
|
||||
#endif /* _NETATM_ATM_IOCTL_H */
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/*-
|
||||
*
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*
|
||||
* @(#) $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Core ATM Services
|
||||
* -----------------
|
||||
*
|
||||
* ATM socket protocol definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _NETATM_ATM_PCB_H
|
||||
#define _NETATM_ATM_PCB_H
|
||||
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* ATM Socket PCB
|
||||
*
|
||||
* Common structure for all ATM protocol sockets. This control block
|
||||
* will be used for all ATM socket types.
|
||||
*/
|
||||
struct atm_pcb {
|
||||
struct socket *atp_socket; /* Socket */
|
||||
Atm_connection *atp_conn; /* Connection manager token */
|
||||
u_char atp_type; /* Protocol type (see below) */
|
||||
u_char atp_flags; /* Protocol flags (see below) */
|
||||
Atm_attributes atp_attr; /* Socket's call attributes */
|
||||
char atp_name[T_ATM_APP_NAME_LEN]; /* Owner's name */
|
||||
};
|
||||
typedef struct atm_pcb Atm_pcb;
|
||||
|
||||
/*
|
||||
* Protocol Types
|
||||
*/
|
||||
#define ATPT_AAL5 0 /* AAL type 5 protocol */
|
||||
#define ATPT_SSCOP 1 /* SSCOP protocol */
|
||||
#define ATPT_NUM 2 /* Number of protocols */
|
||||
|
||||
/*
|
||||
* PCB Flags
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Handy macros
|
||||
*/
|
||||
#define sotoatmpcb(so) ((Atm_pcb *)(so)->so_pcb)
|
||||
|
||||
|
||||
/*
|
||||
* ATM Socket Statistics
|
||||
*/
|
||||
struct atm_sock_stat {
|
||||
u_long as_connreq[ATPT_NUM]; /* Connection requests */
|
||||
u_long as_inconn[ATPT_NUM]; /* Incoming connection requests */
|
||||
u_long as_conncomp[ATPT_NUM]; /* Connections completed */
|
||||
u_long as_connfail[ATPT_NUM]; /* Connections failed */
|
||||
u_long as_connrel[ATPT_NUM]; /* Connections released */
|
||||
u_long as_connclr[ATPT_NUM]; /* Connections cleared */
|
||||
u_long as_indrop[ATPT_NUM]; /* Input packets dropped */
|
||||
u_long as_outdrop[ATPT_NUM]; /* Output packets dropped */
|
||||
};
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _NETATM_ATM_PCB_H */
|
||||
|
|
@ -1,200 +0,0 @@
|
|||
/*-
|
||||
* ===================================
|
||||
* HARP | Host ATM Research Platform
|
||||
* ===================================
|
||||
*
|
||||
*
|
||||
* This Host ATM Research Platform ("HARP") file (the "Software") is
|
||||
* made available by Network Computing Services, Inc. ("NetworkCS")
|
||||
* "AS IS". NetworkCS does not provide maintenance, improvements or
|
||||
* support of any kind.
|
||||
*
|
||||
* NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
|
||||
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
|
||||
* SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
|
||||
* In no event shall NetworkCS be responsible for any damages, including
|
||||
* but not limited to consequential damages, arising from or relating to
|
||||
* any use of the Software or related support.
|
||||
*
|
||||
* Copyright 1994-1998 Network Computing Services, Inc.
|
||||
*
|
||||
* Copies of this Software may be made, however, the above copyright
|
||||
* notice must be reproduced on all copies.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Core ATM Services
|
||||
* -----------------
|
||||
*
|
||||
* ATM socket protocol family support definitions
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/domain.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <net/if.h>
|
||||
#include <netatm/port.h>
|
||||
#include <netatm/queue.h>
|
||||
#include <netatm/atm.h>
|
||||
#include <netatm/atm_sys.h>
|
||||
#include <netatm/atm_sap.h>
|
||||
#include <netatm/atm_cm.h>
|
||||
#include <netatm/atm_if.h>
|
||||
#include <netatm/atm_stack.h>
|
||||
#include <netatm/atm_pcb.h>
|
||||
#include <netatm/atm_var.h>
|
||||
|
||||
#error "NET_NEEDS_GIANT"
|
||||
|
||||
struct protosw atmsw[] = {
|
||||
{
|
||||
.pr_type = SOCK_DGRAM, /* ioctl()-only */
|
||||
.pr_domain = &atmdomain,
|
||||
.pr_usrreqs = &atm_dgram_usrreqs
|
||||
},
|
||||
|
||||
{
|
||||
.pr_type = SOCK_SEQPACKET, /* AAL-5 */
|
||||
.pr_domain = &atmdomain,
|
||||
.pr_protocol = ATM_PROTO_AAL5,
|
||||
.pr_flags = PR_ATOMIC|PR_CONNREQUIRED,
|
||||
.pr_ctloutput = atm_aal5_ctloutput,
|
||||
.pr_usrreqs = &atm_aal5_usrreqs
|
||||
},
|
||||
|
||||
#ifdef XXX
|
||||
{
|
||||
.pr_type = SOCK_SEQPACKET, /* SSCOP */
|
||||
.pr_domain = &atmdomain,
|
||||
.pr_protocol = ATM_PROTO_SSCOP,
|
||||
.pr_flags = PR_ATOMIC|PR_CONNREQUIRED|PR_WANTRCVD,
|
||||
.pr_input = x,
|
||||
.pr_output = x,
|
||||
.pr_ctlinput = x,
|
||||
.pr_ctloutput = x,
|
||||
.pr_drain = x,
|
||||
.pr_usrreqs = x
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
struct domain atmdomain = {
|
||||
.dom_family = AF_ATM,
|
||||
.dom_name = "atm",
|
||||
.dom_init = atm_initialize,
|
||||
.dom_protosw = atmsw,
|
||||
.dom_protoswNPROTOSW = &atmsw[sizeof(atmsw) / sizeof(atmsw[0])]
|
||||
};
|
||||
|
||||
DOMAIN_SET(atm);
|
||||
|
||||
SYSCTL_NODE(_net, PF_ATM, harp, CTLFLAG_RW, 0, "HARP/ATM family");
|
||||
SYSCTL_NODE(_net_harp, OID_AUTO, atm, CTLFLAG_RW, 0, "ATM layer");
|
||||
|
||||
/*
|
||||
* Protocol request not supported
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
*
|
||||
* Returns:
|
||||
* errno error - operation not supported
|
||||
*
|
||||
*/
|
||||
int
|
||||
atm_proto_notsupp1(so)
|
||||
struct socket *so;
|
||||
{
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Protocol request not supported
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* addr pointer to protocol address
|
||||
* p pointer to process
|
||||
*
|
||||
* Returns:
|
||||
* errno error - operation not supported
|
||||
*
|
||||
*/
|
||||
int
|
||||
atm_proto_notsupp2(so, addr, td)
|
||||
struct socket *so;
|
||||
struct sockaddr *addr;
|
||||
struct thread *td;
|
||||
{
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Protocol request not supported
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* addr pointer to pointer to protocol address
|
||||
*
|
||||
* Returns:
|
||||
* errno error - operation not supported
|
||||
*
|
||||
*/
|
||||
int
|
||||
atm_proto_notsupp3(so, addr)
|
||||
struct socket *so;
|
||||
struct sockaddr **addr;
|
||||
{
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Protocol request not supported
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
* i integer
|
||||
* m pointer to kernel buffer
|
||||
* addr pointer to protocol address
|
||||
* m2 pointer to kernel buffer
|
||||
* p pointer to process
|
||||
*
|
||||
* Returns:
|
||||
* errno error - operation not supported
|
||||
*
|
||||
*/
|
||||
int
|
||||
atm_proto_notsupp4(so, i, m, addr, m2, td)
|
||||
struct socket *so;
|
||||
int i;
|
||||
KBuffer *m;
|
||||
struct sockaddr *addr;
|
||||
KBuffer *m2;
|
||||
struct thread *td;
|
||||
{
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
/*
|
||||
* Protocol request not supported
|
||||
*
|
||||
* Arguments:
|
||||
* so pointer to socket
|
||||
*
|
||||
*/
|
||||
void
|
||||
atm_proto_notsupp5(so)
|
||||
struct socket *so;
|
||||
{
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue