ReactOS 0.4.15-dev-8413-gc1c91f2
send.c File Reference
#include "nic.h"
#include <debug.h>
Include dependency graph for send.c:

Go to the source code of this file.

Functions

static NDIS_STATUS NICTransmitPacket (_In_ PE1000_ADAPTER Adapter, _In_ PHYSICAL_ADDRESS PhysicalAddress, _In_ ULONG Length)
 
NDIS_STATUS NTAPI MiniportSend (_In_ NDIS_HANDLE MiniportAdapterContext, _In_ PNDIS_PACKET Packet, _In_ UINT Flags)
 

Function Documentation

◆ MiniportSend()

NDIS_STATUS NTAPI MiniportSend ( _In_ NDIS_HANDLE  MiniportAdapterContext,
_In_ PNDIS_PACKET  Packet,
_In_ UINT  Flags 
)

Definition at line 49 of file send.c.

53{
54 PE1000_ADAPTER Adapter = (PE1000_ADAPTER)MiniportAdapterContext;
56 ULONG TransmitLength;
57 PHYSICAL_ADDRESS TransmitBuffer;
59
61
62 ASSERT(sgList != NULL);
63 ASSERT(sgList->NumberOfElements == 1);
64 ASSERT((sgList->Elements[0].Address.LowPart & 3) == 0);
65 ASSERT(sgList->Elements[0].Length <= MAXIMUM_FRAME_SIZE);
66
67 if (Adapter->TxFull)
68 {
69 NDIS_DbgPrint(MIN_TRACE, ("All TX descriptors are full\n"));
71 }
72
73 TransmitLength = sgList->Elements[0].Length;
74 TransmitBuffer = sgList->Elements[0].Address;
75 Adapter->TransmitPackets[Adapter->CurrentTxDesc] = Packet;
76
77 Status = NICTransmitPacket(Adapter, TransmitBuffer, TransmitLength);
79 {
80 NDIS_DbgPrint(MIN_TRACE, ("Transmit packet failed\n"));
81 return Status;
82 }
83
85}
#define MIN_TRACE
Definition: debug.h:14
#define NULL
Definition: types.h:112
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
static NDIS_STATUS NICTransmitPacket(_In_ PE1000_ADAPTER Adapter, _In_ PHYSICAL_ADDRESS PhysicalAddress, _In_ ULONG Length)
Definition: send.c:15
#define MAXIMUM_FRAME_SIZE
Definition: nic.h:19
struct _E1000_ADAPTER * PE1000_ADAPTER
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1549
#define NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, InfoType)
Definition: ndis.h:1351
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
@ ScatterGatherListPacketInfo
Definition: ndis.h:1183
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
int NDIS_STATUS
Definition: ntddndis.h:475
BOOLEAN TxFull
Definition: nic.h:81
PNDIS_PACKET TransmitPackets[NUM_TRANSMIT_DESCRIPTORS]
Definition: nic.h:77
ULONG CurrentTxDesc
Definition: nic.h:79
uint32_t ULONG
Definition: typedefs.h:59
struct _SCATTER_GATHER_LIST * PSCATTER_GATHER_LIST
Definition: iotypes.h:2204

◆ NICTransmitPacket()

static NDIS_STATUS NICTransmitPacket ( _In_ PE1000_ADAPTER  Adapter,
_In_ PHYSICAL_ADDRESS  PhysicalAddress,
_In_ ULONG  Length 
)
static

Definition at line 15 of file send.c.

19{
20 volatile PE1000_TRANSMIT_DESCRIPTOR TransmitDescriptor;
21
22 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
23
24 TransmitDescriptor = Adapter->TransmitDescriptors + Adapter->CurrentTxDesc;
25 TransmitDescriptor->Address = PhysicalAddress.QuadPart;
26 TransmitDescriptor->Length = Length;
27 TransmitDescriptor->ChecksumOffset = 0;
28 TransmitDescriptor->Command = E1000_TDESC_CMD_RS | E1000_TDESC_CMD_IFCS |
30 TransmitDescriptor->Status = 0;
31 TransmitDescriptor->ChecksumStartField = 0;
32 TransmitDescriptor->Special = 0;
33
34 Adapter->CurrentTxDesc = (Adapter->CurrentTxDesc + 1) % NUM_TRANSMIT_DESCRIPTORS;
35
36 E1000WriteUlong(Adapter, E1000_REG_TDT, Adapter->CurrentTxDesc);
37
38 if (Adapter->CurrentTxDesc == Adapter->LastTxDesc)
39 {
40 NDIS_DbgPrint(MID_TRACE, ("All TX descriptors are full now\n"));
41 Adapter->TxFull = TRUE;
42 }
43
45}
#define MID_TRACE
Definition: debug.h:15
#define MAX_TRACE
Definition: debug.h:16
#define TRUE
Definition: types.h:120
FORCEINLINE VOID E1000WriteUlong(_In_ PE1000_ADAPTER Adapter, _In_ ULONG Address, _In_ ULONG Value)
Definition: nic.h:219
#define E1000_TDESC_CMD_EOP
Definition: e1000hw.h:82
#define E1000_REG_TDT
Definition: e1000hw.h:141
#define E1000_TDESC_CMD_IDE
Definition: e1000hw.h:79
#define E1000_TDESC_CMD_RS
Definition: e1000hw.h:80
#define E1000_TDESC_CMD_IFCS
Definition: e1000hw.h:81
#define NUM_TRANSMIT_DESCRIPTORS
Definition: e1000hw.h:108
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098

Referenced by MiniportSend().