public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Rebecca Cran" <quic_rcran@quicinc.com>
To: <devel@edk2.groups.io>, <richardho@ami.com>
Cc: "Andrew Fish" <afish@apple.com>,
	"Leif Lindholm" <quic_llindhol@quicinc.com>,
	"Michael D Kinney" <michael.d.kinney@intel.com>,
	"Michael Kubacki" <michael.kubacki@microsoft.com>,
	"Zhiguang Liu" <zhiguang.liu@intel.com>,
	"Liming Gao" <gaoliming@byosoft.com.cn>,
	"TonyLo [羅金松]" <TonyLo@ami.com>
Subject: Re: [edk2-devel] [PATCH] UsbNetworkPkg: add USB network devices support
Date: Sun, 4 Dec 2022 20:14:39 -0700	[thread overview]
Message-ID: <e4242f70-b3e3-92ed-1fc2-25ddb7e4fce5@quicinc.com> (raw)
In-Reply-To: <20220902052418.2253-1-richardho@ami.com>

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

  parent reply	other threads:[~2022-12-05  3:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02  5:24 [PATCH] UsbNetworkPkg: add USB network devices support RichardHo [何明忠]
2022-09-02 21:48 ` [edk2-devel] " Rebecca Cran
2022-09-09  7:06   ` Chang, Abner
2022-09-12  3:48     ` RichardHo [何明忠]
2022-09-12  7:55       ` Chang, Abner
2022-09-21  2:34         ` RichardHo [何明忠]
2022-09-22 12:52           ` Chang, Abner
2022-09-06 15:05 ` Rebecca Cran
2022-09-07  5:31   ` RichardHo [何明忠]
2022-09-07 17:46     ` Rebecca Cran
2022-09-23  5:03     ` 回复: " gaoliming
2022-09-23  5:54       ` RichardHo [何明忠]
2022-09-23  7:17         ` 回复: " gaoliming
2022-11-26 18:56 ` Rebecca Cran
2022-11-28  5:24   ` RichardHo [何明忠]
2022-12-05  3:14 ` Rebecca Cran [this message]
2022-12-06  9:15   ` RichardHo [何明忠]
  -- strict thread matches above, loose matches on Subject: below --
2022-08-31  7:51 RichardHo [何明忠]
2022-08-31 13:28 ` [edk2-devel] " Rebecca Cran
2022-09-01  2:51   ` RichardHo [何明忠]
2022-09-01  9:05     ` Chang, Abner
2022-09-01 10:47       ` RichardHo [何明忠]
2022-09-01 12:38     ` Rebecca Cran
2022-08-31  2:31 RichardHo [何明忠]
2022-08-31 12:15 ` [edk2-devel] " Rebecca Cran
2022-08-19  9:17 richardho
2022-08-19 15:54 ` [edk2-devel] " Pedro Falcato
2022-08-19 15:56   ` Pedro Falcato
2022-08-29 10:57     ` RichardHo [何明忠]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e4242f70-b3e3-92ed-1fc2-25ddb7e4fce5@quicinc.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox