1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
14 */
15
16 #ifndef _IPRB_H
17 #define _IPRB_H
18
19 /*
20 * iprb - Intel Pro/100B Ethernet Driver
21 */
22
23 /*
24 * Tunables.
25 */
26 #define NUM_TX 128 /* outstanding tx queue */
27 #define NUM_RX 128 /* outstanding rx queue */
28
29 #define RX_WATCHDOG 15 /* timeout for rx watchdog (sec) */
30 #define TX_WATCHDOG 15 /* timeout for tx watchdog (sec) */
31
32 /*
33 * Driver structures.
34 */
35 typedef struct {
36 ddi_acc_handle_t acch;
37 ddi_dma_handle_t dmah;
38 caddr_t vaddr;
39 uint32_t paddr;
40 } iprb_dma_t;
41
42 typedef struct iprb_mcast {
43 list_node_t node;
44 uint8_t addr[6];
45 } iprb_mcast_t;
46
47 typedef struct iprb {
48 dev_info_t *dip;
49 ddi_acc_handle_t pcih;
50 ddi_acc_handle_t regsh;
55
56 mac_handle_t mach;
57 mii_handle_t miih;
58
59 ddi_intr_handle_t intrh;
60
61 ddi_periodic_t perh;
62
63 kmutex_t culock;
64 kmutex_t rulock;
65
66 uint8_t factaddr[6];
67 uint8_t curraddr[6];
68
69 int nmcast;
70 list_t mcast;
71 boolean_t promisc;
72 iprb_dma_t cmds[NUM_TX];
73 iprb_dma_t rxb[NUM_RX];
74 iprb_dma_t stats;
75 time_t stats_time;
76
77 uint16_t cmd_head;
78 uint16_t cmd_last;
79 uint16_t cmd_tail;
80 uint16_t cmd_count;
81
82 uint16_t rx_index;
83 uint16_t rx_last;
84 time_t rx_wdog;
85 time_t rx_timeout;
86 time_t tx_wdog;
87 time_t tx_timeout;
88
89 uint16_t eeprom_bits;
90
91 boolean_t running;
92 boolean_t suspended;
93 boolean_t wantw;
94 boolean_t rxhangbug;
95 boolean_t resumebug;
96 boolean_t is557;
97 boolean_t canpause;
98 boolean_t canmwi;
99
100 /*
101 * Statistics
102 */
103 uint64_t ipackets;
104 uint64_t rbytes;
105 uint64_t multircv;
106 uint64_t brdcstrcv;
107 uint64_t opackets;
|
1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
14 */
15
16 #ifndef _IPRB_H
17 #define _IPRB_H
18
19 /*
20 * iprb - Intel Pro/100B Ethernet Driver
21 */
22
23 /*
24 * Tunables.
25 */
26 #define NUM_TX 128 /* outstanding tx queue */
27 #define NUM_RX 128 /* outstanding rx queue */
28
29 /* timeouts for the rx and tx watchdogs (nsec) */
30 #define RX_WATCHDOG (15 * NANOSEC)
31 #define TX_WATCHDOG (15 * NANOSEC)
32
33 /*
34 * Driver structures.
35 */
36 typedef struct {
37 ddi_acc_handle_t acch;
38 ddi_dma_handle_t dmah;
39 caddr_t vaddr;
40 uint32_t paddr;
41 } iprb_dma_t;
42
43 typedef struct iprb_mcast {
44 list_node_t node;
45 uint8_t addr[6];
46 } iprb_mcast_t;
47
48 typedef struct iprb {
49 dev_info_t *dip;
50 ddi_acc_handle_t pcih;
51 ddi_acc_handle_t regsh;
56
57 mac_handle_t mach;
58 mii_handle_t miih;
59
60 ddi_intr_handle_t intrh;
61
62 ddi_periodic_t perh;
63
64 kmutex_t culock;
65 kmutex_t rulock;
66
67 uint8_t factaddr[6];
68 uint8_t curraddr[6];
69
70 int nmcast;
71 list_t mcast;
72 boolean_t promisc;
73 iprb_dma_t cmds[NUM_TX];
74 iprb_dma_t rxb[NUM_RX];
75 iprb_dma_t stats;
76 hrtime_t stats_time;
77
78 uint16_t cmd_head;
79 uint16_t cmd_last;
80 uint16_t cmd_tail;
81 uint16_t cmd_count;
82
83 uint16_t rx_index;
84 uint16_t rx_last;
85 hrtime_t rx_wdog;
86 hrtime_t rx_timeout;
87 hrtime_t tx_wdog;
88 hrtime_t tx_timeout;
89
90 uint16_t eeprom_bits;
91
92 boolean_t running;
93 boolean_t suspended;
94 boolean_t wantw;
95 boolean_t rxhangbug;
96 boolean_t resumebug;
97 boolean_t is557;
98 boolean_t canpause;
99 boolean_t canmwi;
100
101 /*
102 * Statistics
103 */
104 uint64_t ipackets;
105 uint64_t rbytes;
106 uint64_t multircv;
107 uint64_t brdcstrcv;
108 uint64_t opackets;
|