From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Sun, 1 Mar 2015 11:07:37 -0700 Subject: [U-Boot] [RFC PATCH v4 19/23] sandbox: eth: Add ability to disable ping reply in sandbox eth driver In-Reply-To: <1424822552-4366-20-git-send-email-joe.hershberger@ni.com> References: <1423618233-11397-1-git-send-email-joe.hershberger@ni.com> <1424822552-4366-1-git-send-email-joe.hershberger@ni.com> <1424822552-4366-20-git-send-email-joe.hershberger@ni.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Joe, On 24 February 2015 at 17:02, Joe Hershberger wrote: > This is needed to test the netretry functionality (make the command fail > on a sandbox eth device). > > Signed-off-by: Joe Hershberger > 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