summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2018-09-26 16:48:59 -0500
committerJoe Hershberger <joe.hershberger@ni.com>2018-10-10 12:28:59 -0500
commit9cbe5972c3c00e974482181cd4062d9229a9b7d5 (patch)
tree8ca670695d6931a755c059d66b0e66f662183f82 /arch
parent3f02c98bd1000fc26ee2700fd5a75112cdeaca6c (diff)
downloadu-boot-9cbe5972c3c00e974482181cd4062d9229a9b7d5.tar.gz
u-boot-9cbe5972c3c00e974482181cd4062d9229a9b7d5.tar.bz2
u-boot-9cbe5972c3c00e974482181cd4062d9229a9b7d5.zip
net: sandbox: Add a priv ptr for tests to use
Tests need to be able to pass their "unit test state" to the handlers where asserts are evaluated. Add a function that allows the tests to set this private data on the sandbox eth device. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/sandbox/include/asm/eth.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/sandbox/include/asm/eth.h b/arch/sandbox/include/asm/eth.h
index 7a49e98fa8..a6adec4e83 100644
--- a/arch/sandbox/include/asm/eth.h
+++ b/arch/sandbox/include/asm/eth.h
@@ -59,6 +59,7 @@ typedef int sandbox_eth_tx_hand_f(struct udevice *dev, void *pkt,
* recv_packet_length - lengths of the packet returned as received
* recv_packets - number of packets returned
* tx_handler - function to generate responses to sent packets
+ * priv - a pointer to some structure a test may want to keep track of
*/
struct eth_sandbox_priv {
uchar fake_host_hwaddr[ARP_HLEN];
@@ -68,6 +69,7 @@ struct eth_sandbox_priv {
int recv_packet_length[PKTBUFSRX];
int recv_packets;
sandbox_eth_tx_hand_f *tx_handler;
+ void *priv;
};
/*
@@ -77,4 +79,11 @@ struct eth_sandbox_priv {
*/
void sandbox_eth_set_tx_handler(int index, sandbox_eth_tx_hand_f *handler);
+/*
+ * Set priv ptr
+ *
+ * priv - priv void ptr to store in the device
+ */
+void sandbox_eth_set_priv(int index, void *priv);
+
#endif /* __ETH_H */