Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Drivers: hv: vmbus: Add utility function for querying ring size

Add a function to query for the preferred ring buffer size of VMBus
device. This will allow the drivers (eg. UIO) to allocate the most
optimized ring buffer size for devices.

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Link: https://lore.kernel.org/r/1711788723-8593-2-git-send-email-ssengar@linux.microsoft.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Saurabh Sengar and committed by
Greg Kroah-Hartman
e8c4bd6c a36b6977

+19 -3
+12 -3
drivers/hv/channel_mgmt.c
··· 120 120 }, 121 121 122 122 /* File copy */ 123 - { .dev_type = HV_FCOPY, 123 + /* fcopy always uses 16KB ring buffer size and is working well for last many years */ 124 + { .pref_ring_size = 0x4000, 125 + .dev_type = HV_FCOPY, 124 126 HV_FCOPY_GUID, 125 127 .perf_device = false, 126 128 .allowed_in_isolated = false, ··· 142 140 .allowed_in_isolated = false, 143 141 }, 144 142 145 - /* Unknown GUID */ 146 - { .dev_type = HV_UNKNOWN, 143 + /* 144 + * Unknown GUID 145 + * 64 KB ring buffer + 4 KB header should be sufficient size for any Hyper-V device apart 146 + * from HV_NIC and HV_SCSI. This case avoid the fallback for unknown devices to allocate 147 + * much bigger (2 MB) of ring size. 148 + */ 149 + { .pref_ring_size = 0x11000, 150 + .dev_type = HV_UNKNOWN, 147 151 .perf_device = false, 148 152 .allowed_in_isolated = false, 149 153 }, 150 154 }; 155 + EXPORT_SYMBOL_GPL(vmbus_devs); 151 156 152 157 static const struct { 153 158 guid_t guid;
+5
drivers/hv/hyperv_vmbus.h
··· 417 417 return vmbus_devs[channel->device_id].perf_device; 418 418 } 419 419 420 + static inline size_t hv_dev_ring_size(struct vmbus_channel *channel) 421 + { 422 + return vmbus_devs[channel->device_id].pref_ring_size; 423 + } 424 + 420 425 static inline bool hv_is_allocated_cpu(unsigned int cpu) 421 426 { 422 427 struct vmbus_channel *channel, *sc;
+2
include/linux/hyperv.h
··· 820 820 #define VMBUS_RQST_RESET (U64_MAX - 3) 821 821 822 822 struct vmbus_device { 823 + /* preferred ring buffer size in KB, 0 means no preferred size for this device */ 824 + size_t pref_ring_size; 823 825 u16 dev_type; 824 826 guid_t guid; 825 827 bool perf_device;