Net patches
Subsystems (2)
The following changes since commit d8e3b729cf452d2689c8669f1ec18158db29fd5a:
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2015-06-11 15:33:38 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.git tags/net-pull-request
for you to fetch changes up to fafa4d508b42a70a59a6bd647a2c0cfad86246c3:
qmp/hmp: add rocker device support (2015-06-12 13:42:17 +0100)
----------------------------------------------------------------
----------------------------------------------------------------
David Ahern (1):
rocker: Add support for phys name
Fam Zheng (12):
stubs: Add qemu_set_fd_handler
l2tpv3: Drop l2tpv3_can_send
netmap: Drop netmap_can_send
net/socket: Drop net_socket_can_send
tap: Drop tap_can_send
Change qemu_set_fd_handler2(..., NULL, ...) to qemu_set_fd_handler
main-loop: Drop qemu_set_fd_handler2
alsaaudio: Remove unused error handling of qemu_set_fd_handler
oss: Remove unused error handling of qemu_set_fd_handler
xen_backend: Remove unused error handling of qemu_set_fd_handler
event-notifier: Always return 0 for posix implementation
iohandler: Change return type of qemu_set_fd_handler to "void"
Scott Feldman (3):
rocker: update tests using hw-derived interface names
rocker: bring link up/down on PHY enable/disable qmp/hmp: add rocker device support
audio/alsaaudio.c | 16 +-- audio/ossaudio.c | 14 +- blockdev-nbd.c | 4 +- docs/specs/rocker.txt | 1 + hmp-commands.hx | 24 ++++ hmp.c | 303 ++++++++++++++++++++++++++++++++++++++++ hmp.h | 4 + hw/net/Makefile.objs | 1 + hw/net/rocker/qmp-norocker.c | 50 +++++++ hw/net/rocker/rocker.c | 68 ++++++++- hw/net/rocker/rocker_fp.c | 29 +++- hw/net/rocker/rocker_fp.h | 2 + hw/net/rocker/rocker_hw.h | 1 + hw/net/rocker/rocker_of_dpa.c | 312 ++++++++++++++++++++++++++++++++++++++++++ hw/xen/xen_backend.c | 4 +- include/block/aio.h | 2 +- include/qemu/main-loop.h | 57 +------- iohandler.c | 21 +-- main-loop.c | 3 +- migration/exec.c | 6 +- migration/fd.c | 4 +- migration/rdma.c | 7 +- migration/tcp.c | 6 +- migration/unix.c | 6 +- monitor.c | 28 ++++ net/l2tpv3.c | 17 +-- net/netmap.c | 20 +-- net/socket.c | 37 +++-- net/tap.c | 19 +-- qapi-schema.json | 3 + qapi/rocker.json | 286 ++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 103 ++++++++++++++ stubs/set-fd-handler.c | 3 +- tests/rocker/bridge | 25 ++-- tests/rocker/bridge-stp | 25 ++-- tests/rocker/bridge-vlan | 37 +++-- tests/rocker/bridge-vlan-stp | 37 +++-- tests/rocker/port | 8 +- ui/vnc-auth-sasl.c | 2 +- ui/vnc-auth-vencrypt.c | 2 +- ui/vnc-ws.c | 6 +- ui/vnc.c | 27 ++-- util/event_notifier-posix.c | 3 +- util/qemu-sockets.c | 8 +- 44 files changed, 1364 insertions(+), 277 deletions(-) create mode 100644 hw/net/rocker/qmp-norocker.c create mode 100644 qapi/rocker.json
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 01/16] stubs: Add qemu_set_fd_handler
From: Fam Zheng <[email protected]>
Some qemu_set_fd_handler2 stub callers will be converted to call qemu_set_fd_handler, add this stub for them before making the change.
Message-id: [email protected]
--- stubs/set-fd-handler.c | 8 ++++++++ 1 file changed, 8 insertions(+)
stubs/set-fd-handler.c +8 -0
@@ -1,6 +1,14 @@#include "qemu-common.h" #include "qemu/main-loop.h" +int qemu_set_fd_handler (int fd, +IOHandler *fd_read, +IOHandler *fd_write, +void *opaque) +{ +abort (); +} + int qemu_set_fd_handler2(int fd, IOCanReadHandler *fd_read_poll, IOHandler *fd_read,
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 02/16] l2tpv3: Drop l2tpv3_can_send
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
This callback is called by main loop before polling s->fd, if it returns false, the fd will not be polled in this iteration.
This is redundant with checks inside read callback. After this patch, the data will be copied from s->fd to s->msgvec when it arrives. If the device can't receive, it will be queued to incoming_queue, and when the device status changes, this queue will be flushed.
Message-id: [email protected]
--- net/l2tpv3.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
net/l2tpv3.c +1 -10
@@ -133,14 +133,12 @@ typedef struct NetL2TPV3State { } NetL2TPV3State; -static int l2tpv3_can_send (void *opaque);static void net_l2tpv3_send (void *opaque);static void l2tpv3_writable (void *opaque);static void l2tpv3_update_fd_handler (NetL2TPV3State *s) { -qemu_set_fd_handler2 (s->fd, - s->read_poll ? l2tpv3_can_send :NULL , +qemu_set_fd_handler2 (s->fd,NULL , s->read_poll ? net_l2tpv3_send :NULL , s->write_poll ? l2tpv3_writable :NULL , s);
@@ -169,13 +167,6 @@ static void l2tpv3_writable(void *opaque)qemu_flush_queued_packets (&s->nc); } -static int l2tpv3_can_send (void *opaque) -{ -NetL2TPV3State *s = opaque; - -return qemu_can_send_packet (&s->nc); -} -static void l2tpv3_send_completed (NetClientState *nc,ssize_t len) {NetL2TPV3State *s =DO_UPCAST (NetL2TPV3State, nc, nc);
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 03/16] netmap: Drop netmap_can_send
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
This callback is called by main loop before polling s->fd, if it returns false, the fd will not be polled in this iteration.
This is redundant with checks inside read callback. After this patch, the data will be copied from s->fd to s->iov when it arrives. If the device can't receive, it will be queued to incoming_queue, and when the device status changes, this queue will be flushed.
Also remove the qemu_can_send_packet() check in netmap_send. If it's true, we are good; if it's false, the qemu_sendv_packet_async would return 0 and read poll will be disabled until netmap_send_completed is called.
Message-id: [email protected]
--- net/netmap.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
net/netmap.c +2 -12
@@ -132,23 +132,13 @@ error:return -1 ; } -/* Tell the event-loop if the netmap backend can send packets -to the frontend. */ -static int netmap_can_send (void *opaque) -{ -NetmapState *s = opaque; - -return qemu_can_send_packet (&s->nc); -} -static void netmap_send (void *opaque);static void netmap_writable (void *opaque);/* Set the event-loop handlers for the netmap backend. */ static void netmap_update_fd_handler (NetmapState *s) { -qemu_set_fd_handler2 (s->me.fd, - s->read_poll ? netmap_can_send :NULL , +qemu_set_fd_handler2 (s->me.fd,NULL , s->read_poll ? netmap_send :NULL , s->write_poll ? netmap_writable :NULL , s);
@@ -317,7 +307,7 @@ static void netmap_send(void *opaque)/* Keep sending while there are available packets into the netmap RX ring and the forwarding path towards the peer is open. */ -while (!nm_ring_empty (ring) &&qemu_can_send_packet (&s->nc)) { +while (!nm_ring_empty (ring)) {uint32_t i;uint32_t idx;bool morefrag;
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 04/16] net/socket: Drop net_socket_can_send
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
This callback is called by main loop before polling s->fd, if it returns false, the fd will not be polled in this iteration.
This is redundant with checks inside read callback. After this patch, the data will be sent to peer when it arrives. If the device can't receive, it will be queued to incoming_queue, and when the device status changes, this queue will be flushed.
If the peer is not ready, disable the read poll until send completes.
Message-id: [email protected]
--- net/socket.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
net/socket.c +19 -12
@@ -51,18 +51,9 @@ typedef struct NetSocketState {static void net_socket_accept (void *opaque);static void net_socket_writable (void *opaque); -/* Only read packets from socket when peer can receive them */ -static int net_socket_can_send (void *opaque) -{ -NetSocketState *s = opaque; - -return qemu_can_send_packet (&s->nc); -} -static void net_socket_update_fd_handler (NetSocketState *s) { -qemu_set_fd_handler2 (s->fd, - s->read_poll ? net_socket_can_send :NULL , +qemu_set_fd_handler2 (s->fd,NULL , s->read_poll ? s->send_fn :NULL , s->write_poll ? net_socket_writable :NULL , s);
@@ -142,6 +133,15 @@ static ssize_t net_socket_receive_dgram(NetClientState *nc, const uint8_t *buf,return ret; } +static void net_socket_send_completed (NetClientState *nc,ssize_t len) +{ +NetSocketState *s =DO_UPCAST (NetSocketState, nc, nc); + +if (!s->read_poll) { +net_socket_read_poll (s, true); + } +} +static void net_socket_send (void *opaque) {NetSocketState *s = opaque;
@@ -211,9 +211,13 @@ static void net_socket_send(void *opaque) buf += l; size -= l;if (s->index >= s->packet_len) { -qemu_send_packet (&s->nc, s->buf, s->packet_len); s->index =0 ; s->state =0 ; +if (qemu_send_packet_async (&s->nc, s->buf, size, + net_socket_send_completed) ==0 ) { +net_socket_read_poll (s, false); +break ; + } }break ; }
@@ -234,7 +238,10 @@ static void net_socket_send_dgram(void *opaque)net_socket_write_poll (s, false);return ; } -qemu_send_packet (&s->nc, s->buf, size); +if (qemu_send_packet_async (&s->nc, s->buf, size, + net_socket_send_completed) ==0 ) { +net_socket_read_poll (s, false); + } }static int net_socket_mcast_create (struct sockaddr_in *mcastaddr,struct in_addr *localaddr)
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 05/16] tap: Drop tap_can_send
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
This callback is called by main loop before polling s->fd, if it returns false, the fd will not be polled in this iteration.
This is redundant with checks inside read callback. After this patch, the data will be sent to peer when it arrives. If the device can't receive, it will be queued to incoming_queue, and when the device status changes, this queue will be flushed.
Message-id: [email protected]
--- net/tap.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
net/tap.c +2 -11
@@ -62,14 +62,12 @@ typedef struct TAPState {static void launch_script (const char *setup_script,const char *ifname,int fd,Error **errp); -static int tap_can_send (void *opaque);static void tap_send (void *opaque);static void tap_writable (void *opaque);static void tap_update_fd_handler (TAPState *s) { -qemu_set_fd_handler2 (s->fd, - s->read_poll && s->enabled ? tap_can_send :NULL , +qemu_set_fd_handler2 (s->fd,NULL , s->read_poll && s->enabled ? tap_send :NULL , s->write_poll && s->enabled ? tap_writable :NULL , s);
@@ -166,13 +164,6 @@ static ssize_t tap_receive(NetClientState *nc, const uint8_t *buf, size_t size)return tap_write_packet (s, iov,1 ); } -static int tap_can_send (void *opaque) -{ -TAPState *s = opaque; - -return qemu_can_send_packet (&s->nc); -} -#ifndef __sun__ssize_t tap_read_packet (int tapfd,uint8_t *buf,int maxlen) {
@@ -192,7 +183,7 @@ static void tap_send(void *opaque)int size;int packets =0 ; -while (qemu_can_send_packet (&s->nc)) { +while (true) {uint8_t *buf = s->buf; size =tap_read_packet (s->fd, s->buf,sizeof (s->buf));
Signature · 1 line
2.4.2
Re: [Qemu-devel] [PULL 05/16] tap: Drop tap_can_send
Quoted 10 lines · Stefan Hajnoczi
From: Fam Zheng <[email protected]>
This callback is called by main loop before polling
s->fd, if it returns false, the fd will not be polled in this iteration.This is redundant with checks inside read callback. After this patch, the data will be sent to peer when it arrives. If the device can't receive, it will be queued to
incoming_queue, and when the device status changes, this queue will be flushed.
Quoted 6 lines
Signed-off-by Fam Zheng <[email protected]>Message-id: [email protected]
Signed-off-by Stefan Hajnoczi <[email protected]>--- net/tap.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
I just gave a try to QEMU 2.4.0-rc0 with an s390x target, and it seems this patch breaks virtio-net with a tap device (it works well with the user mode network stack). The guest correctly sends out packets, but it seems to not get incoming packets.
This is with TCG, I don't know if KVM is also affected.
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
[Qemu-devel] [PULL 06/16] Change qemu_set_fd_handler2(..., NULL, ...) to qemu_set_fd_handler
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
Done with following Coccinelle semantic patch, plus manual cosmetic changes in net/*.c.
@@
expression E1, E2, E3, E4;
@@
- qemu_set_fd_handler2(E1, NULL, E2, E3, E4);
+ qemu_set_fd_handler(E1, E2, E3, E4);Message-id: [email protected]
--- blockdev-nbd.c | 4 ++-- main-loop.c | 3 +-- migration/exec.c | 6 +++--- migration/fd.c | 4 ++-- migration/rdma.c | 7 +++---- migration/tcp.c | 6 +++--- migration/unix.c | 6 +++--- net/l2tpv3.c | 8 ++++---- net/netmap.c | 8 ++++---- net/socket.c | 8 ++++---- net/tap.c | 8 ++++---- ui/vnc-auth-sasl.c | 2 +- ui/vnc-auth-vencrypt.c | 2 +- ui/vnc-ws.c | 6 +++--- ui/vnc.c | 27 ++++++++++++--------------- util/qemu-sockets.c | 8 +++----- 16 files changed, 53 insertions(+), 60 deletions(-)
blockdev-nbd.c +2 -2
@@ -43,7 +43,7 @@ void qmp_nbd_server_start(SocketAddress *addr, Error **errp) server_fd =socket_listen (addr, errp);if (server_fd !=-1 ) { -qemu_set_fd_handler2 (server_fd,NULL , nbd_accept,NULL ,NULL ); +qemu_set_fd_handler (server_fd, nbd_accept,NULL ,NULL ); } }
@@ -129,7 +129,7 @@ void qmp_nbd_server_stop(Error **errp) }if (server_fd !=-1 ) { -qemu_set_fd_handler2 (server_fd,NULL ,NULL ,NULL ,NULL ); +qemu_set_fd_handler (server_fd,NULL ,NULL ,NULL );close (server_fd); server_fd =-1 ; }
main-loop.c +1 -2
@@ -100,8 +100,7 @@ static int qemu_signal_init(void)fcntl_setfl (sigfd,O_NONBLOCK ); -qemu_set_fd_handler2 (sigfd,NULL , sigfd_handler,NULL , - (void *)(intptr_t )sigfd); +qemu_set_fd_handler (sigfd, sigfd_handler,NULL , (void *)(intptr_t )sigfd);return 0 ; }
migration/exec.c +3 -3
@@ -49,7 +49,7 @@ static void exec_accept_incoming_migration(void *opaque) {QEMUFile *f = opaque; -qemu_set_fd_handler2 (qemu_get_fd (f),NULL ,NULL ,NULL ,NULL ); +qemu_set_fd_handler (qemu_get_fd (f),NULL ,NULL ,NULL );process_incoming_migration (f); }
@@ -64,6 +64,6 @@ void exec_start_incoming_migration(const char *command, Error **errp)return ; } -qemu_set_fd_handler2 (qemu_get_fd (f),NULL , - exec_accept_incoming_migration,NULL , f); +qemu_set_fd_handler (qemu_get_fd (f), exec_accept_incoming_migration,NULL , + f); }
migration/fd.c +2 -2
@@ -62,7 +62,7 @@ static void fd_accept_incoming_migration(void *opaque) {QEMUFile *f = opaque; -qemu_set_fd_handler2 (qemu_get_fd (f),NULL ,NULL ,NULL ,NULL ); +qemu_set_fd_handler (qemu_get_fd (f),NULL ,NULL ,NULL );process_incoming_migration (f); }
@@ -84,5 +84,5 @@ void fd_start_incoming_migration(const char *infd, Error **errp)return ; } -qemu_set_fd_handler2 (fd,NULL , fd_accept_incoming_migration,NULL , f); +qemu_set_fd_handler (fd, fd_accept_incoming_migration,NULL , f); }
migration/rdma.c +3 -4
@@ -2834,7 +2834,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) } } -qemu_set_fd_handler2 (rdma->channel->fd,NULL ,NULL ,NULL ,NULL ); +qemu_set_fd_handler (rdma->channel->fd,NULL ,NULL ,NULL ); ret =rdma_accept (rdma->cm_id, &conn_param);if (ret) {
@@ -3331,9 +3331,8 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)trace_rdma_start_incoming_migration_after_rdma_listen (); -qemu_set_fd_handler2 (rdma->channel->fd,NULL , - rdma_accept_incoming_migration,NULL , - (void *)(intptr_t ) rdma); +qemu_set_fd_handler (rdma->channel->fd, rdma_accept_incoming_migration, +NULL , (void *)(intptr_t )rdma);return ; err:error_propagate (errp, local_err);
migration/tcp.c +3 -3
@@ -65,7 +65,7 @@ static void tcp_accept_incoming_migration(void *opaque) c =qemu_accept (s, (struct sockaddr *)&addr, &addrlen); err =socket_error (); }while (c <0 && err ==EINTR ); -qemu_set_fd_handler2 (s,NULL ,NULL ,NULL ,NULL ); +qemu_set_fd_handler (s,NULL ,NULL ,NULL );closesocket (s);DPRINTF ("accepted migration\n" );
@@ -98,6 +98,6 @@ void tcp_start_incoming_migration(const char *host_port, Error **errp)return ; } -qemu_set_fd_handler2 (s,NULL , tcp_accept_incoming_migration,NULL , - (void *)(intptr_t )s); +qemu_set_fd_handler (s, tcp_accept_incoming_migration,NULL , + (void *)(intptr_t )s); }
migration/unix.c +3 -3
@@ -65,7 +65,7 @@ static void unix_accept_incoming_migration(void *opaque) c =qemu_accept (s, (struct sockaddr *)&addr, &addrlen); err = errno; }while (c <0 && err ==EINTR ); -qemu_set_fd_handler2 (s,NULL ,NULL ,NULL ,NULL ); +qemu_set_fd_handler (s,NULL ,NULL ,NULL );close (s);DPRINTF ("accepted migration\n" );
@@ -98,6 +98,6 @@ void unix_start_incoming_migration(const char *path, Error **errp)return ; } -qemu_set_fd_handler2 (s,NULL , unix_accept_incoming_migration,NULL , - (void *)(intptr_t )s); +qemu_set_fd_handler (s, unix_accept_incoming_migration,NULL , + (void *)(intptr_t )s); }
net/l2tpv3.c +4 -4
@@ -138,10 +138,10 @@ static void l2tpv3_writable(void *opaque);static void l2tpv3_update_fd_handler (NetL2TPV3State *s) { -qemu_set_fd_handler2 (s->fd,NULL , - s->read_poll ? net_l2tpv3_send :NULL , - s->write_poll ? l2tpv3_writable :NULL , - s); +qemu_set_fd_handler (s->fd, + s->read_poll ? net_l2tpv3_send :NULL , + s->write_poll ? l2tpv3_writable :NULL , + s); }static void l2tpv3_read_poll (NetL2TPV3State *s,bool enable)
net/netmap.c +4 -4
@@ -138,10 +138,10 @@ static void netmap_writable(void *opaque);/* Set the event-loop handlers for the netmap backend. */ static void netmap_update_fd_handler (NetmapState *s) { -qemu_set_fd_handler2 (s->me.fd,NULL , - s->read_poll ? netmap_send :NULL , - s->write_poll ? netmap_writable :NULL , - s); +qemu_set_fd_handler (s->me.fd, + s->read_poll ? netmap_send :NULL , + s->write_poll ? netmap_writable :NULL , + s); }/* Update the read handler. */
net/socket.c +4 -4
@@ -53,10 +53,10 @@ static void net_socket_writable(void *opaque);static void net_socket_update_fd_handler (NetSocketState *s) { -qemu_set_fd_handler2 (s->fd,NULL , - s->read_poll ? s->send_fn :NULL , - s->write_poll ? net_socket_writable :NULL , - s); +qemu_set_fd_handler (s->fd, + s->read_poll ? s->send_fn :NULL , + s->write_poll ? net_socket_writable :NULL , + s); }static void net_socket_read_poll (NetSocketState *s,bool enable)
net/tap.c +4 -4
@@ -67,10 +67,10 @@ static void tap_writable(void *opaque);static void tap_update_fd_handler (TAPState *s) { -qemu_set_fd_handler2 (s->fd,NULL , - s->read_poll && s->enabled ? tap_send :NULL , - s->write_poll && s->enabled ? tap_writable :NULL , - s); +qemu_set_fd_handler (s->fd, + s->read_poll && s->enabled ? tap_send :NULL , + s->write_poll && s->enabled ? tap_writable :NULL , + s); }static void tap_read_poll (TAPState *s,bool enable)
ui/vnc-auth-sasl.c +1 -1
@@ -86,7 +86,7 @@ long vnc_client_write_sasl(VncState *vs)* SASL encoded output */ if (vs->output.offset ==0 ) { -qemu_set_fd_handler2 (vs->csock,NULL , vnc_client_read,NULL , vs); +qemu_set_fd_handler (vs->csock, vnc_client_read,NULL , vs); }return ret;
ui/vnc-auth-vencrypt.c +1 -1
@@ -94,7 +94,7 @@ static int vnc_start_vencrypt_handshake(VncState *vs) }VNC_DEBUG ("Handshake done, switching to TLS data mode\n" ); -qemu_set_fd_handler2 (vs->csock,NULL , vnc_client_read, vnc_client_write, vs); +qemu_set_fd_handler (vs->csock, vnc_client_read, vnc_client_write, vs);start_auth_vencrypt_subauth (vs);
ui/vnc-ws.c +3 -3
@@ -56,7 +56,7 @@ static int vncws_start_tls_handshake(VncState *vs) }VNC_DEBUG ("Handshake done, switching to TLS data mode\n" ); -qemu_set_fd_handler2 (vs->csock,NULL , vncws_handshake_read,NULL , vs); +qemu_set_fd_handler (vs->csock, vncws_handshake_read,NULL , vs);return 0 ; }
@@ -98,7 +98,7 @@ void vncws_handshake_read(void *opaque) handshake_end = (uint8_t *)g_strstr_len ((char *)vs->ws_input.buffer, vs->ws_input.offset,WS_HANDSHAKE_END );if (handshake_end) { -qemu_set_fd_handler2 (vs->csock,NULL , vnc_client_read,NULL , vs); +qemu_set_fd_handler (vs->csock, vnc_client_read,NULL , vs);vncws_process_handshake (vs, vs->ws_input.buffer, vs->ws_input.offset);buffer_advance (&vs->ws_input, handshake_end - vs->ws_input.buffer +strlen (WS_HANDSHAKE_END ));
@@ -176,7 +176,7 @@ long vnc_client_write_ws(VncState *vs)buffer_advance (&vs->ws_output, ret);if (vs->ws_output.offset ==0 ) { -qemu_set_fd_handler2 (vs->csock,NULL , vnc_client_read,NULL , vs); +qemu_set_fd_handler (vs->csock, vnc_client_read,NULL , vs); }return ret;
ui/vnc.c +12 -15
@@ -1213,7 +1213,7 @@ static void vnc_disconnect_start(VncState *vs)if (vs->csock ==-1 )return ;vnc_set_share_mode (vs,VNC_SHARE_MODE_DISCONNECTED ); -qemu_set_fd_handler2 (vs->csock,NULL ,NULL ,NULL ,NULL ); +qemu_set_fd_handler (vs->csock,NULL ,NULL ,NULL );closesocket (vs->csock); vs->csock =-1 ; }
@@ -1387,7 +1387,7 @@ static long vnc_client_write_plain(VncState *vs)buffer_advance (&vs->output, ret);if (vs->output.offset ==0 ) { -qemu_set_fd_handler2 (vs->csock,NULL , vnc_client_read,NULL , vs); +qemu_set_fd_handler (vs->csock, vnc_client_read,NULL , vs); }return ret;
@@ -1434,7 +1434,7 @@ void vnc_client_write(void *opaque) ) {vnc_client_write_locked (opaque); } else if (vs->csock != -1) { -qemu_set_fd_handler2 (vs->csock,NULL , vnc_client_read,NULL , vs); +qemu_set_fd_handler (vs->csock, vnc_client_read,NULL , vs); }vnc_unlock_output (vs); }
@@ -1581,7 +1581,7 @@ void vnc_write(VncState *vs, const void *data, size_t len)buffer_reserve (&vs->output, len);if (vs->csock !=-1 &&buffer_empty (&vs->output)) { -qemu_set_fd_handler2 (vs->csock,NULL , vnc_client_read, vnc_client_write, vs); +qemu_set_fd_handler (vs->csock, vnc_client_read, vnc_client_write, vs); }buffer_append (&vs->output, data, len);
@@ -3022,18 +3022,16 @@ static void vnc_connect(VncDisplay *vd, int csock, vs->websocket =1 ;#ifdef CONFIG_VNC_TLS if (vd->ws_tls) { -qemu_set_fd_handler2 (vs->csock,NULL , vncws_tls_handshake_io, -NULL , vs); +qemu_set_fd_handler (vs->csock, vncws_tls_handshake_io,NULL , vs); } else#endif /* CONFIG_VNC_TLS */ { -qemu_set_fd_handler2 (vs->csock,NULL , vncws_handshake_read, -NULL , vs); +qemu_set_fd_handler (vs->csock, vncws_handshake_read,NULL , vs); } } else#endif /* CONFIG_VNC_WS */ { -qemu_set_fd_handler2 (vs->csock,NULL , vnc_client_read,NULL , vs); +qemu_set_fd_handler (vs->csock, vnc_client_read,NULL , vs); }vnc_client_cache_addr (vs);
@@ -3182,14 +3180,14 @@ static void vnc_display_close(VncDisplay *vs) vs->enabled = false; vs->is_unix = false;if (vs->lsock !=-1 ) { -qemu_set_fd_handler2 (vs->lsock,NULL ,NULL ,NULL ,NULL ); +qemu_set_fd_handler (vs->lsock,NULL ,NULL ,NULL );close (vs->lsock); vs->lsock =-1 ; }#ifdef CONFIG_VNC_WS vs->ws_enabled = false;if (vs->lwebsock !=-1 ) { -qemu_set_fd_handler2 (vs->lwebsock,NULL ,NULL ,NULL ,NULL ); +qemu_set_fd_handler (vs->lwebsock,NULL ,NULL ,NULL );close (vs->lwebsock); vs->lwebsock =-1 ; }
@@ -3707,12 +3705,11 @@ void vnc_display_open(const char *id, Error **errp)#endif /* CONFIG_VNC_WS */ } vs->enabled = true; -qemu_set_fd_handler2 (vs->lsock,NULL , - vnc_listen_regular_read,NULL , vs); +qemu_set_fd_handler (vs->lsock, vnc_listen_regular_read,NULL , vs);#ifdef CONFIG_VNC_WS if (vs->ws_enabled) { -qemu_set_fd_handler2 (vs->lwebsock,NULL , - vnc_listen_websocket_read,NULL , vs); +qemu_set_fd_handler (vs->lwebsock, vnc_listen_websocket_read, +NULL , vs); }#endif /* CONFIG_VNC_WS */ }
util/qemu-sockets.c +3 -5
@@ -244,7 +244,7 @@ static void wait_for_connect(void *opaque)bool in_progress;Error *err =NULL ; -qemu_set_fd_handler2 (s->fd,NULL ,NULL ,NULL ,NULL ); +qemu_set_fd_handler (s->fd,NULL ,NULL ,NULL ); do { rc = qemu_getsockopt(s->fd, SOL_SOCKET, SO_ERROR, &val, &valsize);
@@ -316,8 +316,7 @@ static int inet_connect_addr(struct addrinfo *addr, bool *in_progress,if (connect_state !=NULL &&QEMU_SOCKET_RC_INPROGRESS (rc)) { connect_state->fd = sock; -qemu_set_fd_handler2 (sock,NULL ,NULL , wait_for_connect, - connect_state); +qemu_set_fd_handler (sock,NULL , wait_for_connect, connect_state); *in_progress = true; }else if (rc <0 ) {error_setg_errno (errp, errno,"Failed to connect socket" );
@@ -796,8 +795,7 @@ int unix_connect_opts(QemuOpts *opts, Error **errp,if (connect_state !=NULL &&QEMU_SOCKET_RC_INPROGRESS (rc)) { connect_state->fd = sock; -qemu_set_fd_handler2 (sock,NULL ,NULL , wait_for_connect, - connect_state); +qemu_set_fd_handler (sock,NULL , wait_for_connect, connect_state);return sock; }else if (rc >=0 ) {/* non blocking socket immediate success, call callback */
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 07/16] main-loop: Drop qemu_set_fd_handler2
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
All users are converted to qemu_set_fd_handler now, drop qemu_set_fd_handler2 and IOHandlerRecord.fd_read_poll.
Message-id: [email protected]
--- include/block/aio.h | 2 +- include/qemu/main-loop.h | 49 +----------------------------------------------- iohandler.c | 26 +++++-------------------- stubs/set-fd-handler.c | 9 --------- 4 files changed, 7 insertions(+), 79 deletions(-)
include/block/aio.h +1 -1
@@ -241,7 +241,7 @@ bool aio_dispatch(AioContext *ctx);bool aio_poll (AioContext *ctx,bool blocking);/* Register a file descriptor and associated callbacks. Behaves very similarly -* to qemu_set_fd_handler2. Unlike qemu_set_fd_handler2, these callbacks will +* to qemu_set_fd_handler. Unlike qemu_set_fd_handler, these callbacks will * be invoked when using aio_poll(). * * Code that invokes AIO completion functions should rely on this function
include/qemu/main-loop.h +1 -48
61 lines not on this page · raw message
iohandler.c +5 -21
@@ -33,7 +33,6 @@#endif typedef struct IOHandlerRecord { - IOCanReadHandler *fd_read_poll; IOHandler *fd_read; IOHandler *fd_write; void *opaque;
@@ -46,14 +45,10 @@ typedef struct IOHandlerRecord { static QLIST_HEAD(, IOHandlerRecord) io_handlers =QLIST_HEAD_INITIALIZER (io_handlers); - -/* XXX: fd_read_poll should be suppressed, but an API change is -necessary in the character devices to suppress fd_can_read(). */ -int qemu_set_fd_handler2 (int fd, -IOCanReadHandler *fd_read_poll, -IOHandler *fd_read, -IOHandler *fd_write, -void *opaque) +int qemu_set_fd_handler (int fd, +IOHandler *fd_read, +IOHandler *fd_write, +void *opaque) {IOHandlerRecord *ioh;
@@ -75,7 +70,6 @@ int qemu_set_fd_handler2(int fd,QLIST_INSERT_HEAD (&io_handlers, ioh, next); found: ioh->fd = fd; - ioh->fd_read_poll = fd_read_poll; ioh->fd_read = fd_read; ioh->fd_write = fd_write; ioh->opaque = opaque;
@@ -86,14 +80,6 @@ int qemu_set_fd_handler2(int fd,return 0 ; } -int qemu_set_fd_handler (int fd, -IOHandler *fd_read, -IOHandler *fd_write, -void *opaque) -{ -return qemu_set_fd_handler2 (fd,NULL , fd_read, fd_write, opaque); -} -void qemu_iohandler_fill (GArray *pollfds) {IOHandlerRecord *ioh;
@@ -103,9 +89,7 @@ void qemu_iohandler_fill(GArray *pollfds)if (ioh->deleted)continue ; -if (ioh->fd_read && - (!ioh->fd_read_poll || - ioh->fd_read_poll (ioh->opaque) !=0 )) { +if (ioh->fd_read) { events |=G_IO_IN |G_IO_HUP |G_IO_ERR ; }if (ioh->fd_write) {
stubs/set-fd-handler.c +0 -9
@@ -8,12 +8,3 @@ int qemu_set_fd_handler(int fd, {abort (); } - -int qemu_set_fd_handler2 (int fd, -IOCanReadHandler *fd_read_poll, -IOHandler *fd_read, -IOHandler *fd_write, -void *opaque) -{ -abort (); -}
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 08/16] alsaaudio: Remove unused error handling of qemu_set_fd_handler
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
The function cannot fail, so the check is superfluous.
Message-id: [email protected]
--- audio/alsaaudio.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-)
audio/alsaaudio.c +2 -14
@@ -266,31 +266,19 @@ static int alsa_poll_helper (snd_pcm_t *handle, struct pollhlp *hlp, int mask)for (i =0 ; i < count; ++i) {if (pfds[i].events &POLLIN ) { - err =qemu_set_fd_handler (pfds[i].fd, alsa_poll_handler, -NULL , hlp); +qemu_set_fd_handler (pfds[i].fd, alsa_poll_handler,NULL , hlp); }if (pfds[i].events &POLLOUT ) {if (conf.verbose) {dolog ("POLLOUT %d %d\n" , i, pfds[i].fd); } - err =qemu_set_fd_handler (pfds[i].fd,NULL , - alsa_poll_handler, hlp); +qemu_set_fd_handler (pfds[i].fd,NULL , alsa_poll_handler, hlp); }if (conf.verbose) {dolog ("Set handler events=%#x index=%d fd=%d err=%d\n" , pfds[i].events, i, pfds[i].fd, err); } -if (err) { -dolog ("Failed to set handler events=%#x index=%d fd=%d err=%d\n" , - pfds[i].events, i, pfds[i].fd, err); - -while (i--) { -qemu_set_fd_handler (pfds[i].fd,NULL ,NULL ,NULL ); - } -g_free (pfds); -return -1 ; - } } hlp->pfds = pfds; hlp->count = count;
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 09/16] oss: Remove unused error handling of qemu_set_fd_handler
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
The function cannot fail, so the check is superfluous.
Message-id: [email protected]
--- audio/ossaudio.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
audio/ossaudio.c +8 -6
@@ -138,18 +138,18 @@ static void oss_helper_poll_in (void *opaque)audio_run ("oss_poll_in" ); } -static int oss_poll_out (HWVoiceOut *hw) +static void oss_poll_out (HWVoiceOut *hw) {OSSVoiceOut *oss = (OSSVoiceOut *) hw; -return qemu_set_fd_handler (oss->fd,NULL , oss_helper_poll_out,NULL ); +qemu_set_fd_handler (oss->fd,NULL , oss_helper_poll_out,NULL ); } -static int oss_poll_in (HWVoiceIn *hw) +static void oss_poll_in (HWVoiceIn *hw) {OSSVoiceIn *oss = (OSSVoiceIn *) hw; -return qemu_set_fd_handler (oss->fd, oss_helper_poll_in,NULL ,NULL ); +qemu_set_fd_handler (oss->fd, oss_helper_poll_in,NULL ,NULL ); }static int oss_write (SWVoiceOut *sw,void *buf,int len)
@@ -634,7 +634,8 @@ static int oss_ctl_out (HWVoiceOut *hw, int cmd, ...)va_end (ap);ldebug ("enabling voice\n" ); -if (poll_mode &&oss_poll_out (hw)) { +if (poll_mode) { +oss_poll_out (hw); poll_mode =0 ; } hw->poll_mode = poll_mode;
@@ -828,7 +829,8 @@ static int oss_ctl_in (HWVoiceIn *hw, int cmd, ...) poll_mode =va_arg (ap, int);va_end (ap); -if (poll_mode &&oss_poll_in (hw)) { +if (poll_mode) { +oss_poll_in (hw); poll_mode =0 ; } hw->poll_mode = poll_mode;
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 10/16] xen_backend: Remove unused error handling of qemu_set_fd_handler
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
The function cannot fail, so the check is superfluous.
Message-id: [email protected]
--- hw/xen/xen_backend.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/xen/xen_backend.c +1 -3
@@ -714,9 +714,7 @@ int xen_be_init(void)return -1 ; } -if (qemu_set_fd_handler (xs_fileno (xenstore), xenstore_update,NULL ,NULL ) <0 ) { - goto err; - } +qemu_set_fd_handler (xs_fileno (xenstore), xenstore_update,NULL ,NULL );if (xen_xc ==XC_HANDLER_INITIAL_VALUE ) {/* Check if xen_init() have been called */
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 11/16] event-notifier: Always return 0 for posix implementation
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
qemu_set_fd_handler cannot fail, let's always return 0.
Message-id: [email protected]
--- util/event_notifier-posix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
util/event_notifier-posix.c +2 -1
@@ -85,7 +85,8 @@ int event_notifier_get_fd(EventNotifier *e)int event_notifier_set_handler (EventNotifier *e,EventNotifierHandler *handler) { -return qemu_set_fd_handler (e->rfd, (IOHandler *)handler,NULL , e); +qemu_set_fd_handler (e->rfd, (IOHandler *)handler,NULL , e); +return 0 ; }int event_notifier_set (EventNotifier *e)
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 12/16] iohandler: Change return type of qemu_set_fd_handler to "void"
In reply to Stefan HajnocziFrom: Fam Zheng <[email protected]>
Message-id: [email protected]
--- include/qemu/main-loop.h | 8 ++++---- iohandler.c | 9 ++++----- stubs/set-fd-handler.c | 8 ++++---- 3 files changed, 12 insertions(+), 13 deletions(-)
include/qemu/main-loop.h +4 -4
@@ -198,10 +198,10 @@ typedef int IOCanReadHandler(void *opaque);* * @opaque: A pointer-sized value that is passed to @fd_read and @fd_write. */ -int qemu_set_fd_handler (int fd, -IOHandler *fd_read, -IOHandler *fd_write, -void *opaque); +void qemu_set_fd_handler (int fd, +IOHandler *fd_read, +IOHandler *fd_write, +void *opaque);#ifdef CONFIG_POSIX /**
iohandler.c +4 -5
@@ -45,10 +45,10 @@ typedef struct IOHandlerRecord { static QLIST_HEAD(, IOHandlerRecord) io_handlers =QLIST_HEAD_INITIALIZER (io_handlers); -int qemu_set_fd_handler (int fd, -IOHandler *fd_read, -IOHandler *fd_write, -void *opaque) +void qemu_set_fd_handler (int fd, +IOHandler *fd_read, +IOHandler *fd_write, +void *opaque) {IOHandlerRecord *ioh;
@@ -77,7 +77,6 @@ int qemu_set_fd_handler(int fd, ioh->deleted =0 ;qemu_notify_event (); } -return 0 ; }void qemu_iohandler_fill (GArray *pollfds)
stubs/set-fd-handler.c +4 -4
@@ -1,10 +1,10 @@#include "qemu-common.h" #include "qemu/main-loop.h" -int qemu_set_fd_handler (int fd, -IOHandler *fd_read, -IOHandler *fd_write, -void *opaque) +void qemu_set_fd_handler (int fd, +IOHandler *fd_read, +IOHandler *fd_write, +void *opaque) {abort (); }
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 13/16] rocker: Add support for phys name
In reply to Stefan HajnocziFrom: David Ahern <[email protected]>
Add ROCKER_TLV_CMD_PORT_SETTINGS_PHYS_NAME to port settings. This attribute exports the port name to the guest OS allowing it to name interfaces with sensible defaults.
Mostly done by Scott for phys_id support; adapted to phys_name by David.
Message-id: [email protected]
--- docs/specs/rocker.txt | 1 + hw/net/rocker/rocker.c | 23 ++++++++++++++++++++++- hw/net/rocker/rocker_fp.c | 7 ++++++- hw/net/rocker/rocker_fp.h | 1 + hw/net/rocker/rocker_hw.h | 1 + 5 files changed, 31 insertions(+), 2 deletions(-)
docs/specs/rocker.txt +1 -0
@@ -420,6 +420,7 @@ Other properties for front-panel ports are available via DMA CMD descriptors: LEARNING 1 MAC address learning on port 1 = enabled 0 = disabled + PHYS_NAME <var> Physical port name (string) Set PORT_SETTINGS descriptor:
hw/net/rocker/rocker.c +22 -1
@@ -238,6 +238,7 @@ static int cmd_get_port_settings(Rocker *r,uint8_t duplex;uint8_t autoneg;uint8_t learning; +char *phys_name;MACAddr macaddr;enum rocker_world_type mode;size_t tlv_size;
@@ -265,6 +266,7 @@ static int cmd_get_port_settings(Rocker *r,fp_port_get_macaddr (fp_port, &macaddr); mode =world_type (fp_port_get_world (fp_port)); learning =fp_port_get_learning (fp_port); + phys_name =fp_port_get_name (fp_port); tlv_size =rocker_tlv_total_size (0 ) +/* nest */ rocker_tlv_total_size(sizeof(uint32_t)) + /* pport */
@@ -273,7 +275,8 @@ static int cmd_get_port_settings(Rocker *r,rocker_tlv_total_size (sizeof (uint8_t )) +/* autoneg */ rocker_tlv_total_size (sizeof (macaddr.a)) +/* macaddr */ rocker_tlv_total_size (sizeof (uint8_t )) +/* mode */ -rocker_tlv_total_size (sizeof (uint8_t ));/* learning */ +rocker_tlv_total_size (sizeof (uint8_t )) +/* learning */ +rocker_tlv_total_size (strlen (phys_name));if (tlv_size >desc_buf_size (info)) {return -ROCKER_EMSGSIZE ;
@@ -290,6 +293,8 @@ static int cmd_get_port_settings(Rocker *r,rocker_tlv_put_u8 (buf, &pos,ROCKER_TLV_CMD_PORT_SETTINGS_MODE , mode);rocker_tlv_put_u8 (buf, &pos,ROCKER_TLV_CMD_PORT_SETTINGS_LEARNING , learning); +rocker_tlv_put (buf, &pos,ROCKER_TLV_CMD_PORT_SETTINGS_PHYS_NAME , +strlen (phys_name), phys_name);rocker_tlv_nest_end (buf, &pos, nest);return desc_set_buf (info, tlv_size);
@@ -1277,6 +1282,22 @@ static int pci_rocker_init(PCIDevice *dev) goto err_duplicate; } +/* Rocker name is passed in port name requests to OS with the intention +* that the name is used in interface names. Limit the length of the +* rocker name to avoid naming problems in the OS. Also, adding the +* port number as p# and unganged breakout b#, where # is at most 2 +* digits, so leave room for it too (-1 for string terminator, -3 for +* p# and -3 for b#) +*/ +#define ROCKER_IFNAMSIZ 16 +#define MAX_ROCKER_NAME_LEN (ROCKER_IFNAMSIZ - 1 - 3 - 3) +if (strlen (r->name) >MAX_ROCKER_NAME_LEN ) { +fprintf (stderr, +"rocker: name too long; please shorten to at most %d chars\n" , +MAX_ROCKER_NAME_LEN ); +return -EINVAL ; + } +if (memcmp (&r->fp_start_macaddr, &zero,sizeof (zero)) ==0 ) {memcpy (&r->fp_start_macaddr, &dflt,sizeof (dflt)); r->fp_start_macaddr.a[4 ] += (sw_index++);
hw/net/rocker/rocker_fp.c +6 -1
@@ -41,6 +41,11 @@ struct fp_port {NICConf conf; }; +char *fp_port_get_name (FpPort *port) +{ +return port->name; +} +bool fp_port_get_link_up (FpPort *port) {return !qemu_get_queue (port->nic)->link_down;
@@ -201,7 +206,7 @@ FpPort *fp_port_alloc(Rocker *r, char *sw_name,/* front-panel switch port names are 1-based */ - port->name =g_strdup_printf ("%s.%d" , sw_name, port->pport); + port->name =g_strdup_printf ("%sp%d" , sw_name, port->pport);memcpy (port->conf.macaddr.a, start_mac,sizeof (port->conf.macaddr.a)); port->conf.macaddr.a[5 ] += index;
hw/net/rocker/rocker_fp.h +1 -0
@@ -26,6 +26,7 @@ typedef struct fp_port FpPort;int fp_port_eg (FpPort *port,const struct iovec *iov,int iovcnt); +char *fp_port_get_name (FpPort *port);bool fp_port_get_link_up (FpPort *port);void fp_port_get_macaddr (FpPort *port,MACAddr *macaddr);void fp_port_set_macaddr (FpPort *port,MACAddr *macaddr);
hw/net/rocker/rocker_hw.h +1 -0
@@ -179,6 +179,7 @@ enum {ROCKER_TLV_CMD_PORT_SETTINGS_MACADDR ,/* binary */ ROCKER_TLV_CMD_PORT_SETTINGS_MODE ,/* u8 */ ROCKER_TLV_CMD_PORT_SETTINGS_LEARNING ,/* u8 */ +ROCKER_TLV_CMD_PORT_SETTINGS_PHYS_NAME ,/* binary */ __ROCKER_TLV_CMD_PORT_SETTINGS_MAX, ROCKER_TLV_CMD_PORT_SETTINGS_MAX = __ROCKER_TLV_CMD_PORT_SETTINGS_MAX - 1,
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 14/16] rocker: update tests using hw-derived interface names
In reply to Stefan HajnocziFrom: Scott Feldman <[email protected]>
With previous patch to support phy name attribute for each port, the OS can name port interfaces using the hw-derived name. So update rocker tests to use the new hw-derived interface names.
Message-id: [email protected]
--- tests/rocker/bridge | 25 ++++++++++--------------- tests/rocker/bridge-stp | 25 ++++++++++--------------- tests/rocker/bridge-vlan | 37 ++++++++++++++++--------------------- tests/rocker/bridge-vlan-stp | 37 ++++++++++++++++--------------------- tests/rocker/port | 8 ++++---- 5 files changed, 56 insertions(+), 76 deletions(-)
tests/rocker/bridge +10 -15
@@ -9,8 +9,8 @@ while ! simp ssh tut h2 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done # configure a 2-port bridge simp ssh tut sw1 --cmd "sudo /sbin/ip link add name br0 type bridge" -simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp1 master br0" -simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp2 master br0" +simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p1 master br0" +simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p2 master br0" # turn off vlan default_pvid on br0
@@ -18,28 +18,23 @@ simp ssh tut sw1 --cmd "echo 0 | sudo dd of=/sys/class/net/br0/bridge/default_pv # turn off learning and flooding in SW -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 learning off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 learning off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 flood off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 flood off" - -# turn on learning in HW - -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning on self" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning on self" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 flood off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 flood off" # bring up bridge and ports simp ssh tut sw1 --cmd "sudo ifconfig br0 up" -simp ssh tut sw1 --cmd "sudo ifconfig swp1 up" -simp ssh tut sw1 --cmd "sudo ifconfig swp2 up" +simp ssh tut sw1 --cmd "sudo ifconfig sw1p1 up" +simp ssh tut sw1 --cmd "sudo ifconfig sw1p2 up" simp ssh tut sw1 --cmd "sudo ifconfig br0 11.0.0.3/24" # config IP on hosts -simp ssh tut h1 --cmd "sudo ifconfig swp1 11.0.0.1/24" -simp ssh tut h2 --cmd "sudo ifconfig swp1 11.0.0.2/24" +simp ssh tut h1 --cmd "sudo ifconfig sw1p1 11.0.0.1/24" +simp ssh tut h2 --cmd "sudo ifconfig sw1p1 11.0.0.2/24" # test...
tests/rocker/bridge-stp +10 -15
@@ -10,8 +10,8 @@ while ! simp ssh tut h2 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done simp ssh tut sw1 --cmd "sudo /sbin/ip link add name br0 type bridge" simp ssh tut sw1 --cmd "sudo brctl stp br0 on" -simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp1 master br0" -simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp2 master br0" +simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p1 master br0" +simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p2 master br0" # turn off vlan default_pvid on br0
@@ -19,27 +19,22 @@ simp ssh tut sw1 --cmd "echo 0 | sudo dd of=/sys/class/net/br0/bridge/default_pv # turn off learning and flooding in SW -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 learning off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 learning off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 flood off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 flood off" - -# turn on learning in HW - -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning on self" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning on self" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 flood off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 flood off" # config IP on hosts -simp ssh tut h1 --cmd "sudo ifconfig swp1 11.0.0.1/24" -simp ssh tut h2 --cmd "sudo ifconfig swp1 11.0.0.2/24" +simp ssh tut h1 --cmd "sudo ifconfig sw1p1 11.0.0.1/24" +simp ssh tut h2 --cmd "sudo ifconfig sw1p1 11.0.0.2/24" # bring up bridge and ports simp ssh tut sw1 --cmd "sudo ifconfig br0 up" -simp ssh tut sw1 --cmd "sudo ifconfig swp1 up" -simp ssh tut sw1 --cmd "sudo ifconfig swp2 up" +simp ssh tut sw1 --cmd "sudo ifconfig sw1p1 up" +simp ssh tut sw1 --cmd "sudo ifconfig sw1p2 up" # test...
tests/rocker/bridge-vlan +16 -21
@@ -9,8 +9,8 @@ while ! simp ssh tut h2 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done # configure a 2-port bridge simp ssh tut sw1 --cmd "sudo /sbin/ip link add name br0 type bridge" -simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp1 master br0" -simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp2 master br0" +simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p1 master br0" +simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p2 master br0" # turn off vlan default_pvid on br0 # turn on vlan filtering on br0
@@ -20,37 +20,32 @@ simp ssh tut sw1 --cmd "echo 1 | sudo dd of=/sys/class/net/br0/bridge/vlan_filte # add both ports to VLAN 57 -simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev swp1 master" -simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev swp2 master" +simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p1 master self" +simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p2 master self" # turn off learning and flooding in SW -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 learning off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 learning off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 flood off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 flood off" - -# turn on learning in HW - -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning on self" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning on self" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 flood off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 flood off" # bring up bridge and ports simp ssh tut sw1 --cmd "sudo ifconfig br0 up" -simp ssh tut sw1 --cmd "sudo ifconfig swp1 up" -simp ssh tut sw1 --cmd "sudo ifconfig swp2 up" +simp ssh tut sw1 --cmd "sudo ifconfig sw1p1 up" +simp ssh tut sw1 --cmd "sudo ifconfig sw1p2 up" # config IP on host VLANs -simp ssh tut h1 --cmd "sudo vconfig add swp1 57 >/dev/null 2>&1" -simp ssh tut h1 --cmd "sudo ifconfig swp1 up" -simp ssh tut h1 --cmd "sudo ifconfig swp1.57 11.0.0.1/24" +simp ssh tut h1 --cmd "sudo vconfig add sw1p1 57 >/dev/null 2>&1" +simp ssh tut h1 --cmd "sudo ifconfig sw1p1 up" +simp ssh tut h1 --cmd "sudo ifconfig sw1p1.57 11.0.0.1/24" -simp ssh tut h2 --cmd "sudo vconfig add swp1 57 >/dev/null 2>&1" -simp ssh tut h2 --cmd "sudo ifconfig swp1 up" -simp ssh tut h2 --cmd "sudo ifconfig swp1.57 11.0.0.2/24" +simp ssh tut h2 --cmd "sudo vconfig add sw1p1 57 >/dev/null 2>&1" +simp ssh tut h2 --cmd "sudo ifconfig sw1p1 up" +simp ssh tut h2 --cmd "sudo ifconfig sw1p1.57 11.0.0.2/24" # test...
tests/rocker/bridge-vlan-stp +16 -21
@@ -10,8 +10,8 @@ while ! simp ssh tut h2 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done simp ssh tut sw1 --cmd "sudo /sbin/ip link add name br0 type bridge" simp ssh tut sw1 --cmd "sudo brctl stp br0 on" -simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp1 master br0" -simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp2 master br0" +simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p1 master br0" +simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p2 master br0" # turn off vlan default_pvid on br0 # turn on vlan filtering on br0
@@ -21,37 +21,32 @@ simp ssh tut sw1 --cmd "echo 1 | sudo dd of=/sys/class/net/br0/bridge/vlan_filte # add both ports to VLAN 57 -simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev swp1 master" -simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev swp2 master" +simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p1 master self" +simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev sw1p2 master self" # turn off learning and flooding in SW -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 learning off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 learning off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 flood off" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 flood off" - -# turn on learning in HW - -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning on self" -simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning on self" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 flood off" +simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 flood off" # config IP on host VLANs -simp ssh tut h1 --cmd "sudo vconfig add swp1 57 >/dev/null 2>&1" -simp ssh tut h1 --cmd "sudo ifconfig swp1 up" -simp ssh tut h1 --cmd "sudo ifconfig swp1.57 11.0.0.1/24" +simp ssh tut h1 --cmd "sudo vconfig add sw1p1 57 >/dev/null 2>&1" +simp ssh tut h1 --cmd "sudo ifconfig sw1p1 up" +simp ssh tut h1 --cmd "sudo ifconfig sw1p1.57 11.0.0.1/24" -simp ssh tut h2 --cmd "sudo vconfig add swp1 57 >/dev/null 2>&1" -simp ssh tut h2 --cmd "sudo ifconfig swp1 up" -simp ssh tut h2 --cmd "sudo ifconfig swp1.57 11.0.0.2/24" +simp ssh tut h2 --cmd "sudo vconfig add sw1p1 57 >/dev/null 2>&1" +simp ssh tut h2 --cmd "sudo ifconfig sw1p1 up" +simp ssh tut h2 --cmd "sudo ifconfig sw1p1.57 11.0.0.2/24" # bring up bridge and ports simp ssh tut sw1 --cmd "sudo ifconfig br0 up" -simp ssh tut sw1 --cmd "sudo ifconfig swp1 up" -simp ssh tut sw1 --cmd "sudo ifconfig swp2 up" +simp ssh tut sw1 --cmd "sudo ifconfig sw1p1 up" +simp ssh tut sw1 --cmd "sudo ifconfig sw1p2 up" # test...
tests/rocker/port +4 -4
@@ -7,13 +7,13 @@ while ! simp ssh tut h2 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done # bring up DUT ports -simp ssh tut sw1 --cmd "sudo ifconfig swp1 11.0.0.1/24" -simp ssh tut sw1 --cmd "sudo ifconfig swp2 12.0.0.1/24" +simp ssh tut sw1 --cmd "sudo ifconfig sw1p1 11.0.0.1/24" +simp ssh tut sw1 --cmd "sudo ifconfig sw1p2 12.0.0.1/24" # config IP on hosts -simp ssh tut h1 --cmd "sudo ifconfig swp1 11.0.0.2/24" -simp ssh tut h2 --cmd "sudo ifconfig swp1 12.0.0.2/24" +simp ssh tut h1 --cmd "sudo ifconfig sw1p1 11.0.0.2/24" +simp ssh tut h2 --cmd "sudo ifconfig sw1p1 12.0.0.2/24" # test...
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 15/16] rocker: bring link up/down on PHY enable/disable
In reply to Stefan HajnocziFrom: Scott Feldman <[email protected]>
When the OS driver enables/disables the port, go ahead and set the port's link status to up/down in response to the change. This more closely emulates real hardware when the PHY for the port is brought up/down and the PHY negotiates carrier (link status) with link partner. In the case of qemu, the virtual rocker device can't really do link negotiation with the link partner as that requires signally over a physical medium (the wire), so just pretend the negotiation was successful and bring the link up when the port is enabled.
Message-id: [email protected]
--- hw/net/rocker/rocker_fp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
hw/net/rocker/rocker_fp.c +12 -0
@@ -178,8 +178,19 @@ bool fp_port_enabled(FpPort *port)return port->enabled; } +static void fp_port_set_link (FpPort *port,bool up) +{ +NetClientState *nc =qemu_get_queue (port->nic); + +if (up == nc->link_down) { + nc->link_down = !up; + nc->info->link_status_changed (nc); + } +} +void fp_port_enable (FpPort *port) { +fp_port_set_link (port, true); port->enabled = true;DPRINTF ("port %d enabled\n" , port->index); }
@@ -187,6 +198,7 @@ void fp_port_enable(FpPort *port)void fp_port_disable (FpPort *port) { port->enabled = false; +fp_port_set_link (port, false);DPRINTF ("port %d disabled\n" , port->index); }
Signature · 1 line
2.4.2
[Qemu-devel] [PULL 16/16] qmp/hmp: add rocker device support
In reply to Stefan HajnocziFrom: Scott Feldman <[email protected]>
Add QMP/HMP support for rocker devices. This is mostly for debugging purposes to see inside the device's tables and port configurations. Some examples:
(qemu) info rocker sw1
name: sw1
id: 0x0000013512005452
ports: 4
(qemu) info rocker-ports sw1
ena/ speed/ auto
port link duplex neg?
sw1.1 up 10G FD No
sw1.2 up 10G FD No
sw1.3 !ena 10G FD No
sw1.4 !ena 10G FD No
(qemu) info rocker-of-dpa-flows sw1
prio tbl hits key(mask) --> actions
2 60 pport 1 vlan 1 LLDP src 00:02:00:00:02:00 dst 01:80:c2:00:00:0e 2 60 pport 1 vlan 1 ARP src 00:02:00:00:02:00 dst 00:02:00:00:03:00 2 60 pport 2 vlan 2 IPv6 src 00:02:00:00:03:00 dst 33:33:ff:00:00:02 proto 58 3 50 vlan 2 dst 33:33:ff:00:00:02 --> write group 0x32000001 goto tbl 60 2 60 pport 2 vlan 2 IPv6 src 00:02:00:00:03:00 dst 33:33:ff:00:03:00 proto 58 3 50 1 vlan 2 dst 33:33:ff:00:03:00 --> write group 0x32000001 goto tbl 60 2 60 pport 2 vlan 2 ARP src 00:02:00:00:03:00 dst 00:02:00:00:02:00 3 50 2 vlan 2 dst 00:02:00:00:02:00 --> write group 0x02000001 goto tbl 60 2 60 1 pport 2 vlan 2 IP src 00:02:00:00:03:00 dst 00:02:00:00:02:00 proto 1 3 50 2 vlan 1 dst 00:02:00:00:03:00 --> write group 0x01000002 goto tbl 60 2 60 1 pport 1 vlan 1 IP src 00:02:00:00:02:00 dst 00:02:00:00:03:00 proto 1 2 60 pport 1 vlan 1 IPv6 src 00:02:00:00:02:00 dst 33:33:ff:00:00:01 proto 58 3 50 vlan 1 dst 33:33:ff:00:00:01 --> write group 0x31000000 goto tbl 60 2 60 pport 1 vlan 1 IPv6 src 00:02:00:00:02:00 dst 33:33:ff:00:02:00 proto 58 3 50 1 vlan 1 dst 33:33:ff:00:02:00 --> write group 0x31000000 goto tbl 60 1 60 173 pport 2 vlan 2 LLDP src <any> dst 01:80:c2:00:00:0e --> write group 0x02000000 1 60 6 pport 2 vlan 2 IPv6 src <any> dst <any> --> write group 0x02000000 1 60 174 pport 1 vlan 1 LLDP src <any> dst 01:80:c2:00:00:0e --> write group 0x01000000 1 60 174 pport 2 vlan 2 IP src <any> dst <any> --> write group 0x02000000 1 60 6 pport 1 vlan 1 IPv6 src <any> dst <any> --> write group 0x01000000 1 60 181 pport 2 vlan 2 ARP src <any> dst <any> --> write group 0x02000000 1 10 715 pport 2 --> apply new vlan 2 goto tbl 20 1 60 177 pport 1 vlan 1 ARP src <any> dst <any> --> write group 0x01000000 1 60 174 pport 1 vlan 1 IP src <any> dst <any> --> write group 0x01000000 1 10 717 pport 1 --> apply new vlan 1 goto tbl 20 1 0 1432 pport 0(0xffff) --> goto tbl 10
(qemu) info rocker-of-dpa-groups sw1
id (decode) --> buckets0x32000001 (type L2 multicast vlan 2 index 1) --> groups [0x02000001,0x02000000] 0x02000001 (type L2 interface vlan 2 pport 1) --> pop vlan out pport 1 0x01000002 (type L2 interface vlan 1 pport 2) --> pop vlan out pport 2 0x02000000 (type L2 interface vlan 2 pport 0) --> pop vlan out pport 0 0x01000000 (type L2 interface vlan 1 pport 0) --> pop vlan out pport 0 0x31000000 (type L2 multicast vlan 1 index 0) --> groups [0x01000002,0x01000000]
[Added "query-" prefixes to rocker.json commands as suggested by Eric Blake <[email protected]>.
--Stefan]
Message-id: [email protected]
--- hmp-commands.hx | 24 ++++ hmp.c | 303 ++++++++++++++++++++++++++++++++++++++++ hmp.h | 4 + hw/net/Makefile.objs | 1 + hw/net/rocker/qmp-norocker.c | 50 +++++++ hw/net/rocker/rocker.c | 45 ++++++ hw/net/rocker/rocker_fp.c | 10 ++ hw/net/rocker/rocker_fp.h | 1 + hw/net/rocker/rocker_of_dpa.c | 312 ++++++++++++++++++++++++++++++++++++++++++ monitor.c | 28 ++++ qapi-schema.json | 3 + qapi/rocker.json | 286 ++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 103 ++++++++++++++ 13 files changed, 1170 insertions(+) create mode 100644 hw/net/rocker/qmp-norocker.c create mode 100644 qapi/rocker.json
hmp-commands.hx +24 -0
@@ -1799,5 +1799,29 @@ show available trace events and their state ETEXI STEXI +@item rocker @var{name} +@findex rocker +Show Rocker(s) +ETEXI + +STEXI +@item rocker_ports @var{name} +@findex rocker_ports +Show Rocker ports +ETEXI + +STEXI +@item rocker_of_dpa_flows @var{name} [@var{tbl_id}] +@findex rocker_of_dpa_flows +Show Rocker OF-DPA flow tables +ETEXI + +STEXI +@item rocker_of_dpa_groups @var{name} [@var{type}] +@findex rocker_of_dpa_groups +Show Rocker OF-DPA groups +ETEXI + +STEXI @end table ETEXI
hmp.c +303 -0
312 lines not on this page · raw message
hmp.h +4 -0
@@ -124,5 +124,9 @@ void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str);void delvm_completion (ReadLineState *rs,int nb_args,const char *str);void loadvm_completion (ReadLineState *rs,int nb_args,const char *str); +void hmp_rocker (Monitor *mon,const QDict *qdict); +void hmp_rocker_ports (Monitor *mon,const QDict *qdict); +void hmp_rocker_of_dpa_flows (Monitor *mon,const QDict *qdict); +void hmp_rocker_of_dpa_groups (Monitor *mon,const QDict *qdict);#endif
hw/net/Makefile.objs +1 -0
@@ -39,3 +39,4 @@ obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \ common-obj-$(CONFIG_ROCKER) += rocker/rocker.o rocker/rocker_fp.o \ rocker/rocker_desc.o rocker/rocker_world.o \ rocker/rocker_of_dpa.o +obj-$(call lnot,$(CONFIG_ROCKER)) += rocker/qmp-norocker.o
hw/net/rocker/qmp-norocker.c new file +50 -0
50 lines not on this page · raw message
hw/net/rocker/rocker.c +45 -0
51 lines not on this page · raw message
hw/net/rocker/rocker_fp.c +10 -0
@@ -51,6 +51,16 @@ bool fp_port_get_link_up(FpPort *port)return !qemu_get_queue (port->nic)->link_down; } +void fp_port_get_info (FpPort *port,RockerPortList *info) +{ + info->value->name =g_strdup (port->name); + info->value->enabled = port->enabled; + info->value->link_up =fp_port_get_link_up (port); + info->value->speed = port->speed; + info->value->duplex = port->duplex; + info->value->autoneg = port->autoneg; +} +void fp_port_get_macaddr (FpPort *port,MACAddr *macaddr) {memcpy (macaddr->a, port->conf.macaddr.a,sizeof (macaddr->a));
hw/net/rocker/rocker_fp.h +1 -0
@@ -28,6 +28,7 @@ int fp_port_eg(FpPort *port, const struct iovec *iov, int iovcnt);char *fp_port_get_name (FpPort *port);bool fp_port_get_link_up (FpPort *port); +void fp_port_get_info (FpPort *port,RockerPortList *info);void fp_port_get_macaddr (FpPort *port,MACAddr *macaddr);void fp_port_set_macaddr (FpPort *port,MACAddr *macaddr);uint8_t fp_port_get_learning (FpPort *port);
hw/net/rocker/rocker_of_dpa.c +312 -0
318 lines not on this page · raw message
monitor.c +28 -0
@@ -2863,6 +2863,34 @@ static mon_cmd_t info_cmds[] = { .mhandler.cmd = hmp_info_memory_devices, }, { + .name = "rocker", + .args_type = "name:s", + .params = "name", + .help = "Show rocker switch", + .mhandler.cmd = hmp_rocker, + }, + { + .name = "rocker-ports", + .args_type = "name:s", + .params = "name", + .help = "Show rocker ports", + .mhandler.cmd = hmp_rocker_ports, + }, + { + .name = "rocker-of-dpa-flows", + .args_type = "name:s,tbl_id:i?", + .params = "name [tbl_id]", + .help = "Show rocker OF-DPA flow tables", + .mhandler.cmd = hmp_rocker_of_dpa_flows, + }, + { + .name = "rocker-of-dpa-groups", + .args_type = "name:s,type:i?", + .params = "name [type]", + .help = "Show rocker OF-DPA groups", + .mhandler.cmd = hmp_rocker_of_dpa_groups, + }, + { .name = NULL, }, };
qapi-schema.json +3 -0
@@ -3788,3 +3788,6 @@ # Since: 2.1 ## { 'command': 'rtc-reset-reinjection' } + +# Rocker ethernet network switch +{ 'include': 'qapi/rocker.json' }
qapi/rocker.json new file +286 -0
286 lines not on this page · raw message
qmp-commands.hx +103 -0
106 lines not on this page · raw message
Signature · 1 line
2.4.2
Re: [Qemu-devel] [PULL 16/16] qmp/hmp: add rocker device support
hw/net/rocker/rocker.c World *rocker_get_world(Rocker *r, enum rocker_world_type type) · line 106
Quoted 8 lines · Stefan Hajnoczi
hw/net/rocker/rocker.c +8
-0+RockerSwitch *rocker =g_malloc0 (sizeof (*rocker)); +Rocker *r; + + r =rocker_find (name); +if (!r) { +error_set (errp,ERROR_CLASS_GENERIC_ERROR , +"rocker %s not found" , name); +return NULL ;
Memory leak, please initialize rocker after the "if".
Paolo
Quoted 3 lines
hw/net/rocker/rocker.c +3
-0+ } + + rocker->name =g_strdup (r->name);
Peter Maydell
AppliedQuoted 8 lines · Stefan Hajnoczi
The following changes since commit
d8e3b729cf452d2689c8669f1ec18158db29fd5a:Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2015-06-11 15:33:38 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.gittags/net-pull-request
Quoted 7 lines
for you to fetch changes up to
fafa4d508b42a70a59a6bd647a2c0cfad86246c3:qmp/hmp: add rocker device support (2015-06-12 13:42:17 +0100)
----------------------------------------------------------------
----------------------------------------------------------------
Applied, thanks.
-- PMM