[U-Boot] [PATCH v2 11/17] efi_loader: implement WaitForPacket event

Alexander Graf agraf at suse.de
Fri Oct 6 11:56:31 UTC 2017



On 05.10.17 16:36, Heinrich Schuchardt wrote:
> The WaitForPacket event informs that a network package has been
> received by the SimpleNetworkProtocol.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> v2
> 	signaled has been renamed to is_signaled and is bool
> ---
>  lib/efi_loader/efi_net.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
> index 3498b96f7a..f63db686af 100644
> --- a/lib/efi_loader/efi_net.c
> +++ b/lib/efi_loader/efi_net.c
> @@ -24,6 +24,10 @@ static void *new_tx_packet;
>   * to check if a new network packet has been received.
>   */
>  static struct efi_event *network_timer_event;
> +/*
> + * This event is signaled when a packet has been received.
> + */
> +static struct efi_event *wait_for_packet;
>  
>  struct efi_net_obj {
>  	/* Generic EFI object parent class data */
> @@ -227,6 +231,8 @@ static void EFIAPI efi_network_timer_notify(struct efi_event *event,
>  		eth_rx();
>  		push_packet = NULL;
>  	}
> +	if (!new_rx_packet)
> +		wait_for_packet->is_signaled = true;

Shouldn't that be if (new_rx_packet)? You want to know whether eth_rx()
received something, no?

In fact, why don't you just move this whole line into efi_net_push()?


Alex

>  	EFI_EXIT(EFI_SUCCESS);
>  }
>  
> @@ -280,6 +286,17 @@ int efi_net_register(void)
>  	/* Hook net up to the device list */
>  	list_add_tail(&netobj->parent.link, &efi_obj_list);
>  
> +	/*
> +	 * Create WaitForPacket event.
> +	 */
> +	r = efi_create_event(EVT_NOTIFY_WAIT, TPL_CALLBACK,
> +			     efi_network_timer_notify, NULL,
> +			     &wait_for_packet);
> +	if (r != EFI_SUCCESS) {
> +		printf("ERROR: Failed to register network event\n");
> +		return r;
> +	}
> +	netobj->net.wait_for_packet = wait_for_packet;
>  	/*
>  	 * Create a timer event.
>  	 *
> 


More information about the U-Boot mailing list