4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
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.
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]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
34 #define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGESIZE)
35 #define NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGESIZE)
37 #define XNF_MAXPKT 1500 /* MTU size */
38 #define XNF_FRAMESIZE 1514 /* frame size including MAC header */
41 #define XNF_DEBUG_DDI 0x01
42 #define XNF_DEBUG_TRACE 0x02
45 * Information about each receive buffer and any transmit look-aside
48 typedef struct xnf_buf
{
51 ddi_dma_handle_t dma_handle
;
52 caddr_t buf
; /* DMA-able data buffer */
56 struct xnf_buf
*next
; /* For linking into free list */
57 ddi_acc_handle_t acc_handle
;
58 grant_ref_t grant_ref
; /* grant table reference */
59 uint16_t id
; /* buffer id */
64 * Information about each transmit buffer.
66 typedef struct xnf_txbuf
{
67 struct xnf_txbuf
*tx_next
;
68 mblk_t
*tx_mp
; /* mblk associated with packet */
69 netif_tx_request_t tx_txreq
;
71 ddi_dma_handle_t tx_dma_handle
;
73 xnf_buf_t
*tx_bdesc
; /* Look-aside buffer, if used. */
74 unsigned char tx_type
;
79 #define TX_MCAST_REQ 2
80 #define TX_MCAST_RSP 3
84 * Information about each outstanding transmit operation.
86 typedef struct xnf_txid
{
87 uint16_t id
; /* Id of this transmit buffer. */
88 uint16_t next
; /* Freelist of ids. */
89 xnf_txbuf_t
*txbuf
; /* Buffer details. */
96 /* most interesting stuff first to assist debugging */
97 dev_info_t
*xnf_devinfo
;
99 unsigned char xnf_mac_addr
[ETHERADDRL
];
101 unsigned int xnf_gen
; /* Increments on resume. */
103 boolean_t xnf_connected
;
104 boolean_t xnf_running
;
106 boolean_t xnf_be_rx_copy
;
107 boolean_t xnf_be_mcast_control
;
109 uint64_t xnf_stat_interrupts
;
110 uint64_t xnf_stat_unclaimed_interrupts
;
111 uint64_t xnf_stat_norxbuf
;
112 uint64_t xnf_stat_drop
;
113 uint64_t xnf_stat_errrx
;
115 uint64_t xnf_stat_tx_attempt
;
116 uint64_t xnf_stat_tx_pullup
;
117 uint64_t xnf_stat_tx_pagebndry
;
118 uint64_t xnf_stat_tx_defer
;
119 uint64_t xnf_stat_mac_rcv_error
;
120 uint64_t xnf_stat_runt
;
122 uint64_t xnf_stat_ipackets
;
123 uint64_t xnf_stat_opackets
;
124 uint64_t xnf_stat_rbytes
;
125 uint64_t xnf_stat_obytes
;
127 uint64_t xnf_stat_tx_cksum_deferred
;
128 uint64_t xnf_stat_rx_cksum_no_need
;
130 uint64_t xnf_stat_buf_allocated
;
131 uint64_t xnf_stat_buf_outstanding
;
132 uint64_t xnf_stat_gref_outstanding
;
133 uint64_t xnf_stat_gref_failure
;
134 uint64_t xnf_stat_gref_peak
;
135 uint64_t xnf_stat_rx_allocb_fail
;
136 uint64_t xnf_stat_rx_desballoc_fail
;
138 kstat_t
*xnf_kstat_aux
;
140 ddi_iblock_cookie_t xnf_icookie
;
142 netif_tx_front_ring_t xnf_tx_ring
;
143 ddi_dma_handle_t xnf_tx_ring_dma_handle
;
144 ddi_acc_handle_t xnf_tx_ring_dma_acchandle
;
145 paddr_t xnf_tx_ring_phys_addr
;
146 grant_ref_t xnf_tx_ring_ref
;
148 xnf_txid_t xnf_tx_pkt_id
[NET_TX_RING_SIZE
];
149 uint16_t xnf_tx_pkt_id_head
;
151 kmutex_t xnf_schedlock
;
152 boolean_t xnf_need_sched
;
153 kcondvar_t xnf_cv_tx_slots
;
154 kmem_cache_t
*xnf_tx_buf_cache
;
156 netif_rx_front_ring_t xnf_rx_ring
;
157 ddi_dma_handle_t xnf_rx_ring_dma_handle
;
158 ddi_acc_handle_t xnf_rx_ring_dma_acchandle
;
159 paddr_t xnf_rx_ring_phys_addr
;
160 grant_ref_t xnf_rx_ring_ref
;
162 xnf_buf_t
*xnf_rx_pkt_info
[NET_RX_RING_SIZE
];
166 boolean_t xnf_rx_new_buffers_posted
;
167 kmem_cache_t
*xnf_buf_cache
;
171 kmutex_t xnf_gref_lock
;
172 grant_ref_t xnf_gref_head
;
174 kcondvar_t xnf_cv_state
;
175 kcondvar_t xnf_cv_multicast
;
176 uint_t xnf_pending_multicast
;
183 #endif /* _SYS_XNF_H */