mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
hyperv: Add support for physically discontinuous receive buffer
This will allow us to use bigger receive buffer, and prevent allocation failure due to fragmented memory. Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: K. Y. Srinivasan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
731073b9c9
commit
b679ef73ed
3 changed files with 11 additions and 12 deletions
|
|
@ -209,7 +209,6 @@ static int create_gpadl_header(void *kbuffer, u32 size,
|
|||
{
|
||||
int i;
|
||||
int pagecount;
|
||||
unsigned long long pfn;
|
||||
struct vmbus_channel_gpadl_header *gpadl_header;
|
||||
struct vmbus_channel_gpadl_body *gpadl_body;
|
||||
struct vmbus_channel_msginfo *msgheader;
|
||||
|
|
@ -219,7 +218,6 @@ static int create_gpadl_header(void *kbuffer, u32 size,
|
|||
int pfnsum, pfncount, pfnleft, pfncurr, pfnsize;
|
||||
|
||||
pagecount = size >> PAGE_SHIFT;
|
||||
pfn = virt_to_phys(kbuffer) >> PAGE_SHIFT;
|
||||
|
||||
/* do we need a gpadl body msg */
|
||||
pfnsize = MAX_SIZE_CHANNEL_MESSAGE -
|
||||
|
|
@ -248,7 +246,8 @@ static int create_gpadl_header(void *kbuffer, u32 size,
|
|||
gpadl_header->range[0].byte_offset = 0;
|
||||
gpadl_header->range[0].byte_count = size;
|
||||
for (i = 0; i < pfncount; i++)
|
||||
gpadl_header->range[0].pfn_array[i] = pfn+i;
|
||||
gpadl_header->range[0].pfn_array[i] = slow_virt_to_phys(
|
||||
kbuffer + PAGE_SIZE * i) >> PAGE_SHIFT;
|
||||
*msginfo = msgheader;
|
||||
*messagecount = 1;
|
||||
|
||||
|
|
@ -301,7 +300,9 @@ static int create_gpadl_header(void *kbuffer, u32 size,
|
|||
* so the hypervisor gurantees that this is ok.
|
||||
*/
|
||||
for (i = 0; i < pfncurr; i++)
|
||||
gpadl_body->pfn[i] = pfn + pfnsum + i;
|
||||
gpadl_body->pfn[i] = slow_virt_to_phys(
|
||||
kbuffer + PAGE_SIZE * (pfnsum + i)) >>
|
||||
PAGE_SHIFT;
|
||||
|
||||
/* add to msg header */
|
||||
list_add_tail(&msgbody->msglistentry,
|
||||
|
|
@ -327,7 +328,8 @@ static int create_gpadl_header(void *kbuffer, u32 size,
|
|||
gpadl_header->range[0].byte_offset = 0;
|
||||
gpadl_header->range[0].byte_count = size;
|
||||
for (i = 0; i < pagecount; i++)
|
||||
gpadl_header->range[0].pfn_array[i] = pfn+i;
|
||||
gpadl_header->range[0].pfn_array[i] = slow_virt_to_phys(
|
||||
kbuffer + PAGE_SIZE * i) >> PAGE_SHIFT;
|
||||
|
||||
*msginfo = msgheader;
|
||||
*messagecount = 1;
|
||||
|
|
@ -344,7 +346,7 @@ nomem:
|
|||
* vmbus_establish_gpadl - Estabish a GPADL for the specified buffer
|
||||
*
|
||||
* @channel: a channel
|
||||
* @kbuffer: from kmalloc
|
||||
* @kbuffer: from kmalloc or vmalloc
|
||||
* @size: page-size multiple
|
||||
* @gpadl_handle: some funky thing
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue