]>
Commit | Line | Data |
---|---|---|
a7b0967d MT |
1 | From f3f885fa684ff18fa4d223dc22b782f5e5d32560 Mon Sep 17 00:00:00 2001 |
2 | From: KY Srinivasan <kys@microsoft.com> | |
3 | Date: Sun, 16 Feb 2014 16:38:43 -0800 | |
4 | Subject: [PATCH 01/25] Drivers: net: hyperv: Get rid of the | |
5 | rndis_filter_packet structure | |
6 | ||
7 | This structure is redundant; get rid of it make the code little more efficient - | |
8 | get rid of the unnecessary indirection. | |
9 | ||
10 | Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> | |
11 | Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> | |
12 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
13 | --- | |
14 | drivers/net/hyperv/hyperv_net.h | 6 ------ | |
15 | drivers/net/hyperv/netvsc_drv.c | 2 +- | |
16 | drivers/net/hyperv/rndis_filter.c | 41 +++------------------------------------ | |
17 | 3 files changed, 4 insertions(+), 45 deletions(-) | |
18 | ||
19 | diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h | |
20 | index 7b594ce3f21d..7645ba38bde8 100644 | |
21 | --- a/drivers/net/hyperv/hyperv_net.h | |
22 | +++ b/drivers/net/hyperv/hyperv_net.h | |
23 | @@ -846,12 +846,6 @@ struct rndis_message { | |
24 | }; | |
25 | ||
26 | ||
27 | -struct rndis_filter_packet { | |
28 | - void *completion_ctx; | |
29 | - void (*completion)(void *context); | |
30 | - struct rndis_message msg; | |
31 | -}; | |
32 | - | |
33 | /* Handy macros */ | |
34 | ||
35 | /* get the size of an RNDIS message. Pass in the message type, */ | |
36 | diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c | |
37 | index 3c1c33ceffba..28020f83ba6f 100644 | |
38 | --- a/drivers/net/hyperv/netvsc_drv.c | |
39 | +++ b/drivers/net/hyperv/netvsc_drv.c | |
40 | @@ -156,7 +156,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) | |
41 | /* Allocate a netvsc packet based on # of frags. */ | |
42 | packet = kzalloc(sizeof(struct hv_netvsc_packet) + | |
43 | (num_pages * sizeof(struct hv_page_buffer)) + | |
44 | - sizeof(struct rndis_filter_packet) + | |
45 | + sizeof(struct rndis_message) + | |
46 | NDIS_VLAN_PPI_SIZE, GFP_ATOMIC); | |
47 | if (!packet) { | |
48 | /* out of memory, drop packet */ | |
49 | diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c | |
50 | index b54fd257652b..6a9f6021f09c 100644 | |
51 | --- a/drivers/net/hyperv/rndis_filter.c | |
52 | +++ b/drivers/net/hyperv/rndis_filter.c | |
53 | @@ -58,9 +58,6 @@ struct rndis_request { | |
54 | u8 request_ext[RNDIS_EXT_LEN]; | |
55 | }; | |
56 | ||
57 | -static void rndis_filter_send_completion(void *ctx); | |
58 | - | |
59 | - | |
60 | static struct rndis_device *get_rndis_device(void) | |
61 | { | |
62 | struct rndis_device *device; | |
63 | @@ -297,7 +294,7 @@ static void rndis_filter_receive_response(struct rndis_device *dev, | |
64 | "rndis response buffer overflow " | |
65 | "detected (size %u max %zu)\n", | |
66 | resp->msg_len, | |
67 | - sizeof(struct rndis_filter_packet)); | |
68 | + sizeof(struct rndis_message)); | |
69 | ||
70 | if (resp->ndis_msg_type == | |
71 | RNDIS_MSG_RESET_C) { | |
72 | @@ -917,17 +914,14 @@ int rndis_filter_close(struct hv_device *dev) | |
73 | int rndis_filter_send(struct hv_device *dev, | |
74 | struct hv_netvsc_packet *pkt) | |
75 | { | |
76 | - int ret; | |
77 | - struct rndis_filter_packet *filter_pkt; | |
78 | struct rndis_message *rndis_msg; | |
79 | struct rndis_packet *rndis_pkt; | |
80 | u32 rndis_msg_size; | |
81 | bool isvlan = pkt->vlan_tci & VLAN_TAG_PRESENT; | |
82 | ||
83 | /* Add the rndis header */ | |
84 | - filter_pkt = (struct rndis_filter_packet *)pkt->extension; | |
85 | + rndis_msg = (struct rndis_message *)pkt->extension; | |
86 | ||
87 | - rndis_msg = &filter_pkt->msg; | |
88 | rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet); | |
89 | if (isvlan) | |
90 | rndis_msg_size += NDIS_VLAN_PPI_SIZE; | |
91 | @@ -980,34 +974,5 @@ int rndis_filter_send(struct hv_device *dev, | |
92 | pkt->page_buf[1].len = rndis_msg_size - pkt->page_buf[0].len; | |
93 | } | |
94 | ||
95 | - /* Save the packet send completion and context */ | |
96 | - filter_pkt->completion = pkt->completion.send.send_completion; | |
97 | - filter_pkt->completion_ctx = | |
98 | - pkt->completion.send.send_completion_ctx; | |
99 | - | |
100 | - /* Use ours */ | |
101 | - pkt->completion.send.send_completion = rndis_filter_send_completion; | |
102 | - pkt->completion.send.send_completion_ctx = filter_pkt; | |
103 | - | |
104 | - ret = netvsc_send(dev, pkt); | |
105 | - if (ret != 0) { | |
106 | - /* | |
107 | - * Reset the completion to originals to allow retries from | |
108 | - * above | |
109 | - */ | |
110 | - pkt->completion.send.send_completion = | |
111 | - filter_pkt->completion; | |
112 | - pkt->completion.send.send_completion_ctx = | |
113 | - filter_pkt->completion_ctx; | |
114 | - } | |
115 | - | |
116 | - return ret; | |
117 | -} | |
118 | - | |
119 | -static void rndis_filter_send_completion(void *ctx) | |
120 | -{ | |
121 | - struct rndis_filter_packet *filter_pkt = ctx; | |
122 | - | |
123 | - /* Pass it back to the original handler */ | |
124 | - filter_pkt->completion(filter_pkt->completion_ctx); | |
125 | + return netvsc_send(dev, pkt); | |
126 | } | |
127 | -- | |
128 | 2.4.3 | |
129 |