All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers
@ 2018-07-02 19:47 Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 01/11] sandbox: eth-raw: Correct valid socket test in send/recv Joe Hershberger
                   ` (10 more replies)
  0 siblings, 11 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

It seems as sandbox moved to livetree these drivers were not updated.
Heinrich suggested correctly that at this point we should be enumerating
network interface names, not hard-coding eth0.
Also, there were a few bugs that needed fixing.

Changes in v3:
- s/UC_ETH/UCLASS_ETH/
- use a string constant for host prefix
- use calloc

Changes in v2:
- New patch
- go back to u8_array
- move DT accesses to ofdata_to_platdata()
- store the host interface details in priv
- switch to dev_read_string()

Joe Hershberger (11):
  sandbox: eth-raw: Correct valid socket test in send/recv
  sandbox: Fix format of fake-host-hwaddr in test.dts
  net: Only call halt on a driver that has been init'ed
  sandbox: eth-raw: Make sure descriptors are always initialized
  net: Correct comment in Kconfig
  net: sandbox: Convert sandbox mock eth driver to livetree
  net: sandbox-raw: Convert raw eth driver to livetree
  sandbox: eth-raw: Add a function to ask the host about localhost
  sandbox: eth-raw: Allow interface to be specified by index
  sandbox: eth-raw: Make random MAC addresses available to eth-raw
  sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces

 arch/sandbox/cpu/eth-raw-os.c         | 81 ++++++++++++++++++++++++++---------
 arch/sandbox/dts/sandbox.dts          | 19 +++-----
 arch/sandbox/dts/sandbox64.dts        | 19 +++-----
 arch/sandbox/dts/test.dts             |  8 ++--
 arch/sandbox/include/asm/eth-raw-os.h | 38 +++++++++++++++-
 drivers/net/Kconfig                   |  4 +-
 drivers/net/Makefile                  |  1 +
 drivers/net/sandbox-raw-bus.c         | 66 ++++++++++++++++++++++++++++
 drivers/net/sandbox-raw.c             | 53 ++++++++++++++++++-----
 drivers/net/sandbox.c                 | 16 +++++--
 net/eth-uclass.c                      |  2 +-
 11 files changed, 237 insertions(+), 70 deletions(-)
 create mode 100644 drivers/net/sandbox-raw-bus.c

-- 
2.11.0

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 01/11] sandbox: eth-raw: Correct valid socket test in send/recv
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:15   ` [U-Boot] " Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 02/11] sandbox: Fix format of fake-host-hwaddr in test.dts Joe Hershberger
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

In open, the socket is correctly checked to be -1 in the error case.
In send and recv, we checked for 0, but that is a valid socket number.

Correct this by checking for -1 as a bad socket everywhere.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 arch/sandbox/cpu/eth-raw-os.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c
index e054a0702a..61f23ed210 100644
--- a/arch/sandbox/cpu/eth-raw-os.c
+++ b/arch/sandbox/cpu/eth-raw-os.c
@@ -156,7 +156,7 @@ int sandbox_eth_raw_os_send(void *packet, int length,
 	int retval;
 	struct udphdr *udph = packet + sizeof(struct iphdr);
 
-	if (!priv->sd || !priv->device)
+	if (priv->sd < 0 || !priv->device)
 		return -EINVAL;
 
 	/*
@@ -221,7 +221,7 @@ int sandbox_eth_raw_os_recv(void *packet, int *length,
 	int retval;
 	int saddr_size;
 
-	if (!priv->sd || !priv->device)
+	if (priv->sd < 0 || !priv->device)
 		return -EINVAL;
 	saddr_size = sizeof(struct sockaddr);
 	retval = recvfrom(priv->sd, packet, 1536, 0,
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 02/11] sandbox: Fix format of fake-host-hwaddr in test.dts
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 01/11] sandbox: eth-raw: Correct valid socket test in send/recv Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:15   ` [U-Boot] " Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 03/11] net: Only call halt on a driver that has been init'ed Joe Hershberger
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

test.dts specified the fake MAC address as a u32 array. Instead it
should be a u8 array.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2:
- New patch

 arch/sandbox/dts/test.dts | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 5752bf547e..1b5ef430d2 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -155,25 +155,25 @@
 	eth at 10002000 {
 		compatible = "sandbox,eth";
 		reg = <0x10002000 0x1000>;
-		fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x00>;
+		fake-host-hwaddr = [00 00 66 44 22 00];
 	};
 
 	eth_5: eth at 10003000 {
 		compatible = "sandbox,eth";
 		reg = <0x10003000 0x1000>;
-		fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x11>;
+		fake-host-hwaddr = [00 00 66 44 22 11];
 	};
 
 	eth_3: sbe5 {
 		compatible = "sandbox,eth";
 		reg = <0x10005000 0x1000>;
-		fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x33>;
+		fake-host-hwaddr = [00 00 66 44 22 33];
 	};
 
 	eth at 10004000 {
 		compatible = "sandbox,eth";
 		reg = <0x10004000 0x1000>;
-		fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x22>;
+		fake-host-hwaddr = [00 00 66 44 22 22];
 	};
 
 	gpio_a: base-gpios {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 03/11] net: Only call halt on a driver that has been init'ed
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 01/11] sandbox: eth-raw: Correct valid socket test in send/recv Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 02/11] sandbox: Fix format of fake-host-hwaddr in test.dts Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:15   ` [U-Boot] " Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 04/11] sandbox: eth-raw: Make sure descriptors are always initialized Joe Hershberger
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

With driver model, we were not checking if the state of the device was
marked as active before calling the halt function. Check that the device
is probed and also marked as active. This avoids the case where we were
calling halt on the first device in net_init() and the driver would
operate on bogus data structures causing problems. In this case, the
priv was all 0, so halt() would close STDIN.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 net/eth-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index e4b49229e3..fa3f5497a2 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -307,7 +307,7 @@ void eth_halt(void)
 	struct eth_device_priv *priv;
 
 	current = eth_get_dev();
-	if (!current || !device_active(current))
+	if (!current || !eth_is_active(current))
 		return;
 
 	eth_get_ops(current)->stop(current);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 04/11] sandbox: eth-raw: Make sure descriptors are always initialized
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
                   ` (2 preceding siblings ...)
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 03/11] net: Only call halt on a driver that has been init'ed Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:15   ` [U-Boot] " Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 05/11] net: Correct comment in Kconfig Joe Hershberger
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

If we let descriptors equal 0, we can end up closing STDIN. Make sure
they start out as -1.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 arch/sandbox/cpu/eth-raw-os.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c
index 61f23ed210..4263d8829a 100644
--- a/arch/sandbox/cpu/eth-raw-os.c
+++ b/arch/sandbox/cpu/eth-raw-os.c
@@ -34,6 +34,7 @@ static int _raw_packet_start(const char *ifname, unsigned char *ethmac,
 	int flags;
 
 	/* Prepare device struct */
+	priv->local_bind_sd = -1;
 	priv->device = malloc(sizeof(struct sockaddr_ll));
 	if (priv->device == NULL)
 		return -ENOMEM;
@@ -103,6 +104,8 @@ static int _local_inet_start(struct eth_sandbox_raw_priv *priv)
 	int one = 1;
 
 	/* Prepare device struct */
+	priv->local_bind_sd = -1;
+	priv->local_bind_udp_port = 0;
 	priv->device = malloc(sizeof(struct sockaddr_in));
 	if (priv->device == NULL)
 		return -ENOMEM;
@@ -136,8 +139,6 @@ static int _local_inet_start(struct eth_sandbox_raw_priv *priv)
 		       strerror(errno));
 		return -errno;
 	}
-	priv->local_bind_sd = -1;
-	priv->local_bind_udp_port = 0;
 	return 0;
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 05/11] net: Correct comment in Kconfig
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
                   ` (3 preceding siblings ...)
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 04/11] sandbox: eth-raw: Make sure descriptors are always initialized Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 06/11] net: sandbox: Convert sandbox mock eth driver to livetree Joe Hershberger
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

Changes in v3:
- s/UC_ETH/UCLASS_ETH/

Changes in v2: None

 drivers/net/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e88f056d84..79eef2d755 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -7,8 +7,8 @@ config DM_ETH
 	help
 	  Enable driver model for Ethernet.
 
-	  The eth_*() interface will be implemented by the UC_ETH class
-	  This is currently implemented in net/eth.c
+	  The eth_*() interface will be implemented by the UCLASS_ETH class
+	  This is currently implemented in net/eth-uclass.c
 	  Look in include/net.h for details.
 
 config DRIVER_TI_CPSW
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 06/11] net: sandbox: Convert sandbox mock eth driver to livetree
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
                   ` (4 preceding siblings ...)
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 05/11] net: Correct comment in Kconfig Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 07/11] net: sandbox-raw: Convert raw " Joe Hershberger
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

Use the dev_ functions to access DT properties.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2:
- go back to u8_array
- move DT accesses to ofdata_to_platdata()

 drivers/net/sandbox.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c
index b34712bd06..b71c8f88d9 100644
--- a/drivers/net/sandbox.c
+++ b/drivers/net/sandbox.c
@@ -59,10 +59,8 @@ static int sb_eth_start(struct udevice *dev)
 
 	debug("eth_sandbox: Start\n");
 
-	fdtdec_get_byte_array(gd->fdt_blob, dev_of_offset(dev),
-			      "fake-host-hwaddr", priv->fake_host_hwaddr,
-			      ARP_HLEN);
 	priv->recv_packet_buffer = net_rx_packets[0];
+
 	return 0;
 }
 
@@ -203,8 +201,18 @@ static int sb_eth_remove(struct udevice *dev)
 static int sb_eth_ofdata_to_platdata(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_platdata(dev);
+	struct eth_sandbox_priv *priv = dev_get_priv(dev);
+	const u8 *mac;
+
+	pdata->iobase = dev_read_addr(dev);
+
+	mac = dev_read_u8_array_ptr(dev, "fake-host-hwaddr", ARP_HLEN);
+	if (!mac) {
+		printf("'fake-host-hwaddr' is missing from the DT\n");
+		return -EINVAL;
+	}
+	memcpy(priv->fake_host_hwaddr, mac, ARP_HLEN);
 
-	pdata->iobase = devfdt_get_addr(dev);
 	return 0;
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 07/11] net: sandbox-raw: Convert raw eth driver to livetree
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
                   ` (5 preceding siblings ...)
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 06/11] net: sandbox: Convert sandbox mock eth driver to livetree Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 08/11] sandbox: eth-raw: Add a function to ask the host about localhost Joe Hershberger
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2:
- move DT accesses to ofdata_to_platdata()
- store the host interface details in priv
- switch to dev_read_string()

 arch/sandbox/cpu/eth-raw-os.c         | 28 +++++++++++++++-------------
 arch/sandbox/include/asm/eth-raw-os.h | 10 ++++++++--
 drivers/net/sandbox-raw.c             | 26 ++++++++++++++++----------
 3 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c
index 4263d8829a..82bf666886 100644
--- a/arch/sandbox/cpu/eth-raw-os.c
+++ b/arch/sandbox/cpu/eth-raw-os.c
@@ -25,8 +25,8 @@
 #include <linux/if_ether.h>
 #include <linux/if_packet.h>
 
-static int _raw_packet_start(const char *ifname, unsigned char *ethmac,
-			    struct eth_sandbox_raw_priv *priv)
+static int _raw_packet_start(struct eth_sandbox_raw_priv *priv,
+			     unsigned char *ethmac)
 {
 	struct sockaddr_ll *device;
 	struct packet_mreq mr;
@@ -40,7 +40,8 @@ static int _raw_packet_start(const char *ifname, unsigned char *ethmac,
 		return -ENOMEM;
 	device = priv->device;
 	memset(device, 0, sizeof(struct sockaddr_ll));
-	device->sll_ifindex = if_nametoindex(ifname);
+	device->sll_ifindex = if_nametoindex(priv->host_ifname);
+	priv->host_ifindex = device->sll_ifindex;
 	device->sll_family = AF_PACKET;
 	memcpy(device->sll_addr, ethmac, 6);
 	device->sll_halen = htons(6);
@@ -53,11 +54,11 @@ static int _raw_packet_start(const char *ifname, unsigned char *ethmac,
 		return -errno;
 	}
 	/* Bind to the specified interface */
-	ret = setsockopt(priv->sd, SOL_SOCKET, SO_BINDTODEVICE, ifname,
-		   strlen(ifname) + 1);
+	ret = setsockopt(priv->sd, SOL_SOCKET, SO_BINDTODEVICE,
+			 priv->host_ifname, strlen(priv->host_ifname) + 1);
 	if (ret < 0) {
-		printf("Failed to bind to '%s': %d %s\n", ifname, errno,
-		       strerror(errno));
+		printf("Failed to bind to '%s': %d %s\n", priv->host_ifname,
+		       errno, strerror(errno));
 		return -errno;
 	}
 
@@ -76,11 +77,12 @@ static int _raw_packet_start(const char *ifname, unsigned char *ethmac,
 		printf("Failed to set promiscuous mode: %d %s\n"
 		       "Falling back to the old \"flags\" way...\n",
 			errno, strerror(errno));
-		if (strlen(ifname) >= IFNAMSIZ) {
-			printf("Interface name %s is too long.\n", ifname);
+		if (strlen(priv->host_ifname) >= IFNAMSIZ) {
+			printf("Interface name %s is too long.\n",
+			       priv->host_ifname);
 			return -EINVAL;
 		}
-		strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
+		strncpy(ifr.ifr_name, priv->host_ifname, IFNAMSIZ);
 		if (ioctl(priv->sd, SIOCGIFFLAGS, &ifr) < 0) {
 			printf("Failed to read flags: %d %s\n", errno,
 			       strerror(errno));
@@ -142,13 +144,13 @@ static int _local_inet_start(struct eth_sandbox_raw_priv *priv)
 	return 0;
 }
 
-int sandbox_eth_raw_os_start(const char *ifname, unsigned char *ethmac,
-			    struct eth_sandbox_raw_priv *priv)
+int sandbox_eth_raw_os_start(struct eth_sandbox_raw_priv *priv,
+			     unsigned char *ethmac)
 {
 	if (priv->local)
 		return _local_inet_start(priv);
 	else
-		return _raw_packet_start(ifname, ethmac, priv);
+		return _raw_packet_start(priv, ethmac);
 }
 
 int sandbox_eth_raw_os_send(void *packet, int length,
diff --git a/arch/sandbox/include/asm/eth-raw-os.h b/arch/sandbox/include/asm/eth-raw-os.h
index f986d3142d..760f5fbedd 100644
--- a/arch/sandbox/include/asm/eth-raw-os.h
+++ b/arch/sandbox/include/asm/eth-raw-os.h
@@ -9,10 +9,14 @@
 #ifndef __ETH_RAW_OS_H
 #define __ETH_RAW_OS_H
 
+#define	IFNAMSIZ	16
+
 /**
  * struct eth_sandbox_raw_priv - raw socket session
  *
  * sd: socket descriptor - the open socket during a session
+ * host_ifname: interface name on the host to use for sending our packets
+ * host_ifindex: interface index number on the host
  * device: struct sockaddr_ll - the host interface packets move to/from
  * local: 1 or 0 to select the local interface ('lo') or not
  * local_bindsd: socket descriptor to prevent the kernel from sending
@@ -22,14 +26,16 @@
  */
 struct eth_sandbox_raw_priv {
 	int sd;
+	char host_ifname[IFNAMSIZ];
+	unsigned int host_ifindex;
 	void *device;
 	int local;
 	int local_bind_sd;
 	unsigned short local_bind_udp_port;
 };
 
-int sandbox_eth_raw_os_start(const char *ifname, unsigned char *ethmac,
-			    struct eth_sandbox_raw_priv *priv);
+int sandbox_eth_raw_os_start(struct eth_sandbox_raw_priv *priv,
+			     unsigned char *ethmac);
 int sandbox_eth_raw_os_send(void *packet, int length,
 			    struct eth_sandbox_raw_priv *priv);
 int sandbox_eth_raw_os_recv(void *packet, int *length,
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index 3f8020f629..317e964019 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -21,21 +21,16 @@ static int sb_eth_raw_start(struct udevice *dev)
 {
 	struct eth_sandbox_raw_priv *priv = dev_get_priv(dev);
 	struct eth_pdata *pdata = dev_get_platdata(dev);
-	const char *interface;
+	int ret;
 
 	debug("eth_sandbox_raw: Start\n");
 
-	interface = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
-					    "host-raw-interface", NULL);
-	if (interface == NULL)
-		return -EINVAL;
-
-	if (strcmp(interface, "lo") == 0) {
-		priv->local = 1;
+	ret = sandbox_eth_raw_os_start(priv, pdata->enetaddr);
+	if (priv->local) {
 		env_set("ipaddr", "127.0.0.1");
 		env_set("serverip", "127.0.0.1");
 	}
-	return sandbox_eth_raw_os_start(interface, pdata->enetaddr, priv);
+	return ret;
 }
 
 static int sb_eth_raw_send(struct udevice *dev, void *packet, int length)
@@ -143,8 +138,19 @@ static const struct eth_ops sb_eth_raw_ops = {
 static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_platdata(dev);
+	struct eth_sandbox_raw_priv *priv = dev_get_priv(dev);
+	const char *ifname;
+
+	pdata->iobase = dev_read_addr(dev);
+
+	ifname = dev_read_string(dev, "host-raw-interface");
+	if (ifname) {
+		strncpy(priv->host_ifname, ifname, IFNAMSIZ);
+		printf(": Using %s from DT\n", priv->host_ifname);
+		if (strcmp(ifname, "lo") == 0)
+			priv->local = 1;
+	}
 
-	pdata->iobase = devfdt_get_addr(dev);
 	return 0;
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 08/11] sandbox: eth-raw: Add a function to ask the host about localhost
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
                   ` (6 preceding siblings ...)
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 07/11] net: sandbox-raw: Convert raw " Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 09/11] sandbox: eth-raw: Allow interface to be specified by index Joe Hershberger
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

Instead of doing a simple string compare against "lo", look for the flag
that indicates a localhost interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 arch/sandbox/cpu/eth-raw-os.c         | 27 +++++++++++++++++++++++----
 arch/sandbox/include/asm/eth-raw-os.h |  8 ++++++++
 drivers/net/sandbox-raw.c             | 10 ++++++++--
 3 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c
index 82bf666886..12ddb345d9 100644
--- a/arch/sandbox/cpu/eth-raw-os.c
+++ b/arch/sandbox/cpu/eth-raw-os.c
@@ -1,9 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2015 National Instruments
- *
- * (C) Copyright 2015
- * Joe Hershberger <joe.hershberger@ni.com>
+ * Copyright (c) 2015-2018 National Instruments
+ * Copyright (c) 2015-2018 Joe Hershberger <joe.hershberger@ni.com>
  */
 
 #include <asm/eth-raw-os.h>
@@ -25,6 +23,27 @@
 #include <linux/if_ether.h>
 #include <linux/if_packet.h>
 
+int sandbox_eth_raw_os_is_local(const char *ifname)
+{
+	int fd = socket(AF_INET, SOCK_DGRAM, 0);
+	struct ifreq ifr;
+	int ret = 0;
+
+	if (fd < 0)
+		return -errno;
+	memset(&ifr, 0, sizeof(ifr));
+	strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
+	ret = ioctl(fd, SIOCGIFFLAGS, &ifr);
+	if (ret < 0) {
+		ret = -errno;
+		goto out;
+	}
+	ret = !!(ifr.ifr_flags & IFF_LOOPBACK);
+out:
+	close(fd);
+	return ret;
+}
+
 static int _raw_packet_start(struct eth_sandbox_raw_priv *priv,
 			     unsigned char *ethmac)
 {
diff --git a/arch/sandbox/include/asm/eth-raw-os.h b/arch/sandbox/include/asm/eth-raw-os.h
index 760f5fbedd..edd09d2e08 100644
--- a/arch/sandbox/include/asm/eth-raw-os.h
+++ b/arch/sandbox/include/asm/eth-raw-os.h
@@ -34,6 +34,14 @@ struct eth_sandbox_raw_priv {
 	unsigned short local_bind_udp_port;
 };
 
+/*
+ * Check if the interface named "ifname" is a localhost interface or not.
+ * ifname - the interface name on the host to check
+ *
+ * returns - 0 if real interface, 1 if local, negative if error
+ */
+int sandbox_eth_raw_os_is_local(const char *ifname);
+
 int sandbox_eth_raw_os_start(struct eth_sandbox_raw_priv *priv,
 			     unsigned char *ethmac);
 int sandbox_eth_raw_os_send(void *packet, int length,
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index 317e964019..c04b94c6e1 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -29,6 +29,8 @@ static int sb_eth_raw_start(struct udevice *dev)
 	if (priv->local) {
 		env_set("ipaddr", "127.0.0.1");
 		env_set("serverip", "127.0.0.1");
+		net_ip = string_to_ip("127.0.0.1");
+		net_server_ip = net_ip;
 	}
 	return ret;
 }
@@ -140,6 +142,7 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev)
 	struct eth_pdata *pdata = dev_get_platdata(dev);
 	struct eth_sandbox_raw_priv *priv = dev_get_priv(dev);
 	const char *ifname;
+	u32 local;
 
 	pdata->iobase = dev_read_addr(dev);
 
@@ -147,10 +150,13 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev)
 	if (ifname) {
 		strncpy(priv->host_ifname, ifname, IFNAMSIZ);
 		printf(": Using %s from DT\n", priv->host_ifname);
-		if (strcmp(ifname, "lo") == 0)
-			priv->local = 1;
 	}
 
+	local = sandbox_eth_raw_os_is_local(priv->host_ifname);
+	if (local < 0)
+		return local;
+	priv->local = local;
+
 	return 0;
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 09/11] sandbox: eth-raw: Allow interface to be specified by index
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
                   ` (7 preceding siblings ...)
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 08/11] sandbox: eth-raw: Add a function to ask the host about localhost Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 10/11] sandbox: eth-raw: Make random MAC addresses available to eth-raw Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 11/11] sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces Joe Hershberger
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

With systemd stable interface names, eth0 will almost never exist.
Instead of using that name in the sandbox.dts, use an index.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 arch/sandbox/cpu/eth-raw-os.c         |  7 +++++++
 arch/sandbox/include/asm/eth-raw-os.h |  9 +++++++++
 drivers/net/sandbox-raw.c             | 11 +++++++++++
 3 files changed, 27 insertions(+)

diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c
index 12ddb345d9..df7acaa0bc 100644
--- a/arch/sandbox/cpu/eth-raw-os.c
+++ b/arch/sandbox/cpu/eth-raw-os.c
@@ -44,6 +44,13 @@ out:
 	return ret;
 }
 
+int sandbox_eth_raw_os_idx_to_name(struct eth_sandbox_raw_priv *priv)
+{
+	if (!if_indextoname(priv->host_ifindex, priv->host_ifname))
+		return -errno;
+	return 0;
+}
+
 static int _raw_packet_start(struct eth_sandbox_raw_priv *priv,
 			     unsigned char *ethmac)
 {
diff --git a/arch/sandbox/include/asm/eth-raw-os.h b/arch/sandbox/include/asm/eth-raw-os.h
index edd09d2e08..99f674e82e 100644
--- a/arch/sandbox/include/asm/eth-raw-os.h
+++ b/arch/sandbox/include/asm/eth-raw-os.h
@@ -42,6 +42,15 @@ struct eth_sandbox_raw_priv {
  */
 int sandbox_eth_raw_os_is_local(const char *ifname);
 
+/*
+ * Look up the name of the interface based on the ifindex populated in priv.
+ *
+ * Overwrite the host_ifname member in priv based on looking up host_ifindex
+ *
+ * returns - 0 if success, negative if error
+ */
+int sandbox_eth_raw_os_idx_to_name(struct eth_sandbox_raw_priv *priv);
+
 int sandbox_eth_raw_os_start(struct eth_sandbox_raw_priv *priv,
 			     unsigned char *ethmac);
 int sandbox_eth_raw_os_send(void *packet, int length,
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index c04b94c6e1..0d1fd4d931 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -143,6 +143,7 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev)
 	struct eth_sandbox_raw_priv *priv = dev_get_priv(dev);
 	const char *ifname;
 	u32 local;
+	int ret;
 
 	pdata->iobase = dev_read_addr(dev);
 
@@ -151,6 +152,16 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev)
 		strncpy(priv->host_ifname, ifname, IFNAMSIZ);
 		printf(": Using %s from DT\n", priv->host_ifname);
 	}
+	if (dev_read_u32(dev, "host-raw-interface-idx",
+			 &priv->host_ifindex) < 0) {
+		priv->host_ifindex = 0;
+	} else {
+		ret = sandbox_eth_raw_os_idx_to_name(priv);
+		if (ret < 0)
+			return ret;
+		printf(": Using interface index %d from DT (%s)\n",
+		       priv->host_ifindex, priv->host_ifname);
+	}
 
 	local = sandbox_eth_raw_os_is_local(priv->host_ifname);
 	if (local < 0)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 10/11] sandbox: eth-raw: Make random MAC addresses available to eth-raw
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
                   ` (8 preceding siblings ...)
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 09/11] sandbox: eth-raw: Allow interface to be specified by index Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 11/11] sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces Joe Hershberger
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

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>
---

Changes in v3: None
Changes in v2: None

 drivers/net/sandbox-raw.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index 0d1fd4d931..09cc678ebd 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -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)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH v3 11/11] sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces
  2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
                   ` (9 preceding siblings ...)
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 10/11] sandbox: eth-raw: Make random MAC addresses available to eth-raw Joe Hershberger
@ 2018-07-02 19:47 ` Joe Hershberger
  2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
  10 siblings, 1 reply; 23+ messages in thread
From: Joe Hershberger @ 2018-07-02 19:47 UTC (permalink / raw)
  To: u-boot

Ask the OS for each of its interfaces and for each one, bind a U-Boot
device and then probe it. This will allocate the priv data structure
that is then populated.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- use a string constant for host prefix
- use calloc

Changes in v2: None

 arch/sandbox/cpu/eth-raw-os.c         | 10 ++++++
 arch/sandbox/dts/sandbox.dts          | 19 ++++------
 arch/sandbox/dts/sandbox64.dts        | 19 ++++------
 arch/sandbox/include/asm/eth-raw-os.h | 11 ++++++
 drivers/net/Makefile                  |  1 +
 drivers/net/sandbox-raw-bus.c         | 66 +++++++++++++++++++++++++++++++++++
 6 files changed, 100 insertions(+), 26 deletions(-)
 create mode 100644 drivers/net/sandbox-raw-bus.c

diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c
index df7acaa0bc..75bfaa4c90 100644
--- a/arch/sandbox/cpu/eth-raw-os.c
+++ b/arch/sandbox/cpu/eth-raw-os.c
@@ -23,6 +23,16 @@
 #include <linux/if_ether.h>
 #include <linux/if_packet.h>
 
+struct sandbox_eth_raw_if_nameindex *sandbox_eth_raw_if_nameindex(void)
+{
+	return (struct sandbox_eth_raw_if_nameindex *)if_nameindex();
+}
+
+void sandbox_eth_raw_if_freenameindex(struct sandbox_eth_raw_if_nameindex *ptr)
+{
+	if_freenameindex((struct if_nameindex *)ptr);
+}
+
 int sandbox_eth_raw_os_is_local(const char *ifname)
 {
 	int fd = socket(AF_INET, SOCK_DGRAM, 0);
diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index 0ea2452742..9164194023 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -8,7 +8,6 @@
 	model = "sandbox";
 
 	aliases {
-		eth5 = "/eth at 90000000";
 		i2c0 = &i2c_0;
 		pci0 = &pci;
 		rtc0 = &rtc_0;
@@ -47,24 +46,18 @@
 		};
 	};
 
+	ethrawbus {
+		reg = <0 0>;
+		compatible = "sandbox,eth-raw-bus";
+		skip-localhost = <0>;
+	};
+
 	eth at 10002000 {
 		compatible = "sandbox,eth";
 		reg = <0x10002000 0x1000>;
 		fake-host-hwaddr = [00 00 66 44 22 00];
 	};
 
-	eth at 80000000 {
-		compatible = "sandbox,eth-raw";
-		reg = <0x80000000 0x1000>;
-		host-raw-interface = "eth0";
-	};
-
-	eth at 90000000 {
-		compatible = "sandbox,eth-raw";
-		reg = <0x90000000 0x1000>;
-		host-raw-interface = "lo";
-	};
-
 	gpio_a: gpios at 0 {
 		gpio-controller;
 		compatible = "sandbox,gpio";
diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts
index 48e420e721..4a2fa9908e 100644
--- a/arch/sandbox/dts/sandbox64.dts
+++ b/arch/sandbox/dts/sandbox64.dts
@@ -8,7 +8,6 @@
 	model = "sandbox";
 
 	aliases {
-		eth5 = "/eth at 90000000";
 		i2c0 = &i2c_0;
 		pci0 = &pci;
 		rtc0 = &rtc_0;
@@ -47,24 +46,18 @@
 		};
 	};
 
+	ethrawbus {
+		reg = <0 0>;
+		compatible = "sandbox,eth-raw-bus";
+		skip-localhost = <1>;
+	};
+
 	eth at 10002000 {
 		compatible = "sandbox,eth";
 		reg = <0x0 0x10002000 0x0 0x1000>;
 		fake-host-hwaddr = [00 00 66 44 22 00];
 	};
 
-	eth at 80000000 {
-		compatible = "sandbox,eth-raw";
-		reg = <0x0 0x80000000 0x0 0x1000>;
-		host-raw-interface = "eth0";
-	};
-
-	eth at 90000000 {
-		compatible = "sandbox,eth-raw";
-		reg = <0x0 0x90000000 0x0 0x1000>;
-		host-raw-interface = "lo";
-	};
-
 	gpio_a: gpios at 0 {
 		gpio-controller;
 		compatible = "sandbox,gpio";
diff --git a/arch/sandbox/include/asm/eth-raw-os.h b/arch/sandbox/include/asm/eth-raw-os.h
index 99f674e82e..0b511db70c 100644
--- a/arch/sandbox/include/asm/eth-raw-os.h
+++ b/arch/sandbox/include/asm/eth-raw-os.h
@@ -34,6 +34,17 @@ struct eth_sandbox_raw_priv {
 	unsigned short local_bind_udp_port;
 };
 
+/* A struct to mimic if_nameindex but that does not depend on Linux headers */
+struct sandbox_eth_raw_if_nameindex {
+	unsigned int if_index; /* Index of interface (1, 2, ...) */
+	char        *if_name;  /* Null-terminated name ("eth0", etc.) */
+};
+
+/* Enumerate host network interfaces */
+struct sandbox_eth_raw_if_nameindex *sandbox_eth_raw_if_nameindex(void);
+/* Free the data structure of enumerated network interfaces */
+void sandbox_eth_raw_if_freenameindex(struct sandbox_eth_raw_if_nameindex *ptr);
+
 /*
  * Check if the interface named "ifname" is a localhost interface or not.
  * ifname - the interface name on the host to check
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 058dd00768..c1ed44e21f 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_RTL8139) += rtl8139.o
 obj-$(CONFIG_RTL8169) += rtl8169.o
 obj-$(CONFIG_ETH_SANDBOX) += sandbox.o
 obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw.o
+obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw-bus.o
 obj-$(CONFIG_SH_ETHER) += sh_eth.o
 obj-$(CONFIG_RENESAS_RAVB) += ravb.o
 obj-$(CONFIG_SMC91111) += smc91111.o
diff --git a/drivers/net/sandbox-raw-bus.c b/drivers/net/sandbox-raw-bus.c
new file mode 100644
index 0000000000..76d65afe6c
--- /dev/null
+++ b/drivers/net/sandbox-raw-bus.c
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2018 National Instruments
+ * Copyright (c) 2018 Joe Hershberger <joe.hershberger@ni.com>
+ */
+
+#include <common.h>
+#include <asm/eth-raw-os.h>
+#include <dm.h>
+#include <errno.h>
+#include <dm/device-internal.h>
+#include <dm/lists.h>
+
+static int eth_raw_bus_post_bind(struct udevice *dev)
+{
+	struct sandbox_eth_raw_if_nameindex *ni, *i;
+	struct udevice *child;
+	struct eth_sandbox_raw_priv *priv;
+	char *ub_ifname;
+	static const char ub_ifname_pfx[] = "host_";
+	u32 skip_localhost = 0;
+
+	ni = sandbox_eth_raw_if_nameindex();
+	if (!ni)
+		return -EINVAL;
+
+	dev_read_u32(dev, "skip-localhost", &skip_localhost);
+	for (i = ni; !(i->if_index == 0 && !i->if_name); i++) {
+		int local = sandbox_eth_raw_os_is_local(i->if_name);
+
+		if (local < 0)
+			continue;
+		if (skip_localhost && local)
+			continue;
+
+		ub_ifname = calloc(IFNAMSIZ + sizeof(ub_ifname_pfx), 1);
+		strcpy(ub_ifname, ub_ifname_pfx);
+		strncat(ub_ifname, i->if_name, IFNAMSIZ);
+		device_bind_driver(dev, "eth_sandbox_raw", ub_ifname, &child);
+
+		device_set_name_alloced(child);
+		device_probe(child);
+		priv = dev_get_priv(child);
+		if (priv) {
+			memcpy(priv->host_ifname, i->if_name, IFNAMSIZ);
+			priv->host_ifindex = i->if_index;
+			priv->local = local;
+		}
+	}
+
+	sandbox_eth_raw_if_freenameindex(ni);
+
+	return 0;
+}
+
+static const struct udevice_id sandbox_eth_raw_bus_ids[] = {
+	{ .compatible = "sandbox,eth-raw-bus" },
+	{ }
+};
+
+U_BOOT_DRIVER(sandbox_eth_raw_bus) = {
+	.name       = "sb_eth_raw_bus",
+	.id         = UCLASS_SIMPLE_BUS,
+	.of_match   = sandbox_eth_raw_bus_ids,
+	.bind       = eth_raw_bus_post_bind,
+};
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] sandbox: eth-raw: Correct valid socket test in send/recv
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 01/11] sandbox: eth-raw: Correct valid socket test in send/recv Joe Hershberger
@ 2018-07-26 19:15   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:15 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938157/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] sandbox: Fix format of fake-host-hwaddr in test.dts
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 02/11] sandbox: Fix format of fake-host-hwaddr in test.dts Joe Hershberger
@ 2018-07-26 19:15   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:15 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938152/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] net: Only call halt on a driver that has been init'ed
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 03/11] net: Only call halt on a driver that has been init'ed Joe Hershberger
@ 2018-07-26 19:15   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:15 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938160/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] sandbox: eth-raw: Make sure descriptors are always initialized
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 04/11] sandbox: eth-raw: Make sure descriptors are always initialized Joe Hershberger
@ 2018-07-26 19:15   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:15 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938156/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] net: Correct comment in Kconfig
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 05/11] net: Correct comment in Kconfig Joe Hershberger
@ 2018-07-26 19:16   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:16 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938158/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] net: sandbox: Convert sandbox mock eth driver to livetree
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 06/11] net: sandbox: Convert sandbox mock eth driver to livetree Joe Hershberger
@ 2018-07-26 19:16   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:16 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938153/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] net: sandbox-raw: Convert raw eth driver to livetree
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 07/11] net: sandbox-raw: Convert raw " Joe Hershberger
@ 2018-07-26 19:16   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:16 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938155/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] sandbox: eth-raw: Add a function to ask the host about localhost
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 08/11] sandbox: eth-raw: Add a function to ask the host about localhost Joe Hershberger
@ 2018-07-26 19:16   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:16 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938161/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] sandbox: eth-raw: Allow interface to be specified by index
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 09/11] sandbox: eth-raw: Allow interface to be specified by index Joe Hershberger
@ 2018-07-26 19:16   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:16 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938164/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] sandbox: eth-raw: Make random MAC addresses available to eth-raw
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 10/11] sandbox: eth-raw: Make random MAC addresses available to eth-raw Joe Hershberger
@ 2018-07-26 19:16   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:16 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938163/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces
  2018-07-02 19:47 ` [U-Boot] [PATCH v3 11/11] sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces Joe Hershberger
@ 2018-07-26 19:16   ` Joe Hershberger
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Hershberger @ 2018-07-26 19:16 UTC (permalink / raw)
  To: u-boot

Hi Joe,

https://patchwork.ozlabs.org/patch/938159/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2018-07-26 19:16 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-02 19:47 [U-Boot] [PATCH v3 00/11] sandbox: net: Fix sandbox eth drivers Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 01/11] sandbox: eth-raw: Correct valid socket test in send/recv Joe Hershberger
2018-07-26 19:15   ` [U-Boot] " Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 02/11] sandbox: Fix format of fake-host-hwaddr in test.dts Joe Hershberger
2018-07-26 19:15   ` [U-Boot] " Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 03/11] net: Only call halt on a driver that has been init'ed Joe Hershberger
2018-07-26 19:15   ` [U-Boot] " Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 04/11] sandbox: eth-raw: Make sure descriptors are always initialized Joe Hershberger
2018-07-26 19:15   ` [U-Boot] " Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 05/11] net: Correct comment in Kconfig Joe Hershberger
2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 06/11] net: sandbox: Convert sandbox mock eth driver to livetree Joe Hershberger
2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 07/11] net: sandbox-raw: Convert raw " Joe Hershberger
2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 08/11] sandbox: eth-raw: Add a function to ask the host about localhost Joe Hershberger
2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 09/11] sandbox: eth-raw: Allow interface to be specified by index Joe Hershberger
2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 10/11] sandbox: eth-raw: Make random MAC addresses available to eth-raw Joe Hershberger
2018-07-26 19:16   ` [U-Boot] " Joe Hershberger
2018-07-02 19:47 ` [U-Boot] [PATCH v3 11/11] sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces Joe Hershberger
2018-07-26 19:16   ` [U-Boot] " Joe Hershberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.