On Mon, Jan 18, 2010 at 1:35 AM, Lenin Ravindranath S <sle...@gmail.com> wrote:
> I am running 2.6.27.37-170.2.104.fc10.i686.
>
> Can you point me to the patch that will enable me to set rates?
> Even the b/g rates doesn't seem to work. The packets are sent out at 1Mbps
> always.
>
> On Sun, Jan 17, 2010 at 3:18 AM, Benoit PAPILLAULT
> <benoit.papilla...@free.fr> wrote:
>>
>> Lenin Ravindranath S a écrit :
>> > Hi,
>> >
>> > I am new to ath9k. I have a DWA-642 card and I am trying to set it in
>> > monitor mode to inject and receive packets.
>> >
>> > I did
>> >
>> > iw dev wlan0 interface add fish0 type monitor
>> > ifconfig fish0 up
>> >
>> >
>> > I have two problems
>> > 1. The interface is able to get only packets which has destination
>> > address as a broadcast address (FF:FF:FF:FF:FF:FF) and not every packet
>> > in the air.
>>
>> That's not expected. Maybe you should set the channel as well :
>> iw dev fish0 set channel 1
>>
>> >
>> > 2. Whatever rate I set in radiotap header to inject packet, the packet
>> > goes out at only 1Mbps. I tried to use both packetspammer and "click
>> > router" to try to inject packets.
>>
>> Indeed, that's not implemented. There are patches to do it however.
>>
>> >
>> > Am I missing some flags/settings?
>>
>> Yes. What kernel are you using?
>>
>> >
>> > Thanks
>> > Lenin
>>
>> Regards,
>> Benoit
>>
>
>
> _______________________________________________
> ath9k-devel mailing list
> ath9k-devel@lists.ath9k.org
> https://lists.ath9k.org/mailman/listinfo/ath9k-devel
>
>

Here is it
Index: compat-wireless-2009-11-21/net/mac80211/tx.c
===================================================================
--- compat-wireless-2009-11-21.orig/net/mac80211/tx.c	2009-11-21 06:17:32.000000000 +0100
+++ compat-wireless-2009-11-21/net/mac80211/tx.c	2009-11-30 12:14:54.500163716 +0100
@@ -979,6 +979,47 @@
 				tx->flags |= IEEE80211_TX_FRAGMENTED;
 			break;
 
+		case IEEE80211_RADIOTAP_RATE: {
+			info->control.rates[0].idx = 0;
+			if (*iterator.this_arg) {
+				int i;
+				for (i = 0; i < sband->n_bitrates; i++)
+					if (sband->bitrates[i].bitrate <=
+						*iterator.this_arg * 5) {
+						info->control.rates[0].idx = i;
+						break;
+					}
+			}
+			info->control.rates[0].flags = 0;
+			info->control.rates[1].idx = -1;
+			info->control.rates[2].idx = -1;
+			info->control.rates[3].idx = -1;
+			info->control.rates[4].idx = -1;
+			break;
+		}
+
+		case IEEE80211_RADIOTAP_DATA_RETRIES:
+			info->control.rates[0].count = *iterator.this_arg;
+			break;
+
+		case IEEE80211_RADIOTAP_RATE_MCS: {
+			u8 flags;
+			if (info->control.rates[0].idx)
+				break;
+			flags = *(iterator.this_arg + 1);
+			info->control.rates[0].idx = *iterator.this_arg;
+
+			info->control.rates[0].flags |=
+				IEEE80211_TX_RC_MCS;
+			if (flags & IEEE80211_RADIOTAP_RATE_MCS_40MHZ)
+				info->control.rates[0].flags |=
+				IEEE80211_TX_RC_40_MHZ_WIDTH;
+			if (flags & IEEE80211_RADIOTAP_RATE_MCS_SHORT_GI)
+				info->control.rates[0].flags |=
+				IEEE80211_TX_RC_SHORT_GI;
+			break;
+		}
+
 		/*
 		 * Please update the file
 		 * Documentation/networking/mac80211-injection.txt
Index: compat-wireless-2009-11-21/include/net/ieee80211_radiotap.h
===================================================================
--- compat-wireless-2009-11-21.orig/include/net/ieee80211_radiotap.h	2009-11-21 06:17:32.000000000 +0100
+++ compat-wireless-2009-11-21/include/net/ieee80211_radiotap.h	2009-11-30 12:14:54.500163716 +0100
@@ -174,6 +174,11 @@
  *
  *     Number of rts retries a transmitted frame used.
  *
+ * IEEE80211_RADIOTAP_RATE_MCS       2 x u8          data, bitmap
+ *
+ *     First byte is the MCS index of the rate,
+ *     second one has flags about channel width and guard interval
+ *
  * IEEE80211_RADIOTAP_DATA_RETRIES      u8           data
  *
  *     Number of unicast retries a transmitted frame used.
@@ -198,6 +203,7 @@
 	IEEE80211_RADIOTAP_TX_FLAGS = 15,
 	IEEE80211_RADIOTAP_RTS_RETRIES = 16,
 	IEEE80211_RADIOTAP_DATA_RETRIES = 17,
+	IEEE80211_RADIOTAP_RATE_MCS = 19,
 	IEEE80211_RADIOTAP_EXT = 31
 };
 
@@ -241,6 +247,10 @@
 #define IEEE80211_RADIOTAP_F_TX_CTS	0x0002	/* used cts 'protection' */
 #define IEEE80211_RADIOTAP_F_TX_RTS	0x0004	/* used rts/cts handshake */
 
+/* For IEEE80211_RADIOTAP_RATE_MCS */
+#define IEEE80211_RADIOTAP_RATE_MCS_40MHZ	0x01 /* 40 MHz channel width */
+#define IEEE80211_RADIOTAP_RATE_MCS_SHORT_GI	0x02 /* short guard interval */
+
 /* Ugly macro to convert literal channel numbers into their mhz equivalents
  * There are certianly some conditions that will break this (like feeding it '30')
  * but they shouldn't arise since nothing talks on channel 30. */
Index: compat-wireless-2009-11-21/net/wireless/radiotap.c
===================================================================
--- compat-wireless-2009-11-21.orig/net/wireless/radiotap.c	2009-11-21 06:17:32.000000000 +0100
+++ compat-wireless-2009-11-21/net/wireless/radiotap.c	2009-11-30 12:14:54.500163716 +0100
@@ -164,6 +164,7 @@
 		[IEEE80211_RADIOTAP_TX_FLAGS] = 0x22,
 		[IEEE80211_RADIOTAP_RTS_RETRIES] = 0x11,
 		[IEEE80211_RADIOTAP_DATA_RETRIES] = 0x11,
+		[IEEE80211_RADIOTAP_RATE_MCS] = 0x12,
 		/*
 		 * add more here as they are defined in
 		 * include/net/ieee80211_radiotap.h
Index: compat-wireless-2009-11-21/net/mac80211/rx.c
===================================================================
--- compat-wireless-2009-11-21.orig/net/mac80211/rx.c	2009-11-21 06:17:36.000000000 +0100
+++ compat-wireless-2009-11-21/net/mac80211/rx.c	2009-11-30 12:14:54.500163716 +0100
@@ -86,7 +86,8 @@
 		len += 1;
 	if (local->hw.flags & IEEE80211_HW_NOISE_DBM)
 		len += 1;
-
+	if (status->flag & RX_FLAG_HT)
+		len += 2;
 	if (len & 1) /* padding for RX_FLAGS if necessary */
 		len++;
 
@@ -142,19 +143,11 @@
 	pos++;
 
 	/* IEEE80211_RADIOTAP_RATE */
-	if (status->flag & RX_FLAG_HT) {
-		/*
-		 * TODO: add following information into radiotap header once
-		 * suitable fields are defined for it:
-		 * - MCS index (status->rate_idx)
-		 * - HT40 (status->flag & RX_FLAG_40MHZ)
-		 * - short-GI (status->flag & RX_FLAG_SHORT_GI)
-		 */
+	rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE);
+	if (status->flag & RX_FLAG_HT)
 		*pos = 0;
-	} else {
-		rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE);
+	else
 		*pos = rate->bitrate / 5;
-	}
 	pos++;
 
 	/* IEEE80211_RADIOTAP_CHANNEL */
@@ -206,6 +199,20 @@
 		rx_flags |= IEEE80211_RADIOTAP_F_RX_BADPLCP;
 	put_unaligned_le16(rx_flags, pos);
 	pos += 2;
+
+	/* IEEE80211_RADIOTAP_RATE_MCS */
+	if (status->flag & RX_FLAG_HT) {
+		rthdr->it_present |=
+			cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE_MCS);
+		*pos = status->rate_idx;
+		pos++;
+		*pos = 0;
+		if (status->flag & RX_FLAG_40MHZ)
+			*pos |= IEEE80211_RADIOTAP_RATE_MCS_40MHZ;
+		if (status->flag & RX_FLAG_SHORT_GI)
+			*pos |= IEEE80211_RADIOTAP_RATE_MCS_SHORT_GI;
+		pos++;
+	}
 }
 
 /*
Index: compat-wireless-2009-11-21/net/mac80211/ieee80211_i.h
===================================================================
--- compat-wireless-2009-11-21.orig/net/mac80211/ieee80211_i.h	2009-11-21 06:17:32.000000000 +0100
+++ compat-wireless-2009-11-21/net/mac80211/ieee80211_i.h	2009-11-30 12:14:54.500163716 +0100
@@ -965,6 +965,7 @@
 	u8 padding_for_rate;
 	__le16 tx_flags;
 	u8 data_retries;
+	u8 mcs; /*HT rates*/
 } __attribute__ ((packed));
 
 
Index: compat-wireless-2009-11-21/net/mac80211/status.c
===================================================================
--- compat-wireless-2009-11-21.orig/net/mac80211/status.c	2009-11-21 06:17:32.000000000 +0100
+++ compat-wireless-2009-11-21/net/mac80211/status.c	2009-11-30 12:16:45.620220980 +0100
@@ -293,6 +293,16 @@
 	    !(info->status.rates[0].flags & IEEE80211_TX_RC_MCS))
 		rthdr->rate = sband->bitrates[
 				info->status.rates[0].idx].bitrate / 5;
+	/* HT rates */
+	if (info->status.rates[0].flags & IEEE80211_TX_RC_MCS) {
+		rthdr->hdr.it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE_MCS);
+		rthdr->rate = 0;
+		rthdr->mcs = info->status.rates[0].idx;
+		if (info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
+			rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_RATE_MCS_40MHZ);
+		if (info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
+			rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_RATE_MCS_SHORT_GI);
+	}
 
 	/* for now report the total retry_count */
 	rthdr->data_retries = retry_count;
_______________________________________________
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel

Reply via email to