1gld_mac_info(9S) Data Structures for Drivers gld_mac_info(9S)
2
3
4
6 gld_mac_info - Generic LAN Driver MAC info data structure
7
9 #include <sys/gld.h>
10
11
13 Solaris architecture specific (Solaris DDI).
14
16 The Generic LAN Driver (GLD) Media Access Control (MAC) information
17 (gld_mac_info) structure is the main data interface between the device-
18 specific driver and GLD. It contains data required by GLD and a pointer
19 to an optional additional driver-specific information structure.
20
21
22 The gld_mac_info structure should be allocated using gld_mac_alloc()
23 and deallocated using gld_mac_free(). Drivers can make no assumptions
24 about the length of this structure, which might be different in differ‐
25 ent releases of Solaris and/or GLD. Structure members private to GLD,
26 not documented here, should not be set or read by the device-specific
27 driver.
28
30 caddr_t gldm_private; /* Driver private data */
31 int (*gldm_reset)(); /* Reset device */
32 int (*gldm_start)(); /* Start device */
33 int (*gldm_stop)(); /* Stop device */
34 int (*gldm_set_mac_addr)(); /* Set device phys addr */
35 int (*gldm_set_multicast)(); /* Set/delete */
36 /* multicast address */
37 int (*gldm_set_promiscuous)();
38 /* Set/reset promiscuous */
39 /* mode*/
40 int (*gldm_send)(); /* Transmit routine */
41 u_int (*gldm_intr)(); /* Interrupt handler */
42 int (*gldm_get_stats)(); /* Get device statistics */
43 int (*gldm_ioctl)(); /* Driver-specific ioctls */
44 char *gldm_ident; /* Driver identity string */
45 uint32_t gldm_type; /* Device type */
46 uint32_t gldm_minpkt; /* Minimum packet size */
47 /* accepted by driver */
48 uint32_t gldm_maxpkt; /* Maximum packet size */
49 /* accepted by driver */
50 uint32_t gldm_addrlen; /* Physical address */
51 /* length */
52 int32_t gldm_saplen; /* SAP length for */
53 /* DL_INFO_ACK */
54 unsigned char *gldm_broadcast_addr; /* Physical broadcast */
55 /* addr */
56 unsigned char *gldm_vendor_addr; /* Factory MAC address */
57 t_uscalar_t gldm_ppa; /* Physical Point of */
58 /* Attachment (PPA) number */
59 dev_info_t *gldm_devinfo; /* Pointer to device's */
60 /* dev_info node */
61 ddi_iblock_cookie_tgldm_cookie; /* Device's interrupt */
62 /* block cookie */
63 int gldm_margin /* accepted data beyond */
64 /*gldm_maxpkt */
65 uint32_t gldm_capabilities; /* Device capabilities */
66
67
68
69
70 Below is a description of the members of the gld_mac_info structure
71 that are visible to the device driver.
72
73 gldm_private This structure member is private to the device-specific
74 driver and is not used or modified by GLD. Convention‐
75 ally, this is used as a pointer to private data, point‐
76 ing to a driver-defined and driver-allocated per-
77 instance data structure.
78
79
80
81 The following group of structure members must be set by the driver
82 before calling gld_register(), and should not thereafter be modified by
83 the driver; gld_register() can use or cache the values of some of these
84 structure members, so changes made by the driver after calling gld_reg‐
85 ister() might cause unpredicted results.
86
87 gldm_reset Pointer to driver entry point; see gld(9E).
88
89
90 gldm_start Pointer to driver entry point; see gld(9E).
91
92
93 gldm_stop Pointer to driver entry point; see gld(9E).
94
95
96 gldm_set_mac_addr Pointer to driver entry point; see gld(9E).
97
98
99 gldm_set_multicast Pointer to driver entry point; see gld(9E).
100
101
102 gldm_set_promiscuous Pointer to driver entry point; see gld(9E).
103
104
105 gldm_send Pointer to driver entry point; see gld(9E).
106
107
108 gldm_intr Pointer to driver entry point; see gld(9E).
109
110
111 gldm_get_stats Pointer to driver entry point; see gld(9E).
112
113
114 gldm_ioctl Pointer to driver entry point; can be NULL; see
115 gld(9E).
116
117
118 gldm_ident Pointer to a string containing a short descrip‐
119 tion of the device. It is used to identify the
120 device in system messages.
121
122
123 gldm_type The type of device the driver handles. The val‐
124 ues currently supported by GLD are DL_ETHER
125 (IEEE 802.3 and Ethernet Bus), DL_TPR (IEEE
126 802.5 Token Passing Ring), and DL_FDDI (ISO
127 9314-2 Fibre Distributed Data Interface). This
128 structure member must be correctly set for GLD
129 to function properly.
130
131 Support for the DL_TPR and DL_FDDI media types
132 is obsolete and may be removed in a future
133 release of Solaris.
134
135
136 gldm_minpkt Minimum Service Data Unit size — the minimum
137 packet size, not including the MAC header, that
138 the device will transmit. This can be zero if
139 the device-specific driver can handle any
140 required padding.
141
142
143 gldm_maxpkt Maximum Service Data Unit size — the maximum
144 size of packet, not including the MAC header,
145 that can be transmitted by the device. For Eth‐
146 ernet, this number is 1500.
147
148
149 gldm_addrlen The length in bytes of physical addresses han‐
150 dled by the device. For Ethernet, Token Ring,
151 and FDDI, the value of this structure member
152 should be 6.
153
154
155 gldm_saplen The length in bytes of the Service Access Point
156 (SAP) address used by the driver. For GLD-based
157 drivers, this should always be set to -2, to
158 indicate that two-byte SAP values are supported
159 and that the SAP appears after the physical
160 address in a DLSAP address. See the description
161 under ``Message DL_INFO_ACK'' in the DLPI spec‐
162 ification for more details.
163
164
165 gldm_broadcast_addr Pointer to an array of bytes of length
166 gldm_addrlen containing the broadcast address
167 to be used for transmit. The driver must allo‐
168 cate space to hold the broadcast address, fill
169 it in with the appropriate value, and set
170 gldm_broadcast_addr to point at it. For Ether‐
171 net, Token Ring, and FDDI, the broadcast
172 address is normally 0xFF-FF-FF-FF-FF-FF.
173
174
175 gldm_vendor_addr Pointer to an array of bytes of length
176 gldm_addrlen containing the vendor-provided
177 network physical address of the device. The
178 driver must allocate space to hold the address,
179 fill it in with information read from the
180 device, and set gldm_vendor_addr to point at
181 it.
182
183
184 gldm_ppa The Physical Point of Attachment (PPA) number
185 for this instance of the device. Normally this
186 should be set to the instance number, returned
187 from ddi_get_instance(9F).
188
189
190 gldm_devinfo Pointer to the dev_info node for this device.
191
192
193 gldm_cookie The interrupt block cookie returned by
194 ddi_get_iblock_cookie(9F), ddi_add_intr(9F),
195 ddi_get_soft_iblock_cookie(9F), or
196 ddi_add_softintr(9F). This must correspond to
197 the device's receive interrupt, from which
198 gld_recv() is called.
199
200
201 gldm_margin Drivers set this value to the amount of data in
202 bytes that the device can transmit beyond
203 gldm_maxpkt. For example, if an Ethernet device
204 can handle packets whose payload section is no
205 greater than 1522 bytes and the gldm_maxpkt is
206 set to 1500 (as is typical for Ethernet), then
207 gldm_margin is set to 22. The registered
208 gldm_margin value is reported in acknowledge‐
209 ments of the DLIOCMARGININFO ioctl (see
210 dlpi(7P)).
211
212
213 gldm_capabilities Bit-field of device capabilities. If the device
214 is capable of reporting media link state, the
215 GLD_CAP_LINKSTATE bit should be set.
216
217
219 gld(7D), dlpi(7P), attach(9E), gld(9E), ddi_add_intr(9F), gld(9F),
220 gld_stats(9S)
221
222
223 Writing Device Drivers
224
225
226
227SunOS 5.11 7 June 2004 gld_mac_info(9S)