net: Do not fill legacy info_str for backends

As we use QAPI NetClientState->stored_config to store and get information
about backend network devices, we can drop fill of legacy field info_str
for them.

We still use info_str field for NIC and hubports, so we can not completely
remove it.

Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru>
Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
Alexey Kirillov 2021-03-03 12:59:10 +03:00 committed by Jason Wang
parent a0724776c5
commit f2e8319d45
8 changed files with 0 additions and 48 deletions

View File

@ -729,8 +729,6 @@ int net_init_l2tpv3(const Netdev *netdev,
QAPI_CLONE_MEMBERS(NetdevL2TPv3Options, QAPI_CLONE_MEMBERS(NetdevL2TPv3Options,
&nc->stored_config->u.l2tpv3, l2tpv3); &nc->stored_config->u.l2tpv3, l2tpv3);
s->nc.info_str = g_strdup_printf("l2tpv3: connected");
return 0; return 0;
outerr: outerr:
qemu_del_net_client(nc); qemu_del_net_client(nc);

View File

@ -664,9 +664,6 @@ static int net_slirp_init(NetClientState *peer, const char *model,
stored->tftp_server_name = g_strdup(tftp_server_name); stored->tftp_server_name = g_strdup(tftp_server_name);
} }
nc->info_str = g_strdup_printf("net=%s,restrict=%s", inet_ntoa(net),
restricted ? "on" : "off");
s = DO_UPCAST(SlirpState, nc, nc); s = DO_UPCAST(SlirpState, nc, nc);
s->slirp = slirp_init(restricted, ipv4, net, mask, host, s->slirp = slirp_init(restricted, ipv4, net, mask, host,

View File

@ -180,8 +180,6 @@ static void net_socket_send(void *opaque)
s->fd = -1; s->fd = -1;
net_socket_rs_init(&s->rs, net_socket_rs_finalize, false); net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);
s->nc.link_down = true; s->nc.link_down = true;
g_free(s->nc.info_str);
s->nc.info_str = g_new0(char, 1);
return; return;
} }
@ -401,16 +399,10 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
stored->mcast = g_strdup(mcast); stored->mcast = g_strdup(mcast);
s->dgram_dst = saddr; s->dgram_dst = saddr;
nc->info_str = g_strdup_printf("socket: fd=%d (cloned mcast=%s:%d)",
fd, inet_ntoa(saddr.sin_addr),
ntohs(saddr.sin_port));
} else { } else {
if (sa_type == SOCKET_ADDRESS_TYPE_UNIX) { if (sa_type == SOCKET_ADDRESS_TYPE_UNIX) {
s->dgram_dst.sin_family = AF_UNIX; s->dgram_dst.sin_family = AF_UNIX;
} }
nc->info_str = g_strdup_printf("socket: fd=%d %s",
fd, SocketAddressType_str(sa_type));
} }
return s; return s;
@ -445,8 +437,6 @@ static NetSocketState *net_socket_fd_init_stream(NetClientState *peer,
nc = qemu_new_net_client(&net_socket_info, peer, model, name); nc = qemu_new_net_client(&net_socket_info, peer, model, name);
nc->info_str = g_strdup_printf("socket: fd=%d", fd);
s = DO_UPCAST(NetSocketState, nc, nc); s = DO_UPCAST(NetSocketState, nc, nc);
s->fd = fd; s->fd = fd;
@ -528,11 +518,6 @@ static void net_socket_accept(void *opaque)
stored->has_fd = true; stored->has_fd = true;
stored->fd = g_strdup_printf("%d", fd); stored->fd = g_strdup_printf("%d", fd);
g_free(s->nc.info_str);
s->nc.info_str = g_strdup_printf("socket: connection from %s:%d",
inet_ntoa(saddr.sin_addr),
ntohs(saddr.sin_port));
} }
static int net_socket_listen_init(NetClientState *peer, static int net_socket_listen_init(NetClientState *peer,
@ -647,10 +632,6 @@ static int net_socket_connect_init(NetClientState *peer,
stored->has_connect = true; stored->has_connect = true;
stored->connect = g_strdup(host_str); stored->connect = g_strdup(host_str);
g_free(s->nc.info_str);
s->nc.info_str = g_strdup_printf("socket: connect to %s:%d",
inet_ntoa(saddr.sin_addr),
ntohs(saddr.sin_port));
return 0; return 0;
} }
@ -707,12 +688,7 @@ static int net_socket_mcast_init(NetClientState *peer,
stored->localaddr = g_strdup(localaddr_str); stored->localaddr = g_strdup(localaddr_str);
} }
g_free(s->nc.info_str);
s->nc.info_str = g_strdup_printf("socket: mcast=%s:%d",
inet_ntoa(saddr.sin_addr),
ntohs(saddr.sin_port));
return 0; return 0;
} }
static int net_socket_udp_init(NetClientState *peer, static int net_socket_udp_init(NetClientState *peer,
@ -773,10 +749,6 @@ static int net_socket_udp_init(NetClientState *peer,
stored->has_udp = true; stored->has_udp = true;
stored->udp = g_strdup(rhost); stored->udp = g_strdup(rhost);
g_free(s->nc.info_str);
s->nc.info_str = g_strdup_printf("socket: udp=%s:%d",
inet_ntoa(raddr.sin_addr),
ntohs(raddr.sin_port));
return 0; return 0;
} }

View File

@ -787,8 +787,6 @@ static int tap_win32_init(NetClientState *peer, const char *model,
stored->has_ifname = true; stored->has_ifname = true;
stored->ifname = g_strdup(ifname); stored->ifname = g_strdup(ifname);
s->nc.info_str = g_strdup_printf("tap: ifname=%s", ifname);
s->handle = handle; s->handle = handle;
qemu_add_wait_object(s->handle->tap_semaphore, tap_win32_send, s); qemu_add_wait_object(s->handle->tap_semaphore, tap_win32_send, s);

View File

@ -625,8 +625,6 @@ int net_init_bridge(const Netdev *netdev, const char *name,
stored->helper = g_strdup(helper); stored->helper = g_strdup(helper);
} }
s->nc.info_str = g_strdup_printf("helper=%s,br=%s", helper, br);
return 0; return 0;
} }
@ -712,8 +710,6 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
stored->fds = g_strdup_printf("%s:%d", stored->fds, fd); stored->fds = g_strdup_printf("%s:%d", stored->fds, fd);
g_free(tmp_s); g_free(tmp_s);
} }
s->nc.info_str = g_strdup_printf("fd=%d", fd);
} else if (tap->has_helper) { } else if (tap->has_helper) {
if (!stored->has_helper) { if (!stored->has_helper) {
stored->has_helper = true; stored->has_helper = true;
@ -725,8 +721,6 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
stored->br = tap->has_br ? g_strdup(tap->br) : stored->br = tap->has_br ? g_strdup(tap->br) :
g_strdup(DEFAULT_BRIDGE_INTERFACE); g_strdup(DEFAULT_BRIDGE_INTERFACE);
} }
s->nc.info_str = g_strdup_printf("helper=%s", tap->helper);
} else { } else {
if (ifname && !stored->has_ifname) { if (ifname && !stored->has_ifname) {
stored->has_ifname = true; stored->has_ifname = true;
@ -743,9 +737,6 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
stored->downscript = g_strdup(downscript); stored->downscript = g_strdup(downscript);
} }
s->nc.info_str = g_strdup_printf("ifname=%s,script=%s,downscript=%s",
ifname, script, downscript);
if (strcmp(downscript, "no") != 0) { if (strcmp(downscript, "no") != 0) {
snprintf(s->down_script, sizeof(s->down_script), "%s", downscript); snprintf(s->down_script, sizeof(s->down_script), "%s", downscript);
snprintf(s->down_script_arg, sizeof(s->down_script_arg), snprintf(s->down_script_arg, sizeof(s->down_script_arg),

View File

@ -100,8 +100,6 @@ static int net_vde_init(NetClientState *peer, const char *model,
nc = qemu_new_net_client(&net_vde_info, peer, model, name); nc = qemu_new_net_client(&net_vde_info, peer, model, name);
nc->info_str = g_strdup_printf("sock=%s,fd=%d", sock, vde_datafd(vde));
s = DO_UPCAST(VDEState, nc, nc); s = DO_UPCAST(VDEState, nc, nc);
s->vde = vde; s->vde = vde;

View File

@ -327,7 +327,6 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
user = g_new0(struct VhostUserState, 1); user = g_new0(struct VhostUserState, 1);
for (i = 0; i < queues; i++) { for (i = 0; i < queues; i++) {
nc = qemu_new_net_client(&net_vhost_user_info, peer, device, name); nc = qemu_new_net_client(&net_vhost_user_info, peer, device, name);
nc->info_str = g_strdup_printf("vhost-user%d to %s", i, chr->label);
nc->queue_index = i; nc->queue_index = i;
if (!nc0) { if (!nc0) {
nc0 = nc; nc0 = nc;

View File

@ -200,7 +200,6 @@ static int net_vhost_vdpa_init(NetClientState *peer, const char *device,
stored->has_queues = true; stored->has_queues = true;
stored->queues = 1; /* TODO: change when support multiqueue */ stored->queues = 1; /* TODO: change when support multiqueue */
nc->info_str = g_strdup_printf(TYPE_VHOST_VDPA);
nc->queue_index = 0; nc->queue_index = 0;
s = DO_UPCAST(VhostVDPAState, nc, nc); s = DO_UPCAST(VhostVDPAState, nc, nc);
vdpa_device_fd = qemu_open_old(vhostdev, O_RDWR); vdpa_device_fd = qemu_open_old(vhostdev, O_RDWR);