Steve's Thinfirm 1.5 developer notes

From OLPC
Jump to: navigation, search

thin firmware major issues

There are no known major issues at this time.

libertas_tf issues/todo

rfkill

The OLCP rfkill causes a deadlock when libertas_tf is used due to the following two threads of execution:

a. OLPC rfkill command powers down the wifi card

b. sdio notices wifi card removed, tries to unload libertas_tf
c. unload driver will call into mac80211, which tries to hold a lock

a. rfkill notifies mac80211 to do rfkill

b. mac80211 holds lock
c. mac80211 tries to call rfkill on driver (if driver supported this, we dont' happen to)

Proposed action:

1.a. OLPC removes rfkill patch that powers down card
b. cozybit adds rfkill support to libertas_tf

Power save

Powersave modes are not implemented in libertas_tf. Functions are stubbed.

Proposed action: cozybit implements proper powersave functions in libertas_tf.

mac80211 not honoring radiotap rate

In order to support the "honor tx rate on multi-cast transfer" patch done for Mitch on the XO1s, we need to fix mac80211 to support this. For some reason, the part of code in mac80211 that parses the tx rate portion of the radiotap header has been removed and this functionality needs to be moved back in. Specifically the function is in net/mac80211/tx.c in the function __ieee80211_parse_tx_radiotap. The below diff shows the difference between wireless-testing and the XO1 mac80211 that we tested the firmware change on.

--- /Volumes/cozybit/projects/OLPC/wireless-testing/net/mac80211/tx.c	2010-06-02 13:31:36.000000000 -0700
+++ /Volumes/cozybit/projects/OLPC/libertastf/net/mac80211/tx.c	2010-05-20 08:05:16.000000000 -0700

@@ -1034,6 +869,8 @@
 	 */
 
 	while (!ret) {
+		int i, target_rate;
+
 		ret = ieee80211_radiotap_iterator_next(&iterator);
 
 		if (ret)
@@ -1047,6 +884,38 @@
 		 * get_unaligned((type *)iterator.this_arg) to dereference
 		 * iterator.this_arg for type "type" safely on all arches.
 		*/
+		case IEEE80211_RADIOTAP_RATE:
+			/*
+			 * radiotap rate u8 is in 500kbps units eg, 0x02=1Mbps
+			 * ieee80211 rate int is in 100kbps units eg, 0x0a=1Mbps
+			 */
+			target_rate = (*iterator.this_arg) * 5;
+			for (i = 0; i < sband->n_bitrates; i++) {
+				struct ieee80211_rate *r;
+
+				r = &sband->bitrates[i];
+
+				if (r->bitrate == target_rate) {
+					tx->rate = r;
+					break;
+				}
+			}
+			break;
+
+		case IEEE80211_RADIOTAP_ANTENNA:
+			/*
+			 * radiotap uses 0 for 1st ant, mac80211 is 1 for
+			 * 1st ant
+			 */
+			control->antenna_sel_tx = (*iterator.this_arg) + 1;
+			break;
+
+#if 0
+		case IEEE80211_RADIOTAP_DBM_TX_POWER:
+			control->power_level = *iterator.this_arg;
+			break;
+#endif
+
 		case IEEE80211_RADIOTAP_FLAGS:
 			if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) {
 				/*
@@ -1056,13 +925,14 @@
 				 * because it will be recomputed and added
 				 * on transmission
 				 */
-				if (skb->len < (iterator._max_length + FCS_LEN))
-					return false;
+				if (skb->len < (iterator.max_length + FCS_LEN))
+					return TX_DROP;
 
 				skb_trim(skb, skb->len - FCS_LEN);
 			}
 			if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
-				info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
+				control->flags &=
+					~IEEE80211_TXCTL_DO_NOT_ENCRYPT;
 			if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
 				tx->flags |= IEEE80211_TX_FRAGMENTED;
 			break;

The XO1.5 firmware and the libertas_tf driver already support this functionality, so the only thing blocking this is the lack of implementation in mac80211.

Proposed action: cozybit adds the honor-rate from radiotap functionality back into mac80211. This change can be upstreamed. Note that it's not likely just as easy as adding the old code back in, I presume that it was removed when other internal changes were made to mac80211.