From patchwork Wed Mar 4 02:41:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Hershberger X-Patchwork-Id: 446029 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 33E2A140082 for ; Wed, 4 Mar 2015 13:45:05 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DABA04B69E; Wed, 4 Mar 2015 03:44:32 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n8jpGTh-IQ2u; Wed, 4 Mar 2015 03:44:32 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6085AA7438; Wed, 4 Mar 2015 03:43:50 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C4CC54B5A8 for ; Wed, 4 Mar 2015 03:43:20 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pZ-exOiEvDfS for ; Wed, 4 Mar 2015 03:43:20 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from ni.com (skprod2.natinst.com [130.164.80.23]) by theia.denx.de (Postfix) with ESMTPS id 273324B5D2 for ; Wed, 4 Mar 2015 03:43:18 +0100 (CET) Received: from us-aus-mgwout2.amer.corp.natinst.com (nb-chan1-1338.natinst.com [130.164.19.134]) by us-aus-skprod2.natinst.com (8.15.0.59/8.15.0.59) with ESMTP id t242hGLQ026452; Tue, 3 Mar 2015 20:43:16 -0600 Received: from linux-xvxi.natinst.com ([130.164.14.198]) by us-aus-mgwout2.amer.corp.natinst.com (Lotus Domino Release 8.5.3FP6) with ESMTP id 2015030320431641-645246 ; Tue, 3 Mar 2015 20:43:16 -0600 From: Joe Hershberger To: u-boot@lists.denx.de Date: Tue, 3 Mar 2015 20:41:16 -0600 Message-Id: <1425436881-10323-23-git-send-email-joe.hershberger@ni.com> X-Mailer: git-send-email 1.7.11.5 In-Reply-To: <1425436881-10323-1-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> X-MIMETrack: Itemize by SMTP Server on US-AUS-MGWOut2/AUS/H/NIC(Release 8.5.3FP6|November 21, 2013) at 03/03/2015 08:43:16 PM, Serialize by Router on US-AUS-MGWOut2/AUS/H/NIC(Release 8.5.3FP6|November 21, 2013) at 03/03/2015 08:43:16 PM, Serialize complete at 03/03/2015 08:43:16 PM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2015-03-03_08:, , signatures=0 Cc: Joe Hershberger Subject: [U-Boot] [PATCH v5 22/27] sandbox: eth: Add ability to disable ping reply in sandbox eth driver X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- 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); + +#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]) + return 0; + if (ntohs(eth->et_protlen) == PROT_ARP) { struct arp_hdr *arp = packet + ETHER_HDR_SIZE;