hv_utils: Add comment about max VMbus packet size in VSS driver
The VSS driver allocates a VMbus receive buffer significantly larger than sizeof(hv_vss_msg), with no explanation. To help prevent future mistakes, add a #define and comment about why this is done. No functional change. Signed-off-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/1644423070-75125-1-git-send-email-mikelley@microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
parent
4ee5245871
commit
6de74d1069
|
@ -31,6 +31,9 @@ static const int fw_versions[] = {
|
|||
UTIL_FW_VERSION
|
||||
};
|
||||
|
||||
/* See comment with struct hv_vss_msg regarding the max VMbus packet size */
|
||||
#define VSS_MAX_PKT_SIZE (HV_HYP_PAGE_SIZE * 2)
|
||||
|
||||
/*
|
||||
* Timeout values are based on expecations from host
|
||||
*/
|
||||
|
@ -298,7 +301,7 @@ void hv_vss_onchannelcallback(void *context)
|
|||
if (vss_transaction.state > HVUTIL_READY)
|
||||
return;
|
||||
|
||||
if (vmbus_recvpacket(channel, recv_buffer, HV_HYP_PAGE_SIZE * 2, &recvlen, &requestid)) {
|
||||
if (vmbus_recvpacket(channel, recv_buffer, VSS_MAX_PKT_SIZE, &recvlen, &requestid)) {
|
||||
pr_err_ratelimited("VSS request received. Could not read into recv buf\n");
|
||||
return;
|
||||
}
|
||||
|
@ -375,7 +378,7 @@ hv_vss_init(struct hv_util_service *srv)
|
|||
}
|
||||
recv_buffer = srv->recv_buffer;
|
||||
vss_transaction.recv_channel = srv->channel;
|
||||
vss_transaction.recv_channel->max_pkt_size = HV_HYP_PAGE_SIZE * 2;
|
||||
vss_transaction.recv_channel->max_pkt_size = VSS_MAX_PKT_SIZE;
|
||||
|
||||
/*
|
||||
* When this driver loads, the user level daemon that
|
||||
|
|
|
@ -90,6 +90,17 @@ struct hv_vss_check_dm_info {
|
|||
__u32 flags;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* struct hv_vss_msg encodes the fields that the Linux VSS
|
||||
* driver accesses. However, FREEZE messages from Hyper-V contain
|
||||
* additional LUN information that Linux doesn't use and are not
|
||||
* represented in struct hv_vss_msg. A received FREEZE message may
|
||||
* be as large as 6,260 bytes, so the driver must allocate at least
|
||||
* that much space, not sizeof(struct hv_vss_msg). Other messages
|
||||
* such as AUTO_RECOVER may be as large as 12,500 bytes. However,
|
||||
* because the Linux VSS driver responds that it doesn't support
|
||||
* auto-recovery, it should not receive such messages.
|
||||
*/
|
||||
struct hv_vss_msg {
|
||||
union {
|
||||
struct hv_vss_hdr vss_hdr;
|
||||
|
|
Loading…
Reference in New Issue