diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2015-03-22 17:09:19 -0500 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-18 11:11:13 -0600 |
commit | 2eede1f363b485a9b2b49ac097b9a24256716c8b (patch) | |
tree | ee5e6e8bd1e7baa62cb3c1b30d4bbec589509fcf /drivers/net | |
parent | 7d104eab7dfb632dd96d027b7bfb233f1ae41ba7 (diff) | |
download | u-boot-2eede1f363b485a9b2b49ac097b9a24256716c8b.zip u-boot-2eede1f363b485a9b2b49ac097b9a24256716c8b.tar.gz u-boot-2eede1f363b485a9b2b49ac097b9a24256716c8b.tar.bz2 |
sandbox: eth: Add ability to disable ping reply in sandbox eth driver
This is needed to test the netretry functionality (make the command fail
on a sandbox eth device).
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/sandbox.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c index cb69a95..db115d0 100644 --- a/drivers/net/sandbox.c +++ b/drivers/net/sandbox.c @@ -29,6 +29,19 @@ struct eth_sandbox_priv { int recv_packet_length; }; +static bool disabled[8] = {false}; + +/* + * sandbox_eth_disable_response() + * + * index - The alias index (also DM seq number) + * disable - If non-zero, ignore sent packets and don't send mock response + */ +void sandbox_eth_disable_response(int index, bool disable) +{ + disabled[index] = disable; +} + static int sb_eth_start(struct udevice *dev) { struct eth_sandbox_priv *priv = dev_get_priv(dev); @@ -48,6 +61,10 @@ static int sb_eth_send(struct udevice *dev, void *packet, int length) debug("eth_sandbox: Send packet %d\n", length); + if (dev->seq >= 0 && dev->seq < ARRAY_SIZE(disabled) && + disabled[dev->seq]) + return 0; + if (ntohs(eth->et_protlen) == PROT_ARP) { struct arp_hdr *arp = packet + ETHER_HDR_SIZE; |