From: agb Date: Fri, 29 Oct 2010 21:26:25 +0000 (+0000) Subject: [backfire] package/mac80211: backport list_for_each_entry_continue_rcu to fix carl1970 X-Git-Url: http://git.ozo.com/?p=openwrt-10.03%2F.git;a=commitdiff_plain;h=62eb83c4fa0b9d9d58d6483381b5dae66e06328e [backfire] package/mac80211: backport list_for_each_entry_continue_rcu to fix carl1970 git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@23716 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/package/mac80211/patches/900-backport_list_for_each_entry_continue_rcu.patch b/package/mac80211/patches/900-backport_list_for_each_entry_continue_rcu.patch new file mode 100644 index 000000000..4e2d9c9a5 --- /dev/null +++ b/package/mac80211/patches/900-backport_list_for_each_entry_continue_rcu.patch @@ -0,0 +1,47 @@ +diff --git a/include/linux/compat-2.6.31.h b/include/linux/compat-2.6.31.h +index 54ddefd..6c454cb 100644 +--- a/include/linux/compat-2.6.31.h ++++ b/include/linux/compat-2.6.31.h +@@ -191,6 +191,17 @@ void compat_synchronize_threaded_irq(struct compat_threaded_irq *comp) + cancel_work_sync(&comp->work); + } + ++/** ++ * list_entry_rcu - get the struct for this entry ++ * @ptr: the &struct list_head pointer. ++ * @type: the type of the struct this is embedded in. ++ * @member: the name of the list_struct within the struct. ++ * ++ * This primitive may safely run concurrently with the _rcu list-mutation ++ * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). ++ */ ++#define list_entry_rcu(ptr, type, member) \ ++ container_of(rcu_dereference(ptr), type, member) + + #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */ + +diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h +index e4dff72..e7e20d9 100644 +--- a/include/linux/compat-2.6.33.h ++++ b/include/linux/compat-2.6.33.h +@@ -98,6 +98,20 @@ int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, + #define kfifo_out(a, b, c) __kfifo_get(*a, b, c) + #define kfifo_len(a) __kfifo_len(*a) + ++/** ++ * list_for_each_entry_continue_rcu - continue iteration over list of given type ++ * @pos: the type * to use as a loop cursor. ++ * @head: the head for your list. ++ * @member: the name of the list_struct within the struct. ++ * ++ * Continue to iterate over list of given type, continuing after ++ * the current position. ++ */ ++#define list_for_each_entry_continue_rcu(pos, head, member) \ ++ for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \ ++ prefetch(pos->member.next), &pos->member != (head); \ ++ pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) ++ + #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) */ + + #endif /* LINUX_26_33_COMPAT_H */