ReactOS  0.4.15-dev-5122-g72bdbdd
requests.c File Reference
#include "nvnet.h"
#include "debug.h"
Include dependency graph for requests.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define NdisEqualMemory   NvEqualMemory
 

Functions

static ULONG NvNetGetLinkSpeed (_In_ PNVNET_ADAPTER Adapter)
 
static ULONG PacketFilterToMask (_In_ ULONG PacketFilter)
 
static DECLSPEC_NOINLINE VOID NvNetApplyPacketFilter (_In_ PNVNET_ADAPTER Adapter)
 
static VOID NvNetReadStatistics (_In_ PNVNET_ADAPTER Adapter)
 
static VOID NvNetQueryHwCounter (_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_OID Oid, _Out_ PULONG64 Counter)
 
static VOID NvNetQuerySoftwareCounter (_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_OID Oid, _Out_ PULONG64 Counter)
 
static NDIS_STATUS NvNetFillPowerManagementCapabilities (_In_ PNVNET_ADAPTER Adapter, _Out_ PNDIS_PNP_CAPABILITIES Capabilities)
 
static ULONG BuildFrameSignature (_In_ PNVNET_WAKE_FRAME WakeFrame)
 
static VOID WriteWakeFrame (_In_ PNVNET_ADAPTER Adapter, _In_ PNVNET_WAKE_FRAME WakeFrame, _In_ ULONG FrameNumber)
 
static ULONG FrameNumberToWakeUpMask (_In_ ULONG FrameNumber)
 
static ULONG FrameNumberToPowerMask (_In_ ULONG FrameNumber)
 
VOID NvNetSetPowerState (_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_DEVICE_POWER_STATE NewPowerState, _In_ ULONG WakeFlags)
 
static VOID NTAPI NvNetPowerWorker (_In_ PNDIS_WORK_ITEM WorkItem, _In_opt_ PVOID Context)
 
static NDIS_STATUS NvNetSetPower (_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_DEVICE_POWER_STATE NewPowerState)
 
static NDIS_STATUS NvNetAddWakeUpPattern (_In_ PNVNET_ADAPTER Adapter, _In_ PNDIS_PM_PACKET_PATTERN Pattern)
 
static BOOLEAN NvEqualMemory (_In_reads_bytes_(Length) PVOID Destination, _In_reads_bytes_(Length) PVOID Source, _In_ ULONG Length)
 
static NDIS_STATUS NvNetRemoveWakeUpPattern (_In_ PNVNET_ADAPTER Adapter, _In_ PNDIS_PM_PACKET_PATTERN Pattern)
 
static ULONG NvNetGetWakeUp (_In_ PNVNET_ADAPTER Adapter)
 
static VOID NvNetEnableWakeUp (_In_ PNVNET_ADAPTER Adapter, _In_ ULONG Flags)
 
static NDIS_STATUS NvNetGetTcpTaskOffload (_In_ PNVNET_ADAPTER Adapter, _In_ PNDIS_TASK_OFFLOAD_HEADER TaskOffloadHeader, _In_ ULONG InformationBufferLength, _Out_ PULONG BytesWritten, _Out_ PULONG BytesNeeded)
 
static NDIS_STATUS NvNetSetTcpTaskOffload (_Inout_ PNVNET_ADAPTER Adapter, _In_ PNDIS_TASK_OFFLOAD_HEADER TaskOffloadHeader, _In_ PULONG BytesRead)
 
NDIS_STATUS NTAPI MiniportQueryInformation (_In_ NDIS_HANDLE MiniportAdapterContext, _In_ NDIS_OID Oid, _In_ PVOID InformationBuffer, _In_ ULONG InformationBufferLength, _Out_ PULONG BytesWritten, _Out_ PULONG BytesNeeded)
 
NDIS_STATUS NTAPI MiniportSetInformation (_In_ NDIS_HANDLE MiniportAdapterContext, _In_ NDIS_OID Oid, _In_ PVOID InformationBuffer, _In_ ULONG InformationBufferLength, _Out_ PULONG BytesRead, _Out_ PULONG BytesNeeded)
 

Variables

static const NDIS_OID NvpSupportedOidList []
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file requests.c.

◆ NdisEqualMemory

#define NdisEqualMemory   NvEqualMemory

Definition at line 717 of file requests.c.

Function Documentation

◆ BuildFrameSignature()

static ULONG BuildFrameSignature ( _In_ PNVNET_WAKE_FRAME  WakeFrame)
static

Definition at line 427 of file requests.c.

429 {
430  ULONG i, j, Crc;
431 
432  Crc = 0xFFFFFFFF;
433  for (i = 0; i < sizeof(WakeFrame->WakeUpPattern); ++i)
434  {
435  if (WakeFrame->PatternMask.AsUCHAR[i / 8] & (1 << (i % 8)))
436  {
437  Crc ^= WakeFrame->WakeUpPattern[i];
438  for (j = 8; j > 0; --j)
439  {
440  Crc = (Crc >> 1) ^ (-(LONG)(Crc & 1) & 0xEDB88320);
441  }
442  }
443  }
444 
445  return ~Crc;
446 }
long LONG
Definition: pedump.c:60
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 GLint GLint j
Definition: glfuncs.h:250
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
unsigned int ULONG
Definition: retypes.h:1

Referenced by WriteWakeFrame().

◆ FrameNumberToPowerMask()

static ULONG FrameNumberToPowerMask ( _In_ ULONG  FrameNumber)
static

Definition at line 482 of file requests.c.

484 {
485  switch (FrameNumber)
486  {
487  case 5:
489  case 6:
491  case 7:
493 
494  default:
495  return 0;
496  }
497 }
#define NVREG_POWERSTATE2_WAKEUPPAT_5
Definition: nic.h:343
#define NVREG_POWERSTATE2_WAKEUPPAT_7
Definition: nic.h:345
#define NVREG_POWERSTATE2_WAKEUPPAT_6
Definition: nic.h:344

Referenced by NvNetSetPowerState().

◆ FrameNumberToWakeUpMask()

static ULONG FrameNumberToWakeUpMask ( _In_ ULONG  FrameNumber)
static

Definition at line 471 of file requests.c.

473 {
474  if (FrameNumber < 5)
475  return 0x10000 << FrameNumber;
476  else
477  return 0;
478 }

Referenced by NvNetSetPowerState().

◆ MiniportQueryInformation()

NDIS_STATUS NTAPI MiniportQueryInformation ( _In_ NDIS_HANDLE  MiniportAdapterContext,
_In_ NDIS_OID  Oid,
_In_ PVOID  InformationBuffer,
_In_ ULONG  InformationBufferLength,
_Out_ PULONG  BytesWritten,
_Out_ PULONG  BytesNeeded 
)

Definition at line 997 of file requests.c.

1004 {
1005  PNVNET_ADAPTER Adapter = (PNVNET_ADAPTER)MiniportAdapterContext;
1007  ULONG InfoLength;
1008  PVOID InfoPtr;
1009  union _GENERIC_INFORMATION
1010  {
1011  USHORT Ushort;
1012  ULONG Ulong;
1013  ULONG64 Ulong64;
1014  NDIS_MEDIUM Medium;
1017  } GenericInfo;
1018 
1019  InfoLength = sizeof(ULONG);
1020  InfoPtr = &GenericInfo;
1021 
1022  switch (Oid)
1023  {
1025  InfoPtr = (PVOID)&NvpSupportedOidList;
1026  InfoLength = sizeof(NvpSupportedOidList);
1027  break;
1028 
1030  InfoLength = sizeof(NDIS_HARDWARE_STATUS);
1031  GenericInfo.Status = NdisHardwareStatusReady;
1032  break;
1033 
1035  case OID_GEN_MEDIA_IN_USE:
1036  {
1037  InfoLength = sizeof(NDIS_MEDIUM);
1038  GenericInfo.Medium = NdisMedium802_3;
1039  break;
1040  }
1041 
1044  {
1045  GenericInfo.Ulong = Adapter->MaximumFrameSize - sizeof(ETH_HEADER);
1046  break;
1047  }
1048 
1050  {
1051  GenericInfo.Ulong = Adapter->MaximumFrameSize;
1052  break;
1053  }
1054 
1055  case OID_GEN_LINK_SPEED:
1056  {
1057  GenericInfo.Ulong = NvNetGetLinkSpeed(Adapter) * 10000;
1058  break;
1059  }
1060 
1062  {
1063  /* TODO: Change this later, once the driver can handle multipacket sends */
1064  GenericInfo.Ulong = Adapter->MaximumFrameSize;
1065  break;
1066  }
1067 
1069  {
1070  GenericInfo.Ulong = Adapter->MaximumFrameSize * NVNET_RECEIVE_DESCRIPTORS;
1071  }
1072 
1076  {
1077  GenericInfo.Ulong = Adapter->MaximumFrameSize;
1078  break;
1079  }
1080 
1081  case OID_GEN_VENDOR_ID:
1082  {
1083  GenericInfo.Ulong = 0;
1084  GenericInfo.Ulong |= (Adapter->PermanentMacAddress[0] << 16);
1085  GenericInfo.Ulong |= (Adapter->PermanentMacAddress[1] << 8);
1086  GenericInfo.Ulong |= (Adapter->PermanentMacAddress[2] & 0xFF);
1087  break;
1088  }
1089 
1091  {
1092  InfoLength = sizeof(USHORT);
1093  GenericInfo.Ushort = (NDIS_MINIPORT_MAJOR_VERSION << 8) | NDIS_MINIPORT_MINOR_VERSION;
1094  break;
1095  }
1096 
1098  {
1099  static const CHAR VendorDesc[] = "nVidia nForce Ethernet Controller";
1100  InfoPtr = (PVOID)&VendorDesc;
1101  InfoLength = sizeof(VendorDesc);
1102  break;
1103  }
1104 
1106  {
1107  GenericInfo.Ulong = Adapter->PacketFilter;
1108  break;
1109  }
1110 
1111  case OID_GEN_MAC_OPTIONS:
1112  {
1113  GenericInfo.Ulong = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA |
1116 
1117  if (Adapter->Flags & NV_PACKET_PRIORITY)
1118  GenericInfo.Ulong |= NDIS_MAC_OPTION_8021P_PRIORITY;
1119  if (Adapter->Flags & NV_VLAN_TAGGING)
1120  GenericInfo.Ulong |= NDIS_MAC_OPTION_8021Q_VLAN;
1121  break;
1122  }
1123 
1125  {
1126  GenericInfo.Ulong = Adapter->Connected ? NdisMediaStateConnected
1128  break;
1129  }
1130 
1132  {
1133  /* TODO: Multipacket sends */
1134  GenericInfo.Ulong = 1;
1135  break;
1136  }
1137 
1139  {
1140  /* 1.0.0 */
1141  GenericInfo.Ulong = 0x100;
1142  break;
1143  }
1144 
1145  case OID_GEN_XMIT_OK:
1146  case OID_GEN_RCV_OK:
1147  case OID_GEN_XMIT_ERROR:
1148  case OID_GEN_RCV_ERROR:
1149  case OID_GEN_RCV_NO_BUFFER:
1151  case OID_GEN_RCV_CRC_ERROR:
1157  case OID_802_3_RCV_OVERRUN:
1162  {
1163  if (Adapter->Features & DEV_HAS_STATISTICS_COUNTERS)
1164  {
1165  NvNetReadStatistics(Adapter);
1166  NvNetQueryHwCounter(Adapter, Oid, &GenericInfo.Ulong64);
1167  }
1168  else
1169  {
1170  NvNetQuerySoftwareCounter(Adapter, Oid, &GenericInfo.Ulong64);
1171  }
1172 
1173  *BytesNeeded = sizeof(ULONG64);
1174  if (InformationBufferLength < sizeof(ULONG))
1175  {
1176  *BytesWritten = 0;
1178  }
1179  if (InformationBufferLength >= sizeof(ULONG64))
1180  {
1181  *BytesWritten = sizeof(ULONG64);
1182  NdisMoveMemory(InformationBuffer, InfoPtr, sizeof(ULONG64));
1183  }
1184  else
1185  {
1186  *BytesWritten = sizeof(ULONG);
1187  NdisMoveMemory(InformationBuffer, InfoPtr, sizeof(ULONG));
1188  }
1189 
1190  return NDIS_STATUS_SUCCESS;
1191  }
1192 
1194  {
1195  GenericInfo.Ulong = NVNET_TRANSMIT_BLOCKS - Adapter->Send.TcbSlots;
1196  break;
1197  }
1198 
1200  {
1201  InfoPtr = Adapter->PermanentMacAddress;
1202  InfoLength = ETH_LENGTH_OF_ADDRESS;
1203  break;
1204  }
1205 
1207  {
1208  InfoPtr = Adapter->CurrentMacAddress;
1209  InfoLength = ETH_LENGTH_OF_ADDRESS;
1210  break;
1211  }
1212 
1214  {
1215  InfoPtr = Adapter->MulticastList;
1216  InfoLength = Adapter->MulticastListSize * ETH_LENGTH_OF_ADDRESS;
1217  break;
1218  }
1219 
1221  {
1222  GenericInfo.Ulong = NVNET_MULTICAST_LIST_SIZE;
1223  break;
1224  }
1225 
1226  case OID_TCP_TASK_OFFLOAD:
1227  {
1228  return NvNetGetTcpTaskOffload(Adapter,
1229  InformationBuffer,
1230  InformationBufferLength,
1231  BytesWritten,
1232  BytesWritten);
1233  }
1234 
1236  {
1237  GenericInfo.Ulong = NvNetGetWakeUp(Adapter);
1238  break;
1239  }
1240 
1241  case OID_PNP_CAPABILITIES:
1242  {
1243  InfoLength = sizeof(NDIS_PNP_CAPABILITIES);
1244 
1245  if (InformationBufferLength < InfoLength)
1246  {
1247  *BytesWritten = 0;
1248  *BytesNeeded = InfoLength;
1250  }
1251 
1252  *BytesWritten = InfoLength;
1253  *BytesNeeded = 0;
1254  return NvNetFillPowerManagementCapabilities(Adapter, InformationBuffer);
1255  }
1256 
1257  case OID_PNP_QUERY_POWER:
1258  {
1259  return NDIS_STATUS_SUCCESS;
1260  }
1261 
1262  case OID_GEN_VLAN_ID:
1263  {
1264  /* TODO: Implement software VLAN support */
1265  if (!(Adapter->Flags & NV_VLAN_TAGGING))
1266  {
1268  break;
1269  }
1270 
1271  GenericInfo.Ulong = Adapter->VlanId;
1272  break;
1273  }
1274 
1275  default:
1277  break;
1278  }
1279 
1280  if (Status == NDIS_STATUS_SUCCESS)
1281  {
1282  if (InfoLength > InformationBufferLength)
1283  {
1284  *BytesWritten = 0;
1285  *BytesNeeded = InfoLength;
1287  }
1288  else
1289  {
1290  NdisMoveMemory(InformationBuffer, InfoPtr, InfoLength);
1291  *BytesWritten = InfoLength;
1292  *BytesNeeded = 0;
1293  }
1294  }
1295  else
1296  {
1297  *BytesWritten = 0;
1298  *BytesNeeded = 0;
1299  }
1300 
1301  return Status;
1302 }
BOOLEAN Connected
Definition: nvnet.h:334
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:949
struct _NVNET_ADAPTER * PNVNET_ADAPTER
Definition: nvnet.h:259
#define NDIS_STATUS_INVALID_OID
Definition: ndis.h:488
ULONG VlanId
Definition: nvnet.h:323
static ULONG NvNetGetLinkSpeed(_In_ PNVNET_ADAPTER Adapter)
Definition: requests.c:82
enum _NDIS_HARDWARE_STATUS NDIS_HARDWARE_STATUS
#define OID_GEN_VENDOR_DRIVER_VERSION
Definition: ntddndis.h:254
enum _NDIS_MEDIUM NDIS_MEDIUM
ULONG Flags
Definition: nvnet.h:285
#define NDIS_MAC_OPTION_8021Q_VLAN
Definition: ntddndis.h:440
#define OID_GEN_VLAN_ID
Definition: ntddndis.h:260
#define OID_GEN_RECEIVE_BUFFER_SPACE
Definition: ntddndis.h:241
static VOID NvNetReadStatistics(_In_ PNVNET_ADAPTER Adapter)
Definition: requests.c:213
char CHAR
Definition: xmlstorage.h:175
#define OID_GEN_MAC_OPTIONS
Definition: ntddndis.h:251
#define NDIS_MAC_OPTION_8021P_PRIORITY
Definition: ndis.h:688
#define OID_GEN_RCV_ERROR
Definition: ntddndis.h:270
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
#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
struct _NVNET_ADAPTER::@981 MulticastList[NVNET_MULTICAST_LIST_SIZE]
#define OID_GEN_MEDIA_IN_USE
Definition: ntddndis.h:236
#define NDIS_MAC_OPTION_NO_LOOPBACK
Definition: ndis.h:685
#define NVNET_TRANSMIT_BLOCKS
Definition: nvnet.h:31
#define OID_802_3_XMIT_DEFERRED
Definition: ntddndis.h:310
static NDIS_STATUS NvNetFillPowerManagementCapabilities(_In_ PNVNET_ADAPTER Adapter, _Out_ PNDIS_PNP_CAPABILITIES Capabilities)
Definition: requests.c:413
ULONG Features
Definition: nvnet.h:284
int NDIS_STATUS
Definition: ntddndis.h:475
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
static const NDIS_OID NvpSupportedOidList[]
Definition: requests.c:17
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: ntddndis.h:305
#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND
Definition: ndis.h:684
#define NDIS_STATUS_BUFFER_TOO_SHORT
Definition: ndis.h:487
UCHAR PermanentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: nvnet.h:338
#define OID_GEN_MEDIA_CONNECT_STATUS
Definition: ntddndis.h:252
#define OID_GEN_TRANSMIT_BUFFER_SPACE
Definition: ntddndis.h:240
#define OID_GEN_MAXIMUM_LOOKAHEAD
Definition: ntddndis.h:237
#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA
Definition: ndis.h:682
#define OID_GEN_RCV_OK
Definition: ntddndis.h:268
#define OID_GEN_TRANSMIT_QUEUE_LENGTH
Definition: ntddndis.h:287
static VOID NvNetQueryHwCounter(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_OID Oid, _Out_ PULONG64 Counter)
Definition: requests.c:258
void * PVOID
Definition: retypes.h:9
static NDIS_STATUS NvNetGetTcpTaskOffload(_In_ PNVNET_ADAPTER Adapter, _In_ PNDIS_TASK_OFFLOAD_HEADER TaskOffloadHeader, _In_ ULONG InformationBufferLength, _Out_ PULONG BytesWritten, _Out_ PULONG BytesNeeded)
Definition: requests.c:780
#define OID_802_3_XMIT_HEARTBEAT_FAILURE
Definition: ntddndis.h:314
#define OID_GEN_SUPPORTED_LIST
Definition: ntddndis.h:233
#define OID_GEN_VENDOR_ID
Definition: ntddndis.h:244
Status
Definition: gdiplustypes.h:24
#define OID_GEN_VENDOR_DESCRIPTION
Definition: ntddndis.h:245
static VOID NvNetQuerySoftwareCounter(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_OID Oid, _Out_ PULONG64 Counter)
Definition: requests.c:344
#define OID_GEN_XMIT_OK
Definition: ntddndis.h:267
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: ntddndis.h:238
struct _ETH_HEADER ETH_HEADER
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: ntddndis.h:249
#define DEV_HAS_STATISTICS_COUNTERS
Definition: nic.h:45
#define OID_802_3_XMIT_UNDERRUN
Definition: ntddndis.h:313
#define OID_802_3_RCV_OVERRUN
Definition: ntddndis.h:312
#define NVNET_MULTICAST_LIST_SIZE
Definition: nvnet.h:64
static ULONG NvNetGetWakeUp(_In_ PNVNET_ADAPTER Adapter)
Definition: requests.c:761
#define OID_802_3_RCV_ERROR_ALIGNMENT
Definition: ntddndis.h:307
#define OID_GEN_DIRECTED_FRAMES_RCV
Definition: ntddndis.h:281
ULONG PacketFilter
Definition: nvnet.h:309
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
unsigned __int64 ULONG64
Definition: imports.h:198
UCHAR CurrentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: nvnet.h:339
#define OID_802_3_XMIT_ONE_COLLISION
Definition: ntddndis.h:308
#define OID_GEN_LINK_SPEED
Definition: ntddndis.h:239
#define OID_TCP_TASK_OFFLOAD
Definition: ntddndis.h:377
#define OID_802_3_XMIT_MORE_COLLISIONS
Definition: ntddndis.h:309
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: ntddndis.h:253
#define NV_PACKET_PRIORITY
Definition: nvnet.h:298
unsigned short Ushort
Definition: utypes.h:44
#define OID_GEN_MEDIA_SUPPORTED
Definition: ntddndis.h:235
unsigned short USHORT
Definition: pedump.c:61
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
Definition: wdfdevice.h:3032
#define OID_GEN_XMIT_ERROR
Definition: ntddndis.h:269
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: ntddndis.h:242
#define ETH_LENGTH_OF_ADDRESS
Definition: efilter.h:16
#define NV_VLAN_TAGGING
Definition: nvnet.h:299
struct _NDIS_PNP_CAPABILITIES NDIS_PNP_CAPABILITIES
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: ntddndis.h:243
#define NVNET_RECEIVE_DESCRIPTORS
Definition: nvnet.h:34
#define OID_802_3_XMIT_MAX_COLLISIONS
Definition: ntddndis.h:311
enum _NDIS_DEVICE_POWER_STATE NDIS_DEVICE_POWER_STATE
#define OID_PNP_QUERY_POWER
Definition: ntddndis.h:362
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
#define OID_802_3_XMIT_LATE_COLLISIONS
Definition: ntddndis.h:316
unsigned long Ulong
Definition: utypes.h:42
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
#define OID_PNP_ENABLE_WAKE_UP
Definition: ntddndis.h:366
NVNET_SEND Send
Definition: nvnet.h:310
ULONG MaximumFrameSize
Definition: nvnet.h:321
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
#define OID_GEN_DRIVER_VERSION
Definition: ntddndis.h:248
#define OID_802_3_XMIT_TIMES_CRS_LOST
Definition: ntddndis.h:315
#define OID_GEN_RCV_NO_BUFFER
Definition: ntddndis.h:271
ULONG TcbSlots
Definition: nvnet.h:246

◆ MiniportSetInformation()

NDIS_STATUS NTAPI MiniportSetInformation ( _In_ NDIS_HANDLE  MiniportAdapterContext,
_In_ NDIS_OID  Oid,
_In_ PVOID  InformationBuffer,
_In_ ULONG  InformationBufferLength,
_Out_ PULONG  BytesRead,
_Out_ PULONG  BytesNeeded 
)

Definition at line 1306 of file requests.c.

1313 {
1314  PNVNET_ADAPTER Adapter = (PNVNET_ADAPTER)MiniportAdapterContext;
1316  ULONG GenericUlong;
1317 
1318  *BytesRead = 0;
1319  *BytesNeeded = 0;
1320 
1321  switch (Oid)
1322  {
1324  {
1325  if (InformationBufferLength % ETH_LENGTH_OF_ADDRESS)
1326  {
1327  *BytesNeeded = (InformationBufferLength / ETH_LENGTH_OF_ADDRESS) *
1330  break;
1331  }
1332 
1333  if (InformationBufferLength > sizeof(Adapter->MulticastList))
1334  {
1335  *BytesNeeded = sizeof(Adapter->MulticastList);
1337  break;
1338  }
1339 
1340  *BytesRead = InformationBufferLength;
1341  NdisMoveMemory(Adapter->MulticastList, InformationBuffer, InformationBufferLength);
1342 
1343  Adapter->MulticastListSize = InformationBufferLength / ETH_LENGTH_OF_ADDRESS;
1344 
1345  NvNetApplyPacketFilter(Adapter);
1346  break;
1347  }
1348 
1350  {
1351  if (InformationBufferLength < sizeof(ULONG))
1352  {
1353  *BytesNeeded = sizeof(ULONG);
1355  break;
1356  }
1357 
1358  *BytesRead = sizeof(ULONG);
1359  NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
1360 
1361  if (GenericUlong & ~NVNET_PACKET_FILTERS)
1362  {
1364  break;
1365  }
1366 
1367  /* Do not check to see if the filter is the same filter */
1368  Adapter->PacketFilter = GenericUlong;
1369 
1370  NvNetApplyPacketFilter(Adapter);
1371  break;
1372  }
1373 
1375  {
1376  if (InformationBufferLength < sizeof(ULONG))
1377  {
1378  *BytesNeeded = sizeof(ULONG);
1380  break;
1381  }
1382 
1383  /* Nothing to do */
1384  *BytesRead = sizeof(ULONG);
1385  break;
1386  }
1387 
1388  case OID_GEN_VLAN_ID:
1389  {
1390  if (InformationBufferLength < sizeof(ULONG))
1391  {
1392  *BytesNeeded = sizeof(ULONG);
1394  break;
1395  }
1396 
1397  if (!(Adapter->Flags & NV_VLAN_TAGGING))
1398  {
1400  break;
1401  }
1402 
1403  *BytesRead = sizeof(ULONG);
1404  NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
1405 
1406  if (GenericUlong > NVNET_MAXIMUM_VLAN_ID)
1407  {
1409  break;
1410  }
1411 
1412  Adapter->VlanId = GenericUlong;
1413  break;
1414  }
1415 
1416  case OID_TCP_TASK_OFFLOAD:
1417  {
1418  if (InformationBufferLength < sizeof(NDIS_TASK_OFFLOAD_HEADER))
1419  {
1420  *BytesNeeded = sizeof(NDIS_TASK_OFFLOAD_HEADER);
1422  break;
1423  }
1424 
1425  *BytesRead = InformationBufferLength;
1426 
1427  Status = NvNetSetTcpTaskOffload(Adapter, InformationBuffer, BytesRead);
1428  break;
1429  }
1430 
1432  {
1433  if (InformationBufferLength < sizeof(NDIS_PM_PACKET_PATTERN))
1434  {
1435  *BytesNeeded = sizeof(NDIS_PM_PACKET_PATTERN);
1437  break;
1438  }
1439 
1440  *BytesRead = sizeof(NDIS_PM_PACKET_PATTERN);
1441 
1442  Status = NvNetAddWakeUpPattern(Adapter, InformationBuffer);
1443  break;
1444  }
1445 
1447  {
1448  if (InformationBufferLength < sizeof(NDIS_PM_PACKET_PATTERN))
1449  {
1450  *BytesNeeded = sizeof(NDIS_PM_PACKET_PATTERN);
1452  break;
1453  }
1454 
1455  *BytesRead = sizeof(NDIS_PM_PACKET_PATTERN);
1456 
1457  Status = NvNetRemoveWakeUpPattern(Adapter, InformationBuffer);
1458  break;
1459  }
1460 
1462  {
1463  if (InformationBufferLength < sizeof(ULONG))
1464  {
1465  *BytesNeeded = sizeof(ULONG);
1467  break;
1468  }
1469 
1470  *BytesRead = sizeof(ULONG);
1471  NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
1472 
1473  NvNetEnableWakeUp(Adapter, GenericUlong);
1474  break;
1475  }
1476 
1477  case OID_PNP_SET_POWER:
1478  {
1479  if (InformationBufferLength < sizeof(NDIS_DEVICE_POWER_STATE))
1480  {
1481  *BytesNeeded = sizeof(NDIS_DEVICE_POWER_STATE);
1483  break;
1484  }
1485 
1486  *BytesRead = sizeof(ULONG);
1487  NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
1488 
1489  if (GenericUlong < NdisDeviceStateD0 || GenericUlong > NdisDeviceStateD3)
1490  {
1492  break;
1493  }
1494 
1495  Status = NvNetSetPower(Adapter, GenericUlong);
1496  break;
1497  }
1498 
1499  default:
1501  break;
1502  }
1503 
1504  return Status;
1505 }
struct _NVNET_ADAPTER * PNVNET_ADAPTER
Definition: nvnet.h:259
ULONG VlanId
Definition: nvnet.h:323
static NDIS_STATUS NvNetRemoveWakeUpPattern(_In_ PNVNET_ADAPTER Adapter, _In_ PNDIS_PM_PACKET_PATTERN Pattern)
Definition: requests.c:721
static NDIS_STATUS NvNetSetTcpTaskOffload(_Inout_ PNVNET_ADAPTER Adapter, _In_ PNDIS_TASK_OFFLOAD_HEADER TaskOffloadHeader, _In_ PULONG BytesRead)
Definition: requests.c:888
ULONG Flags
Definition: nvnet.h:285
#define OID_GEN_VLAN_ID
Definition: ntddndis.h:260
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
struct _NVNET_ADAPTER::@981 MulticastList[NVNET_MULTICAST_LIST_SIZE]
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:859
int NDIS_STATUS
Definition: ntddndis.h:475
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define NVNET_MAXIMUM_VLAN_ID
Definition: nvnet.h:62
static VOID NvNetEnableWakeUp(_In_ PNVNET_ADAPTER Adapter, _In_ ULONG Flags)
Definition: requests.c:771
static DECLSPEC_NOINLINE VOID NvNetApplyPacketFilter(_In_ PNVNET_ADAPTER Adapter)
Definition: requests.c:130
#define NDIS_STATUS_INVALID_LENGTH
Definition: ndis.h:485
#define NDIS_STATUS_INVALID_DATA
Definition: ndis.h:486
#define NDIS_STATUS_MULTICAST_FULL
Definition: ndis.h:473
Status
Definition: gdiplustypes.h:24
#define OID_PNP_ADD_WAKE_UP_PATTERN
Definition: ntddndis.h:363
static NDIS_STATUS NvNetSetPower(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_DEVICE_POWER_STATE NewPowerState)
Definition: requests.c:646
ULONG PacketFilter
Definition: nvnet.h:309
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NVNET_PACKET_FILTERS
Definition: nvnet.h:69
#define OID_TCP_TASK_OFFLOAD
Definition: ntddndis.h:377
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
#define OID_PNP_REMOVE_WAKE_UP_PATTERN
Definition: ntddndis.h:364
#define ETH_LENGTH_OF_ADDRESS
Definition: efilter.h:16
#define OID_PNP_SET_POWER
Definition: ntddndis.h:361
#define NV_VLAN_TAGGING
Definition: nvnet.h:299
struct _NDIS_PM_PACKET_PATTERN NDIS_PM_PACKET_PATTERN
enum _NDIS_DEVICE_POWER_STATE NDIS_DEVICE_POWER_STATE
unsigned int ULONG
Definition: retypes.h:1
struct _NDIS_TASK_OFFLOAD_HEADER NDIS_TASK_OFFLOAD_HEADER
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
#define OID_PNP_ENABLE_WAKE_UP
Definition: ntddndis.h:366
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
static NDIS_STATUS NvNetAddWakeUpPattern(_In_ PNVNET_ADAPTER Adapter, _In_ PNDIS_PM_PACKET_PATTERN Pattern)
Definition: requests.c:660
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247

◆ NvEqualMemory()

static BOOLEAN NvEqualMemory ( _In_reads_bytes_(Length) PVOID  Destination,
_In_reads_bytes_(Length) PVOID  Source,
_In_ ULONG  Length 
)
static

Definition at line 697 of file requests.c.

701 {
702  ULONG i;
703  PUCHAR Src, Dest;
704 
705  Src = Source;
706  Dest = Destination;
707  for (i = 0; i < Length; ++i)
708  {
709  if (Src[i] != Dest[i])
710  return FALSE;
711  }
712 
713  return TRUE;
714 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
#define FALSE
Definition: types.h:117
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2977
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
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167

◆ NvNetAddWakeUpPattern()

static NDIS_STATUS NvNetAddWakeUpPattern ( _In_ PNVNET_ADAPTER  Adapter,
_In_ PNDIS_PM_PACKET_PATTERN  Pattern 
)
static

Definition at line 660 of file requests.c.

663 {
664  ULONG FrameNumber;
666  PNVNET_WAKE_FRAME WakeFrame;
667 
668  if (!_BitScanForward(&FrameNumber, Adapter->WakeFrameBitmap))
669  {
670  return NDIS_STATUS_RESOURCES;
671  }
672 
673  Status = NdisAllocateMemoryWithTag((PVOID*)&WakeFrame, sizeof(*WakeFrame), NVNET_TAG);
675  {
676  return NDIS_STATUS_RESOURCES;
677  }
678 
679  Adapter->WakeFrameBitmap &= ~(1 << FrameNumber);
680 
681  NdisZeroMemory(WakeFrame, sizeof(*WakeFrame));
682  NdisMoveMemory(&WakeFrame->PatternMask,
683  (PUCHAR)Pattern + sizeof(NDIS_PM_PACKET_PATTERN),
684  min(Pattern->MaskSize, 16));
685  NdisMoveMemory(&WakeFrame->WakeUpPattern,
686  (PUCHAR)Pattern + Pattern->PatternOffset,
687  min(Pattern->PatternSize, 128));
688  Adapter->WakeFrames[FrameNumber] = WakeFrame;
689 
690  /* TODO: VLAN frame translation */
691 
692  return NDIS_STATUS_SUCCESS;
693 }
unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask)
Definition: intrin_arm.h:57
NDIS_STATUS EXPORT NdisAllocateMemoryWithTag(OUT PVOID *VirtualAddress, IN UINT Length, IN ULONG Tag)
Definition: memory.c:21
unsigned char * PUCHAR
Definition: retypes.h:3
#define NVNET_TAG
Definition: nvnet.h:22
int NDIS_STATUS
Definition: ntddndis.h:475
Status
Definition: gdiplustypes.h:24
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define min(a, b)
Definition: monoChain.cc:55
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
unsigned int ULONG
Definition: retypes.h:1
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896

Referenced by MiniportSetInformation().

◆ NvNetApplyPacketFilter()

static DECLSPEC_NOINLINE VOID NvNetApplyPacketFilter ( _In_ PNVNET_ADAPTER  Adapter)
static

Definition at line 130 of file requests.c.

132 {
135  ULONG FilterMask;
136  BOOLEAN RestartReceiver;
137 
138  if (Adapter->PacketFilter & NDIS_PACKET_TYPE_ALL_MULTICAST)
139  {
140  NdisZeroMemory(Address, sizeof(Address));
141  NdisZeroMemory(Mask, sizeof(Mask));
142 
145  }
146  else if (Adapter->PacketFilter & NDIS_PACKET_TYPE_MULTICAST)
147  {
148  if (Adapter->MulticastListSize > 0)
149  {
150  ULONG i, j;
151 
152  NdisFillMemory(Address, sizeof(Address), 0xFF);
153  NdisFillMemory(Mask, sizeof(Mask), 0xFF);
154 
155  for (i = 0; i < Adapter->MulticastListSize; ++i)
156  {
157  PUCHAR MacAddress = Adapter->MulticastList[i].MacAddress;
158 
159  for (j = 0; j < ETH_LENGTH_OF_ADDRESS; ++j)
160  {
161  Address[j] &= MacAddress[j];
162  Mask[j] &= ~MacAddress[j];
163  }
164  }
165 
166  for (j = 0; j < ETH_LENGTH_OF_ADDRESS; ++j)
167  {
168  Mask[j] |= Address[j];
169  }
170  }
171  else
172  {
173  NdisZeroMemory(Address, sizeof(Address));
174  NdisZeroMemory(Mask, sizeof(Mask));
175  }
176  }
177  else
178  {
179  NdisZeroMemory(Address, sizeof(Address));
180  NdisFillMemory(Mask, sizeof(Mask), 0xFF);
181  }
182 
183  FilterMask = NV_READ(Adapter, NvRegPacketFilterFlags) & NVREG_PFF_PAUSE_RX;
184  FilterMask |= PacketFilterToMask(Adapter->PacketFilter);
185 
186  NdisAcquireSpinLock(&Adapter->Receive.Lock);
187 
188  RestartReceiver = !!(NV_READ(Adapter, NvRegReceiverControl) & NVREG_RCVCTL_START);
189  if (RestartReceiver)
190  {
191  NvNetStopReceiver(Adapter);
192  }
193 
194  NV_WRITE(Adapter, NvRegMulticastAddrA,
195  Address[3] << 24 | Address[2] << 16 | Address[1] << 8 | Address[0]);
196  NV_WRITE(Adapter, NvRegMulticastAddrB, Address[5] << 8 | Address[4]);
197  NV_WRITE(Adapter, NvRegMulticastMaskA,
198  Mask[3] << 24 | Mask[2] << 16 | Mask[1] << 8 | Mask[0]);
199  NV_WRITE(Adapter, NvRegMulticastMaskB, Mask[5] << 8 | Mask[4]);
200 
201  NV_WRITE(Adapter, NvRegPacketFilterFlags, FilterMask);
202 
203  if (RestartReceiver)
204  {
205  NvNetStartReceiver(Adapter);
206  }
207 
208  NdisReleaseSpinLock(&Adapter->Receive.Lock);
209 }
#define NVREG_MCASTADDRA_FORCE
Definition: nic.h:156
VOID NvNetStartReceiver(_In_ PNVNET_ADAPTER Adapter)
Definition: nic.c:104
VOID EXPORT NdisReleaseSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:239
unsigned char * PUCHAR
Definition: retypes.h:3
VOID NvNetStopReceiver(_In_ PNVNET_ADAPTER Adapter)
Definition: nic.c:147
unsigned char BOOLEAN
static WCHAR Address[46]
Definition: ping.c:68
FORCEINLINE VOID NV_WRITE(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register, _In_ ULONG Value)
Definition: nvnet.h:646
#define NdisFillMemory(Destination, Length, Fill)
Definition: ndis.h:3886
#define NDIS_PACKET_TYPE_ALL_MULTICAST
Definition: ndis.h:665
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 GLint GLint j
Definition: glfuncs.h:250
unsigned int Mask
Definition: fpcontrol.c:82
VOID EXPORT NdisAcquireSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:135
#define NVREG_PFF_PAUSE_RX
Definition: nic.h:115
#define NDIS_PACKET_TYPE_MULTICAST
Definition: ndis.h:664
unsigned char UCHAR
Definition: xmlstorage.h:181
static ULONG PacketFilterToMask(_In_ ULONG PacketFilter)
Definition: requests.c:109
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
#define NVREG_RCVCTL_START
Definition: nic.h:126
#define ETH_LENGTH_OF_ADDRESS
Definition: efilter.h:16
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
unsigned int ULONG
Definition: retypes.h:1
FORCEINLINE ULONG NV_READ(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register)
Definition: nvnet.h:656

Referenced by MiniportSetInformation(), and NvNetPowerWorker().

◆ NvNetEnableWakeUp()

static VOID NvNetEnableWakeUp ( _In_ PNVNET_ADAPTER  Adapter,
_In_ ULONG  Flags 
)
static

Definition at line 771 of file requests.c.

774 {
775  Adapter->WakeFlags = Flags;
776 }
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by MiniportSetInformation().

◆ NvNetFillPowerManagementCapabilities()

static NDIS_STATUS NvNetFillPowerManagementCapabilities ( _In_ PNVNET_ADAPTER  Adapter,
_Out_ PNDIS_PNP_CAPABILITIES  Capabilities 
)
static

Definition at line 413 of file requests.c.

416 {
417  Capabilities->WakeUpCapabilities.MinMagicPacketWakeUp =
418  Capabilities->WakeUpCapabilities.MinPatternWakeUp =
419  Capabilities->WakeUpCapabilities.MinLinkChangeWakeUp = NdisDeviceStateD3;
420 
421  /* All hardware is PM-aware */
422  return NDIS_STATUS_SUCCESS;
423 }
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346

Referenced by MiniportQueryInformation().

◆ NvNetGetLinkSpeed()

static ULONG NvNetGetLinkSpeed ( _In_ PNVNET_ADAPTER  Adapter)
static

Definition at line 82 of file requests.c.

84 {
85  ULONG LinkSpeedMbps;
86 
87  switch (Adapter->LinkSpeed)
88  {
89  case NVREG_LINKSPEED_10:
90  LinkSpeedMbps = 10;
91  break;
93  LinkSpeedMbps = 100;
94  break;
96  LinkSpeedMbps = 1000;
97  break;
98 
99  default:
100  UNREACHABLE;
101  break;
102  }
103 
104  return LinkSpeedMbps;
105 }
#define NVREG_LINKSPEED_100
Definition: nic.h:189
#define NVREG_LINKSPEED_1000
Definition: nic.h:190
unsigned int ULONG
Definition: retypes.h:1
#define UNREACHABLE
#define NVREG_LINKSPEED_10
Definition: nic.h:188

Referenced by MiniportQueryInformation().

◆ NvNetGetTcpTaskOffload()

static NDIS_STATUS NvNetGetTcpTaskOffload ( _In_ PNVNET_ADAPTER  Adapter,
_In_ PNDIS_TASK_OFFLOAD_HEADER  TaskOffloadHeader,
_In_ ULONG  InformationBufferLength,
_Out_ PULONG  BytesWritten,
_Out_ PULONG  BytesNeeded 
)
static

Definition at line 780 of file requests.c.

786 {
787  ULONG InfoLength;
788  PNDIS_TASK_OFFLOAD TaskOffload;
789 
790  if (!(Adapter->Flags & (NV_SEND_CHECKSUM | NV_SEND_LARGE_SEND)))
791  {
792  *BytesWritten = 0;
793  *BytesNeeded = 0;
795  }
796 
797  InfoLength = sizeof(NDIS_TASK_OFFLOAD_HEADER);
798  if (Adapter->Flags & NV_SEND_CHECKSUM)
799  {
800  InfoLength += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer) +
802  }
803  if (Adapter->Flags & NV_SEND_LARGE_SEND)
804  {
805  InfoLength += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer) +
806  sizeof(NDIS_TASK_TCP_LARGE_SEND);
807  }
808 
809  if (InformationBufferLength < InfoLength)
810  {
811  *BytesWritten = 0;
812  *BytesNeeded = InfoLength;
814  }
815 
816  if ((TaskOffloadHeader->EncapsulationFormat.Encapsulation != IEEE_802_3_Encapsulation) &&
817  (TaskOffloadHeader->EncapsulationFormat.Encapsulation != UNSPECIFIED_Encapsulation ||
818  TaskOffloadHeader->EncapsulationFormat.EncapsulationHeaderSize != sizeof(ETH_HEADER)))
819  {
820  *BytesWritten = 0;
821  *BytesNeeded = 0;
823  }
824  if (TaskOffloadHeader->Version != NDIS_TASK_OFFLOAD_VERSION)
825  {
826  *BytesWritten = 0;
827  *BytesNeeded = 0;
829  }
830 
831  TaskOffloadHeader->OffsetFirstTask = sizeof(NDIS_TASK_OFFLOAD_HEADER);
832  TaskOffload = (PNDIS_TASK_OFFLOAD)(TaskOffloadHeader + 1);
833  if (Adapter->Flags & NV_SEND_CHECKSUM)
834  {
835  PNDIS_TASK_TCP_IP_CHECKSUM ChecksumTask;
836 
837  TaskOffload->Size = sizeof(NDIS_TASK_OFFLOAD);
838  TaskOffload->Version = NDIS_TASK_OFFLOAD_VERSION;
839  TaskOffload->Task = TcpIpChecksumNdisTask;
840  TaskOffload->TaskBufferLength = sizeof(NDIS_TASK_TCP_IP_CHECKSUM);
841  TaskOffload->OffsetNextTask = FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer) +
843 
844  ChecksumTask = (PNDIS_TASK_TCP_IP_CHECKSUM)TaskOffload->TaskBuffer;
845  NdisZeroMemory(ChecksumTask, sizeof(*ChecksumTask));
846 
847  ChecksumTask->V4Transmit.IpOptionsSupported = 1;
848  ChecksumTask->V4Transmit.TcpOptionsSupported = 1;
849  ChecksumTask->V4Transmit.TcpChecksum = 1;
850  ChecksumTask->V4Transmit.UdpChecksum = 1;
851  ChecksumTask->V4Transmit.IpChecksum = 1;
852 
853  ChecksumTask->V4Receive.IpOptionsSupported = 1;
854  ChecksumTask->V4Receive.TcpOptionsSupported = 1;
855  ChecksumTask->V4Receive.TcpChecksum = 1;
856  ChecksumTask->V4Receive.UdpChecksum = 1;
857  ChecksumTask->V4Receive.IpChecksum = 1;
858 
859  TaskOffload = (PNDIS_TASK_OFFLOAD)(ChecksumTask + 1);
860  }
861  if (Adapter->Flags & NV_SEND_LARGE_SEND)
862  {
863  PNDIS_TASK_TCP_LARGE_SEND LargeSendTask;
864 
865  TaskOffload->Size = sizeof(NDIS_TASK_OFFLOAD);
866  TaskOffload->Version = NDIS_TASK_OFFLOAD_VERSION;
867  TaskOffload->Task = TcpLargeSendNdisTask;
868  TaskOffload->TaskBufferLength = sizeof(NDIS_TASK_TCP_LARGE_SEND);
869  TaskOffload->OffsetNextTask = 0;
870 
871  LargeSendTask = (PNDIS_TASK_TCP_LARGE_SEND)TaskOffload->TaskBuffer;
872  LargeSendTask->Version = NDIS_TASK_TCP_LARGE_SEND_V0;
875  LargeSendTask->IpOptions = TRUE;
876  LargeSendTask->TcpOptions = TRUE;
877  }
878  TaskOffload->OffsetNextTask = 0;
879 
880  *BytesWritten = InfoLength;
881  *BytesNeeded = 0;
882 
883  return NDIS_STATUS_SUCCESS;
884 }
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:949
#define NV_SEND_LARGE_SEND
Definition: nvnet.h:288
struct _NDIS_TASK_OFFLOAD NDIS_TASK_OFFLOAD
struct _NDIS_TASK_TCP_LARGE_SEND NDIS_TASK_TCP_LARGE_SEND
#define TRUE
Definition: types.h:120
struct _NDIS_TASK_TCP_IP_CHECKSUM NDIS_TASK_TCP_IP_CHECKSUM
#define NVNET_MAXIMUM_LSO_FRAME_SIZE
Definition: nvnet.h:67
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define NDIS_STATUS_BUFFER_TOO_SHORT
Definition: ndis.h:487
struct _NDIS_TASK_OFFLOAD * PNDIS_TASK_OFFLOAD
struct _NDIS_TASK_TCP_IP_CHECKSUM::@2061 V4Receive
struct _NDIS_TASK_TCP_IP_CHECKSUM::@2060 V4Transmit
#define NDIS_TASK_TCP_LARGE_SEND_V0
Definition: ndis.h:1270
#define NV_SEND_CHECKSUM
Definition: nvnet.h:287
struct _ETH_HEADER ETH_HEADER
ULONG TaskBufferLength
Definition: ndis.h:1237
struct _NDIS_TASK_TCP_LARGE_SEND * PNDIS_TASK_TCP_LARGE_SEND
#define NVNET_MINIMUM_LSO_SEGMENT_COUNT
Definition: nvnet.h:66
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NDIS_TASK_OFFLOAD_VERSION
Definition: ndis.h:1388
struct _NDIS_TASK_TCP_IP_CHECKSUM * PNDIS_TASK_TCP_IP_CHECKSUM
ULONG OffsetNextTask
Definition: ndis.h:1236
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
unsigned int ULONG
Definition: retypes.h:1
struct _NDIS_TASK_OFFLOAD_HEADER NDIS_TASK_OFFLOAD_HEADER
NDIS_TASK Task
Definition: ndis.h:1235
UCHAR TaskBuffer[1]
Definition: ndis.h:1238

Referenced by MiniportQueryInformation().

◆ NvNetGetWakeUp()

static ULONG NvNetGetWakeUp ( _In_ PNVNET_ADAPTER  Adapter)
static

Definition at line 761 of file requests.c.

763 {
764  return Adapter->WakeFlags & (NDIS_PNP_WAKE_UP_MAGIC_PACKET |
767 }
#define NDIS_PNP_WAKE_UP_MAGIC_PACKET
Definition: ntddndis.h:372
#define NDIS_PNP_WAKE_UP_PATTERN_MATCH
Definition: ntddndis.h:373
#define NDIS_PNP_WAKE_UP_LINK_CHANGE
Definition: ntddndis.h:374

Referenced by MiniportQueryInformation().

◆ NvNetPowerWorker()

static VOID NTAPI NvNetPowerWorker ( _In_ PNDIS_WORK_ITEM  WorkItem,
_In_opt_ PVOID  Context 
)
static

Definition at line 603 of file requests.c.

606 {
607  PNVNET_ADAPTER Adapter = Context;
608 
610 
611  PAGED_CODE();
612 
613  if (Adapter->PowerStatePending == NdisDeviceStateD0)
614  {
616 
618 
619  NvNetStartAdapter(Adapter);
620 
621  NvNetApplyPacketFilter(Adapter);
622  }
623  else
624  {
625  NvNetPauseProcessing(Adapter);
626 
627  NvNetStopAdapter(Adapter);
628 
629  NvNetIdleTransmitter(Adapter, FALSE);
630  NvNetStopTransmitter(Adapter);
631  NvNetStopReceiver(Adapter);
632  NV_WRITE(Adapter, NvRegTxRxControl,
635 
637 
638  NvNetSetPowerState(Adapter, Adapter->PowerStatePending, Adapter->WakeFlags);
639  }
640 
642 }
VOID EXPORT NdisMSetInformationComplete(IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_STATUS Status)
Definition: miniport.c:1187
#define NVREG_TXRXCTL_BIT2
Definition: nic.h:204
NDIS_STATUS NvNetInitNIC(_In_ PNVNET_ADAPTER Adapter, _In_ BOOLEAN InitPhy)
Definition: nic.c:401
ULONG TxRxControl
Definition: nvnet.h:301
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define NT_VERIFY(exp)
Definition: rtlfuncs.h:3287
VOID NvNetStopReceiver(_In_ PNVNET_ADAPTER Adapter)
Definition: nic.c:147
#define FALSE
Definition: types.h:117
ULONG WakeFlags
Definition: nvnet.h:324
static DECLSPEC_NOINLINE VOID NvNetApplyPacketFilter(_In_ PNVNET_ADAPTER Adapter)
Definition: requests.c:130
ULONG PowerStatePending
Definition: nvnet.h:329
FORCEINLINE VOID NV_WRITE(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register, _In_ ULONG Value)
Definition: nvnet.h:646
VOID NvNetStopTransmitter(_In_ PNVNET_ADAPTER Adapter)
Definition: nic.c:178
VOID NvNetIdleTransmitter(_In_ PNVNET_ADAPTER Adapter, _In_ BOOLEAN ClearPhyControl)
Definition: nic.c:211
#define NVREG_TXRXCTL_RESET
Definition: nic.h:206
VOID NvNetStartAdapter(_In_ PNVNET_ADAPTER Adapter)
Definition: nvnet.c:74
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
VOID NvNetStopAdapter(_In_ PNVNET_ADAPTER Adapter)
Definition: nvnet.c:58
NDIS_HANDLE AdapterHandle
Definition: nvnet.h:283
DECLSPEC_NOINLINE VOID NvNetPauseProcessing(_In_ PNVNET_ADAPTER Adapter)
Definition: nvnet.c:46
VOID NvNetFlushTransmitQueue(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_STATUS CompleteStatus)
Definition: nvnet.c:24
VOID NvNetSetPowerState(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_DEVICE_POWER_STATE NewPowerState, _In_ ULONG WakeFlags)
Definition: requests.c:500
#define NV_TXRX_RESET_DELAY
Definition: nic.h:445
struct tagContext Context
Definition: acpixf.h:1034
#define NdisStallExecution
Definition: ndis.h:4453
_Must_inspect_result_ _In_ PWDF_WORKITEM_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWORKITEM * WorkItem
Definition: wdfworkitem.h:110
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
#define PAGED_CODE()

Referenced by NvNetSetPower().

◆ NvNetQueryHwCounter()

static VOID NvNetQueryHwCounter ( _In_ PNVNET_ADAPTER  Adapter,
_In_ NDIS_OID  Oid,
_Out_ PULONG64  Counter 
)
static

Definition at line 258 of file requests.c.

262 {
263  switch (Oid)
264  {
265  case OID_GEN_XMIT_OK:
266  *Counter = (Adapter->Features & DEV_HAS_STATISTICS_V2)
267  ? Adapter->Statistics.HwTxFrame
268  : (Adapter->Statistics.HwTxZeroReXmt +
269  Adapter->Statistics.HwTxOneReXmt +
270  Adapter->Statistics.HwTxManyReXmt);
271  break;
272  case OID_GEN_RCV_OK:
273  *Counter = (Adapter->Statistics.HwRxUnicast +
274  Adapter->Statistics.HwRxMulticast +
275  Adapter->Statistics.HwRxBroadcast);
276  break;
277  case OID_GEN_XMIT_ERROR:
278  *Counter = (Adapter->Statistics.HwTxRetryErr +
279  Adapter->Statistics.HwTxLateCol +
280  Adapter->Statistics.HwTxUnderflow +
281  Adapter->Statistics.HwTxLossCarrier +
282  Adapter->Statistics.HwTxExcessDef);
283  break;
284  case OID_GEN_RCV_ERROR:
285  *Counter = (Adapter->Statistics.HwRxFrameAlignErr +
286  Adapter->Statistics.HwRxLenErr +
287  Adapter->Statistics.HwRxRunt +
288  Adapter->Statistics.HwRxFrameTooLong +
289  Adapter->Statistics.HwRxFCSErr +
290  Adapter->Statistics.HwRxFrameErr +
291  Adapter->Statistics.HwRxExtraByte +
292  Adapter->Statistics.HwRxLateCol);
293  break;
295  *Counter = (Adapter->Statistics.HwRxDropFrame +
296  Adapter->Statistics.HwRxOverflow +
297  Adapter->Statistics.ReceiveIrqNoBuffers);
298  break;
300  *Counter = Adapter->Statistics.HwRxUnicast;
301  break;
303  *Counter = Adapter->Statistics.HwRxFCSErr;
304  break;
306  *Counter = Adapter->Statistics.HwRxFrameErr;
307  break;
309  *Counter = Adapter->Statistics.HwTxOneReXmt;
310  break;
312  *Counter = Adapter->Statistics.HwTxManyReXmt;
313  break;
315  *Counter = Adapter->Statistics.HwTxDef;
316  break;
318  *Counter = Adapter->Statistics.HwTxRetryErr;
319  break;
321  *Counter = Adapter->Statistics.HwRxOverflow;
322  break;
324  *Counter = Adapter->Statistics.HwTxUnderflow;
325  break;
327  *Counter = Adapter->Statistics.HwTxZeroReXmt;
328  break;
330  *Counter = Adapter->Statistics.HwTxLossCarrier;
331  break;
333  *Counter = Adapter->Statistics.HwTxLateCol;
334  break;
335 
336  default:
337  UNREACHABLE;
338  break;
339  }
340 }
#define OID_GEN_RCV_ERROR
Definition: ntddndis.h:270
#define OID_GEN_RCV_CRC_ERROR
Definition: ntddndis.h:286
#define OID_802_3_XMIT_DEFERRED
Definition: ntddndis.h:310
#define OID_GEN_RCV_OK
Definition: ntddndis.h:268
#define OID_802_3_XMIT_HEARTBEAT_FAILURE
Definition: ntddndis.h:314
#define OID_GEN_XMIT_OK
Definition: ntddndis.h:267
#define OID_802_3_XMIT_UNDERRUN
Definition: ntddndis.h:313
#define OID_802_3_RCV_OVERRUN
Definition: ntddndis.h:312
#define OID_802_3_RCV_ERROR_ALIGNMENT
Definition: ntddndis.h:307
#define OID_GEN_DIRECTED_FRAMES_RCV
Definition: ntddndis.h:281
#define DEV_HAS_STATISTICS_V2
Definition: nic.h:29
#define OID_802_3_XMIT_ONE_COLLISION
Definition: ntddndis.h:308
#define OID_802_3_XMIT_MORE_COLLISIONS
Definition: ntddndis.h:309
#define OID_GEN_XMIT_ERROR
Definition: ntddndis.h:269
static LARGE_INTEGER Counter
Definition: clock.c:43
#define OID_802_3_XMIT_MAX_COLLISIONS
Definition: ntddndis.h:311
#define UNREACHABLE
#define OID_802_3_XMIT_LATE_COLLISIONS
Definition: ntddndis.h:316
#define OID_802_3_XMIT_TIMES_CRS_LOST
Definition: ntddndis.h:315
#define OID_GEN_RCV_NO_BUFFER
Definition: ntddndis.h:271

Referenced by MiniportQueryInformation().

◆ NvNetQuerySoftwareCounter()

static VOID NvNetQuerySoftwareCounter ( _In_ PNVNET_ADAPTER  Adapter,
_In_ NDIS_OID  Oid,
_Out_ PULONG64  Counter 
)
static

Definition at line 344 of file requests.c.

348 {
349  switch (Oid)
350  {
351  case OID_GEN_XMIT_OK:
352  *Counter = Adapter->Statistics.TransmitOk;
353  break;
354  case OID_GEN_RCV_OK:
355  *Counter = Adapter->Statistics.ReceiveOk;
356  break;
357  case OID_GEN_XMIT_ERROR:
358  *Counter = Adapter->Statistics.TransmitErrors;
359  break;
360  case OID_GEN_RCV_ERROR:
361  *Counter = Adapter->Statistics.ReceiveErrors;
362  break;
364  *Counter = Adapter->Statistics.ReceiveNoBuffers;
365  break;
367  *Counter = 0;
368  break;
370  *Counter = Adapter->Statistics.ReceiveCrcErrors;
371  break;
373  *Counter = Adapter->Statistics.ReceiveAlignmentErrors;
374  break;
376  *Counter = Adapter->Statistics.TransmitOneRetry;
377  break;
379  *Counter = (Adapter->Statistics.TransmitOk -
380  Adapter->Statistics.TransmitOneRetry -
381  Adapter->Statistics.TransmitZeroRetry);
382  break;
384  *Counter = Adapter->Statistics.TransmitDeferred;
385  break;
387  *Counter = Adapter->Statistics.TransmitExcessiveCollisions;
388  break;
390  *Counter = Adapter->Statistics.ReceiveOverrunErrors;
391  break;
393  *Counter = Adapter->Statistics.TransmitUnderrunErrors;
394  break;
396  *Counter = Adapter->Statistics.TransmitZeroRetry;
397  break;
399  *Counter = Adapter->Statistics.TransmitLostCarrierSense;
400  break;
402  *Counter = Adapter->Statistics.TransmitLateCollisions;
403  break;
404 
405  default:
406  UNREACHABLE;
407  break;
408  }
409 }
#define OID_GEN_RCV_ERROR
Definition: ntddndis.h:270
#define OID_GEN_RCV_CRC_ERROR
Definition: ntddndis.h:286
#define OID_802_3_XMIT_DEFERRED
Definition: ntddndis.h:310
#define OID_GEN_RCV_OK
Definition: ntddndis.h:268
#define OID_802_3_XMIT_HEARTBEAT_FAILURE
Definition: ntddndis.h:314
#define OID_GEN_XMIT_OK
Definition: ntddndis.h:267
#define OID_802_3_XMIT_UNDERRUN
Definition: ntddndis.h:313
#define OID_802_3_RCV_OVERRUN
Definition: ntddndis.h:312
#define OID_802_3_RCV_ERROR_ALIGNMENT
Definition: ntddndis.h:307
#define OID_GEN_DIRECTED_FRAMES_RCV
Definition: ntddndis.h:281
#define OID_802_3_XMIT_ONE_COLLISION
Definition: ntddndis.h:308
#define OID_802_3_XMIT_MORE_COLLISIONS
Definition: ntddndis.h:309
#define OID_GEN_XMIT_ERROR
Definition: ntddndis.h:269
static LARGE_INTEGER Counter
Definition: clock.c:43
#define OID_802_3_XMIT_MAX_COLLISIONS
Definition: ntddndis.h:311
#define UNREACHABLE
#define OID_802_3_XMIT_LATE_COLLISIONS
Definition: ntddndis.h:316
#define OID_802_3_XMIT_TIMES_CRS_LOST
Definition: ntddndis.h:315
#define OID_GEN_RCV_NO_BUFFER
Definition: ntddndis.h:271

Referenced by MiniportQueryInformation().

◆ NvNetReadStatistics()

static VOID NvNetReadStatistics ( _In_ PNVNET_ADAPTER  Adapter)
static

Definition at line 213 of file requests.c.

215 {
216  Adapter->Statistics.HwTxCnt += NV_READ(Adapter, NvRegTxCnt);
217  Adapter->Statistics.HwTxZeroReXmt += NV_READ(Adapter, NvRegTxZeroReXmt);
218  Adapter->Statistics.HwTxOneReXmt += NV_READ(Adapter, NvRegTxOneReXmt);
219  Adapter->Statistics.HwTxManyReXmt += NV_READ(Adapter, NvRegTxManyReXmt);
220  Adapter->Statistics.HwTxLateCol += NV_READ(Adapter, NvRegTxLateCol);
221  Adapter->Statistics.HwTxUnderflow += NV_READ(Adapter, NvRegTxUnderflow);
222  Adapter->Statistics.HwTxLossCarrier += NV_READ(Adapter, NvRegTxLossCarrier);
223  Adapter->Statistics.HwTxExcessDef += NV_READ(Adapter, NvRegTxExcessDef);
224  Adapter->Statistics.HwTxRetryErr += NV_READ(Adapter, NvRegTxRetryErr);
225  Adapter->Statistics.HwRxFrameErr += NV_READ(Adapter, NvRegRxFrameErr);
226  Adapter->Statistics.HwRxExtraByte += NV_READ(Adapter, NvRegRxExtraByte);
227  Adapter->Statistics.HwRxLateCol += NV_READ(Adapter, NvRegRxLateCol);
228  Adapter->Statistics.HwRxRunt += NV_READ(Adapter, NvRegRxRunt);
229  Adapter->Statistics.HwRxFrameTooLong += NV_READ(Adapter, NvRegRxFrameTooLong);
230  Adapter->Statistics.HwRxOverflow += NV_READ(Adapter, NvRegRxOverflow);
231  Adapter->Statistics.HwRxFCSErr += NV_READ(Adapter, NvRegRxFCSErr);
232  Adapter->Statistics.HwRxFrameAlignErr += NV_READ(Adapter, NvRegRxFrameAlignErr);
233  Adapter->Statistics.HwRxLenErr += NV_READ(Adapter, NvRegRxLenErr);
234  Adapter->Statistics.HwRxUnicast += NV_READ(Adapter, NvRegRxUnicast);
235  Adapter->Statistics.HwRxMulticast += NV_READ(Adapter, NvRegRxMulticast);
236  Adapter->Statistics.HwRxBroadcast += NV_READ(Adapter, NvRegRxBroadcast);
237 
238  if (Adapter->Features & DEV_HAS_STATISTICS_V2)
239  {
240  Adapter->Statistics.HwTxDef += NV_READ(Adapter, NvRegTxDef);
241  Adapter->Statistics.HwTxFrame += NV_READ(Adapter, NvRegTxFrame);
242  Adapter->Statistics.HwRxCnt += NV_READ(Adapter, NvRegRxCnt);
243  Adapter->Statistics.HwTxPause += NV_READ(Adapter, NvRegTxPause);
244  Adapter->Statistics.HwRxPause += NV_READ(Adapter, NvRegRxPause);
245  Adapter->Statistics.HwRxDropFrame += NV_READ(Adapter, NvRegRxDropFrame);
246  }
247 
248  if (Adapter->Features & DEV_HAS_STATISTICS_V3)
249  {
250  Adapter->Statistics.HwTxUnicast += NV_READ(Adapter, NvRegTxUnicast);
251  Adapter->Statistics.HwTxMulticast += NV_READ(Adapter, NvRegTxMulticast);
252  Adapter->Statistics.HwTxBroadcast += NV_READ(Adapter, NvRegTxBroadcast);
253  }
254 }
#define DEV_HAS_STATISTICS_V3
Definition: nic.h:30
#define DEV_HAS_STATISTICS_V2
Definition: nic.h:29
FORCEINLINE ULONG NV_READ(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register)
Definition: nvnet.h:656

Referenced by MiniportQueryInformation().

◆ NvNetRemoveWakeUpPattern()

static NDIS_STATUS NvNetRemoveWakeUpPattern ( _In_ PNVNET_ADAPTER  Adapter,
_In_ PNDIS_PM_PACKET_PATTERN  Pattern 
)
static

Definition at line 721 of file requests.c.

724 {
725  ULONG i;
726 
727  for (i = 0; i < RTL_NUMBER_OF(Adapter->WakeFrames); ++i)
728  {
729  PNVNET_WAKE_FRAME WakeFrame = Adapter->WakeFrames[i];
730 
731  if (!WakeFrame)
732  continue;
733 
734  if (!NdisEqualMemory(&WakeFrame->PatternMask,
735  (PUCHAR)Pattern + sizeof(NDIS_PM_PACKET_PATTERN),
736  min(Pattern->MaskSize, 16)))
737  {
738  continue;
739  }
740 
741  if (!NdisEqualMemory(&WakeFrame->WakeUpPattern,
742  (PUCHAR)Pattern + Pattern->PatternOffset,
743  min(Pattern->PatternSize, 128)))
744  {
745  continue;
746  }
747 
748  NdisFreeMemory(WakeFrame, sizeof(*WakeFrame), 0);
749 
750  Adapter->WakeFrameBitmap |= (1 << i);
751  Adapter->WakeFrames[i] = NULL;
752 
753  return NDIS_STATUS_SUCCESS;
754  }
755 
757 }
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR WakeUpPattern[128]
Definition: nvnet.h:181
#define NDIS_STATUS_INVALID_DATA
Definition: ndis.h:486
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NdisEqualMemory
Definition: requests.c:717
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
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
union _NVNET_WAKE_FRAME::@980 PatternMask
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:110

Referenced by MiniportSetInformation().

◆ NvNetSetPower()

static NDIS_STATUS NvNetSetPower ( _In_ PNVNET_ADAPTER  Adapter,
_In_ NDIS_DEVICE_POWER_STATE  NewPowerState 
)
static

Definition at line 646 of file requests.c.

649 {
650  Adapter->PowerStatePending = NewPowerState;
651 
652  NdisInitializeWorkItem(&Adapter->PowerWorkItem, NvNetPowerWorker, Adapter);
653  NdisScheduleWorkItem(&Adapter->PowerWorkItem);
654 
655  return NDIS_STATUS_PENDING;
656 }
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
#define NdisInitializeWorkItem(_WI_, _R_, _C_)
Definition: ndis.h:3197
NDIS_STATUS EXPORT NdisScheduleWorkItem(IN PNDIS_WORK_ITEM pWorkItem)
Definition: misc.c:467
static VOID NTAPI NvNetPowerWorker(_In_ PNDIS_WORK_ITEM WorkItem, _In_opt_ PVOID Context)
Definition: requests.c:603

Referenced by MiniportSetInformation().

◆ NvNetSetPowerState()

VOID NvNetSetPowerState ( _In_ PNVNET_ADAPTER  Adapter,
_In_ NDIS_DEVICE_POWER_STATE  NewPowerState,
_In_ ULONG  WakeFlags 
)

Definition at line 500 of file requests.c.

504 {
505  ULONG i, PowerState, PowerState2, WakeUpFlags;
506 
507  NV_READ(Adapter, NvRegPowerCap);
508 
509  WakeUpFlags = 0;
510  PowerState2 = 0;
511  if (Adapter->Features & DEV_HAS_POWER_CNTRL)
512  {
513  PowerState2 = NV_READ(Adapter, NvRegPowerState2);
514  PowerState2 &= ~(NVREG_POWERSTATE2_WAKEUPPAT_5 |
517  }
518 
519  if (NewPowerState != NdisDeviceStateD0)
520  {
521  ULONG FramesEnabled = 0;
522 
523  if (WakeFlags & NDIS_PNP_WAKE_UP_PATTERN_MATCH)
524  WakeUpFlags |= NVREG_WAKEUPFLAGS_ENABLE_MAGPAT;
525  if (WakeFlags & NDIS_PNP_WAKE_UP_LINK_CHANGE)
527  if (WakeFlags & NDIS_PNP_WAKE_UP_MAGIC_PACKET)
528  {
529  WakeUpFlags |= NVREG_WAKEUPFLAGS_ENABLE_WAKEUPPAT;
530 
531  for (i = 0; i < RTL_NUMBER_OF(Adapter->WakeFrames); ++i)
532  {
533  PNVNET_WAKE_FRAME WakeFrame = Adapter->WakeFrames[i];
534 
535  if (!WakeFrame)
536  continue;
537 
538  WriteWakeFrame(Adapter, WakeFrame, i);
539 
540  PowerState2 |= FrameNumberToPowerMask(i);
541  WakeUpFlags |= FrameNumberToWakeUpMask(i);
542 
543  ++FramesEnabled;
544  }
545  }
546 
547  if (WakeUpFlags)
548  {
549  if (!(Adapter->Flags & NV_MAC_IN_USE))
550  {
551  PowerState2 &= ~NVREG_POWERSTATE2_GATE_CLOCKS;
552  PowerState2 |= NVREG_POWERSTATE2_GATE_CLOCK_3;
553 
554  if (!FramesEnabled && (WakeUpFlags & NVREG_WAKEUPFLAGS_ENABLE_LINKCHANGE))
555  PowerState2 |= NVREG_POWERSTATE2_GATE_CLOCK_1;
556  if (FramesEnabled < NV_WAKEUPMASKENTRIES)
557  PowerState2 |= NVREG_POWERSTATE2_GATE_CLOCK_2;
558  }
559 
560  NvNetStartReceiver(Adapter);
561  }
562  else
563  {
564  if (!(Adapter->Flags & NV_MAC_IN_USE))
565  PowerState2 |= NVREG_POWERSTATE2_GATE_CLOCKS;
566  }
567  }
568 
570 
571  NV_WRITE(Adapter, NvRegWakeUpFlags, WakeUpFlags);
572  if (Adapter->Features & DEV_HAS_POWER_CNTRL)
573  {
574  NV_WRITE(Adapter, NvRegPowerState2, PowerState2);
575  }
576 
577  NV_WRITE(Adapter, NvRegPowerState,
579  for (i = 0; i < NV_POWER_ATTEMPTS; ++i)
580  {
581  ULONG State = NV_READ(Adapter, NvRegPowerState);
582 
584  break;
585 
587 
589  }
590 
591  PowerState = NewPowerState - 1;
592  if (WakeUpFlags)
593  {
595  }
597 }
#define NVREG_POWERSTATE2_WAKEUPPAT_5
Definition: nic.h:343
#define NVREG_POWERSTATE_POWEREDUP
Definition: nic.h:289
#define NV_MAC_IN_USE
Definition: nvnet.h:291
#define DEV_HAS_POWER_CNTRL
Definition: nic.h:27
VOID NvNetStartReceiver(_In_ PNVNET_ADAPTER Adapter)
Definition: nic.c:104
#define NVREG_WAKEUPFLAGS_ENABLE_LINKCHANGE
Definition: nic.h:269
#define NV_POWER_DELAY
Definition: nic.h:458
static ULONG FrameNumberToPowerMask(_In_ ULONG FrameNumber)
Definition: requests.c:482
#define NVREG_POWERSTATE2_GATE_CLOCK_2
Definition: nic.h:340
#define NVREG_POWERSTATE_VALID
Definition: nic.h:290
static VOID WriteWakeFrame(_In_ PNVNET_ADAPTER Adapter, _In_ PNVNET_WAKE_FRAME WakeFrame, _In_ ULONG FrameNumber)
Definition: requests.c:450
#define NVREG_WAKEUPFLAGS_ENABLE_MAGPAT
Definition: nic.h:267
#define NV_POWER_STALL
Definition: nic.h:459
FORCEINLINE VOID NV_WRITE(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register, _In_ ULONG Value)
Definition: nvnet.h:646
#define NV_POWER_ATTEMPTS
Definition: nic.h:460
#define NV_WAKEUPMASKENTRIES
Definition: nic.h:468
#define NDIS_PNP_WAKE_UP_MAGIC_PACKET
Definition: ntddndis.h:372
#define NVREG_POWERSTATE2_WAKEUPPAT_7
Definition: nic.h:345
#define NDIS_PNP_WAKE_UP_PATTERN_MATCH
Definition: ntddndis.h:373
static ULONG FrameNumberToWakeUpMask(_In_ ULONG FrameNumber)
Definition: requests.c:471
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
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define NDIS_PNP_WAKE_UP_LINK_CHANGE
Definition: ntddndis.h:374
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
Definition: wdfdevice.h:3032
#define NVREG_POWERSTATE2_GATE_CLOCK_1
Definition: nic.h:339
unsigned int ULONG
Definition: retypes.h:1
#define NVREG_POWERSTATE2_WAKEUPPAT_6
Definition: nic.h:344
#define NdisStallExecution
Definition: ndis.h:4453
#define NVREG_POWERSTATE2_GATE_CLOCK_3
Definition: nic.h:341
FORCEINLINE ULONG NV_READ(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register)
Definition: nvnet.h:656
#define NVREG_WAKEUPFLAGS_ENABLE_WAKEUPPAT
Definition: nic.h:268
#define NVREG_POWERSTATE2_GATE_CLOCKS
Definition: nic.h:342

Referenced by MiniportShutdown(), and NvNetPowerWorker().

◆ NvNetSetTcpTaskOffload()

static NDIS_STATUS NvNetSetTcpTaskOffload ( _Inout_ PNVNET_ADAPTER  Adapter,
_In_ PNDIS_TASK_OFFLOAD_HEADER  TaskOffloadHeader,
_In_ PULONG  BytesRead 
)
static

Definition at line 888 of file requests.c.

892 {
893  ULONG Offset;
894  PNDIS_TASK_OFFLOAD TaskOffload;
895 
896  if (TaskOffloadHeader->Version != NDIS_TASK_OFFLOAD_VERSION)
897  {
899  }
900 
901  Adapter->IpHeaderOffset = TaskOffloadHeader->EncapsulationFormat.EncapsulationHeaderSize;
902 
903  TaskOffload = (PNDIS_TASK_OFFLOAD)TaskOffloadHeader;
904  Offset = TaskOffloadHeader->OffsetFirstTask;
905 
906  while (Offset)
907  {
908  *BytesRead += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer);
909 
910  TaskOffload = (PNDIS_TASK_OFFLOAD)((PUCHAR)TaskOffload + Offset);
911  switch (TaskOffload->Task)
912  {
914  {
916 
918 
919  if (!(Adapter->Flags & NV_SEND_CHECKSUM))
920  {
922  }
923 
924  Task = (PNDIS_TASK_TCP_IP_CHECKSUM)TaskOffload->TaskBuffer;
925 
926  Adapter->Offload.SendTcpChecksum = Task->V4Transmit.TcpChecksum;
927  Adapter->Offload.SendUdpChecksum = Task->V4Transmit.UdpChecksum;
928  Adapter->Offload.SendIpChecksum = Task->V4Transmit.IpChecksum;
929 
930  Adapter->Offload.ReceiveTcpChecksum = Task->V4Receive.TcpChecksum;
931  Adapter->Offload.ReceiveUdpChecksum = Task->V4Receive.UdpChecksum;
932  Adapter->Offload.ReceiveIpChecksum = Task->V4Receive.IpChecksum;
933  break;
934  }
935 
937  {
939 
940  if (!(Adapter->Flags & NV_SEND_LARGE_SEND))
941  {
943  }
944 
945  if ((TaskOffloadHeader->
946  EncapsulationFormat.Encapsulation != IEEE_802_3_Encapsulation) &&
947  (TaskOffloadHeader->
948  EncapsulationFormat.Encapsulation != UNSPECIFIED_Encapsulation ||
949  TaskOffloadHeader->
950  EncapsulationFormat.EncapsulationHeaderSize != sizeof(ETH_HEADER)))
951  {
953  }
954 
956 
957  Task = (PNDIS_TASK_TCP_LARGE_SEND)TaskOffload->TaskBuffer;
958 
961 
964 
965  /* Nothing to do */
966  break;
967  }
968 
969  default:
970  break;
971  }
972 
973  Offset = TaskOffload->OffsetNextTask;
974  }
975 
976  NdisAcquireSpinLock(&Adapter->Send.Lock);
977 
978  if (Adapter->Offload.ReceiveTcpChecksum ||
979  Adapter->Offload.ReceiveUdpChecksum ||
980  Adapter->Offload.ReceiveIpChecksum)
981  {
982  Adapter->TxRxControl |= NVREG_TXRXCTL_RXCHECK;
983  }
984  else
985  {
986  Adapter->TxRxControl &= ~NVREG_TXRXCTL_RXCHECK;
987  }
988  NV_WRITE(Adapter, NvRegTxRxControl, Adapter->TxRxControl);
989 
990  NdisReleaseSpinLock(&Adapter->Send.Lock);
991 
992  return NDIS_STATUS_SUCCESS;
993 }
#define NV_SEND_LARGE_SEND
Definition: nvnet.h:288
struct _NDIS_TASK_TCP_LARGE_SEND NDIS_TASK_TCP_LARGE_SEND
VOID EXPORT NdisReleaseSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:239
unsigned char * PUCHAR
Definition: retypes.h:3
if(dx==0 &&dy==0)
Definition: linetemp.h:174
struct _NDIS_TASK_TCP_IP_CHECKSUM NDIS_TASK_TCP_IP_CHECKSUM
#define NVNET_MAXIMUM_LSO_FRAME_SIZE
Definition: nvnet.h:67
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:859
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
struct _NDIS_TASK_OFFLOAD * PNDIS_TASK_OFFLOAD
struct _NDIS_TASK_TCP_IP_CHECKSUM::@2061 V4Receive
FORCEINLINE VOID NV_WRITE(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register, _In_ ULONG Value)
Definition: nvnet.h:646
struct _NDIS_TASK_TCP_IP_CHECKSUM::@2060 V4Transmit
#define NV_SEND_CHECKSUM
Definition: nvnet.h:287
struct _ETH_HEADER ETH_HEADER
VOID EXPORT NdisAcquireSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:135
struct _NDIS_TASK_TCP_LARGE_SEND * PNDIS_TASK_TCP_LARGE_SEND
#define NVNET_MINIMUM_LSO_SEGMENT_COUNT
Definition: nvnet.h:66
#define NVREG_TXRXCTL_RXCHECK
Definition: nic.h:207
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NDIS_TASK_OFFLOAD_VERSION
Definition: ndis.h:1388
struct _NDIS_TASK_TCP_IP_CHECKSUM * PNDIS_TASK_TCP_IP_CHECKSUM
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
ULONG OffsetNextTask
Definition: ndis.h:1236
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned int ULONG
Definition: retypes.h:1
NDIS_TASK Task
Definition: ndis.h:1235
UCHAR TaskBuffer[1]
Definition: ndis.h:1238

Referenced by MiniportSetInformation().

◆ PacketFilterToMask()

static ULONG PacketFilterToMask ( _In_ ULONG  PacketFilter)
static

Definition at line 109 of file requests.c.

111 {
113 
114  if (PacketFilter & NDIS_PACKET_TYPE_PROMISCUOUS)
115  {
116  FilterMask &= ~NVREG_PFF_MYADDR;
117  }
118 
119  if (PacketFilter & NDIS_PACKET_TYPE_BROADCAST)
120  {
121  FilterMask &= ~NVREG_PFF_PROMISC;
122  }
123 
124  return FilterMask;
125 }
#define NVREG_PFF_ALWAYS
Definition: nic.h:116
#define NVREG_PFF_PROMISC
Definition: nic.h:117
#define NVREG_PFF_MYADDR
Definition: nic.h:118
#define NDIS_PACKET_TYPE_PROMISCUOUS
Definition: ndis.h:668
unsigned int ULONG
Definition: retypes.h:1
#define NDIS_PACKET_TYPE_BROADCAST
Definition: ndis.h:666

Referenced by NvNetApplyPacketFilter().

◆ WriteWakeFrame()

static VOID WriteWakeFrame ( _In_ PNVNET_ADAPTER  Adapter,
_In_ PNVNET_WAKE_FRAME  WakeFrame,
_In_ ULONG  FrameNumber 
)
static

Definition at line 450 of file requests.c.

454 {
455  ULONG Offset = FrameNumber * 5 * sizeof(ULONG);
456 
457  if (FrameNumber >= NV_WAKEUPPATTERNS)
458  {
460  }
461 
462  NV_WRITE(Adapter, NvRegPatternCrc + Offset, BuildFrameSignature(WakeFrame));
463  NV_WRITE(Adapter, NvRegPatternMask0 + Offset, WakeFrame->PatternMask.AsULONG[0]);
464  NV_WRITE(Adapter, NvRegPatternMask1 + Offset, WakeFrame->PatternMask.AsULONG[1]);
465  NV_WRITE(Adapter, NvRegPatternMask2 + Offset, WakeFrame->PatternMask.AsULONG[2]);
466  NV_WRITE(Adapter, NvRegPatternMask3 + Offset, WakeFrame->PatternMask.AsULONG[3]);
467 }
#define NV_PATTERN_V2_OFFSET
Definition: nic.h:469
FORCEINLINE VOID NV_WRITE(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register, _In_ ULONG Value)
Definition: nvnet.h:646
static ULONG BuildFrameSignature(_In_ PNVNET_WAKE_FRAME WakeFrame)
Definition: requests.c:427
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define NV_WAKEUPPATTERNS
Definition: nic.h:466
unsigned int ULONG
Definition: retypes.h:1

Referenced by NvNetSetPowerState().

Variable Documentation

◆ NvpSupportedOidList

const NDIS_OID NvpSupportedOidList[]
static

Definition at line 17 of file requests.c.

Referenced by MiniportQueryInformation().