Skip to content

Commit

Permalink
qapi event: convert NIC_RX_FILTER_CHANGED
Browse files Browse the repository at this point in the history
Param name is declared as optional, since in code it is an optional
one.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
  • Loading branch information
Wenchao Xia authored and Luiz Capitulino committed Jun 23, 2014
1 parent bcada37 commit 0615027
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 27 deletions.
17 changes: 0 additions & 17 deletions docs/qmp/qmp-events.txt
Expand Up @@ -42,23 +42,6 @@ Example:
{ "event": "GUEST_PANICKED",
"data": { "action": "pause" } }

NIC_RX_FILTER_CHANGED
---------------------

The event is emitted once until the query command is executed,
the first event will always be emitted.

Data:

- "name": net client name (json-string)
- "path": device path (json-string)

{ "event": "NIC_RX_FILTER_CHANGED",
"data": { "name": "vnet0",
"path": "/machine/peripheral/vnet0/virtio-backend" },
"timestamp": { "seconds": 1368697518, "microseconds": 326866 } }
}

QUORUM_FAILURE
--------------

Expand Down
13 changes: 3 additions & 10 deletions hw/net/virtio-net.c
Expand Up @@ -22,7 +22,7 @@
#include "net/vhost_net.h"
#include "hw/virtio/virtio-bus.h"
#include "qapi/qmp/qjson.h"
#include "monitor/monitor.h"
#include "qapi-event.h"

#define VIRTIO_NET_VM_VERSION 11

Expand Down Expand Up @@ -199,19 +199,12 @@ static void virtio_net_set_link_status(NetClientState *nc)

static void rxfilter_notify(NetClientState *nc)
{
QObject *event_data;
VirtIONet *n = qemu_get_nic_opaque(nc);

if (nc->rxfilter_notify_enabled) {
gchar *path = object_get_canonical_path(OBJECT(n->qdev));
if (n->netclient_name) {
event_data = qobject_from_jsonf("{ 'name': %s, 'path': %s }",
n->netclient_name, path);
} else {
event_data = qobject_from_jsonf("{ 'path': %s }", path);
}
monitor_protocol_event(QEVENT_NIC_RX_FILTER_CHANGED, event_data);
qobject_decref(event_data);
qapi_event_send_nic_rx_filter_changed(!!n->netclient_name,
n->netclient_name, path, &error_abort);
g_free(path);

/* disable event notification to avoid events flooding */
Expand Down
15 changes: 15 additions & 0 deletions qapi-event.json
Expand Up @@ -122,3 +122,18 @@
##
{ 'event': 'DEVICE_DELETED',
'data': { '*device': 'str', 'path': 'str' } }

##
# @NIC_RX_FILTER_CHANGED
#
# Emitted once until the 'query-rx-filter' command is executed, the first event
# will always be emitted
#
# @name: #optional, net client name
#
# @path: device path
#
# Since: 1.6
##
{ 'event': 'NIC_RX_FILTER_CHANGED',
'data': { '*name': 'str', 'path': 'str' } }

0 comments on commit 0615027

Please sign in to comment.