1
The following changes since commit 5bac3c39c82e149515c10643acafd1d292433775:
1
The following changes since commit 23895cbd82be95428e90168b12e925d0d3ca2f06:
2
2
3
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2017-03-13 15:08:01 +0000)
3
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20201123.0' into staging (2020-11-23 18:51:13 +0000)
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 adb560f7fc92903f52071086a46422be1e3f4640:
9
for you to fetch changes up to 9925990d01a92564af55f6f69d0f5f59b47609b1:
10
10
11
hw/net: implement MIB counters in mcf_fec driver (2017-03-14 15:39:55 +0800)
11
net: Use correct default-path macro for downscript (2020-11-24 10:40:17 +0800)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
- fix e100e memory regions leaks during cleanup
14
15
- fix fec MIB counters
16
- fix COLO trace print
17
----------------------------------------------------------------
15
----------------------------------------------------------------
18
Greg Ungerer (1):
16
Keqian Zhu (1):
19
hw/net: implement MIB counters in mcf_fec driver
17
net: Use correct default-path macro for downscript
20
18
21
Paolo Bonzini (1):
19
Paolo Bonzini (1):
22
e1000e: correctly tear down MSI-X memory regions
20
net: do not exit on "netdev_add help" monitor command
23
21
24
Zhang Chen (1):
22
Prasad J Pandit (1):
25
COLO-compare: Fix trace_event print bug
23
hw/net/e1000e: advance desc_offset in case of null descriptor
26
24
27
hw/net/e1000e.c | 2 +-
25
Yuri Benditovich (1):
28
hw/net/mcf_fec.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++
26
net: purge queued rx packets on queue deletion
29
net/colo-compare.c | 33 +++++++++++----
27
30
3 files changed, 141 insertions(+), 9 deletions(-)
28
yuanjungong (1):
29
tap: fix a memory leak
30
31
hw/net/e1000e_core.c | 8 +++---
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(-)
31
37
32
38
diff view generated by jsdifflib
New patch
1
From: Prasad J Pandit <pjp@fedoraproject.org>
1
2
3
While receiving packets via e1000e_write_packet_to_guest() routine,
4
'desc_offset' is advanced only when RX descriptor is processed. And
5
RX descriptor is not processed if it has NULL buffer address.
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
9
Reported-by: Cheol-woo Myung <330cjfdn@gmail.com>
10
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
11
Signed-off-by: Jason Wang <jasowang@redhat.com>
12
---
13
hw/net/e1000e_core.c | 8 ++++----
14
1 file changed, 4 insertions(+), 4 deletions(-)
15
16
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/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,
21
(const char *) &fcs_pad, e1000x_fcs_len(core->mac));
22
}
23
}
24
- desc_offset += desc_size;
25
- if (desc_offset >= total_size) {
26
- is_last = true;
27
- }
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
--
39
2.7.4
40
41
diff view generated by jsdifflib
1
From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
1
From: Paolo Bonzini <pbonzini@redhat.com>
2
2
3
Because of inet_ntoa() return a statically allocated buffer,
3
"netdev_add help" is causing QEMU to exit because the code that
4
subsequent calls will overwrite, So we fix this bug.
4
invokes show_netdevs is shared between CLI and HMP processing.
5
Move the check to the callers so that exit(0) remains only
6
in the CLI flow.
5
7
6
Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
8
"netdev_add help" is not fixed by this patch; that is left for
9
later work.
10
11
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7
Signed-off-by: Jason Wang <jasowang@redhat.com>
12
Signed-off-by: Jason Wang <jasowang@redhat.com>
8
---
13
---
9
net/colo-compare.c | 33 +++++++++++++++++++++++++--------
14
include/net/net.h | 1 +
10
1 file changed, 25 insertions(+), 8 deletions(-)
15
monitor/hmp-cmds.c | 6 +++++
16
net/net.c | 68 +++++++++++++++++++++++++++---------------------------
17
3 files changed, 41 insertions(+), 34 deletions(-)
11
18
12
diff --git a/net/colo-compare.c b/net/colo-compare.c
19
diff --git a/include/net/net.h b/include/net/net.h
13
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
14
--- a/net/colo-compare.c
21
--- a/include/net/net.h
15
+++ b/net/colo-compare.c
22
+++ b/include/net/net.h
16
@@ -XXX,XX +XXX,XX @@ static int packet_enqueue(CompareState *s, int mode)
23
@@ -XXX,XX +XXX,XX @@ extern const char *host_net_devices[];
17
*/
24
18
static int colo_packet_compare_common(Packet *ppkt, Packet *spkt, int offset)
25
/* from net.c */
26
int net_client_parse(QemuOptsList *opts_list, const char *str);
27
+void show_netdevs(void);
28
int net_init_clients(Error **errp);
29
void net_check_clients(void);
30
void net_cleanup(void);
31
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/monitor/hmp-cmds.c
34
+++ b/monitor/hmp-cmds.c
35
@@ -XXX,XX +XXX,XX @@
36
#include "qemu/option.h"
37
#include "qemu/timer.h"
38
#include "qemu/sockets.h"
39
+#include "qemu/help_option.h"
40
#include "monitor/monitor-internal.h"
41
#include "qapi/error.h"
42
#include "qapi/clone-visitor.h"
43
@@ -XXX,XX +XXX,XX @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict)
19
{
44
{
20
- trace_colo_compare_ip_info(ppkt->size, inet_ntoa(ppkt->ip->ip_src),
45
Error *err = NULL;
21
- inet_ntoa(ppkt->ip->ip_dst), spkt->size,
46
QemuOpts *opts;
22
- inet_ntoa(spkt->ip->ip_src),
47
+ const char *type = qdict_get_try_str(qdict, "type");
23
- inet_ntoa(spkt->ip->ip_dst));
48
24
+ if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {
49
+ if (type && is_help_option(type)) {
25
+ char pri_ip_src[20], pri_ip_dst[20], sec_ip_src[20], sec_ip_dst[20];
50
+ show_netdevs();
51
+ return;
52
+ }
53
opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict, &err);
54
if (err) {
55
goto out;
56
diff --git a/net/net.c b/net/net.c
57
index XXXXXXX..XXXXXXX 100644
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
}
87
}
88
89
@@ -XXX,XX +XXX,XX @@ static int net_client_init(QemuOpts *opts, bool is_netdev, Error **errp)
90
int ret = -1;
91
Visitor *v = opts_visitor_new(opts);
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
}
26
+
148
+
27
+ strcpy(pri_ip_src, inet_ntoa(ppkt->ip->ip_src));
149
+ qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort);
28
+ strcpy(pri_ip_dst, inet_ntoa(ppkt->ip->ip_dst));
150
+ qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len,
29
+ strcpy(sec_ip_src, inet_ntoa(spkt->ip->ip_src));
151
+ &error_abort);
30
+ strcpy(sec_ip_dst, inet_ntoa(spkt->ip->ip_dst));
152
+ qemu_opt_unset(opts, "ipv6-net");
153
}
154
155
/* Create an ID for -net if the user did not specify one */
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");
31
+
161
+
32
+ trace_colo_compare_ip_info(ppkt->size, pri_ip_src,
162
+ if (type && is_help_option(type)) {
33
+ pri_ip_dst, spkt->size,
163
+ show_netdevs();
34
+ sec_ip_src, sec_ip_dst);
164
+ exit(0);
35
+ }
165
+ }
36
166
return net_client_init(opts, true, errp);
37
if (ppkt->size == spkt->size) {
38
return memcmp(ppkt->data + offset, spkt->data + offset,
39
@@ -XXX,XX +XXX,XX @@ static int colo_packet_compare_icmp(Packet *spkt, Packet *ppkt)
40
static int colo_packet_compare_other(Packet *spkt, Packet *ppkt)
41
{
42
trace_colo_compare_main("compare other");
43
- trace_colo_compare_ip_info(ppkt->size, inet_ntoa(ppkt->ip->ip_src),
44
- inet_ntoa(ppkt->ip->ip_dst), spkt->size,
45
- inet_ntoa(spkt->ip->ip_src),
46
- inet_ntoa(spkt->ip->ip_dst));
47
+ if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {
48
+ char pri_ip_src[20], pri_ip_dst[20], sec_ip_src[20], sec_ip_dst[20];
49
+
50
+ strcpy(pri_ip_src, inet_ntoa(ppkt->ip->ip_src));
51
+ strcpy(pri_ip_dst, inet_ntoa(ppkt->ip->ip_dst));
52
+ strcpy(sec_ip_src, inet_ntoa(spkt->ip->ip_src));
53
+ strcpy(sec_ip_dst, inet_ntoa(spkt->ip->ip_dst));
54
+
55
+ trace_colo_compare_ip_info(ppkt->size, pri_ip_src,
56
+ pri_ip_dst, spkt->size,
57
+ sec_ip_src, sec_ip_dst);
58
+ }
59
+
60
return colo_packet_compare_common(ppkt, spkt, 0);
61
}
167
}
62
168
63
--
169
--
64
2.7.4
170
2.7.4
65
171
66
172
diff view generated by jsdifflib
1
From: Greg Ungerer <gerg@uclinux.org>
1
From: Yuri Benditovich <yuri.benditovich@daynix.com>
2
2
3
The FEC ethernet hardware module used on ColdFire SoC parts contains a
3
https://bugzilla.redhat.com/show_bug.cgi?id=1829272
4
block of RAM used to maintain hardware counters. This block is accessible
4
When deleting queue pair, purge pending RX packets if any.
5
via the usual FEC register address space. There is currently no support
5
Example of problematic flow:
6
for this in the QEMU mcf_fec driver.
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)
7
14
8
Add support for storing a MIB RAM block, and provide register level
15
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
9
access to it. Also implement a basic set of stats collection functions
10
to populate MIB data fields.
11
12
This support tested running a Linux target and using the net-tools
13
"ethtool -S" option. As of linux-4.9 the kernels FEC driver makes
14
accesses to the MIB counters during its initialization (which it never
15
did before), and so this version of Linux will now fail with the QEMU
16
error:
17
18
qemu: hardware error: mcf_fec_read: Bad address 0x200
19
20
This MIB counter support fixes this problem.
21
22
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
23
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
24
Signed-off-by: Jason Wang <jasowang@redhat.com>
16
Signed-off-by: Jason Wang <jasowang@redhat.com>
25
---
17
---
26
hw/net/mcf_fec.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
18
net/net.c | 12 ++++++++----
27
1 file changed, 115 insertions(+)
19
1 file changed, 8 insertions(+), 4 deletions(-)
28
20
29
diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
21
diff --git a/net/net.c b/net/net.c
30
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
31
--- a/hw/net/mcf_fec.c
23
--- a/net/net.c
32
+++ b/hw/net/mcf_fec.c
24
+++ b/net/net.c
33
@@ -XXX,XX +XXX,XX @@ do { printf("mcf_fec: " fmt , ## __VA_ARGS__); } while (0)
25
@@ -XXX,XX +XXX,XX @@ void qemu_del_nic(NICState *nic)
34
26
35
#define FEC_MAX_DESC 1024
27
qemu_macaddr_set_free(&nic->conf->macaddr);
36
#define FEC_MAX_FRAME_SIZE 2032
28
37
+#define FEC_MIB_SIZE 64
29
- /* If this is a peer NIC and peer has already been deleted, free it now. */
38
30
- if (nic->peer_deleted) {
39
typedef struct {
31
- for (i = 0; i < queues; i++) {
40
SysBusDevice parent_obj;
32
- qemu_free_net_client(qemu_get_subqueue(nic, i)->peer);
41
@@ -XXX,XX +XXX,XX @@ typedef struct {
33
+ for (i = 0; i < queues; i++) {
42
uint32_t erdsr;
34
+ NetClientState *nc = qemu_get_subqueue(nic, i);
43
uint32_t etdsr;
35
+ /* If this is a peer NIC and peer has already been deleted, free it now. */
44
uint32_t emrbr;
36
+ if (nic->peer_deleted) {
45
+ uint32_t mib[FEC_MIB_SIZE];
37
+ qemu_free_net_client(nc->peer);
46
} mcf_fec_state;
38
+ } else if (nc->peer) {
47
39
+ /* if there are RX packets pending, complete them */
48
#define FEC_INT_HB 0x80000000
40
+ qemu_purge_queued_packets(nc->peer);
49
@@ -XXX,XX +XXX,XX @@ typedef struct {
50
#define FEC_BD_OV 0x0002
51
#define FEC_BD_TR 0x0001
52
53
+#define MIB_RMON_T_DROP 0
54
+#define MIB_RMON_T_PACKETS 1
55
+#define MIB_RMON_T_BC_PKT 2
56
+#define MIB_RMON_T_MC_PKT 3
57
+#define MIB_RMON_T_CRC_ALIGN 4
58
+#define MIB_RMON_T_UNDERSIZE 5
59
+#define MIB_RMON_T_OVERSIZE 6
60
+#define MIB_RMON_T_FRAG 7
61
+#define MIB_RMON_T_JAB 8
62
+#define MIB_RMON_T_COL 9
63
+#define MIB_RMON_T_P64 10
64
+#define MIB_RMON_T_P65TO127 11
65
+#define MIB_RMON_T_P128TO255 12
66
+#define MIB_RMON_T_P256TO511 13
67
+#define MIB_RMON_T_P512TO1023 14
68
+#define MIB_RMON_T_P1024TO2047 15
69
+#define MIB_RMON_T_P_GTE2048 16
70
+#define MIB_RMON_T_OCTETS 17
71
+#define MIB_IEEE_T_DROP 18
72
+#define MIB_IEEE_T_FRAME_OK 19
73
+#define MIB_IEEE_T_1COL 20
74
+#define MIB_IEEE_T_MCOL 21
75
+#define MIB_IEEE_T_DEF 22
76
+#define MIB_IEEE_T_LCOL 23
77
+#define MIB_IEEE_T_EXCOL 24
78
+#define MIB_IEEE_T_MACERR 25
79
+#define MIB_IEEE_T_CSERR 26
80
+#define MIB_IEEE_T_SQE 27
81
+#define MIB_IEEE_T_FDXFC 28
82
+#define MIB_IEEE_T_OCTETS_OK 29
83
+
84
+#define MIB_RMON_R_DROP 32
85
+#define MIB_RMON_R_PACKETS 33
86
+#define MIB_RMON_R_BC_PKT 34
87
+#define MIB_RMON_R_MC_PKT 35
88
+#define MIB_RMON_R_CRC_ALIGN 36
89
+#define MIB_RMON_R_UNDERSIZE 37
90
+#define MIB_RMON_R_OVERSIZE 38
91
+#define MIB_RMON_R_FRAG 39
92
+#define MIB_RMON_R_JAB 40
93
+#define MIB_RMON_R_RESVD_0 41
94
+#define MIB_RMON_R_P64 42
95
+#define MIB_RMON_R_P65TO127 43
96
+#define MIB_RMON_R_P128TO255 44
97
+#define MIB_RMON_R_P256TO511 45
98
+#define MIB_RMON_R_P512TO1023 46
99
+#define MIB_RMON_R_P1024TO2047 47
100
+#define MIB_RMON_R_P_GTE2048 48
101
+#define MIB_RMON_R_OCTETS 49
102
+#define MIB_IEEE_R_DROP 50
103
+#define MIB_IEEE_R_FRAME_OK 51
104
+#define MIB_IEEE_R_CRC 52
105
+#define MIB_IEEE_R_ALIGN 53
106
+#define MIB_IEEE_R_MACERR 54
107
+#define MIB_IEEE_R_FDXFC 55
108
+#define MIB_IEEE_R_OCTETS_OK 56
109
+
110
static void mcf_fec_read_bd(mcf_fec_bd *bd, uint32_t addr)
111
{
112
cpu_physical_memory_read(addr, bd, sizeof(*bd));
113
@@ -XXX,XX +XXX,XX @@ static void mcf_fec_update(mcf_fec_state *s)
114
s->irq_state = active;
115
}
116
117
+static void mcf_fec_tx_stats(mcf_fec_state *s, int size)
118
+{
119
+ s->mib[MIB_RMON_T_PACKETS]++;
120
+ s->mib[MIB_RMON_T_OCTETS] += size;
121
+ if (size < 64) {
122
+ s->mib[MIB_RMON_T_FRAG]++;
123
+ } else if (size == 64) {
124
+ s->mib[MIB_RMON_T_P64]++;
125
+ } else if (size < 128) {
126
+ s->mib[MIB_RMON_T_P65TO127]++;
127
+ } else if (size < 256) {
128
+ s->mib[MIB_RMON_T_P128TO255]++;
129
+ } else if (size < 512) {
130
+ s->mib[MIB_RMON_T_P256TO511]++;
131
+ } else if (size < 1024) {
132
+ s->mib[MIB_RMON_T_P512TO1023]++;
133
+ } else if (size < 2048) {
134
+ s->mib[MIB_RMON_T_P1024TO2047]++;
135
+ } else {
136
+ s->mib[MIB_RMON_T_P_GTE2048]++;
137
+ }
138
+ s->mib[MIB_IEEE_T_FRAME_OK]++;
139
+ s->mib[MIB_IEEE_T_OCTETS_OK] += size;
140
+}
141
+
142
static void mcf_fec_do_tx(mcf_fec_state *s)
143
{
144
uint32_t addr;
145
@@ -XXX,XX +XXX,XX @@ static void mcf_fec_do_tx(mcf_fec_state *s)
146
/* Last buffer in frame. */
147
DPRINTF("Sending packet\n");
148
qemu_send_packet(qemu_get_queue(s->nic), frame, frame_size);
149
+ mcf_fec_tx_stats(s, frame_size);
150
ptr = frame;
151
frame_size = 0;
152
s->eir |= FEC_INT_TXF;
153
@@ -XXX,XX +XXX,XX @@ static uint64_t mcf_fec_read(void *opaque, hwaddr addr,
154
case 0x180: return s->erdsr;
155
case 0x184: return s->etdsr;
156
case 0x188: return s->emrbr;
157
+ case 0x200 ... 0x2e0: return s->mib[(addr & 0x1ff) / 4];
158
default:
159
hw_error("mcf_fec_read: Bad address 0x%x\n", (int)addr);
160
return 0;
161
@@ -XXX,XX +XXX,XX @@ static void mcf_fec_write(void *opaque, hwaddr addr,
162
case 0x188:
163
s->emrbr = value > 0 ? value & 0x7F0 : 0x7F0;
164
break;
165
+ case 0x200 ... 0x2e0:
166
+ s->mib[(addr & 0x1ff) / 4] = value;
167
+ break;
168
default:
169
hw_error("mcf_fec_write Bad address 0x%x\n", (int)addr);
170
}
171
mcf_fec_update(s);
172
}
173
174
+static void mcf_fec_rx_stats(mcf_fec_state *s, int size)
175
+{
176
+ s->mib[MIB_RMON_R_PACKETS]++;
177
+ s->mib[MIB_RMON_R_OCTETS] += size;
178
+ if (size < 64) {
179
+ s->mib[MIB_RMON_R_FRAG]++;
180
+ } else if (size == 64) {
181
+ s->mib[MIB_RMON_R_P64]++;
182
+ } else if (size < 128) {
183
+ s->mib[MIB_RMON_R_P65TO127]++;
184
+ } else if (size < 256) {
185
+ s->mib[MIB_RMON_R_P128TO255]++;
186
+ } else if (size < 512) {
187
+ s->mib[MIB_RMON_R_P256TO511]++;
188
+ } else if (size < 1024) {
189
+ s->mib[MIB_RMON_R_P512TO1023]++;
190
+ } else if (size < 2048) {
191
+ s->mib[MIB_RMON_R_P1024TO2047]++;
192
+ } else {
193
+ s->mib[MIB_RMON_R_P_GTE2048]++;
194
+ }
195
+ s->mib[MIB_IEEE_R_FRAME_OK]++;
196
+ s->mib[MIB_IEEE_R_OCTETS_OK] += size;
197
+}
198
+
199
static int mcf_fec_have_receive_space(mcf_fec_state *s, size_t want)
200
{
201
mcf_fec_bd bd;
202
@@ -XXX,XX +XXX,XX @@ static ssize_t mcf_fec_receive(NetClientState *nc, const uint8_t *buf, size_t si
203
}
41
}
204
}
42
}
205
s->rx_descriptor = addr;
43
206
+ mcf_fec_rx_stats(s, retsize);
207
mcf_fec_enable_rx(s);
208
mcf_fec_update(s);
209
return retsize;
210
--
44
--
211
2.7.4
45
2.7.4
212
46
213
47
diff view generated by jsdifflib
New patch
1
From: yuanjungong <ruc_gongyuanjun@163.com>
1
2
3
Close fd before returning.
4
5
Buglink: https://bugs.launchpad.net/qemu/+bug/1904486
6
7
Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
---
11
net/tap.c | 2 ++
12
1 file changed, 2 insertions(+)
13
14
diff --git a/net/tap.c b/net/tap.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/net/tap.c
17
+++ b/net/tap.c
18
@@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name,
19
if (ret < 0) {
20
error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d",
21
name, fd);
22
+ close(fd);
23
return -1;
24
}
25
26
@@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name,
27
vhostfdname, vnet_hdr, fd, &err);
28
if (err) {
29
error_propagate(errp, err);
30
+ close(fd);
31
return -1;
32
}
33
} else if (tap->has_fds) {
34
--
35
2.7.4
36
37
diff view generated by jsdifflib
1
From: Paolo Bonzini <pbonzini@redhat.com>
1
From: Keqian Zhu <zhukeqian1@huawei.com>
2
2
3
MSI-X has been disabled by the time the e1000e device is unrealized, hence
3
Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts)
4
msix_uninit is never called. This causes the object to be leaked, which
4
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
5
shows up as a RAMBlock with empty name when attempting migration.
6
7
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
8
Cc: Jason Wang <jasowang@redhat.com>
9
Cc: qemu-stable@nongnu.org
10
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11
Tested-by: Laurent Vivier <lvivier@redhat.com>
12
Signed-off-by: Jason Wang <jasowang@redhat.com>
5
Signed-off-by: Jason Wang <jasowang@redhat.com>
13
---
6
---
14
hw/net/e1000e.c | 2 +-
7
net/tap.c | 3 ++-
15
1 file changed, 1 insertion(+), 1 deletion(-)
8
1 file changed, 2 insertions(+), 1 deletion(-)
16
9
17
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
10
diff --git a/net/tap.c b/net/tap.c
18
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/net/e1000e.c
12
--- a/net/tap.c
20
+++ b/hw/net/e1000e.c
13
+++ b/net/tap.c
21
@@ -XXX,XX +XXX,XX @@ e1000e_init_msix(E1000EState *s)
14
@@ -XXX,XX +XXX,XX @@ free_fail:
22
static void
15
script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
23
e1000e_cleanup_msix(E1000EState *s)
16
}
24
{
17
if (!downscript) {
25
- if (msix_enabled(PCI_DEVICE(s))) {
18
- downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
26
+ if (msix_present(PCI_DEVICE(s))) {
19
+ downscript = default_downscript =
27
e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM);
20
+ get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT);
28
msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix);
21
}
29
}
22
23
if (tap->has_ifname) {
30
--
24
--
31
2.7.4
25
2.7.4
32
26
33
27
diff view generated by jsdifflib