1
The following changes since commit 43ab9a5376c95c61ae898a222c4d04bdf60e239b:
1
The following changes since commit 23895cbd82be95428e90168b12e925d0d3ca2f06:
2
2
3
hw/i386/vmport: fix missing definitions with non-log trace backends (2017-12-21 22:52:28 +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 0065e915192cdf83c2700bb377e5323c2649476e:
9
for you to fetch changes up to 9925990d01a92564af55f6f69d0f5f59b47609b1:
10
10
11
qemu-doc: Update the deprecation information of -tftp, -bootp, -redir and -smb (2017-12-22 10:06:05 +0800)
11
net: Use correct default-path macro for downscript (2020-11-24 10:40:17 +0800)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
14
15
----------------------------------------------------------------
15
----------------------------------------------------------------
16
Ed Swierk via Qemu-devel (2):
16
Keqian Zhu (1):
17
e1000, e1000e: Move per-packet TX offload flags out of context state
17
net: Use correct default-path macro for downscript
18
e1000: Separate TSO and non-TSO contexts, fixing UDP TX corruption
19
18
20
Mark Cave-Ayland (13):
19
Paolo Bonzini (1):
21
net: move CRC32 calculation from compute_mcast_idx() into its own net_crc32() function
20
net: do not exit on "netdev_add help" monitor command
22
net: introduce net_crc32_le() function
23
pcnet: switch pcnet over to use net_crc32_le()
24
eepro100: switch eepro100 e100_compute_mcast_idx() over to use net_crc32()
25
sunhme: switch sunhme over to use net_crc32_le()
26
sungem: fix multicast filter CRC calculation
27
eepro100: use inline net_crc32() and bitshift instead of compute_mcast_idx()
28
opencores_eth: use inline net_crc32() and bitshift instead of compute_mcast_idx()
29
lan9118: use inline net_crc32() and bitshift instead of compute_mcast_idx()
30
ftgmac100: use inline net_crc32() and bitshift instead of compute_mcast_idx()
31
ne2000: use inline net_crc32() and bitshift instead of compute_mcast_idx()
32
rtl8139: use inline net_crc32() and bitshift instead of compute_mcast_idx()
33
net: remove unused compute_mcast_idx() function
34
21
35
Thomas Huth (3):
22
Prasad J Pandit (1):
36
net: Remove the legacy "-net channel" parameter
23
hw/net/e1000e: advance desc_offset in case of null descriptor
37
qemu-doc: The "-net nic" option can be used with "netdev=...", too
38
qemu-doc: Update the deprecation information of -tftp, -bootp, -redir and -smb
39
24
40
hw/net/e1000.c | 92 ++++++++++++++++++++++++++++----------------------
25
Yuri Benditovich (1):
41
hw/net/e1000e.c | 4 +--
26
net: purge queued rx packets on queue deletion
42
hw/net/e1000e_core.c | 16 ++++-----
27
43
hw/net/e1000e_core.h | 2 ++
28
yuanjungong (1):
44
hw/net/e1000x_common.h | 2 --
29
tap: fix a memory leak
45
hw/net/eepro100.c | 32 +++---------------
30
46
hw/net/ftgmac100.c | 2 +-
31
hw/net/e1000e_core.c | 8 +++---
47
hw/net/lan9118.c | 3 +-
32
include/net/net.h | 1 +
48
hw/net/ne2000.c | 4 ++-
33
monitor/hmp-cmds.c | 6 ++++
49
hw/net/opencores_eth.c | 3 +-
34
net/net.c | 80 +++++++++++++++++++++++++++-------------------------
50
hw/net/pcnet.c | 22 ++----------
35
net/tap.c | 5 +++-
51
hw/net/rtl8139.c | 2 +-
36
5 files changed, 57 insertions(+), 43 deletions(-)
52
hw/net/sungem.c | 5 ++-
53
hw/net/sunhme.c | 25 +-------------
54
include/net/net.h | 5 ++-
55
include/net/slirp.h | 2 --
56
net/net.c | 40 +++++++++++++++-------
57
net/slirp.c | 34 -------------------
58
qemu-doc.texi | 38 +++++++++++----------
59
qemu-options.hx | 14 ++++----
60
20 files changed, 144 insertions(+), 203 deletions(-)
61
37
62
38
diff view generated by jsdifflib
1
From: Ed Swierk via Qemu-devel <qemu-devel@nongnu.org>
1
From: Prasad J Pandit <pjp@fedoraproject.org>
2
2
3
sum_needed and cptse flags are received from the guest within each
3
While receiving packets via e1000e_write_packet_to_guest() routine,
4
transmit data descriptor. They are not part of the offload context;
4
'desc_offset' is advanced only when RX descriptor is processed. And
5
instead, they determine how to apply a previously received context to
5
RX descriptor is not processed if it has NULL buffer address.
6
the packet being transmitted:
6
This may lead to an infinite loop condition. Increament 'desc_offset'
7
to process next descriptor in the ring to avoid infinite loop.
7
8
8
- If cptse is set, perform both segmentation and checksum offload
9
Reported-by: Cheol-woo Myung <330cjfdn@gmail.com>
9
using the parameters in the TSO context; otherwise just do checksum
10
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
10
offload. (Currently the e1000 device incorrectly stores only one
11
context, which will be fixed in a subsequent patch.)
12
13
- Depending on the bits set in sum_needed, possibly perform L4
14
checksum offload and/or IP checksum offload, using the parameters in
15
the appropriate context.
16
17
Move these flags out of struct e1000x_txd_props, which is otherwise
18
dedicated to storing values from a context descriptor, and into the
19
per-packet TX struct.
20
21
Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
22
Signed-off-by: Jason Wang <jasowang@redhat.com>
11
Signed-off-by: Jason Wang <jasowang@redhat.com>
23
---
12
---
24
hw/net/e1000.c | 30 ++++++++++++++++--------------
13
hw/net/e1000e_core.c | 8 ++++----
25
hw/net/e1000e.c | 4 ++--
14
1 file changed, 4 insertions(+), 4 deletions(-)
26
hw/net/e1000e_core.c | 16 ++++++++--------
27
hw/net/e1000e_core.h | 2 ++
28
hw/net/e1000x_common.h | 2 --
29
5 files changed, 28 insertions(+), 26 deletions(-)
30
15
31
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/net/e1000.c
34
+++ b/hw/net/e1000.c
35
@@ -XXX,XX +XXX,XX @@ typedef struct E1000State_st {
36
unsigned char data[0x10000];
37
uint16_t size;
38
unsigned char vlan_needed;
39
+ unsigned char sum_needed;
40
+ bool cptse;
41
e1000x_txd_props props;
42
uint16_t tso_frames;
43
} tx;
44
@@ -XXX,XX +XXX,XX @@ xmit_seg(E1000State *s)
45
unsigned int frames = s->tx.tso_frames, css, sofar;
46
struct e1000_tx *tp = &s->tx;
47
48
- if (tp->props.tse && tp->props.cptse) {
49
+ if (tp->props.tse && tp->cptse) {
50
css = tp->props.ipcss;
51
DBGOUT(TXSUM, "frames %d size %d ipcss %d\n",
52
frames, tp->size, css);
53
@@ -XXX,XX +XXX,XX @@ xmit_seg(E1000State *s)
54
}
55
} else /* UDP */
56
stw_be_p(tp->data+css+4, len);
57
- if (tp->props.sum_needed & E1000_TXD_POPTS_TXSM) {
58
+ if (tp->sum_needed & E1000_TXD_POPTS_TXSM) {
59
unsigned int phsum;
60
// add pseudo-header length before checksum calculation
61
void *sp = tp->data + tp->props.tucso;
62
@@ -XXX,XX +XXX,XX @@ xmit_seg(E1000State *s)
63
tp->tso_frames++;
64
}
65
66
- if (tp->props.sum_needed & E1000_TXD_POPTS_TXSM) {
67
+ if (tp->sum_needed & E1000_TXD_POPTS_TXSM) {
68
putsum(tp->data, tp->size, tp->props.tucso,
69
tp->props.tucss, tp->props.tucse);
70
}
71
- if (tp->props.sum_needed & E1000_TXD_POPTS_IXSM) {
72
+ if (tp->sum_needed & E1000_TXD_POPTS_IXSM) {
73
putsum(tp->data, tp->size, tp->props.ipcso,
74
tp->props.ipcss, tp->props.ipcse);
75
}
76
@@ -XXX,XX +XXX,XX @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
77
} else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) {
78
// data descriptor
79
if (tp->size == 0) {
80
- tp->props.sum_needed = le32_to_cpu(dp->upper.data) >> 8;
81
+ tp->sum_needed = le32_to_cpu(dp->upper.data) >> 8;
82
}
83
- tp->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0;
84
+ tp->cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0;
85
} else {
86
// legacy descriptor
87
- tp->props.cptse = 0;
88
+ tp->cptse = 0;
89
}
90
91
if (e1000x_vlan_enabled(s->mac_reg) &&
92
e1000x_is_vlan_txd(txd_lower) &&
93
- (tp->props.cptse || txd_lower & E1000_TXD_CMD_EOP)) {
94
+ (tp->cptse || txd_lower & E1000_TXD_CMD_EOP)) {
95
tp->vlan_needed = 1;
96
stw_be_p(tp->vlan_header,
97
le16_to_cpu(s->mac_reg[VET]));
98
@@ -XXX,XX +XXX,XX @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
99
}
100
101
addr = le64_to_cpu(dp->buffer_addr);
102
- if (tp->props.tse && tp->props.cptse) {
103
+ if (tp->props.tse && tp->cptse) {
104
msh = tp->props.hdr_len + tp->props.mss;
105
do {
106
bytes = split_size;
107
@@ -XXX,XX +XXX,XX @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
108
}
109
split_size -= bytes;
110
} while (bytes && split_size);
111
- } else if (!tp->props.tse && tp->props.cptse) {
112
+ } else if (!tp->props.tse && tp->cptse) {
113
// context descriptor TSE is not set, while data descriptor TSE is set
114
DBGOUT(TXERR, "TCP segmentation error\n");
115
} else {
116
@@ -XXX,XX +XXX,XX @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
117
118
if (!(txd_lower & E1000_TXD_CMD_EOP))
119
return;
120
- if (!(tp->props.tse && tp->props.cptse && tp->size < tp->props.hdr_len)) {
121
+ if (!(tp->props.tse && tp->cptse && tp->size < tp->props.hdr_len)) {
122
xmit_seg(s);
123
}
124
tp->tso_frames = 0;
125
- tp->props.sum_needed = 0;
126
+ tp->sum_needed = 0;
127
tp->vlan_needed = 0;
128
tp->size = 0;
129
- tp->props.cptse = 0;
130
+ tp->cptse = 0;
131
}
132
133
static uint32_t
134
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_e1000 = {
135
VMSTATE_UINT16(tx.props.mss, E1000State),
136
VMSTATE_UINT16(tx.size, E1000State),
137
VMSTATE_UINT16(tx.tso_frames, E1000State),
138
- VMSTATE_UINT8(tx.props.sum_needed, E1000State),
139
+ VMSTATE_UINT8(tx.sum_needed, E1000State),
140
VMSTATE_INT8(tx.props.ip, E1000State),
141
VMSTATE_INT8(tx.props.tcp, E1000State),
142
VMSTATE_BUFFER(tx.header, E1000State),
143
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
144
index XXXXXXX..XXXXXXX 100644
145
--- a/hw/net/e1000e.c
146
+++ b/hw/net/e1000e.c
147
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription e1000e_vmstate_tx = {
148
.version_id = 1,
149
.minimum_version_id = 1,
150
.fields = (VMStateField[]) {
151
- VMSTATE_UINT8(props.sum_needed, struct e1000e_tx),
152
+ VMSTATE_UINT8(sum_needed, struct e1000e_tx),
153
VMSTATE_UINT8(props.ipcss, struct e1000e_tx),
154
VMSTATE_UINT8(props.ipcso, struct e1000e_tx),
155
VMSTATE_UINT16(props.ipcse, struct e1000e_tx),
156
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription e1000e_vmstate_tx = {
157
VMSTATE_INT8(props.ip, struct e1000e_tx),
158
VMSTATE_INT8(props.tcp, struct e1000e_tx),
159
VMSTATE_BOOL(props.tse, struct e1000e_tx),
160
- VMSTATE_BOOL(props.cptse, struct e1000e_tx),
161
+ VMSTATE_BOOL(cptse, struct e1000e_tx),
162
VMSTATE_BOOL(skip_cp, struct e1000e_tx),
163
VMSTATE_END_OF_LIST()
164
}
165
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
166
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
167
--- a/hw/net/e1000e_core.c
18
--- a/hw/net/e1000e_core.c
168
+++ b/hw/net/e1000e_core.c
19
+++ b/hw/net/e1000e_core.c
169
@@ -XXX,XX +XXX,XX @@ e1000e_rss_parse_packet(E1000ECore *core,
20
@@ -XXX,XX +XXX,XX @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
170
static void
21
(const char *) &fcs_pad, e1000x_fcs_len(core->mac));
171
e1000e_setup_tx_offloads(E1000ECore *core, struct e1000e_tx *tx)
22
}
172
{
23
}
173
- if (tx->props.tse && tx->props.cptse) {
24
- desc_offset += desc_size;
174
+ if (tx->props.tse && tx->cptse) {
25
- if (desc_offset >= total_size) {
175
net_tx_pkt_build_vheader(tx->tx_pkt, true, true, tx->props.mss);
26
- is_last = true;
176
net_tx_pkt_update_ip_checksums(tx->tx_pkt);
27
- }
177
e1000x_inc_reg_if_not_full(core->mac, TSCTC);
28
} else { /* as per intel docs; skip descriptors with null buf addr */
178
return;
29
trace_e1000e_rx_null_descriptor();
179
}
30
}
180
31
+ desc_offset += desc_size;
181
- if (tx->props.sum_needed & E1000_TXD_POPTS_TXSM) {
32
+ if (desc_offset >= total_size) {
182
+ if (tx->sum_needed & E1000_TXD_POPTS_TXSM) {
33
+ is_last = true;
183
net_tx_pkt_build_vheader(tx->tx_pkt, false, true, 0);
34
+ }
184
}
35
185
36
e1000e_write_rx_descr(core, desc, is_last ? core->rx_pkt : NULL,
186
- if (tx->props.sum_needed & E1000_TXD_POPTS_IXSM) {
37
rss_info, do_ps ? ps_hdr_len : 0, &bastate.written);
187
+ if (tx->sum_needed & E1000_TXD_POPTS_IXSM) {
188
net_tx_pkt_update_ip_hdr_checksum(tx->tx_pkt);
189
}
190
}
191
@@ -XXX,XX +XXX,XX @@ e1000e_process_tx_desc(E1000ECore *core,
192
return;
193
} else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) {
194
/* data descriptor */
195
- tx->props.sum_needed = le32_to_cpu(dp->upper.data) >> 8;
196
- tx->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0;
197
+ tx->sum_needed = le32_to_cpu(dp->upper.data) >> 8;
198
+ tx->cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0;
199
e1000e_process_ts_option(core, dp);
200
} else {
201
/* legacy descriptor */
202
e1000e_process_ts_option(core, dp);
203
- tx->props.cptse = 0;
204
+ tx->cptse = 0;
205
}
206
207
addr = le64_to_cpu(dp->buffer_addr);
208
@@ -XXX,XX +XXX,XX @@ e1000e_process_tx_desc(E1000ECore *core,
209
tx->skip_cp = false;
210
net_tx_pkt_reset(tx->tx_pkt);
211
212
- tx->props.sum_needed = 0;
213
- tx->props.cptse = 0;
214
+ tx->sum_needed = 0;
215
+ tx->cptse = 0;
216
}
217
}
218
219
diff --git a/hw/net/e1000e_core.h b/hw/net/e1000e_core.h
220
index XXXXXXX..XXXXXXX 100644
221
--- a/hw/net/e1000e_core.h
222
+++ b/hw/net/e1000e_core.h
223
@@ -XXX,XX +XXX,XX @@ struct E1000Core {
224
e1000x_txd_props props;
225
226
bool skip_cp;
227
+ unsigned char sum_needed;
228
+ bool cptse;
229
struct NetTxPkt *tx_pkt;
230
} tx[E1000E_NUM_QUEUES];
231
232
diff --git a/hw/net/e1000x_common.h b/hw/net/e1000x_common.h
233
index XXXXXXX..XXXXXXX 100644
234
--- a/hw/net/e1000x_common.h
235
+++ b/hw/net/e1000x_common.h
236
@@ -XXX,XX +XXX,XX @@ void e1000x_update_regs_on_autoneg_done(uint32_t *mac, uint16_t *phy);
237
void e1000x_increase_size_stats(uint32_t *mac, const int *size_regs, int size);
238
239
typedef struct e1000x_txd_props {
240
- unsigned char sum_needed;
241
uint8_t ipcss;
242
uint8_t ipcso;
243
uint16_t ipcse;
244
@@ -XXX,XX +XXX,XX @@ typedef struct e1000x_txd_props {
245
int8_t ip;
246
int8_t tcp;
247
bool tse;
248
- bool cptse;
249
} e1000x_txd_props;
250
251
void e1000x_read_tx_ctx_descr(struct e1000_context_desc *d,
252
--
38
--
253
2.7.4
39
2.7.4
254
40
255
41
diff view generated by jsdifflib
Deleted patch
1
From: Ed Swierk via Qemu-devel <qemu-devel@nongnu.org>
2
1
3
The device is supposed to maintain two distinct contexts for transmit
4
offloads: one has parameters for both segmentation and checksum
5
offload, the other only for checksum offload. The guest driver can
6
send two context descriptors, one for each context (the TSE flag
7
specifies which). Then the guest can refer to one or the other context
8
in subsequent transmit data descriptors, depending on what offloads it
9
wants applied to each packet.
10
11
Currently the e1000 device stores just one context, and misinterprets
12
the TSE flags in the context and data descriptors. This is often okay:
13
Linux happens to send a fresh context descriptor before every data
14
descriptor, so forgetting the other context doesn't matter. Windows
15
does rely on separate contexts for TSO vs. non-TSO packets, but for
16
mostly-TCP traffic the two contexts have identical TCP-specific
17
offload parameters so confusing them doesn't matter.
18
19
One case where this confusion matters is when a Windows guest sets up
20
a TSO context for TCP and a non-TSO context for UDP, and then
21
transmits both TCP and UDP traffic in parallel. The e1000 device
22
sometimes ends up using TCP-specific parameters while doing checksum
23
offload on a UDP datagram: it writes the checksum to offset 16 (the
24
correct location for a TCP checksum), stomping on two bytes of UDP
25
data, and leaving the wrong value in the actual UDP checksum field at
26
offset 6. (Even worse, the host network stack may then recompute the
27
UDP checksum, "correcting" it to match the corrupt data before sending
28
it out a physical interface.)
29
30
Correct this by tracking the TSO context independently of the non-TSO
31
context, and selecting the appropriate context based on the TSE flag
32
in each transmit data descriptor.
33
34
Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
35
Signed-off-by: Jason Wang <jasowang@redhat.com>
36
---
37
hw/net/e1000.c | 70 +++++++++++++++++++++++++++++++++-------------------------
38
1 file changed, 40 insertions(+), 30 deletions(-)
39
40
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/net/e1000.c
43
+++ b/hw/net/e1000.c
44
@@ -XXX,XX +XXX,XX @@ typedef struct E1000State_st {
45
unsigned char sum_needed;
46
bool cptse;
47
e1000x_txd_props props;
48
+ e1000x_txd_props tso_props;
49
uint16_t tso_frames;
50
} tx;
51
52
@@ -XXX,XX +XXX,XX @@ xmit_seg(E1000State *s)
53
uint16_t len;
54
unsigned int frames = s->tx.tso_frames, css, sofar;
55
struct e1000_tx *tp = &s->tx;
56
+ struct e1000x_txd_props *props = tp->cptse ? &tp->tso_props : &tp->props;
57
58
- if (tp->props.tse && tp->cptse) {
59
- css = tp->props.ipcss;
60
+ if (tp->cptse) {
61
+ css = props->ipcss;
62
DBGOUT(TXSUM, "frames %d size %d ipcss %d\n",
63
frames, tp->size, css);
64
- if (tp->props.ip) { /* IPv4 */
65
+ if (props->ip) { /* IPv4 */
66
stw_be_p(tp->data+css+2, tp->size - css);
67
stw_be_p(tp->data+css+4,
68
lduw_be_p(tp->data + css + 4) + frames);
69
} else { /* IPv6 */
70
stw_be_p(tp->data+css+4, tp->size - css);
71
}
72
- css = tp->props.tucss;
73
+ css = props->tucss;
74
len = tp->size - css;
75
- DBGOUT(TXSUM, "tcp %d tucss %d len %d\n", tp->props.tcp, css, len);
76
- if (tp->props.tcp) {
77
- sofar = frames * tp->props.mss;
78
+ DBGOUT(TXSUM, "tcp %d tucss %d len %d\n", props->tcp, css, len);
79
+ if (props->tcp) {
80
+ sofar = frames * props->mss;
81
stl_be_p(tp->data+css+4, ldl_be_p(tp->data+css+4)+sofar); /* seq */
82
- if (tp->props.paylen - sofar > tp->props.mss) {
83
+ if (props->paylen - sofar > props->mss) {
84
tp->data[css + 13] &= ~9; /* PSH, FIN */
85
} else if (frames) {
86
e1000x_inc_reg_if_not_full(s->mac_reg, TSCTC);
87
}
88
- } else /* UDP */
89
+ } else { /* UDP */
90
stw_be_p(tp->data+css+4, len);
91
+ }
92
if (tp->sum_needed & E1000_TXD_POPTS_TXSM) {
93
unsigned int phsum;
94
// add pseudo-header length before checksum calculation
95
- void *sp = tp->data + tp->props.tucso;
96
+ void *sp = tp->data + props->tucso;
97
98
phsum = lduw_be_p(sp) + len;
99
phsum = (phsum >> 16) + (phsum & 0xffff);
100
@@ -XXX,XX +XXX,XX @@ xmit_seg(E1000State *s)
101
}
102
103
if (tp->sum_needed & E1000_TXD_POPTS_TXSM) {
104
- putsum(tp->data, tp->size, tp->props.tucso,
105
- tp->props.tucss, tp->props.tucse);
106
+ putsum(tp->data, tp->size, props->tucso, props->tucss, props->tucse);
107
}
108
if (tp->sum_needed & E1000_TXD_POPTS_IXSM) {
109
- putsum(tp->data, tp->size, tp->props.ipcso,
110
- tp->props.ipcss, tp->props.ipcse);
111
+ putsum(tp->data, tp->size, props->ipcso, props->ipcss, props->ipcse);
112
}
113
if (tp->vlan_needed) {
114
memmove(tp->vlan, tp->data, 4);
115
@@ -XXX,XX +XXX,XX @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
116
117
s->mit_ide |= (txd_lower & E1000_TXD_CMD_IDE);
118
if (dtype == E1000_TXD_CMD_DEXT) { /* context descriptor */
119
- e1000x_read_tx_ctx_descr(xp, &tp->props);
120
- tp->tso_frames = 0;
121
- if (tp->props.tucso == 0) { /* this is probably wrong */
122
- DBGOUT(TXSUM, "TCP/UDP: cso 0!\n");
123
- tp->props.tucso = tp->props.tucss + (tp->props.tcp ? 16 : 6);
124
+ if (le32_to_cpu(xp->cmd_and_length) & E1000_TXD_CMD_TSE) {
125
+ e1000x_read_tx_ctx_descr(xp, &tp->tso_props);
126
+ tp->tso_frames = 0;
127
+ } else {
128
+ e1000x_read_tx_ctx_descr(xp, &tp->props);
129
}
130
return;
131
} else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) {
132
@@ -XXX,XX +XXX,XX @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
133
}
134
135
addr = le64_to_cpu(dp->buffer_addr);
136
- if (tp->props.tse && tp->cptse) {
137
- msh = tp->props.hdr_len + tp->props.mss;
138
+ if (tp->cptse) {
139
+ msh = tp->tso_props.hdr_len + tp->tso_props.mss;
140
do {
141
bytes = split_size;
142
if (tp->size + bytes > msh)
143
@@ -XXX,XX +XXX,XX @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
144
bytes = MIN(sizeof(tp->data) - tp->size, bytes);
145
pci_dma_read(d, addr, tp->data + tp->size, bytes);
146
sz = tp->size + bytes;
147
- if (sz >= tp->props.hdr_len && tp->size < tp->props.hdr_len) {
148
- memmove(tp->header, tp->data, tp->props.hdr_len);
149
+ if (sz >= tp->tso_props.hdr_len
150
+ && tp->size < tp->tso_props.hdr_len) {
151
+ memmove(tp->header, tp->data, tp->tso_props.hdr_len);
152
}
153
tp->size = sz;
154
addr += bytes;
155
if (sz == msh) {
156
xmit_seg(s);
157
- memmove(tp->data, tp->header, tp->props.hdr_len);
158
- tp->size = tp->props.hdr_len;
159
+ memmove(tp->data, tp->header, tp->tso_props.hdr_len);
160
+ tp->size = tp->tso_props.hdr_len;
161
}
162
split_size -= bytes;
163
} while (bytes && split_size);
164
- } else if (!tp->props.tse && tp->cptse) {
165
- // context descriptor TSE is not set, while data descriptor TSE is set
166
- DBGOUT(TXERR, "TCP segmentation error\n");
167
} else {
168
split_size = MIN(sizeof(tp->data) - tp->size, split_size);
169
pci_dma_read(d, addr, tp->data + tp->size, split_size);
170
@@ -XXX,XX +XXX,XX @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
171
172
if (!(txd_lower & E1000_TXD_CMD_EOP))
173
return;
174
- if (!(tp->props.tse && tp->cptse && tp->size < tp->props.hdr_len)) {
175
+ if (!(tp->cptse && tp->size < tp->tso_props.hdr_len)) {
176
xmit_seg(s);
177
}
178
tp->tso_frames = 0;
179
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_e1000_full_mac_state = {
180
181
static const VMStateDescription vmstate_e1000 = {
182
.name = "e1000",
183
- .version_id = 2,
184
+ .version_id = 3,
185
.minimum_version_id = 1,
186
.pre_save = e1000_pre_save,
187
.post_load = e1000_post_load,
188
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_e1000 = {
189
VMSTATE_UINT32_SUB_ARRAY(mac_reg, E1000State, RA, 32),
190
VMSTATE_UINT32_SUB_ARRAY(mac_reg, E1000State, MTA, 128),
191
VMSTATE_UINT32_SUB_ARRAY(mac_reg, E1000State, VFTA, 128),
192
+ VMSTATE_UINT8_V(tx.tso_props.ipcss, E1000State, 3),
193
+ VMSTATE_UINT8_V(tx.tso_props.ipcso, E1000State, 3),
194
+ VMSTATE_UINT16_V(tx.tso_props.ipcse, E1000State, 3),
195
+ VMSTATE_UINT8_V(tx.tso_props.tucss, E1000State, 3),
196
+ VMSTATE_UINT8_V(tx.tso_props.tucso, E1000State, 3),
197
+ VMSTATE_UINT16_V(tx.tso_props.tucse, E1000State, 3),
198
+ VMSTATE_UINT32_V(tx.tso_props.paylen, E1000State, 3),
199
+ VMSTATE_UINT8_V(tx.tso_props.hdr_len, E1000State, 3),
200
+ VMSTATE_UINT16_V(tx.tso_props.mss, E1000State, 3),
201
+ VMSTATE_INT8_V(tx.tso_props.ip, E1000State, 3),
202
+ VMSTATE_INT8_V(tx.tso_props.tcp, E1000State, 3),
203
VMSTATE_END_OF_LIST()
204
},
205
.subsections = (const VMStateDescription*[]) {
206
--
207
2.7.4
208
209
diff view generated by jsdifflib
Deleted patch
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
1
3
Separate out the standard ethernet CRC32 calculation into a new net_crc32()
4
function, renaming the constant POLYNOMIAL to POLYNOMIAL_BE to make it clear
5
that this is a big-endian CRC32 calculation.
6
7
As part of the constant rename, remove the duplicate definition of POLYNOMIAL
8
from eepro100.c and use the new POLYNOMIAL_BE constant instead.
9
10
Once this is complete remove the existing CRC32 implementation from
11
compute_mcast_idx() and call the new net_crc32() function in its place.
12
13
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
15
Signed-off-by: Jason Wang <jasowang@redhat.com>
16
---
17
hw/net/eepro100.c | 4 +---
18
include/net/net.h | 3 ++-
19
net/net.c | 16 +++++++++++-----
20
3 files changed, 14 insertions(+), 9 deletions(-)
21
22
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/net/eepro100.c
25
+++ b/hw/net/eepro100.c
26
@@ -XXX,XX +XXX,XX @@ static const uint16_t eepro100_mdi_mask[] = {
27
0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
28
};
29
30
-#define POLYNOMIAL 0x04c11db6
31
-
32
static E100PCIDeviceInfo *eepro100_get_class(EEPRO100State *s);
33
34
/* From FreeBSD (locally modified). */
35
@@ -XXX,XX +XXX,XX @@ static unsigned e100_compute_mcast_idx(const uint8_t *ep)
36
crc <<= 1;
37
b >>= 1;
38
if (carry) {
39
- crc = ((crc ^ POLYNOMIAL) | carry);
40
+ crc = ((crc ^ POLYNOMIAL_BE) | carry);
41
}
42
}
43
}
44
diff --git a/include/net/net.h b/include/net/net.h
45
index XXXXXXX..XXXXXXX 100644
46
--- a/include/net/net.h
47
+++ b/include/net/net.h
48
@@ -XXX,XX +XXX,XX @@ NetClientState *net_hub_port_find(int hub_id);
49
50
void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);
51
52
-#define POLYNOMIAL 0x04c11db6
53
+#define POLYNOMIAL_BE 0x04c11db6
54
+uint32_t net_crc32(const uint8_t *p, int len);
55
unsigned compute_mcast_idx(const uint8_t *ep);
56
57
#define vmstate_offset_macaddr(_state, _field) \
58
diff --git a/net/net.c b/net/net.c
59
index XXXXXXX..XXXXXXX 100644
60
--- a/net/net.c
61
+++ b/net/net.c
62
@@ -XXX,XX +XXX,XX @@ int net_client_parse(QemuOptsList *opts_list, const char *optarg)
63
64
/* From FreeBSD */
65
/* XXX: optimize */
66
-unsigned compute_mcast_idx(const uint8_t *ep)
67
+uint32_t net_crc32(const uint8_t *p, int len)
68
{
69
uint32_t crc;
70
int carry, i, j;
71
uint8_t b;
72
73
crc = 0xffffffff;
74
- for (i = 0; i < 6; i++) {
75
- b = *ep++;
76
+ for (i = 0; i < len; i++) {
77
+ b = *p++;
78
for (j = 0; j < 8; j++) {
79
carry = ((crc & 0x80000000L) ? 1 : 0) ^ (b & 0x01);
80
crc <<= 1;
81
b >>= 1;
82
if (carry) {
83
- crc = ((crc ^ POLYNOMIAL) | carry);
84
+ crc = ((crc ^ POLYNOMIAL_BE) | carry);
85
}
86
}
87
}
88
- return crc >> 26;
89
+
90
+ return crc;
91
+}
92
+
93
+unsigned compute_mcast_idx(const uint8_t *ep)
94
+{
95
+ return net_crc32(ep, ETH_ALEN) >> 26;
96
}
97
98
QemuOptsList qemu_netdev_opts = {
99
--
100
2.7.4
101
102
diff view generated by jsdifflib
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
1
From: Paolo Bonzini <pbonzini@redhat.com>
2
2
3
This provides a standard ethernet CRC32 little-endian implementation.
3
"netdev_add help" is causing QEMU to exit because the code that
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.
4
7
5
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
8
"netdev_add help" is not fixed by this patch; that is left for
6
Reviewed-by: Eric Blake <eblake@redhat.com>
9
later work.
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
11
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8
Signed-off-by: Jason Wang <jasowang@redhat.com>
12
Signed-off-by: Jason Wang <jasowang@redhat.com>
9
---
13
---
10
include/net/net.h | 2 ++
14
include/net/net.h | 1 +
11
net/net.c | 22 ++++++++++++++++++++++
15
monitor/hmp-cmds.c | 6 +++++
12
2 files changed, 24 insertions(+)
16
net/net.c | 68 +++++++++++++++++++++++++++---------------------------
17
3 files changed, 41 insertions(+), 34 deletions(-)
13
18
14
diff --git a/include/net/net.h b/include/net/net.h
19
diff --git a/include/net/net.h b/include/net/net.h
15
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
16
--- a/include/net/net.h
21
--- a/include/net/net.h
17
+++ b/include/net/net.h
22
+++ b/include/net/net.h
18
@@ -XXX,XX +XXX,XX @@ NetClientState *net_hub_port_find(int hub_id);
23
@@ -XXX,XX +XXX,XX @@ extern const char *host_net_devices[];
19
void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);
24
20
25
/* from net.c */
21
#define POLYNOMIAL_BE 0x04c11db6
26
int net_client_parse(QemuOptsList *opts_list, const char *str);
22
+#define POLYNOMIAL_LE 0xedb88320
27
+void show_netdevs(void);
23
uint32_t net_crc32(const uint8_t *p, int len);
28
int net_init_clients(Error **errp);
24
+uint32_t net_crc32_le(const uint8_t *p, int len);
29
void net_check_clients(void);
25
unsigned compute_mcast_idx(const uint8_t *ep);
30
void net_cleanup(void);
26
31
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
27
#define vmstate_offset_macaddr(_state, _field) \
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)
44
{
45
Error *err = NULL;
46
QemuOpts *opts;
47
+ const char *type = qdict_get_try_str(qdict, "type");
48
49
+ if (type && is_help_option(type)) {
50
+ show_netdevs();
51
+ return;
52
+ }
53
opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict, &err);
54
if (err) {
55
goto out;
28
diff --git a/net/net.c b/net/net.c
56
diff --git a/net/net.c b/net/net.c
29
index XXXXXXX..XXXXXXX 100644
57
index XXXXXXX..XXXXXXX 100644
30
--- a/net/net.c
58
--- a/net/net.c
31
+++ b/net/net.c
59
+++ b/net/net.c
32
@@ -XXX,XX +XXX,XX @@ uint32_t net_crc32(const uint8_t *p, int len)
60
@@ -XXX,XX +XXX,XX @@
33
return crc;
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;
34
}
70
}
35
71
36
+uint32_t net_crc32_le(const uint8_t *p, int len)
72
-static void show_netdevs(void)
37
+{
73
+void show_netdevs(void)
38
+ uint32_t crc;
74
{
39
+ int carry, i, j;
75
int idx;
40
+ uint8_t b;
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
}
41
+
148
+
42
+ crc = 0xffffffff;
149
+ qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort);
43
+ for (i = 0; i < len; i++) {
150
+ qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len,
44
+ b = *p++;
151
+ &error_abort);
45
+ for (j = 0; j < 8; j++) {
152
+ qemu_opt_unset(opts, "ipv6-net");
46
+ carry = (crc & 0x1) ^ (b & 0x01);
153
}
47
+ crc >>= 1;
154
48
+ b >>= 1;
155
/* Create an ID for -net if the user did not specify one */
49
+ if (carry) {
156
@@ -XXX,XX +XXX,XX @@ static int net_init_client(void *dummy, QemuOpts *opts, Error **errp)
50
+ crc ^= POLYNOMIAL_LE;
157
51
+ }
158
static int net_init_netdev(void *dummy, QemuOpts *opts, Error **errp)
52
+ }
159
{
160
+ const char *type = qemu_opt_get(opts, "type");
161
+
162
+ if (type && is_help_option(type)) {
163
+ show_netdevs();
164
+ exit(0);
53
+ }
165
+ }
54
+
166
return net_client_init(opts, true, errp);
55
+ return crc;
167
}
56
+}
168
57
+
58
unsigned compute_mcast_idx(const uint8_t *ep)
59
{
60
return net_crc32(ep, ETH_ALEN) >> 26;
61
--
169
--
62
2.7.4
170
2.7.4
63
171
64
172
diff view generated by jsdifflib
Deleted patch
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
1
3
Instead of lnc_mchash() using its own implementation, we can simply call
4
net_crc32_le() directly and apply the bit shift inline.
5
6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7
Reviewed-by: Eric Blake <eblake@redhat.com>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
---
11
hw/net/pcnet.c | 22 ++--------------------
12
1 file changed, 2 insertions(+), 20 deletions(-)
13
14
diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/net/pcnet.c
17
+++ b/hw/net/pcnet.c
18
@@ -XXX,XX +XXX,XX @@
19
#include "qemu/osdep.h"
20
#include "hw/qdev.h"
21
#include "net/net.h"
22
+#include "net/eth.h"
23
#include "qemu/timer.h"
24
#include "qemu/sockets.h"
25
#include "sysemu/sysemu.h"
26
@@ -XXX,XX +XXX,XX @@ static inline void pcnet_rmd_store(PCNetState *s, struct pcnet_RMD *rmd,
27
be16_to_cpu(hdr->ether_type)); \
28
} while (0)
29
30
-#define MULTICAST_FILTER_LEN 8
31
-
32
-static inline uint32_t lnc_mchash(const uint8_t *ether_addr)
33
-{
34
-#define LNC_POLYNOMIAL 0xEDB88320UL
35
- uint32_t crc = 0xFFFFFFFF;
36
- int idx, bit;
37
- uint8_t data;
38
-
39
- for (idx = 0; idx < 6; idx++) {
40
- for (data = *ether_addr++, bit = 0; bit < MULTICAST_FILTER_LEN; bit++) {
41
- crc = (crc >> 1) ^ (((crc ^ data) & 1) ? LNC_POLYNOMIAL : 0);
42
- data >>= 1;
43
- }
44
- }
45
- return crc;
46
-#undef LNC_POLYNOMIAL
47
-}
48
-
49
#define CRC(crc, ch)     (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff])
50
51
/* generated using the AUTODIN II polynomial
52
@@ -XXX,XX +XXX,XX @@ static inline int ladr_match(PCNetState *s, const uint8_t *buf, int size)
53
s->csr[10] & 0xff, s->csr[10] >> 8,
54
s->csr[11] & 0xff, s->csr[11] >> 8
55
};
56
- int index = lnc_mchash(hdr->ether_dhost) >> 26;
57
+ int index = net_crc32_le(hdr->ether_dhost, ETH_ALEN) >> 26;
58
return !!(ladr[index >> 3] & (1 << (index & 7)));
59
}
60
return 0;
61
--
62
2.7.4
63
64
diff view generated by jsdifflib
Deleted patch
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
1
3
Instead of e100_compute_mcast_idx() using its own implementation, we can
4
simply call net_crc32() directly and apply the bit shift inline.
5
6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7
Reviewed-by: Stefan Weil <sw@weilnetz.de>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
---
11
hw/net/eepro100.c | 28 ++++------------------------
12
1 file changed, 4 insertions(+), 24 deletions(-)
13
14
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/net/eepro100.c
17
+++ b/hw/net/eepro100.c
18
@@ -XXX,XX +XXX,XX @@
19
#include "hw/hw.h"
20
#include "hw/pci/pci.h"
21
#include "net/net.h"
22
+#include "net/eth.h"
23
#include "hw/nvram/eeprom93xx.h"
24
#include "sysemu/sysemu.h"
25
#include "sysemu/dma.h"
26
@@ -XXX,XX +XXX,XX @@ static const uint16_t eepro100_mdi_mask[] = {
27
28
static E100PCIDeviceInfo *eepro100_get_class(EEPRO100State *s);
29
30
-/* From FreeBSD (locally modified). */
31
-static unsigned e100_compute_mcast_idx(const uint8_t *ep)
32
-{
33
- uint32_t crc;
34
- int carry, i, j;
35
- uint8_t b;
36
-
37
- crc = 0xffffffff;
38
- for (i = 0; i < 6; i++) {
39
- b = *ep++;
40
- for (j = 0; j < 8; j++) {
41
- carry = ((crc & 0x80000000L) ? 1 : 0) ^ (b & 0x01);
42
- crc <<= 1;
43
- b >>= 1;
44
- if (carry) {
45
- crc = ((crc ^ POLYNOMIAL_BE) | carry);
46
- }
47
- }
48
- }
49
- return (crc & BITS(7, 2)) >> 2;
50
-}
51
-
52
/* Read a 16 bit control/status (CSR) register. */
53
static uint16_t e100_read_reg2(EEPRO100State *s, E100RegisterOffset addr)
54
{
55
@@ -XXX,XX +XXX,XX @@ static void set_multicast_list(EEPRO100State *s)
56
uint8_t multicast_addr[6];
57
pci_dma_read(&s->dev, s->cb_address + 10 + i, multicast_addr, 6);
58
TRACE(OTHER, logout("multicast entry %s\n", nic_dump(multicast_addr, 6)));
59
- unsigned mcast_idx = e100_compute_mcast_idx(multicast_addr);
60
+ unsigned mcast_idx = (net_crc32(multicast_addr, ETH_ALEN) &
61
+ BITS(7, 2)) >> 2;
62
assert(mcast_idx < 64);
63
s->mult[mcast_idx >> 3] |= (1 << (mcast_idx & 7));
64
}
65
@@ -XXX,XX +XXX,XX @@ static ssize_t nic_receive(NetClientState *nc, const uint8_t * buf, size_t size)
66
if (s->configuration[21] & BIT(3)) {
67
/* Multicast all bit is set, receive all multicast frames. */
68
} else {
69
- unsigned mcast_idx = e100_compute_mcast_idx(buf);
70
+ unsigned mcast_idx = (net_crc32(buf, ETH_ALEN) & BITS(7, 2)) >> 2;
71
assert(mcast_idx < 64);
72
if (s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))) {
73
/* Multicast frame is allowed in hash table. */
74
--
75
2.7.4
76
77
diff view generated by jsdifflib
Deleted patch
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
1
3
Instead of sunhme_crc32_le() using its own implementation, we can simply call
4
net_crc32_le() directly and apply the bit shift inline.
5
6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7
Reviewed-by: Eric Blake <eblake@redhat.com>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
---
11
hw/net/sunhme.c | 25 +------------------------
12
1 file changed, 1 insertion(+), 24 deletions(-)
13
14
diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/net/sunhme.c
17
+++ b/hw/net/sunhme.c
18
@@ -XXX,XX +XXX,XX @@ static inline void sunhme_set_rx_ring_nr(SunHMEState *s, int i)
19
s->erxregs[HME_ERXI_RING >> 2] = ring;
20
}
21
22
-#define POLYNOMIAL_LE 0xedb88320
23
-static uint32_t sunhme_crc32_le(const uint8_t *p, int len)
24
-{
25
- uint32_t crc;
26
- int carry, i, j;
27
- uint8_t b;
28
-
29
- crc = 0xffffffff;
30
- for (i = 0; i < len; i++) {
31
- b = *p++;
32
- for (j = 0; j < 8; j++) {
33
- carry = (crc & 0x1) ^ (b & 0x01);
34
- crc >>= 1;
35
- b >>= 1;
36
- if (carry) {
37
- crc = crc ^ POLYNOMIAL_LE;
38
- }
39
- }
40
- }
41
-
42
- return crc;
43
-}
44
-
45
#define MIN_BUF_SIZE 60
46
47
static ssize_t sunhme_receive(NetClientState *nc, const uint8_t *buf,
48
@@ -XXX,XX +XXX,XX @@ static ssize_t sunhme_receive(NetClientState *nc, const uint8_t *buf,
49
trace_sunhme_rx_filter_bcast_match();
50
} else if (s->macregs[HME_MACI_RXCFG >> 2] & HME_MAC_RXCFG_HENABLE) {
51
/* Didn't match local address, check hash filter */
52
- int mcast_idx = sunhme_crc32_le(buf, 6) >> 26;
53
+ int mcast_idx = net_crc32_le(buf, ETH_ALEN) >> 26;
54
if (!(s->macregs[(HME_MACI_HASHTAB0 >> 2) - (mcast_idx >> 4)] &
55
(1 << (mcast_idx & 0xf)))) {
56
/* Didn't match hash filter */
57
--
58
2.7.4
59
60
diff view generated by jsdifflib
Deleted patch
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
1
3
From the Linux sungem driver, we know that the multicast filter CRC is
4
implemented using ether_crc_le() which isn't the same as calling zlib's
5
crc32() function (the zlib implementation requires a complemented initial value
6
and also returns the complemented result).
7
8
Fix the multicast filter by simply using the new net_crc32_le() function.
9
10
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Signed-off-by: Jason Wang <jasowang@redhat.com>
13
---
14
hw/net/sungem.c | 5 ++---
15
1 file changed, 2 insertions(+), 3 deletions(-)
16
17
diff --git a/hw/net/sungem.c b/hw/net/sungem.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/net/sungem.c
20
+++ b/hw/net/sungem.c
21
@@ -XXX,XX +XXX,XX @@
22
#include "hw/pci/pci.h"
23
#include "qemu/log.h"
24
#include "net/net.h"
25
+#include "net/eth.h"
26
#include "net/checksum.h"
27
#include "hw/net/mii.h"
28
#include "sysemu/sysemu.h"
29
#include "trace.h"
30
-/* For crc32 */
31
-#include <zlib.h>
32
33
#define TYPE_SUNGEM "sungem"
34
35
@@ -XXX,XX +XXX,XX @@ static ssize_t sungem_receive(NetClientState *nc, const uint8_t *buf,
36
}
37
38
/* Get MAC crc */
39
- mac_crc = crc32(~0, buf, 6);
40
+ mac_crc = net_crc32_le(buf, ETH_ALEN);
41
42
/* Packet isn't for me ? */
43
rx_cond = sungem_check_rx_mac(s, buf, mac_crc);
44
--
45
2.7.4
46
47
diff view generated by jsdifflib
Deleted patch
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
1
3
This makes it much easier to compare the multicast CRC calculation endian and
4
bitshift against the Linux driver implementation.
5
6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7
Signed-off-by: Jason Wang <jasowang@redhat.com>
8
---
9
hw/net/eepro100.c | 2 +-
10
1 file changed, 1 insertion(+), 1 deletion(-)
11
12
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/net/eepro100.c
15
+++ b/hw/net/eepro100.c
16
@@ -XXX,XX +XXX,XX @@ static ssize_t nic_receive(NetClientState *nc, const uint8_t * buf, size_t size)
17
rfd_status |= 0x0004;
18
} else if (s->configuration[20] & BIT(6)) {
19
/* Multiple IA bit set. */
20
- unsigned mcast_idx = compute_mcast_idx(buf);
21
+ unsigned mcast_idx = net_crc32(buf, ETH_ALEN) >> 26;
22
assert(mcast_idx < 64);
23
if (s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))) {
24
TRACE(RXTX, logout("%p accepted, multiple IA bit set\n", s));
25
--
26
2.7.4
27
28
diff view generated by jsdifflib
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
1
From: Yuri Benditovich <yuri.benditovich@daynix.com>
2
2
3
Now that all of the callers have been converted to compute the multicast index
3
https://bugzilla.redhat.com/show_bug.cgi?id=1829272
4
inline using new net CRC functions, this function can now be dropped.
4
When deleting queue pair, purge pending RX packets if any.
5
Example of problematic flow:
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)
5
14
6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
15
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
7
Signed-off-by: Jason Wang <jasowang@redhat.com>
16
Signed-off-by: Jason Wang <jasowang@redhat.com>
8
---
17
---
9
net/net.c | 5 -----
18
net/net.c | 12 ++++++++----
10
1 file changed, 5 deletions(-)
19
1 file changed, 8 insertions(+), 4 deletions(-)
11
20
12
diff --git a/net/net.c b/net/net.c
21
diff --git a/net/net.c b/net/net.c
13
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
14
--- a/net/net.c
23
--- a/net/net.c
15
+++ b/net/net.c
24
+++ b/net/net.c
16
@@ -XXX,XX +XXX,XX @@ uint32_t net_crc32_le(const uint8_t *p, int len)
25
@@ -XXX,XX +XXX,XX @@ void qemu_del_nic(NICState *nic)
17
return crc;
26
18
}
27
qemu_macaddr_set_free(&nic->conf->macaddr);
19
28
20
-unsigned compute_mcast_idx(const uint8_t *ep)
29
- /* If this is a peer NIC and peer has already been deleted, free it now. */
21
-{
30
- if (nic->peer_deleted) {
22
- return net_crc32(ep, ETH_ALEN) >> 26;
31
- for (i = 0; i < queues; i++) {
23
-}
32
- qemu_free_net_client(qemu_get_subqueue(nic, i)->peer);
24
-
33
+ for (i = 0; i < queues; i++) {
25
QemuOptsList qemu_netdev_opts = {
34
+ NetClientState *nc = qemu_get_subqueue(nic, i);
26
.name = "netdev",
35
+ /* If this is a peer NIC and peer has already been deleted, free it now. */
27
.implied_opt_name = "type",
36
+ if (nic->peer_deleted) {
37
+ qemu_free_net_client(nc->peer);
38
+ } else if (nc->peer) {
39
+ /* if there are RX packets pending, complete them */
40
+ qemu_purge_queued_packets(nc->peer);
41
}
42
}
43
28
--
44
--
29
2.7.4
45
2.7.4
30
46
31
47
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: yuanjungong <ruc_gongyuanjun@163.com>
2
2
3
The information how to update the deprecated parameters was too scarce,
3
Close fd before returning.
4
so that some people did not update to the new syntax yet. Provide some
5
more information to make sure that it is clear how to update from the
6
old syntax to the new one.
7
4
8
Signed-off-by: Thomas Huth <thuth@redhat.com>
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>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
---
10
---
11
qemu-doc.texi | 33 +++++++++++++++++++++------------
11
net/tap.c | 2 ++
12
1 file changed, 21 insertions(+), 12 deletions(-)
12
1 file changed, 2 insertions(+)
13
13
14
diff --git a/qemu-doc.texi b/qemu-doc.texi
14
diff --git a/net/tap.c b/net/tap.c
15
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
16
--- a/qemu-doc.texi
16
--- a/net/tap.c
17
+++ b/qemu-doc.texi
17
+++ b/net/tap.c
18
@@ -XXX,XX +XXX,XX @@ combined with ``-vnc tls-creds=tls0'
18
@@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name,
19
19
if (ret < 0) {
20
@subsection -tftp (since 2.6.0)
20
error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d",
21
21
name, fd);
22
-The ``-tftp /some/dir'' argument is now a synonym for setting
22
+ close(fd);
23
-the ``-netdev user,tftp=/some/dir' argument. The new syntax
23
return -1;
24
-allows different settings to be provided per NIC.
24
}
25
+The ``-tftp /some/dir'' argument is replaced by
25
26
+``-netdev user,id=x,tftp=/some/dir'', either accompanied with
26
@@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name,
27
+``-device ...,netdev=x'' (for pluggable NICs) or ``-net nic,netdev=x''
27
vhostfdname, vnet_hdr, fd, &err);
28
+(for embedded NICs). The new syntax allows different settings to be
28
if (err) {
29
+provided per NIC.
29
error_propagate(errp, err);
30
30
+ close(fd);
31
@subsection -bootp (since 2.6.0)
31
return -1;
32
32
}
33
-The ``-bootp /some/file'' argument is now a synonym for setting
33
} else if (tap->has_fds) {
34
-the ``-netdev user,bootp=/some/file' argument. The new syntax
35
-allows different settings to be provided per NIC.
36
+The ``-bootp /some/file'' argument is replaced by
37
+``-netdev user,id=x,bootp=/some/file'', either accompanied with
38
+``-device ...,netdev=x'' (for pluggable NICs) or ``-net nic,netdev=x''
39
+(for embedded NICs). The new syntax allows different settings to be
40
+provided per NIC.
41
42
@subsection -redir (since 2.6.0)
43
44
-The ``-redir ARGS'' argument is now a synonym for setting
45
-the ``-netdev user,hostfwd=ARGS'' argument instead. The new
46
-syntax allows different settings to be provided per NIC.
47
+The ``-redir [tcp|udp]:hostport:[guestaddr]:guestport'' argument is
48
+replaced by ``-netdev
49
+user,id=x,hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport'',
50
+either accompanied with ``-device ...,netdev=x'' (for pluggable NICs) or
51
+``-net nic,netdev=x'' (for embedded NICs). The new syntax allows different
52
+settings to be provided per NIC.
53
54
@subsection -smb (since 2.6.0)
55
56
-The ``-smb /some/dir'' argument is now a synonym for setting
57
-the ``-netdev user,smb=/some/dir'' argument instead. The new
58
-syntax allows different settings to be provided per NIC.
59
+The ``-smb /some/dir'' argument is replaced by
60
+``-netdev user,id=x,smb=/some/dir'', either accompanied with
61
+``-device ...,netdev=x'' (for pluggable NICs) or ``-net nic,netdev=x''
62
+(for embedded NICs). The new syntax allows different settings to be
63
+provided per NIC.
64
65
@subsection -net vlan (since 2.9.0)
66
67
--
34
--
68
2.7.4
35
2.7.4
69
36
70
37
diff view generated by jsdifflib
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
1
From: Keqian Zhu <zhukeqian1@huawei.com>
2
2
3
This makes it much easier to compare the multicast CRC calculation endian and
3
Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts)
4
bitshift against the Linux driver implementation.
4
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
5
6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7
Signed-off-by: Jason Wang <jasowang@redhat.com>
5
Signed-off-by: Jason Wang <jasowang@redhat.com>
8
---
6
---
9
hw/net/opencores_eth.c | 3 ++-
7
net/tap.c | 3 ++-
10
1 file changed, 2 insertions(+), 1 deletion(-)
8
1 file changed, 2 insertions(+), 1 deletion(-)
11
9
12
diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
10
diff --git a/net/tap.c b/net/tap.c
13
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/net/opencores_eth.c
12
--- a/net/tap.c
15
+++ b/hw/net/opencores_eth.c
13
+++ b/net/tap.c
16
@@ -XXX,XX +XXX,XX @@
14
@@ -XXX,XX +XXX,XX @@ free_fail:
17
#include "hw/net/mii.h"
15
script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
18
#include "hw/sysbus.h"
16
}
19
#include "net/net.h"
17
if (!downscript) {
20
+#include "net/eth.h"
18
- downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
21
#include "sysemu/sysemu.h"
19
+ downscript = default_downscript =
22
#include "trace.h"
20
+ get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT);
23
21
}
24
@@ -XXX,XX +XXX,XX @@ static ssize_t open_eth_receive(NetClientState *nc,
22
25
if (memcmp(buf, bcast_addr, sizeof(bcast_addr)) == 0) {
23
if (tap->has_ifname) {
26
miss = GET_REGBIT(s, MODER, BRO);
27
} else if ((buf[0] & 0x1) || GET_REGBIT(s, MODER, IAM)) {
28
- unsigned mcast_idx = compute_mcast_idx(buf);
29
+ unsigned mcast_idx = net_crc32(buf, ETH_ALEN) >> 26;
30
miss = !(s->regs[HASH0 + mcast_idx / 32] &
31
(1 << (mcast_idx % 32)));
32
trace_open_eth_receive_mcast(
33
--
24
--
34
2.7.4
25
2.7.4
35
26
36
27
diff view generated by jsdifflib
Deleted patch
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
1
3
This makes it much easier to compare the multicast CRC calculation endian and
4
bitshift against the Linux driver implementation.
5
6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7
Signed-off-by: Jason Wang <jasowang@redhat.com>
8
---
9
hw/net/lan9118.c | 3 ++-
10
1 file changed, 2 insertions(+), 1 deletion(-)
11
12
diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/net/lan9118.c
15
+++ b/hw/net/lan9118.c
16
@@ -XXX,XX +XXX,XX @@
17
#include "qemu/osdep.h"
18
#include "hw/sysbus.h"
19
#include "net/net.h"
20
+#include "net/eth.h"
21
#include "hw/devices.h"
22
#include "sysemu/sysemu.h"
23
#include "hw/ptimer.h"
24
@@ -XXX,XX +XXX,XX @@ static int lan9118_filter(lan9118_state *s, const uint8_t *addr)
25
}
26
} else {
27
/* Hash matching */
28
- hash = compute_mcast_idx(addr);
29
+ hash = net_crc32(addr, ETH_ALEN) >> 26;
30
if (hash & 0x20) {
31
return (s->mac_hashh >> (hash & 0x1f)) & 1;
32
} else {
33
--
34
2.7.4
35
36
diff view generated by jsdifflib
Deleted patch
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
1
3
This makes it much easier to compare the multicast CRC calculation endian and
4
bitshift against the Linux driver implementation.
5
6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7
Signed-off-by: Jason Wang <jasowang@redhat.com>
8
---
9
hw/net/ftgmac100.c | 2 +-
10
1 file changed, 1 insertion(+), 1 deletion(-)
11
12
diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/net/ftgmac100.c
15
+++ b/hw/net/ftgmac100.c
16
@@ -XXX,XX +XXX,XX @@ static int ftgmac100_filter(FTGMAC100State *s, const uint8_t *buf, size_t len)
17
}
18
19
/* TODO: this does not seem to work for ftgmac100 */
20
- mcast_idx = compute_mcast_idx(buf);
21
+ mcast_idx = net_crc32(buf, ETH_ALEN) >> 26;
22
if (!(s->math[mcast_idx / 32] & (1 << (mcast_idx % 32)))) {
23
return 0;
24
}
25
--
26
2.7.4
27
28
diff view generated by jsdifflib
Deleted patch
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
1
3
This makes it much easier to compare the multicast CRC calculation endian and
4
bitshift against the Linux driver implementation.
5
6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7
Signed-off-by: Jason Wang <jasowang@redhat.com>
8
---
9
hw/net/ne2000.c | 4 +++-
10
1 file changed, 3 insertions(+), 1 deletion(-)
11
12
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/net/ne2000.c
15
+++ b/hw/net/ne2000.c
16
@@ -XXX,XX +XXX,XX @@
17
*/
18
#include "qemu/osdep.h"
19
#include "hw/pci/pci.h"
20
+#include "net/net.h"
21
+#include "net/eth.h"
22
#include "ne2000.h"
23
#include "hw/loader.h"
24
#include "sysemu/sysemu.h"
25
@@ -XXX,XX +XXX,XX @@ ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
26
/* multicast */
27
if (!(s->rxcr & 0x08))
28
return size;
29
- mcast_idx = compute_mcast_idx(buf);
30
+ mcast_idx = net_crc32(buf, ETH_ALEN) >> 26;
31
if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))))
32
return size;
33
} else if (s->mem[0] == buf[0] &&
34
--
35
2.7.4
36
37
diff view generated by jsdifflib
Deleted patch
1
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
1
3
This makes it much easier to compare the multicast CRC calculation endian and
4
bitshift against the Linux driver implementation.
5
6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7
Signed-off-by: Jason Wang <jasowang@redhat.com>
8
---
9
hw/net/rtl8139.c | 2 +-
10
1 file changed, 1 insertion(+), 1 deletion(-)
11
12
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/net/rtl8139.c
15
+++ b/hw/net/rtl8139.c
16
@@ -XXX,XX +XXX,XX @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t
17
return size;
18
}
19
20
- int mcast_idx = compute_mcast_idx(buf);
21
+ int mcast_idx = net_crc32(buf, ETH_ALEN) >> 26;
22
23
if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))))
24
{
25
--
26
2.7.4
27
28
diff view generated by jsdifflib
Deleted patch
1
From: Thomas Huth <thuth@redhat.com>
2
1
3
It has never been documented, so hardly anybody knows about this
4
parameter, and it is marked as deprecated since QEMU v2.6.
5
Time to let it go now.
6
7
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8
Signed-off-by: Thomas Huth <thuth@redhat.com>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
---
11
include/net/slirp.h | 2 --
12
net/net.c | 7 -------
13
net/slirp.c | 34 ----------------------------------
14
qemu-doc.texi | 5 -----
15
4 files changed, 48 deletions(-)
16
17
diff --git a/include/net/slirp.h b/include/net/slirp.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/net/slirp.h
20
+++ b/include/net/slirp.h
21
@@ -XXX,XX +XXX,XX @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict);
22
23
int net_slirp_redir(const char *redir_str);
24
25
-int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, int *ret);
26
-
27
int net_slirp_smb(const char *exported_dir);
28
29
void hmp_info_usernet(Monitor *mon, const QDict *qdict);
30
diff --git a/net/net.c b/net/net.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/net/net.c
33
+++ b/net/net.c
34
@@ -XXX,XX +XXX,XX @@ int net_init_clients(void)
35
36
int net_client_parse(QemuOptsList *opts_list, const char *optarg)
37
{
38
-#if defined(CONFIG_SLIRP)
39
- int ret;
40
- if (net_slirp_parse_legacy(opts_list, optarg, &ret)) {
41
- return ret;
42
- }
43
-#endif
44
-
45
if (!qemu_opts_parse_noisily(opts_list, optarg, true)) {
46
return -1;
47
}
48
diff --git a/net/slirp.c b/net/slirp.c
49
index XXXXXXX..XXXXXXX 100644
50
--- a/net/slirp.c
51
+++ b/net/slirp.c
52
@@ -XXX,XX +XXX,XX @@ int net_init_slirp(const Netdev *netdev, const char *name,
53
54
return ret;
55
}
56
-
57
-int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, int *ret)
58
-{
59
- if (strcmp(opts_list->name, "net") != 0 ||
60
- strncmp(optarg, "channel,", strlen("channel,")) != 0) {
61
- return 0;
62
- }
63
-
64
- error_report("The '-net channel' option is deprecated. "
65
- "Please use '-netdev user,guestfwd=...' instead.");
66
-
67
- /* handle legacy -net channel,port:chr */
68
- optarg += strlen("channel,");
69
-
70
- if (QTAILQ_EMPTY(&slirp_stacks)) {
71
- struct slirp_config_str *config;
72
-
73
- config = g_malloc(sizeof(*config));
74
- pstrcpy(config->str, sizeof(config->str), optarg);
75
- config->flags = SLIRP_CFG_LEGACY;
76
- config->next = slirp_configs;
77
- slirp_configs = config;
78
- *ret = 0;
79
- } else {
80
- Error *err = NULL;
81
- *ret = slirp_guestfwd(QTAILQ_FIRST(&slirp_stacks), optarg, 1, &err);
82
- if (*ret < 0) {
83
- error_report_err(err);
84
- }
85
- }
86
-
87
- return 1;
88
-}
89
-
90
diff --git a/qemu-doc.texi b/qemu-doc.texi
91
index XXXXXXX..XXXXXXX 100644
92
--- a/qemu-doc.texi
93
+++ b/qemu-doc.texi
94
@@ -XXX,XX +XXX,XX @@ The ``-smb /some/dir'' argument is now a synonym for setting
95
the ``-netdev user,smb=/some/dir'' argument instead. The new
96
syntax allows different settings to be provided per NIC.
97
98
-@subsection -net channel (since 2.6.0)
99
-
100
-The ``--net channel,ARGS'' argument is now a synonym for setting
101
-the ``-netdev user,guestfwd=ARGS'' argument instead.
102
-
103
@subsection -net vlan (since 2.9.0)
104
105
The ``-net vlan=NN'' argument is partially replaced with the
106
--
107
2.7.4
108
109
diff view generated by jsdifflib
Deleted patch
1
From: Thomas Huth <thuth@redhat.com>
2
1
3
Looks like we missed to document that it is also possible to specify
4
a netdev with "-net nic" - which is very useful if you want to
5
configure your on-board NIC to use a backend that has been specified
6
with "-netdev".
7
8
Signed-off-by: Thomas Huth <thuth@redhat.com>
9
Signed-off-by: Jason Wang <jasowang@redhat.com>
10
---
11
qemu-options.hx | 14 ++++++++------
12
1 file changed, 8 insertions(+), 6 deletions(-)
13
14
diff --git a/qemu-options.hx b/qemu-options.hx
15
index XXXXXXX..XXXXXXX 100644
16
--- a/qemu-options.hx
17
+++ b/qemu-options.hx
18
@@ -XXX,XX +XXX,XX @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
19
"-netdev hubport,id=str,hubid=n\n"
20
" configure a hub port on QEMU VLAN 'n'\n", QEMU_ARCH_ALL)
21
DEF("net", HAS_ARG, QEMU_OPTION_net,
22
- "-net nic[,vlan=n][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
23
- " old way to create a new NIC and connect it to VLAN 'n'\n"
24
- " (use the '-device devtype,netdev=str' option if possible instead)\n"
25
+ "-net nic[,vlan=n][,netdev=nd][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
26
+ " configure or create an on-board (or machine default) NIC and\n"
27
+ " connect it either to VLAN 'n' or the netdev 'nd' (for pluggable\n"
28
+ " NICs please use '-device devtype,netdev=nd' instead)\n"
29
"-net dump[,vlan=n][,file=f][,len=n]\n"
30
" dump traffic on vlan 'n' to file 'f' (max n bytes per packet)\n"
31
"-net none use it alone to have zero network devices. If no -net option\n"
32
@@ -XXX,XX +XXX,XX @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
33
" old way to initialize a host network interface\n"
34
" (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL)
35
STEXI
36
-@item -net nic[,vlan=@var{n}][,macaddr=@var{mac}][,model=@var{type}] [,name=@var{name}][,addr=@var{addr}][,vectors=@var{v}]
37
+@item -net nic[,vlan=@var{n}][,netdev=@var{nd}][,macaddr=@var{mac}][,model=@var{type}] [,name=@var{name}][,addr=@var{addr}][,vectors=@var{v}]
38
@findex -net
39
-Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n}
40
-= 0 is the default). The NIC is an e1000 by default on the PC
41
+Configure or create an on-board (or machine default) Network Interface Card
42
+(NIC) and connect it either to VLAN @var{n} (@var{n} = 0 is the default), or
43
+to the netdev @var{nd}. The NIC is an e1000 by default on the PC
44
target. Optionally, the MAC address can be changed to @var{mac}, the
45
device address set to @var{addr} (PCI cards only),
46
and a @var{name} can be assigned for use in monitor commands.
47
--
48
2.7.4
49
50
diff view generated by jsdifflib