wok rev 7135

Fixed ndiswrapper for kernel 2.6.36.
author Christopher Rogers <slaxemulator@gmail.com>
date Fri Nov 05 18:38:20 2010 +0000 (2010-11-05)
parents 4e1c8501de53
children fa103a35bf04
files ndiswrapper-driver/receipt ndiswrapper-driver/stuff/kernel-2.6.35.patch ndiswrapper-driver/stuff/kernel-2.6.36.patch
line diff
     1.1 --- a/ndiswrapper-driver/receipt	Fri Nov 05 18:33:30 2010 +0000
     1.2 +++ b/ndiswrapper-driver/receipt	Fri Nov 05 18:38:20 2010 +0000
     1.3 @@ -19,6 +19,8 @@
     1.4  	
     1.5  	KERNEL_VERSION=`grep  ^VERSION= $WOK/linux/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
     1.6  	cd $src
     1.7 +	patch -Np2 -i ../stuff/kernel-2.6.35.patch
     1.8 +	patch -Np2 -i ../stuff/kernel-2.6.36.patch
     1.9  	make KBUILD=/usr/src/linux KVER=linux-$KERNEL_VERSION-slitaz
    1.10  }
    1.11  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/ndiswrapper-driver/stuff/kernel-2.6.35.patch	Fri Nov 05 18:38:20 2010 +0000
     2.3 @@ -0,0 +1,98 @@
     2.4 +diff -uNr ndiswrapper-1.56.old/driver/usb.c ndiswrapper-1.56/driver/usb.c
     2.5 +--- ndiswrapper-1.56.old/driver/usb.c	2010-02-10 18:09:32.000000000 -0800
     2.6 ++++ ndiswrapper-1.56/driver/usb.c	2010-07-25 02:29:25.442145846 -0700
     2.7 +@@ -191,9 +191,15 @@
     2.8 + 	if (wrap_urb->flags & WRAP_URB_COPY_BUFFER) {
     2.9 + 		USBTRACE("freeing DMA buffer for URB: %p %p",
    2.10 + 			 urb, urb->transfer_buffer);
    2.11 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
    2.12 + 		usb_buffer_free(IRP_WRAP_DEVICE(irp)->usb.udev,
    2.13 ++                                urb->transfer_buffer_length,
    2.14 ++                                urb->transfer_buffer, urb->transfer_dma);
    2.15 ++#else
    2.16 ++		usb_free_coherent(IRP_WRAP_DEVICE(irp)->usb.udev,
    2.17 + 				urb->transfer_buffer_length,
    2.18 + 				urb->transfer_buffer, urb->transfer_dma);
    2.19 ++#endif
    2.20 + 	}
    2.21 + 	if (urb->setup_packet)
    2.22 + 		kfree(urb->setup_packet);
    2.23 +@@ -303,9 +309,16 @@
    2.24 + 			       || PageHighMem(virt_to_page(buf))
    2.25 + #endif
    2.26 + 		    )) {
    2.27 ++
    2.28 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
    2.29 + 		urb->transfer_buffer =
    2.30 +-			usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
    2.31 ++                        usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
    2.32 ++                                         &urb->transfer_dma);
    2.33 ++#else
    2.34 ++		urb->transfer_buffer =
    2.35 ++			usb_alloc_coherent(wd->usb.udev, buf_len, alloc_flags,
    2.36 + 					 &urb->transfer_dma);
    2.37 ++#endif
    2.38 + 		if (!urb->transfer_buffer) {
    2.39 + 			WARNING("couldn't allocate dma buf");
    2.40 + 			IoAcquireCancelSpinLock(&irp->cancel_irql);
    2.41 +diff -uNr ndiswrapper-1.56.old/driver/wrapndis.c ndiswrapper-1.56/driver/wrapndis.c
    2.42 +--- ndiswrapper-1.56.old/driver/wrapndis.c	2010-02-10 18:09:32.000000000 -0800
    2.43 ++++ ndiswrapper-1.56/driver/wrapndis.c	2010-07-25 02:06:13.184631757 -0700
    2.44 +@@ -936,6 +936,10 @@
    2.45 + 	EXIT2(return);
    2.46 + }
    2.47 + 
    2.48 ++#ifndef netdev_mc_count
    2.49 ++#define netdev_mc_count(net_dev) net_dev->mc_count
    2.50 ++#endif
    2.51 ++
    2.52 + static void set_multicast_list(struct ndis_device *wnd)
    2.53 + {
    2.54 + 	struct net_device *net_dev;
    2.55 +@@ -950,20 +954,26 @@
    2.56 + 		packet_filter |= NDIS_PACKET_TYPE_PROMISCUOUS |
    2.57 + 			NDIS_PACKET_TYPE_ALL_LOCAL;
    2.58 + 	} else if (net_dev->flags & IFF_ALLMULTI ||
    2.59 +-		   net_dev->mc_count > wnd->multicast_size) {
    2.60 ++		   netdev_mc_count(net_dev) > wnd->multicast_size) {
    2.61 + 		packet_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
    2.62 + 		TRACE2("0x%08x", packet_filter);
    2.63 +-	} else if (net_dev->mc_count > 0) {
    2.64 ++	} else if (netdev_mc_count(net_dev) > 0) {
    2.65 + 		int i, size;
    2.66 + 		char *buf;
    2.67 ++#ifndef netdev_for_each_mc_addr
    2.68 + 		struct dev_mc_list *mclist;
    2.69 +-		size = min(wnd->multicast_size, net_dev->mc_count);
    2.70 +-		TRACE2("%d, %d", wnd->multicast_size, net_dev->mc_count);
    2.71 ++#else
    2.72 ++		struct netdev_hw_addr *mclist;
    2.73 ++#endif
    2.74 ++
    2.75 ++		size = min(wnd->multicast_size, netdev_mc_count(net_dev));
    2.76 ++		TRACE2("%d, %d", wnd->multicast_size, netdev_mc_count(net_dev));
    2.77 + 		buf = kmalloc(size * ETH_ALEN, GFP_KERNEL);
    2.78 + 		if (!buf) {
    2.79 + 			WARNING("couldn't allocate memory");
    2.80 + 			EXIT2(return);
    2.81 + 		}
    2.82 ++#ifndef netdev_for_each_mc_addr
    2.83 + 		mclist = net_dev->mc_list;
    2.84 + 		for (i = 0; i < size && mclist; mclist = mclist->next) {
    2.85 + 			if (mclist->dmi_addrlen != ETH_ALEN)
    2.86 +@@ -972,6 +982,15 @@
    2.87 + 			TRACE2(MACSTRSEP, MAC2STR(mclist->dmi_addr));
    2.88 + 			i++;
    2.89 + 		}
    2.90 ++#else
    2.91 ++		i = 0;
    2.92 ++		netdev_for_each_mc_addr(mclist, net_dev){
    2.93 ++                        memcpy(buf + i++ * ETH_ALEN,
    2.94 ++                               mclist->addr, ETH_ALEN);
    2.95 ++                        TRACE2(MACSTRSEP, MAC2STR(mclist->addr));
    2.96 ++
    2.97 ++		}
    2.98 ++#endif
    2.99 + 		res = mp_set(wnd, OID_802_3_MULTICAST_LIST, buf, i * ETH_ALEN);
   2.100 + 		if (res == NDIS_STATUS_SUCCESS && i > 0)
   2.101 + 			packet_filter |= NDIS_PACKET_TYPE_MULTICAST;
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/ndiswrapper-driver/stuff/kernel-2.6.36.patch	Fri Nov 05 18:38:20 2010 +0000
     3.3 @@ -0,0 +1,27 @@
     3.4 +--- ndiswrapper-1.56.orig/driver/loader.c	2010-02-11 03:09:32.000000000 +0100
     3.5 ++++ ndiswrapper-1.56/driver/loader.c	2010-10-24 01:38:13.000000000 +0200
     3.6 +@@ -750,13 +750,13 @@
     3.7 + }
     3.8 + 
     3.9 + /* called with loader_mutex is down */
    3.10 +-static int wrapper_ioctl(struct inode *inode, struct file *file,
    3.11 ++static long wrapper_unlocked_ioctl(struct file *file,
    3.12 + 			 unsigned int cmd, unsigned long arg)
    3.13 + {
    3.14 + 	struct load_driver *load_driver;
    3.15 + 	struct load_device load_device;
    3.16 + 	struct load_driver_file load_bin_file;
    3.17 +-	int ret;
    3.18 ++	long ret;
    3.19 + 	void __user *addr = (void __user *)arg;
    3.20 + 
    3.21 + 	ENTER1("cmd: %u", cmd);
    3.22 +@@ -831,7 +831,7 @@
    3.23 + 
    3.24 + static struct file_operations wrapper_fops = {
    3.25 + 	.owner          = THIS_MODULE,
    3.26 +-	.ioctl		= wrapper_ioctl,
    3.27 ++	.unlocked_ioctl	= wrapper_unlocked_ioctl,
    3.28 + 	.release	= wrapper_ioctl_release,
    3.29 + };
    3.30 +