diff options
| author | Haiyang Zhang <haiyangz@microsoft.com> | 2014-08-15 15:18:19 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-08-22 15:23:09 -0400 |
| commit | f90251c8a6d06ed8b072a2a0f13c4b8a6d0cb222 (patch) | |
| tree | 26e9356163f8f68f438e823cd99f7fafbbe60b21 /drivers/net/hyperv | |
| parent | c9d26423e56ce1ab4d786f92aebecf859d419293 (diff) | |
hyperv: Increase the buffer length for netvsc_channel_cb()
When the buffer is too small for a packet from VMBus, a bigger buffer will be
allocated in netvsc_channel_cb() and retry reading the packet from VMBus.
Increasing this buffer size will reduce the retry overhead.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv')
| -rw-r--r-- | drivers/net/hyperv/hyperv_net.h | 4 | ||||
| -rw-r--r-- | drivers/net/hyperv/netvsc.c | 16 |
2 files changed, 16 insertions, 4 deletions
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index d5e07def6a59..2f48f790c9b4 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h | |||
| @@ -591,7 +591,7 @@ struct nvsp_message { | |||
| 591 | 591 | ||
| 592 | #define NETVSC_RECEIVE_BUFFER_ID 0xcafe | 592 | #define NETVSC_RECEIVE_BUFFER_ID 0xcafe |
| 593 | 593 | ||
| 594 | #define NETVSC_PACKET_SIZE 2048 | 594 | #define NETVSC_PACKET_SIZE 4096 |
| 595 | 595 | ||
| 596 | #define VRSS_SEND_TAB_SIZE 16 | 596 | #define VRSS_SEND_TAB_SIZE 16 |
| 597 | 597 | ||
| @@ -642,7 +642,7 @@ struct netvsc_device { | |||
| 642 | int ring_size; | 642 | int ring_size; |
| 643 | 643 | ||
| 644 | /* The primary channel callback buffer */ | 644 | /* The primary channel callback buffer */ |
| 645 | unsigned char cb_buffer[NETVSC_PACKET_SIZE]; | 645 | unsigned char *cb_buffer; |
| 646 | /* The sub channel callback buffer */ | 646 | /* The sub channel callback buffer */ |
| 647 | unsigned char *sub_cb_buf; | 647 | unsigned char *sub_cb_buf; |
| 648 | }; | 648 | }; |
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 66979cf7fca6..5b5644a2233c 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
| @@ -42,6 +42,12 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device) | |||
| 42 | if (!net_device) | 42 | if (!net_device) |
| 43 | return NULL; | 43 | return NULL; |
| 44 | 44 | ||
| 45 | net_device->cb_buffer = kzalloc(NETVSC_PACKET_SIZE, GFP_KERNEL); | ||
| 46 | if (!net_device->cb_buffer) { | ||
| 47 | kfree(net_device); | ||
| 48 | return NULL; | ||
| 49 | } | ||
| 50 | |||
| 45 | init_waitqueue_head(&net_device->wait_drain); | 51 | init_waitqueue_head(&net_device->wait_drain); |
| 46 | net_device->start_remove = false; | 52 | net_device->start_remove = false; |
| 47 | net_device->destroy = false; | 53 | net_device->destroy = false; |
| @@ -52,6 +58,12 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device) | |||
| 52 | return net_device; | 58 | return net_device; |
| 53 | } | 59 | } |
| 54 | 60 | ||
| 61 | static void free_netvsc_device(struct netvsc_device *nvdev) | ||
| 62 | { | ||
| 63 | kfree(nvdev->cb_buffer); | ||
| 64 | kfree(nvdev); | ||
| 65 | } | ||
| 66 | |||
| 55 | static struct netvsc_device *get_outbound_net_device(struct hv_device *device) | 67 | static struct netvsc_device *get_outbound_net_device(struct hv_device *device) |
| 56 | { | 68 | { |
| 57 | struct netvsc_device *net_device; | 69 | struct netvsc_device *net_device; |
| @@ -551,7 +563,7 @@ int netvsc_device_remove(struct hv_device *device) | |||
| 551 | if (net_device->sub_cb_buf) | 563 | if (net_device->sub_cb_buf) |
| 552 | vfree(net_device->sub_cb_buf); | 564 | vfree(net_device->sub_cb_buf); |
| 553 | 565 | ||
| 554 | kfree(net_device); | 566 | free_netvsc_device(net_device); |
| 555 | return 0; | 567 | return 0; |
| 556 | } | 568 | } |
| 557 | 569 | ||
| @@ -1093,7 +1105,7 @@ close: | |||
| 1093 | vmbus_close(device->channel); | 1105 | vmbus_close(device->channel); |
| 1094 | 1106 | ||
| 1095 | cleanup: | 1107 | cleanup: |
| 1096 | kfree(net_device); | 1108 | free_netvsc_device(net_device); |
| 1097 | 1109 | ||
| 1098 | return ret; | 1110 | return ret; |
| 1099 | } | 1111 | } |
