aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2017-05-23 14:53:41 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2017-05-23 15:01:31 +0100
commit9964e96dc9999cf7f7c936ee854a795415d19b60 (patch)
tree61ade0d8a6d39f900e7e8f1779fc083a686f5d58
parent730a6e875b137f74109cc93560a3f643d7ad8263 (diff)
parent82342e91b60a4a078811df4e1a545e57abffa11d (diff)
downloadqemu-9964e96dc9999cf7f7c936ee854a795415d19b60.zip
qemu-9964e96dc9999cf7f7c936ee854a795415d19b60.tar.gz
qemu-9964e96dc9999cf7f7c936ee854a795415d19b60.tar.bz2
Merge remote-tracking branch 'jasowang/tags/net-pull-request' into staging
# gpg: Signature made Tue 23 May 2017 03:27:37 AM BST # gpg: using RSA key 0xEF04965B398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * jasowang/tags/net-pull-request: e1000e: Fix ICR "Other" causes clear logic net/filter-rewriter: Remove unused option in filter-rewriter net/filter-mirror.c: Rename filter_mirror_send() and fix codestyle net/filter-mirror.c: Remove duplicate check code. hmp / net: Mark host_net_add/remove as deprecated COLO-compare: Improve tcp compare trace event readability virtio-net: fix wild pointer when remove virtio-net queues net/dump: Issue a warning for the deprecated "-net dump" net/tap: Replace tap-haiku.c and tap-aix.c by a generic tap-stub.c Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--hmp-commands.hx8
-rw-r--r--hw/net/e1000e_core.c10
-rw-r--r--hw/net/virtio-net.c3
-rw-r--r--net/Makefile.objs15
-rw-r--r--net/colo-compare.c33
-rw-r--r--net/dump.c3
-rw-r--r--net/filter-mirror.c35
-rw-r--r--net/net.c13
-rw-r--r--net/tap-haiku.c87
-rw-r--r--net/tap-stub.c (renamed from net/tap-aix.c)3
-rw-r--r--net/trace-events3
-rw-r--r--qemu-options.hx2
12 files changed, 80 insertions, 135 deletions
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 0aca984..baeac47 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1296,7 +1296,7 @@ ETEXI
.name = "host_net_add",
.args_type = "device:s,opts:s?",
.params = "tap|user|socket|vde|netmap|bridge|vhost-user|dump [options]",
- .help = "add host VLAN client",
+ .help = "add host VLAN client (deprecated, use netdev_add instead)",
.cmd = hmp_host_net_add,
.command_completion = host_net_add_completion,
},
@@ -1304,14 +1304,14 @@ ETEXI
STEXI
@item host_net_add
@findex host_net_add
-Add host VLAN client.
+Add host VLAN client. Deprecated, please use @code{netdev_add} instead.
ETEXI
{
.name = "host_net_remove",
.args_type = "vlan_id:i,device:s",
.params = "vlan_id name",
- .help = "remove host VLAN client",
+ .help = "remove host VLAN client (deprecated, use netdev_del instead)",
.cmd = hmp_host_net_remove,
.command_completion = host_net_remove_completion,
},
@@ -1319,7 +1319,7 @@ ETEXI
STEXI
@item host_net_remove
@findex host_net_remove
-Remove host VLAN client.
+Remove host VLAN client. Deprecated, please use @code{netdev_del} instead.
ETEXI
{
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index 28c5be1..8140564 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -2454,14 +2454,20 @@ e1000e_set_ics(E1000ECore *core, int index, uint32_t val)
static void
e1000e_set_icr(E1000ECore *core, int index, uint32_t val)
{
+ uint32_t icr = 0;
if ((core->mac[ICR] & E1000_ICR_ASSERTED) &&
(core->mac[CTRL_EXT] & E1000_CTRL_EXT_IAME)) {
trace_e1000e_irq_icr_process_iame();
e1000e_clear_ims_bits(core, core->mac[IAM]);
}
- trace_e1000e_irq_icr_write(val, core->mac[ICR], core->mac[ICR] & ~val);
- core->mac[ICR] &= ~val;
+ icr = core->mac[ICR] & ~val;
+ /* Windows driver expects that the "receive overrun" bit and other
+ * ones to be cleared when the "Other" bit (#24) is cleared.
+ */
+ icr = (val & E1000_ICR_OTHER) ? (icr & ~E1000_ICR_OTHER_CAUSES) : icr;
+ trace_e1000e_irq_icr_write(val, core->mac[ICR], icr);
+ core->mac[ICR] = icr;
e1000e_update_interrupt_state(core);
}
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 7d091c9..98bd683 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1522,9 +1522,12 @@ static void virtio_net_del_queue(VirtIONet *n, int index)
if (q->tx_timer) {
timer_del(q->tx_timer);
timer_free(q->tx_timer);
+ q->tx_timer = NULL;
} else {
qemu_bh_delete(q->tx_bh);
+ q->tx_bh = NULL;
}
+ q->tx_waiting = 0;
virtio_del_queue(vdev, index * 2 + 1);
}
diff --git a/net/Makefile.objs b/net/Makefile.objs
index 2e2fd43..67ba5e2 100644
--- a/net/Makefile.objs
+++ b/net/Makefile.objs
@@ -3,13 +3,7 @@ common-obj-y += socket.o
common-obj-y += dump.o
common-obj-y += eth.o
common-obj-$(CONFIG_L2TPV3) += l2tpv3.o
-common-obj-$(CONFIG_POSIX) += tap.o vhost-user.o
-common-obj-$(CONFIG_LINUX) += tap-linux.o
-common-obj-$(CONFIG_WIN32) += tap-win32.o
-common-obj-$(CONFIG_BSD) += tap-bsd.o
-common-obj-$(CONFIG_SOLARIS) += tap-solaris.o
-common-obj-$(CONFIG_AIX) += tap-aix.o
-common-obj-$(CONFIG_HAIKU) += tap-haiku.o
+common-obj-$(CONFIG_POSIX) += vhost-user.o
common-obj-$(CONFIG_SLIRP) += slirp.o
common-obj-$(CONFIG_VDE) += vde.o
common-obj-$(CONFIG_NETMAP) += netmap.o
@@ -20,3 +14,10 @@ common-obj-y += colo-compare.o
common-obj-y += colo.o
common-obj-y += filter-rewriter.o
common-obj-y += filter-replay.o
+
+tap-obj-$(CONFIG_LINUX) = tap-linux.o
+tap-obj-$(CONFIG_BSD) = tap-bsd.o
+tap-obj-$(CONFIG_SOLARIS) = tap-solaris.o
+tap-obj-y ?= tap-stub.o
+common-obj-$(CONFIG_POSIX) += tap.o $(tap-obj-y)
+common-obj-$(CONFIG_WIN32) += tap-win32.o
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 4ab80b1..2639c7f 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -265,17 +265,28 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt)
}
if (res != 0 && trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {
- trace_colo_compare_pkt_info_src(inet_ntoa(ppkt->ip->ip_src),
- ntohl(stcp->th_seq),
- ntohl(stcp->th_ack),
- res, stcp->th_flags,
- spkt->size);
-
- trace_colo_compare_pkt_info_dst(inet_ntoa(ppkt->ip->ip_dst),
- ntohl(ptcp->th_seq),
- ntohl(ptcp->th_ack),
- res, ptcp->th_flags,
- ppkt->size);
+ char pri_ip_src[20], pri_ip_dst[20], sec_ip_src[20], sec_ip_dst[20];
+
+ strcpy(pri_ip_src, inet_ntoa(ppkt->ip->ip_src));
+ strcpy(pri_ip_dst, inet_ntoa(ppkt->ip->ip_dst));
+ strcpy(sec_ip_src, inet_ntoa(spkt->ip->ip_src));
+ strcpy(sec_ip_dst, inet_ntoa(spkt->ip->ip_dst));
+
+ trace_colo_compare_ip_info(ppkt->size, pri_ip_src,
+ pri_ip_dst, spkt->size,
+ sec_ip_src, sec_ip_dst);
+
+ trace_colo_compare_tcp_info("pri tcp packet",
+ ntohl(ptcp->th_seq),
+ ntohl(ptcp->th_ack),
+ res, ptcp->th_flags,
+ ppkt->size);
+
+ trace_colo_compare_tcp_info("sec tcp packet",
+ ntohl(stcp->th_seq),
+ ntohl(stcp->th_ack),
+ res, stcp->th_flags,
+ spkt->size);
qemu_hexdump((char *)ppkt->data, stderr,
"colo-compare ppkt", ppkt->size);
diff --git a/net/dump.c b/net/dump.c
index 89a149b..442eb53 100644
--- a/net/dump.c
+++ b/net/dump.c
@@ -194,6 +194,9 @@ int net_init_dump(const Netdev *netdev, const char *name,
assert(peer);
+ error_report("'-net dump' is deprecated. "
+ "Please use '-object filter-dump' instead.");
+
if (dump->has_file) {
file = dump->file;
} else {
diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index 72fa7c2..8b1b069 100644
--- a/net/filter-mirror.c
+++ b/net/filter-mirror.c
@@ -43,9 +43,9 @@ typedef struct MirrorState {
SocketReadState rs;
} MirrorState;
-static int filter_mirror_send(CharBackend *chr_out,
- const struct iovec *iov,
- int iovcnt)
+static int filter_send(CharBackend *chr_out,
+ const struct iovec *iov,
+ int iovcnt)
{
int ret = 0;
ssize_t size = 0;
@@ -141,9 +141,9 @@ static ssize_t filter_mirror_receive_iov(NetFilterState *nf,
MirrorState *s = FILTER_MIRROR(nf);
int ret;
- ret = filter_mirror_send(&s->chr_out, iov, iovcnt);
+ ret = filter_send(&s->chr_out, iov, iovcnt);
if (ret) {
- error_report("filter_mirror_send failed(%s)", strerror(-ret));
+ error_report("filter mirror send failed(%s)", strerror(-ret));
}
/*
@@ -164,9 +164,9 @@ static ssize_t filter_redirector_receive_iov(NetFilterState *nf,
int ret;
if (qemu_chr_fe_get_driver(&s->chr_out)) {
- ret = filter_mirror_send(&s->chr_out, iov, iovcnt);
+ ret = filter_send(&s->chr_out, iov, iovcnt);
if (ret) {
- error_report("filter_mirror_send failed(%s)", strerror(-ret));
+ error_report("filter redirector send failed(%s)", strerror(-ret));
}
return iov_size(iov, iovcnt);
} else {
@@ -194,12 +194,6 @@ static void filter_mirror_setup(NetFilterState *nf, Error **errp)
MirrorState *s = FILTER_MIRROR(nf);
Chardev *chr;
- if (!s->outdev) {
- error_setg(errp, "filter mirror needs 'outdev' "
- "property set");
- return;
- }
-
chr = qemu_chr_find(s->outdev);
if (chr == NULL) {
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
@@ -292,8 +286,9 @@ static char *filter_redirector_get_indev(Object *obj, Error **errp)
return g_strdup(s->indev);
}
-static void
-filter_redirector_set_indev(Object *obj, const char *value, Error **errp)
+static void filter_redirector_set_indev(Object *obj,
+ const char *value,
+ Error **errp)
{
MirrorState *s = FILTER_REDIRECTOR(obj);
@@ -308,8 +303,9 @@ static char *filter_mirror_get_outdev(Object *obj, Error **errp)
return g_strdup(s->outdev);
}
-static void
-filter_mirror_set_outdev(Object *obj, const char *value, Error **errp)
+static void filter_mirror_set_outdev(Object *obj,
+ const char *value,
+ Error **errp)
{
MirrorState *s = FILTER_MIRROR(obj);
@@ -329,8 +325,9 @@ static char *filter_redirector_get_outdev(Object *obj, Error **errp)
return g_strdup(s->outdev);
}
-static void
-filter_redirector_set_outdev(Object *obj, const char *value, Error **errp)
+static void filter_redirector_set_outdev(Object *obj,
+ const char *value,
+ Error **errp)
{
MirrorState *s = FILTER_REDIRECTOR(obj);
diff --git a/net/net.c b/net/net.c
index 0ac3b9e..6235aab 100644
--- a/net/net.c
+++ b/net/net.c
@@ -45,6 +45,7 @@
#include "qapi-visit.h"
#include "qapi/opts-visitor.h"
#include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
#include "net/filter.h"
#include "qapi/string-output-visitor.h"
@@ -1149,6 +1150,12 @@ void hmp_host_net_add(Monitor *mon, const QDict *qdict)
const char *opts_str = qdict_get_try_str(qdict, "opts");
Error *local_err = NULL;
QemuOpts *opts;
+ static bool warned;
+
+ if (!warned && !qtest_enabled()) {
+ error_report("host_net_add is deprecated, use netdev_add instead");
+ warned = true;
+ }
if (!net_host_check_device(device)) {
monitor_printf(mon, "invalid host network device %s\n", device);
@@ -1175,6 +1182,12 @@ void hmp_host_net_remove(Monitor *mon, const QDict *qdict)
NetClientState *nc;
int vlan_id = qdict_get_int(qdict, "vlan_id");
const char *device = qdict_get_str(qdict, "device");
+ static bool warned;
+
+ if (!warned && !qtest_enabled()) {
+ error_report("host_net_remove is deprecated, use netdev_del instead");
+ warned = true;
+ }
nc = net_hub_find_client_by_name(vlan_id, device);
if (!nc) {
diff --git a/net/tap-haiku.c b/net/tap-haiku.c
deleted file mode 100644
index b27e57e..0000000
--- a/net/tap-haiku.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "qemu/osdep.h"
-#include "qapi/error.h"
-#include "tap_int.h"
-
-int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
- int vnet_hdr_required, int mq_required, Error **errp)
-{
- error_setg(errp, "no tap on Haiku");
- return -1;
-}
-
-void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp)
-{
-}
-
-int tap_probe_vnet_hdr(int fd)
-{
- return 0;
-}
-
-int tap_probe_has_ufo(int fd)
-{
- return 0;
-}
-
-int tap_probe_vnet_hdr_len(int fd, int len)
-{
- return 0;
-}
-
-void tap_fd_set_vnet_hdr_len(int fd, int len)
-{
-}
-
-int tap_fd_set_vnet_le(int fd, int is_le)
-{
- return -EINVAL;
-}
-
-int tap_fd_set_vnet_be(int fd, int is_be)
-{
- return -EINVAL;
-}
-
-void tap_fd_set_offload(int fd, int csum, int tso4,
- int tso6, int ecn, int ufo)
-{
-}
-
-int tap_fd_enable(int fd)
-{
- return -1;
-}
-
-int tap_fd_disable(int fd)
-{
- return -1;
-}
-
-int tap_fd_get_ifname(int fd, char *ifname)
-{
- return -1;
-}
diff --git a/net/tap-aix.c b/net/tap-stub.c
index 0e6da63..a9ab8f8 100644
--- a/net/tap-aix.c
+++ b/net/tap-stub.c
@@ -29,7 +29,7 @@
int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
int vnet_hdr_required, int mq_required, Error **errp)
{
- error_setg(errp, "no tap on AIX");
+ error_setg(errp, "tap is not supported in this build");
return -1;
}
@@ -85,4 +85,3 @@ int tap_fd_get_ifname(int fd, char *ifname)
{
return -1;
}
-
diff --git a/net/trace-events b/net/trace-events
index 35198bc..247e5c0 100644
--- a/net/trace-events
+++ b/net/trace-events
@@ -13,8 +13,7 @@ colo_compare_icmp_miscompare(const char *sta, int size) ": %s = %d"
colo_compare_ip_info(int psize, const char *sta, const char *stb, int ssize, const char *stc, const char *std) "ppkt size = %d, ip_src = %s, ip_dst = %s, spkt size = %d, ip_src = %s, ip_dst = %s"
colo_old_packet_check_found(int64_t old_time) "%" PRId64
colo_compare_miscompare(void) ""
-colo_compare_pkt_info_src(const char *src, uint32_t sseq, uint32_t sack, int res, uint32_t sflag, int ssize) "src/dst: %s s: seq/ack=%u/%u res=%d flags=%x spkt_size: %d\n"
-colo_compare_pkt_info_dst(const char *dst, uint32_t dseq, uint32_t dack, int res, uint32_t dflag, int dsize) "src/dst: %s d: seq/ack=%u/%u res=%d flags=%x dpkt_size: %d\n"
+colo_compare_tcp_info(const char *pkt, uint32_t seq, uint32_t ack, int res, uint32_t flag, int size) "side: %s seq/ack= %u/%u res= %d flags= %x pkt_size: %d\n"
# net/filter-rewriter.c
colo_filter_rewriter_debug(void) ""
diff --git a/qemu-options.hx b/qemu-options.hx
index f07a310..f63f7dc 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4072,7 +4072,7 @@ Create a filter-redirector we need to differ outdev id from indev id, id can not
be the same. we can just use indev or outdev, but at least one of indev or outdev
need to be specified.
-@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid},rewriter-mode=@var{mode}[,queue=@var{all|rx|tx}]
+@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid}[,queue=@var{all|rx|tx}]
Filter-rewriter is a part of COLO project.It will rewrite tcp packet to
secondary from primary to keep secondary tcp connection,and rewrite