mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-28 08:35:38 +00:00
efi_selftest: Receive the packets until the receive buffer is empty
Repeatedly receive the packets until the receive buffer is empty. If the buffer is empty, EFI_SIMPLE_NETWORK_PROTOCOL::Receive() returns EFI_NOT_READY. We don't need to use the wait_for_event() every time. Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
9845b92436
commit
28fc87ee3a
1 changed files with 38 additions and 31 deletions
|
@ -362,11 +362,17 @@ static int execute(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Receive packet
|
* Receive packets until buffer is empty
|
||||||
*/
|
*/
|
||||||
|
for (;;) {
|
||||||
buffer_size = sizeof(buffer);
|
buffer_size = sizeof(buffer);
|
||||||
ret = net->receive(net, NULL, &buffer_size, &buffer,
|
ret = net->receive(net, NULL, &buffer_size, &buffer,
|
||||||
&srcaddr, &destaddr, NULL);
|
&srcaddr, &destaddr, NULL);
|
||||||
|
if (ret == EFI_NOT_READY) {
|
||||||
|
/* The received buffer is empty. */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret != EFI_SUCCESS) {
|
if (ret != EFI_SUCCESS) {
|
||||||
efi_st_error("Failed to receive packet");
|
efi_st_error("Failed to receive packet");
|
||||||
return EFI_ST_FAILURE;
|
return EFI_ST_FAILURE;
|
||||||
|
@ -392,9 +398,10 @@ static int execute(void)
|
||||||
/*
|
/*
|
||||||
* We successfully received a DHCP reply.
|
* We successfully received a DHCP reply.
|
||||||
*/
|
*/
|
||||||
break;
|
goto received;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
received:
|
||||||
/*
|
/*
|
||||||
* Write a log message.
|
* Write a log message.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue