]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: sandbox: Share the priv structure with tests
authorJoe Hershberger <joe.hershberger@ni.com>
Wed, 26 Sep 2018 21:48:56 +0000 (16:48 -0500)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 10 Oct 2018 17:28:57 +0000 (12:28 -0500)
If tests want to implement tx handlers, they will likely need access to
the details in the priv structure.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/sandbox/include/asm/eth.h
drivers/net/sandbox.c

index 20175862f1ddd4c598e72604d0504f3a5c5a42ec..ced6d51999e23b27c69c4d5aa92f5f86f38f7eaa 100644 (file)
@@ -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
  *
index db461b892eafdbcc1ae44f084ade60849bf2c168..6f0fe0ced5566385e05f8a39fc2c14ef3626b15b 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/**
- * 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;
-};
-
 static bool skip_timeout;
 
 /*