Skip to content

Commit 9fe7f5d

Browse files
Clean up virtio-net TAP option handling
Remove the trailing space from the vnet help text, reject unsupported virtio-net backends, and avoid repeated virtio-net options when only one virtio-net device is supported. At this stage only the TAP backend is accepted. The user-mode backend will be enabled later when SLIRP support is added. Also remove the unnecessary device index increment after adding the virtio-net DTB node, since no later device uses the incremented value
1 parent fc23a49 commit 9fe7f5d

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

File renamed without changes.

src/main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static void print_usage(const char *filename)
139139
"(default read and write). This option may be specified "
140140
"multiple times for multiple block devices\n"
141141
" -x vrng : enable virtio-rng device\n"
142-
" -x vnet:<backend>: use <backend> as virtio-net backend interface \n"
142+
" -x vnet:<backend>: use <backend> as virtio-net backend interface\n"
143143
" -b <bootargs> : use customized <bootargs> for the kernel\n"
144144
#endif
145145
" -d [filename]: dump registers as JSON to the "
@@ -201,6 +201,11 @@ static bool parse_args(int argc, char **args)
201201
return false;
202202
}
203203
opt_virtio_net_backend = optarg + 5; /* strlen("vnet:") */
204+
if (strcmp(opt_virtio_net_backend, "tap")) {
205+
rv_log_error("unsupported virtio-net backend: %s",
206+
opt_virtio_net_backend);
207+
return false;
208+
}
204209
} else if (!strcmp("vrng", optarg)) {
205210
opt_virtio_rng = true;
206211
} else {

src/riscv.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,6 @@ static void load_dtb(char **ram_loc, vm_attr_t *attr)
531531
uint32_t irq = cpu_to_fdt32(new_irq);
532532
assert(fdt_setprop(dtb_buf, subnode, "interrupts", &irq,
533533
sizeof(irq)) == 0);
534-
dev_idx++;
535534
}
536535
}
537536

0 commit comments

Comments
 (0)