diff options
author | Haiyang Zhang <haiyangz@microsoft.com> | 2012-10-02 01:30:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-02 14:39:31 -0400 |
commit | a3a6cab5ea10cca64d036851fe0d932448f2fe4f (patch) | |
tree | 2b8c84eed31e455fef949bf5a47602e7f982514b | |
parent | 63f6921d300c6fbdca3d0e73dcc24b4e5e4dced2 (diff) |
hyperv: Add buffer for extended info after the RNDIS response message.
In some response messages, there may be some extended info after the
message.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/hyperv/rndis_filter.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index e7e12cfbbf37..928148cc3220 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c | |||
@@ -32,16 +32,19 @@ | |||
32 | #include "hyperv_net.h" | 32 | #include "hyperv_net.h" |
33 | 33 | ||
34 | 34 | ||
35 | #define RNDIS_EXT_LEN 100 | ||
35 | struct rndis_request { | 36 | struct rndis_request { |
36 | struct list_head list_ent; | 37 | struct list_head list_ent; |
37 | struct completion wait_event; | 38 | struct completion wait_event; |
38 | 39 | ||
40 | struct rndis_message response_msg; | ||
39 | /* | 41 | /* |
40 | * FIXME: We assumed a fixed size response here. If we do ever need to | 42 | * The buffer for extended info after the RNDIS response message. It's |
41 | * handle a bigger response, we can either define a max response | 43 | * referenced based on the data offset in the RNDIS message. Its size |
42 | * message or add a response buffer variable above this field | 44 | * is enough for current needs, and should be sufficient for the near |
45 | * future. | ||
43 | */ | 46 | */ |
44 | struct rndis_message response_msg; | 47 | u8 response_ext[RNDIS_EXT_LEN]; |
45 | 48 | ||
46 | /* Simplify allocation by having a netvsc packet inline */ | 49 | /* Simplify allocation by having a netvsc packet inline */ |
47 | struct hv_netvsc_packet pkt; | 50 | struct hv_netvsc_packet pkt; |
@@ -50,12 +53,10 @@ struct rndis_request { | |||
50 | 53 | ||
51 | struct rndis_message request_msg; | 54 | struct rndis_message request_msg; |
52 | /* | 55 | /* |
53 | * The buffer for the extended info after the RNDIS message. It's | 56 | * The buffer for the extended info after the RNDIS request message. |
54 | * referenced based on the data offset in the RNDIS message. Its size | 57 | * It is referenced and sized in a similar way as response_ext. |
55 | * is enough for current needs, and should be sufficient for the near | ||
56 | * future. | ||
57 | */ | 58 | */ |
58 | u8 ext[100]; | 59 | u8 request_ext[RNDIS_EXT_LEN]; |
59 | }; | 60 | }; |
60 | 61 | ||
61 | static void rndis_filter_send_completion(void *ctx); | 62 | static void rndis_filter_send_completion(void *ctx); |
@@ -274,7 +275,8 @@ static void rndis_filter_receive_response(struct rndis_device *dev, | |||
274 | spin_unlock_irqrestore(&dev->request_lock, flags); | 275 | spin_unlock_irqrestore(&dev->request_lock, flags); |
275 | 276 | ||
276 | if (found) { | 277 | if (found) { |
277 | if (resp->msg_len <= sizeof(struct rndis_message)) { | 278 | if (resp->msg_len <= |
279 | sizeof(struct rndis_message) + RNDIS_EXT_LEN) { | ||
278 | memcpy(&request->response_msg, resp, | 280 | memcpy(&request->response_msg, resp, |
279 | resp->msg_len); | 281 | resp->msg_len); |
280 | } else { | 282 | } else { |