wok diff ndiswrapper-driver64/stuff/kernel-2.6.35.patch @ rev 22102

Add python-attr
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Nov 01 15:22:59 2019 +0100 (2019-11-01)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ndiswrapper-driver64/stuff/kernel-2.6.35.patch	Fri Nov 01 15:22:59 2019 +0100
     1.3 @@ -0,0 +1,98 @@
     1.4 +diff -uNr ndiswrapper-1.56.old/driver/usb.c ndiswrapper-1.56/driver/usb.c
     1.5 +--- ndiswrapper-1.56.old/driver/usb.c	2010-02-10 18:09:32.000000000 -0800
     1.6 ++++ ndiswrapper-1.56/driver/usb.c	2010-07-25 02:29:25.442145846 -0700
     1.7 +@@ -191,9 +191,15 @@
     1.8 + 	if (wrap_urb->flags & WRAP_URB_COPY_BUFFER) {
     1.9 + 		USBTRACE("freeing DMA buffer for URB: %p %p",
    1.10 + 			 urb, urb->transfer_buffer);
    1.11 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
    1.12 + 		usb_buffer_free(IRP_WRAP_DEVICE(irp)->usb.udev,
    1.13 ++                                urb->transfer_buffer_length,
    1.14 ++                                urb->transfer_buffer, urb->transfer_dma);
    1.15 ++#else
    1.16 ++		usb_free_coherent(IRP_WRAP_DEVICE(irp)->usb.udev,
    1.17 + 				urb->transfer_buffer_length,
    1.18 + 				urb->transfer_buffer, urb->transfer_dma);
    1.19 ++#endif
    1.20 + 	}
    1.21 + 	if (urb->setup_packet)
    1.22 + 		kfree(urb->setup_packet);
    1.23 +@@ -303,9 +309,16 @@
    1.24 + 			       || PageHighMem(virt_to_page(buf))
    1.25 + #endif
    1.26 + 		    )) {
    1.27 ++
    1.28 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
    1.29 + 		urb->transfer_buffer =
    1.30 +-			usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
    1.31 ++                        usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
    1.32 ++                                         &urb->transfer_dma);
    1.33 ++#else
    1.34 ++		urb->transfer_buffer =
    1.35 ++			usb_alloc_coherent(wd->usb.udev, buf_len, alloc_flags,
    1.36 + 					 &urb->transfer_dma);
    1.37 ++#endif
    1.38 + 		if (!urb->transfer_buffer) {
    1.39 + 			WARNING("couldn't allocate dma buf");
    1.40 + 			IoAcquireCancelSpinLock(&irp->cancel_irql);
    1.41 +diff -uNr ndiswrapper-1.56.old/driver/wrapndis.c ndiswrapper-1.56/driver/wrapndis.c
    1.42 +--- ndiswrapper-1.56.old/driver/wrapndis.c	2010-02-10 18:09:32.000000000 -0800
    1.43 ++++ ndiswrapper-1.56/driver/wrapndis.c	2010-07-25 02:06:13.184631757 -0700
    1.44 +@@ -936,6 +936,10 @@
    1.45 + 	EXIT2(return);
    1.46 + }
    1.47 + 
    1.48 ++#ifndef netdev_mc_count
    1.49 ++#define netdev_mc_count(net_dev) net_dev->mc_count
    1.50 ++#endif
    1.51 ++
    1.52 + static void set_multicast_list(struct ndis_device *wnd)
    1.53 + {
    1.54 + 	struct net_device *net_dev;
    1.55 +@@ -950,20 +954,26 @@
    1.56 + 		packet_filter |= NDIS_PACKET_TYPE_PROMISCUOUS |
    1.57 + 			NDIS_PACKET_TYPE_ALL_LOCAL;
    1.58 + 	} else if (net_dev->flags & IFF_ALLMULTI ||
    1.59 +-		   net_dev->mc_count > wnd->multicast_size) {
    1.60 ++		   netdev_mc_count(net_dev) > wnd->multicast_size) {
    1.61 + 		packet_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
    1.62 + 		TRACE2("0x%08x", packet_filter);
    1.63 +-	} else if (net_dev->mc_count > 0) {
    1.64 ++	} else if (netdev_mc_count(net_dev) > 0) {
    1.65 + 		int i, size;
    1.66 + 		char *buf;
    1.67 ++#ifndef netdev_for_each_mc_addr
    1.68 + 		struct dev_mc_list *mclist;
    1.69 +-		size = min(wnd->multicast_size, net_dev->mc_count);
    1.70 +-		TRACE2("%d, %d", wnd->multicast_size, net_dev->mc_count);
    1.71 ++#else
    1.72 ++		struct netdev_hw_addr *mclist;
    1.73 ++#endif
    1.74 ++
    1.75 ++		size = min(wnd->multicast_size, netdev_mc_count(net_dev));
    1.76 ++		TRACE2("%d, %d", wnd->multicast_size, netdev_mc_count(net_dev));
    1.77 + 		buf = kmalloc(size * ETH_ALEN, GFP_KERNEL);
    1.78 + 		if (!buf) {
    1.79 + 			WARNING("couldn't allocate memory");
    1.80 + 			EXIT2(return);
    1.81 + 		}
    1.82 ++#ifndef netdev_for_each_mc_addr
    1.83 + 		mclist = net_dev->mc_list;
    1.84 + 		for (i = 0; i < size && mclist; mclist = mclist->next) {
    1.85 + 			if (mclist->dmi_addrlen != ETH_ALEN)
    1.86 +@@ -972,6 +982,15 @@
    1.87 + 			TRACE2(MACSTRSEP, MAC2STR(mclist->dmi_addr));
    1.88 + 			i++;
    1.89 + 		}
    1.90 ++#else
    1.91 ++		i = 0;
    1.92 ++		netdev_for_each_mc_addr(mclist, net_dev){
    1.93 ++                        memcpy(buf + i++ * ETH_ALEN,
    1.94 ++                               mclist->addr, ETH_ALEN);
    1.95 ++                        TRACE2(MACSTRSEP, MAC2STR(mclist->addr));
    1.96 ++
    1.97 ++		}
    1.98 ++#endif
    1.99 + 		res = mp_set(wnd, OID_802_3_MULTICAST_LIST, buf, i * ETH_ALEN);
   1.100 + 		if (res == NDIS_STATUS_SUCCESS && i > 0)
   1.101 + 			packet_filter |= NDIS_PACKET_TYPE_MULTICAST;