Drivers: hv: vmbus: Update indentation in create_gpadl_header()
A previous commit left the indentation in create_gpadl_header() unchanged for ease of review. Update the indentation and remove line wrap in two places where it is no longer necessary. No functional change. Signed-off-by: Michael Kelley <mhklinux@outlook.com> Link: https://lore.kernel.org/r/20240111165451.269418-2-mhklinux@outlook.com Signed-off-by: Wei Liu <wei.liu@kernel.org> Message-ID: <20240111165451.269418-2-mhklinux@outlook.com>
This commit is contained in:
parent
8db0edc4ac
commit
9645e74414
@ -327,84 +327,82 @@ static int create_gpadl_header(enum hv_gpadl_type type, void *kbuffer,
|
|||||||
sizeof(struct gpa_range);
|
sizeof(struct gpa_range);
|
||||||
pfncount = umin(pagecount, pfnsize / sizeof(u64));
|
pfncount = umin(pagecount, pfnsize / sizeof(u64));
|
||||||
|
|
||||||
|
msgsize = sizeof(struct vmbus_channel_msginfo) +
|
||||||
|
sizeof(struct vmbus_channel_gpadl_header) +
|
||||||
|
sizeof(struct gpa_range) + pfncount * sizeof(u64);
|
||||||
|
msgheader = kzalloc(msgsize, GFP_KERNEL);
|
||||||
|
if (!msgheader)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&msgheader->submsglist);
|
||||||
|
msgheader->msgsize = msgsize;
|
||||||
|
|
||||||
|
gpadl_header = (struct vmbus_channel_gpadl_header *)
|
||||||
|
msgheader->msg;
|
||||||
|
gpadl_header->rangecount = 1;
|
||||||
|
gpadl_header->range_buflen = sizeof(struct gpa_range) +
|
||||||
|
pagecount * sizeof(u64);
|
||||||
|
gpadl_header->range[0].byte_offset = 0;
|
||||||
|
gpadl_header->range[0].byte_count = hv_gpadl_size(type, size);
|
||||||
|
for (i = 0; i < pfncount; i++)
|
||||||
|
gpadl_header->range[0].pfn_array[i] = hv_gpadl_hvpfn(
|
||||||
|
type, kbuffer, size, send_offset, i);
|
||||||
|
*msginfo = msgheader;
|
||||||
|
|
||||||
|
pfnsum = pfncount;
|
||||||
|
pfnleft = pagecount - pfncount;
|
||||||
|
|
||||||
|
/* how many pfns can we fit in a body message */
|
||||||
|
pfnsize = MAX_SIZE_CHANNEL_MESSAGE -
|
||||||
|
sizeof(struct vmbus_channel_gpadl_body);
|
||||||
|
pfncount = pfnsize / sizeof(u64);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If pfnleft is zero, everything fits in the header and no body
|
||||||
|
* messages are needed
|
||||||
|
*/
|
||||||
|
while (pfnleft) {
|
||||||
|
pfncurr = umin(pfncount, pfnleft);
|
||||||
msgsize = sizeof(struct vmbus_channel_msginfo) +
|
msgsize = sizeof(struct vmbus_channel_msginfo) +
|
||||||
sizeof(struct vmbus_channel_gpadl_header) +
|
sizeof(struct vmbus_channel_gpadl_body) +
|
||||||
sizeof(struct gpa_range) + pfncount * sizeof(u64);
|
pfncurr * sizeof(u64);
|
||||||
msgheader = kzalloc(msgsize, GFP_KERNEL);
|
msgbody = kzalloc(msgsize, GFP_KERNEL);
|
||||||
if (!msgheader)
|
|
||||||
|
if (!msgbody) {
|
||||||
|
struct vmbus_channel_msginfo *pos = NULL;
|
||||||
|
struct vmbus_channel_msginfo *tmp = NULL;
|
||||||
|
/*
|
||||||
|
* Free up all the allocated messages.
|
||||||
|
*/
|
||||||
|
list_for_each_entry_safe(pos, tmp,
|
||||||
|
&msgheader->submsglist,
|
||||||
|
msglistentry) {
|
||||||
|
|
||||||
|
list_del(&pos->msglistentry);
|
||||||
|
kfree(pos);
|
||||||
|
}
|
||||||
|
kfree(msgheader);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_LIST_HEAD(&msgheader->submsglist);
|
msgbody->msgsize = msgsize;
|
||||||
msgheader->msgsize = msgsize;
|
gpadl_body = (struct vmbus_channel_gpadl_body *)msgbody->msg;
|
||||||
|
|
||||||
gpadl_header = (struct vmbus_channel_gpadl_header *)
|
|
||||||
msgheader->msg;
|
|
||||||
gpadl_header->rangecount = 1;
|
|
||||||
gpadl_header->range_buflen = sizeof(struct gpa_range) +
|
|
||||||
pagecount * sizeof(u64);
|
|
||||||
gpadl_header->range[0].byte_offset = 0;
|
|
||||||
gpadl_header->range[0].byte_count = hv_gpadl_size(type, size);
|
|
||||||
for (i = 0; i < pfncount; i++)
|
|
||||||
gpadl_header->range[0].pfn_array[i] = hv_gpadl_hvpfn(
|
|
||||||
type, kbuffer, size, send_offset, i);
|
|
||||||
*msginfo = msgheader;
|
|
||||||
|
|
||||||
pfnsum = pfncount;
|
|
||||||
pfnleft = pagecount - pfncount;
|
|
||||||
|
|
||||||
/* how many pfns can we fit in a body message */
|
|
||||||
pfnsize = MAX_SIZE_CHANNEL_MESSAGE -
|
|
||||||
sizeof(struct vmbus_channel_gpadl_body);
|
|
||||||
pfncount = pfnsize / sizeof(u64);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If pfnleft is zero, everything fits in the header and no body
|
* Gpadl is u32 and we are using a pointer which could
|
||||||
* messages are needed
|
* be 64-bit
|
||||||
|
* This is governed by the guest/host protocol and
|
||||||
|
* so the hypervisor guarantees that this is ok.
|
||||||
*/
|
*/
|
||||||
while (pfnleft) {
|
for (i = 0; i < pfncurr; i++)
|
||||||
pfncurr = umin(pfncount, pfnleft);
|
gpadl_body->pfn[i] = hv_gpadl_hvpfn(type,
|
||||||
msgsize = sizeof(struct vmbus_channel_msginfo) +
|
kbuffer, size, send_offset, pfnsum + i);
|
||||||
sizeof(struct vmbus_channel_gpadl_body) +
|
|
||||||
pfncurr * sizeof(u64);
|
|
||||||
msgbody = kzalloc(msgsize, GFP_KERNEL);
|
|
||||||
|
|
||||||
if (!msgbody) {
|
/* add to msg header */
|
||||||
struct vmbus_channel_msginfo *pos = NULL;
|
list_add_tail(&msgbody->msglistentry, &msgheader->submsglist);
|
||||||
struct vmbus_channel_msginfo *tmp = NULL;
|
pfnsum += pfncurr;
|
||||||
/*
|
pfnleft -= pfncurr;
|
||||||
* Free up all the allocated messages.
|
}
|
||||||
*/
|
|
||||||
list_for_each_entry_safe(pos, tmp,
|
|
||||||
&msgheader->submsglist,
|
|
||||||
msglistentry) {
|
|
||||||
|
|
||||||
list_del(&pos->msglistentry);
|
|
||||||
kfree(pos);
|
|
||||||
}
|
|
||||||
kfree(msgheader);
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
msgbody->msgsize = msgsize;
|
|
||||||
gpadl_body =
|
|
||||||
(struct vmbus_channel_gpadl_body *)msgbody->msg;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Gpadl is u32 and we are using a pointer which could
|
|
||||||
* be 64-bit
|
|
||||||
* This is governed by the guest/host protocol and
|
|
||||||
* so the hypervisor guarantees that this is ok.
|
|
||||||
*/
|
|
||||||
for (i = 0; i < pfncurr; i++)
|
|
||||||
gpadl_body->pfn[i] = hv_gpadl_hvpfn(type,
|
|
||||||
kbuffer, size, send_offset, pfnsum + i);
|
|
||||||
|
|
||||||
/* add to msg header */
|
|
||||||
list_add_tail(&msgbody->msglistentry,
|
|
||||||
&msgheader->submsglist);
|
|
||||||
pfnsum += pfncurr;
|
|
||||||
pfnleft -= pfncurr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user