]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/staging/hv/rndis_filter.c
Merge staging-next tree into Linus's latest version
[net-next-2.6.git] / drivers / staging / hv / rndis_filter.c
similarity index 96%
rename from drivers/staging/hv/RndisFilter.c
rename to drivers/staging/hv/rndis_filter.c
index 6704f64c93f0bf329733f7b35502a045b715cb97..5edf0853c6afe03d3340253d647380c1a9c1a189 100644 (file)
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <linux/io.h>
+#include <linux/if_ether.h>
+
 #include "osd.h"
 #include "logging.h"
-#include "NetVscApi.h"
-#include "RndisFilter.h"
+#include "netvsc_api.h"
+#include "rndis_filter.h"
 
 /* Data types */
 struct rndis_filter_driver_object {
@@ -50,7 +52,7 @@ struct rndis_device {
        spinlock_t request_lock;
        struct list_head RequestList;
 
-       unsigned char HwMacAddr[HW_MACADDR_LEN];
+       unsigned char HwMacAddr[ETH_ALEN];
 };
 
 struct rndis_request {
@@ -354,8 +356,8 @@ static void RndisFilterReceiveData(struct rndis_device *Device,
        DPRINT_ENTER(NETVSC);
 
        /* empty ethernet frame ?? */
-       ASSERT(Packet->PageBuffers[0].Length >
-               RNDIS_MESSAGE_SIZE(struct rndis_packet));
+       /* ASSERT(Packet->PageBuffers[0].Length > */
+       /*      RNDIS_MESSAGE_SIZE(struct rndis_packet)); */
 
        rndisPacket = &Message->Message.Packet;
 
@@ -389,7 +391,9 @@ static int RndisFilterOnReceive(struct hv_device *Device,
 
        DPRINT_ENTER(NETVSC);
 
-       ASSERT(netDevice);
+       if (!netDevice)
+               return -EINVAL;
+
        /* Make sure the rndis device state is initialized */
        if (!netDevice->Extension) {
                DPRINT_ERR(NETVSC, "got rndis message but no rndis device..."
@@ -490,7 +494,8 @@ static int RndisFilterQueryDevice(struct rndis_device *Device, u32 Oid,
 
        DPRINT_ENTER(NETVSC);
 
-       ASSERT(Result);
+       if (!Result)
+               return -EINVAL;
 
        *ResultSize = 0;
        request = GetRndisRequest(Device, REMOTE_NDIS_QUERY_MSG,
@@ -538,7 +543,7 @@ Cleanup:
 
 static int RndisFilterQueryDeviceMac(struct rndis_device *Device)
 {
-       u32 size = HW_MACADDR_LEN;
+       u32 size = ETH_ALEN;
 
        return RndisFilterQueryDevice(Device,
                                      RNDIS_OID_802_3_PERMANENT_ADDRESS,
@@ -565,8 +570,8 @@ static int RndisFilterSetPacketFilter(struct rndis_device *Device,
 
        DPRINT_ENTER(NETVSC);
 
-       ASSERT(RNDIS_MESSAGE_SIZE(struct rndis_set_request) + sizeof(u32) <=
-               sizeof(struct rndis_message));
+       /* ASSERT(RNDIS_MESSAGE_SIZE(struct rndis_set_request) + sizeof(u32) <= */
+       /*      sizeof(struct rndis_message)); */
 
        request = GetRndisRequest(Device, REMOTE_NDIS_SET_MSG,
                        RNDIS_MESSAGE_SIZE(struct rndis_set_request) +
@@ -622,7 +627,6 @@ int RndisFilterInit(struct netvsc_driver *Driver)
                   sizeof(struct rndis_filter_packet));
 
        Driver->RequestExtSize = sizeof(struct rndis_filter_packet);
-       Driver->AdditionalRequestPageBufferCount = 1; /* For rndis header */
 
        /* Driver->Context = rndisDriver; */
 
@@ -639,8 +643,8 @@ int RndisFilterInit(struct netvsc_driver *Driver)
                                        Driver->Base.OnDeviceRemove;
        gRndisFilter.InnerDriver.Base.OnCleanup = Driver->Base.OnCleanup;
 
-       ASSERT(Driver->OnSend);
-       ASSERT(Driver->OnReceiveCallback);
+       /* ASSERT(Driver->OnSend); */
+       /* ASSERT(Driver->OnReceiveCallback); */
        gRndisFilter.InnerDriver.OnSend = Driver->OnSend;
        gRndisFilter.InnerDriver.OnReceiveCallback = Driver->OnReceiveCallback;
        gRndisFilter.InnerDriver.OnLinkStatusChanged =
@@ -811,8 +815,8 @@ static int RndisFilterOnDeviceAdd(struct hv_device *Device,
 
        /* Initialize the rndis device */
        netDevice = Device->Extension;
-       ASSERT(netDevice);
-       ASSERT(netDevice->Device);
+       /* ASSERT(netDevice); */
+       /* ASSERT(netDevice->Device); */
 
        netDevice->Extension = rndisDevice;
        rndisDevice->NetDevice = netDevice;
@@ -834,16 +838,10 @@ static int RndisFilterOnDeviceAdd(struct hv_device *Device,
                 */
        }
 
-       DPRINT_INFO(NETVSC, "Device 0x%p mac addr %02x%02x%02x%02x%02x%02x",
-                   rndisDevice,
-                   rndisDevice->HwMacAddr[0],
-                   rndisDevice->HwMacAddr[1],
-                   rndisDevice->HwMacAddr[2],
-                   rndisDevice->HwMacAddr[3],
-                   rndisDevice->HwMacAddr[4],
-                   rndisDevice->HwMacAddr[5]);
+       DPRINT_INFO(NETVSC, "Device 0x%p mac addr %pM",
+                   rndisDevice, rndisDevice->HwMacAddr);
 
-       memcpy(deviceInfo->MacAddr, rndisDevice->HwMacAddr, HW_MACADDR_LEN);
+       memcpy(deviceInfo->MacAddr, rndisDevice->HwMacAddr, ETH_ALEN);
 
        RndisFilterQueryDeviceLinkStatus(rndisDevice);
 
@@ -891,7 +889,9 @@ int RndisFilterOnOpen(struct hv_device *Device)
 
        DPRINT_ENTER(NETVSC);
 
-       ASSERT(netDevice);
+       if (!netDevice)
+               return -EINVAL;
+
        ret = RndisFilterOpenDevice(netDevice->Extension);
 
        DPRINT_EXIT(NETVSC);
@@ -906,7 +906,9 @@ int RndisFilterOnClose(struct hv_device *Device)
 
        DPRINT_ENTER(NETVSC);
 
-       ASSERT(netDevice);
+       if (!netDevice)
+               return -EINVAL;
+
        ret = RndisFilterCloseDevice(netDevice->Extension);
 
        DPRINT_EXIT(NETVSC);
@@ -927,7 +929,7 @@ static int RndisFilterOnSend(struct hv_device *Device,
 
        /* Add the rndis header */
        filterPacket = (struct rndis_filter_packet *)Packet->Extension;
-       ASSERT(filterPacket);
+       /* ASSERT(filterPacket); */
 
        memset(filterPacket, 0, sizeof(struct rndis_filter_packet));