35 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
36 * Use is subject to license terms.
37 */
38
39 /*
40 * System Header files.
41 */
42 #include <sys/types.h>
43 #include <sys/conf.h>
44 #include <sys/debug.h>
45 #include <sys/kmem.h>
46 #include <sys/vtrace.h>
47 #include <sys/ethernet.h>
48 #include <sys/modctl.h>
49 #include <sys/errno.h>
50 #include <sys/ddi.h>
51 #include <sys/sunddi.h>
52 #include <sys/stream.h> /* required for MBLK* */
53 #include <sys/strsun.h> /* required for mionack() */
54 #include <sys/byteorder.h>
55 #include <sys/pci.h>
56 #include <inet/common.h>
57 #include <inet/led.h>
58 #include <inet/mi.h>
59 #include <inet/nd.h>
60 #include <sys/crc32.h>
61
62 #include <sys/note.h>
63
64 #include "sfe_mii.h"
65 #include "sfe_util.h"
66
67
68
69 extern char ident[];
70
71 /* Debugging support */
72 #ifdef GEM_DEBUG_LEVEL
73 static int gem_debug = GEM_DEBUG_LEVEL;
74 #define DPRINTF(n, args) if (gem_debug > (n)) cmn_err args
90
91 #define GET_IPTYPEv4(p) (((uint8_t *)(p))[sizeof (struct ether_header) + 9])
92 #define GET_IPTYPEv6(p) (((uint8_t *)(p))[sizeof (struct ether_header) + 6])
93
94
95 #ifndef INT32_MAX
96 #define INT32_MAX 0x7fffffff
97 #endif
98
99 #define VTAG_OFF (ETHERADDRL*2)
100 #ifndef VTAG_SIZE
101 #define VTAG_SIZE 4
102 #endif
103 #ifndef VTAG_TPID
104 #define VTAG_TPID 0x8100U
105 #endif
106
107 #define GET_TXBUF(dp, sn) \
108 &(dp)->tx_buf[SLOT((dp)->tx_slots_base + (sn), (dp)->gc.gc_tx_buf_size)]
109
110 #ifndef offsetof
111 #define offsetof(t, m) ((long)&(((t *) 0)->m))
112 #endif
113 #define TXFLAG_VTAG(flag) \
114 (((flag) & GEM_TXFLAG_VTAG) >> GEM_TXFLAG_VTAG_SHIFT)
115
116 #define MAXPKTBUF(dp) \
117 ((dp)->mtu + sizeof (struct ether_header) + VTAG_SIZE + ETHERFCSL)
118
119 #define WATCH_INTERVAL_FAST drv_usectohz(100*1000) /* 100mS */
120 #define BOOLEAN(x) ((x) != 0)
121
122 /*
123 * Macros to distinct chip generation.
124 */
125
126 /*
127 * Private functions
128 */
129 static void gem_mii_start(struct gem_dev *);
130 static void gem_mii_stop(struct gem_dev *);
131
132 /* local buffer management */
|
35 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
36 * Use is subject to license terms.
37 */
38
39 /*
40 * System Header files.
41 */
42 #include <sys/types.h>
43 #include <sys/conf.h>
44 #include <sys/debug.h>
45 #include <sys/kmem.h>
46 #include <sys/vtrace.h>
47 #include <sys/ethernet.h>
48 #include <sys/modctl.h>
49 #include <sys/errno.h>
50 #include <sys/ddi.h>
51 #include <sys/sunddi.h>
52 #include <sys/stream.h> /* required for MBLK* */
53 #include <sys/strsun.h> /* required for mionack() */
54 #include <sys/byteorder.h>
55 #include <sys/sysmacros.h>
56 #include <sys/pci.h>
57 #include <inet/common.h>
58 #include <inet/led.h>
59 #include <inet/mi.h>
60 #include <inet/nd.h>
61 #include <sys/crc32.h>
62
63 #include <sys/note.h>
64
65 #include "sfe_mii.h"
66 #include "sfe_util.h"
67
68
69
70 extern char ident[];
71
72 /* Debugging support */
73 #ifdef GEM_DEBUG_LEVEL
74 static int gem_debug = GEM_DEBUG_LEVEL;
75 #define DPRINTF(n, args) if (gem_debug > (n)) cmn_err args
91
92 #define GET_IPTYPEv4(p) (((uint8_t *)(p))[sizeof (struct ether_header) + 9])
93 #define GET_IPTYPEv6(p) (((uint8_t *)(p))[sizeof (struct ether_header) + 6])
94
95
96 #ifndef INT32_MAX
97 #define INT32_MAX 0x7fffffff
98 #endif
99
100 #define VTAG_OFF (ETHERADDRL*2)
101 #ifndef VTAG_SIZE
102 #define VTAG_SIZE 4
103 #endif
104 #ifndef VTAG_TPID
105 #define VTAG_TPID 0x8100U
106 #endif
107
108 #define GET_TXBUF(dp, sn) \
109 &(dp)->tx_buf[SLOT((dp)->tx_slots_base + (sn), (dp)->gc.gc_tx_buf_size)]
110
111 #define TXFLAG_VTAG(flag) \
112 (((flag) & GEM_TXFLAG_VTAG) >> GEM_TXFLAG_VTAG_SHIFT)
113
114 #define MAXPKTBUF(dp) \
115 ((dp)->mtu + sizeof (struct ether_header) + VTAG_SIZE + ETHERFCSL)
116
117 #define WATCH_INTERVAL_FAST drv_usectohz(100*1000) /* 100mS */
118 #define BOOLEAN(x) ((x) != 0)
119
120 /*
121 * Macros to distinct chip generation.
122 */
123
124 /*
125 * Private functions
126 */
127 static void gem_mii_start(struct gem_dev *);
128 static void gem_mii_stop(struct gem_dev *);
129
130 /* local buffer management */
|