ReactOS  0.4.15-dev-1171-gab82533
ParaNdis5-Oid.c
Go to the documentation of this file.
1 /*
2  * This file contains NDIS5.X implementation of
3  * OID-related adapter driver procedures
4  *
5  * Copyright (c) 2008-2017 Red Hat, Inc.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met :
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and / or other materials provided with the distribution.
15  * 3. Neither the names of the copyright holders nor the names of their contributors
16  * may be used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  */
30 #include "ParaNdis5.h"
31 #include "ParaNdis-Oid.h"
32 
33 #ifdef WPP_EVENT_TRACING
34 #include "ParaNdis5-Oid.tmh"
35 #endif
36 
37 #define OIDENTRY(oid, el, xfl, xokl, flags) \
38 { oid, el, xfl, xokl, flags, NULL }
39 #define OIDENTRYPROC(oid, el, xfl, xokl, flags, setproc) \
40 { oid, el, xfl, xokl, flags, setproc }
41 
43 {
46  0,
47  0,
48  { IEEE_802_3_Encapsulation, { 1, 0 }, 0 }
49 };
50 
51 
52 static NDIS_OID SupportedOids[] = {
105 };
106 
110 
111 /**********************************************************
112 Structure defining how to process all the oids
113 ***********************************************************/
114 // oid e f ok flags set procedure
115 static const tOidWhatToDo OidsDB[] =
116 {
162 OIDENTRY(OID_GEN_GET_TIME_CAPS, 2,4,4, 0 ),
164 OIDENTRY(OID_GEN_NETCARD_LOAD, 2,4,4, 0 ),
165 OIDENTRY(OID_GEN_DEVICE_PROFILE, 2,4,4, 0 ),
166 OIDENTRY(OID_GEN_INIT_TIME_MS, 2,4,4, 0 ),
167 OIDENTRY(OID_GEN_RESET_COUNTS, 2,4,4, 0 ),
185 OIDENTRY(OID_GEN_MACHINE_NAME, 2,4,4, 0 ),
186 OIDENTRY(OID_IP4_OFFLOAD_STATS, 4,4,4, 0 ),
187 OIDENTRY(OID_IP6_OFFLOAD_STATS, 4,4,4, 0 ),
188 OIDENTRY(OID_802_11_CAPABILITY, 4,4,4, 0 ),
196 OIDENTRY(OID_FFP_SUPPORT, 2,4,4, 0 ),
199 OIDENTRY(0x00010203 /*(OID_GEN_RECEIVE_SCALE_CAPABILITIES)*/, 2,4,4, 0 ),
200 OIDENTRY(0x0001021F /*(OID_GEN_RECEIVE_HASH)*/, 2,4,4, 0 ),
201 OIDENTRY(0, 4,4,4, 0),
202 };
203 
204 /**********************************************************
205 Returns to common query processor the array of supported oids
206 ***********************************************************/
207 void ParaNdis_GetSupportedOid(PVOID *pOidsArray, PULONG pLength)
208 {
209  *pOidsArray = SupportedOids;
210  *pLength = sizeof(SupportedOids);
211 }
212 
213 
214 /*****************************************************************
215 Handles NDIS5 specific OID, all the rest handled by common handler
216 *****************************************************************/
218 {
220  BOOLEAN bFreeInfo = FALSE;
221  PVOID pInfo = NULL;
222  ULONG ulSize = 0;
223  ULONG ulLinkSpeed = 0;
224 
225  switch(pOid->Oid)
226  {
228  status = CreateOffloadInfo5ForQuery(pContext, pOid, &pInfo, &ulSize);
229  bFreeInfo = pInfo != NULL;
230  break;
231  case OID_GEN_LINK_SPEED:
232  {
233  /* units are 100 bps */
234  ulLinkSpeed = (ULONG)(PARANDIS_FORMAL_LINK_SPEED / 100);
235  pInfo = &ulLinkSpeed;
236  ulSize = sizeof(ulLinkSpeed);
238  }
239  break;
240  default:
241  return ParaNdis_OidQueryCommon(pContext, pOid);
242  }
244  {
245  status = ParaNdis_OidQueryCopy(pOid, pInfo, ulSize, bFreeInfo);
246  }
247  else if (bFreeInfo)
248  {
249  NdisFreeMemory(pInfo, 0, 0);
250  }
251  return status;
252 }
253 
254 /**********************************************************
255 NDIS required procedure of OID QUERY
256 Just passes all the supported oids to common query procedure
257 Return value:
258  NDIS_STATUS as returned from common code
259  NDIS_STATUS_NOT_SUPPORTED if suppressed in the table
260 ***********************************************************/
262  IN NDIS_OID Oid,
263  IN PVOID InformationBuffer,
264  IN ULONG InformationBufferLength,
266  OUT PULONG BytesNeeded)
267 {
269  tOidWhatToDo Rules;
270  PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
271  tOidDesc _oid;
272  ParaNdis_GetOidSupportRules(Oid, &Rules, OidsDB);
273  _oid.ulToDoFlags = Rules.Flags;
274  *BytesWritten = 0;
275  *BytesNeeded = 0;
276  ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, 0, 1);
277  DPrintf(Rules.nEntryLevel, ("[%s], id 0x%X(%s) of %d", __FUNCTION__,
278  Oid,
279  Rules.name,
280  InformationBufferLength));
281  _oid.Oid = Oid;
282  _oid.InformationBuffer = InformationBuffer;
283  _oid.InformationBufferLength = InformationBufferLength;
284  _oid.pBytesNeeded = (PUINT)BytesNeeded;
285  _oid.pBytesRead = (PUINT)BytesWritten;
288  else if (Rules.Flags & ohfQuery) status = ParaNdis_OidQuery(pContext, &_oid);
289 
290 
291  ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, status, 0);
293  ("[%s] , id 0x%X(%s) (%X), written %d, needed %d",
294  __FUNCTION__,
295  Rules.oid,
296  Rules.name,
297  status,
298  *BytesWritten,
299  *BytesNeeded));
300  return status;
301 
302 }
303 
304 /**********************************************************
305 NDIS required procedure of OID SET
306 Just passes all the supported oids to common set procedure
307 Return value:
308  NDIS_STATUS as returned from set procedure
309  NDIS_STATUS_NOT_SUPPORTED if support not defined in the table
310 ***********************************************************/
312  IN NDIS_OID Oid,
313  IN PVOID InformationBuffer,
314  IN ULONG InformationBufferLength,
316  OUT PULONG BytesNeeded)
317 {
319  tOidWhatToDo Rules;
320  PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
321  tOidDesc _oid;
322  ParaNdis_GetOidSupportRules(Oid, &Rules, OidsDB);
323  _oid.ulToDoFlags = Rules.Flags;
324  *BytesRead = 0;
325  *BytesNeeded = 0;
326  ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, 1, 1);
327  DPrintf(Rules.nEntryLevel, ("[%s], id 0x%X(%s) of %d", __FUNCTION__,
328  Oid,
329  Rules.name,
330  InformationBufferLength));
331  _oid.Oid = Oid;
332  _oid.InformationBuffer = InformationBuffer;
333  _oid.InformationBufferLength = InformationBufferLength;
334  _oid.pBytesNeeded = (PUINT)BytesNeeded;
335  _oid.pBytesRead = (PUINT)BytesRead;
336  _oid.pBytesWritten = (PUINT)BytesRead;
338  else if (Rules.Flags & ohfSet)
339  {
340  if (Rules.OidSetProc) status = Rules.OidSetProc(pContext, &_oid);
341  else
342  {
343  DPrintf(0, ("[%s] ERROR in OID redirection table", __FUNCTION__));
345  }
346  }
347  ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, status, 0);
349  {
351  ("[%s] , id 0x%X(%s) (%X), read %d, needed %d", __FUNCTION__,
352  Rules.oid, Rules.name, status, *BytesRead, *BytesNeeded));
353  }
354  return status;
355 }
356 
358 {
360  tPowerWorkItem *pwi = (tPowerWorkItem *)pWorkItem;
361  PARANDIS_ADAPTER *pContext = pwi->pContext;
363  {
364  status = ParaNdis_PowerOn(pContext);
365  }
366  else
367  {
368  ParaNdis_PowerOff(pContext);
369  }
370  NdisFreeMemory(pwi, 0, 0);
373 }
374 
375 /**********************************************************
376 NDIS5.X handler of power management
377 ***********************************************************/
379 {
381  NDIS_DEVICE_POWER_STATE newState;
382  DEBUG_ENTRY(0);
383  status = ParaNdis_OidSetCopy(pOid, &newState, sizeof(newState));
385  {
386  tPowerWorkItem *pwi = ParaNdis_AllocateMemory(pContext, sizeof(tPowerWorkItem));
388  if (pwi)
389  {
390  pwi->pContext = pContext;
391  pwi->state = newState;
394  {
396  }
397  else
398  NdisFreeMemory(pwi, 0, 0);
399  }
400  }
401  return status;
402 }
403 
404 /***************************************************
405 check that the incoming NDIS_TASK_TCP_IP_CHECKSUM
406 does not enable options which we do not support
407 ***************************************************/
409 {
411  BOOLEAN bInvalid = FALSE;
412  ParaNdis_ResetOffloadSettings(pContext, &f, NULL);
413  bInvalid |= pcs->V4Receive.IpChecksum && !f.fRxIPChecksum;
414  bInvalid |= pcs->V4Receive.IpOptionsSupported && !f.fRxIPOptions;
415  bInvalid |= pcs->V4Receive.TcpChecksum && !f.fRxTCPChecksum;
416  bInvalid |= pcs->V4Receive.TcpOptionsSupported && !f.fRxTCPOptions;
417  bInvalid |= pcs->V4Receive.UdpChecksum && !f.fRxUDPChecksum;
418 
419  bInvalid |= pcs->V4Transmit.IpChecksum && !f.fTxIPChecksum;
420  bInvalid |= pcs->V4Transmit.IpOptionsSupported && !f.fTxIPOptions;
421  bInvalid |= pcs->V4Transmit.TcpChecksum && !f.fTxTCPChecksum;
422  bInvalid |= pcs->V4Transmit.TcpOptionsSupported && !f.fTxTCPOptions;
423  bInvalid |= pcs->V4Transmit.UdpChecksum && !f.fTxUDPChecksum;
424  return !bInvalid;
425 }
426 
427 /***************************************************
428 check that the incoming NDIS_TASK_TCP_LARGE_SEND
429 does not enable options which we do not support
430 ***************************************************/
432 {
434  BOOLEAN bInvalid = FALSE;
435  ParaNdis_ResetOffloadSettings(pContext, &f, NULL);
436  bInvalid |= pls->Version != NDIS_TASK_TCP_LARGE_SEND_V0;
437  bInvalid |= pls->IpOptions && !f.fTxLsoIP;
438  bInvalid |= pls->TcpOptions && !f.fTxLsoTCP;
439  bInvalid |= (pls->IpOptions || pls->TcpOptions || pls->MaxOffLoadSize) && !f.fTxLso;
440  bInvalid |= pls->MinSegmentCount < PARANDIS_MIN_LSO_SEGMENTS;
441  return !bInvalid;
442 }
443 
445  PARANDIS_ADAPTER *pContext,
446  BOOLEAN bApply, /* for 'set'*/
447  NDIS_TASK_OFFLOAD *pto,
448  ULONG offset,
449  ULONG maxSize)
450 {
454  NDIS_TASK_IPSEC *pips = NULL;
455  LPCSTR sName = NULL;
456  ULONG TaskBufferSize = 0, tailOffset = 0;
457  switch(pto->Task)
458  {
461  TaskBufferSize = sizeof(*pcs);
462  sName = "TcpIpChecksumNdisTask";
463  break;
465  pls = (NDIS_TASK_TCP_LARGE_SEND *)pto->TaskBuffer;
466  TaskBufferSize = sizeof(*pls);
467  sName = "TcpLargeSendNdisTask";
468  break;
469  case IpSecNdisTask:
470  pips = (NDIS_TASK_IPSEC *)pto->TaskBuffer;
471  TaskBufferSize = sizeof(*pips);
472  sName = "IpSecNdisTask";
473  break;
474  default:
475  break;
476  }
477  tailOffset = offset + RtlPointerToOffset(pto, &pto->TaskBuffer) + TaskBufferSize;
478  if (!TaskBufferSize)
479  {
480  DPrintf(0, ("[%s], unknown offload task %d", __FUNCTION__, pto->Task));
481  }
482  else if (tailOffset > maxSize)
483  {
484  DPrintf(0, ("[%s], can not parse %s at offset %d, tail at %d", __FUNCTION__, sName, offset, tailOffset));
486  }
487  else if (TaskBufferSize > pto->TaskBufferLength)
488  {
489  DPrintf(0, ("[%s], invalid size of %s", __FUNCTION__, sName));
491  }
492  else if (pcs)
493  {
494  DPrintf(0, ("[%s], parsing %s", __FUNCTION__, sName));
495  DPrintf(0, ("Rx4: checksum IP(%d),TCP(%d),UDP(%d), options IP(%d),TCP(%d)",
496  pcs->V4Receive.IpChecksum, pcs->V4Receive.TcpChecksum, pcs->V4Receive.UdpChecksum,
497  pcs->V4Receive.IpOptionsSupported, pcs->V4Receive.TcpOptionsSupported
498  ));
499  DPrintf(0, ("Tx4: checksum IP(%d),TCP(%d),UDP(%d), options IP(%d),TCP(%d)",
500  pcs->V4Transmit.IpChecksum, pcs->V4Transmit.TcpChecksum, pcs->V4Transmit.UdpChecksum,
501  pcs->V4Transmit.IpOptionsSupported, pcs->V4Transmit.TcpOptionsSupported
502  ));
503  if (bApply)
504  {
505  if (IsValidPcs(pContext, pcs))
506  {
507  tOffloadSettingsFlags *pf = &pContext->Offload.flags;
508  pf->fTxIPChecksum = !!pcs->V4Transmit.IpChecksum;
509  pf->fTxTCPChecksum = !!pcs->V4Transmit.TcpChecksum;
510  pf->fTxUDPChecksum = !!pcs->V4Transmit.UdpChecksum;
511  pf->fTxTCPOptions = !!pcs->V4Transmit.TcpOptionsSupported;
512  pf->fTxIPOptions = !!pcs->V4Transmit.IpOptionsSupported;
513  pf->fRxIPChecksum = !!pcs->V4Receive.IpChecksum;
514  pf->fRxIPOptions = !!pcs->V4Receive.IpOptionsSupported;
515  pf->fRxTCPChecksum = !!pcs->V4Receive.TcpChecksum;
516  pf->fRxTCPOptions = !!pcs->V4Receive.TcpOptionsSupported;
517  pf->fRxUDPChecksum = !!pcs->V4Receive.UdpChecksum;
518  }
519  else
521  }
522  }
523  else if (pls)
524  {
525  DPrintf(0, ("[%s], parsing %s version %d", __FUNCTION__, sName, pls->Version));
526  DPrintf(0, ("options IP(%d),TCP(%d),MaxOffload %d, MinSegments %d",
527  pls->IpOptions, pls->TcpOptions, pls->MaxOffLoadSize, pls->MinSegmentCount));
528  if (bApply)
529  {
530  if (IsValidPls(pContext, pls))
531  {
532  tOffloadSettingsFlags *pf = &pContext->Offload.flags;
533  pf->fTxLsoIP = !!pls->IpOptions;
534  pf->fTxLsoTCP = !!pls->TcpOptions;
535  pf->fTxLso = 1;
536  }
537  else
539  }
540  }
541  else if (pips)
542  {
543  DPrintf(0, ("[%s], parsing %s", __FUNCTION__, sName));
544  }
545  return status;
546 }
547 
549 {
550  return
553  pth->Size == sizeof(*pth);
554 }
555 
557  PARANDIS_ADAPTER *pContext,
559  ULONG size,
560  BOOLEAN bApply,
561  PCCHAR reason,
562  BOOLEAN headerOnly)
563 {
565  BOOLEAN bReset = FALSE;
566  ULONG ulNoCapabilities = 0;
567  DPrintf(0, ("[%s](%s), format %d", __FUNCTION__, reason,
569  if (ValidateOffloadHeader(pth))
570  {
571  PUCHAR p = (PUCHAR)pth;
574  DPrintf(0, ("[%s], header version %d, ip header at %d, fixed %d, first at %d", __FUNCTION__,
575  pth->Version,
577  pth->EncapsulationFormat.Flags.FixedHeaderSize,
578  offset));
579  if (!offset && bApply)
580  {
581  /* disable all the capabilities */
582  // according to DDK, 0 at first task offset means disabling all the capabilities
583  DPrintf(0, ("[%s] RESETTING offload capabilities", __FUNCTION__));
584  ParaNdis_ResetOffloadSettings(pContext, NULL, &ulNoCapabilities);
585  bReset = TRUE;
586  }
587  while (!headerOnly && offset > 0 && (offset + sizeof(NDIS_TASK_OFFLOAD)) < size)
588  {
591  {
592  DPrintf(0, ("[%s], unexpected TO version %d at %d",
593  __FUNCTION__, pto->Version, offset));
595  break;
596  }
597  status = ParseOffloadTask(pContext, bApply, pto, offset, size);
598  if (!pto->OffsetNextTask || status != NDIS_STATUS_SUCCESS)
599  break;
600  offset += pto->OffsetNextTask;
601  }
602  }
603  if (status == STATUS_SUCCESS && bApply)
605  return status;
606 }
607 
608 /********************************************************
609 Fill offload query structure according to our capabilities
610 ********************************************************/
612  PARANDIS_ADAPTER *pContext,
614 {
616  NdisZeroMemory(pcs, sizeof(*pcs));
617  ParaNdis_ResetOffloadSettings(pContext, &f, NULL);
618  pcs->V4Transmit.IpChecksum = !!f.fTxIPChecksum;
619  pcs->V4Transmit.TcpChecksum = !!f.fTxTCPChecksum;
620  pcs->V4Transmit.UdpChecksum = !!f.fTxUDPChecksum;
621  pcs->V4Transmit.IpOptionsSupported = !!f.fTxIPOptions;
622  pcs->V4Transmit.TcpOptionsSupported = !!f.fTxTCPOptions;
623  pcs->V4Receive.IpChecksum = !!f.fRxIPChecksum;
624  pcs->V4Receive.IpOptionsSupported = !!f.fRxIPOptions;
625  pcs->V4Receive.TcpChecksum = !!f.fRxTCPChecksum;
626  pcs->V4Receive.TcpOptionsSupported = !!f.fRxTCPOptions;
627  pcs->V4Receive.UdpChecksum = !!f.fRxUDPChecksum;
628 
629  return
630  pcs->V4Transmit.IpChecksum ||
631  pcs->V4Transmit.TcpChecksum ||
632  pcs->V4Transmit.UdpChecksum ||
633  pcs->V4Receive.IpChecksum ||
634  pcs->V4Receive.TcpChecksum ||
635  pcs->V4Receive.UdpChecksum;
636 }
637 
638 /********************************************************
639 Fill offload query structure according to our capabilities
640 ********************************************************/
642  PARANDIS_ADAPTER *pContext,
644 {
646  NdisZeroMemory(pls, sizeof(*pls));
647  ParaNdis_ResetOffloadSettings(pContext, &f, NULL);
649  pls->IpOptions = !!f.fTxLsoIP;
650  pls->TcpOptions = !!f.fTxLsoTCP;
652  pls->MaxOffLoadSize = pContext->Offload.maxPacketSize;
653  return f.fTxLso != 0;
654 }
655 
656 /********************************************************
657 Allocate and fill our capabilities, dependent on registry setting
658 Note than NDIS test of WLK1.2 and 1.3 fail (offloadmisc)
659 if CS capability indicated and passes if only LSO indicated
660 ********************************************************/
662  PARANDIS_ADAPTER *pContext,
663  PVOID *ppInfo,
664  PULONG pulSize,
665  PCCHAR reason,
666  NDIS_TASK_OFFLOAD_HEADER *pHeader)
667 {
669  ULONG size =
670  sizeof(NDIS_TASK_OFFLOAD_HEADER) +
671  sizeof(NDIS_TASK_OFFLOAD) + sizeof(NDIS_TASK_TCP_IP_CHECKSUM) +
673  *ppInfo = ParaNdis_AllocateMemory(pContext, size);
674  if (*ppInfo)
675  {
676  ULONG flags = 0;
679  flags |= GetTcpIpCheckSumCapabilities(pContext, &cs) ? 2 : 0;
680  flags |= GetLargeSendCapabilities(pContext, &lso) ? 1 : 0;
681  if (flags)
682  {
684  NDIS_TASK_OFFLOAD *pto;
685  UINT i = 0;
686  ULONG *pOffset;
687  PVOID base;
688  *pulSize = size;
689  NdisZeroMemory(*ppInfo, size);
690  ph = (NDIS_TASK_OFFLOAD_HEADER *)*ppInfo;
691  *ph = *pHeader;
692  pto = (NDIS_TASK_OFFLOAD *)(ph + 1);
693  base = ph;
694  pOffset = &ph->OffsetFirstTask;
695  ph->OffsetFirstTask = 0;
696  do
697  {
698  if (flags & (1 << i))
699  {
700  flags &= ~(1 << i);
702  pto->Size = sizeof(*pto);
703  *pOffset = RtlPointerToOffset(base, pto);
704  base = pto;
705  pOffset = &pto->OffsetNextTask;
706  switch(i)
707  {
708  case 1:
709  {
712  pto->TaskBufferLength = sizeof(*pcs);
713  NdisMoveMemory(pcs, &cs, sizeof(cs));
714  pto = (NDIS_TASK_OFFLOAD *)(pcs + 1);
715  break;
716  }
717  case 0:
718  {
720  pto->Task = TcpLargeSendNdisTask;
721  pto->TaskBufferLength = sizeof(*pls);
722  NdisMoveMemory(pls, &lso, sizeof(lso));
723  pto = (NDIS_TASK_OFFLOAD *)(pls + 1);
724  break;
725  }
726  default:
727  break;
728  }
729  }
730  ++i;
731  } while (flags);
732  status = ParseOffload(pContext, ph, size, FALSE, reason, FALSE);
733  }
734  else
735  {
736  NdisFreeMemory(*ppInfo, 0, 0);
737  *ppInfo = NULL;
739  }
740  }
741  return status;
742 }
743 
744 
746  PARANDIS_ADAPTER *pContext,
747  tOidDesc *pOid,
748  PVOID *ppInfo,
749  PULONG pulSize)
750 {
753  *ppInfo = NULL;
754  *pulSize = 0;
755  if (pOid->InformationBufferLength < sizeof(*pth)) pth = &ReservedHeader;
756  status = ParseOffload(pContext, pth, pOid->InformationBufferLength, FALSE, "query enter", TRUE);
758  {
759  CreateOffloadInfo5Internal(pContext, ppInfo, pulSize, "QUERY", pth);
760  }
761  return status;
762 }
763 
765 {
768  pOid->InformationBufferLength, TRUE, "SET", FALSE);
769  if (status == STATUS_SUCCESS)
770  {
771 #if 0 // only for logging after SET
772  PVOID pInfo = NULL;
773  ULONG dummy = 0;
774  CreateOffloadInfo5Internal(pContext, &pInfo, &dummy, "UPDATED", &ReservedHeader);
775  if (pInfo) NdisFreeMemory(pInfo, 0, 0);
776 #endif
777  *pOid->pBytesRead = pOid->InformationBufferLength;
778  }
779  else
780  {
781  DPrintf(0, ("[%s], restoring after unsuccessful set", __FUNCTION__));
782  pContext->Offload = pContext->Offload;
783  }
784  return status;
785 }
VOID ParaNdis_PowerOff(PARANDIS_ADAPTER *pContext)
NDIS_STATUS ParaNdis_OidQueryCommon(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
Definition: ParaNdis-Oid.c:225
#define OID_GEN_PHYSICAL_MEDIUM
Definition: ntddndis.h:264
#define NDIS_STATUS_INVALID_OID
Definition: ndis.h:488
NDIS_STATUS ParaNdis_OnSetLookahead(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
Definition: ParaNdis-Oid.c:640
VOID EXPORT NdisMSetInformationComplete(IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_STATUS Status)
Definition: miniport.c:1187
#define IN
Definition: typedefs.h:39
NDIS_STATUS ParaNdis_OnSetPower(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
static BOOLEAN IsValidPcs(PARANDIS_ADAPTER *pContext, NDIS_TASK_TCP_IP_CHECKSUM *pcs)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
NDIS_WORK_ITEM wi
Definition: ParaNdis5.h:77
NDIS_STATUS ParaNdis_OidSetCopy(tOidDesc *pOid, PVOID pDest, ULONG ulSize)
Definition: ParaNdis-Oid.c:66
#define OID_GEN_DIRECTED_BYTES_RCV
Definition: ntddndis.h:280
#define OID_GEN_VENDOR_DRIVER_VERSION
Definition: ntddndis.h:254
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
struct _NDIS_TASK_TCP_LARGE_SEND NDIS_TASK_TCP_LARGE_SEND
#define NdisInitializeWorkItem(_WI_, _R_, _C_)
Definition: ndis.h:3197
#define TRUE
Definition: types.h:120
UINT InformationBufferLength
Definition: ParaNdis-Oid.h:43
#define OID_GEN_VLAN_ID
Definition: ntddndis.h:260
NDIS_STATUS ParaNdis_OnRemoveWakeupPattern(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
Definition: ParaNdis-Oid.c:606
#define OID_GEN_RECEIVE_BUFFER_SPACE
Definition: ntddndis.h:241
PPARANDIS_ADAPTER pContext
Definition: ParaNdis5.h:78
#define OID_GEN_MEDIA_CAPABILITIES
Definition: ntddndis.h:263
unsigned char * PUCHAR
Definition: retypes.h:3
#define OID_GEN_MAC_OPTIONS
Definition: ntddndis.h:251
#define DEBUG_ENTRY(level)
Definition: kdebugprint.h:49
#define OID_GEN_RCV_ERROR
Definition: ntddndis.h:270
GLintptr offset
Definition: glext.h:5920
ULONG NDIS_OID
Definition: ntddndis.h:230
#define OID_GEN_DIRECTED_FRAMES_XMIT
Definition: ntddndis.h:275
ULONG ulToDoFlags
Definition: ParaNdis-Oid.h:41
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
_Check_return_ _Out_ PULONG pulSize
Definition: winddi.h:2120
#define OID_GEN_RCV_CRC_ERROR
Definition: ntddndis.h:286
#define OID_GEN_HARDWARE_STATUS
Definition: ntddndis.h:234
#define OID_PNP_CAPABILITIES
Definition: ntddndis.h:360
#define OID_802_11_CAPABILITY
Definition: ntddndis.h:354
PVOID InformationBuffer
Definition: ParaNdis-Oid.h:42
#define OID_GEN_MEDIA_IN_USE
Definition: ntddndis.h:236
#define OID_GEN_GET_NETCARD_TIME
Definition: ntddndis.h:289
#define OID_GEN_MULTICAST_FRAMES_RCV
Definition: ntddndis.h:283
#define OID_802_3_XMIT_DEFERRED
Definition: ntddndis.h:310
OIDHANDLERPROC OidSetProc
Definition: ParaNdis-Oid.h:59
static void NTAPI OnSetPowerWorkItem(NDIS_WORK_ITEM *pWorkItem, PVOID Context)
struct _NDIS_TASK_TCP_IP_CHECKSUM NDIS_TASK_TCP_IP_CHECKSUM
#define OID_GEN_MACHINE_NAME
Definition: ntddndis.h:258
static NDIS_STATUS ParseOffload(PARANDIS_ADAPTER *pContext, NDIS_TASK_OFFLOAD_HEADER *pth, ULONG size, BOOLEAN bApply, PCCHAR reason, BOOLEAN headerOnly)
int NDIS_STATUS
Definition: ntddndis.h:471
tOffloadSettingsFlags flags
Definition: ndis56common.h:237
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define OID_GEN_PROTOCOL_OPTIONS
Definition: ntddndis.h:250
static const tOidWhatToDo OidsDB[]
#define OID_GEN_BROADCAST_FRAMES_XMIT
Definition: ntddndis.h:279
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: ntddndis.h:305
uint32_t cs
Definition: isohybrid.c:75
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static BOOLEAN GetLargeSendCapabilities(PARANDIS_ADAPTER *pContext, NDIS_TASK_TCP_LARGE_SEND *pls)
NDIS_DEVICE_POWER_STATE state
Definition: ParaNdis5.h:79
void ParaNdis_ResetOffloadSettings(PARANDIS_ADAPTER *pContext, tOffloadSettingsFlags *pDest, PULONG from)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NDIS_ENCAPSULATION_FORMAT EncapsulationFormat
Definition: ndis.h:1229
#define OID_GEN_RESET_COUNTS
Definition: ntddndis.h:293
#define FALSE
Definition: types.h:117
#define NDIS_STATUS_BUFFER_TOO_SHORT
Definition: ndis.h:487
GLuint base
Definition: 3dtext.c:35
long LONG
Definition: pedump.c:60
#define OID_GEN_TRANSPORT_HEADER_OFFSET
Definition: ntddndis.h:257
#define OID_GEN_MEDIA_CONNECT_STATUS
Definition: ntddndis.h:252
#define PARANDIS_FORMAL_LINK_SPEED
Definition: ndis56common.h:121
#define OID_GEN_TRANSMIT_BUFFER_SPACE
Definition: ntddndis.h:240
PVOID ParaNdis_AllocateMemory(PARANDIS_ADAPTER *pContext, ULONG ulRequiredSize)
#define OID_GEN_MAXIMUM_LOOKAHEAD
Definition: ntddndis.h:237
#define DPrintf(Level, Fmt)
Definition: kdebugprint.h:61
static BOOLEAN GetTcpIpCheckSumCapabilities(PARANDIS_ADAPTER *pContext, NDIS_TASK_TCP_IP_CHECKSUM *pcs)
#define OID_GEN_RCV_OK
Definition: ntddndis.h:268
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NDIS_STATUS EXPORT NdisScheduleWorkItem(IN PNDIS_WORK_ITEM pWorkItem)
Definition: misc.c:467
#define OID_GEN_TRANSMIT_QUEUE_LENGTH
Definition: ntddndis.h:287
#define FORCEINLINE
Definition: ntbasedef.h:216
#define NDIS_STATUS_INVALID_DATA
Definition: ndis.h:486
const char * LPCSTR
Definition: xmlstorage.h:183
const char * name
Definition: ParaNdis-Oid.h:60
#define OID_GEN_GET_TIME_CAPS
Definition: ntddndis.h:288
#define OID_802_3_XMIT_HEARTBEAT_FAILURE
Definition: ntddndis.h:314
#define OID_GEN_SUPPORTED_LIST
Definition: ntddndis.h:233
static NDIS_STATUS ParaNdis_OidQuery(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
#define NDIS_TASK_TCP_LARGE_SEND_V0
Definition: ndis.h:1270
#define OID_GEN_DEVICE_PROFILE
Definition: ntddndis.h:291
#define OID_GEN_VENDOR_ID
Definition: ntddndis.h:244
GLfloat f
Definition: glext.h:7540
#define OID_GEN_VENDOR_DESCRIPTION
Definition: ntddndis.h:245
#define OID_GEN_XMIT_OK
Definition: ntddndis.h:267
GLsizeiptr size
Definition: glext.h:5919
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: ntddndis.h:238
#define OID_IP4_OFFLOAD_STATS
Definition: ntddndis.h:381
#define NDIS_STATUS_NOT_ACCEPTED
Definition: ndis.h:350
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define OID_PNP_ADD_WAKE_UP_PATTERN
Definition: ntddndis.h:363
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: ntddndis.h:249
NDIS_STATUS ParaNdis_OnSetVlanId(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
Definition: ParaNdis-Oid.c:645
NDIS_HANDLE MiniportHandle
Definition: ndis56common.h:349
NDIS_STATUS NTAPI ParaNdis5_QueryOID(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
NDIS_STATUS ParaNdis_OnOidSetMulticastList(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
Definition: ParaNdis-Oid.c:150
#define OID_802_3_XMIT_UNDERRUN
Definition: ntddndis.h:313
#define OID_GEN_NETCARD_LOAD
Definition: ntddndis.h:290
#define RtlPointerToOffset(Base, Pointer)
Definition: ndis56common.h:54
#define OID_802_3_RCV_OVERRUN
Definition: ntddndis.h:312
#define OID_802_3_RCV_ERROR_ALIGNMENT
Definition: ntddndis.h:307
NDIS_STATUS ParaNdis_OnAddWakeupPattern(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
Definition: ParaNdis-Oid.c:584
NDIS_STATUS NTAPI ParaNdis5_SetOID(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
NDIS_STATUS ParaNdis_OnSetPacketFilter(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
Definition: ParaNdis-Oid.c:118
ULONG TaskBufferLength
Definition: ndis.h:1237
#define PARANDIS_MIN_LSO_SEGMENTS
Definition: ndis56common.h:124
GLbitfield flags
Definition: glext.h:7161
#define OID_GEN_DIRECTED_FRAMES_RCV
Definition: ntddndis.h:281
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
void ParaNdis_GetOidSupportRules(NDIS_OID oid, tOidWhatToDo *pRule, const tOidWhatToDo *Table)
Definition: ParaNdis-Oid.c:661
#define OIDENTRY(oid, el, xfl, xokl, flags)
Definition: ParaNdis5-Oid.c:37
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
NDIS_STATUS ParaNdis_OnEnableWakeup(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
Definition: ParaNdis-Oid.c:627
PUINT pBytesRead
Definition: ParaNdis-Oid.h:46
#define NDIS_TASK_OFFLOAD_VERSION
Definition: ndis.h:1388
struct _NDIS_ENCAPSULATION_FORMAT::@2077 Flags
NDIS_STATUS ParaNdis_PowerOn(PARANDIS_ADAPTER *pContext)
#define OID_802_3_XMIT_ONE_COLLISION
Definition: ntddndis.h:308
PUINT pBytesNeeded
Definition: ParaNdis-Oid.h:45
#define OID_GEN_BROADCAST_BYTES_RCV
Definition: ntddndis.h:284
static void FORCEINLINE ParaNdis_DebugHistory(PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4)
Definition: ndis56common.h:647
#define OID_GEN_MEDIA_SENSE_COUNTS
Definition: ntddndis.h:294
#define OID_GEN_BROADCAST_FRAMES_RCV
Definition: ntddndis.h:285
#define OID_GEN_LINK_SPEED
Definition: ntddndis.h:239
NDIS_ENCAPSULATION Encapsulation
Definition: ndis.h:1216
#define OID_TCP_TASK_OFFLOAD
Definition: ntddndis.h:373
#define OID_802_3_XMIT_MORE_COLLISIONS
Definition: ntddndis.h:309
tOffloadSettings Offload
Definition: ndis56common.h:470
#define OID_GEN_BROADCAST_BYTES_XMIT
Definition: ntddndis.h:278
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
#define OID_PNP_REMOVE_WAKE_UP_PATTERN
Definition: ntddndis.h:364
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: ntddndis.h:253
ULONG OffsetNextTask
Definition: ndis.h:1236
#define OID_GEN_MULTICAST_FRAMES_XMIT
Definition: ntddndis.h:277
#define OID_GEN_MULTICAST_BYTES_XMIT
Definition: ntddndis.h:276
#define OID_GEN_MEDIA_SUPPORTED
Definition: ntddndis.h:235
static NDIS_TASK_OFFLOAD_HEADER ReservedHeader
Definition: ParaNdis5-Oid.c:42
static NDIS_STATUS OnOidSetNdis5Offload(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
#define f
Definition: ke_i.h:83
NDIS_STATUS ParaNdis_OidQueryCopy(tOidDesc *pOid, PVOID pInfo, ULONG ulSize, BOOLEAN bFreeInfo)
Definition: ParaNdis-Oid.c:178
#define OID_GEN_XMIT_ERROR
Definition: ntddndis.h:269
#define OID_802_3_MAC_OPTIONS
Definition: ntddndis.h:306
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: ntddndis.h:242
NDIS_OID Oid
Definition: ParaNdis-Oid.h:40
unsigned int * PULONG
Definition: retypes.h:1
unsigned int UINT
Definition: ndis.h:50
static FORCEINLINE BOOLEAN ValidateOffloadHeader(NDIS_TASK_OFFLOAD_HEADER *pth)
static BOOLEAN IsValidPls(PARANDIS_ADAPTER *pContext, NDIS_TASK_TCP_LARGE_SEND *pls)
#define OID_PNP_SET_POWER
Definition: ntddndis.h:361
PUINT pBytesWritten
Definition: ParaNdis-Oid.h:44
#define OID_GEN_MULTICAST_BYTES_RCV
Definition: ntddndis.h:282
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: ntddndis.h:243
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
static NDIS_STATUS ParseOffloadTask(PARANDIS_ADAPTER *pContext, BOOLEAN bApply, NDIS_TASK_OFFLOAD *pto, ULONG offset, ULONG maxSize)
#define OID_802_3_XMIT_MAX_COLLISIONS
Definition: ntddndis.h:311
static NDIS_STATUS CreateOffloadInfo5ForQuery(PARANDIS_ADAPTER *pContext, tOidDesc *pOid, PVOID *ppInfo, PULONG pulSize)
enum _NDIS_DEVICE_POWER_STATE NDIS_DEVICE_POWER_STATE
#define OUT
Definition: typedefs.h:40
#define OID_PNP_QUERY_POWER
Definition: ntddndis.h:362
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
unsigned int ULONG
Definition: retypes.h:1
#define OID_802_3_PERMANENT_ADDRESS
Definition: ntddndis.h:302
#define OID_802_3_CURRENT_ADDRESS
Definition: ntddndis.h:303
struct _NDIS_TASK_OFFLOAD_HEADER NDIS_TASK_OFFLOAD_HEADER
NDIS_TASK Task
Definition: ndis.h:1235
static NDIS_OID SupportedOids[]
Definition: ParaNdis5-Oid.c:52
GLfloat GLfloat p
Definition: glext.h:8902
#define OID_802_3_XMIT_LATE_COLLISIONS
Definition: ntddndis.h:316
#define OID_IP6_OFFLOAD_STATS
Definition: ntddndis.h:382
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
#define __FUNCTION__
Definition: types.h:112
UCHAR TaskBuffer[1]
Definition: ndis.h:1238
#define OID_PNP_ENABLE_WAKE_UP
Definition: ntddndis.h:366
static SERVICE_STATUS status
Definition: service.c:31
#define OID_GEN_SUPPORTED_GUIDS
Definition: ntddndis.h:255
void ParaNdis_GetSupportedOid(PVOID *pOidsArray, PULONG pLength)
struct _NDIS_TASK_TCP_IP_CHECKSUM::@2079 V4Receive
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:110
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
#define OID_GEN_DRIVER_VERSION
Definition: ntddndis.h:248
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255
#define OID_802_3_XMIT_TIMES_CRS_LOST
Definition: ntddndis.h:315
#define OID_FFP_SUPPORT
Definition: ntddndis.h:393
unsigned int * PUINT
Definition: ndis.h:50
struct _NDIS_TASK_TCP_IP_CHECKSUM::@2078 V4Transmit
#define OID_GEN_DIRECTED_BYTES_XMIT
Definition: ntddndis.h:274
#define OIDENTRYPROC(oid, el, xfl, xokl, flags, setproc)
Definition: ParaNdis5-Oid.c:39
#define OID_GEN_INIT_TIME_MS
Definition: ntddndis.h:292
#define OID_GEN_RCV_NO_BUFFER
Definition: ntddndis.h:271
Definition: ps.c:97
static NDIS_STATUS CreateOffloadInfo5Internal(PARANDIS_ADAPTER *pContext, PVOID *ppInfo, PULONG pulSize, PCCHAR reason, NDIS_TASK_OFFLOAD_HEADER *pHeader)