-----BEGIN PGP SIGNATURE-----

Version: GnuPG v1
 
 iQEcBAABAgAGBQJauJjnAAoJEO8Ells5jWIRUZMH/1r/2Jrtjkq+5hBDFY5kV/VR
 /5XeORnq9c48cQ/zo4IffKWKWNaWNzvN+nTg9K+Wi1VzNpV179a04WdTixfMA/xB
 RCFlqarl+6ke5wGyHe07nO9uvxik26esf+y9/qP+W6u6vM1Yl6xLvxqtIa/MemEy
 o9UBLxiE0Uo7vuajR7WeKJkmTkL1VSal2GDXnDz0jr41ijXur/O0cpAJoytXs2qO
 t6eXbcPqlWP//hGDiXNFsjbGFWbY8A0eOpUnGrSXplZMctkaESBv1Ovc0TNposUf
 1GixNzf4LgspTzsi3kmsV4hRPZhTao5IKnwjT+Sp7/VE0ZRLxrT/dvlYGFNpYCI=
 =/WeC
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging

# gpg: Signature made Mon 26 Mar 2018 07:53:27 BST
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request:
  net/vde: print error on vde_open() failure
  virtio_net: flush uncompleted TX on reset

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-03-26 11:02:50 +01:00
commit 2ffd221d07
4 changed files with 16 additions and 4 deletions

View File

@ -427,6 +427,7 @@ static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc)
static void virtio_net_reset(VirtIODevice *vdev)
{
VirtIONet *n = VIRTIO_NET(vdev);
int i;
/* Reset back to compatibility mode */
n->promisc = 1;
@ -450,6 +451,16 @@ static void virtio_net_reset(VirtIODevice *vdev)
memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));
qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
memset(n->vlans, 0, MAX_VLAN >> 3);
/* Flush any async TX */
for (i = 0; i < n->max_queues; i++) {
NetClientState *nc = qemu_get_subqueue(n->nic, i);
if (nc->peer) {
qemu_flush_or_purge_queued_packets(nc->peer, true);
assert(!virtio_net_get_subqueue(nc)->async_tx.elem);
}
}
}
static void peer_test_vnet_hdr(VirtIONet *n)

View File

@ -153,6 +153,7 @@ ssize_t qemu_send_packet_async(NetClientState *nc, const uint8_t *buf,
int size, NetPacketSent *sent_cb);
void qemu_purge_queued_packets(NetClientState *nc);
void qemu_flush_queued_packets(NetClientState *nc);
void qemu_flush_or_purge_queued_packets(NetClientState *nc, bool purge);
void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6]);
bool qemu_has_ufo(NetClientState *nc);
bool qemu_has_vnet_hdr(NetClientState *nc);

View File

@ -595,7 +595,6 @@ void qemu_purge_queued_packets(NetClientState *nc)
qemu_net_queue_purge(nc->peer->incoming_queue, nc);
}
static
void qemu_flush_or_purge_queued_packets(NetClientState *nc, bool purge)
{
nc->receive_disabled = 0;

View File

@ -30,6 +30,7 @@
#include "qemu-common.h"
#include "qemu/option.h"
#include "qemu/main-loop.h"
#include "qapi/error.h"
typedef struct VDEState {
NetClientState nc;
@ -76,7 +77,7 @@ static NetClientInfo net_vde_info = {
static int net_vde_init(NetClientState *peer, const char *model,
const char *name, const char *sock,
int port, const char *group, int mode)
int port, const char *group, int mode, Error **errp)
{
NetClientState *nc;
VDEState *s;
@ -92,6 +93,7 @@ static int net_vde_init(NetClientState *peer, const char *model,
vde = vde_open(init_sock, (char *)"QEMU", &args);
if (!vde){
error_setg_errno(errp, errno, "Could not open vde");
return -1;
}
@ -112,7 +114,6 @@ static int net_vde_init(NetClientState *peer, const char *model,
int net_init_vde(const Netdev *netdev, const char *name,
NetClientState *peer, Error **errp)
{
/* FIXME error_setg(errp, ...) on failure */
const NetdevVdeOptions *vde;
assert(netdev->type == NET_CLIENT_DRIVER_VDE);
@ -120,7 +121,7 @@ int net_init_vde(const Netdev *netdev, const char *name,
/* missing optional values have been initialized to "all bits zero" */
if (net_vde_init(peer, "vde", name, vde->sock, vde->port, vde->group,
vde->has_mode ? vde->mode : 0700) == -1) {
vde->has_mode ? vde->mode : 0700, errp) == -1) {
return -1;
}