summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-emulation/vmware-modules/files/1.0.0.24-vmnet-2.6.31.patch')
-rw-r--r--app-emulation/vmware-modules/files/1.0.0.24-vmnet-2.6.31.patch477
1 files changed, 477 insertions, 0 deletions
diff --git a/app-emulation/vmware-modules/files/1.0.0.24-vmnet-2.6.31.patch b/app-emulation/vmware-modules/files/1.0.0.24-vmnet-2.6.31.patch
new file mode 100644
index 000000000000..a15e8ec1907e
--- /dev/null
+++ b/app-emulation/vmware-modules/files/1.0.0.24-vmnet-2.6.31.patch
@@ -0,0 +1,477 @@
+diff -uh vmnet-only.old/bridge.c vmnet-only/bridge.c
+--- vmnet-only.old/bridge.c 2009-03-27 01:34:28.000000000 -0400
++++ vmnet-only/bridge.c 2009-08-14 22:55:21.000000000 -0400
+@@ -645,9 +645,7 @@
+ if (clone == NULL) {
+ dev_unlock_list();
+ } else {
+- struct sock *sk = bridge->sk;
+- atomic_add(skb->truesize, &sk->sk_wmem_alloc);
+- clone->sk = sk;
++ skb_set_owner_w(clone, bridge->sk);
+ clone->protocol = ((struct ethhdr *)skb->data)->h_proto; // XXX
+ if ((dev->flags & IFF_UP) != 0) {
+ dev_unlock_list();
+@@ -987,6 +985,7 @@
+ retval = -ENOMEM;
+ goto out;
+ }
++ sock_init_data(NULL, bridge->sk);
+ SET_SK_DEAD(bridge->sk);
+
+ bridge->wirelessAdapter = VNetBridgeIsDeviceWireless(bridge->dev);
+diff -uh vmnet-only.old/compat_netdevice.h vmnet-only/compat_netdevice.h
+--- vmnet-only.old/compat_netdevice.h 2009-03-27 01:34:28.000000000 -0400
++++ vmnet-only/compat_netdevice.h 2009-08-14 22:55:21.000000000 -0400
+@@ -178,6 +178,23 @@
+ # define compat_netdev_priv(netdev) netdev_priv(netdev)
+ #endif
+
++/*
++ * All compat_* business is good but when we can we should just provide
++ * missing implementation to ease upstreaming task.
++ */
++#ifndef HAVE_ALLOC_NETDEV
++#define alloc_netdev(sz, name, setup) compat_alloc_netdev(sz, name, setup)
++#define alloc_etherdev(sz) compat_alloc_etherdev(sz)
++#endif
++
++#ifndef HAVE_FREE_NETDEV
++#define free_netdev(dev) kfree(dev)
++#endif
++
++#ifndef HAVE_NETDEV_PRIV
++#define netdev_priv(dev) ((dev)->priv)
++#endif
++
+ #if defined(NETDEV_TX_OK)
+ # define COMPAT_NETDEV_TX_OK NETDEV_TX_OK
+ # define COMPAT_NETDEV_TX_BUSY NETDEV_TX_BUSY
+@@ -186,55 +203,56 @@
+ # define COMPAT_NETDEV_TX_BUSY 1
+ #endif
+
+-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43))
++#ifndef HAVE_NETIF_QUEUE
+ static inline void
+-compat_netif_start_queue(struct device *dev)
++netif_start_queue(struct device *dev)
+ {
+ clear_bit(0, &dev->tbusy);
+ }
+
+ static inline void
+-compat_netif_stop_queue(struct device *dev)
++netif_stop_queue(struct device *dev)
+ {
+ set_bit(0, &dev->tbusy);
+ }
+
+ static inline int
+-compat_netif_queue_stopped(struct device *dev)
++netif_queue_stopped(struct device *dev)
+ {
+ return test_bit(0, &dev->tbusy);
+ }
+
+ static inline void
+-compat_netif_wake_queue(struct device *dev)
++netif_wake_queue(struct device *dev)
+ {
+ clear_bit(0, &dev->tbusy);
+ mark_bh(NET_BH);
+ }
+
+ static inline int
+-compat_netif_running(struct device *dev)
++netif_running(struct device *dev)
+ {
+ return dev->start == 0;
+ }
+
+ static inline int
+-compat_netif_carrier_ok(struct device *dev)
++netif_carrier_ok(struct device *dev)
+ {
+ return 1;
+ }
+
+ static inline void
+-compat_netif_carrier_on(struct device *dev)
++netif_carrier_on(struct device *dev)
+ {
+ }
+
+ static inline void
+-compat_netif_carrier_off(struct device *dev)
++netif_carrier_off(struct device *dev)
+ {
+ }
++#endif
+
+-#else
++/* Keep compat_* defines for now */
+ #define compat_netif_start_queue(dev) netif_start_queue(dev)
+ #define compat_netif_stop_queue(dev) netif_stop_queue(dev)
+ #define compat_netif_queue_stopped(dev) netif_queue_stopped(dev)
+@@ -243,7 +261,6 @@
+ #define compat_netif_carrier_ok(dev) netif_carrier_ok(dev)
+ #define compat_netif_carrier_on(dev) netif_carrier_on(dev)
+ #define compat_netif_carrier_off(dev) netif_carrier_off(dev)
+-#endif
+
+ /* unregister_netdevice_notifier was not safe prior to 2.6.17 */
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17) && \
+diff -uh vmnet-only.old/compat_sched.h vmnet-only/compat_sched.h
+--- vmnet-only.old/compat_sched.h 2009-03-27 01:34:28.000000000 -0400
++++ vmnet-only/compat_sched.h 2009-08-14 22:55:21.000000000 -0400
+@@ -272,6 +272,20 @@
+ #endif
+
+ /*
++ * Around 2.6.27 kernel stopped sending signals to kernel
++ * threads being frozen, instead threads have to check
++ * freezing() or use wait_event_freezable(). Unfortunately
++ * wait_event_freezable() completely hides the fact that
++ * thread was frozen from calling code and sometimes we do
++ * want to know that.
++ */
++#ifdef PF_FREEZER_NOSIG
++#define compat_wait_check_freezing() freezing(current)
++#else
++#define compat_wait_check_freezing() (0)
++#endif
++
++/*
+ * Since 2.6.27-rc2 kill_proc() is gone... Replacement (GPL-only!)
+ * API is available since 2.6.19. Use them from 2.6.27-rc1 up.
+ */
+diff -uh vmnet-only.old/compat_sock.h vmnet-only/compat_sock.h
+--- vmnet-only.old/compat_sock.h 2009-03-27 01:34:28.000000000 -0400
++++ vmnet-only/compat_sock.h 2009-08-14 22:55:21.000000000 -0400
+@@ -22,21 +22,9 @@
+ #include <linux/stddef.h> /* for NULL */
+ #include <net/sock.h>
+
+-
+ /*
+ * Between 2.5.70 and 2.5.71 all sock members were renamed from XXX to sk_XXX.
+- *
+- * VMW_HAVE_SK_WMEM_ALLOC is defined in module Makefile if kernel's struct sock
+- * has sk_wmem_alloc member. See vmnet's Makefile.kernel for details.
+- * It also means that all modules including this file should do
+- *
+- * EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/socket.c, -DVMW_HAVE_SK_WMEM_ALLOC, )
+- *
+- * in their Makefiles.
+ */
+-#ifndef VMW_HAVE_SK_WMEM_ALLOC
+-# define sk_wmem_alloc wmem_alloc
+-#endif
+
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 71)
+ # define compat_sk_backlog_rcv backlog_rcv
+diff -uh vmnet-only.old/Makefile vmnet-only/Makefile
+--- vmnet-only.old/Makefile 2009-09-13 07:39:55.000000000 -0400
++++ vmnet-only/Makefile 2009-09-13 07:40:10.000000000 -0400
+@@ -106,9 +106,10 @@
+ postbuild:: ;
+
+ $(DRIVER_KO): prebuild
+- make -C $(BUILD_DIR) SUBDIRS=$$PWD SRCROOT=$$PWD/$(SRCROOT) modules
+- make -C $$PWD SRCROOT=$$PWD/$(SRCROOT) postbuild
+-
++ make -C $(BUILD_DIR) SUBDIRS=$$PWD SRCROOT=$$PWD/$(SRCROOT) \
++ MODULEBUILDDIR=$(MODULEBUILDDIR) modules
++ make -C $$PWD SRCROOT=$$PWD/$(SRCROOT) \
++ MODULEBUILDDIR=$(MODULEBUILDDIR) postbuild
+ else
+
+ ifneq ($(VM_CCVER), $(VMCCVER))
+@@ -121,7 +122,7 @@
+ endif
+
+ vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
+- $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
++ $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) $(LINUXINCLUDE) \
+ $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ -DKBUILD_BASENAME=\"$(DRIVER)\" \
+ -Werror -S -o /dev/null -xc $(1) \
+diff -uh vmnet-only.old/Makefile.kernel vmnet-only/Makefile.kernel
+--- vmnet-only.old/Makefile.kernel 2009-09-13 07:39:55.000000000 -0400
++++ vmnet-only/Makefile.kernel 2009-09-13 07:40:10.000000000 -0400
+@@ -21,7 +21,6 @@
+
+ EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/epoll.c, -DVMW_HAVE_EPOLL, )
+-EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/socket.c, -DVMW_HAVE_SK_WMEM_ALLOC, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/sk_alloc.c,-DVMW_HAVE_SK_ALLOC_WITH_PROTO, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/netdev_has_net.c,-DVMW_NETDEV_HAS_NET, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/netdev_has_dev_net.c,-DVMW_NETDEV_HAS_DEV_NET, )
+diff -uh vmnet-only.old/Makefile.normal vmnet-only/Makefile.normal
+--- vmnet-only.old/Makefile.normal 2009-03-27 01:34:28.000000000 -0400
++++ vmnet-only/Makefile.normal 2009-08-14 22:55:22.000000000 -0400
+@@ -47,7 +47,6 @@
+ | sed -n -e 's!^APATH!-I$(HEADER_DIR)/asm!p')
+
+ CC_OPTS += $(call vm_check_build, $(SRCROOT)/epoll.c, -DVMW_HAVE_EPOLL, )
+-CC_OPTS += $(call vm_check_build, $(SRCROOT)/socket.c, -DVMW_HAVE_SK_WMEM_ALLOC, )
+ CC_OPTS += $(call vm_check_build, $(SRCROOT)/sk_alloc.c,-DVMW_HAVE_SK_ALLOC_WITH_PROTO, )
+ CC_OPTS += $(call vm_check_build, $(SRCROOT)/netdev_has_net.c,-DVMW_NETDEV_HAS_NET, )
+ CC_OPTS += $(call vm_check_build, $(SRCROOT)/netdev_has_dev_net.c,-DVMW_NETDEV_HAS_DEV_NET, )
+diff -uh vmnet-only.old/netif.c vmnet-only/netif.c
+--- vmnet-only.old/netif.c 2009-09-13 07:39:55.000000000 -0400
++++ vmnet-only/netif.c 2009-08-14 22:55:21.000000000 -0400
+@@ -55,30 +55,6 @@
+ struct net_device_stats stats;
+ } VNetNetIF;
+
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+-/*
+- Prior to KERNEL_VERSION(2, 6, 29) "struct net_device" had "void
+- *priv" field which was used as pointer to "VNetNetIF".
+-*/
+-
+-#define VNetNetIF_netdev_priv_size 0
+-
+-#define VNetNetIF_netdev_netIf(dev) (*(VNetNetIF**)&((dev)->priv))
+-
+-#else
+-/*
+- Since KERNEL_VERSION(2, 6, 29) pointer to "VNetNetIF" is stored in
+- explicitly allocated private area.
+-*/
+-typedef struct {
+- VNetNetIF *netIf;
+-} VNetNetIF_netdev_priv;
+-
+-#define VNetNetIF_netdev_priv_size sizeof(VNetNetIF_netdev_priv)
+-
+-#define VNetNetIF_netdev_netIf(dev) (((VNetNetIF_netdev_priv *)compat_netdev_priv(dev))->netIf)
+-
+-#endif
+
+ static void VNetNetIfFree(VNetJack *this);
+ static void VNetNetIfReceive(VNetJack *this, struct sk_buff *skb);
+@@ -100,73 +76,6 @@
+ static int VNetNetIfProcRead(char *page, char **start, off_t off,
+ int count, int *eof, void *data);
+
+-#ifndef KERNEL_2_3_43
+-/* softnet API emulation */
+-
+-
+-/*
+- *----------------------------------------------------------------------
+- *
+- * netif_stop_queue --
+- *
+- * Stops queue processing.
+- *
+- * Results:
+- * None.
+- *
+- *----------------------------------------------------------------------
+- */
+-
+-static inline void
+-netif_stop_queue(struct net_device *dev) // IN:
+-{
+- dev->tbusy = 1;
+-}
+-
+-
+-/*
+- *----------------------------------------------------------------------
+- *
+- * netif_start_queue --
+- *
+- * Enables queue processing. It does not try to start received
+- * frames processing.
+- *
+- * Results:
+- * None.
+- *
+- *----------------------------------------------------------------------
+- */
+-
+-static inline void
+-netif_start_queue(struct net_device *dev) // IN:
+-{
+- dev->tbusy = 0;
+-}
+-
+-
+-/*
+- *----------------------------------------------------------------------
+- *
+- * netif_wake_queue --
+- *
+- * Enables queue processing. It schedules receive queue processing.
+- *
+- * Results:
+- * None.
+- *
+- *----------------------------------------------------------------------
+- */
+-
+-static inline void
+-netif_wake_queue(struct net_device *dev) // IN:
+-{
+- dev->tbusy = 0;
+- mark_bh(NET_BH);
+-}
+-#endif
+-
+-
+ #if 0
+ #ifdef KERNEL_2_3_43
+ /*
+@@ -221,7 +130,29 @@
+ static void
+ VNetNetIfSetup(struct net_device *dev) // IN:
+ {
++#ifdef HAVE_NET_DEVICE_OPS
++ static const struct net_device_ops vnetNetifOps = {
++ .ndo_init = VNetNetifProbe,
++ .ndo_open = VNetNetifOpen,
++ .ndo_start_xmit = VNetNetifStartXmit,
++ .ndo_stop = VNetNetifClose,
++ .ndo_get_stats = VNetNetifGetStats,
++ .ndo_set_mac_address = VNetNetifSetMAC,
++ .ndo_set_multicast_list = VNetNetifSetMulticast,
++ /*
++ * We cannot stuck... If someone will report problems under
++ * low memory conditions or some such, we should enable it.
++ */
++#if 0
++ .ndo_tx_timeout = VNetNetifTxTimeout,
++#endif
++ };
++#endif /* HAVE_NET_DEVICE_OPS */
++
+ ether_setup(dev); // turns on IFF_BROADCAST, IFF_MULTICAST
++#ifdef HAVE_NET_DEVICE_OPS
++ dev->netdev_ops = &vnetNetifOps;
++#else
+ dev->init = VNetNetifProbe;
+ dev->open = VNetNetifOpen;
+ dev->hard_start_xmit = VNetNetifStartXmit;
+@@ -236,9 +167,43 @@
+ */
+ #if 0
+ dev->tx_timeout = VNetNetifTxTimeout;
++#endif
++#endif
++#endif /* HAVE_NET_DEVICE_OPS */
++
++#if 0
++ /* Only necessary if tx_timeout is set. See above. */
+ dev->watchdog_timeo = TX_TIMEOUT;
+ #endif
+-#endif
++}
++
++
++/*
++ *----------------------------------------------------------------------
++ *
++ * VNetNetIfNetDeviceToNetIf --
++ *
++ * Converts net_device to netIf.
++ *
++ * Results:
++ * Converted pointer.
++ *
++ * Side effects:
++ * None.
++ *
++ *----------------------------------------------------------------------
++ */
++
++static INLINE VNetNetIF *
++VNetNetIfNetDeviceToNetIf(struct net_device *dev)
++{
++#ifdef HAVE_NETDEV_PRIV
++ VNetNetIF** devPriv = netdev_priv(dev);
++
++ return *devPriv;
++#else
++ return dev->priv;
++#endif
+ }
+
+
+@@ -342,13 +307,21 @@
+ memcpy(netIf->devName, devName, sizeof netIf->devName);
+ NULL_TERMINATE_STRING(netIf->devName);
+
+- dev = compat_alloc_netdev(VNetNetIF_netdev_priv_size, netIf->devName, VNetNetIfSetup);
++#ifdef HAVE_NETDEV_PRIV
++ dev = compat_alloc_netdev(sizeof(VNetNetIF *), netIf->devName, VNetNetIfSetup);
+ if (!dev) {
+ retval = -ENOMEM;
+ goto out;
+ }
+-
+- VNetNetIF_netdev_netIf(dev) = netIf;
++ *(VNetNetIF**)netdev_priv(dev) = netIf;
++#else
++ dev = compat_alloc_netdev(0, netIf->devName, VNetNetIfSetup);
++ if (!dev) {
++ retval = -ENOMEM;
++ goto out;
++ }
++ dev->priv = netIf;
++#endif
+ netIf->dev = dev;
+
+ memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
+@@ -590,12 +563,14 @@
+ VNetNetifStartXmit(struct sk_buff *skb, // IN:
+ struct net_device *dev) // IN:
+ {
+- VNetNetIF *netIf = VNetNetIF_netdev_netIf(dev);
++ VNetNetIF *netIf;
+
+ if(skb == NULL) {
+ return 0;
+ }
+
++ netIf = VNetNetIfNetDeviceToNetIf(dev);
++
+ /*
+ * Block a timer-based transmit from overlapping. This could better be
+ * done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
+@@ -642,11 +617,13 @@
+ VNetNetifSetMAC(struct net_device *dev, // IN:
+ void *p) // IN:
+ {
+- VNetNetIF *netIf = VNetNetIF_netdev_netIf(dev);
++ VNetNetIF *netIf;
+ struct sockaddr const *addr = p;
++
+ if (!VMX86_IS_STATIC_MAC(addr->sa_data)) {
+ return -EINVAL;
+ }
++ netIf = VNetNetIfNetDeviceToNetIf(dev);
+ memcpy(netIf->port.paddr, addr->sa_data, dev->addr_len);
+ memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+ return 0;
+@@ -696,11 +673,12 @@
+ *----------------------------------------------------------------------
+ */
+
+-struct net_device_stats *
++static struct net_device_stats *
+ VNetNetifGetStats(struct net_device *dev) // IN:
+ {
+- VNetNetIF *netIf = VNetNetIF_netdev_netIf(dev);
+- return &(netIf->stats);
++ VNetNetIF *netIf = VNetNetIfNetDeviceToNetIf(dev);
++
++ return &netIf->stats;
+ }
+
+
+Only in vmnet-only.old: socket.c