win-pvdrivers

view xennet/xennet_oid.c @ 370:d76831a77d19

merge
author Andy Grover <andy.grover@oracle.com>
date Wed Jul 09 00:26:05 2008 -0700 (2008-07-09)
parents 5a762fd1fba9
children 8e10579159a0
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 DDKAPI
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 {
106 temp_data = NdisHardwareStatusInitializing;
107 KdPrint((__DRIVER_NAME " --- " __FUNCTION__ " NdisHardwareStatusInitializing\n"));
108 }
109 else
110 {
111 temp_data = NdisHardwareStatusReady;
112 KdPrint((__DRIVER_NAME " --- " __FUNCTION__ " NdisHardwareStatusReady\n"));
113 }
114 break;
115 case OID_GEN_MEDIA_SUPPORTED:
116 temp_data = NdisMedium802_3;
117 break;
118 case OID_GEN_MEDIA_IN_USE:
119 temp_data = NdisMedium802_3;
120 break;
121 case OID_GEN_MAXIMUM_LOOKAHEAD:
122 temp_data = XN_DATA_SIZE;
123 break;
124 case OID_GEN_MAXIMUM_FRAME_SIZE:
125 // According to the specs, OID_GEN_MAXIMUM_FRAME_SIZE does not include the header, so
126 // it is XN_DATA_SIZE not XN_MAX_PKT_SIZE
127 temp_data = XN_DATA_SIZE;
128 break;
129 case OID_GEN_LINK_SPEED:
130 temp_data = 10000000; /* 1Gb */
131 break;
132 case OID_GEN_TRANSMIT_BUFFER_SPACE:
133 /* pkts times sizeof ring, maybe? */
134 /* multiply this by some small number as we can queue additional packets */
135 // temp_data = XN_MAX_PKT_SIZE * NET_TX_RING_SIZE;
136 temp_data = PAGE_SIZE * NET_TX_RING_SIZE * 4;
137 break;
138 case OID_GEN_RECEIVE_BUFFER_SPACE:
139 /* pkts times sizeof ring, maybe? */
140 // temp_data = XN_MAX_PKT_SIZE * NET_RX_RING_SIZE;
141 temp_data = PAGE_SIZE * NET_RX_RING_SIZE;
142 break;
143 case OID_GEN_TRANSMIT_BLOCK_SIZE:
144 temp_data = PAGE_SIZE; //XN_MAX_PKT_SIZE;
145 break;
146 case OID_GEN_RECEIVE_BLOCK_SIZE:
147 temp_data = PAGE_SIZE; //XN_MAX_PKT_SIZE;
148 break;
149 case OID_GEN_VENDOR_ID:
150 temp_data = 0xFFFFFF; // Not guaranteed to be XENSOURCE_MAC_HDR;
151 break;
152 case OID_GEN_VENDOR_DESCRIPTION:
153 data = vendor_desc;
154 len = sizeof(vendor_desc);
155 break;
156 case OID_GEN_CURRENT_PACKET_FILTER:
157 temp_data = xi->packet_filter;
158 break;
159 case OID_GEN_CURRENT_LOOKAHEAD:
160 // TODO: we should store this...
161 temp_data = 54; //XN_MAX_PKT_SIZE;
162 break;
163 case OID_GEN_DRIVER_VERSION:
164 temp_data = (NDIS_MINIPORT_MAJOR_VERSION << 8) | NDIS_MINIPORT_MINOR_VERSION;
165 len = 2;
166 break;
167 case OID_GEN_MAXIMUM_TOTAL_SIZE:
168 temp_data = xi->config_max_pkt_size;
169 break;
170 case OID_GEN_MAC_OPTIONS:
171 temp_data = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA |
172 NDIS_MAC_OPTION_TRANSFERS_NOT_PEND |
173 NDIS_MAC_OPTION_NO_LOOPBACK;
174 break;
175 case OID_GEN_MEDIA_CONNECT_STATUS:
176 if (xi->connected)
177 temp_data = NdisMediaStateConnected;
178 else
179 temp_data = NdisMediaStateDisconnected;
180 break;
181 case OID_GEN_MAXIMUM_SEND_PACKETS:
182 /* this is actually ignored for deserialised drivers like us */
183 temp_data = 0; //XN_MAX_SEND_PKTS;
184 break;
185 case OID_GEN_XMIT_OK:
186 temp_data = xi->stat_tx_ok;
187 HANDLE_STAT_RETURN;
188 break;
189 case OID_GEN_RCV_OK:
190 temp_data = xi->stat_rx_ok;
191 HANDLE_STAT_RETURN;
192 break;
193 case OID_GEN_XMIT_ERROR:
194 temp_data = xi->stat_tx_error;
195 HANDLE_STAT_RETURN;
196 break;
197 case OID_GEN_RCV_ERROR:
198 temp_data = xi->stat_rx_error;
199 HANDLE_STAT_RETURN;
200 break;
201 case OID_GEN_RCV_NO_BUFFER:
202 temp_data = xi->stat_rx_no_buffer;
203 HANDLE_STAT_RETURN;
204 break;
205 case OID_802_3_PERMANENT_ADDRESS:
206 data = xi->perm_mac_addr;
207 len = ETH_ALEN;
208 break;
209 case OID_802_3_CURRENT_ADDRESS:
210 data = xi->curr_mac_addr;
211 len = ETH_ALEN;
212 break;
213 case OID_802_3_MULTICAST_LIST:
214 data = NULL;
215 len = 0;
216 case OID_802_3_MAXIMUM_LIST_SIZE:
217 temp_data = 0; /* no mcast support */
218 break;
219 case OID_TCP_TASK_OFFLOAD:
220 KdPrint(("Get OID_TCP_TASK_OFFLOAD\n"));
221 /* it's times like this that C really sucks */
223 len = sizeof(NDIS_TASK_OFFLOAD_HEADER);
225 if (xi->config_csum)
226 {
227 len += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer)
228 + sizeof(NDIS_TASK_TCP_IP_CHECKSUM);
229 }
231 if (xi->config_gso)
232 {
233 len += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer)
234 + sizeof(NDIS_TASK_TCP_LARGE_SEND);
235 }
237 //len += 1024;
239 if (len > InformationBufferLength)
240 {
241 break;
242 }
244 KdPrint(("InformationBuffer = %p\n", InformationBuffer));
245 KdPrint(("len = %d\n", len));
247 ntoh = (PNDIS_TASK_OFFLOAD_HEADER)InformationBuffer;
248 if (ntoh->Version != NDIS_TASK_OFFLOAD_VERSION
249 || ntoh->Size != sizeof(*ntoh)
250 || ntoh->EncapsulationFormat.Encapsulation != IEEE_802_3_Encapsulation)
251 {
252 status = NDIS_STATUS_NOT_SUPPORTED;
253 break;
254 }
255 KdPrint(("ntoh = %p\n", ntoh));
256 KdPrint(("ntoh->Size = %d\n", ntoh->Size));
257 ntoh->OffsetFirstTask = 0;
258 nto = NULL;
260 if (xi->config_csum)
261 {
262 if (ntoh->OffsetFirstTask == 0)
263 {
264 ntoh->OffsetFirstTask = ntoh->Size;
265 KdPrint(("ntoh->OffsetFirstTask = %d\n", ntoh->OffsetFirstTask));
266 nto = (PNDIS_TASK_OFFLOAD)((PCHAR)(ntoh) + ntoh->OffsetFirstTask);
267 }
268 else
269 {
270 nto->OffsetNextTask = FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer)
271 + nto->TaskBufferLength;
272 KdPrint(("nto->OffsetNextTask = %d\n", nto->OffsetNextTask));
273 nto = (PNDIS_TASK_OFFLOAD)((PCHAR)(nto) + nto->OffsetNextTask);
274 }
275 /* fill in first nto */
276 nto->Version = NDIS_TASK_OFFLOAD_VERSION;
277 nto->Size = sizeof(NDIS_TASK_OFFLOAD);
278 nto->Task = TcpIpChecksumNdisTask;
279 nto->TaskBufferLength = sizeof(NDIS_TASK_TCP_IP_CHECKSUM);
281 KdPrint(("config_csum enabled\n"));
282 KdPrint(("nto = %p\n", nto));
283 KdPrint(("nto->Size = %d\n", nto->Size));
284 KdPrint(("nto->TaskBufferLength = %d\n", nto->TaskBufferLength));
286 /* fill in checksum offload struct */
287 nttic = (PNDIS_TASK_TCP_IP_CHECKSUM)nto->TaskBuffer;
288 nttic->V4Transmit.IpChecksum = 0;
289 nttic->V4Transmit.IpOptionsSupported = 0;
290 nttic->V4Transmit.TcpChecksum = 1;
291 nttic->V4Transmit.TcpOptionsSupported = 1;
292 nttic->V4Transmit.UdpChecksum = 1;
293 nttic->V4Receive.IpChecksum = 1;
294 nttic->V4Receive.IpOptionsSupported = 1;
295 nttic->V4Receive.TcpChecksum = 1;
296 nttic->V4Receive.TcpOptionsSupported = 1;
297 nttic->V4Receive.UdpChecksum = 1;
298 nttic->V6Transmit.IpOptionsSupported = 0;
299 nttic->V6Transmit.TcpOptionsSupported = 0;
300 nttic->V6Transmit.TcpChecksum = 0;
301 nttic->V6Transmit.UdpChecksum = 0;
302 nttic->V6Receive.IpOptionsSupported = 0;
303 nttic->V6Receive.TcpOptionsSupported = 0;
304 nttic->V6Receive.TcpChecksum = 0;
305 nttic->V6Receive.UdpChecksum = 0;
306 }
307 if (xi->config_gso)
308 {
309 if (ntoh->OffsetFirstTask == 0)
310 {
311 ntoh->OffsetFirstTask = ntoh->Size;
312 KdPrint(("ntoh->OffsetFirstTask = %d\n", ntoh->OffsetFirstTask));
313 nto = (PNDIS_TASK_OFFLOAD)((PCHAR)(ntoh) + ntoh->OffsetFirstTask);
314 }
315 else
316 {
317 nto->OffsetNextTask = FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer)
318 + nto->TaskBufferLength;
319 KdPrint(("nto->OffsetNextTask = %d\n", nto->OffsetNextTask));
320 nto = (PNDIS_TASK_OFFLOAD)((PCHAR)(nto) + nto->OffsetNextTask);
321 }
323 /* fill in second nto */
324 nto->Version = NDIS_TASK_OFFLOAD_VERSION;
325 nto->Size = sizeof(NDIS_TASK_OFFLOAD);
326 nto->Task = TcpLargeSendNdisTask;
327 nto->TaskBufferLength = sizeof(NDIS_TASK_TCP_LARGE_SEND);
329 KdPrint(("config_gso enabled\n"));
330 KdPrint(("nto = %p\n", nto));
331 KdPrint(("nto->Size = %d\n", nto->Size));
332 KdPrint(("nto->TaskBufferLength = %d\n", nto->TaskBufferLength));
334 /* fill in large send struct */
335 nttls = (PNDIS_TASK_TCP_LARGE_SEND)nto->TaskBuffer;
336 nttls->Version = 0;
337 nttls->MaxOffLoadSize = xi->config_gso;
338 nttls->MinSegmentCount = MIN_LARGE_SEND_SEGMENTS;
339 nttls->TcpOptions = TRUE;
340 nttls->IpOptions = TRUE;
341 KdPrint(("&(nttls->IpOptions) = %p\n", &(nttls->IpOptions)));
343 }
345 if (nto)
346 nto->OffsetNextTask = 0; /* last one */
348 used_temp_buffer = FALSE;
349 break;
350 default:
351 KdPrint(("Get Unknown OID 0x%x\n", Oid));
352 status = NDIS_STATUS_NOT_SUPPORTED;
353 }
355 if (!NT_SUCCESS(status))
356 {
357 // KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (returned error)\n"));
358 return status;
359 }
361 if (len > InformationBufferLength)
362 {
363 *BytesNeeded = len;
364 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (BUFFER_TOO_SHORT %d > %d)\n", len, InformationBufferLength));
365 return NDIS_STATUS_BUFFER_TOO_SHORT;
366 }
368 *BytesWritten = len;
369 if (len && used_temp_buffer)
370 {
371 NdisMoveMemory((PUCHAR)InformationBuffer, data, len);
372 }
374 //KdPrint(("Got OID 0x%x\n", Oid));
375 // KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
377 return status;
378 }
380 NDIS_STATUS DDKAPI
381 XenNet_SetInformation(
382 IN NDIS_HANDLE MiniportAdapterContext,
383 IN NDIS_OID Oid,
384 IN PVOID InformationBuffer,
385 IN ULONG InformationBufferLength,
386 OUT PULONG BytesRead,
387 OUT PULONG BytesNeeded
388 )
389 {
390 NTSTATUS status;
391 struct xennet_info *xi = MiniportAdapterContext;
392 PULONG64 data = InformationBuffer;
393 PNDIS_TASK_OFFLOAD_HEADER ntoh;
394 PNDIS_TASK_OFFLOAD nto;
395 PNDIS_TASK_TCP_IP_CHECKSUM nttic;
396 PNDIS_TASK_TCP_LARGE_SEND nttls;
397 int offset;
399 //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
401 UNREFERENCED_PARAMETER(MiniportAdapterContext);
402 UNREFERENCED_PARAMETER(InformationBufferLength);
403 UNREFERENCED_PARAMETER(BytesRead);
404 UNREFERENCED_PARAMETER(BytesNeeded);
406 switch(Oid)
407 {
408 case OID_GEN_SUPPORTED_LIST:
409 status = NDIS_STATUS_NOT_SUPPORTED;
410 KdPrint(("Unsupported set OID_GEN_SUPPORTED_LIST\n"));
411 break;
412 case OID_GEN_HARDWARE_STATUS:
413 status = NDIS_STATUS_NOT_SUPPORTED;
414 KdPrint(("Unsupported set OID_GEN_HARDWARE_STATUS\n"));
415 break;
416 case OID_GEN_MEDIA_SUPPORTED:
417 status = NDIS_STATUS_NOT_SUPPORTED;
418 KdPrint(("Unsupported set OID_GEN_MEDIA_SUPPORTED\n"));
419 break;
420 case OID_GEN_MEDIA_IN_USE:
421 status = NDIS_STATUS_NOT_SUPPORTED;
422 KdPrint(("Unsupported set OID_GEN_MEDIA_IN_USE\n"));
423 break;
424 case OID_GEN_MAXIMUM_LOOKAHEAD:
425 status = NDIS_STATUS_NOT_SUPPORTED;
426 KdPrint(("Unsupported set OID_GEN_MAXIMUM_LOOKAHEAD\n"));
427 break;
428 case OID_GEN_MAXIMUM_FRAME_SIZE:
429 status = NDIS_STATUS_NOT_SUPPORTED;
430 KdPrint(("Unsupported set OID_GEN_MAXIMUM_FRAME_SIZE\n"));
431 break;
432 case OID_GEN_LINK_SPEED:
433 status = NDIS_STATUS_NOT_SUPPORTED;
434 KdPrint(("Unsupported set OID_GEN_LINK_SPEED\n"));
435 break;
436 case OID_GEN_TRANSMIT_BUFFER_SPACE:
437 status = NDIS_STATUS_NOT_SUPPORTED;
438 KdPrint(("Unsupported set OID_GEN_TRANSMIT_BUFFER_SPACE\n"));
439 break;
440 case OID_GEN_RECEIVE_BUFFER_SPACE:
441 status = NDIS_STATUS_NOT_SUPPORTED;
442 KdPrint(("Unsupported set OID_GEN_RECEIVE_BUFFER_SPACE\n"));
443 break;
444 case OID_GEN_TRANSMIT_BLOCK_SIZE:
445 status = NDIS_STATUS_NOT_SUPPORTED;
446 KdPrint(("Unsupported set OID_GEN_TRANSMIT_BLOCK_SIZE\n"));
447 break;
448 case OID_GEN_RECEIVE_BLOCK_SIZE:
449 status = NDIS_STATUS_NOT_SUPPORTED;
450 KdPrint(("Unsupported set OID_GEN_RECEIVE_BLOCK_SIZE\n"));
451 break;
452 case OID_GEN_VENDOR_ID:
453 status = NDIS_STATUS_NOT_SUPPORTED;
454 KdPrint(("Unsupported set OID_GEN_VENDOR_ID\n"));
455 break;
456 case OID_GEN_VENDOR_DESCRIPTION:
457 status = NDIS_STATUS_NOT_SUPPORTED;
458 KdPrint(("Unsupported set OID_GEN_VENDOR_DESCRIPTION\n"));
459 break;
460 case OID_GEN_CURRENT_PACKET_FILTER:
461 KdPrint(("Set OID_GEN_CURRENT_PACKET_FILTER\n"));
462 xi->packet_filter = *(ULONG *)data;
463 status = NDIS_STATUS_SUCCESS;
464 break;
465 case OID_GEN_CURRENT_LOOKAHEAD:
466 KdPrint(("Set OID_GEN_CURRENT_LOOKAHEAD %d\n", *(int *)data));
467 // TODO: We should do this...
468 status = NDIS_STATUS_SUCCESS;
469 break;
470 case OID_GEN_DRIVER_VERSION:
471 status = NDIS_STATUS_NOT_SUPPORTED;
472 KdPrint(("Unsupported set OID_GEN_DRIVER_VERSION\n"));
473 break;
474 case OID_GEN_MAXIMUM_TOTAL_SIZE:
475 status = NDIS_STATUS_NOT_SUPPORTED;
476 KdPrint(("Unsupported set OID_GEN_MAXIMUM_TOTAL_SIZE\n"));
477 break;
478 case OID_GEN_PROTOCOL_OPTIONS:
479 KdPrint(("Unsupported set OID_GEN_PROTOCOL_OPTIONS\n"));
480 // TODO - actually do this...
481 status = NDIS_STATUS_SUCCESS;
482 break;
483 case OID_GEN_MAC_OPTIONS:
484 status = NDIS_STATUS_NOT_SUPPORTED;
485 KdPrint(("Unsupported set OID_GEN_MAC_OPTIONS\n"));
486 break;
487 case OID_GEN_MEDIA_CONNECT_STATUS:
488 status = NDIS_STATUS_NOT_SUPPORTED;
489 KdPrint(("Unsupported set OID_GEN_MEDIA_CONNECT_STATUS\n"));
490 break;
491 case OID_GEN_MAXIMUM_SEND_PACKETS:
492 status = NDIS_STATUS_NOT_SUPPORTED;
493 KdPrint(("Unsupported set OID_GEN_MAXIMUM_SEND_PACKETS\n"));
494 break;
495 case OID_GEN_XMIT_OK:
496 status = NDIS_STATUS_NOT_SUPPORTED;
497 KdPrint(("Unsupported set OID_GEN_XMIT_OK\n"));
498 break;
499 case OID_GEN_RCV_OK:
500 status = NDIS_STATUS_NOT_SUPPORTED;
501 KdPrint(("Unsupported set OID_GEN_RCV_OK\n"));
502 break;
503 case OID_GEN_XMIT_ERROR:
504 status = NDIS_STATUS_NOT_SUPPORTED;
505 KdPrint(("Unsupported set OID_GEN_XMIT_ERROR\n"));
506 break;
507 case OID_GEN_RCV_ERROR:
508 status = NDIS_STATUS_NOT_SUPPORTED;
509 KdPrint(("Unsupported set OID_GEN_RCV_ERROR\n"));
510 break;
511 case OID_GEN_RCV_NO_BUFFER:
512 status = NDIS_STATUS_NOT_SUPPORTED;
513 KdPrint(("Unsupported set OID_GEN_RCV_NO_BUFFER\n"));
514 break;
515 case OID_802_3_PERMANENT_ADDRESS:
516 status = NDIS_STATUS_NOT_SUPPORTED;
517 KdPrint(("Unsupported set OID_802_3_PERMANENT_ADDRESS\n"));
518 break;
519 case OID_802_3_CURRENT_ADDRESS:
520 status = NDIS_STATUS_NOT_SUPPORTED;
521 KdPrint(("Unsupported set OID_802_3_CURRENT_ADDRESS\n"));
522 break;
523 case OID_802_3_MULTICAST_LIST:
524 status = NDIS_STATUS_NOT_SUPPORTED;
525 KdPrint(("Unsupported set OID_802_3_MULTICAST_LIST\n"));
526 break;
527 case OID_802_3_MAXIMUM_LIST_SIZE:
528 status = NDIS_STATUS_NOT_SUPPORTED;
529 KdPrint(("Unsupported set OID_802_3_MAXIMUM_LIST_SIZE\n"));
530 break;
531 case OID_TCP_TASK_OFFLOAD:
532 status = NDIS_STATUS_SUCCESS;
533 KdPrint(("Set OID_TCP_TASK_OFFLOAD\n"));
534 // we should disable everything here, then enable what has been set
535 ntoh = (PNDIS_TASK_OFFLOAD_HEADER)InformationBuffer;
536 *BytesRead = sizeof(NDIS_TASK_OFFLOAD_HEADER);
537 offset = ntoh->OffsetFirstTask;
538 nto = (PNDIS_TASK_OFFLOAD)ntoh; // not really, just to get the first offset right
539 while (offset != 0)
540 {
541 *BytesRead += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer);
542 nto = (PNDIS_TASK_OFFLOAD)(((PUCHAR)nto) + offset);
543 switch (nto->Task)
544 {
545 case TcpIpChecksumNdisTask:
546 *BytesRead += sizeof(NDIS_TASK_TCP_IP_CHECKSUM);
547 KdPrint(("TcpIpChecksumNdisTask\n"));
548 nttic = (PNDIS_TASK_TCP_IP_CHECKSUM)nto->TaskBuffer;
549 xi->setting_csum = *nttic;
550 KdPrint((" V4Transmit.IpOptionsSupported = %d\n", nttic->V4Transmit.IpOptionsSupported));
551 KdPrint((" V4Transmit.TcpOptionsSupported = %d\n", nttic->V4Transmit.TcpOptionsSupported));
552 KdPrint((" V4Transmit.TcpChecksum = %d\n", nttic->V4Transmit.TcpChecksum));
553 KdPrint((" V4Transmit.UdpChecksum = %d\n", nttic->V4Transmit.UdpChecksum));
554 KdPrint((" V4Transmit.IpChecksum = %d\n", nttic->V4Transmit.IpChecksum));
555 KdPrint((" V4Receive.IpOptionsSupported = %d\n", nttic->V4Receive.IpOptionsSupported));
556 KdPrint((" V4Receive.TcpOptionsSupported = %d\n", nttic->V4Receive.TcpOptionsSupported));
557 KdPrint((" V4Receive.TcpChecksum = %d\n", nttic->V4Receive.TcpChecksum));
558 KdPrint((" V4Receive.UdpChecksum = %d\n", nttic->V4Receive.UdpChecksum));
559 KdPrint((" V4Receive.IpChecksum = %d\n", nttic->V4Receive.IpChecksum));
560 KdPrint((" V6Transmit.IpOptionsSupported = %d\n", nttic->V6Transmit.IpOptionsSupported));
561 KdPrint((" V6Transmit.TcpOptionsSupported = %d\n", nttic->V6Transmit.TcpOptionsSupported));
562 KdPrint((" V6Transmit.TcpChecksum = %d\n", nttic->V6Transmit.TcpChecksum));
563 KdPrint((" V6Transmit.UdpChecksum = %d\n", nttic->V6Transmit.UdpChecksum));
564 KdPrint((" V6Receive.IpOptionsSupported = %d\n", nttic->V6Receive.IpOptionsSupported));
565 KdPrint((" V6Receive.TcpOptionsSupported = %d\n", nttic->V6Receive.TcpOptionsSupported));
566 KdPrint((" V6Receive.TcpChecksum = %d\n", nttic->V6Receive.TcpChecksum));
567 KdPrint((" V6Receive.UdpChecksum = %d\n", nttic->V6Receive.UdpChecksum));
568 break;
569 case TcpLargeSendNdisTask:
570 *BytesRead += sizeof(NDIS_TASK_TCP_LARGE_SEND);
571 KdPrint(("TcpLargeSendNdisTask\n"));
572 nttls = (PNDIS_TASK_TCP_LARGE_SEND)nto->TaskBuffer;
573 xi->setting_max_offload = nttls->MaxOffLoadSize;
574 KdPrint((" MaxOffLoadSize = %d\n", nttls->MaxOffLoadSize));
575 KdPrint((" MinSegmentCount = %d\n", nttls->MinSegmentCount));
576 KdPrint((" TcpOptions = %d\n", nttls->TcpOptions));
577 KdPrint((" IpOptions = %d\n", nttls->IpOptions));
578 break;
579 default:
580 KdPrint((" Unknown Task %d\n", nto->Task));
581 }
582 offset = nto->OffsetNextTask;
583 }
584 break;
585 default:
586 KdPrint(("Set Unknown OID 0x%x\n", Oid));
587 status = NDIS_STATUS_NOT_SUPPORTED;
588 break;
589 }
590 //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
591 return status;
592 }