* [Qemu-devel] [PATCH] pcnet: Add link state support
@ 2011-10-07 10:27 Jan Kiszka
2011-10-07 12:06 ` Jan Kiszka
2011-11-01 22:20 ` Anthony Liguori
0 siblings, 2 replies; 3+ messages in thread
From: Jan Kiszka @ 2011-10-07 10:27 UTC (permalink / raw)
To: Anthony Liguori, qemu-devel
Update lnkst on link state changes so that guests can obtain this
information via reading back the LED output pin. Works for Linux but
not for guests that depend on the missing PHY.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/lance.c | 1 +
hw/pcnet-pci.c | 1 +
hw/pcnet.c | 7 +++++++
hw/pcnet.h | 1 +
4 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/hw/lance.c b/hw/lance.c
index d83e7f5..93d5fda 100644
--- a/hw/lance.c
+++ b/hw/lance.c
@@ -97,6 +97,7 @@ static NetClientInfo net_lance_info = {
.size = sizeof(NICState),
.can_receive = pcnet_can_receive,
.receive = pcnet_receive,
+ .link_status_changed = pcnet_set_link_status,
.cleanup = lance_cleanup,
};
diff --git a/hw/pcnet-pci.c b/hw/pcnet-pci.c
index cab1116..548bb50 100644
--- a/hw/pcnet-pci.c
+++ b/hw/pcnet-pci.c
@@ -287,6 +287,7 @@ static NetClientInfo net_pci_pcnet_info = {
.size = sizeof(NICState),
.can_receive = pcnet_can_receive,
.receive = pcnet_receive,
+ .link_status_changed = pcnet_set_link_status,
.cleanup = pci_pcnet_cleanup,
};
diff --git a/hw/pcnet.c b/hw/pcnet.c
index add3ec2..cba253b 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1197,6 +1197,13 @@ ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_)
return size_;
}
+void pcnet_set_link_status(VLANClientState *nc)
+{
+ PCNetState *d = DO_UPCAST(NICState, nc, nc)->opaque;
+
+ d->lnkst = nc->link_down ? 0 : 0x40;
+}
+
static void pcnet_transmit(PCNetState *s)
{
target_phys_addr_t xmit_cxda = 0;
diff --git a/hw/pcnet.h b/hw/pcnet.h
index 52cc52e..edc81c9 100644
--- a/hw/pcnet.h
+++ b/hw/pcnet.h
@@ -58,6 +58,7 @@ uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr);
uint32_t pcnet_bcr_readw(PCNetState *s, uint32_t rap);
int pcnet_can_receive(VLANClientState *nc);
ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_);
+void pcnet_set_link_status(VLANClientState *nc);
void pcnet_common_cleanup(PCNetState *d);
int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info);
extern const VMStateDescription vmstate_pcnet;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] pcnet: Add link state support
2011-10-07 10:27 [Qemu-devel] [PATCH] pcnet: Add link state support Jan Kiszka
@ 2011-10-07 12:06 ` Jan Kiszka
2011-11-01 22:20 ` Anthony Liguori
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2011-10-07 12:06 UTC (permalink / raw)
To: Anthony Liguori, qemu-devel
On 2011-10-07 12:27, Jan Kiszka wrote:
> Update lnkst on link state changes so that guests can obtain this
> information via reading back the LED output pin. Works for Linux but
> not for guests that depend on the missing PHY.
Strike the second sentence: The older Am79C970A that QEMU emulated
provided no PHY access, only newer Am79C973/Am79C979 did. So the patch
is sufficient for our current level of support.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] pcnet: Add link state support
2011-10-07 10:27 [Qemu-devel] [PATCH] pcnet: Add link state support Jan Kiszka
2011-10-07 12:06 ` Jan Kiszka
@ 2011-11-01 22:20 ` Anthony Liguori
1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2011-11-01 22:20 UTC (permalink / raw)
To: Jan Kiszka; +Cc: qemu-devel
On 10/07/2011 05:27 AM, Jan Kiszka wrote:
> Update lnkst on link state changes so that guests can obtain this
> information via reading back the LED output pin. Works for Linux but
> not for guests that depend on the missing PHY.
>
> Signed-off-by: Jan Kiszka<jan.kiszka@siemens.com>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> hw/lance.c | 1 +
> hw/pcnet-pci.c | 1 +
> hw/pcnet.c | 7 +++++++
> hw/pcnet.h | 1 +
> 4 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/hw/lance.c b/hw/lance.c
> index d83e7f5..93d5fda 100644
> --- a/hw/lance.c
> +++ b/hw/lance.c
> @@ -97,6 +97,7 @@ static NetClientInfo net_lance_info = {
> .size = sizeof(NICState),
> .can_receive = pcnet_can_receive,
> .receive = pcnet_receive,
> + .link_status_changed = pcnet_set_link_status,
> .cleanup = lance_cleanup,
> };
>
> diff --git a/hw/pcnet-pci.c b/hw/pcnet-pci.c
> index cab1116..548bb50 100644
> --- a/hw/pcnet-pci.c
> +++ b/hw/pcnet-pci.c
> @@ -287,6 +287,7 @@ static NetClientInfo net_pci_pcnet_info = {
> .size = sizeof(NICState),
> .can_receive = pcnet_can_receive,
> .receive = pcnet_receive,
> + .link_status_changed = pcnet_set_link_status,
> .cleanup = pci_pcnet_cleanup,
> };
>
> diff --git a/hw/pcnet.c b/hw/pcnet.c
> index add3ec2..cba253b 100644
> --- a/hw/pcnet.c
> +++ b/hw/pcnet.c
> @@ -1197,6 +1197,13 @@ ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_)
> return size_;
> }
>
> +void pcnet_set_link_status(VLANClientState *nc)
> +{
> + PCNetState *d = DO_UPCAST(NICState, nc, nc)->opaque;
> +
> + d->lnkst = nc->link_down ? 0 : 0x40;
> +}
> +
> static void pcnet_transmit(PCNetState *s)
> {
> target_phys_addr_t xmit_cxda = 0;
> diff --git a/hw/pcnet.h b/hw/pcnet.h
> index 52cc52e..edc81c9 100644
> --- a/hw/pcnet.h
> +++ b/hw/pcnet.h
> @@ -58,6 +58,7 @@ uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr);
> uint32_t pcnet_bcr_readw(PCNetState *s, uint32_t rap);
> int pcnet_can_receive(VLANClientState *nc);
> ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_);
> +void pcnet_set_link_status(VLANClientState *nc);
> void pcnet_common_cleanup(PCNetState *d);
> int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info);
> extern const VMStateDescription vmstate_pcnet;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-01 22:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-07 10:27 [Qemu-devel] [PATCH] pcnet: Add link state support Jan Kiszka
2011-10-07 12:06 ` Jan Kiszka
2011-11-01 22:20 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).