qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

net: Remove the deprecated 'host_net_add' and 'host_net_remove' HMP commands

They are deprecated since QEMU v2.10, and so far nobody complained that
these commands are still necessary for any reason - and since you can use
'netdev_add' and 'netdev_remove' instead, there also should not be any
real reason. Since they are also standing in the way for the upcoming
'vlan' clean-up, it's now time to remove them.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>

authored by

Thomas Huth and committed by
Jason Wang
7cc28cb0 857d2087

-200
-30
hmp-commands.hx
··· 1291 1291 ETEXI 1292 1292 1293 1293 { 1294 - .name = "host_net_add", 1295 - .args_type = "device:s,opts:s?", 1296 - .params = "tap|user|socket|vde|netmap|bridge|vhost-user|dump [options]", 1297 - .help = "add host VLAN client (deprecated, use netdev_add instead)", 1298 - .cmd = hmp_host_net_add, 1299 - .command_completion = host_net_add_completion, 1300 - }, 1301 - 1302 - STEXI 1303 - @item host_net_add 1304 - @findex host_net_add 1305 - Add host VLAN client. Deprecated, please use @code{netdev_add} instead. 1306 - ETEXI 1307 - 1308 - { 1309 - .name = "host_net_remove", 1310 - .args_type = "vlan_id:i,device:s", 1311 - .params = "vlan_id name", 1312 - .help = "remove host VLAN client (deprecated, use netdev_del instead)", 1313 - .cmd = hmp_host_net_remove, 1314 - .command_completion = host_net_remove_completion, 1315 - }, 1316 - 1317 - STEXI 1318 - @item host_net_remove 1319 - @findex host_net_remove 1320 - Remove host VLAN client. Deprecated, please use @code{netdev_del} instead. 1321 - ETEXI 1322 - 1323 - { 1324 1294 .name = "netdev_add", 1325 1295 .args_type = "netdev:O", 1326 1296 .params = "[user|tap|socket|vde|bridge|hubport|netmap|vhost-user],id=str[,prop=value][,...]",
-3
hmp.h
··· 132 132 const char *str); 133 133 void migrate_set_parameter_completion(ReadLineState *rs, int nb_args, 134 134 const char *str); 135 - void host_net_add_completion(ReadLineState *rs, int nb_args, const char *str); 136 - void host_net_remove_completion(ReadLineState *rs, int nb_args, 137 - const char *str); 138 135 void delvm_completion(ReadLineState *rs, int nb_args, const char *str); 139 136 void loadvm_completion(ReadLineState *rs, int nb_args, const char *str); 140 137 void hmp_rocker(Monitor *mon, const QDict *qdict);
-61
monitor.c
··· 3581 3581 } 3582 3582 } 3583 3583 3584 - void host_net_add_completion(ReadLineState *rs, int nb_args, const char *str) 3585 - { 3586 - int i; 3587 - size_t len; 3588 - if (nb_args != 2) { 3589 - return; 3590 - } 3591 - len = strlen(str); 3592 - readline_set_completion_index(rs, len); 3593 - for (i = 0; host_net_devices[i]; i++) { 3594 - if (!strncmp(host_net_devices[i], str, len)) { 3595 - readline_add_completion(rs, host_net_devices[i]); 3596 - } 3597 - } 3598 - } 3599 - 3600 - void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str) 3601 - { 3602 - NetClientState *ncs[MAX_QUEUE_NUM]; 3603 - int count, i, len; 3604 - 3605 - len = strlen(str); 3606 - readline_set_completion_index(rs, len); 3607 - if (nb_args == 2) { 3608 - count = qemu_find_net_clients_except(NULL, ncs, 3609 - NET_CLIENT_DRIVER_NONE, 3610 - MAX_QUEUE_NUM); 3611 - for (i = 0; i < MIN(count, MAX_QUEUE_NUM); i++) { 3612 - int id; 3613 - char name[16]; 3614 - 3615 - if (net_hub_id_for_client(ncs[i], &id)) { 3616 - continue; 3617 - } 3618 - snprintf(name, sizeof(name), "%d", id); 3619 - if (!strncmp(str, name, len)) { 3620 - readline_add_completion(rs, name); 3621 - } 3622 - } 3623 - return; 3624 - } else if (nb_args == 3) { 3625 - count = qemu_find_net_clients_except(NULL, ncs, 3626 - NET_CLIENT_DRIVER_NIC, 3627 - MAX_QUEUE_NUM); 3628 - for (i = 0; i < MIN(count, MAX_QUEUE_NUM); i++) { 3629 - int id; 3630 - const char *name; 3631 - 3632 - if (ncs[i]->info->type == NET_CLIENT_DRIVER_HUBPORT || 3633 - net_hub_id_for_client(ncs[i], &id)) { 3634 - continue; 3635 - } 3636 - name = ncs[i]->name; 3637 - if (!strncmp(str, name, len)) { 3638 - readline_add_completion(rs, name); 3639 - } 3640 - } 3641 - return; 3642 - } 3643 - } 3644 - 3645 3584 static void vm_completion(ReadLineState *rs, const char *str) 3646 3585 { 3647 3586 size_t len;
-94
net/net.c
··· 60 60 static VMChangeStateEntry *net_change_state_entry; 61 61 static QTAILQ_HEAD(, NetClientState) net_clients; 62 62 63 - const char *host_net_devices[] = { 64 - "tap", 65 - "socket", 66 - #ifdef CONFIG_NET_BRIDGE 67 - "bridge", 68 - #endif 69 - #ifdef CONFIG_NETMAP 70 - "netmap", 71 - #endif 72 - #ifdef CONFIG_SLIRP 73 - "user", 74 - #endif 75 - #ifdef CONFIG_VDE 76 - "vde", 77 - #endif 78 - "vhost-user", 79 - NULL, 80 - }; 81 - 82 63 /***********************************************************/ 83 64 /* network device redirectors */ 84 65 ··· 1172 1153 error_propagate(errp, err); 1173 1154 visit_free(v); 1174 1155 return ret; 1175 - } 1176 - 1177 - 1178 - static int net_host_check_device(const char *device) 1179 - { 1180 - int i; 1181 - for (i = 0; host_net_devices[i]; i++) { 1182 - if (!strncmp(host_net_devices[i], device, 1183 - strlen(host_net_devices[i]))) { 1184 - return 1; 1185 - } 1186 - } 1187 - 1188 - return 0; 1189 - } 1190 - 1191 - void hmp_host_net_add(Monitor *mon, const QDict *qdict) 1192 - { 1193 - const char *device = qdict_get_str(qdict, "device"); 1194 - const char *opts_str = qdict_get_try_str(qdict, "opts"); 1195 - Error *local_err = NULL; 1196 - QemuOpts *opts; 1197 - static bool warned; 1198 - 1199 - if (!warned && !qtest_enabled()) { 1200 - error_report("host_net_add is deprecated, use netdev_add instead"); 1201 - warned = true; 1202 - } 1203 - 1204 - if (!net_host_check_device(device)) { 1205 - monitor_printf(mon, "invalid host network device %s\n", device); 1206 - return; 1207 - } 1208 - 1209 - opts = qemu_opts_parse_noisily(qemu_find_opts("net"), 1210 - opts_str ? opts_str : "", false); 1211 - if (!opts) { 1212 - return; 1213 - } 1214 - 1215 - qemu_opt_set(opts, "type", device, &error_abort); 1216 - 1217 - net_client_init(opts, false, &local_err); 1218 - if (local_err) { 1219 - error_report_err(local_err); 1220 - monitor_printf(mon, "adding host network device %s failed\n", device); 1221 - } 1222 - } 1223 - 1224 - void hmp_host_net_remove(Monitor *mon, const QDict *qdict) 1225 - { 1226 - NetClientState *nc; 1227 - int vlan_id = qdict_get_int(qdict, "vlan_id"); 1228 - const char *device = qdict_get_str(qdict, "device"); 1229 - static bool warned; 1230 - 1231 - if (!warned && !qtest_enabled()) { 1232 - error_report("host_net_remove is deprecated, use netdev_del instead"); 1233 - warned = true; 1234 - } 1235 - 1236 - nc = net_hub_find_client_by_name(vlan_id, device); 1237 - if (!nc) { 1238 - error_report("Host network device '%s' on hub '%d' not found", 1239 - device, vlan_id); 1240 - return; 1241 - } 1242 - if (nc->info->type == NET_CLIENT_DRIVER_NIC) { 1243 - error_report("invalid host network device '%s'", device); 1244 - return; 1245 - } 1246 - 1247 - qemu_del_net_client(nc->peer); 1248 - qemu_del_net_client(nc); 1249 - qemu_opts_del(qemu_opts_find(qemu_find_opts("net"), device)); 1250 1156 } 1251 1157 1252 1158 void netdev_add(QemuOpts *opts, Error **errp)
-10
qemu-doc.texi
··· 2760 2760 2761 2761 The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command. 2762 2762 2763 - @section System emulator human monitor commands 2764 - 2765 - @subsection host_net_add (since 2.10.0) 2766 - 2767 - The ``host_net_add'' command is replaced by the ``netdev_add'' command. 2768 - 2769 - @subsection host_net_remove (since 2.10.0) 2770 - 2771 - The ``host_net_remove'' command is replaced by the ``netdev_del'' command. 2772 - 2773 2763 @section System emulator devices 2774 2764 2775 2765 @subsection ivshmem (since 2.6.0)
-2
tests/test-hmp.c
··· 37 37 "dump-guest-memory /dev/null 0 4096", 38 38 "dump-guest-memory /dev/null", 39 39 "gdbserver", 40 - "host_net_add user id=net0", 41 40 "hostfwd_add tcp::43210-:43210", 42 41 "hostfwd_remove tcp::43210-:43210", 43 - "host_net_remove 0 net0", 44 42 "i /w 0", 45 43 "log all", 46 44 "log none",