Hi Rebecca,

Thanks for your response. I will fixed it next.

Thanks,
Richard

-----Original Message-----
From: Rebecca Cran <rebe...@quicinc.com>
Sent: 2022年12月5日 11:15 AM
To: devel@edk2.groups.io; Richard Ho (何明忠) <richar...@ami.com>
Cc: Andrew Fish <af...@apple.com>; Leif Lindholm <quic_llind...@quicinc.com>; 
Michael D Kinney <michael.d.kin...@intel.com>; Michael Kubacki 
<michael.kuba...@microsoft.com>; Zhiguang Liu <zhiguang....@intel.com>; Liming 
Gao <gaolim...@byosoft.com.cn>; Tony Lo (羅金松) <ton...@ami.com>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] UsbNetworkPkg: add USB network 
devices support


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

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
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97014): https://edk2.groups.io/g/devel/message/97014
Mute This Topic: https://groups.io/mt/93121092/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to