[VNIC] Initial checkin of VNIC code. Not yet fully functional.
[mirror/winof/.git] / ulp / inic / kernel / vnic_driver.h
1 /*\r
2  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.\r
3  *\r
4  * This software is available to you under the OpenIB.org BSD license\r
5  * below:\r
6  *\r
7  *     Redistribution and use in source and binary forms, with or\r
8  *     without modification, are permitted provided that the following\r
9  *     conditions are met:\r
10  *\r
11  *      - Redistributions of source code must retain the above\r
12  *        copyright notice, this list of conditions and the following\r
13  *        disclaimer.\r
14  *\r
15  *      - Redistributions in binary form must reproduce the above\r
16  *        copyright notice, this list of conditions and the following\r
17  *        disclaimer in the documentation and/or other materials\r
18  *        provided with the distribution.\r
19  *\r
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
23  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
24  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
25  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
26  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
27  * SOFTWARE.\r
28  *\r
29  * $Id$\r
30  */\r
31 \r
32 #ifndef _VNIC_DRIVER_H_\r
33 #define _VNIC_DRIVER_H_\r
34 \r
35 #include "vnic_adapter.h"\r
36 #include "vnic_debug.h"\r
37 \r
38 \r
39 #if defined(NDIS50_MINIPORT)\r
40 #define MAJOR_NDIS_VERSION 5\r
41 #define MINOR_NDIS_VERSION 0\r
42 #elif defined (NDIS51_MINIPORT)\r
43 #define MAJOR_NDIS_VERSION 5\r
44 #define MINOR_NDIS_VERSION 1\r
45 #else\r
46 #error NDIS Version not defined, try defining NDIS50_MINIPORT or NDIS51_MINIPORT\r
47 #endif\r
48 \r
49 #include <ndis.h>\r
50 \r
51 static const NDIS_OID SUPPORTED_OIDS[] =\r
52 {\r
53         OID_GEN_SUPPORTED_LIST,\r
54         OID_GEN_HARDWARE_STATUS,\r
55         OID_GEN_MEDIA_SUPPORTED,\r
56         OID_GEN_MEDIA_IN_USE,\r
57         OID_GEN_MAXIMUM_LOOKAHEAD,\r
58         OID_GEN_MAXIMUM_FRAME_SIZE,\r
59         OID_GEN_LINK_SPEED,\r
60         OID_GEN_TRANSMIT_BUFFER_SPACE,\r
61         OID_GEN_RECEIVE_BUFFER_SPACE,\r
62         OID_GEN_TRANSMIT_BLOCK_SIZE,\r
63         OID_GEN_RECEIVE_BLOCK_SIZE,\r
64         OID_GEN_VENDOR_ID,\r
65         OID_GEN_VENDOR_DESCRIPTION,\r
66         OID_GEN_CURRENT_PACKET_FILTER,\r
67         OID_GEN_CURRENT_LOOKAHEAD,\r
68         OID_GEN_DRIVER_VERSION,\r
69         OID_GEN_MAXIMUM_TOTAL_SIZE,\r
70         OID_GEN_PROTOCOL_OPTIONS, // ?\r
71         OID_GEN_MAC_OPTIONS,\r
72         OID_GEN_MEDIA_CONNECT_STATUS,\r
73         OID_GEN_MAXIMUM_SEND_PACKETS,\r
74         OID_GEN_VENDOR_DRIVER_VERSION,\r
75         OID_GEN_PHYSICAL_MEDIUM,\r
76         OID_GEN_XMIT_OK,\r
77         OID_GEN_RCV_OK,\r
78         OID_GEN_XMIT_ERROR,\r
79         OID_GEN_RCV_ERROR,\r
80         OID_GEN_RCV_NO_BUFFER,\r
81         OID_GEN_DIRECTED_BYTES_XMIT,\r
82         OID_GEN_DIRECTED_FRAMES_XMIT,\r
83         OID_GEN_MULTICAST_BYTES_XMIT,\r
84         OID_GEN_MULTICAST_FRAMES_XMIT,\r
85         OID_GEN_BROADCAST_BYTES_XMIT,\r
86         OID_GEN_BROADCAST_FRAMES_XMIT,\r
87         OID_GEN_DIRECTED_BYTES_RCV,\r
88         OID_GEN_DIRECTED_FRAMES_RCV,\r
89         OID_GEN_MULTICAST_BYTES_RCV,\r
90         OID_GEN_MULTICAST_FRAMES_RCV,\r
91         OID_GEN_BROADCAST_BYTES_RCV,\r
92         OID_GEN_BROADCAST_FRAMES_RCV,\r
93         OID_802_3_PERMANENT_ADDRESS,\r
94         OID_802_3_CURRENT_ADDRESS,\r
95         OID_802_3_MULTICAST_LIST,\r
96         OID_802_3_MAXIMUM_LIST_SIZE,\r
97         OID_802_3_MAC_OPTIONS,\r
98         OID_802_3_RCV_ERROR_ALIGNMENT,\r
99         OID_802_3_XMIT_ONE_COLLISION,\r
100         OID_802_3_XMIT_MORE_COLLISIONS,\r
101         OID_TCP_TASK_OFFLOAD\r
102 };\r
103 \r
104 static const unsigned char VENDOR_ID[] = {0x00, 0x06, 0x6A, 0x00};\r
105 #define VENDOR_DESCRIPTION "Virtual Ethernet over InfiniBand"\r
106 #define DEFAULT_VNIC_NAME       "VNIC"\r
107 \r
108 NTSTATUS\r
109 DriverEntry(\r
110         IN                              PDRIVER_OBJECT                          p_drv_obj,\r
111         IN                              PUNICODE_STRING                         p_reg_path );\r
112 \r
113 VOID\r
114 vnic_unload(\r
115         IN                              PDRIVER_OBJECT                          p_drv_obj );\r
116 \r
117 NDIS_STATUS\r
118 vnic_initialize(\r
119                 OUT                     PNDIS_STATUS                            p_open_err_status,\r
120                 OUT                     PUINT                                           p_selected_medium_index,\r
121         IN                              PNDIS_MEDIUM                            medium_array,\r
122         IN                              UINT                                            medium_array_size,\r
123         IN                              NDIS_HANDLE                                     h_handle,\r
124         IN                              NDIS_HANDLE                                     wrapper_configuration_context );\r
125 \r
126 BOOLEAN\r
127 vnic_check_for_hang(\r
128         IN                              NDIS_HANDLE                                     adapter_context );\r
129 \r
130 void\r
131 vnic_halt(\r
132         IN                              NDIS_HANDLE                                     adapter_context );\r
133 \r
134 NDIS_STATUS\r
135 vnic_oid_query_info(\r
136         IN                              NDIS_HANDLE                                     adapter_context,\r
137         IN                              NDIS_OID                                        oid,\r
138         IN                              PVOID                                           info_buf,\r
139         IN                              ULONG                                           info_buf_len,\r
140                 OUT                     PULONG                                          p_bytes_written,\r
141                 OUT                     PULONG                                          p_bytes_needed );\r
142 \r
143 NDIS_STATUS\r
144 vnic_reset(\r
145                 OUT                     PBOOLEAN                                        p_addressing_reset,\r
146         IN                              NDIS_HANDLE                                     adapter_context );\r
147 \r
148 NDIS_STATUS\r
149 vnic_oid_set_info(\r
150         IN                              NDIS_HANDLE                                     adapter_context,\r
151         IN                              NDIS_OID                                        oid,\r
152         IN                              PVOID                                           info_buf,\r
153         IN                              ULONG                                           info_buf_length,\r
154                 OUT                     PULONG                                          p_bytes_read,\r
155                 OUT                     PULONG                                          p_bytes_needed );\r
156 \r
157 void\r
158 vnic_send_packets(\r
159         IN                              NDIS_HANDLE                                     adapter_context,\r
160         IN                              PPNDIS_PACKET                           packet_array,\r
161         IN                              UINT                                            num_packets );\r
162 \r
163 void\r
164 vnic_pnp_notify(\r
165         IN                              NDIS_HANDLE                                     adapter_context,\r
166         IN                              NDIS_DEVICE_PNP_EVENT           pnp_event,\r
167         IN                              PVOID                                           info_buf,\r
168         IN                              ULONG                                           info_buf_len );\r
169 \r
170 void\r
171 vnic_shutdown(\r
172         IN                              PVOID                                           adapter_context );\r
173 \r
174 NDIS_STATUS\r
175 vnic_get_agapter_interface(\r
176         IN      NDIS_HANDLE                     h_handle,\r
177         IN      vnic_adapter_t          *p_adapter);\r
178 \r
179 \r
180 /* same as cl_timer_start() except it takes timeout param in usec */\r
181 /* need to run kicktimer */\r
182 cl_status_t \r
183 usec_timer_start(\r
184         IN              cl_timer_t* const       p_timer,\r
185         IN              const uint32_t          time_usec );\r
186 \r
187 #endif /* _VNIC_DRIVER_H_ */