ReactOS 0.4.16-dev-122-g325d74c
sendrcv.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS DC21x4 Driver
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Send and receive definitions
5 * COPYRIGHT: Copyright 2023 Dmitry Borisov <di.sean@protonmail.com>
6 */
7
8#pragma once
9
10#define DC_LIST_ENTRY_FROM_PACKET(Packet) \
11 ((PLIST_ENTRY)(&(Packet)->MiniportReservedEx[0]))
12
13#define DC_PACKET_FROM_LIST_ENTRY(ListEntry) \
14 (CONTAINING_RECORD(ListEntry, NDIS_PACKET, MiniportReservedEx))
15
16#define DC_RCB_FROM_PACKET(Packet) \
17 ((PDC_RCB*)&(Packet)->MiniportReservedEx[0])
18
19#define DC_RBD_FROM_PACKET(Packet) \
20 ((PDC_RBD*)&(Packet)->MiniportReservedEx[sizeof(PVOID)])
21
22typedef struct _DC_COALESCE_BUFFER
23{
24 /* Must be the first entry */
26
30
31typedef struct _DC_TCB
32{
38
39typedef struct _DC_RCB
40{
41 /* Must be the first entry */
43
46#define DC_RCB_FLAG_RECLAIM 0x80000000
47
55
57VOID
59 _In_ PDC21X4_ADAPTER Adapter,
60 _In_ PDC_TCB Tcb)
61{
62 if (Tcb->Buffer)
63 {
64 PushEntryList(&Adapter->SendBufferList, &Tcb->Buffer->ListEntry);
65 }
66
67 ++Adapter->TcbSlots;
68
69 Adapter->TbdSlots += Tcb->SlotsUsed;
70}
71
75 _In_ PDC21X4_ADAPTER Adapter,
76 _In_ PDC_TCB Tcb)
77{
78 if (Tcb++ == Adapter->TailTcb)
79 return Adapter->HeadTcb;
80 else
81 return Tcb;
82}
83
87 _In_ PDC21X4_ADAPTER Adapter,
88 _In_ PDC_TBD Tbd)
89{
90 if (Tbd++ == Adapter->TailTbd)
91 return Adapter->HeadTbd;
92 else
93 return Tbd;
94}
95
99 _In_ PDC21X4_ADAPTER Adapter,
100 _In_ PDC_RBD Rbd)
101{
102 if (Rbd++ == Adapter->TailRbd)
103 return Adapter->HeadRbd;
104 else
105 return Rbd;
106}
107
109PDC_RCB*
111 _In_ PDC21X4_ADAPTER Adapter,
112 _In_ PDC_RBD Rbd)
113{
114 return Adapter->RcbArray + (((ULONG_PTR)(Rbd - Adapter->HeadRbd)));
115}
#define ULONG_PTR
Definition: config.h:101
#define _In_
Definition: ms_sal.h:308
MDL * PNDIS_BUFFER
Definition: ndis.h:343
struct _DC_RCB * PDC_RCB
struct _DC_COALESCE_BUFFER DC_COALESCE_BUFFER
struct _DC_TCB * PDC_TCB
FORCEINLINE PDC_TBD DC_NEXT_TBD(_In_ PDC21X4_ADAPTER Adapter, _In_ PDC_TBD Tbd)
Definition: sendrcv.h:86
struct _DC_TCB DC_TCB
struct _DC_COALESCE_BUFFER * PDC_COALESCE_BUFFER
FORCEINLINE PDC_TCB DC_NEXT_TCB(_In_ PDC21X4_ADAPTER Adapter, _In_ PDC_TCB Tcb)
Definition: sendrcv.h:74
struct _DC_RCB DC_RCB
FORCEINLINE PDC_RBD DC_NEXT_RBD(_In_ PDC21X4_ADAPTER Adapter, _In_ PDC_RBD Rbd)
Definition: sendrcv.h:98
FORCEINLINE PDC_RCB * DC_GET_RCB_SLOT(_In_ PDC21X4_ADAPTER Adapter, _In_ PDC_RBD Rbd)
Definition: sendrcv.h:110
FORCEINLINE VOID DC_RELEASE_TCB(_In_ PDC21X4_ADAPTER Adapter, _In_ PDC_TCB Tcb)
Definition: sendrcv.h:58
PVOID VirtualAddress
Definition: sendrcv.h:27
SINGLE_LIST_ENTRY ListEntry
Definition: sendrcv.h:25
ULONG PhysicalAddress
Definition: sendrcv.h:28
PVOID VirtualAddressOriginal
Definition: sendrcv.h:51
PNDIS_BUFFER NdisBuffer
Definition: sendrcv.h:49
SINGLE_LIST_ENTRY ListEntry
Definition: sendrcv.h:42
NDIS_PHYSICAL_ADDRESS PhysicalAddressOriginal
Definition: sendrcv.h:52
PNDIS_PACKET Packet
Definition: sendrcv.h:48
SINGLE_LIST_ENTRY AllocListEntry
Definition: sendrcv.h:53
PVOID VirtualAddress
Definition: sendrcv.h:50
ULONG PhysicalAddress
Definition: sendrcv.h:44
ULONG Flags
Definition: sendrcv.h:45
ULONG SlotsUsed
Definition: sendrcv.h:36
PDC_COALESCE_BUFFER Buffer
Definition: sendrcv.h:35
PDC_TBD Tbd
Definition: sendrcv.h:33
PNDIS_PACKET Packet
Definition: sendrcv.h:34
Definition: ntbasedef.h:628
uint32_t ULONG
Definition: typedefs.h:59
#define FORCEINLINE
Definition: wdftypes.h:67
FORCEINLINE VOID PushEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY Entry)
Definition: rtlfuncs.h:253