1
The following changes since commit 23895cbd82be95428e90168b12e925d0d3ca2f06:
1
The following changes since commit 0c633cf0c221922a0a9f9d0b8866cbb111f5e192:
2
2
3
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20201123.0' into staging (2020-11-23 18:51:13 +0000)
3
Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210730' into staging (2021-07-31 21:29:57 +0100)
4
4
5
are available in the git repository at:
5
are available in the git repository at:
6
6
7
https://github.com/jasowang/qemu.git tags/net-pull-request
7
https://github.com/jasowang/qemu.git tags/net-pull-request
8
8
9
for you to fetch changes up to 9925990d01a92564af55f6f69d0f5f59b47609b1:
9
for you to fetch changes up to cfe6d6841ff46b43ec38792422f690813f4ce3bf:
10
10
11
net: Use correct default-path macro for downscript (2020-11-24 10:40:17 +0800)
11
hw/net: e1000e: Don't zero out the VLAN tag in the legacy RX descriptor (2021-08-02 12:19:18 +0800)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
14
15
----------------------------------------------------------------
15
----------------------------------------------------------------
16
Keqian Zhu (1):
16
Christina Wang (3):
17
net: Use correct default-path macro for downscript
17
hw/net: e1000: Correct the initial value of VET register
18
hw/net: e1000e: Correct the initial value of VET register
19
hw/net: e1000e: Don't zero out the VLAN tag in the legacy RX descriptor
18
20
19
Paolo Bonzini (1):
21
Pavel Pisa (1):
20
net: do not exit on "netdev_add help" monitor command
22
hw/net/can: sja1000 fix buff2frame_bas and buff2frame_pel when dlc is out of std CAN 8 bytes
21
23
22
Prasad J Pandit (1):
24
Thomas Huth (1):
23
hw/net/e1000e: advance desc_offset in case of null descriptor
25
hw/net/vmxnet3: Do not abort QEMU if guest specified bad queue numbers
24
26
25
Yuri Benditovich (1):
27
hw/core/machine.c | 2 ++
26
net: purge queued rx packets on queue deletion
28
hw/net/can/can_sja1000.c | 8 ++++++++
27
29
hw/net/e1000.c | 17 +++++++++++++++++
28
yuanjungong (1):
30
hw/net/e1000e.c | 8 +++++++-
29
tap: fix a memory leak
31
hw/net/e1000e_core.c | 10 ++++------
30
32
hw/net/vmxnet3.c | 34 ++++++++++++++++++++++------------
31
hw/net/e1000e_core.c | 8 +++---
33
6 files changed, 60 insertions(+), 19 deletions(-)
32
include/net/net.h | 1 +
33
monitor/hmp-cmds.c | 6 ++++
34
net/net.c | 80 +++++++++++++++++++++++++++-------------------------
35
net/tap.c | 5 +++-
36
5 files changed, 57 insertions(+), 43 deletions(-)
37
34
38
35
36
diff view generated by jsdifflib
1
From: Yuri Benditovich <yuri.benditovich@daynix.com>
1
From: Thomas Huth <thuth@redhat.com>
2
2
3
https://bugzilla.redhat.com/show_bug.cgi?id=1829272
3
QEMU should never terminate unexpectedly just because the guest is
4
When deleting queue pair, purge pending RX packets if any.
4
doing something wrong like specifying wrong queue numbers. Let's
5
Example of problematic flow:
5
simply refuse to set the device active in this case.
6
1. Bring up q35 VM with tap (vhost off) and virtio-net or e1000e
7
2. Run ping flood to the VM NIC ( 1 ms interval)
8
3. Hot unplug the NIC device (device_del)
9
During unplug process one or more packets come, the NIC
10
can't receive, tap disables read_poll
11
4. Hot plug the device (device_add) with the same netdev
12
The tap stays with read_poll disabled and does not receive
13
any packets anymore (tap_send never triggered)
14
6
15
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
7
Buglink: https://bugs.launchpad.net/qemu/+bug/1890160
8
Signed-off-by: Thomas Huth <thuth@redhat.com>
16
Signed-off-by: Jason Wang <jasowang@redhat.com>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
17
---
10
---
18
net/net.c | 12 ++++++++----
11
hw/net/vmxnet3.c | 34 ++++++++++++++++++++++------------
19
1 file changed, 8 insertions(+), 4 deletions(-)
12
1 file changed, 22 insertions(+), 12 deletions(-)
20
13
21
diff --git a/net/net.c b/net/net.c
14
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
22
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
23
--- a/net/net.c
16
--- a/hw/net/vmxnet3.c
24
+++ b/net/net.c
17
+++ b/hw/net/vmxnet3.c
25
@@ -XXX,XX +XXX,XX @@ void qemu_del_nic(NICState *nic)
18
@@ -XXX,XX +XXX,XX @@ static void vmxnet3_validate_interrupts(VMXNET3State *s)
26
19
}
27
qemu_macaddr_set_free(&nic->conf->macaddr);
20
}
28
21
29
- /* If this is a peer NIC and peer has already been deleted, free it now. */
22
-static void vmxnet3_validate_queues(VMXNET3State *s)
30
- if (nic->peer_deleted) {
23
+static bool vmxnet3_validate_queues(VMXNET3State *s)
31
- for (i = 0; i < queues; i++) {
24
{
32
- qemu_free_net_client(qemu_get_subqueue(nic, i)->peer);
25
/*
33
+ for (i = 0; i < queues; i++) {
26
* txq_num and rxq_num are total number of queues
34
+ NetClientState *nc = qemu_get_subqueue(nic, i);
27
@@ -XXX,XX +XXX,XX @@ static void vmxnet3_validate_queues(VMXNET3State *s)
35
+ /* If this is a peer NIC and peer has already been deleted, free it now. */
28
*/
36
+ if (nic->peer_deleted) {
29
37
+ qemu_free_net_client(nc->peer);
30
if (s->txq_num > VMXNET3_DEVICE_MAX_TX_QUEUES) {
38
+ } else if (nc->peer) {
31
- hw_error("Bad TX queues number: %d\n", s->txq_num);
39
+ /* if there are RX packets pending, complete them */
32
+ qemu_log_mask(LOG_GUEST_ERROR, "vmxnet3: Bad TX queues number: %d\n",
40
+ qemu_purge_queued_packets(nc->peer);
33
+ s->txq_num);
34
+ return false;
35
}
36
37
if (s->rxq_num > VMXNET3_DEVICE_MAX_RX_QUEUES) {
38
- hw_error("Bad RX queues number: %d\n", s->rxq_num);
39
+ qemu_log_mask(LOG_GUEST_ERROR, "vmxnet3: Bad RX queues number: %d\n",
40
+ s->rxq_num);
41
+ return false;
42
}
43
+
44
+ return true;
45
}
46
47
static void vmxnet3_activate_device(VMXNET3State *s)
48
@@ -XXX,XX +XXX,XX @@ static void vmxnet3_activate_device(VMXNET3State *s)
49
return;
50
}
51
52
+ s->txq_num =
53
+ VMXNET3_READ_DRV_SHARED8(d, s->drv_shmem, devRead.misc.numTxQueues);
54
+ s->rxq_num =
55
+ VMXNET3_READ_DRV_SHARED8(d, s->drv_shmem, devRead.misc.numRxQueues);
56
+
57
+ VMW_CFPRN("Number of TX/RX queues %u/%u", s->txq_num, s->rxq_num);
58
+ if (!vmxnet3_validate_queues(s)) {
59
+ return;
60
+ }
61
+
62
vmxnet3_adjust_by_guest_type(s);
63
vmxnet3_update_features(s);
64
vmxnet3_update_pm_state(s);
65
@@ -XXX,XX +XXX,XX @@ static void vmxnet3_activate_device(VMXNET3State *s)
66
VMXNET3_READ_DRV_SHARED8(d, s->drv_shmem, devRead.intrConf.autoMask);
67
VMW_CFPRN("Automatic interrupt masking is %d", (int)s->auto_int_masking);
68
69
- s->txq_num =
70
- VMXNET3_READ_DRV_SHARED8(d, s->drv_shmem, devRead.misc.numTxQueues);
71
- s->rxq_num =
72
- VMXNET3_READ_DRV_SHARED8(d, s->drv_shmem, devRead.misc.numRxQueues);
73
-
74
- VMW_CFPRN("Number of TX/RX queues %u/%u", s->txq_num, s->rxq_num);
75
- vmxnet3_validate_queues(s);
76
-
77
qdescr_table_pa =
78
VMXNET3_READ_DRV_SHARED64(d, s->drv_shmem, devRead.misc.queueDescPA);
79
VMW_CFPRN("TX queues descriptors table is at 0x%" PRIx64, qdescr_table_pa);
80
@@ -XXX,XX +XXX,XX @@ static int vmxnet3_post_load(void *opaque, int version_id)
41
}
81
}
42
}
82
}
43
83
84
- vmxnet3_validate_queues(s);
85
+ if (!vmxnet3_validate_queues(s)) {
86
+ return -1;
87
+ }
88
vmxnet3_validate_interrupts(s);
89
90
return 0;
44
--
91
--
45
2.7.4
92
2.7.4
46
93
47
94
diff view generated by jsdifflib
1
From: Keqian Zhu <zhukeqian1@huawei.com>
1
From: Pavel Pisa <pisa@cmp.felk.cvut.cz>
2
2
3
Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts)
3
Problem reported by openEuler fuzz-sig group.
4
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
4
5
The buff2frame_bas function (hw\net\can\can_sja1000.c)
6
infoleak(qemu5.x~qemu6.x) or stack-overflow(qemu 4.x).
7
8
Reported-by: Qiang Ning <ningqiang1@huawei.com>
9
Cc: qemu-stable@nongnu.org
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
5
Signed-off-by: Jason Wang <jasowang@redhat.com>
12
Signed-off-by: Jason Wang <jasowang@redhat.com>
6
---
13
---
7
net/tap.c | 3 ++-
14
hw/net/can/can_sja1000.c | 8 ++++++++
8
1 file changed, 2 insertions(+), 1 deletion(-)
15
1 file changed, 8 insertions(+)
9
16
10
diff --git a/net/tap.c b/net/tap.c
17
diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c
11
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
12
--- a/net/tap.c
19
--- a/hw/net/can/can_sja1000.c
13
+++ b/net/tap.c
20
+++ b/hw/net/can/can_sja1000.c
14
@@ -XXX,XX +XXX,XX @@ free_fail:
21
@@ -XXX,XX +XXX,XX @@ static void buff2frame_pel(const uint8_t *buff, qemu_can_frame *frame)
15
script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
22
}
16
}
23
frame->can_dlc = buff[0] & 0x0f;
17
if (!downscript) {
24
18
- downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
25
+ if (frame->can_dlc > 8) {
19
+ downscript = default_downscript =
26
+ frame->can_dlc = 8;
20
+ get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT);
27
+ }
21
}
28
+
22
29
if (buff[0] & 0x80) { /* Extended */
23
if (tap->has_ifname) {
30
frame->can_id |= QEMU_CAN_EFF_FLAG;
31
frame->can_id |= buff[1] << 21; /* ID.28~ID.21 */
32
@@ -XXX,XX +XXX,XX @@ static void buff2frame_bas(const uint8_t *buff, qemu_can_frame *frame)
33
}
34
frame->can_dlc = buff[1] & 0x0f;
35
36
+ if (frame->can_dlc > 8) {
37
+ frame->can_dlc = 8;
38
+ }
39
+
40
for (i = 0; i < frame->can_dlc; i++) {
41
frame->data[i] = buff[2 + i];
42
}
24
--
43
--
25
2.7.4
44
2.7.4
26
45
27
46
diff view generated by jsdifflib
1
From: Paolo Bonzini <pbonzini@redhat.com>
1
From: Christina Wang <christina.wang@windriver.com>
2
2
3
"netdev_add help" is causing QEMU to exit because the code that
3
The initial value of VLAN Ether Type (VET) register is 0x8100, as per
4
invokes show_netdevs is shared between CLI and HMP processing.
4
the manual and real hardware.
5
Move the check to the callers so that exit(0) remains only
6
in the CLI flow.
7
5
8
"netdev_add help" is not fixed by this patch; that is left for
6
While Linux e1000 driver always writes VET register to 0x8100, it is
9
later work.
7
not always the case for everyone. Drivers relying on the reset value
8
of VET won't be able to transmit and receive VLAN frames in QEMU.
10
9
11
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10
Reported-by: Markus Carlstedt <markus.carlstedt@windriver.com>
11
Signed-off-by: Christina Wang <christina.wang@windriver.com>
12
Signed-off-by: Bin Meng <bin.meng@windriver.com>
12
Signed-off-by: Jason Wang <jasowang@redhat.com>
13
Signed-off-by: Jason Wang <jasowang@redhat.com>
13
---
14
---
14
include/net/net.h | 1 +
15
hw/core/machine.c | 1 +
15
monitor/hmp-cmds.c | 6 +++++
16
hw/net/e1000.c | 17 +++++++++++++++++
16
net/net.c | 68 +++++++++++++++++++++++++++---------------------------
17
2 files changed, 18 insertions(+)
17
3 files changed, 41 insertions(+), 34 deletions(-)
18
18
19
diff --git a/include/net/net.h b/include/net/net.h
19
diff --git a/hw/core/machine.c b/hw/core/machine.c
20
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
21
--- a/include/net/net.h
21
--- a/hw/core/machine.c
22
+++ b/include/net/net.h
22
+++ b/hw/core/machine.c
23
@@ -XXX,XX +XXX,XX @@ extern const char *host_net_devices[];
23
@@ -XXX,XX +XXX,XX @@ GlobalProperty hw_compat_6_0[] = {
24
24
{ "gpex-pcihost", "allow-unmapped-accesses", "false" },
25
/* from net.c */
25
{ "i8042", "extended-state", "false"},
26
int net_client_parse(QemuOptsList *opts_list, const char *str);
26
{ "nvme-ns", "eui64-default", "off"},
27
+void show_netdevs(void);
27
+ { "e1000", "init-vet", "off" },
28
int net_init_clients(Error **errp);
28
};
29
void net_check_clients(void);
29
const size_t hw_compat_6_0_len = G_N_ELEMENTS(hw_compat_6_0);
30
void net_cleanup(void);
30
31
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
31
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
32
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
33
--- a/monitor/hmp-cmds.c
33
--- a/hw/net/e1000.c
34
+++ b/monitor/hmp-cmds.c
34
+++ b/hw/net/e1000.c
35
@@ -XXX,XX +XXX,XX @@
35
@@ -XXX,XX +XXX,XX @@
36
#include "qemu/option.h"
36
#include "hw/pci/pci.h"
37
#include "qemu/timer.h"
37
#include "hw/qdev-properties.h"
38
#include "qemu/sockets.h"
38
#include "migration/vmstate.h"
39
+#include "qemu/help_option.h"
39
+#include "net/eth.h"
40
#include "monitor/monitor-internal.h"
40
#include "net/net.h"
41
#include "qapi/error.h"
41
#include "net/checksum.h"
42
#include "qapi/clone-visitor.h"
42
#include "sysemu/sysemu.h"
43
@@ -XXX,XX +XXX,XX @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict)
43
@@ -XXX,XX +XXX,XX @@ struct E1000State_st {
44
{
44
#define E1000_FLAG_MIT_BIT 1
45
Error *err = NULL;
45
#define E1000_FLAG_MAC_BIT 2
46
QemuOpts *opts;
46
#define E1000_FLAG_TSO_BIT 3
47
+ const char *type = qdict_get_try_str(qdict, "type");
47
+#define E1000_FLAG_VET_BIT 4
48
48
#define E1000_FLAG_AUTONEG (1 << E1000_FLAG_AUTONEG_BIT)
49
+ if (type && is_help_option(type)) {
49
#define E1000_FLAG_MIT (1 << E1000_FLAG_MIT_BIT)
50
+ show_netdevs();
50
#define E1000_FLAG_MAC (1 << E1000_FLAG_MAC_BIT)
51
+ return;
51
#define E1000_FLAG_TSO (1 << E1000_FLAG_TSO_BIT)
52
+ }
52
+#define E1000_FLAG_VET (1 << E1000_FLAG_VET_BIT)
53
opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict, &err);
53
+
54
if (err) {
54
uint32_t compat_flags;
55
goto out;
55
bool received_tx_tso;
56
diff --git a/net/net.c b/net/net.c
56
bool use_tso_for_migration;
57
index XXXXXXX..XXXXXXX 100644
57
@@ -XXX,XX +XXX,XX @@ e1000_autoneg_timer(void *opaque)
58
--- a/net/net.c
59
+++ b/net/net.c
60
@@ -XXX,XX +XXX,XX @@
61
#include "qemu/config-file.h"
62
#include "qemu/ctype.h"
63
#include "qemu/iov.h"
64
+#include "qemu/qemu-print.h"
65
#include "qemu/main-loop.h"
66
#include "qemu/option.h"
67
#include "qapi/error.h"
68
@@ -XXX,XX +XXX,XX @@ static int net_client_init1(const Netdev *netdev, bool is_netdev, Error **errp)
69
return 0;
70
}
71
72
-static void show_netdevs(void)
73
+void show_netdevs(void)
74
{
75
int idx;
76
const char *available_netdevs[] = {
77
@@ -XXX,XX +XXX,XX @@ static void show_netdevs(void)
78
#endif
79
};
80
81
- printf("Available netdev backend types:\n");
82
+ qemu_printf("Available netdev backend types:\n");
83
for (idx = 0; idx < ARRAY_SIZE(available_netdevs); idx++) {
84
- puts(available_netdevs[idx]);
85
+ qemu_printf("%s\n", available_netdevs[idx]);
86
}
58
}
87
}
59
}
88
60
89
@@ -XXX,XX +XXX,XX @@ static int net_client_init(QemuOpts *opts, bool is_netdev, Error **errp)
61
+static bool e1000_vet_init_need(void *opaque)
90
int ret = -1;
62
+{
91
Visitor *v = opts_visitor_new(opts);
63
+ E1000State *s = opaque;
92
93
- const char *type = qemu_opt_get(opts, "type");
94
-
95
- if (is_netdev && type && is_help_option(type)) {
96
- show_netdevs();
97
- exit(0);
98
- } else {
99
- /* Parse convenience option format ip6-net=fec0::0[/64] */
100
- const char *ip6_net = qemu_opt_get(opts, "ipv6-net");
101
+ /* Parse convenience option format ip6-net=fec0::0[/64] */
102
+ const char *ip6_net = qemu_opt_get(opts, "ipv6-net");
103
104
- if (ip6_net) {
105
- char *prefix_addr;
106
- unsigned long prefix_len = 64; /* Default 64bit prefix length. */
107
+ if (ip6_net) {
108
+ char *prefix_addr;
109
+ unsigned long prefix_len = 64; /* Default 64bit prefix length. */
110
111
- substrings = g_strsplit(ip6_net, "/", 2);
112
- if (!substrings || !substrings[0]) {
113
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "ipv6-net",
114
- "a valid IPv6 prefix");
115
- goto out;
116
- }
117
+ substrings = g_strsplit(ip6_net, "/", 2);
118
+ if (!substrings || !substrings[0]) {
119
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "ipv6-net",
120
+ "a valid IPv6 prefix");
121
+ goto out;
122
+ }
123
124
- prefix_addr = substrings[0];
125
+ prefix_addr = substrings[0];
126
127
- /* Handle user-specified prefix length. */
128
- if (substrings[1] &&
129
- qemu_strtoul(substrings[1], NULL, 10, &prefix_len))
130
- {
131
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
132
- "ipv6-prefixlen", "a number");
133
- goto out;
134
- }
135
-
136
- qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort);
137
- qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len,
138
- &error_abort);
139
- qemu_opt_unset(opts, "ipv6-net");
140
+ /* Handle user-specified prefix length. */
141
+ if (substrings[1] &&
142
+ qemu_strtoul(substrings[1], NULL, 10, &prefix_len))
143
+ {
144
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
145
+ "ipv6-prefixlen", "a number");
146
+ goto out;
147
}
148
+
64
+
149
+ qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort);
65
+ return chkflag(VET);
150
+ qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len,
66
+}
151
+ &error_abort);
67
+
152
+ qemu_opt_unset(opts, "ipv6-net");
68
static void e1000_reset(void *opaque)
69
{
70
E1000State *d = opaque;
71
@@ -XXX,XX +XXX,XX @@ static void e1000_reset(void *opaque)
153
}
72
}
154
73
155
/* Create an ID for -net if the user did not specify one */
74
e1000x_reset_mac_addr(d->nic, d->mac_reg, macaddr);
156
@@ -XXX,XX +XXX,XX @@ static int net_init_client(void *dummy, QemuOpts *opts, Error **errp)
157
158
static int net_init_netdev(void *dummy, QemuOpts *opts, Error **errp)
159
{
160
+ const char *type = qemu_opt_get(opts, "type");
161
+
75
+
162
+ if (type && is_help_option(type)) {
76
+ if (e1000_vet_init_need(d)) {
163
+ show_netdevs();
77
+ d->mac_reg[VET] = ETH_P_VLAN;
164
+ exit(0);
165
+ }
78
+ }
166
return net_client_init(opts, true, errp);
167
}
79
}
80
81
static void
82
@@ -XXX,XX +XXX,XX @@ static Property e1000_properties[] = {
83
compat_flags, E1000_FLAG_MAC_BIT, true),
84
DEFINE_PROP_BIT("migrate_tso_props", E1000State,
85
compat_flags, E1000_FLAG_TSO_BIT, true),
86
+ DEFINE_PROP_BIT("init-vet", E1000State,
87
+ compat_flags, E1000_FLAG_VET_BIT, true),
88
DEFINE_PROP_END_OF_LIST(),
89
};
168
90
169
--
91
--
170
2.7.4
92
2.7.4
171
93
172
94
diff view generated by jsdifflib
1
From: yuanjungong <ruc_gongyuanjun@163.com>
1
From: Christina Wang <christina.wang@windriver.com>
2
2
3
Close fd before returning.
3
The initial value of VLAN Ether Type (VET) register is 0x8100, as per
4
the manual and real hardware.
4
5
5
Buglink: https://bugs.launchpad.net/qemu/+bug/1904486
6
While Linux e1000e driver always writes VET register to 0x8100, it is
7
not always the case for everyone. Drivers relying on the reset value
8
of VET won't be able to transmit and receive VLAN frames in QEMU.
6
9
7
Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com>
10
Unlike e1000 in QEMU, e1000e uses a field 'vet' in "struct E1000Core"
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
to cache the value of VET register, but the cache only gets updated
12
when VET register is written. To always get a consistent VET value
13
no matter VET is written or remains its reset value, drop the 'vet'
14
field and use 'core->mac[VET]' directly.
15
16
Reported-by: Markus Carlstedt <markus.carlstedt@windriver.com>
17
Signed-off-by: Christina Wang <christina.wang@windriver.com>
18
Signed-off-by: Bin Meng <bin.meng@windriver.com>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
19
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
---
20
---
11
net/tap.c | 2 ++
21
hw/core/machine.c | 1 +
12
1 file changed, 2 insertions(+)
22
hw/net/e1000e.c | 8 +++++++-
23
hw/net/e1000e_core.c | 9 ++++-----
24
3 files changed, 12 insertions(+), 6 deletions(-)
13
25
14
diff --git a/net/tap.c b/net/tap.c
26
diff --git a/hw/core/machine.c b/hw/core/machine.c
15
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
16
--- a/net/tap.c
28
--- a/hw/core/machine.c
17
+++ b/net/tap.c
29
+++ b/hw/core/machine.c
18
@@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name,
30
@@ -XXX,XX +XXX,XX @@ GlobalProperty hw_compat_6_0[] = {
19
if (ret < 0) {
31
{ "i8042", "extended-state", "false"},
20
error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d",
32
{ "nvme-ns", "eui64-default", "off"},
21
name, fd);
33
{ "e1000", "init-vet", "off" },
22
+ close(fd);
34
+ { "e1000e", "init-vet", "off" },
23
return -1;
35
};
24
}
36
const size_t hw_compat_6_0_len = G_N_ELEMENTS(hw_compat_6_0);
25
37
26
@@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name,
38
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
27
vhostfdname, vnet_hdr, fd, &err);
39
index XXXXXXX..XXXXXXX 100644
28
if (err) {
40
--- a/hw/net/e1000e.c
29
error_propagate(errp, err);
41
+++ b/hw/net/e1000e.c
30
+ close(fd);
42
@@ -XXX,XX +XXX,XX @@
31
return -1;
43
32
}
44
#include "qemu/osdep.h"
33
} else if (tap->has_fds) {
45
#include "qemu/units.h"
46
+#include "net/eth.h"
47
#include "net/net.h"
48
#include "net/tap.h"
49
#include "qemu/module.h"
50
@@ -XXX,XX +XXX,XX @@ struct E1000EState {
51
bool disable_vnet;
52
53
E1000ECore core;
54
-
55
+ bool init_vet;
56
};
57
58
#define E1000E_MMIO_IDX 0
59
@@ -XXX,XX +XXX,XX @@ static void e1000e_qdev_reset(DeviceState *dev)
60
trace_e1000e_cb_qdev_reset();
61
62
e1000e_core_reset(&s->core);
63
+
64
+ if (s->init_vet) {
65
+ s->core.mac[VET] = ETH_P_VLAN;
66
+ }
67
}
68
69
static int e1000e_pre_save(void *opaque)
70
@@ -XXX,XX +XXX,XX @@ static Property e1000e_properties[] = {
71
e1000e_prop_subsys_ven, uint16_t),
72
DEFINE_PROP_SIGNED("subsys", E1000EState, subsys, 0,
73
e1000e_prop_subsys, uint16_t),
74
+ DEFINE_PROP_BOOL("init-vet", E1000EState, init_vet, true),
75
DEFINE_PROP_END_OF_LIST(),
76
};
77
78
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
79
index XXXXXXX..XXXXXXX 100644
80
--- a/hw/net/e1000e_core.c
81
+++ b/hw/net/e1000e_core.c
82
@@ -XXX,XX +XXX,XX @@ e1000e_process_tx_desc(E1000ECore *core,
83
if (e1000x_vlan_enabled(core->mac) &&
84
e1000x_is_vlan_txd(txd_lower)) {
85
net_tx_pkt_setup_vlan_header_ex(tx->tx_pkt,
86
- le16_to_cpu(dp->upper.fields.special), core->vet);
87
+ le16_to_cpu(dp->upper.fields.special), core->mac[VET]);
88
}
89
if (e1000e_tx_pkt_send(core, tx, queue_index)) {
90
e1000e_on_tx_done_update_stats(core, tx->tx_pkt);
91
@@ -XXX,XX +XXX,XX @@ e1000e_receive_filter(E1000ECore *core, const uint8_t *buf, int size)
92
{
93
uint32_t rctl = core->mac[RCTL];
94
95
- if (e1000x_is_vlan_packet(buf, core->vet) &&
96
+ if (e1000x_is_vlan_packet(buf, core->mac[VET]) &&
97
e1000x_vlan_rx_filter_enabled(core->mac)) {
98
uint16_t vid = lduw_be_p(buf + 14);
99
uint32_t vfta = ldl_le_p((uint32_t *)(core->mac + VFTA) +
100
@@ -XXX,XX +XXX,XX @@ e1000e_receive_iov(E1000ECore *core, const struct iovec *iov, int iovcnt)
101
}
102
103
net_rx_pkt_attach_iovec_ex(core->rx_pkt, iov, iovcnt, iov_ofs,
104
- e1000x_vlan_enabled(core->mac), core->vet);
105
+ e1000x_vlan_enabled(core->mac), core->mac[VET]);
106
107
e1000e_rss_parse_packet(core, core->rx_pkt, &rss_info);
108
e1000e_rx_ring_init(core, &rxr, rss_info.queue);
109
@@ -XXX,XX +XXX,XX @@ static void
110
e1000e_set_vet(E1000ECore *core, int index, uint32_t val)
111
{
112
core->mac[VET] = val & 0xffff;
113
- core->vet = le16_to_cpu(core->mac[VET]);
114
- trace_e1000e_vlan_vet(core->vet);
115
+ trace_e1000e_vlan_vet(core->mac[VET]);
116
}
117
118
static void
34
--
119
--
35
2.7.4
120
2.7.4
36
121
37
122
diff view generated by jsdifflib
1
From: Prasad J Pandit <pjp@fedoraproject.org>
1
From: Christina Wang <christina.wang@windriver.com>
2
2
3
While receiving packets via e1000e_write_packet_to_guest() routine,
3
In the legacy RX descriptor mode, VLAN tag was saved to d->special
4
'desc_offset' is advanced only when RX descriptor is processed. And
4
by e1000e_build_rx_metadata() in e1000e_write_lgcy_rx_descr(), but
5
RX descriptor is not processed if it has NULL buffer address.
5
it was then zeroed out again at the end of the call, which is wrong.
6
This may lead to an infinite loop condition. Increament 'desc_offset'
7
to process next descriptor in the ring to avoid infinite loop.
8
6
9
Reported-by: Cheol-woo Myung <330cjfdn@gmail.com>
7
Fixes: c89d416a2b0f ("e1000e: Don't zero out buffer address in rx descriptor")
10
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
8
Reported-by: Markus Carlstedt <markus.carlstedt@windriver.com>
9
Signed-off-by: Christina Wang <christina.wang@windriver.com>
10
Signed-off-by: Bin Meng <bin.meng@windriver.com>
11
Signed-off-by: Jason Wang <jasowang@redhat.com>
11
Signed-off-by: Jason Wang <jasowang@redhat.com>
12
---
12
---
13
hw/net/e1000e_core.c | 8 ++++----
13
hw/net/e1000e_core.c | 1 -
14
1 file changed, 4 insertions(+), 4 deletions(-)
14
1 file changed, 1 deletion(-)
15
15
16
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
16
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
17
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/net/e1000e_core.c
18
--- a/hw/net/e1000e_core.c
19
+++ b/hw/net/e1000e_core.c
19
+++ b/hw/net/e1000e_core.c
20
@@ -XXX,XX +XXX,XX @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
20
@@ -XXX,XX +XXX,XX @@ e1000e_write_lgcy_rx_descr(E1000ECore *core, uint8_t *desc,
21
(const char *) &fcs_pad, e1000x_fcs_len(core->mac));
21
&d->special);
22
}
22
d->errors = (uint8_t) (le32_to_cpu(status_flags) >> 24);
23
}
23
d->status = (uint8_t) le32_to_cpu(status_flags);
24
- desc_offset += desc_size;
24
- d->special = 0;
25
- if (desc_offset >= total_size) {
25
}
26
- is_last = true;
26
27
- }
27
static inline void
28
} else { /* as per intel docs; skip descriptors with null buf addr */
29
trace_e1000e_rx_null_descriptor();
30
}
31
+ desc_offset += desc_size;
32
+ if (desc_offset >= total_size) {
33
+ is_last = true;
34
+ }
35
36
e1000e_write_rx_descr(core, desc, is_last ? core->rx_pkt : NULL,
37
rss_info, do_ps ? ps_hdr_len : 0, &bastate.written);
38
--
28
--
39
2.7.4
29
2.7.4
40
30
41
31
diff view generated by jsdifflib