Print this page
3373 gcc >= 4.5 concerns about offsetof()
Portions contributed by: Igor Pashev <pashev.igor@gmail.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/xen/io/xnb.h
+++ new/usr/src/uts/common/xen/io/xnb.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 *
26 26 * xnb.h - definitions for Xen dom0 network driver
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
27 27 */
28 28
29 29 #ifndef _SYS_XNB_H
30 30 #define _SYS_XNB_H
31 31
32 32 #include <sys/types.h>
33 33 #include <sys/kstat.h>
34 34 #include <sys/stream.h>
35 35 #include <sys/ethernet.h>
36 36 #include <sys/hypervisor.h>
37 +#include <sys/sysmacros.h>
37 38 #include <xen/public/io/netif.h>
38 39
39 40 #ifdef __cplusplus
40 41 extern "C" {
41 42 #endif
42 43
43 -#define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGESIZE)
44 -#define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGESIZE)
44 +#define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGESIZE)
45 +#define NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGESIZE)
45 46
46 47 #define XNBMAXPKT 1500 /* MTU size */
47 48
48 49 /* DEBUG flags */
49 50 #define XNBDDI 0x01
50 51 #define XNBTRACE 0x02
51 52 #define XNBSEND 0x04
52 53 #define XNBRECV 0x08
53 54 #define XNBINTR 0x10
54 55 #define XNBRING 0x20
55 56 #define XNBCKSUM 0x40
56 57
57 58 #define XNB_STATE_INIT 0x01
58 59 #define XNB_STATE_READY 0x02
59 60
60 61 typedef struct xnb xnb_t;
61 62
62 63 /*
63 64 * The xnb module provides core inter-domain network protocol functionality.
64 65 * It is connected to the rest of Solaris in two ways:
65 66 * - as a GLDv3 driver (with xnbu),
66 67 * - as a GLDv3 consumer (with xnbo).
67 68 *
68 69 * The different modes of operation are termed "flavours" and each
69 70 * instance of an xnb based driver operates in one and only one mode.
70 71 * The common xnb driver exports a set of functions to these drivers
71 72 * (declarations at the foot of this file) and calls back into the
72 73 * drivers via the xnb_flavour_t structure.
73 74 */
74 75 typedef struct xnb_flavour {
75 76 void (*xf_from_peer)(xnb_t *, mblk_t *);
76 77 boolean_t (*xf_peer_connected)(xnb_t *);
77 78 void (*xf_peer_disconnected)(xnb_t *);
78 79 boolean_t (*xf_hotplug_connected)(xnb_t *);
79 80 boolean_t (*xf_start_connect)(xnb_t *);
80 81 mblk_t *(*xf_cksum_from_peer)(xnb_t *, mblk_t *, uint16_t);
81 82 uint16_t (*xf_cksum_to_peer)(xnb_t *, mblk_t *);
82 83 boolean_t (*xf_mcast_add)(xnb_t *, ether_addr_t *);
83 84 boolean_t (*xf_mcast_del)(xnb_t *, ether_addr_t *);
84 85 } xnb_flavour_t;
85 86
86 87 typedef struct xnb_txbuf {
87 88 frtn_t xt_free_rtn;
88 89 xnb_t *xt_xnbp;
89 90 struct xnb_txbuf *xt_next;
90 91 RING_IDX xt_id;
91 92 RING_IDX xt_idx;
92 93 uint16_t xt_status;
93 94
94 95 ddi_dma_handle_t xt_dma_handle;
95 96 ddi_acc_handle_t xt_acc_handle;
96 97 caddr_t xt_buf;
97 98 size_t xt_buflen;
98 99 mfn_t xt_mfn;
99 100
100 101 mblk_t *xt_mblk;
101 102
102 103 unsigned int xt_flags;
103 104
104 105 #define XNB_TXBUF_INUSE 0x01
105 106
106 107 } xnb_txbuf_t;
107 108
108 109 /* Per network-interface-controller driver private structure */
109 110 struct xnb {
110 111 /* most interesting stuff first to assist debugging */
111 112 dev_info_t *xnb_devinfo; /* System per-device info. */
112 113
113 114 xnb_flavour_t *xnb_flavour;
114 115 void *xnb_flavour_data;
115 116
116 117 boolean_t xnb_irq;
117 118 unsigned char xnb_mac_addr[ETHERADDRL];
118 119
119 120 uint64_t xnb_stat_ipackets;
120 121 uint64_t xnb_stat_opackets;
121 122 uint64_t xnb_stat_rbytes;
122 123 uint64_t xnb_stat_obytes;
123 124
124 125 uint64_t xnb_stat_intr;
125 126 uint64_t xnb_stat_rx_defer;
126 127
127 128 uint64_t xnb_stat_rx_cksum_deferred;
128 129 uint64_t xnb_stat_tx_cksum_no_need;
129 130
130 131 uint64_t xnb_stat_rx_rsp_notok;
131 132
132 133 uint64_t xnb_stat_tx_notify_sent;
133 134 uint64_t xnb_stat_tx_notify_deferred;
134 135
135 136 uint64_t xnb_stat_rx_notify_sent;
136 137 uint64_t xnb_stat_rx_notify_deferred;
137 138
138 139 uint64_t xnb_stat_tx_too_early;
139 140 uint64_t xnb_stat_rx_too_early;
140 141 uint64_t xnb_stat_rx_allocb_failed;
141 142 uint64_t xnb_stat_tx_allocb_failed;
142 143 uint64_t xnb_stat_rx_foreign_page;
143 144 uint64_t xnb_stat_tx_overflow_page;
144 145 uint64_t xnb_stat_tx_unexpected_flags;
145 146 uint64_t xnb_stat_mac_full;
146 147 uint64_t xnb_stat_spurious_intr;
147 148 uint64_t xnb_stat_allocation_success;
148 149 uint64_t xnb_stat_allocation_failure;
149 150 uint64_t xnb_stat_small_allocation_success;
150 151 uint64_t xnb_stat_small_allocation_failure;
151 152 uint64_t xnb_stat_other_allocation_failure;
152 153
153 154 uint64_t xnb_stat_rx_pagebndry_crossed;
154 155 uint64_t xnb_stat_rx_cpoparea_grown;
155 156
156 157 uint64_t xnb_stat_csum_hardware;
157 158 uint64_t xnb_stat_csum_software;
158 159
159 160 kstat_t *xnb_kstat_aux;
160 161
161 162 ddi_iblock_cookie_t xnb_icookie;
162 163
163 164 kmutex_t xnb_rx_lock;
164 165 kmutex_t xnb_tx_lock;
165 166 kmutex_t xnb_state_lock;
166 167
167 168 int xnb_be_status;
168 169 int xnb_fe_status;
169 170
170 171 kmem_cache_t *xnb_tx_buf_cache;
171 172 uint32_t xnb_tx_buf_count;
172 173 int xnb_tx_buf_outstanding;
173 174
174 175 netif_rx_back_ring_t xnb_rx_ring; /* rx interface struct ptr */
175 176 void *xnb_rx_ring_addr;
176 177 grant_ref_t xnb_rx_ring_ref;
177 178 grant_handle_t xnb_rx_ring_handle;
178 179
179 180 netif_tx_back_ring_t xnb_tx_ring; /* tx interface struct ptr */
180 181 void *xnb_tx_ring_addr;
181 182 grant_ref_t xnb_tx_ring_ref;
182 183 grant_handle_t xnb_tx_ring_handle;
183 184
184 185 boolean_t xnb_connected;
185 186 boolean_t xnb_hotplugged;
186 187 boolean_t xnb_detachable;
187 188 int xnb_evtchn; /* channel to front end */
188 189 evtchn_port_t xnb_fe_evtchn;
189 190 domid_t xnb_peer;
190 191
191 192 xnb_txbuf_t *xnb_tx_bufp[NET_TX_RING_SIZE];
192 193 gnttab_copy_t xnb_tx_cop[NET_TX_RING_SIZE];
193 194
194 195 caddr_t xnb_rx_va;
195 196 gnttab_transfer_t xnb_rx_top[NET_RX_RING_SIZE];
196 197
197 198 boolean_t xnb_rx_hv_copy;
198 199 boolean_t xnb_multicast_control;
199 200 boolean_t xnb_no_csum_offload;
200 201
201 202 gnttab_copy_t *xnb_rx_cpop;
202 203 #define CPOP_DEFCNT 8
203 204 size_t xnb_rx_cpop_count; /* in elements */
204 205 };
205 206
206 207 extern int xnb_attach(dev_info_t *, xnb_flavour_t *, void *);
207 208 extern void xnb_detach(dev_info_t *);
208 209 extern mblk_t *xnb_copy_to_peer(xnb_t *, mblk_t *);
209 210 extern mblk_t *xnb_process_cksum_flags(xnb_t *, mblk_t *, uint32_t);
210 211
211 212 #ifdef __cplusplus
212 213 }
213 214 #endif
214 215
215 216 #endif /* _SYS_XNB_H */
↓ open down ↓ |
161 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX