Skip to content
Snippets Groups Projects
Commit 5ff1547b authored by Scott Feldman's avatar Scott Feldman Committed by Stefan Hajnoczi
Browse files

rocker: bring link up/down on PHY enable/disable


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: default avatarScott Feldman <sfeldma@gmail.com>
Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Message-id: 1433985681-56138-4-git-send-email-sfeldma@gmail.com
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent 73da0232
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment