From 76a503439e38be9d4fe365bdf87a6d0e74ea41c9 Mon Sep 17 00:00:00 2001 From: Joe Hershberger Date: Wed, 26 Sep 2018 16:48:56 -0500 Subject: net: sandbox: Share the priv structure with tests If tests want to implement tx handlers, they will likely need access to the details in the priv structure. Signed-off-by: Joe Hershberger Reviewed-by: Simon Glass Reviewed-by: Bin Meng --- arch/sandbox/include/asm/eth.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'arch/sandbox') diff --git a/arch/sandbox/include/asm/eth.h b/arch/sandbox/include/asm/eth.h index 20175862f1d..ced6d51999e 100644 --- a/arch/sandbox/include/asm/eth.h +++ b/arch/sandbox/include/asm/eth.h @@ -49,6 +49,25 @@ int sandbox_eth_ping_req_to_reply(struct udevice *dev, void *packet, typedef int sandbox_eth_tx_hand_f(struct udevice *dev, void *pkt, unsigned int len); +/** + * struct eth_sandbox_priv - memory for sandbox mock driver + * + * fake_host_hwaddr - MAC address of mocked machine + * fake_host_ipaddr - IP address of mocked machine + * disabled - Will not respond + * recv_packet_buffer - buffer of the packet returned as received + * recv_packet_length - length of the packet returned as received + * tx_handler - function to generate responses to sent packets + */ +struct eth_sandbox_priv { + uchar fake_host_hwaddr[ARP_HLEN]; + struct in_addr fake_host_ipaddr; + bool disabled; + uchar *recv_packet_buffer; + int recv_packet_length; + sandbox_eth_tx_hand_f *tx_handler; +}; + /* * Set packet handler * -- cgit v1.2.3