ReactOS 0.4.16-dev-303-g11d5cb8
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
 

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 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.

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}
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
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
long LONG
Definition: pedump.c:60
uint32_t ULONG
Definition: typedefs.h:59

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_6
Definition: nic.h:343
#define NVREG_POWERSTATE2_WAKEUPPAT_5
Definition: nic.h:342
#define NVREG_POWERSTATE2_WAKEUPPAT_7
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 973 of file requests.c.

980{
981 PNVNET_ADAPTER Adapter = (PNVNET_ADAPTER)MiniportAdapterContext;
983 ULONG InfoLength;
984 PVOID InfoPtr;
985 union _GENERIC_INFORMATION
986 {
988 ULONG Ulong;
989 ULONG64 Ulong64;
990 NDIS_MEDIUM Medium;
993 } GenericInfo;
994
995 InfoLength = sizeof(ULONG);
996 InfoPtr = &GenericInfo;
997
998 switch (Oid)
999 {
1001 InfoPtr = (PVOID)&NvpSupportedOidList;
1002 InfoLength = sizeof(NvpSupportedOidList);
1003 break;
1004
1006 InfoLength = sizeof(NDIS_HARDWARE_STATUS);
1007 GenericInfo.Status = NdisHardwareStatusReady;
1008 break;
1009
1012 {
1013 InfoLength = sizeof(NDIS_MEDIUM);
1014 GenericInfo.Medium = NdisMedium802_3;
1015 break;
1016 }
1017
1020 {
1021 GenericInfo.Ulong = Adapter->MaximumFrameSize - sizeof(ETH_HEADER);
1022 break;
1023 }
1024
1026 {
1027 GenericInfo.Ulong = Adapter->MaximumFrameSize;
1028 break;
1029 }
1030
1031 case OID_GEN_LINK_SPEED:
1032 {
1033 GenericInfo.Ulong = NvNetGetLinkSpeed(Adapter) * 10000;
1034 break;
1035 }
1036
1038 {
1039 /* TODO: Change this later, once the driver can handle multipacket sends */
1040 GenericInfo.Ulong = Adapter->MaximumFrameSize;
1041 break;
1042 }
1043
1045 {
1046 GenericInfo.Ulong = Adapter->MaximumFrameSize * NVNET_RECEIVE_DESCRIPTORS;
1047 }
1048
1052 {
1053 GenericInfo.Ulong = Adapter->MaximumFrameSize;
1054 break;
1055 }
1056
1057 case OID_GEN_VENDOR_ID:
1058 {
1059 GenericInfo.Ulong = 0;
1060 GenericInfo.Ulong |= (Adapter->PermanentMacAddress[0] << 16);
1061 GenericInfo.Ulong |= (Adapter->PermanentMacAddress[1] << 8);
1062 GenericInfo.Ulong |= (Adapter->PermanentMacAddress[2] & 0xFF);
1063 break;
1064 }
1065
1067 {
1068 InfoLength = sizeof(USHORT);
1069 GenericInfo.Ushort = (NDIS_MINIPORT_MAJOR_VERSION << 8) | NDIS_MINIPORT_MINOR_VERSION;
1070 break;
1071 }
1072
1074 {
1075 static const CHAR VendorDesc[] = "nVidia nForce Ethernet Controller";
1076 InfoPtr = (PVOID)&VendorDesc;
1077 InfoLength = sizeof(VendorDesc);
1078 break;
1079 }
1080
1082 {
1083 GenericInfo.Ulong = Adapter->PacketFilter;
1084 break;
1085 }
1086
1088 {
1089 GenericInfo.Ulong = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA |
1092
1093 if (Adapter->Flags & NV_PACKET_PRIORITY)
1094 GenericInfo.Ulong |= NDIS_MAC_OPTION_8021P_PRIORITY;
1095 if (Adapter->Flags & NV_VLAN_TAGGING)
1096 GenericInfo.Ulong |= NDIS_MAC_OPTION_8021Q_VLAN;
1097 break;
1098 }
1099
1101 {
1102 GenericInfo.Ulong = Adapter->Connected ? NdisMediaStateConnected
1104 break;
1105 }
1106
1108 {
1109 /* TODO: Multipacket sends */
1110 GenericInfo.Ulong = 1;
1111 break;
1112 }
1113
1115 {
1116 /* 1.0.0 */
1117 GenericInfo.Ulong = 0x100;
1118 break;
1119 }
1120
1121 case OID_GEN_XMIT_OK:
1122 case OID_GEN_RCV_OK:
1123 case OID_GEN_XMIT_ERROR:
1124 case OID_GEN_RCV_ERROR:
1138 {
1140 {
1141 NvNetReadStatistics(Adapter);
1142 NvNetQueryHwCounter(Adapter, Oid, &GenericInfo.Ulong64);
1143 }
1144 else
1145 {
1146 NvNetQuerySoftwareCounter(Adapter, Oid, &GenericInfo.Ulong64);
1147 }
1148
1149 *BytesNeeded = sizeof(ULONG64);
1150 if (InformationBufferLength < sizeof(ULONG))
1151 {
1152 *BytesWritten = 0;
1154 }
1155 if (InformationBufferLength >= sizeof(ULONG64))
1156 {
1157 *BytesWritten = sizeof(ULONG64);
1158 NdisMoveMemory(InformationBuffer, InfoPtr, sizeof(ULONG64));
1159 }
1160 else
1161 {
1162 *BytesWritten = sizeof(ULONG);
1163 NdisMoveMemory(InformationBuffer, InfoPtr, sizeof(ULONG));
1164 }
1165
1166 return NDIS_STATUS_SUCCESS;
1167 }
1168
1170 {
1171 GenericInfo.Ulong = NVNET_TRANSMIT_BLOCKS - Adapter->Send.TcbSlots;
1172 break;
1173 }
1174
1176 {
1177 InfoPtr = Adapter->PermanentMacAddress;
1178 InfoLength = ETH_LENGTH_OF_ADDRESS;
1179 break;
1180 }
1181
1183 {
1184 InfoPtr = Adapter->CurrentMacAddress;
1185 InfoLength = ETH_LENGTH_OF_ADDRESS;
1186 break;
1187 }
1188
1190 {
1191 InfoPtr = Adapter->MulticastList;
1192 InfoLength = Adapter->MulticastListSize * ETH_LENGTH_OF_ADDRESS;
1193 break;
1194 }
1195
1197 {
1198 GenericInfo.Ulong = NVNET_MULTICAST_LIST_SIZE;
1199 break;
1200 }
1201
1203 {
1204 return NvNetGetTcpTaskOffload(Adapter,
1205 InformationBuffer,
1206 InformationBufferLength,
1208 BytesWritten);
1209 }
1210
1212 {
1213 GenericInfo.Ulong = NvNetGetWakeUp(Adapter);
1214 break;
1215 }
1216
1218 {
1219 InfoLength = sizeof(NDIS_PNP_CAPABILITIES);
1220
1221 if (InformationBufferLength < InfoLength)
1222 {
1223 *BytesWritten = 0;
1224 *BytesNeeded = InfoLength;
1226 }
1227
1228 *BytesWritten = InfoLength;
1229 *BytesNeeded = 0;
1230 return NvNetFillPowerManagementCapabilities(Adapter, InformationBuffer);
1231 }
1232
1234 {
1235 return NDIS_STATUS_SUCCESS;
1236 }
1237
1238 case OID_GEN_VLAN_ID:
1239 {
1240 /* TODO: Implement software VLAN support */
1241 if (!(Adapter->Flags & NV_VLAN_TAGGING))
1242 {
1244 break;
1245 }
1246
1247 GenericInfo.Ulong = Adapter->VlanId;
1248 break;
1249 }
1250
1251 default:
1253 break;
1254 }
1255
1257 {
1258 if (InfoLength > InformationBufferLength)
1259 {
1260 *BytesWritten = 0;
1261 *BytesNeeded = InfoLength;
1263 }
1264 else
1265 {
1266 NdisMoveMemory(InformationBuffer, InfoPtr, InfoLength);
1267 *BytesWritten = InfoLength;
1268 *BytesNeeded = 0;
1269 }
1270 }
1271 else
1272 {
1273 *BytesWritten = 0;
1274 *BytesNeeded = 0;
1275 }
1276
1277 return Status;
1278}
#define ETH_LENGTH_OF_ADDRESS
Definition: efilter.h:16
Status
Definition: gdiplustypes.h:25
unsigned __int64 ULONG64
Definition: imports.h:198
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND
Definition: ndis.h:684
#define NDIS_STATUS_INVALID_OID
Definition: ndis.h:488
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NDIS_STATUS_BUFFER_TOO_SHORT
Definition: ndis.h:487
#define NDIS_MAC_OPTION_NO_LOOPBACK
Definition: ndis.h:685
#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA
Definition: ndis.h:682
#define NDIS_MAC_OPTION_8021P_PRIORITY
Definition: ndis.h:688
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
enum _NDIS_MEDIUM NDIS_MEDIUM
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: ntddndis.h:242
#define OID_GEN_XMIT_OK
Definition: ntddndis.h:267
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: ntddndis.h:249
#define OID_GEN_XMIT_ERROR
Definition: ntddndis.h:269
#define OID_GEN_VENDOR_DRIVER_VERSION
Definition: ntddndis.h:254
#define OID_802_3_PERMANENT_ADDRESS
Definition: ntddndis.h:302
#define OID_GEN_LINK_SPEED
Definition: ntddndis.h:239
#define OID_GEN_VENDOR_ID
Definition: ntddndis.h:244
#define OID_802_3_RCV_OVERRUN
Definition: ntddndis.h:312
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
@ NdisMediaStateConnected
Definition: ntddndis.h:470
@ NdisMediaStateDisconnected
Definition: ntddndis.h:471
#define OID_GEN_RCV_NO_BUFFER
Definition: ntddndis.h:271
#define OID_802_3_XMIT_HEARTBEAT_FAILURE
Definition: ntddndis.h:314
enum _NDIS_DEVICE_POWER_STATE NDIS_DEVICE_POWER_STATE
#define OID_802_3_XMIT_ONE_COLLISION
Definition: ntddndis.h:308
#define OID_802_3_XMIT_MORE_COLLISIONS
Definition: ntddndis.h:309
#define OID_802_3_XMIT_MAX_COLLISIONS
Definition: ntddndis.h:311
#define OID_GEN_RECEIVE_BUFFER_SPACE
Definition: ntddndis.h:241
#define OID_802_3_XMIT_TIMES_CRS_LOST
Definition: ntddndis.h:315
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: ntddndis.h:305
#define OID_GEN_DRIVER_VERSION
Definition: ntddndis.h:248
#define OID_802_3_XMIT_UNDERRUN
Definition: ntddndis.h:313
#define OID_802_3_XMIT_LATE_COLLISIONS
Definition: ntddndis.h:316
#define OID_802_3_CURRENT_ADDRESS
Definition: ntddndis.h:303
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
struct _NDIS_PNP_CAPABILITIES NDIS_PNP_CAPABILITIES
#define OID_GEN_DIRECTED_FRAMES_RCV
Definition: ntddndis.h:281
#define OID_PNP_ENABLE_WAKE_UP
Definition: ntddndis.h:366
#define OID_GEN_TRANSMIT_BUFFER_SPACE
Definition: ntddndis.h:240
#define OID_GEN_MEDIA_SUPPORTED
Definition: ntddndis.h:235
@ NdisMedium802_3
Definition: ntddndis.h:188
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: ntddndis.h:238
#define OID_GEN_RCV_CRC_ERROR
Definition: ntddndis.h:286
#define NDIS_MAC_OPTION_8021Q_VLAN
Definition: ntddndis.h:440
#define OID_GEN_MEDIA_IN_USE
Definition: ntddndis.h:236
#define OID_GEN_MEDIA_CONNECT_STATUS
Definition: ntddndis.h:252
#define OID_GEN_RCV_OK
Definition: ntddndis.h:268
#define OID_GEN_MAXIMUM_LOOKAHEAD
Definition: ntddndis.h:237
#define OID_802_3_RCV_ERROR_ALIGNMENT
Definition: ntddndis.h:307
#define OID_GEN_VLAN_ID
Definition: ntddndis.h:260
int NDIS_STATUS
Definition: ntddndis.h:475
#define OID_PNP_QUERY_POWER
Definition: ntddndis.h:362
#define OID_GEN_RCV_ERROR
Definition: ntddndis.h:270
@ NdisHardwareStatusReady
Definition: ntddndis.h:450
#define OID_PNP_CAPABILITIES
Definition: ntddndis.h:360
#define OID_TCP_TASK_OFFLOAD
Definition: ntddndis.h:377
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
#define OID_GEN_MAC_OPTIONS
Definition: ntddndis.h:251
#define OID_GEN_VENDOR_DESCRIPTION
Definition: ntddndis.h:245
#define OID_GEN_SUPPORTED_LIST
Definition: ntddndis.h:233
#define OID_802_3_XMIT_DEFERRED
Definition: ntddndis.h:310
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: ntddndis.h:243
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: ntddndis.h:253
#define OID_GEN_TRANSMIT_QUEUE_LENGTH
Definition: ntddndis.h:287
#define OID_GEN_HARDWARE_STATUS
Definition: ntddndis.h:234
enum _NDIS_HARDWARE_STATUS NDIS_HARDWARE_STATUS
#define DEV_HAS_STATISTICS_COUNTERS
Definition: nic.h:44
static ULONG NvNetGetWakeUp(_In_ PNVNET_ADAPTER Adapter)
Definition: requests.c:737
static VOID NvNetQuerySoftwareCounter(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_OID Oid, _Out_ PULONG64 Counter)
Definition: requests.c:344
static VOID NvNetReadStatistics(_In_ PNVNET_ADAPTER Adapter)
Definition: requests.c:213
static VOID NvNetQueryHwCounter(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_OID Oid, _Out_ PULONG64 Counter)
Definition: requests.c:258
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:756
static NDIS_STATUS NvNetFillPowerManagementCapabilities(_In_ PNVNET_ADAPTER Adapter, _Out_ PNDIS_PNP_CAPABILITIES Capabilities)
Definition: requests.c:413
static ULONG NvNetGetLinkSpeed(_In_ PNVNET_ADAPTER Adapter)
Definition: requests.c:82
static const NDIS_OID NvpSupportedOidList[]
Definition: requests.c:17
#define NVNET_RECEIVE_DESCRIPTORS
Definition: nvnet.h:34
#define NVNET_MULTICAST_LIST_SIZE
Definition: nvnet.h:64
#define NVNET_TRANSMIT_BLOCKS
Definition: nvnet.h:31
#define NV_PACKET_PRIORITY
Definition: nvnet.h:298
#define NV_VLAN_TAGGING
Definition: nvnet.h:299
struct _NVNET_ADAPTER * PNVNET_ADAPTER
Definition: nvnet.h:259
unsigned short USHORT
Definition: pedump.c:61
Definition: lan.h:33
UCHAR PermanentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: nvnet.h:338
ULONG MaximumFrameSize
Definition: nvnet.h:321
BOOLEAN Connected
Definition: nvnet.h:334
struct _NVNET_ADAPTER::@1012 MulticastList[NVNET_MULTICAST_LIST_SIZE]
ULONG Features
Definition: nvnet.h:284
ULONG PacketFilter
Definition: nvnet.h:309
ULONG Flags
Definition: nvnet.h:285
ULONG VlanId
Definition: nvnet.h:323
NVNET_SEND Send
Definition: nvnet.h:310
UCHAR CurrentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: nvnet.h:339
ULONG TcbSlots
Definition: nvnet.h:246
void * PVOID
Definition: typedefs.h:50
unsigned short Ushort
Definition: utypes.h:44
unsigned long Ulong
Definition: utypes.h:42
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
Definition: wdfdevice.h:3034
_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:960
char CHAR
Definition: xmlstorage.h:175

◆ 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 1282 of file requests.c.

1289{
1290 PNVNET_ADAPTER Adapter = (PNVNET_ADAPTER)MiniportAdapterContext;
1292 ULONG GenericUlong;
1293
1294 *BytesRead = 0;
1295 *BytesNeeded = 0;
1296
1297 switch (Oid)
1298 {
1300 {
1301 if (InformationBufferLength % ETH_LENGTH_OF_ADDRESS)
1302 {
1303 *BytesNeeded = (InformationBufferLength / ETH_LENGTH_OF_ADDRESS) *
1306 break;
1307 }
1308
1309 if (InformationBufferLength > sizeof(Adapter->MulticastList))
1310 {
1311 *BytesNeeded = sizeof(Adapter->MulticastList);
1313 break;
1314 }
1315
1316 *BytesRead = InformationBufferLength;
1317 NdisMoveMemory(Adapter->MulticastList, InformationBuffer, InformationBufferLength);
1318
1319 Adapter->MulticastListSize = InformationBufferLength / ETH_LENGTH_OF_ADDRESS;
1320
1321 NvNetApplyPacketFilter(Adapter);
1322 break;
1323 }
1324
1326 {
1327 if (InformationBufferLength < sizeof(ULONG))
1328 {
1329 *BytesNeeded = sizeof(ULONG);
1331 break;
1332 }
1333
1334 *BytesRead = sizeof(ULONG);
1335 NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
1336
1337 if (GenericUlong & ~NVNET_PACKET_FILTERS)
1338 {
1340 break;
1341 }
1342
1343 /* Do not check to see if the filter is the same filter */
1344 Adapter->PacketFilter = GenericUlong;
1345
1346 NvNetApplyPacketFilter(Adapter);
1347 break;
1348 }
1349
1351 {
1352 if (InformationBufferLength < sizeof(ULONG))
1353 {
1354 *BytesNeeded = sizeof(ULONG);
1356 break;
1357 }
1358
1359 /* Nothing to do */
1360 *BytesRead = sizeof(ULONG);
1361 break;
1362 }
1363
1364 case OID_GEN_VLAN_ID:
1365 {
1366 if (InformationBufferLength < sizeof(ULONG))
1367 {
1368 *BytesNeeded = sizeof(ULONG);
1370 break;
1371 }
1372
1373 if (!(Adapter->Flags & NV_VLAN_TAGGING))
1374 {
1376 break;
1377 }
1378
1379 *BytesRead = sizeof(ULONG);
1380 NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
1381
1382 if (GenericUlong > NVNET_MAXIMUM_VLAN_ID)
1383 {
1385 break;
1386 }
1387
1388 Adapter->VlanId = GenericUlong;
1389 break;
1390 }
1391
1393 {
1394 if (InformationBufferLength < sizeof(NDIS_TASK_OFFLOAD_HEADER))
1395 {
1396 *BytesNeeded = sizeof(NDIS_TASK_OFFLOAD_HEADER);
1398 break;
1399 }
1400
1401 *BytesRead = InformationBufferLength;
1402
1403 Status = NvNetSetTcpTaskOffload(Adapter, InformationBuffer, BytesRead);
1404 break;
1405 }
1406
1408 {
1409 if (InformationBufferLength < sizeof(NDIS_PM_PACKET_PATTERN))
1410 {
1411 *BytesNeeded = sizeof(NDIS_PM_PACKET_PATTERN);
1413 break;
1414 }
1415
1417
1418 Status = NvNetAddWakeUpPattern(Adapter, InformationBuffer);
1419 break;
1420 }
1421
1423 {
1424 if (InformationBufferLength < sizeof(NDIS_PM_PACKET_PATTERN))
1425 {
1426 *BytesNeeded = sizeof(NDIS_PM_PACKET_PATTERN);
1428 break;
1429 }
1430
1432
1433 Status = NvNetRemoveWakeUpPattern(Adapter, InformationBuffer);
1434 break;
1435 }
1436
1438 {
1439 if (InformationBufferLength < sizeof(ULONG))
1440 {
1441 *BytesNeeded = sizeof(ULONG);
1443 break;
1444 }
1445
1446 *BytesRead = sizeof(ULONG);
1447 NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
1448
1449 NvNetEnableWakeUp(Adapter, GenericUlong);
1450 break;
1451 }
1452
1453 case OID_PNP_SET_POWER:
1454 {
1455 if (InformationBufferLength < sizeof(NDIS_DEVICE_POWER_STATE))
1456 {
1457 *BytesNeeded = sizeof(NDIS_DEVICE_POWER_STATE);
1459 break;
1460 }
1461
1462 *BytesRead = sizeof(ULONG);
1463 NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
1464
1465 if (GenericUlong < NdisDeviceStateD0 || GenericUlong > NdisDeviceStateD3)
1466 {
1468 break;
1469 }
1470
1471 Status = NvNetSetPower(Adapter, GenericUlong);
1472 break;
1473 }
1474
1475 default:
1477 break;
1478 }
1479
1480 return Status;
1481}
#define NDIS_STATUS_INVALID_DATA
Definition: ndis.h:486
#define NDIS_STATUS_INVALID_LENGTH
Definition: ndis.h:485
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
struct _NDIS_TASK_OFFLOAD_HEADER NDIS_TASK_OFFLOAD_HEADER
#define NDIS_STATUS_MULTICAST_FULL
Definition: ndis.h:473
struct _NDIS_PM_PACKET_PATTERN NDIS_PM_PACKET_PATTERN
#define OID_PNP_SET_POWER
Definition: ntddndis.h:361
#define OID_PNP_ADD_WAKE_UP_PATTERN
Definition: ntddndis.h:363
#define OID_PNP_REMOVE_WAKE_UP_PATTERN
Definition: ntddndis.h:364
@ NdisDeviceStateD3
Definition: ntddndis.h:41
static VOID NvNetEnableWakeUp(_In_ PNVNET_ADAPTER Adapter, _In_ ULONG Flags)
Definition: requests.c:747
static DECLSPEC_NOINLINE VOID NvNetApplyPacketFilter(_In_ PNVNET_ADAPTER Adapter)
Definition: requests.c:130
static NDIS_STATUS NvNetSetPower(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_DEVICE_POWER_STATE NewPowerState)
Definition: requests.c:646
static NDIS_STATUS NvNetAddWakeUpPattern(_In_ PNVNET_ADAPTER Adapter, _In_ PNDIS_PM_PACKET_PATTERN Pattern)
Definition: requests.c:660
static NDIS_STATUS NvNetSetTcpTaskOffload(_Inout_ PNVNET_ADAPTER Adapter, _In_ PNDIS_TASK_OFFLOAD_HEADER TaskOffloadHeader, _In_ PULONG BytesRead)
Definition: requests.c:864
static NDIS_STATUS NvNetRemoveWakeUpPattern(_In_ PNVNET_ADAPTER Adapter, _In_ PNDIS_PM_PACKET_PATTERN Pattern)
Definition: requests.c:697
#define NVNET_MAXIMUM_VLAN_ID
Definition: nvnet.h:62
#define NVNET_PACKET_FILTERS
Definition: nvnet.h:69
_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:870

◆ 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 {
671 }
672
673 Status = NdisAllocateMemoryWithTag((PVOID*)&WakeFrame, sizeof(*WakeFrame), NVNET_TAG);
675 {
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}
NDIS_STATUS EXPORT NdisAllocateMemoryWithTag(OUT PVOID *VirtualAddress, IN UINT Length, IN ULONG Tag)
Definition: memory.c:21
unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask)
Definition: intrin_arm.h:57
#define min(a, b)
Definition: monoChain.cc:55
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
#define NVNET_TAG
Definition: nvnet.h:22
unsigned char * PUCHAR
Definition: typedefs.h:53

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 {
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 {
174 NdisZeroMemory(Mask, sizeof(Mask));
175 }
176 }
177 else
178 {
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
195 Address[3] << 24 | Address[2] << 16 | Address[1] << 8 | Address[0]);
196 NV_WRITE(Adapter, NvRegMulticastAddrB, Address[5] << 8 | Address[4]);
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}
unsigned char BOOLEAN
unsigned int Mask
Definition: fpcontrol.c:82
#define NdisReleaseSpinLock(_SpinLock)
Definition: ndis.h:4115
#define NdisFillMemory(Destination, Length, Fill)
Definition: ndis.h:3886
#define NDIS_PACKET_TYPE_MULTICAST
Definition: ndis.h:664
#define NDIS_PACKET_TYPE_ALL_MULTICAST
Definition: ndis.h:665
#define NdisAcquireSpinLock(_SpinLock)
Definition: ndis.h:4106
VOID NvNetStartReceiver(_In_ PNVNET_ADAPTER Adapter)
Definition: nic.c:104
VOID NvNetStopReceiver(_In_ PNVNET_ADAPTER Adapter)
Definition: nic.c:147
#define NVREG_RCVCTL_START
Definition: nic.h:125
#define NVREG_MCASTADDRA_FORCE
Definition: nic.h:155
@ NvRegMulticastAddrA
Definition: nic.h:153
@ NvRegMulticastMaskA
Definition: nic.h:157
@ NvRegReceiverControl
Definition: nic.h:124
@ NvRegPacketFilterFlags
Definition: nic.h:113
@ NvRegMulticastMaskB
Definition: nic.h:160
@ NvRegMulticastAddrB
Definition: nic.h:154
#define NVREG_PFF_PAUSE_RX
Definition: nic.h:114
static ULONG PacketFilterToMask(_In_ ULONG PacketFilter)
Definition: requests.c:109
FORCEINLINE VOID NV_WRITE(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register, _In_ ULONG Value)
Definition: nvnet.h:646
FORCEINLINE ULONG NV_READ(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register)
Definition: nvnet.h:656
static WCHAR Address[46]
Definition: ping.c:68
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by MiniportSetInformation(), and NvNetPowerWorker().

◆ NvNetEnableWakeUp()

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

Definition at line 747 of file requests.c.

750{
751 Adapter->WakeFlags = Flags;
752}
_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

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 {
90 LinkSpeedMbps = 10;
91 break;
93 LinkSpeedMbps = 100;
94 break;
96 LinkSpeedMbps = 1000;
97 break;
98
99 default:
101 break;
102 }
103
104 return LinkSpeedMbps;
105}
#define UNREACHABLE
#define NVREG_LINKSPEED_1000
Definition: nic.h:189
#define NVREG_LINKSPEED_100
Definition: nic.h:188
#define NVREG_LINKSPEED_10
Definition: nic.h:187

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 756 of file requests.c.

762{
763 ULONG InfoLength;
764 PNDIS_TASK_OFFLOAD TaskOffload;
765
766 if (!(Adapter->Flags & (NV_SEND_CHECKSUM | NV_SEND_LARGE_SEND)))
767 {
768 *BytesWritten = 0;
769 *BytesNeeded = 0;
771 }
772
773 InfoLength = sizeof(NDIS_TASK_OFFLOAD_HEADER);
774 if (Adapter->Flags & NV_SEND_CHECKSUM)
775 {
776 InfoLength += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer) +
778 }
779 if (Adapter->Flags & NV_SEND_LARGE_SEND)
780 {
781 InfoLength += FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer) +
783 }
784
785 if (InformationBufferLength < InfoLength)
786 {
787 *BytesWritten = 0;
788 *BytesNeeded = InfoLength;
790 }
791
792 if ((TaskOffloadHeader->EncapsulationFormat.Encapsulation != IEEE_802_3_Encapsulation) &&
793 (TaskOffloadHeader->EncapsulationFormat.Encapsulation != UNSPECIFIED_Encapsulation ||
794 TaskOffloadHeader->EncapsulationFormat.EncapsulationHeaderSize != sizeof(ETH_HEADER)))
795 {
796 *BytesWritten = 0;
797 *BytesNeeded = 0;
799 }
800 if (TaskOffloadHeader->Version != NDIS_TASK_OFFLOAD_VERSION)
801 {
802 *BytesWritten = 0;
803 *BytesNeeded = 0;
805 }
806
807 TaskOffloadHeader->OffsetFirstTask = sizeof(NDIS_TASK_OFFLOAD_HEADER);
808 TaskOffload = (PNDIS_TASK_OFFLOAD)(TaskOffloadHeader + 1);
809 if (Adapter->Flags & NV_SEND_CHECKSUM)
810 {
811 PNDIS_TASK_TCP_IP_CHECKSUM ChecksumTask;
812
813 TaskOffload->Size = sizeof(NDIS_TASK_OFFLOAD);
814 TaskOffload->Version = NDIS_TASK_OFFLOAD_VERSION;
815 TaskOffload->Task = TcpIpChecksumNdisTask;
816 TaskOffload->TaskBufferLength = sizeof(NDIS_TASK_TCP_IP_CHECKSUM);
817 TaskOffload->OffsetNextTask = FIELD_OFFSET(NDIS_TASK_OFFLOAD, TaskBuffer) +
819
820 ChecksumTask = (PNDIS_TASK_TCP_IP_CHECKSUM)TaskOffload->TaskBuffer;
821 NdisZeroMemory(ChecksumTask, sizeof(*ChecksumTask));
822
823 ChecksumTask->V4Transmit.IpOptionsSupported = 1;
824 ChecksumTask->V4Transmit.TcpOptionsSupported = 1;
825 ChecksumTask->V4Transmit.TcpChecksum = 1;
826 ChecksumTask->V4Transmit.UdpChecksum = 1;
827 ChecksumTask->V4Transmit.IpChecksum = 1;
828
829 ChecksumTask->V4Receive.IpOptionsSupported = 1;
830 ChecksumTask->V4Receive.TcpOptionsSupported = 1;
831 ChecksumTask->V4Receive.TcpChecksum = 1;
832 ChecksumTask->V4Receive.UdpChecksum = 1;
833 ChecksumTask->V4Receive.IpChecksum = 1;
834
835 TaskOffload = (PNDIS_TASK_OFFLOAD)(ChecksumTask + 1);
836 }
837 if (Adapter->Flags & NV_SEND_LARGE_SEND)
838 {
839 PNDIS_TASK_TCP_LARGE_SEND LargeSendTask;
840
841 TaskOffload->Size = sizeof(NDIS_TASK_OFFLOAD);
842 TaskOffload->Version = NDIS_TASK_OFFLOAD_VERSION;
843 TaskOffload->Task = TcpLargeSendNdisTask;
844 TaskOffload->TaskBufferLength = sizeof(NDIS_TASK_TCP_LARGE_SEND);
845 TaskOffload->OffsetNextTask = 0;
846
847 LargeSendTask = (PNDIS_TASK_TCP_LARGE_SEND)TaskOffload->TaskBuffer;
848 LargeSendTask->Version = NDIS_TASK_TCP_LARGE_SEND_V0;
851 LargeSendTask->IpOptions = TRUE;
852 LargeSendTask->TcpOptions = TRUE;
853 }
854 TaskOffload->OffsetNextTask = 0;
855
856 *BytesWritten = InfoLength;
857 *BytesNeeded = 0;
858
859 return NDIS_STATUS_SUCCESS;
860}
#define TRUE
Definition: types.h:120
struct _NDIS_TASK_OFFLOAD NDIS_TASK_OFFLOAD
struct _NDIS_TASK_OFFLOAD * PNDIS_TASK_OFFLOAD
@ UNSPECIFIED_Encapsulation
Definition: ndis.h:1207
@ IEEE_802_3_Encapsulation
Definition: ndis.h:1209
#define NDIS_TASK_OFFLOAD_VERSION
Definition: ndis.h:1388
struct _NDIS_TASK_TCP_LARGE_SEND * PNDIS_TASK_TCP_LARGE_SEND
struct _NDIS_TASK_TCP_IP_CHECKSUM NDIS_TASK_TCP_IP_CHECKSUM
@ TcpIpChecksumNdisTask
Definition: ndis.h:1200
@ TcpLargeSendNdisTask
Definition: ndis.h:1202
struct _NDIS_TASK_TCP_LARGE_SEND NDIS_TASK_TCP_LARGE_SEND
#define NDIS_TASK_TCP_LARGE_SEND_V0
Definition: ndis.h:1270
struct _NDIS_TASK_TCP_IP_CHECKSUM * PNDIS_TASK_TCP_IP_CHECKSUM
#define NVNET_MINIMUM_LSO_SEGMENT_COUNT
Definition: nvnet.h:66
#define NVNET_MAXIMUM_LSO_FRAME_SIZE
Definition: nvnet.h:67
#define NV_SEND_LARGE_SEND
Definition: nvnet.h:288
#define NV_SEND_CHECKSUM
Definition: nvnet.h:287
ULONG TaskBufferLength
Definition: ndis.h:1237
ULONG OffsetNextTask
Definition: ndis.h:1236
UCHAR TaskBuffer[1]
Definition: ndis.h:1238
NDIS_TASK Task
Definition: ndis.h:1235
struct _NDIS_TASK_TCP_IP_CHECKSUM::@2114 V4Transmit
struct _NDIS_TASK_TCP_IP_CHECKSUM::@2115 V4Receive
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by MiniportQueryInformation().

◆ NvNetGetWakeUp()

static ULONG NvNetGetWakeUp ( _In_ PNVNET_ADAPTER  Adapter)
static

Definition at line 737 of file requests.c.

739{
740 return Adapter->WakeFlags & (NDIS_PNP_WAKE_UP_MAGIC_PACKET |
743}
#define NDIS_PNP_WAKE_UP_MAGIC_PACKET
Definition: ntddndis.h:372
#define NDIS_PNP_WAKE_UP_LINK_CHANGE
Definition: ntddndis.h:374
#define NDIS_PNP_WAKE_UP_PATTERN_MATCH
Definition: ntddndis.h:373

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}
#define PAGED_CODE()
#define FALSE
Definition: types.h:117
#define NdisMSetInformationComplete(MiniportAdapterHandle, Status)
Definition: ndis.h:5762
#define NdisStallExecution
Definition: ndis.h:4453
VOID NvNetIdleTransmitter(_In_ PNVNET_ADAPTER Adapter, _In_ BOOLEAN ClearPhyControl)
Definition: nic.c:211
NDIS_STATUS NvNetInitNIC(_In_ PNVNET_ADAPTER Adapter, _In_ BOOLEAN InitPhy)
Definition: nic.c:401
VOID NvNetStopTransmitter(_In_ PNVNET_ADAPTER Adapter)
Definition: nic.c:178
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
@ NdisDeviceStateD0
Definition: ntddndis.h:38
#define NV_TXRX_RESET_DELAY
Definition: nic.h:444
#define NVREG_TXRXCTL_BIT2
Definition: nic.h:203
#define NVREG_TXRXCTL_RESET
Definition: nic.h:205
@ NvRegTxRxControl
Definition: nic.h:200
VOID NvNetSetPowerState(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_DEVICE_POWER_STATE NewPowerState, _In_ ULONG WakeFlags)
Definition: requests.c:500
VOID NvNetFlushTransmitQueue(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_STATUS CompleteStatus)
Definition: nvnet.c:24
DECLSPEC_NOINLINE VOID NvNetPauseProcessing(_In_ PNVNET_ADAPTER Adapter)
Definition: nvnet.c:46
VOID NvNetStopAdapter(_In_ PNVNET_ADAPTER Adapter)
Definition: nvnet.c:58
VOID NvNetStartAdapter(_In_ PNVNET_ADAPTER Adapter)
Definition: nvnet.c:74
ULONG WakeFlags
Definition: nvnet.h:324
ULONG TxRxControl
Definition: nvnet.h:301
NDIS_HANDLE AdapterHandle
Definition: nvnet.h:283
ULONG PowerStatePending
Definition: nvnet.h:329
_Must_inspect_result_ _In_ PWDF_WORKITEM_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWORKITEM * WorkItem
Definition: wdfworkitem.h:115
#define NT_VERIFY(exp)
Definition: rtlfuncs.h:3304

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;
278 *Counter = (Adapter->Statistics.HwTxRetryErr +
279 Adapter->Statistics.HwTxLateCol +
280 Adapter->Statistics.HwTxUnderflow +
281 Adapter->Statistics.HwTxLossCarrier +
282 Adapter->Statistics.HwTxExcessDef);
283 break;
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:
338 break;
339 }
340}
#define DEV_HAS_STATISTICS_V2
Definition: nic.h:28
static LARGE_INTEGER Counter
Definition: clock.c:43

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;
358 *Counter = Adapter->Statistics.TransmitErrors;
359 break;
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:
407 break;
408 }
409}

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:29
@ NvRegRxPause
Definition: nic.h:324
@ NvRegRxDropFrame
Definition: nic.h:325
@ NvRegRxExtraByte
Definition: nic.h:309
@ NvRegTxPause
Definition: nic.h:323
@ NvRegRxRunt
Definition: nic.h:311
@ NvRegRxOverflow
Definition: nic.h:313
@ NvRegTxRetryErr
Definition: nic.h:307
@ NvRegTxUnderflow
Definition: nic.h:304
@ NvRegTxCnt
Definition: nic.h:299
@ NvRegTxMulticast
Definition: nic.h:252
@ NvRegRxFrameTooLong
Definition: nic.h:312
@ NvRegTxFrame
Definition: nic.h:321
@ NvRegRxMulticast
Definition: nic.h:318
@ NvRegRxCnt
Definition: nic.h:322
@ NvRegRxFCSErr
Definition: nic.h:314
@ NvRegTxLateCol
Definition: nic.h:303
@ NvRegTxUnicast
Definition: nic.h:251
@ NvRegRxUnicast
Definition: nic.h:317
@ NvRegTxBroadcast
Definition: nic.h:253
@ NvRegTxExcessDef
Definition: nic.h:306
@ NvRegRxBroadcast
Definition: nic.h:319
@ NvRegTxDef
Definition: nic.h:320
@ NvRegTxZeroReXmt
Definition: nic.h:300
@ NvRegTxManyReXmt
Definition: nic.h:302
@ NvRegTxOneReXmt
Definition: nic.h:301
@ NvRegRxLenErr
Definition: nic.h:316
@ NvRegTxLossCarrier
Definition: nic.h:305
@ NvRegRxLateCol
Definition: nic.h:310
@ NvRegRxFrameErr
Definition: nic.h:308
@ NvRegRxFrameAlignErr
Definition: nic.h:315

Referenced by MiniportQueryInformation().

◆ NvNetRemoveWakeUpPattern()

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

Definition at line 697 of file requests.c.

700{
701 ULONG i;
702
703 for (i = 0; i < RTL_NUMBER_OF(Adapter->WakeFrames); ++i)
704 {
705 PNVNET_WAKE_FRAME WakeFrame = Adapter->WakeFrames[i];
706
707 if (!WakeFrame)
708 continue;
709
710 if (!NdisEqualMemory(&WakeFrame->PatternMask,
711 (PUCHAR)Pattern + sizeof(NDIS_PM_PACKET_PATTERN),
712 min(Pattern->MaskSize, 16)))
713 {
714 continue;
715 }
716
717 if (!NdisEqualMemory(&WakeFrame->WakeUpPattern,
718 (PUCHAR)Pattern + Pattern->PatternOffset,
719 min(Pattern->PatternSize, 128)))
720 {
721 continue;
722 }
723
724 NdisFreeMemory(WakeFrame, sizeof(*WakeFrame), 0);
725
726 Adapter->WakeFrameBitmap |= (1 << i);
727 Adapter->WakeFrames[i] = NULL;
728
729 return NDIS_STATUS_SUCCESS;
730 }
731
733}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define NULL
Definition: types.h:112
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:110
#define NdisEqualMemory(Source1, Source2, Length)
Definition: ndis.h:3876
UCHAR WakeUpPattern[128]
Definition: nvnet.h:181
union _NVNET_WAKE_FRAME::@1011 PatternMask

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}
NDIS_STATUS EXPORT NdisScheduleWorkItem(IN PNDIS_WORK_ITEM pWorkItem)
Definition: misc.c:467
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
#define NdisInitializeWorkItem(_WI_, _R_, _C_)
Definition: ndis.h:3197
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 {
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 {
582
584 break;
585
587
589 }
590
591 PowerState = NewPowerState - 1;
592 if (WakeUpFlags)
593 {
595 }
597}
#define NVREG_POWERSTATE_VALID
Definition: nic.h:289
#define DEV_HAS_POWER_CNTRL
Definition: nic.h:26
#define NVREG_WAKEUPFLAGS_ENABLE_WAKEUPPAT
Definition: nic.h:267
#define NVREG_POWERSTATE2_GATE_CLOCKS
Definition: nic.h:341
#define NVREG_POWERSTATE_POWEREDUP
Definition: nic.h:288
#define NVREG_POWERSTATE2_GATE_CLOCK_2
Definition: nic.h:339
#define NVREG_POWERSTATE2_GATE_CLOCK_3
Definition: nic.h:340
#define NVREG_POWERSTATE2_GATE_CLOCK_1
Definition: nic.h:338
#define NV_POWER_DELAY
Definition: nic.h:457
#define NV_POWER_ATTEMPTS
Definition: nic.h:459
#define NV_POWER_STALL
Definition: nic.h:458
#define NV_WAKEUPMASKENTRIES
Definition: nic.h:467
@ NvRegWakeUpFlags
Definition: nic.h:255
@ NvRegPowerState2
Definition: nic.h:334
@ NvRegPowerCap
Definition: nic.h:282
@ NvRegPowerState
Definition: nic.h:287
#define NVREG_WAKEUPFLAGS_ENABLE_MAGPAT
Definition: nic.h:266
#define NVREG_WAKEUPFLAGS_ENABLE_LINKCHANGE
Definition: nic.h:268
static ULONG FrameNumberToPowerMask(_In_ ULONG FrameNumber)
Definition: requests.c:482
static ULONG FrameNumberToWakeUpMask(_In_ ULONG FrameNumber)
Definition: requests.c:471
static VOID WriteWakeFrame(_In_ PNVNET_ADAPTER Adapter, _In_ PNVNET_WAKE_FRAME WakeFrame, _In_ ULONG FrameNumber)
Definition: requests.c:450
#define NV_MAC_IN_USE
Definition: nvnet.h:291

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 864 of file requests.c.

868{
870 PNDIS_TASK_OFFLOAD TaskOffload;
871
872 if (TaskOffloadHeader->Version != NDIS_TASK_OFFLOAD_VERSION)
873 {
875 }
876
877 Adapter->IpHeaderOffset = TaskOffloadHeader->EncapsulationFormat.EncapsulationHeaderSize;
878
879 TaskOffload = (PNDIS_TASK_OFFLOAD)TaskOffloadHeader;
880 Offset = TaskOffloadHeader->OffsetFirstTask;
881
882 while (Offset)
883 {
885
886 TaskOffload = (PNDIS_TASK_OFFLOAD)((PUCHAR)TaskOffload + Offset);
887 switch (TaskOffload->Task)
888 {
890 {
892
894
895 if (!(Adapter->Flags & NV_SEND_CHECKSUM))
896 {
898 }
899
900 Task = (PNDIS_TASK_TCP_IP_CHECKSUM)TaskOffload->TaskBuffer;
901
902 Adapter->Offload.SendTcpChecksum = Task->V4Transmit.TcpChecksum;
903 Adapter->Offload.SendUdpChecksum = Task->V4Transmit.UdpChecksum;
904 Adapter->Offload.SendIpChecksum = Task->V4Transmit.IpChecksum;
905
906 Adapter->Offload.ReceiveTcpChecksum = Task->V4Receive.TcpChecksum;
907 Adapter->Offload.ReceiveUdpChecksum = Task->V4Receive.UdpChecksum;
908 Adapter->Offload.ReceiveIpChecksum = Task->V4Receive.IpChecksum;
909 break;
910 }
911
913 {
915
916 if (!(Adapter->Flags & NV_SEND_LARGE_SEND))
917 {
919 }
920
921 if ((TaskOffloadHeader->
922 EncapsulationFormat.Encapsulation != IEEE_802_3_Encapsulation) &&
923 (TaskOffloadHeader->
924 EncapsulationFormat.Encapsulation != UNSPECIFIED_Encapsulation ||
925 TaskOffloadHeader->
926 EncapsulationFormat.EncapsulationHeaderSize != sizeof(ETH_HEADER)))
927 {
929 }
930
932
933 Task = (PNDIS_TASK_TCP_LARGE_SEND)TaskOffload->TaskBuffer;
934
937
940
941 /* Nothing to do */
942 break;
943 }
944
945 default:
946 break;
947 }
948
949 Offset = TaskOffload->OffsetNextTask;
950 }
951
952 NdisAcquireSpinLock(&Adapter->Send.Lock);
953
954 if (Adapter->Offload.ReceiveTcpChecksum ||
955 Adapter->Offload.ReceiveUdpChecksum ||
956 Adapter->Offload.ReceiveIpChecksum)
957 {
958 Adapter->TxRxControl |= NVREG_TXRXCTL_RXCHECK;
959 }
960 else
961 {
962 Adapter->TxRxControl &= ~NVREG_TXRXCTL_RXCHECK;
963 }
964 NV_WRITE(Adapter, NvRegTxRxControl, Adapter->TxRxControl);
965
966 NdisReleaseSpinLock(&Adapter->Send.Lock);
967
968 return NDIS_STATUS_SUCCESS;
969}
if(dx< 0)
Definition: linetemp.h:194
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define NVREG_TXRXCTL_RXCHECK
Definition: nic.h:206

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 NDIS_PACKET_TYPE_PROMISCUOUS
Definition: ndis.h:668
#define NDIS_PACKET_TYPE_BROADCAST
Definition: ndis.h:666
#define NVREG_PFF_PROMISC
Definition: nic.h:116
#define NVREG_PFF_ALWAYS
Definition: nic.h:115
#define NVREG_PFF_MYADDR
Definition: nic.h:117

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:468
#define NV_WAKEUPPATTERNS
Definition: nic.h:465
@ NvRegPatternMask3
Definition: nic.h:274
@ NvRegPatternMask1
Definition: nic.h:272
@ NvRegPatternMask0
Definition: nic.h:271
@ NvRegPatternMask2
Definition: nic.h:273
@ NvRegPatternCrc
Definition: nic.h:270
static ULONG BuildFrameSignature(_In_ PNVNET_WAKE_FRAME WakeFrame)
Definition: requests.c:427

Referenced by NvNetSetPowerState().

Variable Documentation

◆ NvpSupportedOidList

const NDIS_OID NvpSupportedOidList[]
static

Definition at line 17 of file requests.c.

Referenced by MiniportQueryInformation().