wok-next annotate ndiswrapper-driver/stuff/kernel-2.6.35.patch @ rev 7372

Up: lftp to 4.1.1.
author Christopher Rogers <slaxemulator@gmail.com>
date Wed Nov 24 18:03:17 2010 +0000 (2010-11-24)
parents
children
rev   line source
slaxemulator@7135 1 diff -uNr ndiswrapper-1.56.old/driver/usb.c ndiswrapper-1.56/driver/usb.c
slaxemulator@7135 2 --- ndiswrapper-1.56.old/driver/usb.c 2010-02-10 18:09:32.000000000 -0800
slaxemulator@7135 3 +++ ndiswrapper-1.56/driver/usb.c 2010-07-25 02:29:25.442145846 -0700
slaxemulator@7135 4 @@ -191,9 +191,15 @@
slaxemulator@7135 5 if (wrap_urb->flags & WRAP_URB_COPY_BUFFER) {
slaxemulator@7135 6 USBTRACE("freeing DMA buffer for URB: %p %p",
slaxemulator@7135 7 urb, urb->transfer_buffer);
slaxemulator@7135 8 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
slaxemulator@7135 9 usb_buffer_free(IRP_WRAP_DEVICE(irp)->usb.udev,
slaxemulator@7135 10 + urb->transfer_buffer_length,
slaxemulator@7135 11 + urb->transfer_buffer, urb->transfer_dma);
slaxemulator@7135 12 +#else
slaxemulator@7135 13 + usb_free_coherent(IRP_WRAP_DEVICE(irp)->usb.udev,
slaxemulator@7135 14 urb->transfer_buffer_length,
slaxemulator@7135 15 urb->transfer_buffer, urb->transfer_dma);
slaxemulator@7135 16 +#endif
slaxemulator@7135 17 }
slaxemulator@7135 18 if (urb->setup_packet)
slaxemulator@7135 19 kfree(urb->setup_packet);
slaxemulator@7135 20 @@ -303,9 +309,16 @@
slaxemulator@7135 21 || PageHighMem(virt_to_page(buf))
slaxemulator@7135 22 #endif
slaxemulator@7135 23 )) {
slaxemulator@7135 24 +
slaxemulator@7135 25 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
slaxemulator@7135 26 urb->transfer_buffer =
slaxemulator@7135 27 - usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
slaxemulator@7135 28 + usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
slaxemulator@7135 29 + &urb->transfer_dma);
slaxemulator@7135 30 +#else
slaxemulator@7135 31 + urb->transfer_buffer =
slaxemulator@7135 32 + usb_alloc_coherent(wd->usb.udev, buf_len, alloc_flags,
slaxemulator@7135 33 &urb->transfer_dma);
slaxemulator@7135 34 +#endif
slaxemulator@7135 35 if (!urb->transfer_buffer) {
slaxemulator@7135 36 WARNING("couldn't allocate dma buf");
slaxemulator@7135 37 IoAcquireCancelSpinLock(&irp->cancel_irql);
slaxemulator@7135 38 diff -uNr ndiswrapper-1.56.old/driver/wrapndis.c ndiswrapper-1.56/driver/wrapndis.c
slaxemulator@7135 39 --- ndiswrapper-1.56.old/driver/wrapndis.c 2010-02-10 18:09:32.000000000 -0800
slaxemulator@7135 40 +++ ndiswrapper-1.56/driver/wrapndis.c 2010-07-25 02:06:13.184631757 -0700
slaxemulator@7135 41 @@ -936,6 +936,10 @@
slaxemulator@7135 42 EXIT2(return);
slaxemulator@7135 43 }
slaxemulator@7135 44
slaxemulator@7135 45 +#ifndef netdev_mc_count
slaxemulator@7135 46 +#define netdev_mc_count(net_dev) net_dev->mc_count
slaxemulator@7135 47 +#endif
slaxemulator@7135 48 +
slaxemulator@7135 49 static void set_multicast_list(struct ndis_device *wnd)
slaxemulator@7135 50 {
slaxemulator@7135 51 struct net_device *net_dev;
slaxemulator@7135 52 @@ -950,20 +954,26 @@
slaxemulator@7135 53 packet_filter |= NDIS_PACKET_TYPE_PROMISCUOUS |
slaxemulator@7135 54 NDIS_PACKET_TYPE_ALL_LOCAL;
slaxemulator@7135 55 } else if (net_dev->flags & IFF_ALLMULTI ||
slaxemulator@7135 56 - net_dev->mc_count > wnd->multicast_size) {
slaxemulator@7135 57 + netdev_mc_count(net_dev) > wnd->multicast_size) {
slaxemulator@7135 58 packet_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
slaxemulator@7135 59 TRACE2("0x%08x", packet_filter);
slaxemulator@7135 60 - } else if (net_dev->mc_count > 0) {
slaxemulator@7135 61 + } else if (netdev_mc_count(net_dev) > 0) {
slaxemulator@7135 62 int i, size;
slaxemulator@7135 63 char *buf;
slaxemulator@7135 64 +#ifndef netdev_for_each_mc_addr
slaxemulator@7135 65 struct dev_mc_list *mclist;
slaxemulator@7135 66 - size = min(wnd->multicast_size, net_dev->mc_count);
slaxemulator@7135 67 - TRACE2("%d, %d", wnd->multicast_size, net_dev->mc_count);
slaxemulator@7135 68 +#else
slaxemulator@7135 69 + struct netdev_hw_addr *mclist;
slaxemulator@7135 70 +#endif
slaxemulator@7135 71 +
slaxemulator@7135 72 + size = min(wnd->multicast_size, netdev_mc_count(net_dev));
slaxemulator@7135 73 + TRACE2("%d, %d", wnd->multicast_size, netdev_mc_count(net_dev));
slaxemulator@7135 74 buf = kmalloc(size * ETH_ALEN, GFP_KERNEL);
slaxemulator@7135 75 if (!buf) {
slaxemulator@7135 76 WARNING("couldn't allocate memory");
slaxemulator@7135 77 EXIT2(return);
slaxemulator@7135 78 }
slaxemulator@7135 79 +#ifndef netdev_for_each_mc_addr
slaxemulator@7135 80 mclist = net_dev->mc_list;
slaxemulator@7135 81 for (i = 0; i < size && mclist; mclist = mclist->next) {
slaxemulator@7135 82 if (mclist->dmi_addrlen != ETH_ALEN)
slaxemulator@7135 83 @@ -972,6 +982,15 @@
slaxemulator@7135 84 TRACE2(MACSTRSEP, MAC2STR(mclist->dmi_addr));
slaxemulator@7135 85 i++;
slaxemulator@7135 86 }
slaxemulator@7135 87 +#else
slaxemulator@7135 88 + i = 0;
slaxemulator@7135 89 + netdev_for_each_mc_addr(mclist, net_dev){
slaxemulator@7135 90 + memcpy(buf + i++ * ETH_ALEN,
slaxemulator@7135 91 + mclist->addr, ETH_ALEN);
slaxemulator@7135 92 + TRACE2(MACSTRSEP, MAC2STR(mclist->addr));
slaxemulator@7135 93 +
slaxemulator@7135 94 + }
slaxemulator@7135 95 +#endif
slaxemulator@7135 96 res = mp_set(wnd, OID_802_3_MULTICAST_LIST, buf, i * ETH_ALEN);
slaxemulator@7135 97 if (res == NDIS_STATUS_SUCCESS && i > 0)
slaxemulator@7135 98 packet_filter |= NDIS_PACKET_TYPE_MULTICAST;