Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved
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 or http://www.opensolaris.org/os/licensing. 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]
#include <sys/gld.h>
The gld_mac_info structure should be allocated using gld_mac_alloc() and deallocated using gld_mac_free(). Drivers can make no assumptions about the length of this structure, which might be different in different releases of illumos and/or GLD. Structure members private to GLD, not documented here, should not be set or read by the device-specific driver.
caddr_t gldm_private; /* Driver private data */ int (*gldm_reset)(); /* Reset device */ int (*gldm_start)(); /* Start device */ int (*gldm_stop)(); /* Stop device */ int (*gldm_set_mac_addr)(); /* Set device phys addr */ int (*gldm_set_multicast)(); /* Set/delete */ /* multicast address */ int (*gldm_set_promiscuous)(); /* Set/reset promiscuous */ /* mode*/ int (*gldm_send)(); /* Transmit routine */ u_int (*gldm_intr)(); /* Interrupt handler */ int (*gldm_get_stats)(); /* Get device statistics */ int (*gldm_ioctl)(); /* Driver-specific ioctls */ char *gldm_ident; /* Driver identity string */ uint32_t gldm_type; /* Device type */ uint32_t gldm_minpkt; /* Minimum packet size */ /* accepted by driver */ uint32_t gldm_maxpkt; /* Maximum packet size */ /* accepted by driver */ uint32_t gldm_addrlen; /* Physical address */ /* length */ int32_t gldm_saplen; /* SAP length for */ /* DL_INFO_ACK */ unsigned char *gldm_broadcast_addr; /* Physical broadcast */ /* addr */ unsigned char *gldm_vendor_addr; /* Factory MAC address */ t_uscalar_t gldm_ppa; /* Physical Point of */ /* Attachment (PPA) number */ dev_info_t *gldm_devinfo; /* Pointer to device's */ /* dev_info node */ ddi_iblock_cookie_tgldm_cookie; /* Device's interrupt */ /* block cookie */ int gldm_margin /* accepted data beyond */ /*gldm_maxpkt */ uint32_t gldm_capabilities; /* Device capabilities */
Below is a description of the members of the gld_mac_info structure that are visible to the device driver. gldm_private
This structure member is private to the device-specific driver and is not used or modified by GLD. Conventionally, this is used as a pointer to private data, pointing to a driver-defined and driver-allocated per-instance data structure.
The following group of structure members must be set by the driver before calling gld_register(), and should not thereafter be modified by the driver; gld_register() can use or cache the values of some of these structure members, so changes made by the driver after calling gld_register() might cause unpredicted results. gldm_reset
Pointer to driver entry point; see gld(9E).
Pointer to driver entry point; see gld(9E).
Pointer to driver entry point; see gld(9E).
Pointer to driver entry point; see gld(9E).
Pointer to driver entry point; see gld(9E).
Pointer to driver entry point; see gld(9E).
Pointer to driver entry point; see gld(9E).
Pointer to driver entry point; see gld(9E).
Pointer to driver entry point; see gld(9E).
Pointer to driver entry point; can be NULL; see gld(9E).
Pointer to a string containing a short description of the device. It is used to identify the device in system messages.
The type of device the driver handles. The values currently supported by GLD are DL_ETHER (IEEE 802.3 and Ethernet Bus), DL_TPR (IEEE 802.5 Token Passing Ring), and DL_FDDI (ISO 9314-2 Fibre Distributed Data Interface). This structure member must be correctly set for GLD to function properly. Support for the DL_TPR and DL_FDDI media types is obsolete and may be removed in a future release of illumos.
Minimum Service Data Unit size \(em the minimum packet size, not including the MAC header, that the device will transmit. This can be zero if the device-specific driver can handle any required padding.
Maximum Service Data Unit size \(em the maximum size of packet, not including the MAC header, that can be transmitted by the device. For Ethernet, this number is 1500.
The length in bytes of physical addresses handled by the device. For Ethernet, Token Ring, and FDDI, the value of this structure member should be 6.
The length in bytes of the Service Access Point (SAP) address used by the driver. For GLD-based drivers, this should always be set to -2, to indicate that two-byte SAP values are supported and that the SAP appears after the physical address in a DLSAP address. See the description under ``Message DL_INFO_ACK'' in the DLPI specification for more details.
Pointer to an array of bytes of length gldm_addrlen containing the broadcast address to be used for transmit. The driver must allocate space to hold the broadcast address, fill it in with the appropriate value, and set gldm_broadcast_addr to point at it. For Ethernet, Token Ring, and FDDI, the broadcast address is normally 0xFF-FF-FF-FF-FF-FF.
Pointer to an array of bytes of length gldm_addrlen containing the vendor-provided network physical address of the device. The driver must allocate space to hold the address, fill it in with information read from the device, and set gldm_vendor_addr to point at it.
The Physical Point of Attachment (PPA) number for this instance of the device. Normally this should be set to the instance number, returned from ddi_get_instance(9F).
Pointer to the dev_info node for this device.
The interrupt block cookie returned by ddi_get_iblock_cookie(9F), ddi_add_intr(9F), ddi_get_soft_iblock_cookie(9F), or ddi_add_softintr(9F). This must correspond to the device's receive interrupt, from which gld_recv() is called.
Drivers set this value to the amount of data in bytes that the device can transmit beyond gldm_maxpkt. For example, if an Ethernet device can handle packets whose payload section is no greater than 1522 bytes and the gldm_maxpkt is set to 1500 (as is typical for Ethernet), then gldm_margin is set to 22. The registered gldm_margin value is reported in acknowledgements of the DLIOCMARGININFO ioctl (see dlpi(7P)).
Bit-field of device capabilities. If the device is capable of reporting media link state, the GLD_CAP_LINKSTATE bit should be set.
Writing Device Drivers