mirror of https://github.com/hak5/openwrt.git
mac80211: backport required changes to support 3.9-rc kernels
SVN-Revision: 36007lede-17.01
parent
2070c91672
commit
32f3b1e358
|
@ -1,6 +1,5 @@
|
|||
diff -Nur compat-wireless-2013-02-22.orig/compat/scripts/gen-compat-config.sh compat-wireless-2013-02-22/compat/scripts/gen-compat-config.sh
|
||||
--- compat-wireless-2013-02-22.orig/compat/scripts/gen-compat-config.sh 2012-12-20 15:14:36.000000000 +0100
|
||||
+++ compat-wireless-2013-02-22/compat/scripts/gen-compat-config.sh 2013-03-07 17:27:04.000000000 +0100
|
||||
--- a/compat/scripts/gen-compat-config.sh
|
||||
+++ b/compat/scripts/gen-compat-config.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/usr/bin/env bash
|
||||
|
|
|
@ -0,0 +1,153 @@
|
|||
--- a/include/linux/compat-2.6.h
|
||||
+++ b/include/linux/compat-2.6.h
|
||||
@@ -69,6 +69,7 @@ void compat_dependency_symbol(void);
|
||||
#include <linux/compat-3.6.h>
|
||||
#include <linux/compat-3.7.h>
|
||||
#include <linux/compat-3.8.h>
|
||||
+#include <linux/compat-3.9.h>
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
--- /dev/null
|
||||
+++ b/include/linux/compat-3.9.h
|
||||
@@ -0,0 +1,140 @@
|
||||
+#ifndef LINUX_3_9_COMPAT_H
|
||||
+#define LINUX_3_9_COMPAT_H
|
||||
+
|
||||
+#include <linux/version.h>
|
||||
+
|
||||
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
|
||||
+
|
||||
+#include <linux/idr.h>
|
||||
+#include <linux/list.h>
|
||||
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25))
|
||||
+#include <linux/rculist.h>
|
||||
+#endif
|
||||
+#include <net/sock.h>
|
||||
+#include <linux/tty.h>
|
||||
+#include <linux/tty_flip.h>
|
||||
+
|
||||
+/* include this before changing hlist_for_each_* to use the old versions. */
|
||||
+#include <net/sch_generic.h>
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * backport of idr idr_alloc() usage
|
||||
+ *
|
||||
+ * This backports a patch series send by Tejun Heo:
|
||||
+ * https://lkml.org/lkml/2013/2/2/159
|
||||
+ */
|
||||
+static inline void compat_idr_destroy(struct idr *idp)
|
||||
+{
|
||||
+ idr_remove_all(idp);
|
||||
+ idr_destroy(idp);
|
||||
+}
|
||||
+#define idr_destroy(idp) compat_idr_destroy(idp)
|
||||
+
|
||||
+static inline int idr_alloc(struct idr *idr, void *ptr, int start, int end,
|
||||
+ gfp_t gfp_mask)
|
||||
+{
|
||||
+ int id, ret;
|
||||
+
|
||||
+ do {
|
||||
+ if (!idr_pre_get(idr, gfp_mask))
|
||||
+ return -ENOMEM;
|
||||
+ ret = idr_get_new_above(idr, ptr, start, &id);
|
||||
+ if (!ret && id > end) {
|
||||
+ idr_remove(idr, id);
|
||||
+ ret = -ENOSPC;
|
||||
+ }
|
||||
+ } while (ret == -EAGAIN);
|
||||
+
|
||||
+ return ret ? ret : id;
|
||||
+}
|
||||
+
|
||||
+static inline void idr_preload(gfp_t gfp_mask)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static inline void idr_preload_end(void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * backport:
|
||||
+ *
|
||||
+ * commit 0bbacca7c3911451cea923b0ad6389d58e3d9ce9
|
||||
+ * Author: Sasha Levin <sasha.levin@oracle.com>
|
||||
+ * Date: Thu Feb 7 12:32:18 2013 +1100
|
||||
+ *
|
||||
+ * hlist: drop the node parameter from iterators
|
||||
+ */
|
||||
+
|
||||
+#define hlist_entry_safe(ptr, type, member) \
|
||||
+ (ptr) ? hlist_entry(ptr, type, member) : NULL
|
||||
+
|
||||
+#undef hlist_for_each_entry
|
||||
+/**
|
||||
+ * hlist_for_each_entry - iterate 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 hlist_node within the struct.
|
||||
+ */
|
||||
+#define hlist_for_each_entry(pos, head, member) \
|
||||
+ for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \
|
||||
+ pos; \
|
||||
+ pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
|
||||
+
|
||||
+#undef hlist_for_each_entry_safe
|
||||
+/**
|
||||
+ * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
|
||||
+ * @pos: the type * to use as a loop cursor.
|
||||
+ * @n: another &struct hlist_node to use as temporary storage
|
||||
+ * @head: the head for your list.
|
||||
+ * @member: the name of the hlist_node within the struct.
|
||||
+ */
|
||||
+#define hlist_for_each_entry_safe(pos, n, head, member) \
|
||||
+ for (pos = hlist_entry_safe((head)->first, typeof(*pos), member); \
|
||||
+ pos && ({ n = pos->member.next; 1; }); \
|
||||
+ pos = hlist_entry_safe(n, typeof(*pos), member))
|
||||
+
|
||||
+#undef hlist_for_each_entry_rcu
|
||||
+/**
|
||||
+ * hlist_for_each_entry_rcu - iterate over rcu list of given type
|
||||
+ * @pos: the type * to use as a loop cursor.
|
||||
+ * @head: the head for your list.
|
||||
+ * @member: the name of the hlist_node within the struct.
|
||||
+ *
|
||||
+ * This list-traversal primitive may safely run concurrently with
|
||||
+ * the _rcu list-mutation primitives such as hlist_add_head_rcu()
|
||||
+ * as long as the traversal is guarded by rcu_read_lock().
|
||||
+ */
|
||||
+#define hlist_for_each_entry_rcu(pos, head, member) \
|
||||
+ for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\
|
||||
+ typeof(*(pos)), member); \
|
||||
+ pos; \
|
||||
+ pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \
|
||||
+ &(pos)->member)), typeof(*(pos)), member))
|
||||
+
|
||||
+#undef sk_for_each
|
||||
+#define sk_for_each(__sk, list) \
|
||||
+ hlist_for_each_entry(__sk, list, sk_node)
|
||||
+
|
||||
+#define tty_flip_buffer_push(port) tty_flip_buffer_push((port)->tty)
|
||||
+#define tty_insert_flip_string(port, chars, size) tty_insert_flip_string((port)->tty, chars, size)
|
||||
+
|
||||
+/**
|
||||
+ * backport of:
|
||||
+ *
|
||||
+ * commit 496ad9aa8ef448058e36ca7a787c61f2e63f0f54
|
||||
+ * Author: Al Viro <viro@zeniv.linux.org.uk>
|
||||
+ * Date: Wed Jan 23 17:07:38 2013 -0500
|
||||
+ *
|
||||
+ * new helper: file_inode(file)
|
||||
+ */
|
||||
+static inline struct inode *file_inode(struct file *f)
|
||||
+{
|
||||
+ return f->f_path.dentry->d_inode;
|
||||
+}
|
||||
+
|
||||
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) */
|
||||
+
|
||||
+#endif /* LINUX_3_9_COMPAT_H */
|
|
@ -1,10 +1,212 @@
|
|||
--- a/net/mac80211/mesh_pathtbl.c
|
||||
+++ b/net/mac80211/mesh_pathtbl.c
|
||||
@@ -818,7 +818,6 @@ static void table_flush_by_iface(struct
|
||||
struct hlist_node *p;
|
||||
@@ -72,9 +72,9 @@ static inline struct mesh_table *resize_
|
||||
* it's used twice. So it is illegal to do
|
||||
* for_each_mesh_entry(rcu_dereference(...), ...)
|
||||
*/
|
||||
-#define for_each_mesh_entry(tbl, p, node, i) \
|
||||
+#define for_each_mesh_entry(tbl, node, i) \
|
||||
for (i = 0; i <= tbl->hash_mask; i++) \
|
||||
- hlist_for_each_entry_rcu(node, p, &tbl->hash_buckets[i], list)
|
||||
+ hlist_for_each_entry_rcu(node, &tbl->hash_buckets[i], list)
|
||||
|
||||
|
||||
static struct mesh_table *mesh_table_alloc(int size_order)
|
||||
@@ -139,7 +139,7 @@ static void mesh_table_free(struct mesh_
|
||||
}
|
||||
if (free_leafs) {
|
||||
spin_lock_bh(&tbl->gates_lock);
|
||||
- hlist_for_each_entry_safe(gate, p, q,
|
||||
+ hlist_for_each_entry_safe(gate, q,
|
||||
tbl->known_gates, list) {
|
||||
hlist_del(&gate->list);
|
||||
kfree(gate);
|
||||
@@ -333,12 +333,11 @@ static struct mesh_path *mpath_lookup(st
|
||||
struct ieee80211_sub_if_data *sdata)
|
||||
{
|
||||
struct mesh_path *mpath;
|
||||
- struct hlist_node *n;
|
||||
struct hlist_head *bucket;
|
||||
struct mpath_node *node;
|
||||
|
||||
bucket = &tbl->hash_buckets[mesh_table_hash(dst, sdata, tbl)];
|
||||
- hlist_for_each_entry_rcu(node, n, bucket, list) {
|
||||
+ hlist_for_each_entry_rcu(node, bucket, list) {
|
||||
mpath = node->mpath;
|
||||
if (mpath->sdata == sdata &&
|
||||
ether_addr_equal(dst, mpath->dst)) {
|
||||
@@ -389,11 +388,10 @@ mesh_path_lookup_by_idx(struct ieee80211
|
||||
{
|
||||
struct mesh_table *tbl = rcu_dereference(mesh_paths);
|
||||
struct mpath_node *node;
|
||||
- struct hlist_node *p;
|
||||
int i;
|
||||
int j = 0;
|
||||
|
||||
- for_each_mesh_entry(tbl, p, node, i) {
|
||||
+ for_each_mesh_entry(tbl, node, i) {
|
||||
if (sdata && node->mpath->sdata != sdata)
|
||||
continue;
|
||||
if (j++ == idx) {
|
||||
@@ -417,13 +415,12 @@ int mesh_path_add_gate(struct mesh_path
|
||||
{
|
||||
struct mesh_table *tbl;
|
||||
struct mpath_node *gate, *new_gate;
|
||||
- struct hlist_node *n;
|
||||
int err;
|
||||
|
||||
rcu_read_lock();
|
||||
tbl = rcu_dereference(mesh_paths);
|
||||
|
||||
- hlist_for_each_entry_rcu(gate, n, tbl->known_gates, list)
|
||||
+ hlist_for_each_entry_rcu(gate, tbl->known_gates, list)
|
||||
if (gate->mpath == mpath) {
|
||||
err = -EEXIST;
|
||||
goto err_rcu;
|
||||
@@ -460,9 +457,9 @@ err_rcu:
|
||||
static void mesh_gate_del(struct mesh_table *tbl, struct mesh_path *mpath)
|
||||
{
|
||||
struct mpath_node *gate;
|
||||
- struct hlist_node *p, *q;
|
||||
+ struct hlist_node *q;
|
||||
|
||||
- hlist_for_each_entry_safe(gate, p, q, tbl->known_gates, list) {
|
||||
+ hlist_for_each_entry_safe(gate, q, tbl->known_gates, list) {
|
||||
if (gate->mpath != mpath)
|
||||
continue;
|
||||
spin_lock_bh(&tbl->gates_lock);
|
||||
@@ -504,7 +501,6 @@ int mesh_path_add(struct ieee80211_sub_i
|
||||
struct mesh_path *mpath, *new_mpath;
|
||||
struct mpath_node *node, *new_node;
|
||||
struct hlist_head *bucket;
|
||||
- struct hlist_node *n;
|
||||
int grow = 0;
|
||||
int err = 0;
|
||||
u32 hash_idx;
|
||||
@@ -550,7 +546,7 @@ int mesh_path_add(struct ieee80211_sub_i
|
||||
spin_lock(&tbl->hashwlock[hash_idx]);
|
||||
|
||||
err = -EEXIST;
|
||||
- hlist_for_each_entry(node, n, bucket, list) {
|
||||
+ hlist_for_each_entry(node, bucket, list) {
|
||||
mpath = node->mpath;
|
||||
if (mpath->sdata == sdata &&
|
||||
ether_addr_equal(dst, mpath->dst))
|
||||
@@ -640,7 +636,6 @@ int mpp_path_add(struct ieee80211_sub_if
|
||||
struct mesh_path *mpath, *new_mpath;
|
||||
struct mpath_node *node, *new_node;
|
||||
struct hlist_head *bucket;
|
||||
- struct hlist_node *n;
|
||||
int grow = 0;
|
||||
int err = 0;
|
||||
u32 hash_idx;
|
||||
@@ -680,7 +675,7 @@ int mpp_path_add(struct ieee80211_sub_if
|
||||
spin_lock(&tbl->hashwlock[hash_idx]);
|
||||
|
||||
err = -EEXIST;
|
||||
- hlist_for_each_entry(node, n, bucket, list) {
|
||||
+ hlist_for_each_entry(node, bucket, list) {
|
||||
mpath = node->mpath;
|
||||
if (mpath->sdata == sdata &&
|
||||
ether_addr_equal(dst, mpath->dst))
|
||||
@@ -725,14 +720,13 @@ void mesh_plink_broken(struct sta_info *
|
||||
static const u8 bcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
struct mesh_path *mpath;
|
||||
struct mpath_node *node;
|
||||
- struct hlist_node *p;
|
||||
struct ieee80211_sub_if_data *sdata = sta->sdata;
|
||||
int i;
|
||||
__le16 reason = cpu_to_le16(WLAN_REASON_MESH_PATH_DEST_UNREACHABLE);
|
||||
|
||||
rcu_read_lock();
|
||||
tbl = rcu_dereference(mesh_paths);
|
||||
- for_each_mesh_entry(tbl, p, node, i) {
|
||||
+ for_each_mesh_entry(tbl, node, i) {
|
||||
mpath = node->mpath;
|
||||
if (rcu_dereference(mpath->next_hop) == sta &&
|
||||
mpath->flags & MESH_PATH_ACTIVE &&
|
||||
@@ -792,13 +786,12 @@ void mesh_path_flush_by_nexthop(struct s
|
||||
struct mesh_table *tbl;
|
||||
struct mesh_path *mpath;
|
||||
struct mpath_node *node;
|
||||
- struct hlist_node *p;
|
||||
int i;
|
||||
|
||||
rcu_read_lock();
|
||||
read_lock_bh(&pathtbl_resize_lock);
|
||||
tbl = resize_dereference_mesh_paths();
|
||||
- for_each_mesh_entry(tbl, p, node, i) {
|
||||
+ for_each_mesh_entry(tbl, node, i) {
|
||||
mpath = node->mpath;
|
||||
if (rcu_dereference(mpath->next_hop) == sta) {
|
||||
spin_lock(&tbl->hashwlock[i]);
|
||||
@@ -815,11 +808,9 @@ static void table_flush_by_iface(struct
|
||||
{
|
||||
struct mesh_path *mpath;
|
||||
struct mpath_node *node;
|
||||
- struct hlist_node *p;
|
||||
int i;
|
||||
|
||||
- WARN_ON(!rcu_read_lock_held());
|
||||
for_each_mesh_entry(tbl, p, node, i) {
|
||||
- for_each_mesh_entry(tbl, p, node, i) {
|
||||
+ for_each_mesh_entry(tbl, node, i) {
|
||||
mpath = node->mpath;
|
||||
if (mpath->sdata != sdata)
|
||||
continue;
|
||||
@@ -865,7 +856,6 @@ int mesh_path_del(struct ieee80211_sub_i
|
||||
struct mesh_path *mpath;
|
||||
struct mpath_node *node;
|
||||
struct hlist_head *bucket;
|
||||
- struct hlist_node *n;
|
||||
int hash_idx;
|
||||
int err = 0;
|
||||
|
||||
@@ -875,7 +865,7 @@ int mesh_path_del(struct ieee80211_sub_i
|
||||
bucket = &tbl->hash_buckets[hash_idx];
|
||||
|
||||
spin_lock(&tbl->hashwlock[hash_idx]);
|
||||
- hlist_for_each_entry(node, n, bucket, list) {
|
||||
+ hlist_for_each_entry(node, bucket, list) {
|
||||
mpath = node->mpath;
|
||||
if (mpath->sdata == sdata &&
|
||||
ether_addr_equal(addr, mpath->dst)) {
|
||||
@@ -920,7 +910,6 @@ void mesh_path_tx_pending(struct mesh_pa
|
||||
int mesh_path_send_to_gates(struct mesh_path *mpath)
|
||||
{
|
||||
struct ieee80211_sub_if_data *sdata = mpath->sdata;
|
||||
- struct hlist_node *n;
|
||||
struct mesh_table *tbl;
|
||||
struct mesh_path *from_mpath = mpath;
|
||||
struct mpath_node *gate = NULL;
|
||||
@@ -935,7 +924,7 @@ int mesh_path_send_to_gates(struct mesh_
|
||||
if (!known_gates)
|
||||
return -EHOSTUNREACH;
|
||||
|
||||
- hlist_for_each_entry_rcu(gate, n, known_gates, list) {
|
||||
+ hlist_for_each_entry_rcu(gate, known_gates, list) {
|
||||
if (gate->mpath->sdata != sdata)
|
||||
continue;
|
||||
|
||||
@@ -951,7 +940,7 @@ int mesh_path_send_to_gates(struct mesh_
|
||||
}
|
||||
}
|
||||
|
||||
- hlist_for_each_entry_rcu(gate, n, known_gates, list)
|
||||
+ hlist_for_each_entry_rcu(gate, known_gates, list)
|
||||
if (gate->mpath->sdata == sdata) {
|
||||
mpath_dbg(sdata, "Sending to %pM\n", gate->mpath->dst);
|
||||
mesh_path_tx_pending(gate->mpath);
|
||||
@@ -1096,12 +1085,11 @@ void mesh_path_expire(struct ieee80211_s
|
||||
struct mesh_table *tbl;
|
||||
struct mesh_path *mpath;
|
||||
struct mpath_node *node;
|
||||
- struct hlist_node *p;
|
||||
int i;
|
||||
|
||||
rcu_read_lock();
|
||||
tbl = rcu_dereference(mesh_paths);
|
||||
- for_each_mesh_entry(tbl, p, node, i) {
|
||||
+ for_each_mesh_entry(tbl, node, i) {
|
||||
if (node->mpath->sdata != sdata)
|
||||
continue;
|
||||
mpath = node->mpath;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/mac80211/iface.c
|
||||
+++ b/net/mac80211/iface.c
|
||||
@@ -989,6 +989,7 @@ static const struct net_device_ops ieee8
|
||||
@@ -995,6 +995,7 @@ static const struct net_device_ops ieee8
|
||||
static void ieee80211_if_setup(struct net_device *dev)
|
||||
{
|
||||
ether_setup(dev);
|
||||
|
|
|
@ -47,10 +47,11 @@
|
|||
};
|
||||
|
||||
/* policy for the key attributes */
|
||||
@@ -1706,6 +1707,22 @@ static int nl80211_set_wiphy(struct sk_b
|
||||
@@ -1705,6 +1706,22 @@ static int nl80211_set_wiphy(struct sk_b
|
||||
if (result)
|
||||
goto bad_res;
|
||||
}
|
||||
|
||||
+
|
||||
+ if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_GAIN]) {
|
||||
+ int idx, dbi = 0;
|
||||
+
|
||||
|
@ -66,10 +67,9 @@
|
|||
+ if (result)
|
||||
+ goto bad_res;
|
||||
+ }
|
||||
+
|
||||
|
||||
if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
|
||||
info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
|
||||
u32 tx_ant, rx_ant;
|
||||
--- a/net/mac80211/cfg.c
|
||||
+++ b/net/mac80211/cfg.c
|
||||
@@ -2212,6 +2212,19 @@ static int ieee80211_get_tx_power(struct
|
||||
|
|
Loading…
Reference in New Issue