mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 06:29:19 +00:00
dm: remove the assume of virtio-net device name
Now, the DM assumes the device name entered by user is dependent on the type. For example, the device of tap type is named tap_TAAG, this patch remove the above assumption. User could set any name, no matter the code of DM or actually created, it is represented by user input. Tracked-On: #6690 Acked-by: Wang, Yu1 <yu1.wang@intel.com> Signed-off-by: Chenli Wei<chenli.wei@linux.intel.com>
This commit is contained in:
parent
04eefc9516
commit
b9431b8da4
@ -820,7 +820,6 @@ virtio_net_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||||||
char nstr[80];
|
char nstr[80];
|
||||||
char tname[MAXCOMLEN + 1];
|
char tname[MAXCOMLEN + 1];
|
||||||
struct virtio_net *net;
|
struct virtio_net *net;
|
||||||
char fname[IFNAMSIZ];
|
|
||||||
char *devopts = NULL;
|
char *devopts = NULL;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
char *type = NULL;
|
char *type = NULL;
|
||||||
@ -911,23 +910,20 @@ virtio_net_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vtopts = tmp = strdup(opts);
|
vtopts = tmp = strdup(opts);
|
||||||
if ((strstr(tmp, "tap") != NULL)
|
if (strncmp(tmp, "tap", 3) == 0) {
|
||||||
|| (strncmp(tmp, "vmnet",5) == 0)) {
|
|
||||||
type = strsep(&tmp, "=");
|
type = strsep(&tmp, "=");
|
||||||
name = strsep(&tmp, ",");
|
name = strsep(&tmp, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tmp != NULL) && (strncmp(tmp, "mac_seed",8) == 0)) {
|
if ((tmp != NULL) && (strncmp(tmp, "mac_seed", 8) == 0)) {
|
||||||
strsep(&tmp, "=");
|
strsep(&tmp, "=");
|
||||||
mac_seed = tmp;
|
mac_seed = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type != NULL) && (name != NULL)) {
|
if ((type != NULL) && (name != NULL)) {
|
||||||
snprintf(fname, IFNAMSIZ, "%s_%s", type, name);
|
|
||||||
|
|
||||||
if ((strstr(type, "tap") != NULL) ||
|
if (strcmp(type, "tap") == 0) {
|
||||||
(strncmp(type, "vmnet", 5) == 0)){
|
virtio_net_tap_setup(net, name);
|
||||||
virtio_net_tap_setup(net, fname);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user