From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Wed, 4 Mar 2015 11:35:44 -0700 Subject: [U-Boot] [PATCH v5 22/27] sandbox: eth: Add ability to disable ping reply in sandbox eth driver In-Reply-To: <1425436881-10323-23-git-send-email-joe.hershberger@ni.com> References: <1424822552-4366-1-git-send-email-joe.hershberger@ni.com> <1425436881-10323-1-git-send-email-joe.hershberger@ni.com> <1425436881-10323-23-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 3 March 2015 at 19:41, 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 Reviewed-by: Simon Glass Please see nits below. > > --- > > Changes in v5: > -Use a function call to change mock driver behavior > > Changes in v4: > -Add ability to disable ping reply in sandbox eth driver > > Changes in v3: None > Changes in v2: None > > arch/sandbox/include/asm/eth.h | 15 +++++++++++++++ > drivers/net/sandbox.c | 10 ++++++++++ > 2 files changed, 25 insertions(+) > create mode 100644 arch/sandbox/include/asm/eth.h > > diff --git a/arch/sandbox/include/asm/eth.h b/arch/sandbox/include/asm/eth.h > new file mode 100644 > index 0000000..4b79ede > --- /dev/null > +++ b/arch/sandbox/include/asm/eth.h > @@ -0,0 +1,15 @@ > +/* > + * Copyright (c) 2015 National Instruments > + * > + * (C) Copyright 2015 > + * Joe Hershberger > + * > + * SPDX-License-Identifier: GPL-2.0 > + */ > + > +#ifndef __ETH_H > +#define __ETH_H > + > +void sandbox_eth_disable_response(int index, bool disable); Function comment - what is index? What does it disable? > + > +#endif /* __ETH_H */ > diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c > index cb69a95..0dfd144 100644 > --- a/drivers/net/sandbox.c > +++ b/drivers/net/sandbox.c > @@ -29,6 +29,13 @@ struct eth_sandbox_priv { > int recv_packet_length; > }; > > +static bool disabled[8] = {false}; > + > +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 +55,9 @@ static int sb_eth_send(struct udevice *dev, void *packet, int length) > > debug("eth_sandbox: Send packet %d\n", length); > > + if (disabled[dev->seq]) if (dev->seq >= 0 && dev->seq seq]) > + return 0; > + > if (ntohs(eth->et_protlen) == PROT_ARP) { > struct arp_hdr *arp = packet + ETHER_HDR_SIZE; > > -- > 1.7.11.5 > Regards, Simon