PERFORCE change 135037 for review

Sepherosa Ziehau sephe at FreeBSD.org
Fri Feb 8 05:21:16 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=135037

Change 135037 by sephe at sephe_zealot:sam_wifi on 2008/02/08 13:21:08

	Use single TX sequence space for packets sent by the NIC.
	This is used to assist some hardwares which can not generate TX
	sequence for outgoing packets, e.g. 2560 parts of ral(4).
	
	Discussed with: sam
	
	# This commit is tested on 2560 part, but from the 802.11 tap, it
	# seems that a newly setup beacon is sent after data, however, the
	# situation is much better than have 0 in beacons' sequence field
	# (192.168.5.1 is AP):
	# 21:05:07.043979 Beacon (sephe-hostap) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] ESS CH: 6
	# 	0x0000:  8000 0000 ffff ffff ffff 0015 f2d7 420c
	# 	0x0010:  0015 f2d7 420c 402b 2265 f103 0000 0000
	# 	0x0020:  6400 2104 000c 7365 7068 652d 686f 7374
	# 	0x0030:  6170 0108 8284 8b96 0c12 1824 0301 0605
	# 	0x0040:  0400 0101 0007 064e 414f 010e 002a 0100
	# 	0x0050:  3204 3048 606c
	# 21:05:07.065888 IP 192.168.5.2 > 192.168.5.1: ICMP echo request, id 23363, seq 39, length 64
	# 	0x0000:  0801 2c00 0015 f2d7 420c 0014 787a 5990
	# 	0x0010:  0015 f2d7 420c b002 aaaa 0300 0000 0800
	# 	0x0020:  4500 0054 b8c5 0000 4001 3690 c0a8 0502
	# 	0x0030:  c0a8 0501 0800 1540 5b43 0027 47ac 5383
	# 	0x0040:  0001 0122 0809 0a0b 0c0d 0e0f 1011 1213
	# 	0x0050:  1415 1617 1819 1a1b 1c1d 1e1f 2021 2223
	# 	0x0060:  2425 2627 2829 2a2b 2c2d 2e2f 3031 3233
	# 	0x0070:  3435 3637
	# 21:05:07.066144 IP 192.168.5.1 > 192.168.5.2: ICMP echo reply, id 23363, seq 39, length 64
	# 	0x0000:  0802 2c00 0014 787a 5990 0015 f2d7 420c
	# 	0x0010:  0015 f2d7 420c 602b aaaa 0300 0000 0800
	# 	0x0020:  4500 0054 003b 0000 4001 ef1a c0a8 0501
	# 	0x0030:  c0a8 0502 0000 1d40 5b43 0027 47ac 5383
	# 	0x0040:  0001 0122 0809 0a0b 0c0d 0e0f 1011 1213
	# 	0x0050:  1415 1617 1819 1a1b 1c1d 1e1f 2021 2223
	# 	0x0060:  2425 2627 2829 2a2b 2c2d 2e2f 3031 3233
	# 	0x0070:  3435 3637
	# 21:05:07.145884 Beacon (sephe-hostap) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] ESS CH: 6
	# 	0x0000:  8000 0000 ffff ffff ffff 0015 f2d7 420c
	# 	0x0010:  0015 f2d7 420c 502b 34f3 f203 0000 0000
	# 	0x0020:  6400 2104 000c 7365 7068 652d 686f 7374
	# 	0x0030:  6170 0108 8284 8b96 0c12 1824 0301 0605
	# 	0x0040:  0400 0101 0007 064e 414f 010e 002a 0100
	# 	0x0050:  3204 3048 606c

Affected files ...

.. //depot/projects/wifi/sys/dev/ral/rt2560.c#33 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#88 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_output.c#80 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_var.h#63 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ral/rt2560.c#33 (text) ====

@@ -1316,6 +1316,7 @@
 {
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct rt2560_tx_data *data;
+	struct ieee80211_frame *wh;
 
 	if (ic->ic_opmode != IEEE80211_M_IBSS &&
 	    ic->ic_opmode != IEEE80211_M_HOSTAP)
@@ -1333,6 +1334,12 @@
 
 	ieee80211_beacon_update(data->ni, &sc->sc_bo, data->m, 1);
 
+	/* 2560 needs software to setup seuqence */
+	wh = mtod(data->m, struct ieee80211_frame *);
+	*(uint16_t *)wh->i_seq =
+	htole16(ic->ic_txseqs[IEEE80211_NONQOS_TID] << IEEE80211_SEQ_SEQ_SHIFT);
+	ic->ic_txseqs[IEEE80211_NONQOS_TID]++;
+
 	if (bpf_peers_present(ic->ic_rawbpf))
 		bpf_mtap(ic->ic_rawbpf, data->m);
 

==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#88 (text+ko) ====

@@ -575,10 +575,10 @@
 	si->isi_txpower = ni->ni_txpower;
 	si->isi_vlan = ni->ni_vlan;
 	if (ni->ni_flags & IEEE80211_NODE_QOS) {
-		memcpy(si->isi_txseqs, ni->ni_txseqs, sizeof(ni->ni_txseqs));
+		memcpy(si->isi_txseqs, ic->ic_txseqs, sizeof(ic->ic_txseqs));
 		memcpy(si->isi_rxseqs, ni->ni_rxseqs, sizeof(ni->ni_rxseqs));
 	} else {
-		si->isi_txseqs[0] = ni->ni_txseqs[IEEE80211_NONQOS_TID];
+		si->isi_txseqs[0] = ic->ic_txseqs[IEEE80211_NONQOS_TID];
 		si->isi_rxseqs[0] = ni->ni_rxseqs[IEEE80211_NONQOS_TID];
 	}
 	/* NB: leave all cases in case we relax ni_associd == 0 check */

==== //depot/projects/wifi/sys/net80211/ieee80211_output.c#80 (text+ko) ====

@@ -141,8 +141,8 @@
 	*(uint16_t *)&wh->i_dur[0] = 0;
 	/* NB: use non-QoS tid */
 	*(uint16_t *)&wh->i_seq[0] =
-	    htole16(ni->ni_txseqs[IEEE80211_NONQOS_TID] << IEEE80211_SEQ_SEQ_SHIFT);
-	ni->ni_txseqs[IEEE80211_NONQOS_TID]++;
+	    htole16(ic->ic_txseqs[IEEE80211_NONQOS_TID] << IEEE80211_SEQ_SEQ_SHIFT);
+	ic->ic_txseqs[IEEE80211_NONQOS_TID]++;
 #undef WH4
 }
 
@@ -811,12 +811,12 @@
 		qwh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_QOS;
 
 		*(uint16_t *)wh->i_seq =
-		    htole16(ni->ni_txseqs[tid] << IEEE80211_SEQ_SEQ_SHIFT);
-		ni->ni_txseqs[tid]++;
+		    htole16(ic->ic_txseqs[tid] << IEEE80211_SEQ_SEQ_SHIFT);
+		ic->ic_txseqs[tid]++;
 	} else {
 		*(uint16_t *)wh->i_seq =
-		    htole16(ni->ni_txseqs[IEEE80211_NONQOS_TID] << IEEE80211_SEQ_SEQ_SHIFT);
-		ni->ni_txseqs[IEEE80211_NONQOS_TID]++;
+		    htole16(ic->ic_txseqs[IEEE80211_NONQOS_TID] << IEEE80211_SEQ_SEQ_SHIFT);
+		ic->ic_txseqs[IEEE80211_NONQOS_TID]++;
 	}
 	/* check if xmit fragmentation is required */
 	txfrag = (m->m_pkthdr.len > ic->ic_fragthreshold &&

==== //depot/projects/wifi/sys/net80211/ieee80211_var.h#63 (text+ko) ====

@@ -217,6 +217,8 @@
 	int			ic_inact_auth;	/* auth but not assoc setting */
 	int			ic_inact_run;	/* authorized setting */
 	int			ic_inact_probe;	/* inactive probe time */
+						/* tx seq per-tid */
+	uint16_t		ic_txseqs[IEEE80211_TID_SIZE];
 
 	/*
 	 * Cipher state/configuration.


More information about the p4-projects mailing list