sundlpi.c revision 3a18a1c198c1b0bc47599d4a37028047fc8358cc
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Common Sun DLPI routines.
*/
#include <sys/sysmacros.h>
#include <sys/byteorder.h>
void
const void *addrp,
{
union DL_primitives *dlp;
return;
if (addrlen != 0)
}
void
{
union DL_primitives *dlp;
return;
}
void
{
union DL_primitives *dlp;
DL_ERROR_ACK)) == NULL)
return;
}
void
const void *addrp,
{
union DL_primitives *dlp;
return;
if (addrlen != 0)
}
void
const void *addrp,
{
union DL_primitives *dlp;
return;
if (len != 0)
}
void
{
#ifndef _LP64
#else
#endif
}
{
#ifndef _LP64
#else
return ((queue_t *)
#endif
}
void
{
union DL_primitives *dlp;
DL_NOTIFY_ACK)) == NULL)
return;
}
static int
{
int err;
union DL_primitives *dlp;
case 0:
break;
case ETIME:
return (ETIME);
default:
return (err);
}
if (len < sizeof (t_uscalar_t)) {
return (EBADMSG);
}
goto runt;
goto mixup;
}
}
return (0);
}
if (ackprim == DL_ERROR_ACK) {
if (len < DL_ERROR_ACK_SIZE)
goto runt;
goto mixup;
}
/*
* Return a special error code (ENOTSUP) indicating that the
* caller has returned DL_ERROR_ACK. Callers that want more
* details an pass a non-NULL dleap.
*/
return (ENOTSUP);
}
return (EBADMSG);
runt:
return (EBADMSG);
return (EBADMSG);
}
/*
* Send a DL_ATTACH_REQ for `ppa' over `lh' and wait for the response.
*
* Returns an errno; ENOTSUP indicates a DL_ERROR_ACK response (and the
* caller can get the contents by passing a non-NULL `dleap').
*/
int
{
int err;
return (ENOMEM);
if (err == 0)
return (err);
}
/*
* Send a DL_BIND_REQ for `sap' over `lh' and wait for the response.
*
* Returns an errno; ENOTSUP indicates a DL_ERROR_ACK response (and the
* caller can get the contents by passing a non-NULL `dleap').
*/
int
{
int err;
return (ENOMEM);
dlbrp->dl_conn_mgmt = 0;
dlbrp->dl_max_conind = 0;
dlbrp->dl_xidtest_flg = 0;
if (err == 0) {
}
}
return (err);
}
/*
* Send a DL_PHYS_ADDR_REQ over `lh' and wait for the response. The caller
* must set `*physlenp' to the size of `physaddr' (both of which must be
* non-NULL); upon success they will be updated to contain the actual physical
* address and length.
*
* Returns an errno; ENOTSUP indicates a DL_ERROR_ACK response (and the
* caller can get the contents by passing a non-NULL `dleap').
*/
int
{
int err;
return (ENOMEM);
/*
* In case some provider doesn't implement or NAK the
* request, just wait for 15 seconds.
*/
&tv);
if (err == 0) {
} else {
}
}
return (err);
}
/*
* Send a DL_INFO_REQ over `lh' and wait for the response. The caller must
* pass a non-NULL `dliap', which upon success will contain the dl_info_ack_t
* from the provider. The caller may optionally get the provider's physical
* address by passing a non-NULL `physaddr' and setting `*physlenp' to its
* size; upon success they will be updated to contain the actual physical
* address and its length.
*
* Returns an errno; ENOTSUP indicates a DL_ERROR_ACK response (and the
* caller can get the contents by passing a non-NULL `dleap').
*/
int
{
int err;
return (ENOMEM);
if (err != 0)
return (err);
return (EBADMSG);
}
if (dliap->dl_sap_length > 0)
}
return (err);
}
/*
* Send a DL_NOTIFY_REQ over `lh' and wait for the response. The caller
* should set `notesp' to the set of notifications they wish to enable;
* upon success it will contain the notifications enabled by the provider.
*
* Returns an errno; ENOTSUP indicates a DL_ERROR_ACK response (and the
* caller can get the contents by passing a non-NULL `dleap').
*/
int
{
int err;
return (ENOMEM);
if (err == 0) {
}
return (err);
}
const char *
{
switch (prim) {
case DL_INFO_REQ: return ("DL_INFO_REQ");
case DL_INFO_ACK: return ("DL_INFO_ACK");
case DL_ATTACH_REQ: return ("DL_ATTACH_REQ");
case DL_DETACH_REQ: return ("DL_DETACH_REQ");
case DL_BIND_REQ: return ("DL_BIND_REQ");
case DL_BIND_ACK: return ("DL_BIND_ACK");
case DL_UNBIND_REQ: return ("DL_UNBIND_REQ");
case DL_OK_ACK: return ("DL_OK_ACK");
case DL_ERROR_ACK: return ("DL_ERROR_ACK");
case DL_ENABMULTI_REQ: return ("DL_ENABMULTI_REQ");
case DL_DISABMULTI_REQ: return ("DL_DISABMULTI_REQ");
case DL_PROMISCON_REQ: return ("DL_PROMISCON_REQ");
case DL_PROMISCOFF_REQ: return ("DL_PROMISCOFF_REQ");
case DL_UNITDATA_REQ: return ("DL_UNITDATA_REQ");
case DL_UNITDATA_IND: return ("DL_UNITDATA_IND");
case DL_UDERROR_IND: return ("DL_UDERROR_IND");
case DL_PHYS_ADDR_REQ: return ("DL_PHYS_ADDR_REQ");
case DL_PHYS_ADDR_ACK: return ("DL_PHYS_ADDR_ACK");
case DL_SET_PHYS_ADDR_REQ: return ("DL_SET_PHYS_ADDR_REQ");
case DL_NOTIFY_REQ: return ("DL_NOTIFY_REQ");
case DL_NOTIFY_ACK: return ("DL_NOTIFY_ACK");
case DL_NOTIFY_IND: return ("DL_NOTIFY_IND");
case DL_CAPABILITY_REQ: return ("DL_CAPABILITY_REQ");
case DL_CAPABILITY_ACK: return ("DL_CAPABILITY_ACK");
case DL_CONTROL_REQ: return ("DL_CONTROL_REQ");
case DL_CONTROL_ACK: return ("DL_CONTROL_ACK");
case DL_PASSIVE_REQ: return ("DL_PASSIVE_REQ");
case DL_INTR_MODE_REQ: return ("DL_INTR_MODE_REQ");
case DL_UDQOS_REQ: return ("DL_UDQOS_REQ");
default: return ("<unknown primitive>");
}
}
const char *
{
switch (err) {
case DL_ACCESS: return ("DL_ACCESS");
case DL_BADADDR: return ("DL_BADADDR");
case DL_BADCORR: return ("DL_BADCORR");
case DL_BADDATA: return ("DL_BADDATA");
case DL_BADPPA: return ("DL_BADPPA");
case DL_BADPRIM: return ("DL_BADPRIM");
case DL_BADQOSPARAM: return ("DL_BADQOSPARAM");
case DL_BADQOSTYPE: return ("DL_BADQOSTYPE");
case DL_BADSAP: return ("DL_BADSAP");
case DL_BADTOKEN: return ("DL_BADTOKEN");
case DL_BOUND: return ("DL_BOUND");
case DL_INITFAILED: return ("DL_INITFAILED");
case DL_NOADDR: return ("DL_NOADDR");
case DL_NOTINIT: return ("DL_NOTINIT");
case DL_OUTSTATE: return ("DL_OUTSTATE");
case DL_SYSERR: return ("DL_SYSERR");
case DL_UNSUPPORTED: return ("DL_UNSUPPORTED");
case DL_UNDELIVERABLE: return ("DL_UNDELIVERABLE");
case DL_NOTSUPPORTED: return ("DL_NOTSUPPORTED ");
case DL_TOOMANY: return ("DL_TOOMANY");
case DL_NOTENAB: return ("DL_NOTENAB");
case DL_BUSY: return ("DL_BUSY");
case DL_NOAUTO: return ("DL_NOAUTO");
case DL_NOXIDAUTO: return ("DL_NOXIDAUTO");
case DL_NOTESTAUTO: return ("DL_NOTESTAUTO");
case DL_XIDAUTO: return ("DL_XIDAUTO");
case DL_TESTAUTO: return ("DL_TESTAUTO");
case DL_PENDING: return ("DL_PENDING");
default: return ("<unknown error>");
}
}
const char *
{
switch (mactype) {
case DL_TPB: return ("Token Bus");
case DL_TPR: return ("Token Ring");
case DL_METRO: return ("Metro Net");
case DL_ETHER: return ("Ethernet");
case DL_HDLC: return ("HDLC");
case DL_CHAR: return ("Sync Character");
case DL_CTCA: return ("CTCA");
case DL_FDDI: return ("FDDI");
case DL_FRAME: return ("Frame Relay (LAPF)");
case DL_MPFRAME: return ("MP Frame Relay");
case DL_ASYNC: return ("Async Character");
case DL_IPX25: return ("X.25 (Classic IP)");
case DL_LOOP: return ("Software Loopback");
case DL_FC: return ("Fiber Channel");
case DL_ATM: return ("ATM");
case DL_IPATM: return ("ATM (Classic IP)");
case DL_X25: return ("X.25 (LAPB)");
case DL_ISDN: return ("ISDN");
case DL_HIPPI: return ("HIPPI");
case DL_100VG: return ("100BaseVG Ethernet");
case DL_100VGTPR: return ("100BaseVG Token Ring");
case DL_ETH_CSMA: return ("Ethernet/IEEE 802.3");
case DL_100BT: return ("100BaseT");
case DL_IB: return ("Infiniband");
case DL_IPV4: return ("IPv4 Tunnel");
case DL_IPV6: return ("IPv6 Tunnel");
case DL_WIFI: return ("IEEE 802.11");
case DL_IPNET: return ("IPNET");
default: return ("<unknown mactype>");
}
}