qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 1.3 0/4] Net patches
@ 2012-11-01 11:10 Stefan Hajnoczi
  2012-11-01 11:10 ` [Qemu-devel] [PATCH 1/4] e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty Stefan Hajnoczi
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2012-11-01 11:10 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel, Stefan Hajnoczi

The following changes since commit 286d52ebfc0d0d53c2a878e454292fea14bad41b:

  target-mips: don't flush extra TLB on permissions upgrade (2012-10-31 22:20:49 +0100)

are available in the git repository at:

  git://github.com/stefanha/qemu.git net

for you to fetch changes up to 372254c6e5c078fb13b236bb648d2b9b2b0c70f1:

  e1000: pre-initialize RAH/RAL registers (2012-11-01 12:02:17 +0100)

----------------------------------------------------------------
Dmitry Fleytman (1):
      e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty

Gabriel L. Somlo (1):
      e1000: pre-initialize RAH/RAL registers

Lei Li (1):
      net: use "socket" model name for UDP sockets

Stefan Hajnoczi (1):
      net: Reject non-netdevs in qmp_netdev_del()

 hw/e1000.c   | 17 ++++++++++++-----
 net.c        |  9 ++++++++-
 net/socket.c |  2 +-
 3 files changed, 21 insertions(+), 7 deletions(-)

-- 
1.7.12.1

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

* [Qemu-devel] [PATCH 1/4] e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty
  2012-11-01 11:10 [Qemu-devel] [PULL 1.3 0/4] Net patches Stefan Hajnoczi
@ 2012-11-01 11:10 ` Stefan Hajnoczi
  2012-11-01 11:10 ` [Qemu-devel] [PATCH 2/4] net: use "socket" model name for UDP sockets Stefan Hajnoczi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2012-11-01 11:10 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Dmitry Fleytman, qemu-devel, Stefan Hajnoczi

From: Dmitry Fleytman <dmitry@daynix.com>

Real HW always treats RX ring with RDH == RDT as empty.
Emulation is supposed to behave the same.

Reported-by: Chris Webb <chris.webb@elastichosts.com>
Reported-by: Richard Davies <richard.davies@elastichosts.com>
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/e1000.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index e4f1ffe..ec32f59 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -92,7 +92,6 @@ typedef struct E1000State_st {
 
     uint32_t rxbuf_size;
     uint32_t rxbuf_min_shift;
-    int check_rxov;
     struct e1000_tx {
         unsigned char header[256];
         unsigned char vlan_header[4];
@@ -741,11 +740,11 @@ static bool e1000_has_rxbufs(E1000State *s, size_t total_size)
     int bufs;
     /* Fast-path short packets */
     if (total_size <= s->rxbuf_size) {
-        return s->mac_reg[RDH] != s->mac_reg[RDT] || !s->check_rxov;
+        return s->mac_reg[RDH] != s->mac_reg[RDT];
     }
     if (s->mac_reg[RDH] < s->mac_reg[RDT]) {
         bufs = s->mac_reg[RDT] - s->mac_reg[RDH];
-    } else if (s->mac_reg[RDH] > s->mac_reg[RDT] || !s->check_rxov) {
+    } else if (s->mac_reg[RDH] > s->mac_reg[RDT]) {
         bufs = s->mac_reg[RDLEN] /  sizeof(struct e1000_rx_desc) +
             s->mac_reg[RDT] - s->mac_reg[RDH];
     } else {
@@ -848,7 +847,6 @@ e1000_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 
         if (++s->mac_reg[RDH] * sizeof(desc) >= s->mac_reg[RDLEN])
             s->mac_reg[RDH] = 0;
-        s->check_rxov = 1;
         /* see comment in start_xmit; same here */
         if (s->mac_reg[RDH] == rdh_start) {
             DBGOUT(RXERR, "RDH wraparound @%x, RDT %x, RDLEN %x\n",
@@ -925,7 +923,6 @@ mac_writereg(E1000State *s, int index, uint32_t val)
 static void
 set_rdt(E1000State *s, int index, uint32_t val)
 {
-    s->check_rxov = 0;
     s->mac_reg[index] = val & 0xffff;
     if (e1000_has_rxbufs(s, 1)) {
         qemu_flush_queued_packets(&s->nic->nc);
-- 
1.7.12.1

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

* [Qemu-devel] [PATCH 2/4] net: use "socket" model name for UDP sockets
  2012-11-01 11:10 [Qemu-devel] [PULL 1.3 0/4] Net patches Stefan Hajnoczi
  2012-11-01 11:10 ` [Qemu-devel] [PATCH 1/4] e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty Stefan Hajnoczi
@ 2012-11-01 11:10 ` Stefan Hajnoczi
  2012-11-01 11:10 ` [Qemu-devel] [PATCH 3/4] net: Reject non-netdevs in qmp_netdev_del() Stefan Hajnoczi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2012-11-01 11:10 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel, Stefan Hajnoczi, Lei Li

From: Lei Li <lilei@linux.vnet.ibm.com>

Fix the problem that can not delete the udp socket.
It's caused by passing "udp" model to net_socket_udp_init,
but we do not have "udp" model in our model list.
Pass the right model "socket" to init function.

https://bugs.launchpad.net/qemu/+bug/1073585?comments=all

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 net/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/socket.c b/net/socket.c
index b75d567..c01323d 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -747,7 +747,7 @@ int net_init_socket(const NetClientOptions *opts, const char *name,
         error_report("localaddr= is mandatory with udp=");
         return -1;
     }
-    if (net_socket_udp_init(peer, "udp", name, sock->udp, sock->localaddr) ==
+    if (net_socket_udp_init(peer, "socket", name, sock->udp, sock->localaddr) ==
         -1) {
         return -1;
     }
-- 
1.7.12.1

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

* [Qemu-devel] [PATCH 3/4] net: Reject non-netdevs in qmp_netdev_del()
  2012-11-01 11:10 [Qemu-devel] [PULL 1.3 0/4] Net patches Stefan Hajnoczi
  2012-11-01 11:10 ` [Qemu-devel] [PATCH 1/4] e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty Stefan Hajnoczi
  2012-11-01 11:10 ` [Qemu-devel] [PATCH 2/4] net: use "socket" model name for UDP sockets Stefan Hajnoczi
@ 2012-11-01 11:10 ` Stefan Hajnoczi
  2012-11-01 11:10 ` [Qemu-devel] [PATCH 4/4] e1000: pre-initialize RAH/RAL registers Stefan Hajnoczi
  2012-11-01 19:33 ` [Qemu-devel] [PULL 1.3 0/4] Net patches Anthony Liguori
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2012-11-01 11:10 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel, Stefan Hajnoczi

The netdev_del command crashes when given a -net device, because it
calls qemu_opts_del(NULL).

Check that this is a -netdev before attempting to delete it and the
QemuOpts.

Note the subtle change from qemu_find_opts_err("netdev", errp) to
qemu_find_opts_err("netdev", NULL).  Since "netdev" is a built in
options group and we don't check for NULL return anyway, there's no use
in passing errp here.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 net.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net.c b/net.c
index ae4bc0d..e8ae13e 100644
--- a/net.c
+++ b/net.c
@@ -827,6 +827,7 @@ exit_err:
 void qmp_netdev_del(const char *id, Error **errp)
 {
     NetClientState *nc;
+    QemuOpts *opts;
 
     nc = qemu_find_netdev(id);
     if (!nc) {
@@ -834,8 +835,14 @@ void qmp_netdev_del(const char *id, Error **errp)
         return;
     }
 
+    opts = qemu_opts_find(qemu_find_opts_err("netdev", NULL), id);
+    if (!opts) {
+        error_setg(errp, "Device '%s' is not a netdev", id);
+        return;
+    }
+
     qemu_del_net_client(nc);
-    qemu_opts_del(qemu_opts_find(qemu_find_opts_err("netdev", errp), id));
+    qemu_opts_del(opts);
 }
 
 void print_net_client(Monitor *mon, NetClientState *nc)
-- 
1.7.12.1

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

* [Qemu-devel] [PATCH 4/4] e1000: pre-initialize RAH/RAL registers
  2012-11-01 11:10 [Qemu-devel] [PULL 1.3 0/4] Net patches Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2012-11-01 11:10 ` [Qemu-devel] [PATCH 3/4] net: Reject non-netdevs in qmp_netdev_del() Stefan Hajnoczi
@ 2012-11-01 11:10 ` Stefan Hajnoczi
  2012-11-01 19:33 ` [Qemu-devel] [PULL 1.3 0/4] Net patches Anthony Liguori
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2012-11-01 11:10 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: Gabriel Somlo, Gabriel L. Somlo, qemu-devel, Stefan Hajnoczi

From: "Gabriel L. Somlo" <gsomlo@gmail.com>

Some guest operating systems' drivers (Mac OS X in particular) fail to
properly initialize the Receive Address registers (probably expecting
them to be pre-initialized by an earlier component, such as a specific
proprietary BIOS). This patch pre-initializes the RA registers, allowing
OS X networking to function properly. Other guest operating systems are
not affected, and free to (re)initialize these registers during boot.

[According to the datasheet the Address Valid bits in the RA registers
are cleared on PCI or software reset.  This patch adds the NIC's MAC
address and sets Address Valid on reset.  So we diverge from real
hardware behavior here. -- Stefan]

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/e1000.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/hw/e1000.c b/hw/e1000.c
index ec32f59..cb7e7e8 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -265,6 +265,8 @@ rxbufsize(uint32_t v)
 static void e1000_reset(void *opaque)
 {
     E1000State *d = opaque;
+    uint8_t *macaddr = d->conf.macaddr.a;
+    int i;
 
     qemu_del_timer(d->autoneg_timer);
     memset(d->phy_reg, 0, sizeof d->phy_reg);
@@ -277,6 +279,14 @@ static void e1000_reset(void *opaque)
     if (d->nic->nc.link_down) {
         e1000_link_down(d);
     }
+
+    /* Some guests expect pre-initialized RAH/RAL (AddrValid flag + MACaddr) */
+    d->mac_reg[RA] = 0;
+    d->mac_reg[RA + 1] = E1000_RAH_AV;
+    for (i = 0; i < 4; i++) {
+        d->mac_reg[RA] |= macaddr[i] << (8 * i);
+        d->mac_reg[RA + 1] |= (i < 2) ? macaddr[i + 4] << (8 * i) : 0;
+    }
 }
 
 static void
-- 
1.7.12.1

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

* Re: [Qemu-devel] [PULL 1.3 0/4] Net patches
  2012-11-01 11:10 [Qemu-devel] [PULL 1.3 0/4] Net patches Stefan Hajnoczi
                   ` (3 preceding siblings ...)
  2012-11-01 11:10 ` [Qemu-devel] [PATCH 4/4] e1000: pre-initialize RAH/RAL registers Stefan Hajnoczi
@ 2012-11-01 19:33 ` Anthony Liguori
  4 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2012-11-01 19:33 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

Stefan Hajnoczi <stefanha@redhat.com> writes:

> The following changes since commit 286d52ebfc0d0d53c2a878e454292fea14bad41b:
>
>   target-mips: don't flush extra TLB on permissions upgrade (2012-10-31 22:20:49 +0100)
>
> are available in the git repository at:
>
>   git://github.com/stefanha/qemu.git net
>
> for you to fetch changes up to 372254c6e5c078fb13b236bb648d2b9b2b0c70f1:
>
>   e1000: pre-initialize RAH/RAL registers (2012-11-01 12:02:17 +0100)
>
> ----------------------------------------------------------------
> Dmitry Fleytman (1):
>       e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty
>
> Gabriel L. Somlo (1):
>       e1000: pre-initialize RAH/RAL registers
>
> Lei Li (1):
>       net: use "socket" model name for UDP sockets
>
> Stefan Hajnoczi (1):
>       net: Reject non-netdevs in qmp_netdev_del()
>

Pulled. Thanks.

Regards,

Anthony Liguori

>  hw/e1000.c   | 17 ++++++++++++-----
>  net.c        |  9 ++++++++-
>  net/socket.c |  2 +-
>  3 files changed, 21 insertions(+), 7 deletions(-)
>
> -- 
> 1.7.12.1

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

end of thread, other threads:[~2012-11-01 19:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01 11:10 [Qemu-devel] [PULL 1.3 0/4] Net patches Stefan Hajnoczi
2012-11-01 11:10 ` [Qemu-devel] [PATCH 1/4] e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty Stefan Hajnoczi
2012-11-01 11:10 ` [Qemu-devel] [PATCH 2/4] net: use "socket" model name for UDP sockets Stefan Hajnoczi
2012-11-01 11:10 ` [Qemu-devel] [PATCH 3/4] net: Reject non-netdevs in qmp_netdev_del() Stefan Hajnoczi
2012-11-01 11:10 ` [Qemu-devel] [PATCH 4/4] e1000: pre-initialize RAH/RAL registers Stefan Hajnoczi
2012-11-01 19:33 ` [Qemu-devel] [PULL 1.3 0/4] Net patches 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).