66 IN UINT16 *Protocol OPTIONAL
76 if ((This ==
NULL) || (BufferSize == 0) || (Buffer ==
NULL)) {
77 return EFI_INVALID_PARAMETER;
80 Dev = VIRTIO_NET_FROM_SNP (This);
81 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
82 switch (Dev->Snm.
State) {
83 case EfiSimpleNetworkStopped:
84 Status = EFI_NOT_STARTED;
86 case EfiSimpleNetworkStarted:
87 Status = EFI_DEVICE_ERROR;
93 if (BufferSize < Dev->Snm.MediaHeaderSize) {
94 Status = EFI_BUFFER_TOO_SMALL;
99 Status = EFI_INVALID_PARAMETER;
106 ASSERT (Dev->TxCurPending <= Dev->TxMaxPending);
107 if (Dev->TxCurPending == Dev->TxMaxPending) {
108 Status = EFI_NOT_READY;
116 if (HeaderSize != 0) {
120 (DestAddr ==
NULL) || (Protocol ==
NULL))
122 Status = EFI_INVALID_PARAMETER;
129 CopyMem (Ptr, DestAddr, SIZE_OF_VNET (Mac));
130 Ptr += SIZE_OF_VNET (Mac);
137 Ptr += SIZE_OF_VNET (Mac);
139 *Ptr++ = (UINT8)(*Protocol >> 8);
140 *Ptr++ = (UINT8)*Protocol;
154 if (EFI_ERROR (Status)) {
155 Status = EFI_DEVICE_ERROR;
162 DescIdx = Dev->TxFreeStack[Dev->TxCurPending++];
163 Dev->TxRing.Desc[DescIdx + 1].Addr = DeviceAddress;
164 Dev->TxRing.Desc[DescIdx + 1].Len = (UINT32)BufferSize;
170 AvailIdx = *Dev->TxRing.Avail.Idx;
171 Dev->TxRing.Avail.Ring[AvailIdx++ % Dev->TxRing.QueueSize] = DescIdx;
174 *Dev->TxRing.Avail.Idx = AvailIdx;
177 Status = Dev->VirtIo->SetQueueNotify (Dev->VirtIo, VIRTIO_NET_Q_TX);
180 gBS->RestoreTPL (OldTpl);
VOID EFIAPI MemoryFence(VOID)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
EFI_STATUS EFIAPI VirtioNetMapTxBuf(IN VNET_DEV *Dev, IN VOID *Buffer, IN UINTN NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress)
EFI_STATUS EFIAPI VirtioNetTransmit(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINTN HeaderSize, IN UINTN BufferSize, IN VOID *Buffer, IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, IN UINT16 *Protocol OPTIONAL)
VOID EFIAPI Exit(IN EFI_STATUS Status)
UINT64 EFI_PHYSICAL_ADDRESS
EFI_MAC_ADDRESS CurrentAddress