Commit b73188ee626ab417ae4b879f510fc55f3af63a03

Authored by Ginés García
1 parent a4e47b81

Block_ack mechanism implemented for peers. Just need to test it

setup-wlan.py
... ... @@ -51,7 +51,7 @@ if video_nodes > 0:
51 51  
52 52 # Peers Configuration
53 53 #utils_peers.configure_peers(peers_file_path, ap_addr, bssid, rate, power, channel, mechanism)
54   -'''
  54 +
55 55 index = 0
56 56 with open(peers_file_path) as peers_file_opened:
57 57 for peer in peers_file_opened:
... ... @@ -63,7 +63,7 @@ if video_nodes > 0:
63 63 if peer_ip_wired != ap_addr:
64 64 index = index+1
65 65 thr_name = "thread_%d" % index
66   - t = threading.Thread(target=utils_peers.configure_peer, name=thr_name, args=(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanism))
  66 + t = threading.Thread(target=utils_peers.configure_peer, name=thr_name, args=(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanism, b_size, retries))
67 67 threads.append(t)
68 68 t.start()
69 69 time.sleep(0.005)
... ... @@ -71,4 +71,4 @@ if video_nodes > 0:
71 71 for thread in threads:
72 72 t.join()
73 73 print "Configuration process end"
74   -'''
  74 +
... ...
setup-wlan.py~
... ... @@ -51,7 +51,7 @@ if video_nodes > 0:
51 51  
52 52 # Peers Configuration
53 53 #utils_peers.configure_peers(peers_file_path, ap_addr, bssid, rate, power, channel, mechanism)
54   -'''
  54 +
55 55 index = 0
56 56 with open(peers_file_path) as peers_file_opened:
57 57 for peer in peers_file_opened:
... ... @@ -71,4 +71,4 @@ if video_nodes > 0:
71 71 for thread in threads:
72 72 t.join()
73 73 print "Configuration process end"
74   -'''
  74 +
... ...
utils_peers.py
... ... @@ -5,11 +5,12 @@ import os, sys, time, re, subprocess
5 5 # Global variables
6 6 path_module_b43 = "/lib/modules/2.6.36/kernel/drivers/net/wireless"
7 7 path_module_80211 = "/lib/modules/2.6.36/kernel/net/mac80211"
  8 +path_firm_b43_blockack = "/lib/firmware/b43.video/firmware.blockack"
8 9  
9 10 # Run method executed by threads in order to configure one peer
10 11 # - Input: peer_ip, peer_ip_wired, bssid, rate, power, channel
11 12 # - Configure interfaces, load modules based on the selected mechanism, start peer and check it's configuration
12   -def configure_peer(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanism):
  13 +def configure_peer(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanism, b_size, retries):
13 14 print threading.currentThread().getName(), "configuring %s" % peer_ip_wired
14 15 reload_peer(peer_ip_wired)
15 16 set_mechanism(peer_ip_wired, mechanism)
... ... @@ -43,7 +44,8 @@ def reload_peer(peer_ip_wired):
43 44 utils_config.exec_command_ssh(peer_ip_wired, "rm %s/b43" % path_module_b43)
44 45 utils_config.exec_command_ssh(peer_ip_wired, "rm %s/mac80211.ko" % path_module_80211)
45 46 utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/mac80211.video.ko %s/mac80211.ko" % (path_module_80211, path_module_80211))
46   - utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43.orig %s/b43" % (path_module_b43,path_module_b43))
  47 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43.video %s/b43" % (path_module_b43,path_module_b43))
  48 + time.sleep(0.5)
47 49 utils_config.exec_command_ssh(peer_ip_wired, "modprobe mac80211")
48 50  
49 51  
... ... @@ -52,7 +54,13 @@ def reload_peer(peer_ip_wired):
52 54 def set_mechanism(peer_ip_wired, mechanism):
53 55 #print "Mechanism %s selected for the peer" % mechanism
54 56  
55   - if mechanism == "LEGACY":
  57 + if mechanism == "BLOCK_ACK":
  58 + set_block_ack(peer_ip_wired, rate, b_size)
  59 + elif mechanism == "DMS":
  60 + set_dms()
  61 + elif mechanism == "UR":
  62 + set_ur()
  63 + elif mechanism == "LEGACY":
56 64 utils_config.exec_command_ssh(peer_ip_wired, "ln -s /lib/firmware/b43.legacy/ /lib/firmware/b43")
57 65 #utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43-2.6.36-orig.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
58 66 utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43.orig-dmasingleworker.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
... ... @@ -90,3 +98,14 @@ def check_peer(peer_ip_wired, peer_ip):
90 98 return "ok"
91 99  
92 100  
  101 +# Load modules in order to enable BLOCK_ACK mechanism
  102 +# - Input: peer ip wired address, rate and b_size
  103 +def set_block_ack(peer_ip_wired, rate, b_size):
  104 + utils_config.exec_command("cp %s/%s/ucode5.back-%s.fw %s/ucode5.fw" % (path_firm_b43_blockack, rate, b_size, path_firm_b43_blockack))
  105 + utils_config.exec_command_ssh(peer_ip_wired, "cp %s/%s/ucode5.back-%s.fw %s/ucode5.fw" % (path_firm_b43_blockack, rate, b_size, path_firm_b43_blockack))
  106 +
  107 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/ /lib/firmware/b43" % path_firm_b43_blockack)
  108 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43.rate-adaptation.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
  109 + utils_config.exec_command_ssh(peer_ip_wired, "modprobe b43 qos=1 aseq=1 frate=1 bsize=%s brate=%s && sleep 0.5" % (b_size, rate))
  110 +
  111 +
... ...
utils_peers.py~
... ... @@ -5,11 +5,12 @@ import os, sys, time, re, subprocess
5 5 # Global variables
6 6 path_module_b43 = "/lib/modules/2.6.36/kernel/drivers/net/wireless"
7 7 path_module_80211 = "/lib/modules/2.6.36/kernel/net/mac80211"
  8 +path_firm_b43_blockack = "/lib/firmware/b43.video/firmware.blockack"
8 9  
9 10 # Run method executed by threads in order to configure one peer
10 11 # - Input: peer_ip, peer_ip_wired, bssid, rate, power, channel
11 12 # - Configure interfaces, load modules based on the selected mechanism, start peer and check it's configuration
12   -def configure_peer(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanism):
  13 +def configure_peer(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanism, b_size, retries):
13 14 print threading.currentThread().getName(), "configuring %s" % peer_ip_wired
14 15 reload_peer(peer_ip_wired)
15 16 set_mechanism(peer_ip_wired, mechanism)
... ... @@ -28,23 +29,24 @@ def configure_peer(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanis
28 29 def reload_peer(peer_ip_wired):
29 30  
30 31 # kill all wpa supplicants
31   - wpa_supplicant_pids = utils_config.exec_command(peer_ip_wired, "pgrep -x wpa_supplicant")
  32 + wpa_supplicant_pids = utils_config.exec_command_ssh(peer_ip_wired, "pgrep -x wpa_supplicant")
32 33 for pid in wpa_supplicant_pids:
33 34 pid = int(pid)
34   - utils_config.exec_command(peer_ip_wired, ("kill -SIGTERM %d" % pid))
  35 + utils_config.exec_command_ssh(peer_ip_wired, ("kill -SIGTERM %d" % pid))
35 36 #print "Process wpa supplicand (pid = %d) killed" % pid
36 37  
37 38 # Reconfigure interface
38 39 #print "Reconfiguring peer %s Interface" % peer_ip_wired
39   - utils_config.exec_command(peer_ip_wired, "rmmod b43 && sleep 1")
40   - utils_config.exec_command(peer_ip_wired, "rmmod mac80211")
41   - utils_config.exec_command(peer_ip_wired, "rm /lib/firmware/b43")
42   - utils_config.exec_command(peer_ip_wired, "rm %s/b43/b43.ko" % path_module_b43)
43   - utils_config.exec_command(peer_ip_wired, "rm %s/b43" % path_module_b43)
44   - utils_config.exec_command(peer_ip_wired, "rm %s/mac80211.ko" % path_module_80211)
45   - utils_config.exec_command(peer_ip_wired, "ln -s %s/mac80211.video.ko %s/mac80211.ko" % (path_module_80211, path_module_80211))
46   - utils_config.exec_command(peer_ip_wired, "ln -s %s/b43.orig %s/b43" % (path_module_b43,path_module_b43))
47   - utils_config.exec_command(peer_ip_wired, "modprobe mac80211")
  40 + utils_config.exec_command_ssh(peer_ip_wired, "rmmod b43 && sleep 1")
  41 + utils_config.exec_command_ssh(peer_ip_wired, "rmmod mac80211")
  42 + utils_config.exec_command_ssh(peer_ip_wired, "rm /lib/firmware/b43")
  43 + utils_config.exec_command_ssh(peer_ip_wired, "rm %s/b43/b43.ko" % path_module_b43)
  44 + utils_config.exec_command_ssh(peer_ip_wired, "rm %s/b43" % path_module_b43)
  45 + utils_config.exec_command_ssh(peer_ip_wired, "rm %s/mac80211.ko" % path_module_80211)
  46 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/mac80211.video.ko %s/mac80211.ko" % (path_module_80211, path_module_80211))
  47 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43.video %s/b43" % (path_module_b43,path_module_b43))
  48 + time.sleep(0.5)
  49 + utils_config.exec_command_ssh(peer_ip_wired, "modprobe mac80211")
48 50  
49 51  
50 52 # Enable b43 module using different sources depending of the selected mechanism
... ... @@ -52,34 +54,40 @@ def reload_peer(peer_ip_wired):
52 54 def set_mechanism(peer_ip_wired, mechanism):
53 55 #print "Mechanism %s selected for the peer" % mechanism
54 56  
55   - if mechanism == "LEGACY":
56   - utils_config.exec_command(peer_ip_wired, "ln -s /lib/firmware/b43.legacy/ /lib/firmware/b43")
57   - #utils_config.exec_command(peer_ip_wired, "ln -s %s/b43/b43-2.6.36-orig.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
58   - utils_config.exec_command(peer_ip_wired, "ln -s %s/b43/b43.orig-dmasingleworker.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
59   - utils_config.exec_command(peer_ip_wired, "modprobe b43 qos=1 && sleep 1")
  57 + if mechanism == "BLOCK_ACK":
  58 + set_block_ack()
  59 + elif mechanism == "DMS":
  60 + set_dms()
  61 + elif mechanism == "UR":
  62 + set_ur()
  63 + elif mechanism == "LEGACY":
  64 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s /lib/firmware/b43.legacy/ /lib/firmware/b43")
  65 + #utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43-2.6.36-orig.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
  66 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43.orig-dmasingleworker.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
  67 + utils_config.exec_command_ssh(peer_ip_wired, "modprobe b43 qos=1 && sleep 1")
60 68  
61 69  
62 70 # Start peer with the given configuration, set up wlan0 (peer_ip -> 192.168.98.xxx) and join to the AP
63 71 # - Input: Input: Peer address, rate, channel and power that we want to stablish in the AP
64 72 def start_ap(peer_ip_wired, peer_ip, bssid, rate, power, channel):
65 73 # Up wlan0 ,search and join AP
66   - utils_config.exec_command(peer_ip_wired, "ifconfig wlan0 %s up" % peer_ip)
67   - utils_config.exec_command(peer_ip_wired, "iwlist wlan0 scan | grep %s -C 5" % bssid)
68   - utils_config.exec_command(peer_ip_wired, "wpa_supplicant -B -Dwext -iwlan0 -c/root/wpa_supplicant.conf")
69   - utils_config.exec_command(peer_ip_wired, "iwconfig wlan0 rate %s fixed channel %s txpower %s fixed" % (rate, channel, power))
  74 + utils_config.exec_command_ssh(peer_ip_wired, "ifconfig wlan0 %s up" % peer_ip)
  75 + utils_config.exec_command_ssh(peer_ip_wired, "iwlist wlan0 scan | grep %s -C 5" % bssid)
  76 + utils_config.exec_command_ssh(peer_ip_wired, "wpa_supplicant -B -Dwext -iwlan0 -c/root/wpa_supplicant.conf")
  77 + utils_config.exec_command_ssh(peer_ip_wired, "iwconfig wlan0 rate %s fixed channel %s txpower %s fixed" % (rate, channel, power))
70 78  
71 79 #print "Configuring multicast route"
72   - #utils_config.exec_command(peer_ip_wired, "route add -host 224.0.0.1 wlan0")
  80 + #utils_config.exec_command_ssh(peer_ip_wired, "route add -host 224.0.0.1 wlan0")
73 81  
74 82 #print "Setting arp table"
75   - #utils_config.exec_command(peer_ip_wired, "/root/setarp.sh 192.168.98.10")
  83 + #utils_config.exec_command_ssh(peer_ip_wired, "/root/setarp.sh 192.168.98.10")
76 84  
77 85 # Check if all the configuration is correctly set
78 86 # - Input: Peer address (wired and wlan0 interface)
79 87 def check_peer(peer_ip_wired, peer_ip):
80   - if utils_config.exec_command(peer_ip_wired, "modprobe -l | grep mac80211.ko") == "ERROR":
  88 + if utils_config.exec_command_ssh(peer_ip_wired, "modprobe -l | grep mac80211.ko") == "ERROR":
81 89 return "mac80211"
82   - elif utils_config.exec_command(peer_ip_wired, "modprobe -l | grep b43.ko") == "ERROR":
  90 + elif utils_config.exec_command_ssh(peer_ip_wired, "modprobe -l | grep b43.ko") == "ERROR":
83 91 return "b43"
84 92 else:
85 93 time.sleep(0.5)
... ... @@ -89,4 +97,12 @@ def check_peer(peer_ip_wired, peer_ip):
89 97 else:
90 98 return "ok"
91 99  
  100 +def set_block_ack(peer_ip_wired, rate, b_size):
  101 + utils_config.exec_command("cp %s/%s/ucode5.back-%s.fw %s/ucode5.fw" % (path_firm_b43_blockack, rate, b_size, path_firm_b43_blockack))
  102 + utils_config.exec_command_ssh(peer_ip_wired, "cp %s/%s/ucode5.back-%s.fw %s/ucode5.fw" % (path_firm_b43_blockack, rate, b_size, path_firm_b43_blockack))
  103 +
  104 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/ /lib/firmware/b43" % path_firm_b43_blockack)
  105 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43.rate-adaptation.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
  106 + utils_config.exec_command_ssh(peer_ip_wired, "modprobe b43 qos=1 aseq=1 frate=1 bsize=%s brate=%s && sleep 0.5" % (b_size, rate))
  107 +
92 108  
... ...