1 '\" te
2 .\" Copyright (c) 2003, Sun Microsystems, Inc.
3 .\" All Rights Reserved
4 .\" 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.
5 .\" 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.
6 .\" 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]
7 .TH GLD 9F "Aug 28, 2003"
8 .SH NAME
9 gld, gld_mac_alloc, gld_mac_free, gld_register, gld_unregister, gld_recv,
10 gld_sched, gld_intr \- Generic LAN Driver service routines
11 .SH SYNOPSIS
12 .LP
13 .nf
14 #include <sys/gld.h>
15
16 \fBgld_mac_info_t *\fR\fBgld_mac_alloc\fR(\fBdev_info_t *\fR\fIdip\fR);
17 .fi
18
19 .LP
20 .nf
21 \fBvoid\fR \fBgld_mac_free\fR(\fBgld_mac_info_t *\fR\fImacinfo\fR);
22 .fi
23
24 .LP
25 .nf
26 \fBint\fR \fBgld_register\fR(\fBdev_info_t *\fR\fIdip\fR, \fBchar *\fR\fIname\fR, \fBgld_mac_info_t *\fR\fImacinfo\fR);
27 .fi
28
29 .LP
30 .nf
31 \fBint\fR \fBgld_unregister\fR(\fBgld_mac_info_t *\fR\fImacinfo\fR);
32 .fi
35 .nf
36 \fBvoid\fR \fBgld_recv\fR(\fBgld_mac_info_t *\fR\fImacinfo\fR, \fBmblk_t *\fR\fImp\fR);
37 .fi
38
39 .LP
40 .nf
41 \fBvoid\fR \fBgld_sched\fR(\fBgld_mac_info_t *\fR\fImacinfo\fR);
42 .fi
43
44 .LP
45 .nf
46 \fBuint_t\fR \fBgld_intr\fR(\fBcaddr_t);\fR
47 .fi
48
49 .LP
50 .nf
51 \fBvoid\fR \fBgld_linkstate\fR(\fBgld_mac_info_t *\fR\fImacinfo\fR, \fBint32_t\fR \fInewstate\fR);
52 .fi
53
54 .SH INTERFACE LEVEL
55 .sp
56 .LP
57 Solaris architecture specific (Solaris DDI).
58 .SH PARAMETERS
59 .sp
60 .ne 2
61 .na
62 \fB\fImacinfo\fR \fR
63 .ad
64 .RS 13n
65 Pointer to a \fBgld_mac_info\fR(9S) structure.
66 .RE
67
68 .sp
69 .ne 2
70 .na
71 \fB\fIdip\fR \fR
72 .ad
73 .RS 13n
74 Pointer to \fBdev_info\fR structure.
75 .RE
76
77 .sp
78 .ne 2
79 .na
85
86 .sp
87 .ne 2
88 .na
89 \fB\fImp\fR \fR
90 .ad
91 .RS 13n
92 Pointer to a message block containing a received packet.
93 .RE
94
95 .sp
96 .ne 2
97 .na
98 \fB\fInewstate\fR \fR
99 .ad
100 .RS 13n
101 Media link state.
102 .RE
103
104 .SH DESCRIPTION
105 .sp
106 .LP
107 \fBgld_mac_alloc\fR(\|) allocates a new \fBgld_mac_info\fR(9S) structure and
108 returns a pointer to it. Some of the GLD-private elements of the structure may
109 be initialized before \fBgld_mac_alloc\fR(\|) returns; all other elements are
110 initialized to zero. The device driver must initialize some structure members,
111 as described in \fBgld_mac_info\fR(9S), before passing the mac_info pointer to
112 \fBgld_register\fR(\|).
113 .sp
114 .LP
115 \fBgld_mac_free\fR(\|) frees a \fBgld_mac_info\fR(9S) structure previously
116 allocated by \fBgld_mac_alloc\fR(\|).
117 .sp
118 .LP
119 \fBgld_register\fR(\|) is called from the device driver's \fBattach\fR(9E)
120 routine, and is used to link the GLD-based device driver with the GLD
121 framework. Before calling \fBgld_register\fR(\|) the device driver's
122 \fBattach\fR(9E) routine must first use \fBgld_mac_alloc\fR(\|) to allocate a
123 \fBgld_mac_info\fR(9S) structure, and initialize several of its structure
124 elements. See \fBgld_mac_info\fR(9S) for more information. A successful call to
125 \fBgld_register\fR(\|) performs the following actions:
126 .RS +4
247 .ne 2
248 .na
249 \fB\fBGLD_LINKSTATE_UP\fR \fR
250 .ad
251 .RS 26n
252 The media link is unavailable.
253 .RE
254
255 .sp
256 .ne 2
257 .na
258 \fB\fBGLD_LINKSTATE_UNKNOWN\fR \fR
259 .ad
260 .RS 26n
261 The status of the media link is unknown.
262 .RE
263
264 .sp
265 .LP
266 If a driver calls \fBgld_linkstate()\fR, it must also set the GLD_CAP_LINKSTATE
267 bit in the gldm_capabilties field of the \fBgld_mac_info\fR(9S) structure.
268 .SH RETURN VALUES
269 .sp
270 .LP
271 \fBgld_mac_alloc\fR(\|) returns a pointer to a new \fBgld_mac_info\fR(9S)
272 structure.
273 .sp
274 .LP
275 \fBgld_register\fR(\|) and \fBgld_unregister\fR(\|) return:
276 .sp
277 .ne 2
278 .na
279 \fB\fBDDI_SUCCESS\fR \fR
280 .ad
281 .RS 16n
282 on success.
283 .RE
284
285 .sp
286 .ne 2
287 .na
288 \fB\fBDDI_FAILURE\fR \fR
289 .ad
290 .RS 16n
291 on failure.
292 .RE
293
294 .sp
295 .LP
296 \fBgld_intr\fR(\|) returns a value appropriate for an interrupt handler.
297 .SH SEE ALSO
298 .sp
299 .LP
300 \fBgld\fR(7D), \fBgld\fR(9E), \fBgld_mac_info\fR(9S), \fBgld_stats\fR(9S),
301 \fBdlpi\fR(7P), \fBattach\fR(9E), \fBddi_add_intr\fR(9F)
302 .sp
303 .LP
304 \fIWriting Device Drivers\fR
|
1 '\" te
2 .\" Copyright (c) 2003, Sun Microsystems, Inc.
3 .\" All Rights Reserved
4 .\" 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.
5 .\" 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.
6 .\" 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]
7 .TH GLD 9F "February 15, 2020"
8 .SH NAME
9 gld, gld_mac_alloc, gld_mac_free, gld_register, gld_unregister, gld_recv,
10 gld_sched, gld_intr \- Generic LAN Driver service routines
11 .SH SYNOPSIS
12 .nf
13 #include <sys/gld.h>
14
15 \fBgld_mac_info_t *\fR\fBgld_mac_alloc\fR(\fBdev_info_t *\fR\fIdip\fR);
16 .fi
17
18 .LP
19 .nf
20 \fBvoid\fR \fBgld_mac_free\fR(\fBgld_mac_info_t *\fR\fImacinfo\fR);
21 .fi
22
23 .LP
24 .nf
25 \fBint\fR \fBgld_register\fR(\fBdev_info_t *\fR\fIdip\fR, \fBchar *\fR\fIname\fR, \fBgld_mac_info_t *\fR\fImacinfo\fR);
26 .fi
27
28 .LP
29 .nf
30 \fBint\fR \fBgld_unregister\fR(\fBgld_mac_info_t *\fR\fImacinfo\fR);
31 .fi
34 .nf
35 \fBvoid\fR \fBgld_recv\fR(\fBgld_mac_info_t *\fR\fImacinfo\fR, \fBmblk_t *\fR\fImp\fR);
36 .fi
37
38 .LP
39 .nf
40 \fBvoid\fR \fBgld_sched\fR(\fBgld_mac_info_t *\fR\fImacinfo\fR);
41 .fi
42
43 .LP
44 .nf
45 \fBuint_t\fR \fBgld_intr\fR(\fBcaddr_t);\fR
46 .fi
47
48 .LP
49 .nf
50 \fBvoid\fR \fBgld_linkstate\fR(\fBgld_mac_info_t *\fR\fImacinfo\fR, \fBint32_t\fR \fInewstate\fR);
51 .fi
52
53 .SH INTERFACE LEVEL
54 Solaris architecture specific (Solaris DDI).
55 .SH PARAMETERS
56 .ne 2
57 .na
58 \fB\fImacinfo\fR \fR
59 .ad
60 .RS 13n
61 Pointer to a \fBgld_mac_info\fR(9S) structure.
62 .RE
63
64 .sp
65 .ne 2
66 .na
67 \fB\fIdip\fR \fR
68 .ad
69 .RS 13n
70 Pointer to \fBdev_info\fR structure.
71 .RE
72
73 .sp
74 .ne 2
75 .na
81
82 .sp
83 .ne 2
84 .na
85 \fB\fImp\fR \fR
86 .ad
87 .RS 13n
88 Pointer to a message block containing a received packet.
89 .RE
90
91 .sp
92 .ne 2
93 .na
94 \fB\fInewstate\fR \fR
95 .ad
96 .RS 13n
97 Media link state.
98 .RE
99
100 .SH DESCRIPTION
101 \fBgld_mac_alloc\fR(\|) allocates a new \fBgld_mac_info\fR(9S) structure and
102 returns a pointer to it. Some of the GLD-private elements of the structure may
103 be initialized before \fBgld_mac_alloc\fR(\|) returns; all other elements are
104 initialized to zero. The device driver must initialize some structure members,
105 as described in \fBgld_mac_info\fR(9S), before passing the mac_info pointer to
106 \fBgld_register\fR(\|).
107 .sp
108 .LP
109 \fBgld_mac_free\fR(\|) frees a \fBgld_mac_info\fR(9S) structure previously
110 allocated by \fBgld_mac_alloc\fR(\|).
111 .sp
112 .LP
113 \fBgld_register\fR(\|) is called from the device driver's \fBattach\fR(9E)
114 routine, and is used to link the GLD-based device driver with the GLD
115 framework. Before calling \fBgld_register\fR(\|) the device driver's
116 \fBattach\fR(9E) routine must first use \fBgld_mac_alloc\fR(\|) to allocate a
117 \fBgld_mac_info\fR(9S) structure, and initialize several of its structure
118 elements. See \fBgld_mac_info\fR(9S) for more information. A successful call to
119 \fBgld_register\fR(\|) performs the following actions:
120 .RS +4
241 .ne 2
242 .na
243 \fB\fBGLD_LINKSTATE_UP\fR \fR
244 .ad
245 .RS 26n
246 The media link is unavailable.
247 .RE
248
249 .sp
250 .ne 2
251 .na
252 \fB\fBGLD_LINKSTATE_UNKNOWN\fR \fR
253 .ad
254 .RS 26n
255 The status of the media link is unknown.
256 .RE
257
258 .sp
259 .LP
260 If a driver calls \fBgld_linkstate()\fR, it must also set the GLD_CAP_LINKSTATE
261 bit in the gldm_capabilities field of the \fBgld_mac_info\fR(9S) structure.
262 .SH RETURN VALUES
263 \fBgld_mac_alloc\fR(\|) returns a pointer to a new \fBgld_mac_info\fR(9S)
264 structure.
265 .sp
266 .LP
267 \fBgld_register\fR(\|) and \fBgld_unregister\fR(\|) return:
268 .sp
269 .ne 2
270 .na
271 \fB\fBDDI_SUCCESS\fR \fR
272 .ad
273 .RS 16n
274 on success.
275 .RE
276
277 .sp
278 .ne 2
279 .na
280 \fB\fBDDI_FAILURE\fR \fR
281 .ad
282 .RS 16n
283 on failure.
284 .RE
285
286 .sp
287 .LP
288 \fBgld_intr\fR(\|) returns a value appropriate for an interrupt handler.
289 .SH SEE ALSO
290 \fBgld\fR(7D), \fBgld\fR(9E), \fBgld_mac_info\fR(9S), \fBgld_stats\fR(9S),
291 \fBdlpi\fR(7P), \fBattach\fR(9E), \fBddi_add_intr\fR(9F)
292 .sp
293 .LP
294 \fIWriting Device Drivers\fR
|