[edk2-devel] [PATCH] UsbNetworkPkg: add USB network devices support

Rebecca Cran quic_rcran at quicinc.com
Mon Dec 5 03:14:39 UTC 2022


On 9/1/22 23:24, RichardHo [何明忠] via groups.io wrote:
> +  DataLength = (UINTN)(Cpb->DataLen + (UINT32)Cpb->MediaheaderLen);
> +
> +  while (1) {
> +    if (Counter >= 3) {
> +      StatCode = PXE_STATCODE_BUSY;
> +      break;
> +    }
> +
> +    Status = Nic->UsbEth->UsbEthTransmit (Cdb, Nic->UsbEth, (VOID *)(UINTN)BulkOutData, &DataLength);
> +    if (EFI_ERROR (Status)) {
> +      StatCode =  PXE_STATFLAGS_COMMAND_FAILED;
> +    }
> +
> +    if (Status == EFI_INVALID_PARAMETER) {
> +      StatCode = PXE_STATCODE_INVALID_PARAMETER;
> +      break;
> +    }
> +
> +    if (Status == EFI_DEVICE_ERROR) {
> +      StatCode = PXE_STATCODE_DEVICE_FAILURE;
> +      break;
> +    }
> +
> +    if (!EFI_ERROR (Status)) {
> +      Nic->TxFrame++;
> +      StatCode = PXE_STATCODE_SUCCESS;
> +      break;
> +    }
> +
> +    Counter++;
> +  }

You need to set DataLength inside the while loop, otherwise on 
subsequent iterations DataLength will be whatever value UsbEthTransmit 
just set it to, which will likely be 0 since an error occurred.

-- 
Rebecca Cran


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96935): https://edk2.groups.io/g/devel/message/96935
Mute This Topic: https://groups.io/mt/93121092/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list