All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make NIC model fallback to default when specified model is not supported
@ 2010-09-20 10:21 Michal Novotny
  2010-09-20 12:07 ` Paolo Bonzini
  2010-09-20 14:53 ` Ian Jackson
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Novotny @ 2010-09-20 10:21 UTC (permalink / raw)
  To: 'xen-devel@lists.xensource.com'

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

Hi,
this is the patch to introduce a NIC model fallback to default when model
specified is not supported. It's been tested on x86_64 host with current
version of qemu-dm using the RHEL-5 i386 virtual machine and by trying to
setup the invalid (unsupported) model of NIC device. Also, the new constant
in the net.h called the DEFAULT_NIC_MODEL has been introduced to be able to
change the default NIC model easily. This variable is being used to set
the default NIC model when necessary.

It's been tested by running a guest with NIC model set to be "eee" which
is not supported and when the guest was started I tried to issue "lspci"
to list all the PCI devices and there was Realtek RTL-8239 (AS) card
which is basically the ne2k_pci card (default for Xen-4.1 qemu-dm) so
the old default has been preserved and it's being used as a fallback.

Michal

Signed-off-by: Michal Novotny<minovotn@redhat.com>

-- 
Michal Novotny<minovotn@redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat


[-- Attachment #2: xen-qemu-make-nic-model-fallback-to-default-when-unsupported.patch --]
[-- Type: text/x-patch, Size: 3538 bytes --]

>From fabe98d01d43a7b8157726407f344a943a233ad7 Mon Sep 17 00:00:00 2001
From: Michal Novotny <minovotn@redhat.com>
Date: Mon, 20 Sep 2010 14:22:28 +0200
Subject: [PATCH] Make NIC model fallback to default when specified model is not supported

Hi,
this is the patch to introduce a NIC model fallback to default when model
specified is not supported. It's been tested on x86_64 host with current
version of qemu-dm using the RHEL-5 i386 virtual machine and by trying to
setup the invalid (unsupported) model of NIC device. Also, the new constant
in the net.h called the DEFAULT_NIC_MODEL has been introduced to be able to
change the default NIC model easily. This variable is being used to set
the default NIC model when necessary.

It's been tested by running a guest with NIC model set to be "eee" which
is not supported and when the guest was started I tried to issue "lspci"
to list all the PCI devices and there was Realtek RTL-8239 (AS) card
which is basically the ne2k_pci card (default for Xen-4.1 qemu-dm) so
the old default has been preserved and it's being used as a fallback.

Michal

Signed-off-by: Michal Novotny<minovotn@redhat.com>
---
 hw/pc.c |    2 +-
 net.c   |   11 ++++++++++-
 net.h   |    3 +++
 vl.c    |    2 +-
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 4c9a164..3b6d15d 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1077,7 +1077,7 @@ vga_bios_error:
         if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0))
             pc_init_ne2k_isa(nd, i8259);
         else
-            pci_nic_init(pci_bus, nd, -1, "ne2k_pci");
+            pci_nic_init(pci_bus, nd, -1, NIC_DEFAULT_MODEL);
     }
 
     qemu_system_hot_add_init();
diff --git a/net.c b/net.c
index 720027c..f10ba8b 100644
--- a/net.c
+++ b/net.c
@@ -1610,12 +1610,21 @@ void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
     if (!nd->model)
         nd->model = strdup(default_model);
 
+again:
     if (strcmp(nd->model, "?") != 0) {
         for (i = 0 ; models[i]; i++)
             if (strcmp(nd->model, models[i]) == 0)
                 return;
 
-        fprintf(stderr, "qemu: Unsupported NIC model: %s\n", nd->model);
+        if (strcmp(nd->model, NIC_DEFAULT_MODEL) != 0) {
+            fprintf(stderr, "qemu: Unsupported NIC model: %s, using default: %s\n",
+                             nd->model, NIC_DEFAULT_MODEL);
+            nd->model = strdup(NIC_DEFAULT_MODEL);
+            goto again;
+        }
+        else
+            fprintf(stderr, "qemu: Unsupported default NIC model: %s (probably a bug)\n", nd->model);
+
         exit_status = 1;
     }
 
diff --git a/net.h b/net.h
index bc749d9..e7626f4 100644
--- a/net.h
+++ b/net.h
@@ -3,6 +3,9 @@
 
 #include "qemu-common.h"
 
+/* Default NIC model to be used - also used as a fallback model when model specified doesn't exist */
+#define NIC_DEFAULT_MODEL "ne2k_pci"
+
 /* VLANs support */
 
 typedef ssize_t (IOReadvHandler)(void *, const struct iovec *, int);
diff --git a/vl.c b/vl.c
index 1673cd4..25db3a0 100644
--- a/vl.c
+++ b/vl.c
@@ -5727,7 +5727,7 @@ int main(int argc, char **argv, char **envp)
 	    char buf[1024];
             if (net_boot & (1 << i)) {
                 if (model == NULL)
-                    model = "ne2k_pci";
+                    model = NIC_DEFAULT_MODEL;
                 snprintf(buf, sizeof(buf), "%s/pxe-%s.bin", bios_dir, model);
                 if (get_image_size(buf) > 0) {
                     if (nb_option_roms >= MAX_OPTION_ROMS) {
-- 
1.5.5.6


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: [PATCH] Make NIC model fallback to default when specified model is not supported
  2010-09-20 10:21 [PATCH] Make NIC model fallback to default when specified model is not supported Michal Novotny
@ 2010-09-20 12:07 ` Paolo Bonzini
  2010-09-20 14:53 ` Ian Jackson
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2010-09-20 12:07 UTC (permalink / raw)
  To: Michal Novotny; +Cc: 'xen-devel@lists.xensource.com'

On 09/20/2010 12:21 PM, Michal Novotny wrote:
> Hi,
> this is the patch to introduce a NIC model fallback to default when model
> specified is not supported. It's been tested on x86_64 host with current
> version of qemu-dm using the RHEL-5 i386 virtual machine and by trying to
> setup the invalid (unsupported) model of NIC device. Also, the new constant
> in the net.h called the DEFAULT_NIC_MODEL has been introduced to be able to
> change the default NIC model easily. This variable is being used to set
> the default NIC model when necessary.
>
> It's been tested by running a guest with NIC model set to be "eee" which
> is not supported and when the guest was started I tried to issue "lspci"
> to list all the PCI devices and there was Realtek RTL-8239 (AS) card
> which is basically the ne2k_pci card (default for Xen-4.1 qemu-dm) so
> the old default has been preserved and it's being used as a fallback.

I don't think qemu-dm and upstream QEMU should diverge again, so this 
patch does not sound like a good thing for Xen's ioemu codebase.

Paolo

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

* Re: [PATCH] Make NIC model fallback to default when specified model is not supported
  2010-09-20 10:21 [PATCH] Make NIC model fallback to default when specified model is not supported Michal Novotny
  2010-09-20 12:07 ` Paolo Bonzini
@ 2010-09-20 14:53 ` Ian Jackson
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Jackson @ 2010-09-20 14:53 UTC (permalink / raw)
  To: Michal Novotny; +Cc: 'xen-devel@lists.xensource.com'

Michal Novotny writes ("[Xen-devel] [PATCH] Make NIC model fallback to default when specified model is not supported"):
> this is the patch to introduce a NIC model fallback to default when model
> specified is not supported.

This functionality should be done in the toolstack (libxl, xend) not
in qemu-dm.  I see that currently it's done in xl_cmdimpl.c (ie, in
xl) which I think is wrong.  These default settings should be in
libxl.

But touching qemu for this is definitely wrong.

Ian.

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

end of thread, other threads:[~2010-09-20 14:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-20 10:21 [PATCH] Make NIC model fallback to default when specified model is not supported Michal Novotny
2010-09-20 12:07 ` Paolo Bonzini
2010-09-20 14:53 ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.