[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/16] rocker: bring link up/down on PHY enable/disab
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 15/16] rocker: bring link up/down on PHY enable/disable |
Date: |
Fri, 12 Jun 2015 13:57:40 +0100 |
From: Scott Feldman <address@hidden>
When the OS driver enables/disables the port, go ahead and set the port's
link status to up/down in response to the change. This more closely
emulates real hardware when the PHY for the port is brought up/down
and the PHY negotiates carrier (link status) with link partner. In
the case of qemu, the virtual rocker device can't really do link
negotiation with the link partner as that requires signally over a
physical medium (the wire), so just pretend the negotiation was
successful and bring the link up when the port is enabled.
Signed-off-by: Scott Feldman <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/net/rocker/rocker_fp.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/net/rocker/rocker_fp.c b/hw/net/rocker/rocker_fp.c
index 393e9e7..29a2b68 100644
--- a/hw/net/rocker/rocker_fp.c
+++ b/hw/net/rocker/rocker_fp.c
@@ -178,8 +178,19 @@ bool fp_port_enabled(FpPort *port)
return port->enabled;
}
+static void fp_port_set_link(FpPort *port, bool up)
+{
+ NetClientState *nc = qemu_get_queue(port->nic);
+
+ if (up == nc->link_down) {
+ nc->link_down = !up;
+ nc->info->link_status_changed(nc);
+ }
+}
+
void fp_port_enable(FpPort *port)
{
+ fp_port_set_link(port, true);
port->enabled = true;
DPRINTF("port %d enabled\n", port->index);
}
@@ -187,6 +198,7 @@ void fp_port_enable(FpPort *port)
void fp_port_disable(FpPort *port)
{
port->enabled = false;
+ fp_port_set_link(port, false);
DPRINTF("port %d disabled\n", port->index);
}
--
2.4.2
- [Qemu-devel] [PULL 04/16] net/socket: Drop net_socket_can_send, (continued)
- [Qemu-devel] [PULL 04/16] net/socket: Drop net_socket_can_send, Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 05/16] tap: Drop tap_can_send, Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 06/16] Change qemu_set_fd_handler2(..., NULL, ...) to qemu_set_fd_handler, Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 07/16] main-loop: Drop qemu_set_fd_handler2, Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 08/16] alsaaudio: Remove unused error handling of qemu_set_fd_handler, Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 09/16] oss: Remove unused error handling of qemu_set_fd_handler, Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 10/16] xen_backend: Remove unused error handling of qemu_set_fd_handler, Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 11/16] event-notifier: Always return 0 for posix implementation, Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 12/16] iohandler: Change return type of qemu_set_fd_handler to "void", Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 13/16] rocker: Add support for phys name, Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 15/16] rocker: bring link up/down on PHY enable/disable,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 14/16] rocker: update tests using hw-derived interface names, Stefan Hajnoczi, 2015/06/12
- [Qemu-devel] [PULL 16/16] qmp/hmp: add rocker device support, Stefan Hajnoczi, 2015/06/12
- Re: [Qemu-devel] [PULL 00/16] Net patches, Peter Maydell, 2015/06/12