ReactOS  0.4.15-dev-1377-ga59cecd
ParaNdis5.h File Reference
#include "ndis56common.h"
Include dependency graph for ParaNdis5.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _tagPowerWorkItem
 
struct  _tagGeneralWorkItem
 

Typedefs

typedef struct _tagPowerWorkItem tPowerWorkItem
 
typedef struct _tagGeneralWorkItem tGeneralWorkItem
 

Functions

NDIS_STATUS NTAPI ParaNdis5_SetOID (IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
 
NDIS_STATUS NTAPI ParaNdis5_QueryOID (IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
 
VOID NTAPI ParaNdis5_SendPackets (IN NDIS_HANDLE MiniportAdapterContext, IN PPNDIS_PACKET PacketArray, IN UINT NumberOfPackets)
 
VOID NTAPI ParaNdis5_ReturnPacket (IN NDIS_HANDLE MiniportAdapterContext, IN PNDIS_PACKET Packet)
 
VOID ParaNdis5_IndicateConnect (PARANDIS_ADAPTER *pContext, BOOLEAN bConnected)
 
VOID NTAPI ParaNdis5_CancelSendPackets (IN NDIS_HANDLE MiniportAdapterContext, IN PVOID CancelId)
 
NDIS_STATUS ParaNdis5_StopSend (PARANDIS_ADAPTER *pContext, BOOLEAN bStop, ONPAUSECOMPLETEPROC Callback)
 
NDIS_STATUS ParaNdis5_StopReceive (PARANDIS_ADAPTER *pContext, BOOLEAN bStop, ONPAUSECOMPLETEPROC Callback)
 
VOID NTAPI ParaNdis5_HandleDPC (IN NDIS_HANDLE MiniportAdapterContext)
 

Typedef Documentation

◆ tGeneralWorkItem

◆ tPowerWorkItem

Function Documentation

◆ ParaNdis5_CancelSendPackets()

VOID NTAPI ParaNdis5_CancelSendPackets ( IN NDIS_HANDLE  MiniportAdapterContext,
IN PVOID  CancelId 
)

Definition at line 1303 of file ParaNdis5-Impl.c.

1304 {
1305  PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
1306  LIST_ENTRY DoneList, KeepList;
1307  UINT n = 0;
1308  tSendEntry *pEntry;
1309  DEBUG_ENTRY(0);
1310  InitializeListHead(&DoneList);
1311  InitializeListHead(&KeepList);
1312  NdisAcquireSpinLock(&pContext->SendLock);
1313  while ( !IsListEmpty(&pContext->SendQueue))
1314  {
1316  pEntry = (tSendEntry *)RemoveHeadList(&pContext->SendQueue);
1317  Packet = pEntry->packet;
1319  {
1320  InsertTailList(&DoneList, &pEntry->list);
1321  ++n;
1322  }
1323  else InsertTailList(&KeepList, &pEntry->list);
1324  }
1325  while ( !IsListEmpty(&KeepList))
1326  {
1327  pEntry = (tSendEntry *)RemoveHeadList(&KeepList);
1328  InsertTailList(&pContext->SendQueue, &pEntry->list);
1329  }
1330  NdisReleaseSpinLock(&pContext->SendLock);
1331  while (!IsListEmpty(&DoneList))
1332  {
1333  pEntry = (tSendEntry *)RemoveHeadList(&DoneList);
1335  CompletePacket(pContext, pEntry->packet);
1336  NdisFreeMemory(pEntry, 0, 0);
1337  }
1338  DEBUG_EXIT_STATUS(0, n);
1339 }
#define DEBUG_EXIT_STATUS(level, status)
Definition: kdebugprint.h:50
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
VOID EXPORT NdisReleaseSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:239
#define DEBUG_ENTRY(level)
Definition: kdebugprint.h:49
GLdouble n
Definition: glext.h:7729
#define InsertTailList(ListHead, Entry)
LONG CancelId
Definition: main.c:23
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
#define NDIS_STATUS_REQUEST_ABORTED
Definition: ndis.h:476
VOID EXPORT NdisAcquireSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:135
#define NDIS_SET_PACKET_STATUS(_Packet, _Status)
Definition: ndis.h:3509
static void CompletePacket(PARANDIS_ADAPTER *pContext, PNDIS_PACKET Packet)
Definition: typedefs.h:119
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned int UINT
Definition: ndis.h:50
#define NDIS_GET_PACKET_CANCEL_ID(Packet)
Definition: ndis.h:1333
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
NDIS_SPIN_LOCK SendLock
Definition: ndis56common.h:411
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:110

Referenced by DriverEntry().

◆ ParaNdis5_HandleDPC()

VOID NTAPI ParaNdis5_HandleDPC ( IN NDIS_HANDLE  MiniportAdapterContext)

Definition at line 1445 of file ParaNdis5-Impl.c.

1446 {
1447  PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
1448  ULONG requiresProcessing;
1449  BOOLEAN unused;
1450  DEBUG_ENTRY(7);
1451  // we do not need the timer, as DPC will do all the job
1452  // this is not a problem if the timer procedure is already running,
1453  // we need to do our job anyway
1455  requiresProcessing = ParaNdis_DPCWorkBody(pContext, PARANDIS_UNLIMITED_PACKETS_TO_INDICATE);
1456  if (requiresProcessing)
1457  {
1458  // we need to request additional DPC
1459  InterlockedOr(&pContext->InterruptStatus, requiresProcessing);
1460  NdisSetTimer(&pContext->DPCPostProcessTimer, 10);
1461  }
1462 }
#define PARANDIS_UNLIMITED_PACKETS_TO_INDICATE
Definition: ndis56common.h:128
NDIS_TIMER DPCPostProcessTimer
Definition: ndis56common.h:486
#define DEBUG_ENTRY(level)
Definition: kdebugprint.h:49
VOID EXPORT NdisSetTimer(IN PNDIS_TIMER Timer, IN UINT MillisecondsToDelay)
Definition: time.c:317
WORD unused[29]
Definition: crypt.c:1155
unsigned char BOOLEAN
#define InterlockedOr
Definition: interlocked.h:224
ULONG ParaNdis_DPCWorkBody(PARANDIS_ADAPTER *pContext, ULONG ulMaxPacketsToIndicate)
unsigned int ULONG
Definition: retypes.h:1
VOID EXPORT NdisCancelTimer(IN PNDIS_TIMER Timer, OUT PBOOLEAN TimerCancelled)
Definition: time.c:27

Referenced by DriverEntry().

◆ ParaNdis5_IndicateConnect()

VOID ParaNdis5_IndicateConnect ( PARANDIS_ADAPTER pContext,
BOOLEAN  bConnected 
)

◆ ParaNdis5_QueryOID()

NDIS_STATUS NTAPI ParaNdis5_QueryOID ( IN NDIS_HANDLE  MiniportAdapterContext,
IN NDIS_OID  Oid,
IN PVOID  InformationBuffer,
IN ULONG  InformationBufferLength,
OUT PULONG  BytesWritten,
OUT PULONG  BytesNeeded 
)

Definition at line 261 of file ParaNdis5-Oid.c.

267 {
269  tOidWhatToDo Rules;
270  PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
271  tOidDesc _oid;
272  ParaNdis_GetOidSupportRules(Oid, &Rules, OidsDB);
273  _oid.ulToDoFlags = Rules.Flags;
274  *BytesWritten = 0;
275  *BytesNeeded = 0;
276  ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, 0, 1);
277  DPrintf(Rules.nEntryLevel, ("[%s], id 0x%X(%s) of %d", __FUNCTION__,
278  Oid,
279  Rules.name,
280  InformationBufferLength));
281  _oid.Oid = Oid;
282  _oid.InformationBuffer = InformationBuffer;
283  _oid.InformationBufferLength = InformationBufferLength;
284  _oid.pBytesNeeded = (PUINT)BytesNeeded;
285  _oid.pBytesRead = (PUINT)BytesWritten;
288  else if (Rules.Flags & ohfQuery) status = ParaNdis_OidQuery(pContext, &_oid);
289 
290 
291  ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, status, 0);
293  ("[%s] , id 0x%X(%s) (%X), written %d, needed %d",
294  __FUNCTION__,
295  Rules.oid,
296  Rules.name,
297  status,
298  *BytesWritten,
299  *BytesNeeded));
300  return status;
301 
302 }
_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
UINT InformationBufferLength
Definition: ParaNdis-Oid.h:43
ULONG ulToDoFlags
Definition: ParaNdis-Oid.h:41
PVOID InformationBuffer
Definition: ParaNdis-Oid.h:42
int NDIS_STATUS
Definition: ntddndis.h:471
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
static const tOidWhatToDo OidsDB[]
#define DPrintf(Level, Fmt)
Definition: kdebugprint.h:61
const char * name
Definition: ParaNdis-Oid.h:60
static NDIS_STATUS ParaNdis_OidQuery(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
#define NDIS_STATUS_NOT_ACCEPTED
Definition: ndis.h:350
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
void ParaNdis_GetOidSupportRules(NDIS_OID oid, tOidWhatToDo *pRule, const tOidWhatToDo *Table)
Definition: ParaNdis-Oid.c:661
PUINT pBytesRead
Definition: ParaNdis-Oid.h:46
PUINT pBytesNeeded
Definition: ParaNdis-Oid.h:45
static void FORCEINLINE ParaNdis_DebugHistory(PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4)
Definition: ndis56common.h:647
NDIS_OID Oid
Definition: ParaNdis-Oid.h:40
#define NULL
Definition: types.h:112
PUINT pBytesWritten
Definition: ParaNdis-Oid.h:44
#define __FUNCTION__
Definition: types.h:112
static SERVICE_STATUS status
Definition: service.c:31
unsigned int * PUINT
Definition: ndis.h:50
Definition: ps.c:97

Referenced by DriverEntry().

◆ ParaNdis5_ReturnPacket()

VOID NTAPI ParaNdis5_ReturnPacket ( IN NDIS_HANDLE  MiniportAdapterContext,
IN PNDIS_PACKET  Packet 
)

Definition at line 1077 of file ParaNdis5-Impl.c.

1078 {
1079  PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
1080  pIONetDescriptor pBufferDescriptor;
1081  pBufferDescriptor = (pIONetDescriptor) *REF_MINIPORT(Packet);
1082  DPrintf(4, ("[%s] buffer %p", __FUNCTION__, pBufferDescriptor));
1083 
1084  NdisAcquireSpinLock(&pContext->ReceiveLock);
1085  pContext->ReuseBufferProc(pContext, pBufferDescriptor);
1086  NdisReleaseSpinLock(&pContext->ReceiveLock);
1087 }
NDIS_SPIN_LOCK ReceiveLock
Definition: ndis56common.h:412
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
VOID EXPORT NdisReleaseSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:239
#define DPrintf(Level, Fmt)
Definition: kdebugprint.h:61
#define REF_MINIPORT(Packet)
tReuseReceiveBufferProc ReuseBufferProc
Definition: ndis56common.h:438
VOID EXPORT NdisAcquireSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:135
#define __FUNCTION__
Definition: types.h:112
struct _tagIONetDescriptor * pIONetDescriptor

Referenced by DriverEntry().

◆ ParaNdis5_SendPackets()

VOID NTAPI ParaNdis5_SendPackets ( IN NDIS_HANDLE  MiniportAdapterContext,
IN PPNDIS_PACKET  PacketArray,
IN UINT  NumberOfPackets 
)

Definition at line 1243 of file ParaNdis5-Impl.c.

1246 {
1247  UINT i;
1248  LIST_ENTRY FailedList, DoneList;
1249  PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
1250  InitializeListHead(&FailedList);
1251  InitializeListHead(&DoneList);
1252  DPrintf(3, ("[%s] %d packets", __FUNCTION__, NumberOfPackets));
1254 
1255  NdisAcquireSpinLock(&pContext->SendLock);
1256 
1257  for (i = 0; i < NumberOfPackets; ++i)
1258  {
1259  UINT uPacketLength = 0;
1260  NdisQueryPacketLength(PacketArray[i], &uPacketLength);
1263  if (!pContext->bSurprizeRemoved && pContext->bConnected && pContext->SendState == srsEnabled && uPacketLength)
1264  {
1265  tSendEntry *pse = PrepareSendEntry(pContext, PacketArray[i], uPacketLength);
1266  if (!pse)
1267  {
1269  CompletePacket(pContext, PacketArray[i]);
1270  }
1271  else
1272  {
1273  UINT nFragments = 0;
1274  GET_NUMBER_OF_SG_ELEMENTS(PacketArray[i], &nFragments);
1275  ParaNdis_DebugHistory(pContext, hopSendPacketMapped, PacketArray[i], 0, nFragments, 0);
1276  InsertTailList(&pContext->SendQueue, &pse->list);
1277  }
1278  }
1279  else
1280  {
1284  CompletePacket(pContext, PacketArray[i]);
1285  DPrintf(1, ("[%s] packet of %d rejected", __FUNCTION__, uPacketLength));
1286  }
1287  }
1288 
1289  NdisReleaseSpinLock(&pContext->SendLock);
1290 
1291  ParaNdis_ProcessTx(pContext, FALSE, FALSE);
1292 }
_In_ PPNDIS_PACKET _In_ UINT NumberOfPackets
Definition: ndis.h:5120
BOOLEAN ParaNdis_ProcessTx(PARANDIS_ADAPTER *pContext, BOOLEAN IsDpc, BOOLEAN IsInterrupt)
LONG EXPORT NdisInterlockedIncrement(IN PLONG Addend)
Definition: misc.c:400
VOID EXPORT NdisReleaseSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:239
static FORCEINLINE void GET_NUMBER_OF_SG_ELEMENTS(PNDIS_PACKET Packet, UINT *pNum)
#define InsertTailList(ListHead, Entry)
int NDIS_STATUS
Definition: ntddndis.h:471
_In_ PPNDIS_PACKET PacketArray
Definition: ndis.h:5120
#define FALSE
Definition: types.h:117
#define DPrintf(Level, Fmt)
Definition: kdebugprint.h:61
tSendReceiveState SendState
Definition: ndis56common.h:434
#define NDIS_STATUS_NOT_ACCEPTED
Definition: ndis.h:350
VOID EXPORT NdisAcquireSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:135
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
static __inline tSendEntry * PrepareSendEntry(PARANDIS_ADAPTER *pContext, PNDIS_PACKET Packet, ULONG len)
#define NDIS_SET_PACKET_STATUS(_Packet, _Status)
Definition: ndis.h:3509
static void CompletePacket(PARANDIS_ADAPTER *pContext, PNDIS_PACKET Packet)
Definition: typedefs.h:119
static void FORCEINLINE ParaNdis_DebugHistory(PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4)
Definition: ndis56common.h:647
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 InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define NdisQueryPacketLength(_Packet, _TotalPacketLength)
Definition: ndis.h:3645
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
LIST_ENTRY list
#define __FUNCTION__
Definition: types.h:112
NDIS_SPIN_LOCK SendLock
Definition: ndis56common.h:411
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
Definition: ps.c:97

Referenced by DriverEntry().

◆ ParaNdis5_SetOID()

NDIS_STATUS NTAPI ParaNdis5_SetOID ( IN NDIS_HANDLE  MiniportAdapterContext,
IN NDIS_OID  Oid,
IN PVOID  InformationBuffer,
IN ULONG  InformationBufferLength,
OUT PULONG  BytesRead,
OUT PULONG  BytesNeeded 
)

Definition at line 311 of file ParaNdis5-Oid.c.

317 {
319  tOidWhatToDo Rules;
320  PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
321  tOidDesc _oid;
322  ParaNdis_GetOidSupportRules(Oid, &Rules, OidsDB);
323  _oid.ulToDoFlags = Rules.Flags;
324  *BytesRead = 0;
325  *BytesNeeded = 0;
326  ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, 1, 1);
327  DPrintf(Rules.nEntryLevel, ("[%s], id 0x%X(%s) of %d", __FUNCTION__,
328  Oid,
329  Rules.name,
330  InformationBufferLength));
331  _oid.Oid = Oid;
332  _oid.InformationBuffer = InformationBuffer;
333  _oid.InformationBufferLength = InformationBufferLength;
334  _oid.pBytesNeeded = (PUINT)BytesNeeded;
335  _oid.pBytesRead = (PUINT)BytesRead;
336  _oid.pBytesWritten = (PUINT)BytesRead;
338  else if (Rules.Flags & ohfSet)
339  {
340  if (Rules.OidSetProc) status = Rules.OidSetProc(pContext, &_oid);
341  else
342  {
343  DPrintf(0, ("[%s] ERROR in OID redirection table", __FUNCTION__));
345  }
346  }
347  ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, status, 0);
349  {
351  ("[%s] , id 0x%X(%s) (%X), read %d, needed %d", __FUNCTION__,
352  Rules.oid, Rules.name, status, *BytesRead, *BytesNeeded));
353  }
354  return status;
355 }
#define NDIS_STATUS_INVALID_OID
Definition: ndis.h:488
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
UINT InformationBufferLength
Definition: ParaNdis-Oid.h:43
ULONG ulToDoFlags
Definition: ParaNdis-Oid.h:41
PVOID InformationBuffer
Definition: ParaNdis-Oid.h:42
OIDHANDLERPROC OidSetProc
Definition: ParaNdis-Oid.h:59
_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:471
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
static const tOidWhatToDo OidsDB[]
#define DPrintf(Level, Fmt)
Definition: kdebugprint.h:61
const char * name
Definition: ParaNdis-Oid.h:60
#define NDIS_STATUS_NOT_ACCEPTED
Definition: ndis.h:350
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
void ParaNdis_GetOidSupportRules(NDIS_OID oid, tOidWhatToDo *pRule, const tOidWhatToDo *Table)
Definition: ParaNdis-Oid.c:661
PUINT pBytesRead
Definition: ParaNdis-Oid.h:46
PUINT pBytesNeeded
Definition: ParaNdis-Oid.h:45
static void FORCEINLINE ParaNdis_DebugHistory(PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4)
Definition: ndis56common.h:647
NDIS_OID Oid
Definition: ParaNdis-Oid.h:40
#define NULL
Definition: types.h:112
PUINT pBytesWritten
Definition: ParaNdis-Oid.h:44
#define __FUNCTION__
Definition: types.h:112
static SERVICE_STATUS status
Definition: service.c:31
unsigned int * PUINT
Definition: ndis.h:50
Definition: ps.c:97

Referenced by DriverEntry().

◆ ParaNdis5_StopReceive()

NDIS_STATUS ParaNdis5_StopReceive ( PARANDIS_ADAPTER pContext,
BOOLEAN  bStop,
ONPAUSECOMPLETEPROC  Callback 
)

Definition at line 1410 of file ParaNdis5-Impl.c.

1415 {
1417  if (bStop)
1418  {
1419  ParaNdis_DebugHistory(pContext, hopInternalReceivePause, NULL, 1, 0, 0);
1420  NdisAcquireSpinLock(&pContext->ReceiveLock);
1421  if (IsListEmpty(&pContext->NetReceiveBuffersWaiting))
1422  {
1423  pContext->ReceiveState = srsDisabled;
1424  ParaNdis_DebugHistory(pContext, hopInternalReceivePause, NULL, 0, 0, 0);
1425  }
1426  else
1427  {
1428  pContext->ReceiveState = srsPausing;
1431  }
1432  NdisReleaseSpinLock(&pContext->ReceiveLock);
1433  }
1434  else
1435  {
1436  pContext->ReceiveState = srsEnabled;
1438  }
1439  return status;
1440 }
tSendReceiveState ReceiveState
Definition: ndis56common.h:435
NDIS_SPIN_LOCK ReceiveLock
Definition: ndis56common.h:412
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
VOID EXPORT NdisReleaseSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:239
LIST_ENTRY NetReceiveBuffersWaiting
Definition: ndis56common.h:448
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
int NDIS_STATUS
Definition: ntddndis.h:471
VOID EXPORT NdisAcquireSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:135
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
static void FORCEINLINE ParaNdis_DebugHistory(PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4)
Definition: ndis56common.h:647
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:456
ONPAUSECOMPLETEPROC ReceivePauseCompletionProc
Definition: ndis56common.h:437
#define NULL
Definition: types.h:112
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by ParaNdis5_Halt(), ParaNdis5_Initialize(), ParaNdis_Resume(), and ParaNdis_Suspend().

◆ ParaNdis5_StopSend()

NDIS_STATUS ParaNdis5_StopSend ( PARANDIS_ADAPTER pContext,
BOOLEAN  bStop,
ONPAUSECOMPLETEPROC  Callback 
)

Definition at line 1348 of file ParaNdis5-Impl.c.

1349 {
1351  if (bStop)
1352  {
1353  LIST_ENTRY DoneList;
1354  tSendEntry *pEntry;
1355  DEBUG_ENTRY(0);
1356  ParaNdis_DebugHistory(pContext, hopInternalSendPause, NULL, 1, 0, 0);
1357  InitializeListHead(&DoneList);
1358  NdisAcquireSpinLock(&pContext->SendLock);
1359  if (IsListEmpty(&pContext->TxWaitingList))
1360  {
1361  pContext->SendState = srsDisabled;
1362  while (!IsListEmpty(&pContext->SendQueue))
1363  {
1364  pEntry = (tSendEntry *)RemoveHeadList(&pContext->SendQueue);
1365  InsertTailList(&DoneList, &pEntry->list);
1366  }
1367  ParaNdis_DebugHistory(pContext, hopInternalSendPause, NULL, 0, 0, 0);
1368  }
1369  else
1370  {
1371  pContext->SendState = srsPausing;
1372  pContext->SendPauseCompletionProc = Callback;
1374  while (!IsListEmpty(&pContext->SendQueue))
1375  {
1376  pEntry = (tSendEntry *)RemoveHeadList(&pContext->SendQueue);
1377  pEntry->flags |= SEND_ENTRY_FLAG_READY;
1378  InsertTailList(&pContext->TxWaitingList, &pEntry->list);
1379  }
1380  }
1381 
1382  NdisReleaseSpinLock(&pContext->SendLock);
1383  while (!IsListEmpty(&DoneList))
1384  {
1385  pEntry = (tSendEntry *)RemoveHeadList(&DoneList);
1387  CompletePacket(pContext, pEntry->packet);
1388  NdisFreeMemory(pEntry, 0, 0);
1389  }
1390  }
1391  else
1392  {
1393  pContext->SendState = srsEnabled;
1394  ParaNdis_DebugHistory(pContext, hopInternalSendResume, NULL, 0, 0, 0);
1395  }
1396  return status;
1397 }
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
VOID EXPORT NdisReleaseSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:239
#define DEBUG_ENTRY(level)
Definition: kdebugprint.h:49
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
int NDIS_STATUS
Definition: ntddndis.h:471
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
#define SEND_ENTRY_FLAG_READY
LIST_ENTRY TxWaitingList
Definition: ndis56common.h:483
#define NDIS_STATUS_REQUEST_ABORTED
Definition: ndis.h:476
tSendReceiveState SendState
Definition: ndis56common.h:434
VOID EXPORT NdisAcquireSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:135
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NDIS_SET_PACKET_STATUS(_Packet, _Status)
Definition: ndis.h:3509
static void CompletePacket(PARANDIS_ADAPTER *pContext, PNDIS_PACKET Packet)
Definition: typedefs.h:119
static void FORCEINLINE ParaNdis_DebugHistory(PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4)
Definition: ndis56common.h:647
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:456
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define NULL
Definition: types.h:112
ONPAUSECOMPLETEPROC SendPauseCompletionProc
Definition: ndis56common.h:436
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
static SERVICE_STATUS status
Definition: service.c:31
NDIS_SPIN_LOCK SendLock
Definition: ndis56common.h:411
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:110
Definition: ps.c:97

Referenced by ParaNdis5_Halt(), ParaNdis5_Initialize(), ParaNdis_Resume(), and ParaNdis_Suspend().