* [Qemu-devel] [PATCH 1/4] monitor: print hub port name during info network
@ 2015-02-02 7:06 Jason Wang
2015-02-02 7:06 ` [Qemu-devel] [PATCH 2/4] net: remove the wrong comment in net_init_hubport() Jason Wang
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Jason Wang @ 2015-02-02 7:06 UTC (permalink / raw)
To: aliguori, stefanha, qemu-devel; +Cc: Jason Wang
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
net/hub.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/hub.c b/net/hub.c
index 7e0f2d6..ef09d5f 100644
--- a/net/hub.c
+++ b/net/hub.c
@@ -245,9 +245,12 @@ void net_hub_info(Monitor *mon)
QLIST_FOREACH(hub, &hubs, next) {
monitor_printf(mon, "hub %d\n", hub->id);
QLIST_FOREACH(port, &hub->ports, next) {
+ monitor_printf(mon, " \\ %s", port->nc.name);
if (port->nc.peer) {
- monitor_printf(mon, " \\ ");
+ monitor_printf(mon, ": ");
print_net_client(mon, port->nc.peer);
+ } else {
+ monitor_printf(mon, "\n");
}
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 2/4] net: remove the wrong comment in net_init_hubport()
2015-02-02 7:06 [Qemu-devel] [PATCH 1/4] monitor: print hub port name during info network Jason Wang
@ 2015-02-02 7:06 ` Jason Wang
2015-02-02 7:06 ` [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted Jason Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Jason Wang @ 2015-02-02 7:06 UTC (permalink / raw)
To: aliguori, stefanha, qemu-devel; +Cc: Jason Wang
Not only nic could be the one to peer.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
net/hub.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/hub.c b/net/hub.c
index ef09d5f..2b60ab9 100644
--- a/net/hub.c
+++ b/net/hub.c
@@ -288,7 +288,6 @@ int net_init_hubport(const NetClientOptions *opts, const char *name,
assert(opts->kind == NET_CLIENT_OPTIONS_KIND_HUBPORT);
hubport = opts->hubport;
- /* Treat hub port like a backend, NIC must be the one to peer */
if (peer) {
return -EINVAL;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted
2015-02-02 7:06 [Qemu-devel] [PATCH 1/4] monitor: print hub port name during info network Jason Wang
2015-02-02 7:06 ` [Qemu-devel] [PATCH 2/4] net: remove the wrong comment in net_init_hubport() Jason Wang
@ 2015-02-02 7:06 ` Jason Wang
2015-02-05 14:25 ` Stefan Hajnoczi
2015-02-02 7:06 ` [Qemu-devel] [PATCH 4/4] monitor: more accurate completion for host_net_remove() Jason Wang
2015-02-06 14:06 ` [Qemu-devel] [PATCH 1/4] monitor: print hub port name during info network Stefan Hajnoczi
3 siblings, 1 reply; 8+ messages in thread
From: Jason Wang @ 2015-02-02 7:06 UTC (permalink / raw)
To: aliguori, stefanha, qemu-devel; +Cc: Jason Wang
We should del hub port when peer is deleted since it will not be reused
and will only be freed during exit.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
net/net.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/net.c b/net/net.c
index 7acc162..74e651e 100644
--- a/net/net.c
+++ b/net/net.c
@@ -996,6 +996,8 @@ void net_host_device_remove(Monitor *mon, const QDict *qdict)
error_report("invalid host network device '%s'", device);
return;
}
+
+ qemu_del_net_client(nc->peer);
qemu_del_net_client(nc);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted
2015-02-02 7:06 ` [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted Jason Wang
@ 2015-02-05 14:25 ` Stefan Hajnoczi
2015-02-06 9:29 ` Jason Wang
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2015-02-05 14:25 UTC (permalink / raw)
To: Jason Wang; +Cc: stefanha, aliguori, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1076 bytes --]
On Mon, Feb 02, 2015 at 03:06:37PM +0800, Jason Wang wrote:
> We should del hub port when peer is deleted since it will not be reused
> and will only be freed during exit.
>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> net/net.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/net.c b/net/net.c
> index 7acc162..74e651e 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -996,6 +996,8 @@ void net_host_device_remove(Monitor *mon, const QDict *qdict)
> error_report("invalid host network device '%s'", device);
> return;
> }
> +
> + qemu_del_net_client(nc->peer);
> qemu_del_net_client(nc);
> }
If qmp_netdev_del() is used the hub port will stay alive.
Should the peer deletion happen in qemu_del_net_client(), similar to the
existing NIC peer check?
/* If there is a peer NIC, delete and cleanup client, but do not free. */
if (nc->peer && nc->peer->info->type == NET_CLIENT_OPTIONS_KIND_NIC) {
This way the hub port is consistently deleted when its peer is deleted.
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted
2015-02-05 14:25 ` Stefan Hajnoczi
@ 2015-02-06 9:29 ` Jason Wang
2015-02-06 14:06 ` Stefan Hajnoczi
0 siblings, 1 reply; 8+ messages in thread
From: Jason Wang @ 2015-02-06 9:29 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: aliguori, stefanha, qemu-devel
On Thu, Feb 5, 2015 at 10:25 PM, Stefan Hajnoczi <stefanha@gmail.com>
wrote:
> On Mon, Feb 02, 2015 at 03:06:37PM +0800, Jason Wang wrote:
>> We should del hub port when peer is deleted since it will not be
>> reused
>> and will only be freed during exit.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> net/net.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/net/net.c b/net/net.c
>> index 7acc162..74e651e 100644
>> --- a/net/net.c
>> +++ b/net/net.c
>> @@ -996,6 +996,8 @@ void net_host_device_remove(Monitor *mon, const
>> QDict *qdict)
>> error_report("invalid host network device '%s'", device);
>> return;
>> }
>> +
>> + qemu_del_net_client(nc->peer);
>> qemu_del_net_client(nc);
>> }
>
> If qmp_netdev_del() is used the hub port will stay alive.
This is true if it has a peer. And the port will be freed during the
deletion of its peer. If no peer, it will be deleted soon. This is
consistent with the behaviors of other type of netdevs.
>
> Should the peer deletion happen in qemu_del_net_client(), similar to
> the
> existing NIC peer check?
>
> /* If there is a peer NIC, delete and cleanup client, but do not
> free. */
> if (nc->peer && nc->peer->info->type ==
> NET_CLIENT_OPTIONS_KIND_NIC) {
>
> This way the hub port is consistently deleted when its peer is
> deleted.
Not sure, but if management always do netdev_del after device_del, it
will get an error.
Thanks
>
>
> Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted
2015-02-06 9:29 ` Jason Wang
@ 2015-02-06 14:06 ` Stefan Hajnoczi
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2015-02-06 14:06 UTC (permalink / raw)
To: Jason Wang; +Cc: aliguori, stefanha, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]
On Fri, Feb 06, 2015 at 09:37:54AM +0008, Jason Wang wrote:
> On Thu, Feb 5, 2015 at 10:25 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> >On Mon, Feb 02, 2015 at 03:06:37PM +0800, Jason Wang wrote:
> >> We should del hub port when peer is deleted since it will not be reused
> >> and will only be freed during exit.
> >> Signed-off-by: Jason Wang <jasowang@redhat.com>
> >> ---
> >> net/net.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >> diff --git a/net/net.c b/net/net.c
> >> index 7acc162..74e651e 100644
> >> --- a/net/net.c
> >> +++ b/net/net.c
> >> @@ -996,6 +996,8 @@ void net_host_device_remove(Monitor *mon, const
> >>QDict *qdict)
> >> error_report("invalid host network device '%s'", device);
> >> return;
> >> }
> >> +
> >> + qemu_del_net_client(nc->peer);
> >> qemu_del_net_client(nc);
> >> }
> >
> >If qmp_netdev_del() is used the hub port will stay alive.
>
> This is true if it has a peer. And the port will be freed during the
> deletion of its peer. If no peer, it will be deleted soon. This is
> consistent with the behaviors of other type of netdevs.
> >
> >Should the peer deletion happen in qemu_del_net_client(), similar to the
> >existing NIC peer check?
> >
> > /* If there is a peer NIC, delete and cleanup client, but do not free.
> >*/
> > if (nc->peer && nc->peer->info->type == NET_CLIENT_OPTIONS_KIND_NIC) {
> >
> >This way the hub port is consistently deleted when its peer is deleted.
>
> Not sure, but if management always do netdev_del after device_del, it will
> get an error.
Okay, I will merge this patch as-is.
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 4/4] monitor: more accurate completion for host_net_remove()
2015-02-02 7:06 [Qemu-devel] [PATCH 1/4] monitor: print hub port name during info network Jason Wang
2015-02-02 7:06 ` [Qemu-devel] [PATCH 2/4] net: remove the wrong comment in net_init_hubport() Jason Wang
2015-02-02 7:06 ` [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted Jason Wang
@ 2015-02-02 7:06 ` Jason Wang
2015-02-06 14:06 ` [Qemu-devel] [PATCH 1/4] monitor: print hub port name during info network Stefan Hajnoczi
3 siblings, 0 replies; 8+ messages in thread
From: Jason Wang @ 2015-02-02 7:06 UTC (permalink / raw)
To: aliguori, stefanha, qemu-devel; +Cc: Jason Wang, Luiz Capitulino
Current completion for host_net_remove will show hub ports and clients
that were not peered with hub ports. Fix this.
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
monitor.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/monitor.c b/monitor.c
index 7e4f605..e6dc50a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4597,8 +4597,13 @@ void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str)
count = qemu_find_net_clients_except(NULL, ncs,
NET_CLIENT_OPTIONS_KIND_NIC, 255);
for (i = 0; i < count; i++) {
+ int id;
const char *name;
+ if (ncs[i]->info->type == NET_CLIENT_OPTIONS_KIND_HUBPORT ||
+ net_hub_id_for_client(ncs[i], &id)) {
+ continue;
+ }
name = ncs[i]->name;
if (!strncmp(str, name, len)) {
readline_add_completion(rs, name);
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 1/4] monitor: print hub port name during info network
2015-02-02 7:06 [Qemu-devel] [PATCH 1/4] monitor: print hub port name during info network Jason Wang
` (2 preceding siblings ...)
2015-02-02 7:06 ` [Qemu-devel] [PATCH 4/4] monitor: more accurate completion for host_net_remove() Jason Wang
@ 2015-02-06 14:06 ` Stefan Hajnoczi
3 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2015-02-06 14:06 UTC (permalink / raw)
To: Jason Wang; +Cc: stefanha, aliguori, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 275 bytes --]
On Mon, Feb 02, 2015 at 03:06:35PM +0800, Jason Wang wrote:
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> net/hub.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-02-06 14:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-02 7:06 [Qemu-devel] [PATCH 1/4] monitor: print hub port name during info network Jason Wang
2015-02-02 7:06 ` [Qemu-devel] [PATCH 2/4] net: remove the wrong comment in net_init_hubport() Jason Wang
2015-02-02 7:06 ` [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted Jason Wang
2015-02-05 14:25 ` Stefan Hajnoczi
2015-02-06 9:29 ` Jason Wang
2015-02-06 14:06 ` Stefan Hajnoczi
2015-02-02 7:06 ` [Qemu-devel] [PATCH 4/4] monitor: more accurate completion for host_net_remove() Jason Wang
2015-02-06 14:06 ` [Qemu-devel] [PATCH 1/4] monitor: print hub port name during info network Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).