win-pvdrivers

view xennet/xennet_oid.c @ 266:b88529df8b60

More wdm updates
author James Harper <james.harper@bendigoit.com.au>
date Wed May 07 10:47:03 2008 +1000 (2008-05-07)
parents 253ec5052cb4
children da9b1e17fbc0
line source
1 /*
2 PV Net Driver for Windows Xen HVM Domains
3 Copyright (C) 2007 James Harper
4 Copyright (C) 2007 Andrew Grover <andy.grover@oracle.com>
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
21 #include "xennet.h"
23 // Q = Query Mandatory, S = Set Mandatory
24 NDIS_OID supported_oids[] =
25 {
26 /* general OIDs */
27 OID_GEN_SUPPORTED_LIST, // Q
28 OID_GEN_HARDWARE_STATUS, // Q
29 OID_GEN_MEDIA_SUPPORTED, // Q
30 OID_GEN_MEDIA_IN_USE, // Q
31 OID_GEN_MAXIMUM_LOOKAHEAD, // Q
32 OID_GEN_MAXIMUM_FRAME_SIZE, // Q
33 OID_GEN_LINK_SPEED, // Q
34 OID_GEN_TRANSMIT_BUFFER_SPACE, // Q
35 OID_GEN_RECEIVE_BUFFER_SPACE, // Q
36 OID_GEN_TRANSMIT_BLOCK_SIZE, // Q
37 OID_GEN_RECEIVE_BLOCK_SIZE, // Q
38 OID_GEN_VENDOR_ID, // Q
39 OID_GEN_VENDOR_DESCRIPTION, // Q
40 OID_GEN_CURRENT_PACKET_FILTER, // QS
41 OID_GEN_CURRENT_LOOKAHEAD, // QS
42 OID_GEN_DRIVER_VERSION, // Q
43 OID_GEN_MAXIMUM_TOTAL_SIZE, // Q
44 OID_GEN_PROTOCOL_OPTIONS, // S
45 OID_GEN_MAC_OPTIONS, // Q
46 OID_GEN_MEDIA_CONNECT_STATUS, // Q
47 OID_GEN_MAXIMUM_SEND_PACKETS, // Q
48 /* stats */
49 OID_GEN_XMIT_OK, // Q
50 OID_GEN_RCV_OK, // Q
51 OID_GEN_XMIT_ERROR, // Q
52 OID_GEN_RCV_ERROR, // Q
53 OID_GEN_RCV_NO_BUFFER, // Q
54 /* media-specific OIDs */
55 OID_802_3_PERMANENT_ADDRESS,
56 OID_802_3_CURRENT_ADDRESS,
57 OID_802_3_MULTICAST_LIST,
58 OID_802_3_MAXIMUM_LIST_SIZE,
59 /* tcp offload */
60 OID_TCP_TASK_OFFLOAD,
61 };
63 /* return 4 or 8 depending on size of buffer */
64 #define HANDLE_STAT_RETURN \
65 {if (InformationBufferLength == 4) { \
66 len = 4; *BytesNeeded = 8; \
67 } else { \
68 len = 8; \
69 } }
71 NDIS_STATUS
72 XenNet_QueryInformation(
73 IN NDIS_HANDLE MiniportAdapterContext,
74 IN NDIS_OID Oid,
75 IN PVOID InformationBuffer,
76 IN ULONG InformationBufferLength,
77 OUT PULONG BytesWritten,
78 OUT PULONG BytesNeeded)
79 {
80 struct xennet_info *xi = MiniportAdapterContext;
81 UCHAR vendor_desc[] = XN_VENDOR_DESC;
82 ULONG64 temp_data;
83 PVOID data = &temp_data;
84 UINT len = 4;
85 BOOLEAN used_temp_buffer = TRUE;
86 NDIS_STATUS status = NDIS_STATUS_SUCCESS;
87 PNDIS_TASK_OFFLOAD_HEADER ntoh;
88 PNDIS_TASK_OFFLOAD nto;
89 PNDIS_TASK_TCP_IP_CHECKSUM nttic;
90 PNDIS_TASK_TCP_LARGE_SEND nttls;
92 *BytesNeeded = 0;
93 *BytesWritten = 0;
95 // KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
97 switch(Oid)
98 {
99 case OID_GEN_SUPPORTED_LIST:
100 data = supported_oids;
101 len = sizeof(supported_oids);
102 break;
103 case OID_GEN_HARDWARE_STATUS:
104 if (!xi->connected)
105 temp_data = NdisHardwareStatusInitializing;
106 else
107 temp_data = NdisHardwareStatusReady;
108 break;
109 case OID_GEN_MEDIA_SUPPORTED:
110 temp_data = NdisMedium802_3;
111 break;
112 case OID_GEN_MEDIA_IN_USE:
113 temp_data = NdisMedium802_3;
114 break;
115 case OID_GEN_MAXIMUM_LOOKAHEAD:
116 temp_data = XN_DATA_SIZE;
117 break;
118 case OID_GEN_MAXIMUM_FRAME_SIZE:
119 // According to the specs, OID_GEN_MAXIMUM_FRAME_SIZE does not include the header, so
120 // it is XN_DATA_SIZE not XN_MAX_PKT_SIZE
121 temp_data = XN_DATA_SIZE;
122 break;
123 case OID_GEN_LINK_SPEED:
124 temp_data = 10000000; /* 1Gb */
125 break;
126 case OID_GEN_TRANSMIT_BUFFER_SPACE:
127 /* pkts times sizeof ring, maybe? */
128 /* multiply this by some small number as we can queue additional packets */
129 // temp_data = XN_MAX_PKT_SIZE * NET_TX_RING_SIZE;
130 temp_data = PAGE_SIZE * NET_TX_RING_SIZE * 4;
131 break;
132 case OID_GEN_RECEIVE_BUFFER_SPACE:
133 /* pkts times sizeof ring, maybe? */
134 // temp_data = XN_MAX_PKT_SIZE * NET_RX_RING_SIZE;
135 temp_data = PAGE_SIZE * NET_RX_RING_SIZE;
136 break;
137 case OID_GEN_TRANSMIT_BLOCK_SIZE:
138 temp_data = PAGE_SIZE; //XN_MAX_PKT_SIZE;
139 break;
140 case OID_GEN_RECEIVE_BLOCK_SIZE:
141 temp_data = PAGE_SIZE; //XN_MAX_PKT_SIZE;
142 break;
143 case OID_GEN_VENDOR_ID:
144 temp_data = 0xFFFFFF; // Not guaranteed to be XENSOURCE_MAC_HDR;
145 break;
146 case OID_GEN_VENDOR_DESCRIPTION:
147 data = vendor_desc;
148 len = sizeof(vendor_desc);
149 break;
150 case OID_GEN_CURRENT_PACKET_FILTER:
151 temp_data = xi->packet_filter;
152 break;
153 case OID_GEN_CURRENT_LOOKAHEAD:
154 // TODO: we should store this...
155 temp_data = 54; //XN_MAX_PKT_SIZE;
156 break;
157 case OID_GEN_DRIVER_VERSION:
158 temp_data = (NDIS_MINIPORT_MAJOR_VERSION << 8) | NDIS_MINIPORT_MINOR_VERSION;
159 len = 2;
160 break;
161 case OID_GEN_MAXIMUM_TOTAL_SIZE:
162 temp_data = xi->config_max_pkt_size;
163 break;
164 case OID_GEN_MAC_OPTIONS:
165 temp_data = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA |
166 NDIS_MAC_OPTION_TRANSFERS_NOT_PEND |
167 NDIS_MAC_OPTION_NO_LOOPBACK;
168 break;
169 case OID_GEN_MEDIA_CONNECT_STATUS:
170 if (xi->connected)
171 temp_data = NdisMediaStateConnected;
172 else
173 temp_data = NdisMediaStateDisconnected;
174 break;
175 case OID_GEN_MAXIMUM_SEND_PACKETS:
176 /* this is actually ignored for deserialised drivers like us */
177 temp_data = 0; //XN_MAX_SEND_PKTS;
178 break;
179 case OID_GEN_XMIT_OK:
180 temp_data = xi->stat_tx_ok;
181 HANDLE_STAT_RETURN;
182 break;
183 case OID_GEN_RCV_OK:
184 temp_data = xi->stat_rx_ok;
185 HANDLE_STAT_RETURN;
186 break;
187 case OID_GEN_XMIT_ERROR:
188 temp_data = xi->stat_tx_error;
189 HANDLE_STAT_RETURN;
190 break;
191 case OID_GEN_RCV_ERROR:
192 temp_data = xi->stat_rx_error;
193 HANDLE_STAT_RETURN;
194 break;
195 case OID_GEN_RCV_NO_BUFFER:
196 temp_data = xi->stat_rx_no_buffer;
197 HANDLE_STAT_RETURN;
198 break;
199 case OID_802_3_PERMANENT_ADDRESS:
200 data = xi->perm_mac_addr;
201 len = ETH_ALEN;
202 break;
203 case OID_802_3_CURRENT_ADDRESS:
204 data = xi->curr_mac_addr;
205 len = ETH_ALEN;
206 break;
207 case OID_802_3_MULTICAST_LIST:
208 data = NULL;
209 len = 0;
210 case OID_802_3_MAXIMUM_LIST_SIZE:
211 temp_data = 0; /* no mcast support */
212 break;
213 case OID_TCP_TASK_OFFLOAD:
214 KdPrint(("Get OID_TCP_TASK_OFFLOAD\n"));
215 /* it's times like this that C really sucks */
217 len = sizeof(NDIS_TASK_OFFLOAD_HEADER);
219 if (xi->config_csum)
220 {
221 len += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer)
222 + sizeof(NDIS_TASK_TCP_IP_CHECKSUM);
223 }
225 if (xi->config_gso)
226 {
227 len += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer)
228 + sizeof(NDIS_TASK_TCP_LARGE_SEND);
229 }
231 //len += 1024;
233 if (len > InformationBufferLength)
234 {
235 break;
236 }
238 KdPrint(("InformationBuffer = %p\n", InformationBuffer));
239 KdPrint(("len = %d\n", len));
241 ntoh = (PNDIS_TASK_OFFLOAD_HEADER)InformationBuffer;
242 if (ntoh->Version != NDIS_TASK_OFFLOAD_VERSION
243 || ntoh->Size != sizeof(*ntoh)
244 || ntoh->EncapsulationFormat.Encapsulation != IEEE_802_3_Encapsulation)
245 {
246 status = NDIS_STATUS_NOT_SUPPORTED;
247 break;
248 }
249 KdPrint(("ntoh = %p\n", ntoh));
250 KdPrint(("ntoh->Size = %d\n", ntoh->Size));
251 ntoh->OffsetFirstTask = 0;
252 nto = NULL;
254 if (xi->config_csum)
255 {
256 if (ntoh->OffsetFirstTask == 0)
257 {
258 ntoh->OffsetFirstTask = ntoh->Size;
259 KdPrint(("ntoh->OffsetFirstTask = %d\n", ntoh->OffsetFirstTask));
260 nto = (PNDIS_TASK_OFFLOAD)((PCHAR)(ntoh) + ntoh->OffsetFirstTask);
261 }
262 else
263 {
264 nto->OffsetNextTask = FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer)
265 + nto->TaskBufferLength;
266 KdPrint(("nto->OffsetNextTask = %d\n", nto->OffsetNextTask));
267 nto = (PNDIS_TASK_OFFLOAD)((PCHAR)(nto) + nto->OffsetNextTask);
268 }
269 /* fill in first nto */
270 nto->Version = NDIS_TASK_OFFLOAD_VERSION;
271 nto->Size = sizeof(NDIS_TASK_OFFLOAD);
272 nto->Task = TcpIpChecksumNdisTask;
273 nto->TaskBufferLength = sizeof(NDIS_TASK_TCP_IP_CHECKSUM);
275 KdPrint(("config_csum enabled\n"));
276 KdPrint(("nto = %p\n", nto));
277 KdPrint(("nto->Size = %d\n", nto->Size));
278 KdPrint(("nto->TaskBufferLength = %d\n", nto->TaskBufferLength));
280 /* fill in checksum offload struct */
281 nttic = (PNDIS_TASK_TCP_IP_CHECKSUM)nto->TaskBuffer;
282 nttic->V4Transmit.IpChecksum = 0;
283 nttic->V4Transmit.IpOptionsSupported = 0;
284 nttic->V4Transmit.TcpChecksum = 1;
285 nttic->V4Transmit.TcpOptionsSupported = 1;
286 nttic->V4Transmit.UdpChecksum = 1;
287 nttic->V4Receive.IpChecksum = 1;
288 nttic->V4Receive.IpOptionsSupported = 1;
289 nttic->V4Receive.TcpChecksum = 1;
290 nttic->V4Receive.TcpOptionsSupported = 1;
291 nttic->V4Receive.UdpChecksum = 1;
292 nttic->V6Transmit.IpOptionsSupported = 0;
293 nttic->V6Transmit.TcpOptionsSupported = 0;
294 nttic->V6Transmit.TcpChecksum = 0;
295 nttic->V6Transmit.UdpChecksum = 0;
296 nttic->V6Receive.IpOptionsSupported = 0;
297 nttic->V6Receive.TcpOptionsSupported = 0;
298 nttic->V6Receive.TcpChecksum = 0;
299 nttic->V6Receive.UdpChecksum = 0;
300 }
301 if (xi->config_gso)
302 {
303 if (ntoh->OffsetFirstTask == 0)
304 {
305 ntoh->OffsetFirstTask = ntoh->Size;
306 KdPrint(("ntoh->OffsetFirstTask = %d\n", ntoh->OffsetFirstTask));
307 nto = (PNDIS_TASK_OFFLOAD)((PCHAR)(ntoh) + ntoh->OffsetFirstTask);
308 }
309 else
310 {
311 nto->OffsetNextTask = FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer)
312 + nto->TaskBufferLength;
313 KdPrint(("nto->OffsetNextTask = %d\n", nto->OffsetNextTask));
314 nto = (PNDIS_TASK_OFFLOAD)((PCHAR)(nto) + nto->OffsetNextTask);
315 }
317 /* fill in second nto */
318 nto->Version = NDIS_TASK_OFFLOAD_VERSION;
319 nto->Size = sizeof(NDIS_TASK_OFFLOAD);
320 nto->Task = TcpLargeSendNdisTask;
321 nto->TaskBufferLength = sizeof(NDIS_TASK_TCP_LARGE_SEND);
323 KdPrint(("config_gso enabled\n"));
324 KdPrint(("nto = %p\n", nto));
325 KdPrint(("nto->Size = %d\n", nto->Size));
326 KdPrint(("nto->TaskBufferLength = %d\n", nto->TaskBufferLength));
328 /* fill in large send struct */
329 nttls = (PNDIS_TASK_TCP_LARGE_SEND)nto->TaskBuffer;
330 nttls->Version = 0;
331 nttls->MaxOffLoadSize = xi->config_gso;
332 nttls->MinSegmentCount = MIN_LARGE_SEND_SEGMENTS;
333 nttls->TcpOptions = TRUE;
334 nttls->IpOptions = TRUE;
335 KdPrint(("&(nttls->IpOptions) = %p\n", &(nttls->IpOptions)));
337 }
339 if (nto)
340 nto->OffsetNextTask = 0; /* last one */
342 used_temp_buffer = FALSE;
343 break;
344 default:
345 KdPrint(("Get Unknown OID 0x%x\n", Oid));
346 status = NDIS_STATUS_NOT_SUPPORTED;
347 }
349 if (!NT_SUCCESS(status))
350 {
351 // KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (returned error)\n"));
352 return status;
353 }
355 if (len > InformationBufferLength)
356 {
357 *BytesNeeded = len;
358 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (BUFFER_TOO_SHORT %d > %d)\n", len, InformationBufferLength));
359 return NDIS_STATUS_BUFFER_TOO_SHORT;
360 }
362 *BytesWritten = len;
363 if (len && used_temp_buffer)
364 {
365 NdisMoveMemory((PUCHAR)InformationBuffer, data, len);
366 }
368 //KdPrint(("Got OID 0x%x\n", Oid));
369 // KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
371 return status;
372 }
374 NDIS_STATUS
375 XenNet_SetInformation(
376 IN NDIS_HANDLE MiniportAdapterContext,
377 IN NDIS_OID Oid,
378 IN PVOID InformationBuffer,
379 IN ULONG InformationBufferLength,
380 OUT PULONG BytesRead,
381 OUT PULONG BytesNeeded
382 )
383 {
384 NTSTATUS status;
385 struct xennet_info *xi = MiniportAdapterContext;
386 PULONG64 data = InformationBuffer;
387 PNDIS_TASK_OFFLOAD_HEADER ntoh;
388 PNDIS_TASK_OFFLOAD nto;
389 PNDIS_TASK_TCP_IP_CHECKSUM nttic;
390 PNDIS_TASK_TCP_LARGE_SEND nttls;
391 int offset;
393 KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
395 UNREFERENCED_PARAMETER(MiniportAdapterContext);
396 UNREFERENCED_PARAMETER(InformationBufferLength);
397 UNREFERENCED_PARAMETER(BytesRead);
398 UNREFERENCED_PARAMETER(BytesNeeded);
400 switch(Oid)
401 {
402 case OID_GEN_SUPPORTED_LIST:
403 status = NDIS_STATUS_NOT_SUPPORTED;
404 KdPrint(("Unsupported set OID_GEN_SUPPORTED_LIST\n"));
405 break;
406 case OID_GEN_HARDWARE_STATUS:
407 status = NDIS_STATUS_NOT_SUPPORTED;
408 KdPrint(("Unsupported set OID_GEN_HARDWARE_STATUS\n"));
409 break;
410 case OID_GEN_MEDIA_SUPPORTED:
411 status = NDIS_STATUS_NOT_SUPPORTED;
412 KdPrint(("Unsupported set OID_GEN_MEDIA_SUPPORTED\n"));
413 break;
414 case OID_GEN_MEDIA_IN_USE:
415 status = NDIS_STATUS_NOT_SUPPORTED;
416 KdPrint(("Unsupported set OID_GEN_MEDIA_IN_USE\n"));
417 break;
418 case OID_GEN_MAXIMUM_LOOKAHEAD:
419 status = NDIS_STATUS_NOT_SUPPORTED;
420 KdPrint(("Unsupported set OID_GEN_MAXIMUM_LOOKAHEAD\n"));
421 break;
422 case OID_GEN_MAXIMUM_FRAME_SIZE:
423 status = NDIS_STATUS_NOT_SUPPORTED;
424 KdPrint(("Unsupported set OID_GEN_MAXIMUM_FRAME_SIZE\n"));
425 break;
426 case OID_GEN_LINK_SPEED:
427 status = NDIS_STATUS_NOT_SUPPORTED;
428 KdPrint(("Unsupported set OID_GEN_LINK_SPEED\n"));
429 break;
430 case OID_GEN_TRANSMIT_BUFFER_SPACE:
431 status = NDIS_STATUS_NOT_SUPPORTED;
432 KdPrint(("Unsupported set OID_GEN_TRANSMIT_BUFFER_SPACE\n"));
433 break;
434 case OID_GEN_RECEIVE_BUFFER_SPACE:
435 status = NDIS_STATUS_NOT_SUPPORTED;
436 KdPrint(("Unsupported set OID_GEN_RECEIVE_BUFFER_SPACE\n"));
437 break;
438 case OID_GEN_TRANSMIT_BLOCK_SIZE:
439 status = NDIS_STATUS_NOT_SUPPORTED;
440 KdPrint(("Unsupported set OID_GEN_TRANSMIT_BLOCK_SIZE\n"));
441 break;
442 case OID_GEN_RECEIVE_BLOCK_SIZE:
443 status = NDIS_STATUS_NOT_SUPPORTED;
444 KdPrint(("Unsupported set OID_GEN_RECEIVE_BLOCK_SIZE\n"));
445 break;
446 case OID_GEN_VENDOR_ID:
447 status = NDIS_STATUS_NOT_SUPPORTED;
448 KdPrint(("Unsupported set OID_GEN_VENDOR_ID\n"));
449 break;
450 case OID_GEN_VENDOR_DESCRIPTION:
451 status = NDIS_STATUS_NOT_SUPPORTED;
452 KdPrint(("Unsupported set OID_GEN_VENDOR_DESCRIPTION\n"));
453 break;
454 case OID_GEN_CURRENT_PACKET_FILTER:
455 KdPrint(("Set OID_GEN_CURRENT_PACKET_FILTER\n"));
456 xi->packet_filter = *(ULONG *)data;
457 status = NDIS_STATUS_SUCCESS;
458 break;
459 case OID_GEN_CURRENT_LOOKAHEAD:
460 KdPrint(("Set OID_GEN_CURRENT_LOOKAHEAD %d\n", *(int *)data));
461 // TODO: We should do this...
462 status = NDIS_STATUS_SUCCESS;
463 break;
464 case OID_GEN_DRIVER_VERSION:
465 status = NDIS_STATUS_NOT_SUPPORTED;
466 KdPrint(("Unsupported set OID_GEN_DRIVER_VERSION\n"));
467 break;
468 case OID_GEN_MAXIMUM_TOTAL_SIZE:
469 status = NDIS_STATUS_NOT_SUPPORTED;
470 KdPrint(("Unsupported set OID_GEN_MAXIMUM_TOTAL_SIZE\n"));
471 break;
472 case OID_GEN_PROTOCOL_OPTIONS:
473 KdPrint(("Unsupported set OID_GEN_PROTOCOL_OPTIONS\n"));
474 // TODO - actually do this...
475 status = NDIS_STATUS_SUCCESS;
476 break;
477 case OID_GEN_MAC_OPTIONS:
478 status = NDIS_STATUS_NOT_SUPPORTED;
479 KdPrint(("Unsupported set OID_GEN_MAC_OPTIONS\n"));
480 break;
481 case OID_GEN_MEDIA_CONNECT_STATUS:
482 status = NDIS_STATUS_NOT_SUPPORTED;
483 KdPrint(("Unsupported set OID_GEN_MEDIA_CONNECT_STATUS\n"));
484 break;
485 case OID_GEN_MAXIMUM_SEND_PACKETS:
486 status = NDIS_STATUS_NOT_SUPPORTED;
487 KdPrint(("Unsupported set OID_GEN_MAXIMUM_SEND_PACKETS\n"));
488 break;
489 case OID_GEN_XMIT_OK:
490 status = NDIS_STATUS_NOT_SUPPORTED;
491 KdPrint(("Unsupported set OID_GEN_XMIT_OK\n"));
492 break;
493 case OID_GEN_RCV_OK:
494 status = NDIS_STATUS_NOT_SUPPORTED;
495 KdPrint(("Unsupported set OID_GEN_RCV_OK\n"));
496 break;
497 case OID_GEN_XMIT_ERROR:
498 status = NDIS_STATUS_NOT_SUPPORTED;
499 KdPrint(("Unsupported set OID_GEN_XMIT_ERROR\n"));
500 break;
501 case OID_GEN_RCV_ERROR:
502 status = NDIS_STATUS_NOT_SUPPORTED;
503 KdPrint(("Unsupported set OID_GEN_RCV_ERROR\n"));
504 break;
505 case OID_GEN_RCV_NO_BUFFER:
506 status = NDIS_STATUS_NOT_SUPPORTED;
507 KdPrint(("Unsupported set OID_GEN_RCV_NO_BUFFER\n"));
508 break;
509 case OID_802_3_PERMANENT_ADDRESS:
510 status = NDIS_STATUS_NOT_SUPPORTED;
511 KdPrint(("Unsupported set OID_802_3_PERMANENT_ADDRESS\n"));
512 break;
513 case OID_802_3_CURRENT_ADDRESS:
514 status = NDIS_STATUS_NOT_SUPPORTED;
515 KdPrint(("Unsupported set OID_802_3_CURRENT_ADDRESS\n"));
516 break;
517 case OID_802_3_MULTICAST_LIST:
518 status = NDIS_STATUS_NOT_SUPPORTED;
519 KdPrint(("Unsupported set OID_802_3_MULTICAST_LIST\n"));
520 break;
521 case OID_802_3_MAXIMUM_LIST_SIZE:
522 status = NDIS_STATUS_NOT_SUPPORTED;
523 KdPrint(("Unsupported set OID_802_3_MAXIMUM_LIST_SIZE\n"));
524 break;
525 case OID_TCP_TASK_OFFLOAD:
526 status = NDIS_STATUS_SUCCESS;
527 KdPrint(("Set OID_TCP_TASK_OFFLOAD\n"));
528 // we should disable everything here, then enable what has been set
529 ntoh = (PNDIS_TASK_OFFLOAD_HEADER)InformationBuffer;
530 *BytesRead = sizeof(NDIS_TASK_OFFLOAD_HEADER);
531 offset = ntoh->OffsetFirstTask;
532 nto = (PNDIS_TASK_OFFLOAD)ntoh; // not really, just to get the first offset right
533 while (offset != 0)
534 {
535 *BytesRead += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer);
536 nto = (PNDIS_TASK_OFFLOAD)(((PUCHAR)nto) + offset);
537 switch (nto->Task)
538 {
539 case TcpIpChecksumNdisTask:
540 *BytesRead += sizeof(NDIS_TASK_TCP_IP_CHECKSUM);
541 KdPrint(("TcpIpChecksumNdisTask\n"));
542 nttic = (PNDIS_TASK_TCP_IP_CHECKSUM)nto->TaskBuffer;
543 xi->setting_csum = *nttic;
544 KdPrint((" V4Transmit.IpOptionsSupported = %d\n", nttic->V4Transmit.IpOptionsSupported));
545 KdPrint((" V4Transmit.TcpOptionsSupported = %d\n", nttic->V4Transmit.TcpOptionsSupported));
546 KdPrint((" V4Transmit.TcpChecksum = %d\n", nttic->V4Transmit.TcpChecksum));
547 KdPrint((" V4Transmit.UdpChecksum = %d\n", nttic->V4Transmit.UdpChecksum));
548 KdPrint((" V4Transmit.IpChecksum = %d\n", nttic->V4Transmit.IpChecksum));
549 KdPrint((" V4Receive.IpOptionsSupported = %d\n", nttic->V4Receive.IpOptionsSupported));
550 KdPrint((" V4Receive.TcpOptionsSupported = %d\n", nttic->V4Receive.TcpOptionsSupported));
551 KdPrint((" V4Receive.TcpChecksum = %d\n", nttic->V4Receive.TcpChecksum));
552 KdPrint((" V4Receive.UdpChecksum = %d\n", nttic->V4Receive.UdpChecksum));
553 KdPrint((" V4Receive.IpChecksum = %d\n", nttic->V4Receive.IpChecksum));
554 KdPrint((" V6Transmit.IpOptionsSupported = %d\n", nttic->V6Transmit.IpOptionsSupported));
555 KdPrint((" V6Transmit.TcpOptionsSupported = %d\n", nttic->V6Transmit.TcpOptionsSupported));
556 KdPrint((" V6Transmit.TcpChecksum = %d\n", nttic->V6Transmit.TcpChecksum));
557 KdPrint((" V6Transmit.UdpChecksum = %d\n", nttic->V6Transmit.UdpChecksum));
558 KdPrint((" V6Receive.IpOptionsSupported = %d\n", nttic->V6Receive.IpOptionsSupported));
559 KdPrint((" V6Receive.TcpOptionsSupported = %d\n", nttic->V6Receive.TcpOptionsSupported));
560 KdPrint((" V6Receive.TcpChecksum = %d\n", nttic->V6Receive.TcpChecksum));
561 KdPrint((" V6Receive.UdpChecksum = %d\n", nttic->V6Receive.UdpChecksum));
562 break;
563 case TcpLargeSendNdisTask:
564 *BytesRead += sizeof(NDIS_TASK_TCP_LARGE_SEND);
565 KdPrint(("TcpLargeSendNdisTask\n"));
566 nttls = (PNDIS_TASK_TCP_LARGE_SEND)nto->TaskBuffer;
567 xi->setting_max_offload = nttls->MaxOffLoadSize;
568 KdPrint((" MaxOffLoadSize = %d\n", nttls->MaxOffLoadSize));
569 KdPrint((" MinSegmentCount = %d\n", nttls->MinSegmentCount));
570 KdPrint((" TcpOptions = %d\n", nttls->TcpOptions));
571 KdPrint((" IpOptions = %d\n", nttls->IpOptions));
572 break;
573 default:
574 KdPrint((" Unknown Task %d\n", nto->Task));
575 }
576 offset = nto->OffsetNextTask;
577 }
578 break;
579 default:
580 KdPrint(("Set Unknown OID 0x%x\n", Oid));
581 status = NDIS_STATUS_NOT_SUPPORTED;
582 break;
583 }
584 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
585 return status;
586 }