[U-Boot] [RFC PATCH v4 19/23] sandbox: eth: Add ability to disable ping reply in sandbox eth driver

Simon Glass sjg at chromium.org
Sun Mar 1 19:07:37 CET 2015


Hi Joe,

On 24 February 2015 at 17:02, Joe Hershberger <joe.hershberger at ni.com> wrote:
> This is needed to test the netretry functionality (make the command fail
> on a sandbox eth device).
>
> Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
>

Rather than using environment variables to communicate, you should use
a function call into this code. See arch/sandbox/include/asm/test.h.

Or you can create a state function and update the state (see state.h)
if you want it to affect more than one driver.

> ---
>
> Changes in v4:
> -Add ability to disable ping reply in sandbox eth driver
>
> Changes in v3: None
> Changes in v2: None
>
>  drivers/net/sandbox.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c
> index 81362e6..28fe09a 100644
> --- a/drivers/net/sandbox.c
> +++ b/drivers/net/sandbox.c
> @@ -49,9 +49,14 @@ static int sb_eth_send(struct udevice *dev, void *packet, int length)
>  {
>         struct eth_sandbox_priv *priv = dev_get_priv(dev);
>         struct ethernet_hdr *eth = packet;
> +       char varname[32];
>
>         debug("eth_sandbox: Send packet %d\n", length);
>
> +       sprintf(varname, "eth_sandbox_disable_%d", dev->seq);
> +       if (getenv_yesno(varname) > 0)
> +               return 0;
> +
>         if (ntohs(eth->et_protlen) == PROT_ARP) {
>                 struct arp_hdr *arp = packet + ETHER_HDR_SIZE;
>
> --
> 1.7.11.5
>

Regards,
Simon


More information about the U-Boot mailing list