[U-Boot] [PATCH 02/10] net: sandbox: Refactor sandbox send function

Bin Meng bmeng.cn at gmail.com
Tue Sep 25 08:22:01 UTC 2018


Hi Joe,

On Wed, Jul 25, 2018 at 5:46 AM Joe Hershberger <joe.hershberger at ni.com> wrote:
>
> Make the behavior of the send function reusable.
>
> Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
> ---
>
>  arch/sandbox/include/asm/eth.h |  20 +++++
>  drivers/net/sandbox.c          | 176 ++++++++++++++++++++++++-----------------
>  2 files changed, 124 insertions(+), 72 deletions(-)
>
> diff --git a/arch/sandbox/include/asm/eth.h b/arch/sandbox/include/asm/eth.h
> index bfcd11b593..00062616a4 100644
> --- a/arch/sandbox/include/asm/eth.h
> +++ b/arch/sandbox/include/asm/eth.h
> @@ -13,4 +13,24 @@ void sandbox_eth_disable_response(int index, bool disable);
>
>  void sandbox_eth_skip_timeout(void);
>
> +/*
> + * sandbox_eth_arp_req_to_reply()
> + *
> + * Check for an arp request to be sent. If so, inject a reply
> + *
> + * returns 1 if injected, 0 if not

The meaning of return code 1/0 seems odd. Normally 0 means OK. Can we
use -Exxx for the error condition?

> + */
> +int sandbox_eth_arp_req_to_reply(struct udevice *dev, void *packet,
> +                                unsigned int len);
> +
> +/*
> + * sandbox_eth_ping_req_to_reply()
> + *
> + * Check for a ping request to be sent. If so, inject a reply
> + *
> + * returns 1 if injected, 0 if not
> + */
> +int sandbox_eth_ping_req_to_reply(struct udevice *dev, void *packet,
> +                                 unsigned int len);
> +
>  #endif /* __ETH_H */

[snip]

Regards,
Bin


More information about the U-Boot mailing list