Search Linux Wireless

[RFC PATCH] ath5k:mesh support (enable send beacon)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch enable Ath5k send mesh beacon and found each other, I tested it
between two Atheros cards AR5414/AR5413 and AR2413, it seemed they can send
beacon correctly and ping each other. The kernel I used is pulled from
wireless-testing tree. The HEAD is
a520bdbe7d344296482f9355e29b0018ea58760f (iwl-scan.c: fixup merge
damage in wireless-testing#master)

But in order to make the mesh works, below three patches need to be apply first
1. [ath5k-devel] [PATCH] ath5k: add Mesh Point support
http://marc.info/?l=linux-wireless&m=121632572409109&w=2
2. [ath5k-devel] [PATCH 1/3] Ath5k: fix beacon-update deadlock
http://marc.info/?l=linux-wireless&m=121681221413848&w=2
3. [PATCH] mac80211: fix mesh beaconing
http://marc.info/?l=linux-wireless&m=121735468220792&w=2

Something need to be notice:
1: In ath5k ADHOC mode the TSF will be dynamic adjusted, but in Mesh
mode, it is not be
done. In my opinion the mesh node need adjust TSF too (CMIIW).
2: The default beacon intval is 1000ms, we can change it in base.c
ath5k_config_interface() . ( or there is any command or tools can be
used to do this, I don't know :) )
3: After input "iw dev mesh station dump" it will trigger a lock
problem(attach is the warning info).
4: In my test after send 7 ping packets, the kernel will crash for
some reason. (After I get a serial console line, will report more
detail of it or send a patch if I can figure them out)


Signed-off-by: Li YanBo <dreamfly281@xxxxxxxxx>

drivers/net/wireless/ath5k/base.c |   31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath5k/base.c
b/drivers/net/wireless/ath5k/base.c
index 16c19ce..a56a4d5 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1810,7 +1810,8 @@ accept:
 		ath5k_debug_dump_skb(sc, skb, "RX  ", 0);

 		/* check beacons in IBSS mode */
-		if (sc->opmode == IEEE80211_IF_TYPE_IBSS)
+		if (sc->opmode == IEEE80211_IF_TYPE_IBSS ||
+		    sc->opmode == IEEE80211_IF_TYPE_MESH_POINT)
 			ath5k_check_ibss_tsf(sc, skb, &rxs);

 		__ieee80211_rx(sc->hw, skb, &rxs);
@@ -1927,7 +1928,9 @@ ath5k_beacon_setup(struct ath5k_softc *sc,
struct ath5k_buf *bf)
 	ds = bf->desc;

 	flags = AR5K_TXDESC_NOACK;
-	if (sc->opmode == IEEE80211_IF_TYPE_IBSS && ath5k_hw_hasveol(ah)) {
+	if ((sc->opmode == IEEE80211_IF_TYPE_IBSS ||
+	     sc->opmode == IEEE80211_IF_TYPE_MESH_POINT) &&
+	    ath5k_hw_hasveol(ah)) {
 		ds->ds_link = bf->daddr;	/* self-linked */
 		flags |= AR5K_TXDESC_VEOL;
 		/*
@@ -2154,7 +2157,8 @@ ath5k_beacon_config(struct ath5k_softc *sc)

 	if (sc->opmode == IEEE80211_IF_TYPE_STA) {
 		sc->imask |= AR5K_INT_BMISS;
-	} else if (sc->opmode == IEEE80211_IF_TYPE_IBSS) {
+	} else if (sc->opmode == IEEE80211_IF_TYPE_IBSS ||
+		   sc->opmode == IEEE80211_IF_TYPE_MESH_POINT) {
 		/*
 		 * In IBSS mode we use a self-linked tx descriptor and let the
 		 * hardware send the beacons automatically. We have to load it
@@ -2163,11 +2167,15 @@ ath5k_beacon_config(struct ath5k_softc *sc)
 		 * timers in order to detect automatic TSF updates.
 		 */
 		ath5k_beaconq_config(sc);
-
-		sc->imask |= AR5K_INT_SWBA;
+		if (sc->opmode == IEEE80211_IF_TYPE_IBSS)
+			sc->imask |= AR5K_INT_SWBA;	

 		if (ath5k_hw_hasveol(ah))
 			ath5k_beacon_send(sc);
+
+		/* set the beacon timer */
+		if (sc->opmode == IEEE80211_IF_TYPE_MESH_POINT)
+			ath5k_beacon_update_timers(sc, 0);
 	}
 	/* TODO else AP */

@@ -2720,6 +2728,7 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,
 	case IEEE80211_IF_TYPE_STA:
 	case IEEE80211_IF_TYPE_IBSS:
 	case IEEE80211_IF_TYPE_MNTR:
+	case IEEE80211_IF_TYPE_MESH_POINT:
 		sc->opmode = conf->type;
 		break;
 	default:
@@ -2787,7 +2796,7 @@ ath5k_config_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
 	}

 	if (conf->changed & IEEE80211_IFCC_BEACON &&
-	    vif->type == IEEE80211_IF_TYPE_IBSS) {
+	    (vif->type == IEEE80211_IF_TYPE_IBSS || ieee80211_vif_is_mesh(vif))) {
 		struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
 		if (!beacon) {
 			ret = -ENOMEM;
@@ -2916,7 +2925,8 @@ static void ath5k_configure_filter(struct
ieee80211_hw *hw,
 		test_bit(ATH_STAT_PROMISC, sc->status))
 		rfilt |= AR5K_RX_FILTER_PROM;
 	if (sc->opmode == IEEE80211_IF_TYPE_STA ||
-		sc->opmode == IEEE80211_IF_TYPE_IBSS) {
+	    sc->opmode == IEEE80211_IF_TYPE_IBSS ||
+	    sc->opmode == IEEE80211_IF_TYPE_MESH_POINT) {
 		rfilt |= AR5K_RX_FILTER_BEACON;
 	}

@@ -3020,7 +3030,8 @@ ath5k_reset_tsf(struct ieee80211_hw *hw)
 	 * in IBSS mode we need to update the beacon timers too.
 	 * this will also reset the TSF if we call it with 0
 	 */
-	if (sc->opmode == IEEE80211_IF_TYPE_IBSS)
+	if (sc->opmode == IEEE80211_IF_TYPE_IBSS ||
+	    sc->opmode == IEEE80211_IF_TYPE_MESH_POINT)
 		ath5k_beacon_update_timers(sc, 0);
 	else
 		ath5k_hw_reset_tsf(sc->ah);
@@ -3034,8 +3045,8 @@ ath5k_beacon_update(struct ieee80211_hw *hw,
struct sk_buff *skb)

 	ath5k_debug_dump_skb(sc, skb, "BC  ", 1);

-
-	if (sc->opmode != IEEE80211_IF_TYPE_IBSS) {
+ 	if (sc->opmode != IEEE80211_IF_TYPE_IBSS &&
+ 	    sc->opmode != IEEE80211_IF_TYPE_MESH_POINT) {		
 		ret = -EIO;
 		goto end;
 	}
After input "iw dev mesh station dump" it will trigger below problem
[  762.968679] =======================================================
[  762.968687] [ INFO: possible circular locking dependency detected ]
[  762.968691] 2.6.26-wl-14211-g2986537-dirty #32
[  762.968694] -------------------------------------------------------
[  762.968697] iw/7188 is trying to acquire lock:
[  762.968701]  (rtnl_mutex){--..}, at: [<c04bb430>] nl80211_dump_station+0x140/0x1e0
[  762.968713] 
[  762.968714] but task is already holding lock:
[  762.968717]  (&drv->devlist_mtx){--..}, at: [<c04bb390>] nl80211_dump_station+0xa0/0x1e0
[  762.968725] 
[  762.968726] which lock already depends on the new lock.
[  762.968728] 
[  762.968731] 
[  762.968731] the existing dependency chain (in reverse order) is:
[  762.968735] 
[  762.968736] -> #1 (&drv->devlist_mtx){--..}:
[  762.968742]        [<c013d8f6>] add_lock_to_list+0x46/0xc0
[  762.968755]        [<c014104b>] __lock_acquire+0xbdb/0x1060
[  762.968767]        [<c04b9382>] cfg80211_netdev_notifier_call+0x72/0x110
[  762.968778]        [<c013da0d>] get_lock_stats+0xd/0x30
[  762.968789]        [<c0141556>] lock_acquire+0x86/0xb0
[  762.968800]        [<c04b9382>] cfg80211_netdev_notifier_call+0x72/0x110
[  762.968811]        [<c04eed11>] mutex_lock_nested+0x91/0x2a0
[  762.968823]        [<c04b9382>] cfg80211_netdev_notifier_call+0x72/0x110
[  762.968834]        [<c04b9382>] cfg80211_netdev_notifier_call+0x72/0x110
[  762.968845]        [<c04b9382>] cfg80211_netdev_notifier_call+0x72/0x110
[  762.968856]        [<c0138010>] notifier_call_chain+0x30/0x60
[  762.968866]        [<c0138087>] raw_notifier_call_chain+0x17/0x20
[  762.968877]        [<c041909d>] register_netdevice+0x25d/0x390
[  762.968889]        [<c04bdf63>] ieee80211_register_hw+0x1b3/0x2d0
[  762.968900]        [<f8864f39>] ath5k_pci_probe+0x839/0xfd0 [ath5k]
[  762.968920]        [<c0276aba>] _atomic_dec_and_lock+0x2a/0x40
[  762.968933]        [<c0288496>] pci_device_probe+0x56/0x80
[  762.968945]        [<c0304881>] driver_probe_device+0x81/0x170
[  762.968957]        [<c013ff91>] trace_hardirqs_on+0xb1/0x140
[  762.968968]        [<c03049e2>] __driver_attach+0x72/0x80
[  762.968979]        [<c0303f4c>] bus_for_each_dev+0x3c/0x60
[  762.968990]        [<c03046e6>] driver_attach+0x16/0x20
[  762.969001]        [<c0304970>] __driver_attach+0x0/0x80
[  762.969011]        [<c030439f>] bus_add_driver+0xaf/0x220
[  762.969022]        [<c02883e0>] pci_device_remove+0x0/0x40
[  762.969033]        [<c0304b5d>] driver_register+0x4d/0x120
[  762.969044]        [<c0280b72>] __spin_lock_init+0x32/0x70
[  762.969055]        [<c02886db>] __pci_register_driver+0x4b/0x90
[  762.969066]        [<f887501d>] 0xf887501d
[  762.969075]        [<c0148363>] sys_init_module+0x113/0x18b0
[  762.969087]        [<c01406f3>] __lock_acquire+0x283/0x1060
[  762.969098]        [<c0284090>] pci_bus_read_config_byte+0x0/0x80
[  762.969109]        [<c0103d7d>] sysenter_past_esp+0x6a/0xb1
[  762.969121]        [<ffffffff>] 0xffffffff
[  762.969145] 
[  762.969146] -> #0 (rtnl_mutex){--..}:
[  762.969151]        [<c013e210>] print_circular_bug_entry+0x40/0x50
[  762.969162]        [<c0140e58>] __lock_acquire+0x9e8/0x1060
[  762.969174]        [<c04bb390>] nl80211_dump_station+0xa0/0x1e0
[  762.969184]        [<c013da3a>] put_lock_stats+0xa/0x20
[  762.969195]        [<c0141556>] lock_acquire+0x86/0xb0
[  762.969207]        [<c04bb430>] nl80211_dump_station+0x140/0x1e0
[  762.969217]        [<c04eed11>] mutex_lock_nested+0x91/0x2a0
[  762.969229]        [<c04bb430>] nl80211_dump_station+0x140/0x1e0
[  762.969239]        [<c04bb430>] nl80211_dump_station+0x140/0x1e0
[  762.969250]        [<c04bb430>] nl80211_dump_station+0x140/0x1e0
[  762.969258]        [<c013fe18>] mark_held_locks+0x38/0x70
[  762.969258]        [<c04eee3f>] mutex_lock_nested+0x1bf/0x2a0
[  762.969258]        [<c0427090>] netlink_dump+0x40/0x1b0
[  762.969258]        [<c04270a5>] netlink_dump+0x55/0x1b0
[  762.969258]        [<c04292f0>] netlink_dump_start+0x130/0x150
[  762.969258]        [<c042ad71>] genl_rcv_msg+0xc1/0x1b0
[  762.969258]        [<c04bb2f0>] nl80211_dump_station+0x0/0x1e0
[  762.969258]        [<c042a2cf>] genl_rcv+0xf/0x30
[  762.969258]        [<c042a2cf>] genl_rcv+0xf/0x30
[  762.969258]        [<c042acb0>] genl_rcv_msg+0x0/0x1b0
[  762.969258]        [<c04281a6>] netlink_rcv_skb+0x66/0x90
[  762.969258]        [<c042a2db>] genl_rcv+0x1b/0x30
[  762.969258]        [<c0427f57>] netlink_unicast+0x247/0x280
[  762.969258]        [<c027d308>] copy_from_user+0x38/0x80
[  762.969258]        [<c04288e5>] netlink_sendmsg+0x1e5/0x290
[  762.969258]        [<c040c76d>] sock_sendmsg+0xcd/0x100
[  762.969258]        [<c0134100>] autoremove_wake_function+0x0/0x40
[  762.969258]        [<c013ff91>] trace_hardirqs_on+0xb1/0x140
[  762.969258]        [<c027d308>] copy_from_user+0x38/0x80
[  762.969258]        [<c041479a>] verify_iovec+0x2a/0x90
[  762.969258]        [<c040c8f9>] sys_sendmsg+0x159/0x270
[  762.969258]        [<c01406f3>] __lock_acquire+0x283/0x1060
[  762.969258]        [<c010951a>] native_sched_clock+0x7a/0xb0
[  762.969258]        [<c010951a>] native_sched_clock+0x7a/0xb0
[  762.969258]        [<c040dbf2>] sys_socketcall+0x82/0x280
[  762.969258]        [<c0103db8>] sysenter_past_esp+0xa5/0xb1
[  762.969258]        [<c0103db8>] sysenter_past_esp+0xa5/0xb1
[  762.969258]        [<c0103d7d>] sysenter_past_esp+0x6a/0xb1
[  762.969258]        [<ffffffff>] 0xffffffff
[  762.969258] 
[  762.969258] other info that might help us debug this:
[  762.969258] 
[  762.969258] 3 locks held by iw/7188:
[  762.969258]  #0:  (genl_mutex){--..}, at: [<c0427090>] netlink_dump+0x40/0x1b0
[  762.969258]  #1:  (cfg80211_drv_mutex){--..}, at: [<c04bb31e>] nl80211_dump_station+0x2e/0x1e0
[  762.969258]  #2:  (&drv->devlist_mtx){--..}, at: [<c04bb390>] nl80211_dump_station+0xa0/0x1e0
[  762.969258] 
[  762.969258] stack backtrace:
[  762.969258] Pid: 7188, comm: iw Not tainted 2.6.26-wl-14211-g2986537-dirty #32
[  762.969258]  [<c013eb5a>] print_circular_bug_tail+0x7a/0x90
[  762.969258]  [<c0140e58>] __lock_acquire+0x9e8/0x1060
[  762.969258]  [<c04bb390>] nl80211_dump_station+0xa0/0x1e0
[  762.969258]  [<c013da3a>] put_lock_stats+0xa/0x20
[  762.969258]  [<c0141556>] lock_acquire+0x86/0xb0
[  762.969258]  [<c04bb430>] nl80211_dump_station+0x140/0x1e0
[  762.969258]  [<c04eed11>] mutex_lock_nested+0x91/0x2a0
[  762.969258]  [<c04bb430>] nl80211_dump_station+0x140/0x1e0
[  762.969258]  [<c04bb430>] nl80211_dump_station+0x140/0x1e0
[  762.969258]  [<c04bb430>] nl80211_dump_station+0x140/0x1e0
[  762.969258]  [<c013fe18>] mark_held_locks+0x38/0x70
[  762.969258]  [<c04eee3f>] mutex_lock_nested+0x1bf/0x2a0
[  762.969258]  [<c0427090>] netlink_dump+0x40/0x1b0
[  762.969258]  [<c04270a5>] netlink_dump+0x55/0x1b0
[  762.969258]  [<c04292f0>] netlink_dump_start+0x130/0x150
[  762.969258]  [<c042ad71>] genl_rcv_msg+0xc1/0x1b0
[  762.969258]  [<c04bb2f0>] nl80211_dump_station+0x0/0x1e0
[  762.969258]  [<c042a2cf>] genl_rcv+0xf/0x30
[  762.969258]  [<c042a2cf>] genl_rcv+0xf/0x30
[  762.969258]  [<c042acb0>] genl_rcv_msg+0x0/0x1b0
[  762.969258]  [<c04281a6>] netlink_rcv_skb+0x66/0x90
[  762.969258]  [<c042a2db>] genl_rcv+0x1b/0x30
[  762.969258]  [<c0427f57>] netlink_unicast+0x247/0x280
[  762.969258]  [<c027d308>] copy_from_user+0x38/0x80
[  762.969258]  [<c04288e5>] netlink_sendmsg+0x1e5/0x290
[  762.969258]  [<c040c76d>] sock_sendmsg+0xcd/0x100
[  762.969258]  [<c0134100>] autoremove_wake_function+0x0/0x40
[  762.969258]  [<c013ff91>] trace_hardirqs_on+0xb1/0x140
[  762.969258]  [<c027d308>] copy_from_user+0x38/0x80
[  762.969258]  [<c041479a>] verify_iovec+0x2a/0x90
[  762.969258]  [<c040c8f9>] sys_sendmsg+0x159/0x270
[  762.969258]  [<c01406f3>] __lock_acquire+0x283/0x1060
[  762.969258]  [<c010951a>] native_sched_clock+0x7a/0xb0
[  762.969258]  [<c010951a>] native_sched_clock+0x7a/0xb0
[  762.969258]  [<c040dbf2>] sys_socketcall+0x82/0x280
[  762.969258]  [<c0103db8>] sysenter_past_esp+0xa5/0xb1
[  762.969258]  [<c0103db8>] sysenter_past_esp+0xa5/0xb1
[  762.969258]  [<c0103d7d>] sysenter_past_esp+0x6a/0xb1
[  762.969258]  =======================


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux