sandbox: eth-raw: Make random MAC addresses available to eth-raw
authorJoe Hershberger <joe.hershberger@ni.com>
Mon, 2 Jul 2018 19:47:53 +0000 (14:47 -0500)
committerJoe Hershberger <joe.hershberger@ni.com>
Thu, 26 Jul 2018 19:08:18 +0000 (14:08 -0500)
We don't necessarily know how many MAC addresses we'll need, so implement
a ROM read so we always have something valid.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/net/sandbox-raw.c

index 0d1fd4d93110b569112323606a68812ebe873c6b..09cc678ebde72657c3f6e51b631c8dcad2b8bd57 100644 (file)
@@ -130,11 +130,21 @@ static void sb_eth_raw_stop(struct udevice *dev)
        sandbox_eth_raw_os_stop(priv);
 }
 
+static int sb_eth_raw_read_rom_hwaddr(struct udevice *dev)
+{
+       struct eth_pdata *pdata = dev_get_platdata(dev);
+
+       net_random_ethaddr(pdata->enetaddr);
+
+       return 0;
+}
+
 static const struct eth_ops sb_eth_raw_ops = {
        .start                  = sb_eth_raw_start,
        .send                   = sb_eth_raw_send,
        .recv                   = sb_eth_raw_recv,
        .stop                   = sb_eth_raw_stop,
+       .read_rom_hwaddr        = sb_eth_raw_read_rom_hwaddr,
 };
 
 static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev)