/* This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk in. */
EFI_STATUS EFIAPI UsbEthEcmReceive(IN PXE_CDB *Cdb, IN EDKII_USB_ETHERNET_PROTOCOL *This, IN OUT VOID *Packet, IN OUT UINTN *PacketLength)
/* This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk in. */
EFI_STATUS EFIAPI UsbEthEcmReceive(IN PXE_CDB *Cdb, IN EDKII_USB_ETHERNET_PROTOCOL *This, IN OUT VOID *Packet, IN OUT UINTN *PacketLength)
{
  EFI_STATUS           Status;
  USB_ETHERNET_DRIVER  *UsbEthDriver;
  EFI_USB_IO_PROTOCOL  *UsbIo;
  UINT32               TransStatus;
  UsbEthDriver = USB_ETHERNET_DEV_FROM_THIS (This);
  Status = gBS->HandleProtocol (
                  UsbEthDriver->UsbCdcDataHandle,
                  &gEfiUsbIoProtocolGuid,
                  (VOID **)&UsbIo
                  );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  if (UsbEthDriver->BulkInEndpoint == 0) {
    GetEndpoint (UsbIo, UsbEthDriver);
  }
  Status = UsbIo->UsbBulkTransfer (
                    UsbIo,
                    UsbEthDriver->BulkInEndpoint,
                    Packet,
                    PacketLength,
                    USB_ETHERNET_BULK_TIMEOUT,
                    &TransStatus
                    );
  return Status;
}