o from the qemu mailing list, prompted by brad@, improve userland
networking througput since otherwise the emulated NICs didn't have a way of indicating the receive queue is full and would drop packets. o bump PKGNAME o inttypes.h made irrelevent a few chunks of patches, so use it instead
This commit is contained in:
parent
de3b7684cd
commit
4dbc6a7738
@ -1,10 +1,11 @@
|
||||
# $OpenBSD: Makefile,v 1.10 2006/01/04 21:47:39 brad Exp $
|
||||
# $OpenBSD: Makefile,v 1.11 2006/02/08 13:44:17 todd Exp $
|
||||
|
||||
# no success building on other archs yet
|
||||
ONLY_FOR_ARCHS= amd64 arm i386 powerpc
|
||||
|
||||
COMMENT= "multi system emulator"
|
||||
DISTNAME= qemu-0.8.0
|
||||
PKGNAME= ${DISTNAME}p1
|
||||
CATEGORIES= emulators
|
||||
|
||||
HOMEPAGE= http://fabrice.bellard.free.fr/qemu/
|
||||
|
@ -1,16 +0,0 @@
|
||||
$OpenBSD: patch-audio_audio_c,v 1.2 2005/12/27 07:56:15 todd Exp $
|
||||
--- audio/audio.c.orig Mon Dec 19 16:51:53 2005
|
||||
+++ audio/audio.c Tue Dec 20 10:59:25 2005
|
||||
@@ -55,6 +55,12 @@ static struct audio_driver *drvtab[] = {
|
||||
&wav_audio_driver
|
||||
};
|
||||
|
||||
+#ifdef __OpenBSD__
|
||||
+#include <sys/limits.h>
|
||||
+#define INT16_MAX SHRT_MAX
|
||||
+#define UINT64_MAX ULONG_MAX
|
||||
+#endif
|
||||
+
|
||||
struct fixed_settings {
|
||||
int enabled;
|
||||
int nb_voices;
|
@ -1,6 +1,6 @@
|
||||
$OpenBSD: patch-configure,v 1.3 2005/12/27 07:56:15 todd Exp $
|
||||
$OpenBSD: patch-configure,v 1.4 2006/02/08 13:44:17 todd Exp $
|
||||
--- configure.orig Mon Dec 19 16:51:53 2005
|
||||
+++ configure Tue Dec 20 08:06:20 2005
|
||||
+++ configure Wed Feb 8 06:05:57 2006
|
||||
@@ -21,8 +21,8 @@ prefix=""
|
||||
interp_prefix="/usr/gnemul/qemu-%M"
|
||||
static="no"
|
||||
@ -79,14 +79,13 @@ $OpenBSD: patch-configure,v 1.3 2005/12/27 07:56:15 todd Exp $
|
||||
fi
|
||||
if test "$coreaudio" = "yes" ; then
|
||||
echo "CONFIG_COREAUDIO=yes" >> $config_mak
|
||||
@@ -655,6 +663,14 @@ if [ "$bsd" = "yes" ] ; then
|
||||
@@ -655,6 +663,13 @@ if [ "$bsd" = "yes" ] ; then
|
||||
echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
|
||||
echo "#define _BSD 1" >> $config_h
|
||||
fi
|
||||
+
|
||||
+if [ "$openbsd" = "yes" ] ; then
|
||||
+ echo "#define ENOTSUP 4096" >> $config_h
|
||||
+ echo "#define PRIx64 \"llX\"" >> $config_h
|
||||
+ echo "#define qemu_siginfo siginfo_t" >> $config_h
|
||||
+else
|
||||
+ echo "#define qemu_siginfo struct siginfo" >> $config_h
|
||||
|
24
emulators/qemu/patches/patch-hw_lance_c
Normal file
24
emulators/qemu/patches/patch-hw_lance_c
Normal file
@ -0,0 +1,24 @@
|
||||
$OpenBSD: patch-hw_lance_c,v 1.1 2006/02/08 13:44:17 todd Exp $
|
||||
--- hw/lance.c.orig Mon Dec 19 17:51:53 2005
|
||||
+++ hw/lance.c Sat Jan 28 22:10:33 2006
|
||||
@@ -283,6 +283,11 @@ static CPUWriteMemoryFunc *lance_mem_wri
|
||||
|
||||
#define MIN_BUF_SIZE 60
|
||||
|
||||
+static void lance_can_receive(void *opaque)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
static void lance_receive(void *opaque, const uint8_t *buf, int size)
|
||||
{
|
||||
LANCEState *s = opaque;
|
||||
@@ -440,7 +445,7 @@ void lance_init(NICInfo *nd, int irq, ui
|
||||
|
||||
lance_reset(s);
|
||||
|
||||
- s->vc = qemu_new_vlan_client(nd->vlan, lance_receive, s);
|
||||
+ s->vc = qemu_new_vlan_client(nd->vlan, lance_receive, lance_can_receive, s);
|
||||
|
||||
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
|
||||
"lance macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
|
71
emulators/qemu/patches/patch-hw_ne2000_c
Normal file
71
emulators/qemu/patches/patch-hw_ne2000_c
Normal file
@ -0,0 +1,71 @@
|
||||
$OpenBSD: patch-hw_ne2000_c,v 1.1 2006/02/08 13:44:17 todd Exp $
|
||||
--- hw/ne2000.c.orig Mon Dec 19 17:51:53 2005
|
||||
+++ hw/ne2000.c Sat Jan 28 22:10:33 2006
|
||||
@@ -200,14 +200,10 @@ static int compute_mcast_idx(const uint8
|
||||
return (crc >> 26);
|
||||
}
|
||||
|
||||
-/* return the max buffer size if the NE2000 can receive more data */
|
||||
-static int ne2000_can_receive(void *opaque)
|
||||
+static int ne2000_buffer_full(NE2000State *s)
|
||||
{
|
||||
- NE2000State *s = opaque;
|
||||
int avail, index, boundary;
|
||||
-
|
||||
- if (s->cmd & E8390_STOP)
|
||||
- return 0;
|
||||
+
|
||||
index = s->curpag << 8;
|
||||
boundary = s->boundary << 8;
|
||||
if (index < boundary)
|
||||
@@ -215,10 +211,19 @@ static int ne2000_can_receive(void *opaq
|
||||
else
|
||||
avail = (s->stop - s->start) - (index - boundary);
|
||||
if (avail < (MAX_ETH_FRAME_SIZE + 4))
|
||||
- return 0;
|
||||
- return MAX_ETH_FRAME_SIZE;
|
||||
+ return 1;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
+static int ne2000_can_receive(void *opaque)
|
||||
+{
|
||||
+ NE2000State *s = opaque;
|
||||
+
|
||||
+ if (s->cmd & E8390_STOP)
|
||||
+ return 1;
|
||||
+ return !ne2000_buffer_full(s);
|
||||
+}
|
||||
+
|
||||
#define MIN_BUF_SIZE 60
|
||||
|
||||
static void ne2000_receive(void *opaque, const uint8_t *buf, int size)
|
||||
@@ -234,7 +239,7 @@ static void ne2000_receive(void *opaque,
|
||||
printf("NE2000: received len=%d\n", size);
|
||||
#endif
|
||||
|
||||
- if (!ne2000_can_receive(s))
|
||||
+ if (s->cmd & E8390_STOP || ne2000_buffer_full(s))
|
||||
return;
|
||||
|
||||
/* XXX: check this */
|
||||
@@ -715,7 +720,8 @@ void isa_ne2000_init(int base, int irq,
|
||||
|
||||
ne2000_reset(s);
|
||||
|
||||
- s->vc = qemu_new_vlan_client(nd->vlan, ne2000_receive, s);
|
||||
+ s->vc = qemu_new_vlan_client(nd->vlan, ne2000_receive,
|
||||
+ ne2000_can_receive, s);
|
||||
|
||||
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
|
||||
"ne2000 macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
@@ -784,7 +790,8 @@ void pci_ne2000_init(PCIBus *bus, NICInf
|
||||
s->pci_dev = (PCIDevice *)d;
|
||||
memcpy(s->macaddr, nd->macaddr, 6);
|
||||
ne2000_reset(s);
|
||||
- s->vc = qemu_new_vlan_client(nd->vlan, ne2000_receive, s);
|
||||
+ s->vc = qemu_new_vlan_client(nd->vlan, ne2000_receive,
|
||||
+ ne2000_can_receive, s);
|
||||
|
||||
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
|
||||
"ne2000 pci macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
|
30
emulators/qemu/patches/patch-hw_smc91c111_c
Normal file
30
emulators/qemu/patches/patch-hw_smc91c111_c
Normal file
@ -0,0 +1,30 @@
|
||||
$OpenBSD: patch-hw_smc91c111_c,v 1.1 2006/02/08 13:44:17 todd Exp $
|
||||
--- hw/smc91c111.c.orig Mon Dec 19 17:51:53 2005
|
||||
+++ hw/smc91c111.c Sat Jan 28 22:10:33 2006
|
||||
@@ -593,6 +593,17 @@ static uint32_t smc91c111_readl(void *op
|
||||
return val;
|
||||
}
|
||||
|
||||
+static int smc91c111_can_receive(void *opaque)
|
||||
+{
|
||||
+ smc91c111_state *s = (smc91c111_state *)opaque;
|
||||
+
|
||||
+ if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST))
|
||||
+ return 1;
|
||||
+ if (s->allocated == (1 << NUM_PACKETS) - 1)
|
||||
+ return 0;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
static void smc91c111_receive(void *opaque, const uint8_t *buf, int size)
|
||||
{
|
||||
smc91c111_state *s = (smc91c111_state *)opaque;
|
||||
@@ -697,6 +708,7 @@ void smc91c111_init(NICInfo *nd, uint32_
|
||||
|
||||
smc91c111_reset(s);
|
||||
|
||||
- s->vc = qemu_new_vlan_client(nd->vlan, smc91c111_receive, s);
|
||||
+ s->vc = qemu_new_vlan_client(nd->vlan, smc91c111_receive,
|
||||
+ smc91c111_can_receive, s);
|
||||
/* ??? Save/restore. */
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
$OpenBSD: patch-vl_c,v 1.5 2005/12/27 07:56:15 todd Exp $
|
||||
--- vl.c.orig Mon Dec 19 16:51:53 2005
|
||||
+++ vl.c Tue Dec 20 10:53:26 2005
|
||||
$OpenBSD: patch-vl_c,v 1.6 2006/02/08 13:44:17 todd Exp $
|
||||
--- vl.c.orig Mon Dec 19 17:51:53 2005
|
||||
+++ vl.c Sat Jan 28 22:10:33 2006
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <netdb.h>
|
||||
#ifdef _BSD
|
||||
@ -43,7 +43,73 @@ $OpenBSD: patch-vl_c,v 1.5 2005/12/27 07:56:15 todd Exp $
|
||||
#endif
|
||||
|
||||
static int64_t cpu_ticks_offset;
|
||||
@@ -2037,11 +2054,35 @@ static int tap_open(char *ifname, int if
|
||||
@@ -1768,13 +1785,16 @@ VLANState *qemu_find_vlan(int id)
|
||||
}
|
||||
|
||||
VLANClientState *qemu_new_vlan_client(VLANState *vlan,
|
||||
- IOReadHandler *fd_read, void *opaque)
|
||||
+ IOReadHandler *fd_read,
|
||||
+ IOCanRWHandler *fd_can_read,
|
||||
+ void *opaque)
|
||||
{
|
||||
VLANClientState *vc, **pvc;
|
||||
vc = qemu_mallocz(sizeof(VLANClientState));
|
||||
if (!vc)
|
||||
return NULL;
|
||||
vc->fd_read = fd_read;
|
||||
+ vc->fd_can_read = fd_can_read;
|
||||
vc->opaque = opaque;
|
||||
vc->vlan = vlan;
|
||||
|
||||
@@ -1786,6 +1806,20 @@ VLANClientState *qemu_new_vlan_client(VL
|
||||
return vc;
|
||||
}
|
||||
|
||||
+int qemu_can_send_packet(VLANClientState *vc1)
|
||||
+{
|
||||
+ VLANState *vlan = vc1->vlan;
|
||||
+ VLANClientState *vc;
|
||||
+
|
||||
+ for(vc = vlan->first_client; vc != NULL; vc = vc->next) {
|
||||
+ if (vc != vc1) {
|
||||
+ if (vc->fd_can_read && !vc->fd_can_read(vc->opaque))
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
void qemu_send_packet(VLANClientState *vc1, const uint8_t *buf, int size)
|
||||
{
|
||||
VLANState *vlan = vc1->vlan;
|
||||
@@ -1811,7 +1845,7 @@ static VLANClientState *slirp_vc;
|
||||
|
||||
int slirp_can_output(void)
|
||||
{
|
||||
- return 1;
|
||||
+ qemu_can_send_packet(slirp_vc);
|
||||
}
|
||||
|
||||
void slirp_output(const uint8_t *pkt, int pkt_len)
|
||||
@@ -1839,7 +1873,7 @@ static int net_slirp_init(VLANState *vla
|
||||
slirp_init();
|
||||
}
|
||||
slirp_vc = qemu_new_vlan_client(vlan,
|
||||
- slirp_receive, NULL);
|
||||
+ slirp_receive, NULL, NULL);
|
||||
snprintf(slirp_vc->info_str, sizeof(slirp_vc->info_str), "user redirector");
|
||||
return 0;
|
||||
}
|
||||
@@ -2024,7 +2058,7 @@ static TAPState *net_tap_fd_init(VLANSta
|
||||
if (!s)
|
||||
return NULL;
|
||||
s->fd = fd;
|
||||
- s->vc = qemu_new_vlan_client(vlan, tap_receive, s);
|
||||
+ s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s);
|
||||
qemu_set_fd_handler(s->fd, tap_send, NULL, s);
|
||||
snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: fd=%d", fd);
|
||||
return s;
|
||||
@@ -2037,11 +2071,35 @@ static int tap_open(char *ifname, int if
|
||||
char *dev;
|
||||
struct stat s;
|
||||
|
||||
@ -79,7 +145,25 @@ $OpenBSD: patch-vl_c,v 1.5 2005/12/27 07:56:15 todd Exp $
|
||||
|
||||
fstat(fd, &s);
|
||||
dev = devname(s.st_rdev, S_IFCHR);
|
||||
@@ -3986,6 +4027,7 @@ void help(void)
|
||||
@@ -2327,7 +2385,7 @@ static NetSocketState *net_socket_fd_ini
|
||||
return NULL;
|
||||
s->fd = fd;
|
||||
|
||||
- s->vc = qemu_new_vlan_client(vlan, net_socket_receive_dgram, s);
|
||||
+ s->vc = qemu_new_vlan_client(vlan, net_socket_receive_dgram, NULL, s);
|
||||
qemu_set_fd_handler(s->fd, net_socket_send_dgram, NULL, s);
|
||||
|
||||
/* mcast: save bound address as dst */
|
||||
@@ -2355,7 +2413,7 @@ static NetSocketState *net_socket_fd_ini
|
||||
return NULL;
|
||||
s->fd = fd;
|
||||
s->vc = qemu_new_vlan_client(vlan,
|
||||
- net_socket_receive, s);
|
||||
+ net_socket_receive, NULL, s);
|
||||
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
|
||||
"socket: fd=%d", fd);
|
||||
if (is_connected) {
|
||||
@@ -3986,6 +4044,7 @@ void help(void)
|
||||
#if defined(TARGET_PPC) || defined(TARGET_SPARC)
|
||||
"-g WxH[xDEPTH] Set the initial graphical resolution and depth\n"
|
||||
#endif
|
||||
@ -87,7 +171,7 @@ $OpenBSD: patch-vl_c,v 1.5 2005/12/27 07:56:15 todd Exp $
|
||||
"\n"
|
||||
"Network options:\n"
|
||||
"-net nic[,vlan=n][,macaddr=addr]\n"
|
||||
@@ -4093,6 +4135,7 @@ enum {
|
||||
@@ -4093,6 +4152,7 @@ enum {
|
||||
QEMU_OPTION_audio_help,
|
||||
QEMU_OPTION_soundhw,
|
||||
#endif
|
||||
@ -95,7 +179,7 @@ $OpenBSD: patch-vl_c,v 1.5 2005/12/27 07:56:15 todd Exp $
|
||||
|
||||
QEMU_OPTION_net,
|
||||
QEMU_OPTION_tftp,
|
||||
@@ -4195,6 +4238,7 @@ const QEMUOption qemu_options[] = {
|
||||
@@ -4195,6 +4255,7 @@ const QEMUOption qemu_options[] = {
|
||||
|
||||
/* temporary options */
|
||||
{ "usb", 0, QEMU_OPTION_usb },
|
||||
@ -103,7 +187,7 @@ $OpenBSD: patch-vl_c,v 1.5 2005/12/27 07:56:15 todd Exp $
|
||||
{ "cirrusvga", 0, QEMU_OPTION_cirrusvga },
|
||||
{ NULL },
|
||||
};
|
||||
@@ -4441,7 +4485,7 @@ int main(int argc, char **argv)
|
||||
@@ -4441,7 +4502,7 @@ int main(int argc, char **argv)
|
||||
serial_devices[i][0] = '\0';
|
||||
serial_device_index = 0;
|
||||
|
||||
@ -112,7 +196,7 @@ $OpenBSD: patch-vl_c,v 1.5 2005/12/27 07:56:15 todd Exp $
|
||||
for(i = 1; i < MAX_PARALLEL_PORTS; i++)
|
||||
parallel_devices[i][0] = '\0';
|
||||
parallel_device_index = 0;
|
||||
@@ -4601,6 +4645,9 @@ int main(int argc, char **argv)
|
||||
@@ -4601,6 +4662,9 @@ int main(int argc, char **argv)
|
||||
optarg);
|
||||
nb_net_clients++;
|
||||
break;
|
||||
|
@ -1,16 +1,40 @@
|
||||
$OpenBSD: patch-vl_h,v 1.2 2005/12/27 07:56:15 todd Exp $
|
||||
--- vl.h.orig Mon Dec 19 16:51:53 2005
|
||||
+++ vl.h Tue Dec 20 10:55:04 2005
|
||||
@@ -729,6 +729,12 @@ int fdctrl_get_drive_type(fdctrl_t *fdct
|
||||
$OpenBSD: patch-vl_h,v 1.3 2006/02/08 13:44:17 todd Exp $
|
||||
--- vl.h.orig Mon Dec 19 17:51:53 2005
|
||||
+++ vl.h Sat Jan 28 22:10:33 2006
|
||||
@@ -279,6 +279,9 @@ typedef struct VLANClientState VLANClien
|
||||
|
||||
struct VLANClientState {
|
||||
IOReadHandler *fd_read;
|
||||
+ /* Packets may still be sent if this returns zero. It's used to
|
||||
+ rate-limit the slirp code. */
|
||||
+ IOCanRWHandler *fd_can_read;
|
||||
void *opaque;
|
||||
struct VLANClientState *next;
|
||||
struct VLANState *vlan;
|
||||
@@ -293,8 +296,12 @@ typedef struct VLANState {
|
||||
|
||||
VLANState *qemu_find_vlan(int id);
|
||||
VLANClientState *qemu_new_vlan_client(VLANState *vlan,
|
||||
- IOReadHandler *fd_read, void *opaque);
|
||||
+ IOReadHandler *fd_read,
|
||||
+ IOCanRWHandler *fd_can_read,
|
||||
+ void *opaque);
|
||||
+int qemu_can_send_packet(VLANClientState *vc);
|
||||
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
|
||||
+void qemu_handler_true(void *opaque);
|
||||
|
||||
void do_info_network(void);
|
||||
|
||||
@@ -728,6 +735,12 @@ int fdctrl_get_drive_type(fdctrl_t *fdct
|
||||
|
||||
void isa_ne2000_init(int base, int irq, NICInfo *nd);
|
||||
void pci_ne2000_init(PCIBus *bus, NICInfo *nd);
|
||||
|
||||
+
|
||||
+/* pcnet.c */
|
||||
+
|
||||
+extern int nic_pcnet;
|
||||
+
|
||||
+void pci_pcnet_init(PCIBus *bus, NICInfo *nd);
|
||||
+
|
||||
|
||||
/* pckbd.c */
|
||||
|
||||
void kbd_init(void);
|
||||
|
@ -2,6 +2,11 @@
|
||||
| Quick Start:
|
||||
| 1. get a bootable floppy image
|
||||
| 2. qemu-img create -f qcow virtual.hd 10G
|
||||
| 3. qemu -m 32 -fda floppy.fs -boot a virtual.hd
|
||||
| 3. qemu -m 32 -fda floppy.fs -boot a -monitor stdio virtual.hd
|
||||
| (initial install to hard drive)
|
||||
| 4. qemu-img convert -c -O qcow virtual.hd tmp && mv tmp virtual.hd
|
||||
| (compress hard drive while qemu is not running)
|
||||
| 5. qemu -m 32 -monitor stdio virtual.hd
|
||||
| (normal boot from hard drive)
|
||||
+---------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user