]> git.ipfire.org Git - people/ms/linux.git/commitdiff
Drivers: net: hyperv: Get rid of the rndis_filter_packet structure
authorKY Srinivasan <kys@microsoft.com>
Mon, 17 Feb 2014 00:38:43 +0000 (16:38 -0800)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 15 Dec 2015 15:45:30 +0000 (15:45 +0000)
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>
drivers/net/hyperv/hyperv_net.h
drivers/net/hyperv/netvsc_drv.c
drivers/net/hyperv/rndis_filter.c

index 7b594ce3f21db2102139e8802d4d9e69bb61a3e8..7645ba38bde8059f058e6d112956df4055c7a3d7 100644 (file)
@@ -846,12 +846,6 @@ struct rndis_message {
 };
 
 
-struct rndis_filter_packet {
-       void *completion_ctx;
-       void (*completion)(void *context);
-       struct rndis_message msg;
-};
-
 /* Handy macros */
 
 /* get the size of an RNDIS message. Pass in the message type, */
index 3c1c33ceffba1d08ebd3835c8fa91be5424f68d3..28020f83ba6f57215b9e925992e8361bfb6b8233 100644 (file)
@@ -156,7 +156,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
        /* Allocate a netvsc packet based on # of frags. */
        packet = kzalloc(sizeof(struct hv_netvsc_packet) +
                         (num_pages * sizeof(struct hv_page_buffer)) +
-                        sizeof(struct rndis_filter_packet) +
+                        sizeof(struct rndis_message) +
                         NDIS_VLAN_PPI_SIZE, GFP_ATOMIC);
        if (!packet) {
                /* out of memory, drop packet */
index b54fd257652bb629b8228162712bb557e9023943..6a9f6021f09c9353008bc74a52917e6edf5d2ca1 100644 (file)
@@ -58,9 +58,6 @@ struct rndis_request {
        u8 request_ext[RNDIS_EXT_LEN];
 };
 
-static void rndis_filter_send_completion(void *ctx);
-
-
 static struct rndis_device *get_rndis_device(void)
 {
        struct rndis_device *device;
@@ -297,7 +294,7 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
                                "rndis response buffer overflow "
                                "detected (size %u max %zu)\n",
                                resp->msg_len,
-                               sizeof(struct rndis_filter_packet));
+                               sizeof(struct rndis_message));
 
                        if (resp->ndis_msg_type ==
                            RNDIS_MSG_RESET_C) {
@@ -917,17 +914,14 @@ int rndis_filter_close(struct hv_device *dev)
 int rndis_filter_send(struct hv_device *dev,
                             struct hv_netvsc_packet *pkt)
 {
-       int ret;
-       struct rndis_filter_packet *filter_pkt;
        struct rndis_message *rndis_msg;
        struct rndis_packet *rndis_pkt;
        u32 rndis_msg_size;
        bool isvlan = pkt->vlan_tci & VLAN_TAG_PRESENT;
 
        /* Add the rndis header */
-       filter_pkt = (struct rndis_filter_packet *)pkt->extension;
+       rndis_msg = (struct rndis_message *)pkt->extension;
 
-       rndis_msg = &filter_pkt->msg;
        rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet);
        if (isvlan)
                rndis_msg_size += NDIS_VLAN_PPI_SIZE;
@@ -980,34 +974,5 @@ int rndis_filter_send(struct hv_device *dev,
                pkt->page_buf[1].len = rndis_msg_size - pkt->page_buf[0].len;
        }
 
-       /* Save the packet send completion and context */
-       filter_pkt->completion = pkt->completion.send.send_completion;
-       filter_pkt->completion_ctx =
-                               pkt->completion.send.send_completion_ctx;
-
-       /* Use ours */
-       pkt->completion.send.send_completion = rndis_filter_send_completion;
-       pkt->completion.send.send_completion_ctx = filter_pkt;
-
-       ret = netvsc_send(dev, pkt);
-       if (ret != 0) {
-               /*
-                * Reset the completion to originals to allow retries from
-                * above
-                */
-               pkt->completion.send.send_completion =
-                               filter_pkt->completion;
-               pkt->completion.send.send_completion_ctx =
-                               filter_pkt->completion_ctx;
-       }
-
-       return ret;
-}
-
-static void rndis_filter_send_completion(void *ctx)
-{
-       struct rndis_filter_packet *filter_pkt = ctx;
-
-       /* Pass it back to the original handler */
-       filter_pkt->completion(filter_pkt->completion_ctx);
+       return netvsc_send(dev, pkt);
 }