aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hyperv
diff options
context:
space:
mode:
authorKY Srinivasan <kys@microsoft.com>2014-02-16 19:38:43 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-17 16:32:31 -0500
commit86eedacc63074dbf304ce9c8b261bef9503c796d (patch)
treea88baf2f49ad8056d62c1408dca7b766ef954d5c /drivers/net/hyperv
parentc1b5994770ad5ae03336b5cdd1e0ad622a870a00 (diff)
Drivers: net: hyperv: Get rid of the rndis_filter_packet structure
This structure is redundant; get rid of it make the code little more efficient - get rid of the unnecessary indirection. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@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.h6
-rw-r--r--drivers/net/hyperv/netvsc_drv.c2
-rw-r--r--drivers/net/hyperv/rndis_filter.c41
3 files changed, 4 insertions, 45 deletions
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 7b594ce3f21d..7645ba38bde8 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -846,12 +846,6 @@ struct rndis_message {
846}; 846};
847 847
848 848
849struct rndis_filter_packet {
850 void *completion_ctx;
851 void (*completion)(void *context);
852 struct rndis_message msg;
853};
854
855/* Handy macros */ 849/* Handy macros */
856 850
857/* get the size of an RNDIS message. Pass in the message type, */ 851/* get the size of an RNDIS message. Pass in the message type, */
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 7756118c2f0a..1eadc136a372 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -146,7 +146,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
146 /* Allocate a netvsc packet based on # of frags. */ 146 /* Allocate a netvsc packet based on # of frags. */
147 packet = kzalloc(sizeof(struct hv_netvsc_packet) + 147 packet = kzalloc(sizeof(struct hv_netvsc_packet) +
148 (num_pages * sizeof(struct hv_page_buffer)) + 148 (num_pages * sizeof(struct hv_page_buffer)) +
149 sizeof(struct rndis_filter_packet) + 149 sizeof(struct rndis_message) +
150 NDIS_VLAN_PPI_SIZE, GFP_ATOMIC); 150 NDIS_VLAN_PPI_SIZE, GFP_ATOMIC);
151 if (!packet) { 151 if (!packet) {
152 /* out of memory, drop packet */ 152 /* out of memory, drop packet */
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 1084e5de3ceb..f0cc8ef21e1c 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -58,9 +58,6 @@ struct rndis_request {
58 u8 request_ext[RNDIS_EXT_LEN]; 58 u8 request_ext[RNDIS_EXT_LEN];
59}; 59};
60 60
61static void rndis_filter_send_completion(void *ctx);
62
63
64static struct rndis_device *get_rndis_device(void) 61static struct rndis_device *get_rndis_device(void)
65{ 62{
66 struct rndis_device *device; 63 struct rndis_device *device;
@@ -277,7 +274,7 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
277 "rndis response buffer overflow " 274 "rndis response buffer overflow "
278 "detected (size %u max %zu)\n", 275 "detected (size %u max %zu)\n",
279 resp->msg_len, 276 resp->msg_len,
280 sizeof(struct rndis_filter_packet)); 277 sizeof(struct rndis_message));
281 278
282 if (resp->ndis_msg_type == 279 if (resp->ndis_msg_type ==
283 RNDIS_MSG_RESET_C) { 280 RNDIS_MSG_RESET_C) {
@@ -898,17 +895,14 @@ int rndis_filter_close(struct hv_device *dev)
898int rndis_filter_send(struct hv_device *dev, 895int rndis_filter_send(struct hv_device *dev,
899 struct hv_netvsc_packet *pkt) 896 struct hv_netvsc_packet *pkt)
900{ 897{
901 int ret;
902 struct rndis_filter_packet *filter_pkt;
903 struct rndis_message *rndis_msg; 898 struct rndis_message *rndis_msg;
904 struct rndis_packet *rndis_pkt; 899 struct rndis_packet *rndis_pkt;
905 u32 rndis_msg_size; 900 u32 rndis_msg_size;
906 bool isvlan = pkt->vlan_tci & VLAN_TAG_PRESENT; 901 bool isvlan = pkt->vlan_tci & VLAN_TAG_PRESENT;
907 902
908 /* Add the rndis header */ 903 /* Add the rndis header */
909 filter_pkt = (struct rndis_filter_packet *)pkt->extension; 904 rndis_msg = (struct rndis_message *)pkt->extension;
910 905
911 rndis_msg = &filter_pkt->msg;
912 rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet); 906 rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet);
913 if (isvlan) 907 if (isvlan)
914 rndis_msg_size += NDIS_VLAN_PPI_SIZE; 908 rndis_msg_size += NDIS_VLAN_PPI_SIZE;
@@ -961,34 +955,5 @@ int rndis_filter_send(struct hv_device *dev,
961 pkt->page_buf[1].len = rndis_msg_size - pkt->page_buf[0].len; 955 pkt->page_buf[1].len = rndis_msg_size - pkt->page_buf[0].len;
962 } 956 }
963 957
964 /* Save the packet send completion and context */ 958 return netvsc_send(dev, pkt);
965 filter_pkt->completion = pkt->completion.send.send_completion;
966 filter_pkt->completion_ctx =
967 pkt->completion.send.send_completion_ctx;
968
969 /* Use ours */
970 pkt->completion.send.send_completion = rndis_filter_send_completion;
971 pkt->completion.send.send_completion_ctx = filter_pkt;
972
973 ret = netvsc_send(dev, pkt);
974 if (ret != 0) {
975 /*
976 * Reset the completion to originals to allow retries from
977 * above
978 */
979 pkt->completion.send.send_completion =
980 filter_pkt->completion;
981 pkt->completion.send.send_completion_ctx =
982 filter_pkt->completion_ctx;
983 }
984
985 return ret;
986}
987
988static void rndis_filter_send_completion(void *ctx)
989{
990 struct rndis_filter_packet *filter_pkt = ctx;
991
992 /* Pass it back to the original handler */
993 filter_pkt->completion(filter_pkt->completion_ctx);
994} 959}