From: Long Li <lon...@microsoft.com> Hyperv host may offer channels without monitor enabled. The max monitor ID it supports is 128. Over those channels without monitor enabled, Hyperv does not send or receive large amount of data traffic and almost all the data traffic is going over the VF.
Change the code to not fail on creating channels without monitor enabled. Use UINT8_MAX (256) to indicate this channel have no monitoring. Signed-off-by: Long Li <lon...@microsoft.com> --- drivers/bus/vmbus/linux/vmbus_bus.c | 9 ++++++--- drivers/bus/vmbus/linux/vmbus_uio.c | 4 ++-- drivers/bus/vmbus/vmbus_channel.c | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c index 01d8111b85..79fd3370b8 100644 --- a/drivers/bus/vmbus/linux/vmbus_bus.c +++ b/drivers/bus/vmbus/linux/vmbus_bus.c @@ -280,9 +280,12 @@ vmbus_scan_one(const char *name) /* get monitor id */ snprintf(filename, sizeof(filename), "%s/monitor_id", dirname); - if (eal_parse_sysfs_value(filename, &tmp) < 0) - goto error; - dev->monitor_id = tmp; + if (eal_parse_sysfs_value(filename, &tmp) >= 0) { + dev->monitor_id = tmp; + } else { + VMBUS_LOG(NOTICE, "monitor disabled on %s", name); + dev->monitor_id = UINT8_MAX; + } /* get numa node (if present) */ snprintf(filename, sizeof(filename), "%s/numa_node", diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c index 26edef342d..33edc151f6 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -451,9 +451,9 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, err = vmbus_uio_sysfs_read(subchan_path, "monitor_id", &monid, UINT8_MAX); if (err) { - VMBUS_LOG(NOTICE, "no monitor_id in %s:%s", + VMBUS_LOG(NOTICE, "no monitor_id in %s:%s use int mode", subchan_path, strerror(-err)); - goto fail; + monid = UINT8_MAX; } err = vmbus_chan_create(dev, relid, subid, monid, subchan); diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c index 925c2aa081..d4b5ba1979 100644 --- a/drivers/bus/vmbus/vmbus_channel.c +++ b/drivers/bus/vmbus/vmbus_channel.c @@ -52,6 +52,9 @@ rte_vmbus_set_latency(const struct rte_vmbus_device *dev, const struct vmbus_channel *chan, uint32_t latency) { + if (chan->monitor_id == UINT8_MAX) + return; + uint32_t trig_idx = chan->monitor_id / VMBUS_MONTRIG_LEN; uint32_t trig_offs = chan->monitor_id % VMBUS_MONTRIG_LEN; -- 2.34.1