linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] compat: miscellaneous fixes
@ 2010-08-17 18:32 Hauke Mehrtens
  2010-08-17 18:32 ` [PATCH 1/3] compat: backport init_dummy_netdev Hauke Mehrtens
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2010-08-17 18:32 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

This was build tested in combination with the patches to compat-wireless.

Hauke Mehrtens (3):
  compat: backport init_dummy_netdev
  compat: backport net_ns_type_operations
  compat: fix warning in device_rename

 compat/Makefile               |    1 +
 compat/compat-2.6.29.c        |   40 ++++++++++++++++++++++++++++++++++++
 compat/compat-2.6.37.c        |   45 +++++++++++++++++++++++++++++++++++++++++
 include/linux/compat-2.6.29.h |    2 +
 include/linux/compat-2.6.36.h |    2 +
 include/linux/compat-2.6.37.h |    2 +
 6 files changed, 92 insertions(+), 0 deletions(-)
 create mode 100644 compat/compat-2.6.37.c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] compat: backport init_dummy_netdev
  2010-08-17 18:32 [PATCH 0/3] compat: miscellaneous fixes Hauke Mehrtens
@ 2010-08-17 18:32 ` Hauke Mehrtens
  2010-08-17 18:32 ` [PATCH 2/3] compat: backport net_ns_type_operations Hauke Mehrtens
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2010-08-17 18:32 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

NETREG_DUMMY is not available for older kernels, it should be set to
something not normal. NETREG_DUMMY is set to 5 in new kernel versions.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 compat/compat-2.6.29.c        |   40 ++++++++++++++++++++++++++++++++++++++++
 include/linux/compat-2.6.29.h |    2 ++
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/compat/compat-2.6.29.c b/compat/compat-2.6.29.c
index 2e7e623..a2354f9 100644
--- a/compat/compat-2.6.29.c
+++ b/compat/compat-2.6.29.c
@@ -124,6 +124,46 @@ int eth_validate_addr(struct net_device *dev)
 EXPORT_SYMBOL(eth_validate_addr);
 /* Source: net/ethernet/eth.c */
 
+#define NETREG_DUMMY 5
+/**
+ *	init_dummy_netdev	- init a dummy network device for NAPI
+ *	@dev: device to init
+ *
+ *	This takes a network device structure and initialize the minimum
+ *	amount of fields so it can be used to schedule NAPI polls without
+ *	registering a full blown interface. This is to be used by drivers
+ *	that need to tie several hardware interfaces to a single NAPI
+ *	poll scheduler due to HW limitations.
+ */
+int init_dummy_netdev(struct net_device *dev)
+{
+	/* Clear everything. Note we don't initialize spinlocks
+	 * are they aren't supposed to be taken by any of the
+	 * NAPI code and this dummy netdev is supposed to be
+	 * only ever used for NAPI polls
+	 */
+	memset(dev, 0, sizeof(struct net_device));
+
+	/* make sure we BUG if trying to hit standard
+	 * register/unregister code path
+	 */
+	dev->reg_state = NETREG_DUMMY;
+
+	/* initialize the ref count */
+	atomic_set(&dev->refcnt, 1);
+
+	/* NAPI wants this */
+	INIT_LIST_HEAD(&dev->napi_list);
+
+	/* a dummy interface is started by default */
+	set_bit(__LINK_STATE_PRESENT, &dev->state);
+	set_bit(__LINK_STATE_START, &dev->state);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(init_dummy_netdev);
+/* Source: net/core/dev.c */
+
 
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */
 
diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h
index a1a989c..cce678f 100644
--- a/include/linux/compat-2.6.29.h
+++ b/include/linux/compat-2.6.29.h
@@ -274,6 +274,8 @@ static inline struct net *read_pnet(struct net * const *pnet)
 
 #endif
 
+extern int		init_dummy_netdev(struct net_device *dev);
+
 #else
 
 static inline void netdev_attach_ops(struct net_device *dev,
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] compat: backport net_ns_type_operations
  2010-08-17 18:32 [PATCH 0/3] compat: miscellaneous fixes Hauke Mehrtens
  2010-08-17 18:32 ` [PATCH 1/3] compat: backport init_dummy_netdev Hauke Mehrtens
@ 2010-08-17 18:32 ` Hauke Mehrtens
  2010-08-17 18:32 ` [PATCH 3/3] compat: fix warning in device_rename Hauke Mehrtens
  2010-08-17 22:02 ` [PATCH 0/3] compat: miscellaneous fixes Luis R. Rodriguez
  3 siblings, 0 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2010-08-17 18:32 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

net_ns_type_operations needs to be exported. This only works for kernel
>= 2.6.35 because struct kobj_ns_type_operations was introduced in
kernel 2.6.35.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 compat/Makefile               |    1 +
 compat/compat-2.6.37.c        |   45 +++++++++++++++++++++++++++++++++++++++++
 include/linux/compat-2.6.37.h |    2 +
 3 files changed, 48 insertions(+), 0 deletions(-)
 create mode 100644 compat/compat-2.6.37.c

diff --git a/compat/Makefile b/compat/Makefile
index bcd8fe7..b067be2 100644
--- a/compat/Makefile
+++ b/compat/Makefile
@@ -27,3 +27,4 @@ compat-$(CONFIG_COMPAT_KERNEL_31) += compat-2.6.31.o
 compat-$(CONFIG_COMPAT_KERNEL_32) += compat-2.6.32.o
 compat-$(CONFIG_COMPAT_KERNEL_33) += compat-2.6.33.o
 compat-$(CONFIG_COMPAT_KERNEL_35) += compat-2.6.35.o
+compat-$(CONFIG_COMPAT_KERNEL_37) += compat-2.6.37.o
diff --git a/compat/compat-2.6.37.c b/compat/compat-2.6.37.c
new file mode 100644
index 0000000..655b92f
--- /dev/null
+++ b/compat/compat-2.6.37.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2010    Hauke Mehrtens <hauke@hauke-m.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Compatibility file for Linux wireless for kernels 2.6.37.
+ */
+
+#include <linux/compat.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+
+#include <linux/netdevice.h>
+#include <net/sock.h>
+#include <linux/nsproxy.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+static const void *net_current_ns(void)
+{
+	return current->nsproxy->net_ns;
+}
+
+static const void *net_initial_ns(void)
+{
+	return &init_net;
+}
+
+static const void *net_netlink_ns(struct sock *sk)
+{
+	return sock_net(sk);
+}
+
+struct kobj_ns_type_operations net_ns_type_operations = {
+	.type = KOBJ_NS_TYPE_NET,
+	.current_ns = net_current_ns,
+	.netlink_ns = net_netlink_ns,
+	.initial_ns = net_initial_ns,
+};
+EXPORT_SYMBOL_GPL(net_ns_type_operations);
+
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)*/ 
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) */
diff --git a/include/linux/compat-2.6.37.h b/include/linux/compat-2.6.37.h
index cf0279e..5bd6edb 100644
--- a/include/linux/compat-2.6.37.h
+++ b/include/linux/compat-2.6.37.h
@@ -24,6 +24,8 @@
 
 #define SDIO_CLASS_BT_AMP	0x09	/* Type-A Bluetooth AMP interface */
 
+extern struct kobj_ns_type_operations net_ns_type_operations;
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
 
 #endif /* LINUX_26_37_COMPAT_H */
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] compat: fix warning in device_rename
  2010-08-17 18:32 [PATCH 0/3] compat: miscellaneous fixes Hauke Mehrtens
  2010-08-17 18:32 ` [PATCH 1/3] compat: backport init_dummy_netdev Hauke Mehrtens
  2010-08-17 18:32 ` [PATCH 2/3] compat: backport net_ns_type_operations Hauke Mehrtens
@ 2010-08-17 18:32 ` Hauke Mehrtens
  2010-08-17 22:02 ` [PATCH 0/3] compat: miscellaneous fixes Luis R. Rodriguez
  3 siblings, 0 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2010-08-17 18:32 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens


Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 include/linux/compat-2.6.36.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
index b14c772..5b48215 100644
--- a/include/linux/compat-2.6.36.h
+++ b/include/linux/compat-2.6.36.h
@@ -13,6 +13,8 @@ struct va_format {
 	va_list *va;
 };
 
+#define device_rename(dev, new_name) device_rename(dev, (char *)new_name)
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
 
 #endif /* LINUX_26_36_COMPAT_H */
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] compat: miscellaneous fixes
  2010-08-17 18:32 [PATCH 0/3] compat: miscellaneous fixes Hauke Mehrtens
                   ` (2 preceding siblings ...)
  2010-08-17 18:32 ` [PATCH 3/3] compat: fix warning in device_rename Hauke Mehrtens
@ 2010-08-17 22:02 ` Luis R. Rodriguez
  3 siblings, 0 replies; 5+ messages in thread
From: Luis R. Rodriguez @ 2010-08-17 22:02 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-wireless, mcgrof

On Tue, Aug 17, 2010 at 11:32 AM, Hauke Mehrtens <hauke@hauke-m.de> wrote:
> This was build tested in combination with the patches to compat-wireless.
>
> Hauke Mehrtens (3):
>  compat: backport init_dummy_netdev
>  compat: backport net_ns_type_operations
>  compat: fix warning in device_rename

All applied and pushed out, thanks!

  Luis

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-17 22:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-17 18:32 [PATCH 0/3] compat: miscellaneous fixes Hauke Mehrtens
2010-08-17 18:32 ` [PATCH 1/3] compat: backport init_dummy_netdev Hauke Mehrtens
2010-08-17 18:32 ` [PATCH 2/3] compat: backport net_ns_type_operations Hauke Mehrtens
2010-08-17 18:32 ` [PATCH 3/3] compat: fix warning in device_rename Hauke Mehrtens
2010-08-17 22:02 ` [PATCH 0/3] compat: miscellaneous fixes Luis R. Rodriguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).