[PATCH 1/2]: mac80211: set tx rate and retries when injecting

STALE5588d

5 messages, 3 authors, 2011-05-23 · open the first message on its own page

[PATCH 1/2]: mac80211: set tx rate and retries when injecting

From: Matteo Croce <hidden>
Date: 2011-05-19 23:13:42

Allow to set the tx rate and retries when injecting:
read the information from the radiotap header and populate the retry chain

Signed-off-by: Matteo Croce <redacted>
--- a/net/mac80211/tx.c	2011-05-20 00:22:56.250640264 +0200
+++ b/net/mac80211/tx.c	2011-05-20 00:24:14.010640270 +0200
@@ -1092,6 +1092,44 @@
 				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_MCS: {
+			u8 flags = iterator.this_arg[1];
+			u8 mcs = iterator.this_arg[2];
+			info->control.rates[0].idx = mcs;
+			info->control.rates[0].flags |=
+				IEEE80211_TX_RC_MCS;
+			if (flags & IEEE80211_RADIOTAP_MCS_BW_40)
+				info->control.rates[0].flags |=
+				IEEE80211_TX_RC_40_MHZ_WIDTH;
+			if (flags & IEEE80211_RADIOTAP_MCS_SGI)
+				info->control.rates[0].flags |=
+				IEEE80211_TX_RC_SHORT_GI;
+			break;
+		}
+
 		/*
 		 * Please update the file
 		 * Documentation/networking/mac80211-injection.txt
--- a/net/mac80211/ieee80211_i.h	2011-05-20 00:22:56.240640264 +0200
+++ b/net/mac80211/ieee80211_i.h	2011-05-20 00:24:14.010640270 +0200
@@ -1217,6 +1217,10 @@
 	u8 padding_for_rate;
 	__le16 tx_flags;
 	u8 data_retries;
+	/*HT info*/
+	u8 ht_known;
+	u8 ht_flag;
+	u8 ht_mcs;
 } __packed;


--- a/net/wireless/radiotap.c	2011-05-20 00:22:56.270640264 +0200
+++ b/net/wireless/radiotap.c	2011-05-20 00:24:14.010640270 +0200
@@ -40,6 +40,7 @@
 	[IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, },
 	[IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, },
 	[IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
+	[IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
 	/*
 	 * add more here as they are defined in radiotap.h
 	 */
--- a/include/net/mac80211.h	2011-05-20 00:22:56.210640264 +0200
+++ b/include/net/mac80211.h	2011-05-20 00:24:14.020640270 +0200
@@ -2278,7 +2278,7 @@
  * The TX headroom reserved by mac80211 for its own tx_status functions.
  * This is enough for the radiotap header.
  */
-#define IEEE80211_TX_STATUS_HEADROOM	13
+#define IEEE80211_TX_STATUS_HEADROOM	16

 /**
  * ieee80211_sta_set_tim - set the TIM bit for a sleeping station

Re: [PATCH 1/2]: mac80211: set tx rate and retries when injecting

From: Roberto Riggio <hidden>
Date: 2011-05-20 10:07:35

Shouldn't the patch bypass the rate control algo and specifically
this piece of code in tx.c:

     if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL))
         CALL_TXH(ieee80211_tx_h_rate_ctrl);

Thanks

Il 20/05/2011 01:13, Matteo Croce ha scritto:
quoted hunk
Allow to set the tx rate and retries when injecting:
read the information from the radiotap header and populate the retry chain

Signed-off-by: Matteo Croce<redacted>
--- a/net/mac80211/tx.c	2011-05-20 00:22:56.250640264 +0200
+++ b/net/mac80211/tx.c	2011-05-20 00:24:14.010640270 +0200
@@ -1092,6 +1092,44 @@
  				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_MCS: {
+			u8 flags = iterator.this_arg[1];
+			u8 mcs = iterator.this_arg[2];
+			info->control.rates[0].idx = mcs;
+			info->control.rates[0].flags |=
+				IEEE80211_TX_RC_MCS;
+			if (flags&  IEEE80211_RADIOTAP_MCS_BW_40)
+				info->control.rates[0].flags |=
+				IEEE80211_TX_RC_40_MHZ_WIDTH;
+			if (flags&  IEEE80211_RADIOTAP_MCS_SGI)
+				info->control.rates[0].flags |=
+				IEEE80211_TX_RC_SHORT_GI;
+			break;
+		}
+
  		/*
  		 * Please update the file
  		 * Documentation/networking/mac80211-injection.txt
--- a/net/mac80211/ieee80211_i.h	2011-05-20 00:22:56.240640264 +0200
+++ b/net/mac80211/ieee80211_i.h	2011-05-20 00:24:14.010640270 +0200
@@ -1217,6 +1217,10 @@
  	u8 padding_for_rate;
  	__le16 tx_flags;
  	u8 data_retries;
+	/*HT info*/
+	u8 ht_known;
+	u8 ht_flag;
+	u8 ht_mcs;
  } __packed;


--- a/net/wireless/radiotap.c	2011-05-20 00:22:56.270640264 +0200
+++ b/net/wireless/radiotap.c	2011-05-20 00:24:14.010640270 +0200
@@ -40,6 +40,7 @@
  	[IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, },
  	[IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, },
  	[IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
+	[IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
  	/*
  	 * add more here as they are defined in radiotap.h
  	 */
--- a/include/net/mac80211.h	2011-05-20 00:22:56.210640264 +0200
+++ b/include/net/mac80211.h	2011-05-20 00:24:14.020640270 +0200
@@ -2278,7 +2278,7 @@
   * The TX headroom reserved by mac80211 for its own tx_status functions.
   * This is enough for the radiotap header.
   */
-#define IEEE80211_TX_STATUS_HEADROOM	13
+#define IEEE80211_TX_STATUS_HEADROOM	16

  /**
   * ieee80211_sta_set_tim - set the TIM bit for a sleeping station
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
--------------------------------------------------------
Roberto Riggio, Ph.D.
CREATE-NET
Network&  Security Solutions for Pervasive Computing Systems (iNSPIRE)
Senior Researcher
Via alla Cascata 56/D - 38123 Povo Trento (Italy)
e-mail: roberto.riggio@create-net.org
Tel: (+39) 0461 408400 - interno/extension 708
Fax: (+39) 0461 421157
www.create-net.org/~rriggio
--------------------------------------------------------

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited according to
the Italian Law 196/2003 of the Legislature. If you received this in
error, please contact the sender and delete the material from any
computer.

Le informazioni contenute in questo messaggio di posta elettronica e nei
file allegati sono da considerarsi strettamente riservate. Il loro
utilizzo e' consentito esclusivamente al destinatario del messaggio, per
le finalita' indicate nel messaggio stesso. Qualora riceveste questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla cancellazione del
messaggio stesso dal Vostro sistema. Trattenere il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo,
od utilizzarlo per finalita' diverse, costituisce comportamento
contrario ai principi dettati dal D. Lgs. 196/2003.

Re: [PATCH 1/2]: mac80211: set tx rate and retries when injecting

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2011-05-20 15:10:42

quoted hunk
+++ b/net/mac80211/ieee80211_i.h	2011-05-20 00:24:14.010640270 +0200
@@ -1217,6 +1217,10 @@
 	u8 padding_for_rate;
 	__le16 tx_flags;
 	u8 data_retries;
+	/*HT info*/
+	u8 ht_known;
+	u8 ht_flag;
+	u8 ht_mcs;
 } __packed;
quoted hunk
--- a/include/net/mac80211.h	2011-05-20 00:22:56.210640264 +0200
+++ b/include/net/mac80211.h	2011-05-20 00:24:14.020640270 +0200
@@ -2278,7 +2278,7 @@
  * The TX headroom reserved by mac80211 for its own tx_status functions.
  * This is enough for the radiotap header.
  */
-#define IEEE80211_TX_STATUS_HEADROOM	13
+#define IEEE80211_TX_STATUS_HEADROOM	16
This both belongs to the other patch.

johannes

Re: [PATCH 1/2]: mac80211: set tx rate and retries when injecting

From: Matteo Croce <hidden>
Date: 2011-05-23 00:30:58

2011/5/20 Roberto Riggio [off-list ref]:
Shouldn't the patch bypass the rate control algo and specifically
this piece of code in tx.c:

   if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL))
       CALL_TXH(ieee80211_tx_h_rate_ctrl);

Thanks

Il 20/05/2011 01:13, Matteo Croce ha scritto:
quoted
Allow to set the tx rate and retries when injecting:
read the information from the radiotap header and populate the retry chain

Signed-off-by: Matteo Croce<redacted>
--- a/net/mac80211/tx.c 2011-05-20 00:22:56.250640264 +0200
+++ b/net/mac80211/tx.c 2011-05-20 00:24:14.010640270 +0200
@@ -1092,6 +1092,44 @@
                               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_MCS: {
+                       u8 flags = iterator.this_arg[1];
+                       u8 mcs = iterator.this_arg[2];
+                       info->control.rates[0].idx = mcs;
+                       info->control.rates[0].flags |=
+                               IEEE80211_TX_RC_MCS;
+                       if (flags&  IEEE80211_RADIOTAP_MCS_BW_40)
+                               info->control.rates[0].flags |=
+                               IEEE80211_TX_RC_40_MHZ_WIDTH;
+                       if (flags&  IEEE80211_RADIOTAP_MCS_SGI)
+                               info->control.rates[0].flags |=
+                               IEEE80211_TX_RC_SHORT_GI;
+                       break;
+               }
+
               /*
                * Please update the file
                * Documentation/networking/mac80211-injection.txt
--- a/net/mac80211/ieee80211_i.h        2011-05-20 00:22:56.240640264
+0200
+++ b/net/mac80211/ieee80211_i.h        2011-05-20 00:24:14.010640270
+0200
@@ -1217,6 +1217,10 @@
       u8 padding_for_rate;
       __le16 tx_flags;
       u8 data_retries;
+       /*HT info*/
+       u8 ht_known;
+       u8 ht_flag;
+       u8 ht_mcs;
 } __packed;

--- a/net/wireless/radiotap.c   2011-05-20 00:22:56.270640264 +0200
+++ b/net/wireless/radiotap.c   2011-05-20 00:24:14.010640270 +0200
@@ -40,6 +40,7 @@
       [IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, },
       [IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, },
       [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
+       [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
       /*
        * add more here as they are defined in radiotap.h
        */
--- a/include/net/mac80211.h    2011-05-20 00:22:56.210640264 +0200
+++ b/include/net/mac80211.h    2011-05-20 00:24:14.020640270 +0200
@@ -2278,7 +2278,7 @@
  * The TX headroom reserved by mac80211 for its own tx_status functions.
  * This is enough for the radiotap header.
  */
-#define IEEE80211_TX_STATUS_HEADROOM   13
+#define IEEE80211_TX_STATUS_HEADROOM   16

 /**
  * ieee80211_sta_set_tim - set the TIM bit for a sleeping station
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
--------------------------------------------------------
Roberto Riggio, Ph.D.
CREATE-NET
Network&  Security Solutions for Pervasive Computing Systems (iNSPIRE)
Senior Researcher
Via alla Cascata 56/D - 38123 Povo Trento (Italy)
e-mail: roberto.riggio@create-net.org
Tel: (+39) 0461 408400 - interno/extension 708
Fax: (+39) 0461 421157
www.create-net.org/~rriggio
--------------------------------------------------------

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited according to
the Italian Law 196/2003 of the Legislature. If you received this in
error, please contact the sender and delete the material from any
computer.

Le informazioni contenute in questo messaggio di posta elettronica e nei
file allegati sono da considerarsi strettamente riservate. Il loro
utilizzo e' consentito esclusivamente al destinatario del messaggio, per
le finalita' indicate nel messaggio stesso. Qualora riceveste questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla cancellazione del
messaggio stesso dal Vostro sistema. Trattenere il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo,
od utilizzarlo per finalita' diverse, costituisce comportamento
contrario ai principi dettati dal D. Lgs. 196/2003.
I'm not sure that the rate control is used in monitor mode

-- 
Matteo Croce
OpenWrt Developer
 _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|
         |__| W I R E L E S S   F R E E D O M
ATTITUDE ADJUSTMENT (bleeding edge) --------------
 * 1/4 oz Vodka      Pour all ingredents into mixing
 * 1/4 oz Gin        tin with ice, strain into glass.
 * 1/4 oz Amaretto
 * 1/4 oz Triple sec
 * 1/4 oz Peach schnapps
 * 1/4 oz Sour mix
 * 1 splash Cranberry juice
-----------------------------------------------------

Re: [PATCH 1/2]: mac80211: set tx rate and retries when injecting

From: Roberto Riggio <hidden>
Date: 2011-05-23 06:59:27

Il 23/05/2011 02:30, Matteo Croce ha scritto:
I'm not sure that the rate control is used in monitor mode
well, without that piece of code the frame is not injected. I'm talking
about 11a/g rates since for 11n rates I still did not manage
to have it working.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help