5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 *
21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22 * Use is subject to license terms.
23 */
24
25 #pragma ident "%Z%%M% %I% %E% SMI"
26
27 /*
28 * gld - Generic LAN Driver
29 * media dependent routines
30 */
31
32 #include <sys/types.h>
33 #include <sys/errno.h>
34 #include <sys/stropts.h>
35 #include <sys/stream.h>
36 #include <sys/kmem.h>
37 #include <sys/stat.h>
38 #include <sys/modctl.h>
39 #include <sys/kstat.h>
40 #include <sys/debug.h>
41
42 #include <sys/byteorder.h>
43 #include <sys/strsun.h>
44 #include <sys/dlpi.h>
45 #include <sys/ethernet.h>
46 #include <sys/multidata.h>
51 #include <sys/sysmacros.h>
52 #include <sys/ib/clients/ibd/ibd.h>
53 #include <sys/pattr.h>
54
55 #define DLSAPLENGTH(macinfo) \
56 ((macinfo)->gldm_addrlen + ABS((macinfo)->gldm_saplen))
57
58 #ifdef GLD_DEBUG
59 extern int gld_debug;
60 #endif
61
62 extern void gld_bitrevcopy(caddr_t src, caddr_t target, size_t n);
63 extern char *gld_macaddr_sprintf(char *, unsigned char *, int);
64 extern gld_vlan_t *gld_find_vlan(gld_mac_info_t *, uint32_t);
65 extern uint32_t gld_global_options;
66
67 static struct llc_snap_hdr llc_snap_def = {
68 LSAP_SNAP, /* DLSAP 0xaa */
69 LSAP_SNAP, /* SLSAP 0xaa */
70 CNTL_LLC_UI, /* Control 0x03 */
71 0x00, 0x00, 0x00, /* Org[3] */
72 0x00 /* Type */
73 };
74
75 #define ISETHERTYPE(snaphdr) \
76 (snaphdr->d_lsap == LSAP_SNAP && \
77 snaphdr->s_lsap == LSAP_SNAP && \
78 snaphdr->control == CNTL_LLC_UI && \
79 snaphdr->org[0] == 0 && \
80 snaphdr->org[1] == 0 && \
81 snaphdr->org[2] == 0)
82
83 /* ======== */
84 /* Ethernet */
85 /* ======== */
86
87 static mac_addr_t ether_broadcast = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
88
89 void
90 gld_init_ether(gld_mac_info_t *macinfo)
91 {
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 *
21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22 * Use is subject to license terms.
23 */
24
25 /*
26 * gld - Generic LAN Driver
27 * media dependent routines
28 */
29
30 #include <sys/types.h>
31 #include <sys/errno.h>
32 #include <sys/stropts.h>
33 #include <sys/stream.h>
34 #include <sys/kmem.h>
35 #include <sys/stat.h>
36 #include <sys/modctl.h>
37 #include <sys/kstat.h>
38 #include <sys/debug.h>
39
40 #include <sys/byteorder.h>
41 #include <sys/strsun.h>
42 #include <sys/dlpi.h>
43 #include <sys/ethernet.h>
44 #include <sys/multidata.h>
49 #include <sys/sysmacros.h>
50 #include <sys/ib/clients/ibd/ibd.h>
51 #include <sys/pattr.h>
52
53 #define DLSAPLENGTH(macinfo) \
54 ((macinfo)->gldm_addrlen + ABS((macinfo)->gldm_saplen))
55
56 #ifdef GLD_DEBUG
57 extern int gld_debug;
58 #endif
59
60 extern void gld_bitrevcopy(caddr_t src, caddr_t target, size_t n);
61 extern char *gld_macaddr_sprintf(char *, unsigned char *, int);
62 extern gld_vlan_t *gld_find_vlan(gld_mac_info_t *, uint32_t);
63 extern uint32_t gld_global_options;
64
65 static struct llc_snap_hdr llc_snap_def = {
66 LSAP_SNAP, /* DLSAP 0xaa */
67 LSAP_SNAP, /* SLSAP 0xaa */
68 CNTL_LLC_UI, /* Control 0x03 */
69 { 0x00, 0x00, 0x00 }, /* Org[3] */
70 0x00 /* Type */
71 };
72
73 #define ISETHERTYPE(snaphdr) \
74 (snaphdr->d_lsap == LSAP_SNAP && \
75 snaphdr->s_lsap == LSAP_SNAP && \
76 snaphdr->control == CNTL_LLC_UI && \
77 snaphdr->org[0] == 0 && \
78 snaphdr->org[1] == 0 && \
79 snaphdr->org[2] == 0)
80
81 /* ======== */
82 /* Ethernet */
83 /* ======== */
84
85 static mac_addr_t ether_broadcast = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
86
87 void
88 gld_init_ether(gld_mac_info_t *macinfo)
89 {
|