qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/4] Net patches
@ 2013-01-08 10:45 Stefan Hajnoczi
  2013-01-08 10:45 ` [Qemu-devel] [PATCH 1/4] e1000: Discard oversized packets based on SBP|LPE Stefan Hajnoczi
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2013-01-08 10:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Stefan Hajnoczi

The following changes since commit 8e4a424b305e29dc0e454f52df3b35577f342975:

  Revert "virtio-pci: replace byte swap hack" (2013-01-06 18:30:17 +0000)

are available in the git repository at:

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

for you to fetch changes up to 83f58e570f21c3e7227e7fbef1fc0e18b5ed7ea9:

  rtl8139: preserve link state across device reset (2013-01-07 10:43:21 +0100)

----------------------------------------------------------------
Amos Kong (3):
      net: clean up network at qemu process termination
      e1000: no need auto-negotiation if link was down
      rtl8139: preserve link state across device reset

Michael Contreras (1):
      e1000: Discard oversized packets based on SBP|LPE

 hw/e1000.c   | 12 ++++++++++--
 hw/rtl8139.c |  3 ++-
 vl.c         |  4 +++-
 3 files changed, 15 insertions(+), 4 deletions(-)

-- 
1.8.0.2

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

* [Qemu-devel] [PATCH 1/4] e1000: Discard oversized packets based on SBP|LPE
  2013-01-08 10:45 [Qemu-devel] [PULL 0/4] Net patches Stefan Hajnoczi
@ 2013-01-08 10:45 ` Stefan Hajnoczi
  2013-01-08 10:45 ` [Qemu-devel] [PATCH 2/4] net: clean up network at qemu process termination Stefan Hajnoczi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2013-01-08 10:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Contreras, Anthony Liguori, Stefan Hajnoczi

From: Michael Contreras <michael@inetric.com>

Discard packets longer than 16384 when !SBP to match the hardware behavior.

Signed-off-by: Michael Contreras <michael@inetric.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/e1000.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index 92fb00a..8fd1654 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -61,6 +61,8 @@ static int debugflags = DBGBIT(TXERR) | DBGBIT(GENERAL);
 
 /* this is the size past which hardware will drop packets when setting LPE=0 */
 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
+/* this is the size past which hardware will drop packets when setting LPE=1 */
+#define MAXIMUM_ETHERNET_LPE_SIZE 16384
 
 /*
  * HW models:
@@ -809,8 +811,9 @@ e1000_receive(NetClientState *nc, const uint8_t *buf, size_t size)
     }
 
     /* Discard oversized packets if !LPE and !SBP. */
-    if (size > MAXIMUM_ETHERNET_VLAN_SIZE
-        && !(s->mac_reg[RCTL] & E1000_RCTL_LPE)
+    if ((size > MAXIMUM_ETHERNET_LPE_SIZE ||
+        (size > MAXIMUM_ETHERNET_VLAN_SIZE
+        && !(s->mac_reg[RCTL] & E1000_RCTL_LPE)))
         && !(s->mac_reg[RCTL] & E1000_RCTL_SBP)) {
         return size;
     }
-- 
1.8.0.2

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

* [Qemu-devel] [PATCH 2/4] net: clean up network at qemu process termination
  2013-01-08 10:45 [Qemu-devel] [PULL 0/4] Net patches Stefan Hajnoczi
  2013-01-08 10:45 ` [Qemu-devel] [PATCH 1/4] e1000: Discard oversized packets based on SBP|LPE Stefan Hajnoczi
@ 2013-01-08 10:45 ` Stefan Hajnoczi
  2013-01-08 10:45 ` [Qemu-devel] [PATCH 3/4] e1000: no need auto-negotiation if link was down Stefan Hajnoczi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2013-01-08 10:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Amos Kong, Stefan Hajnoczi

From: Amos Kong <akong@redhat.com>

We don't clean up network if fails to parse "-device" parameters without
calling net_cleanup(). I touch a problem, the tap device which is
created by qemu-ifup script could not be removed by qemu-ifdown script.
Some similar problems also exist in vl.c

In this patch, if network initialization successes, a cleanup function
will be registered to be called at qemu process termination.

Signed-off-by: Amos Kong <akong@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 vl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vl.c b/vl.c
index f056c95..79e5122 100644
--- a/vl.c
+++ b/vl.c
@@ -3762,6 +3762,9 @@ int main(int argc, char **argv, char **envp)
     }
     configure_icount(icount_option);
 
+    /* clean up network at qemu process termination */
+    atexit(&net_cleanup);
+
     if (net_init_clients() < 0) {
         exit(1);
     }
@@ -4014,7 +4017,6 @@ int main(int argc, char **argv, char **envp)
     main_loop();
     bdrv_close_all();
     pause_all_vcpus();
-    net_cleanup();
     res_free();
 
     return 0;
-- 
1.8.0.2

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

* [Qemu-devel] [PATCH 3/4] e1000: no need auto-negotiation if link was down
  2013-01-08 10:45 [Qemu-devel] [PULL 0/4] Net patches Stefan Hajnoczi
  2013-01-08 10:45 ` [Qemu-devel] [PATCH 1/4] e1000: Discard oversized packets based on SBP|LPE Stefan Hajnoczi
  2013-01-08 10:45 ` [Qemu-devel] [PATCH 2/4] net: clean up network at qemu process termination Stefan Hajnoczi
@ 2013-01-08 10:45 ` Stefan Hajnoczi
  2013-01-08 10:45 ` [Qemu-devel] [PATCH 4/4] rtl8139: preserve link state across device reset Stefan Hajnoczi
  2013-01-08 20:34 ` [Qemu-devel] [PULL 0/4] Net patches Anthony Liguori
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2013-01-08 10:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Amos Kong, Jason Wang, Stefan Hajnoczi

From: Amos Kong <akong@redhat.com>

Commit b9d03e352cb6b31a66545763f6a1e20c9abf0c2c added link
auto-negotiation emulation, it would always set link up by
callback function. Problem exists if original link status
was down, link status should not be changed in auto-negotiation.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/e1000.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/e1000.c b/hw/e1000.c
index 8fd1654..0f177ff 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -166,6 +166,11 @@ static void
 set_phy_ctrl(E1000State *s, int index, uint16_t val)
 {
     if ((val & MII_CR_AUTO_NEG_EN) && (val & MII_CR_RESTART_AUTO_NEG)) {
+        /* no need auto-negotiation if link was down */
+        if (s->nic->nc.link_down) {
+            s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
+            return;
+        }
         s->nic->nc.link_down = true;
         e1000_link_down(s);
         s->phy_reg[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE;
-- 
1.8.0.2

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

* [Qemu-devel] [PATCH 4/4] rtl8139: preserve link state across device reset
  2013-01-08 10:45 [Qemu-devel] [PULL 0/4] Net patches Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2013-01-08 10:45 ` [Qemu-devel] [PATCH 3/4] e1000: no need auto-negotiation if link was down Stefan Hajnoczi
@ 2013-01-08 10:45 ` Stefan Hajnoczi
  2013-01-08 20:34 ` [Qemu-devel] [PULL 0/4] Net patches Anthony Liguori
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2013-01-08 10:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Amos Kong, Stefan Hajnoczi

From: Amos Kong <akong@redhat.com>

A device reset does not affect the link state, only set_link does.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/rtl8139.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index c59ec6b..3e08062 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -1258,7 +1258,8 @@ static void rtl8139_reset(DeviceState *d)
     s->BasicModeStatus  = 0x7809;
     //s->BasicModeStatus |= 0x0040; /* UTP medium */
     s->BasicModeStatus |= 0x0020; /* autonegotiation completed */
-    s->BasicModeStatus |= 0x0004; /* link is up */
+    /* preserve link state */
+    s->BasicModeStatus |= s->nic->nc.link_down ? 0 : 0x04;
 
     s->NWayAdvert    = 0x05e1; /* all modes, full duplex */
     s->NWayLPAR      = 0x05e1; /* all modes, full duplex */
-- 
1.8.0.2

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

* Re: [Qemu-devel] [PULL 0/4] Net patches
  2013-01-08 10:45 [Qemu-devel] [PULL 0/4] Net patches Stefan Hajnoczi
                   ` (3 preceding siblings ...)
  2013-01-08 10:45 ` [Qemu-devel] [PATCH 4/4] rtl8139: preserve link state across device reset Stefan Hajnoczi
@ 2013-01-08 20:34 ` Anthony Liguori
  4 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2013-01-08 20:34 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Anthony Liguori

Pulled, thanks.

Regards,

Anthony Liguori

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

end of thread, other threads:[~2013-01-08 20:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-08 10:45 [Qemu-devel] [PULL 0/4] Net patches Stefan Hajnoczi
2013-01-08 10:45 ` [Qemu-devel] [PATCH 1/4] e1000: Discard oversized packets based on SBP|LPE Stefan Hajnoczi
2013-01-08 10:45 ` [Qemu-devel] [PATCH 2/4] net: clean up network at qemu process termination Stefan Hajnoczi
2013-01-08 10:45 ` [Qemu-devel] [PATCH 3/4] e1000: no need auto-negotiation if link was down Stefan Hajnoczi
2013-01-08 10:45 ` [Qemu-devel] [PATCH 4/4] rtl8139: preserve link state across device reset Stefan Hajnoczi
2013-01-08 20:34 ` [Qemu-devel] [PULL 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).