All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad)
@ 2012-07-02  6:32 Vladimir Kondratiev
  2012-07-02  6:32 ` [PATCH 60g v2 1/5] wireless: add 802.11ad (60gHz band) Vladimir Kondratiev
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Vladimir Kondratiev @ 2012-07-02  6:32 UTC (permalink / raw)
  To: John W . Linville, Johannes Berg
  Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez

These patches add minimal infrastructure for the 60gHz (802.11ad)
band WiFi drivers.

This change enables offload drivers for the 60GHz devices that implement
the 802.11 MAC functionality in the device itself.

Driver based on this infrastructure see at:
http://wireless.kernel.org/en/users/Drivers/wil6210

Identation should be fine now, thanks Joe Perches for hint.

I put in #if 0 one entry in MCS-to-bitrate translation table,
since it does not fit into u16. It should work fine until
real devices with 6.5Gbps bitrate appears.

Vladimir Kondratiev (5):
  wireless: add 802.11ad (60gHz band)
  wireless: rate check logic for 60g
  wireless: regulatory for 60g
  wireless: 60g protocol constants
  wireless: bitrate calculation for 60g

 include/linux/ieee80211.h |   89 +++++++++++++++++++++++++++++++++++++++++++-
 include/linux/nl80211.h   |    2 +
 include/net/cfg80211.h    |    4 ++
 net/mac80211/tx.c         |    2 +
 net/wireless/core.c       |   10 ++++-
 net/wireless/reg.c        |    5 ++-
 net/wireless/util.c       |   90 +++++++++++++++++++++++++++++++++++++++++----
 7 files changed, 190 insertions(+), 12 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 60g v2 1/5] wireless: add 802.11ad (60gHz band)
  2012-07-02  6:32 [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Vladimir Kondratiev
@ 2012-07-02  6:32 ` Vladimir Kondratiev
  2012-07-02 14:22   ` Arik Nemtsov
  2012-07-02  6:32 ` [PATCH 60g v2 2/5] wireless: rate check logic for 60g Vladimir Kondratiev
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 17+ messages in thread
From: Vladimir Kondratiev @ 2012-07-02  6:32 UTC (permalink / raw)
  To: John W . Linville, Johannes Berg
  Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez

Add enumerations for both cfg80211 and nl80211.
This expands wiphy.bands etc. arrays.

Extend channel <-> frequency translation to cover 60g band

Small fix for mac80211/tx.c required to fix compiler warning

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
 include/linux/nl80211.h |    2 ++
 include/net/cfg80211.h  |    2 ++
 net/mac80211/tx.c       |    2 ++
 net/wireless/util.c     |   30 ++++++++++++++++++++++--------
 4 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index c0fc5d2..679831e 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -2539,10 +2539,12 @@ enum nl80211_tx_rate_attributes {
  * enum nl80211_band - Frequency band
  * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
+ * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  */
 enum nl80211_band {
 	NL80211_BAND_2GHZ,
 	NL80211_BAND_5GHZ,
+	NL80211_BAND_60GHZ,
 };
 
 /**
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 061c019..56e840d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -70,11 +70,13 @@
  *
  * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
  * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
+ * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  * @IEEE80211_NUM_BANDS: number of defined bands
  */
 enum ieee80211_band {
 	IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
 	IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
+	IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
 
 	/* keep last */
 	IEEE80211_NUM_BANDS
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index ec8f5346..eebd33a 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -140,6 +140,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
 			if (r->flags & IEEE80211_RATE_MANDATORY_A)
 				mrate = r->bitrate;
 			break;
+		case IEEE80211_BAND_60GHZ:
+			/* TODO, for now fall through */
 		case IEEE80211_NUM_BANDS:
 			WARN_ON(1);
 			break;
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 316cfd0..f3ce35b 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -35,19 +35,29 @@ int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band)
 {
 	/* see 802.11 17.3.8.3.2 and Annex J
 	 * there are overlapping channel numbers in 5GHz and 2GHz bands */
-	if (band == IEEE80211_BAND_5GHZ) {
-		if (chan >= 182 && chan <= 196)
-			return 4000 + chan * 5;
-		else
-			return 5000 + chan * 5;
-	} else { /* IEEE80211_BAND_2GHZ */
+	if (chan <= 0)
+		return 0; /* not supported */
+	switch (band) {
+	case IEEE80211_BAND_2GHZ:
 		if (chan == 14)
 			return 2484;
 		else if (chan < 14)
 			return 2407 + chan * 5;
+		break;
+	case IEEE80211_BAND_5GHZ:
+		if (chan >= 182 && chan <= 196)
+			return 4000 + chan * 5;
 		else
-			return 0; /* not supported */
+			return 5000 + chan * 5;
+		break;
+	case IEEE80211_BAND_60GHZ:
+		if (chan < 5)
+			return 56160 + chan * 2160;
+		break;
+	default:
+		;
 	}
+	return 0; /* not supported */
 }
 EXPORT_SYMBOL(ieee80211_channel_to_frequency);
 
@@ -60,8 +70,12 @@ int ieee80211_frequency_to_channel(int freq)
 		return (freq - 2407) / 5;
 	else if (freq >= 4910 && freq <= 4980)
 		return (freq - 4000) / 5;
-	else
+	else if (freq <= 45000) /* DMG band lower limit */
 		return (freq - 5000) / 5;
+	else if (freq >= 58320 && freq <= 64800)
+		return (freq - 56160) / 2160;
+	else
+		return 0;
 }
 EXPORT_SYMBOL(ieee80211_frequency_to_channel);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 60g v2 2/5] wireless: rate check logic for 60g
  2012-07-02  6:32 [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Vladimir Kondratiev
  2012-07-02  6:32 ` [PATCH 60g v2 1/5] wireless: add 802.11ad (60gHz band) Vladimir Kondratiev
@ 2012-07-02  6:32 ` Vladimir Kondratiev
  2012-07-02 13:02   ` Johannes Berg
  2012-07-02  6:32 ` [PATCH 60g v2 3/5] wireless: regulatory " Vladimir Kondratiev
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 17+ messages in thread
From: Vladimir Kondratiev @ 2012-07-02  6:32 UTC (permalink / raw)
  To: John W . Linville, Johannes Berg
  Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez

On the 60g band, there is no 'basic rates'. Only MCS used.
Instead of mandatory basic rates, standard requires support for
mandatory MCS 1..4

Modify logic to comply with 60g requirements

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
 net/wireless/core.c |   10 ++++++++--
 net/wireless/util.c |    5 +++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/net/wireless/core.c b/net/wireless/core.c
index 907f62c..029db45 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -458,8 +458,14 @@ int wiphy_register(struct wiphy *wiphy)
 			continue;
 
 		sband->band = band;
-
-		if (WARN_ON(!sband->n_channels || !sband->n_bitrates))
+		if (WARN_ON(!sband->n_channels))
+			return -EINVAL;
+		/*
+		 * on 60gHz band, there are no legacy rates, so
+		 * n_bitrates is 0
+		 */
+		if (WARN_ON(band != IEEE80211_BAND_60GHZ &&
+			    !sband->n_bitrates))
 			return -EINVAL;
 
 		/*
diff --git a/net/wireless/util.c b/net/wireless/util.c
index f3ce35b..11188c6 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -151,6 +151,11 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
 		}
 		WARN_ON(want != 0 && want != 3 && want != 6);
 		break;
+	case IEEE80211_BAND_60GHZ:
+		/* check for mandatory HT MCS 1..4 */
+		WARN_ON(!sband->ht_cap.ht_supported);
+		WARN_ON((sband->ht_cap.mcs.rx_mask[0] & 0x1e) != 0x1e);
+		break;
 	case IEEE80211_NUM_BANDS:
 		WARN_ON(1);
 		break;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 60g v2 3/5] wireless: regulatory for 60g
  2012-07-02  6:32 [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Vladimir Kondratiev
  2012-07-02  6:32 ` [PATCH 60g v2 1/5] wireless: add 802.11ad (60gHz band) Vladimir Kondratiev
  2012-07-02  6:32 ` [PATCH 60g v2 2/5] wireless: rate check logic for 60g Vladimir Kondratiev
@ 2012-07-02  6:32 ` Vladimir Kondratiev
  2012-07-02  6:32 ` [PATCH 60g v2 4/5] wireless: 60g protocol constants Vladimir Kondratiev
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: Vladimir Kondratiev @ 2012-07-02  6:32 UTC (permalink / raw)
  To: John W . Linville, Johannes Berg
  Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez

Add regulatory rule for the 60g band

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
 net/wireless/reg.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index baf5704..b2b3222 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -129,7 +129,7 @@ static DECLARE_DELAYED_WORK(reg_timeout, reg_timeout_work);
 
 /* We keep a static world regulatory domain in case of the absence of CRDA */
 static const struct ieee80211_regdomain world_regdom = {
-	.n_reg_rules = 5,
+	.n_reg_rules = 6,
 	.alpha2 =  "00",
 	.reg_rules = {
 		/* IEEE 802.11b/g, channels 1..11 */
@@ -156,6 +156,9 @@ static const struct ieee80211_regdomain world_regdom = {
 		REG_RULE(5745-10, 5825+10, 40, 6, 20,
 			NL80211_RRF_PASSIVE_SCAN |
 			NL80211_RRF_NO_IBSS),
+
+		/* IEEE 802.11ad (60gHz), channels 1..3 */
+		REG_RULE(56160+2160*1-1080, 56160+2160*3+1080, 2160, 0, 0, 0),
 	}
 };
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 60g v2 4/5] wireless: 60g protocol constants
  2012-07-02  6:32 [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Vladimir Kondratiev
                   ` (2 preceding siblings ...)
  2012-07-02  6:32 ` [PATCH 60g v2 3/5] wireless: regulatory " Vladimir Kondratiev
@ 2012-07-02  6:32 ` Vladimir Kondratiev
  2012-07-02  6:32 ` [PATCH 60g v2 5/5] wireless: bitrate calculation for 60g Vladimir Kondratiev
  2012-07-02 12:54 ` [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Johannes Berg
  5 siblings, 0 replies; 17+ messages in thread
From: Vladimir Kondratiev @ 2012-07-02  6:32 UTC (permalink / raw)
  To: John W . Linville, Johannes Berg
  Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez

Provide various constants as defined by the 802.11ad:
frame types, IE's, capability bits, action categories

Introduce GCMP cipher, mandatory by 802.11ad

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
 include/linux/ieee80211.h |   89 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 88 insertions(+), 1 deletion(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 318fc1f..90145bd 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -47,6 +47,7 @@
 #define IEEE80211_FCTL_MOREDATA		0x2000
 #define IEEE80211_FCTL_PROTECTED	0x4000
 #define IEEE80211_FCTL_ORDER		0x8000
+#define IEEE80211_FCTL_CTL_EXT		0x0f00
 
 #define IEEE80211_SCTL_FRAG		0x000F
 #define IEEE80211_SCTL_SEQ		0xFFF0
@@ -54,6 +55,7 @@
 #define IEEE80211_FTYPE_MGMT		0x0000
 #define IEEE80211_FTYPE_CTL		0x0004
 #define IEEE80211_FTYPE_DATA		0x0008
+#define IEEE80211_FTYPE_EXT		0x000c
 
 /* management */
 #define IEEE80211_STYPE_ASSOC_REQ	0x0000
@@ -70,6 +72,7 @@
 #define IEEE80211_STYPE_ACTION		0x00D0
 
 /* control */
+#define IEEE80211_STYPE_CTL_EXT		0x0060
 #define IEEE80211_STYPE_BACK_REQ	0x0080
 #define IEEE80211_STYPE_BACK		0x0090
 #define IEEE80211_STYPE_PSPOLL		0x00A0
@@ -97,6 +100,18 @@
 #define IEEE80211_STYPE_QOS_CFPOLL		0x00E0
 #define IEEE80211_STYPE_QOS_CFACKPOLL		0x00F0
 
+/* extension, added by 802.11ad */
+#define IEEE80211_STYPE_DMG_BEACON		0x0000
+
+/* control extension - for IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTL_EXT */
+#define IEEE80211_CTL_EXT_POLL		0x2000
+#define IEEE80211_CTL_EXT_SPR		0x3000
+#define IEEE80211_CTL_EXT_GRANT	0x4000
+#define IEEE80211_CTL_EXT_DMG_CTS	0x5000
+#define IEEE80211_CTL_EXT_DMG_DTS	0x6000
+#define IEEE80211_CTL_EXT_SSW		0x8000
+#define IEEE80211_CTL_EXT_SSW_FBACK	0x9000
+#define IEEE80211_CTL_EXT_SSW_ACK	0xa000
 
 /* miscellaneous IEEE 802.11 constants */
 #define IEEE80211_MAX_FRAG_THRESHOLD	2352
@@ -1124,6 +1139,21 @@ struct ieee80211_ht_operation {
 #define WLAN_CAPABILITY_QOS		(1<<9)
 #define WLAN_CAPABILITY_SHORT_SLOT_TIME	(1<<10)
 #define WLAN_CAPABILITY_DSSS_OFDM	(1<<13)
+
+/* DMG (60gHz) 802.11ad */
+/* type - bits 0..1 */
+#define WLAN_CAPABILITY_DMG_TYPE_IBSS		(1<<0) /* Tx by: STA */
+#define WLAN_CAPABILITY_DMG_TYPE_PBSS		(2<<0) /* Tx by: PCP */
+#define WLAN_CAPABILITY_DMG_TYPE_AP		(3<<0) /* Tx by: AP */
+
+#define WLAN_CAPABILITY_DMG_CBAP_ONLY		(1<<2)
+#define WLAN_CAPABILITY_DMG_CBAP_SOURCE	(1<<3)
+#define WLAN_CAPABILITY_DMG_PRIVACY		(1<<4)
+#define WLAN_CAPABILITY_DMG_ECPAC		(1<<5)
+
+#define WLAN_CAPABILITY_DMG_SPECTRUM_MGMT	(1<<8)
+#define WLAN_CAPABILITY_DMG_RADIO_MEASURE	(1<<12)
+
 /* measurement */
 #define IEEE80211_SPCT_MSR_RPRT_MODE_LATE	(1<<0)
 #define IEEE80211_SPCT_MSR_RPRT_MODE_INCAPABLE	(1<<1)
@@ -1133,7 +1163,6 @@ struct ieee80211_ht_operation {
 #define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA	1
 #define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI	2
 
-
 /* 802.11g ERP information element */
 #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
 #define WLAN_ERP_USE_PROTECTION (1<<1)
@@ -1145,6 +1174,16 @@ enum {
 	WLAN_ERP_PREAMBLE_LONG = 1,
 };
 
+/* Band ID, 802.11ad #8.4.1.45 */
+enum {
+	IEEE80211_BANDID_TV_WS = 0, /* TV white spaces */
+	IEEE80211_BANDID_SUB1  = 1, /* Sub-1 GHz (excluding TV white spaces) */
+	IEEE80211_BANDID_2G    = 2, /* 2.4 GHz */
+	IEEE80211_BANDID_3G    = 3, /* 3.6 GHz */
+	IEEE80211_BANDID_5G    = 4, /* 4.9 and 5 GHz */
+	IEEE80211_BANDID_60G   = 5, /* 60 GHz */
+};
+
 /* Status codes */
 enum ieee80211_statuscode {
 	WLAN_STATUS_SUCCESS = 0,
@@ -1196,6 +1235,17 @@ enum ieee80211_statuscode {
 	WLAN_STATUS_ANTI_CLOG_REQUIRED = 76,
 	WLAN_STATUS_FCG_NOT_SUPP = 78,
 	WLAN_STATUS_STA_NO_TBTT = 78,
+	/* 802.11ad */
+	WLAN_STATUS_REJECTED_WITH_SUGGESTED_CHANGES = 39,
+	WLAN_STATUS_REJECTED_FOR_DELAY_PERIOD = 47,
+	WLAN_STATUS_REJECT_WITH_SCHEDULE = 83,
+	WLAN_STATUS_PENDING_ADMITTING_FST_SESSION = 86,
+	WLAN_STATUS_PERFORMING_FST_NOW = 87,
+	WLAN_STATUS_PENDING_GAP_IN_BA_WINDOW = 88,
+	WLAN_STATUS_REJECT_U_PID_SETTING = 89,
+	WLAN_STATUS_REJECT_DSE_BAND = 96,
+	WLAN_STATUS_DENIED_WITH_SUGGESTED_BAND_AND_CHANNEL = 99,
+	WLAN_STATUS_DENIED_DUE_TO_SPECTRUM_MANAGEMENT = 103,
 };
 
 
@@ -1352,6 +1402,39 @@ enum ieee80211_eid {
 	WLAN_EID_DSE_REGISTERED_LOCATION = 58,
 	WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59,
 	WLAN_EID_EXT_CHANSWITCH_ANN = 60,
+	/* 802.11ad */
+	WLAN_EID_NON_TX_BSSID_CAP =  83,
+	WLAN_EID_WAKEUP_SCHEDULE = 143,
+	WLAN_EID_EXT_SCHEDULE = 144,
+	WLAN_EID_STA_AVAILABILITY = 145,
+	WLAN_EID_DMG_TSPEC = 146,
+	WLAN_EID_DMG_AT = 147,
+	WLAN_EID_DMG_CAP = 148,
+	WLAN_EID_DMG_OPERATION = 151,
+	WLAN_EID_DMG_BSS_PARAM_CHANGE = 152,
+	WLAN_EID_DMG_BEAM_REFINEMENT = 153,
+	WLAN_EID_CHANNEL_MEASURE_FEEDBACK = 154,
+	WLAN_EID_AWAKE_WINDOW = 157,
+	WLAN_EID_MULTI_BAND = 158,
+	WLAN_EID_ADDBA_EXT = 159,
+	WLAN_EID_NEXT_PCP_LIST = 160,
+	WLAN_EID_PCP_HANDOVER = 161,
+	WLAN_EID_DMG_LINK_MARGIN = 162,
+	WLAN_EID_SWITCHING_STREAM = 163,
+	WLAN_EID_SESSION_TRANSITION = 164,
+	WLAN_EID_DYN_TONE_PAIRING_REPORT = 165,
+	WLAN_EID_CLUSTER_REPORT = 166,
+	WLAN_EID_RELAY_CAP = 167,
+	WLAN_EID_RELAY_XFER_PARAM_SET = 168,
+	WLAN_EID_BEAM_LINK_MAINT = 169,
+	WLAN_EID_MULTIPLE_MAC_ADDR = 170,
+	WLAN_EID_U_PID = 171,
+	WLAN_EID_DMG_LINK_ADAPT_ACK = 172,
+	WLAN_EID_QUIET_PERIOD_REQ = 175,
+	WLAN_EID_QUIET_PERIOD_RESP = 177,
+	WLAN_EID_EPAC_POLICY = 182,
+	WLAN_EID_CLISTER_TIME_OFF = 183,
+	WLAN_EID_ANTENNA_SECTOR_ID_PATTERN = 190,
 };
 
 /* Action category code */
@@ -1368,7 +1451,10 @@ enum ieee80211_category {
 	WLAN_CATEGORY_MESH_ACTION = 13,
 	WLAN_CATEGORY_MULTIHOP_ACTION = 14,
 	WLAN_CATEGORY_SELF_PROTECTED = 15,
+	WLAN_CATEGORY_DMG = 16,
 	WLAN_CATEGORY_WMM = 17,
+	WLAN_CATEGORY_FST = 18,
+	WLAN_CATEGORY_UNPROT_DMG = 20,
 	WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
 	WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
 };
@@ -1616,6 +1702,7 @@ enum ieee80211_sa_query_action {
 #define WLAN_CIPHER_SUITE_CCMP		0x000FAC04
 #define WLAN_CIPHER_SUITE_WEP104	0x000FAC05
 #define WLAN_CIPHER_SUITE_AES_CMAC	0x000FAC06
+#define WLAN_CIPHER_SUITE_GCMP		0x000FAC08
 
 #define WLAN_CIPHER_SUITE_SMS4		0x00147201
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 60g v2 5/5] wireless: bitrate calculation for 60g
  2012-07-02  6:32 [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Vladimir Kondratiev
                   ` (3 preceding siblings ...)
  2012-07-02  6:32 ` [PATCH 60g v2 4/5] wireless: 60g protocol constants Vladimir Kondratiev
@ 2012-07-02  6:32 ` Vladimir Kondratiev
  2012-07-02 12:54   ` Johannes Berg
  2012-07-02 12:54 ` [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Johannes Berg
  5 siblings, 1 reply; 17+ messages in thread
From: Vladimir Kondratiev @ 2012-07-02  6:32 UTC (permalink / raw)
  To: John W . Linville, Johannes Berg
  Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez

60g band uses different from .11n MCS scheme, so bitrate should be calculated
differently

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
 include/net/cfg80211.h |    2 ++
 net/wireless/util.c    |   55 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 56e840d..f760520 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -563,11 +563,13 @@ enum station_info_flags {
  * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
+ * @RATE_INFO_FLAGS_60G: 60gHz MCS
  */
 enum rate_info_flags {
 	RATE_INFO_FLAGS_MCS		= 1<<0,
 	RATE_INFO_FLAGS_40_MHZ_WIDTH	= 1<<1,
 	RATE_INFO_FLAGS_SHORT_GI	= 1<<2,
+	RATE_INFO_FLAGS_60G		= 1<<3,
 };
 
 /**
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 11188c6..130eaed 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -890,12 +890,67 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
 	return err;
 }
 
+static u16 cfg80211_calculate_bitrate_60g(struct rate_info *rate)
+{
+	static const u16 __mcs2bitrate[] = {
+		/* control PHY */
+		[0] =   275,
+		/* SC PHY */
+		[1] =  3850,
+		[2] =  7700,
+		[3] =  9625,
+		[4] = 11550,
+		[5] = 12512, /* 1251.25 mbps */
+		[6] = 15400,
+		[7] = 19250,
+		[8] = 23100,
+		[9] = 25025,
+		[10] = 30800,
+		[11] = 38500,
+		[12] = 46200,
+		/* OFDM PHY */
+		[13] =  6930,
+		[14] =  8662, /* 866.25 mbps */
+		[15] = 13860,
+		[16] = 17325,
+		[17] = 20790,
+		[18] = 27720,
+		[19] = 34650,
+		[20] = 41580,
+		[21] = 45045,
+		[22] = 51975,
+		[23] = 62370,
+#if 0
+		/*
+		 * TODO: How to report this bitrate?
+		 * It don't fit into u16
+		 */
+		[24] = 67568, /* 6756.75 mbps */
+#endif
+		/* LP-SC PHY */
+		[25] =  6260,
+		[26] =  8340,
+		[27] = 11120,
+		[28] = 12510,
+		[29] = 16680,
+		[30] = 22240,
+		[31] = 25030,
+	};
+
+	if (WARN_ON_ONCE(rate->mcs >= ARRAY_SIZE(__mcs2bitrate)))
+		return 0;
+
+	return __mcs2bitrate[rate->mcs];
+}
+
 u16 cfg80211_calculate_bitrate(struct rate_info *rate)
 {
 	int modulation, streams, bitrate;
 
 	if (!(rate->flags & RATE_INFO_FLAGS_MCS))
 		return rate->legacy;
+	if (rate->flags & RATE_INFO_FLAGS_60G)
+		return cfg80211_calculate_bitrate_60g(rate);
 
 	/* the formula below does only work for MCS values smaller than 32 */
 	if (WARN_ON_ONCE(rate->mcs >= 32))
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 5/5] wireless: bitrate calculation for 60g
  2012-07-02  6:32 ` [PATCH 60g v2 5/5] wireless: bitrate calculation for 60g Vladimir Kondratiev
@ 2012-07-02 12:54   ` Johannes Berg
  0 siblings, 0 replies; 17+ messages in thread
From: Johannes Berg @ 2012-07-02 12:54 UTC (permalink / raw)
  To: Vladimir Kondratiev; +Cc: John W . Linville, linux-wireless, Luis R . Rodriguez

On Mon, 2012-07-02 at 09:32 +0300, Vladimir Kondratiev wrote:

> +#if 0
> +		/*
> +		 * TODO: How to report this bitrate?
> +		 * It don't fit into u16
> +		 */
> +		[24] = 67568, /* 6756.75 mbps */
> +#endif

So how do you plan to address this todo? I think we need to have a new
U32 attribute for the bitrate and then put this when the value is too
large etc.

johannes


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad)
  2012-07-02  6:32 [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Vladimir Kondratiev
                   ` (4 preceding siblings ...)
  2012-07-02  6:32 ` [PATCH 60g v2 5/5] wireless: bitrate calculation for 60g Vladimir Kondratiev
@ 2012-07-02 12:54 ` Johannes Berg
  2012-07-02 12:58   ` Johannes Berg
  5 siblings, 1 reply; 17+ messages in thread
From: Johannes Berg @ 2012-07-02 12:54 UTC (permalink / raw)
  To: Vladimir Kondratiev; +Cc: John W . Linville, linux-wireless, Luis R . Rodriguez

On Mon, 2012-07-02 at 09:32 +0300, Vladimir Kondratiev wrote:
> These patches add minimal infrastructure for the 60gHz (802.11ad)
> band WiFi drivers.
> 
> This change enables offload drivers for the 60GHz devices that implement
> the 802.11 MAC functionality in the device itself.
> 
> Driver based on this infrastructure see at:
> http://wireless.kernel.org/en/users/Drivers/wil6210
> 
> Identation should be fine now, thanks Joe Perches for hint.
> 
> I put in #if 0 one entry in MCS-to-bitrate translation table,
> since it does not fit into u16. It should work fine until
> real devices with 6.5Gbps bitrate appears.
> 
> Vladimir Kondratiev (5):
>   wireless: add 802.11ad (60gHz band)
>   wireless: rate check logic for 60g
>   wireless: regulatory for 60g
>   wireless: 60g protocol constants
>   wireless: bitrate calculation for 60g

Applied the first four patches, but I fixed the subjects for you (this
time)

johannes


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad)
  2012-07-02 12:54 ` [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Johannes Berg
@ 2012-07-02 12:58   ` Johannes Berg
  2012-07-02 15:01     ` Vladimir Kondratiev
  0 siblings, 1 reply; 17+ messages in thread
From: Johannes Berg @ 2012-07-02 12:58 UTC (permalink / raw)
  To: Vladimir Kondratiev; +Cc: John W . Linville, linux-wireless, Luis R . Rodriguez

On Mon, 2012-07-02 at 14:54 +0200, Johannes Berg wrote:
> On Mon, 2012-07-02 at 09:32 +0300, Vladimir Kondratiev wrote:
> > These patches add minimal infrastructure for the 60gHz (802.11ad)
> > band WiFi drivers.
> > 
> > This change enables offload drivers for the 60GHz devices that implement
> > the 802.11 MAC functionality in the device itself.
> > 
> > Driver based on this infrastructure see at:
> > http://wireless.kernel.org/en/users/Drivers/wil6210
> > 
> > Identation should be fine now, thanks Joe Perches for hint.
> > 
> > I put in #if 0 one entry in MCS-to-bitrate translation table,
> > since it does not fit into u16. It should work fine until
> > real devices with 6.5Gbps bitrate appears.
> > 
> > Vladimir Kondratiev (5):
> >   wireless: add 802.11ad (60gHz band)
> >   wireless: rate check logic for 60g
> >   wireless: regulatory for 60g
> >   wireless: 60g protocol constants
> >   wireless: bitrate calculation for 60g
> 
> Applied the first four patches, but I fixed the subjects for you (this
> time)

And I had to squash patches to make it compile without warnings after
each patch.

Please be more careful next time.

johannes


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 2/5] wireless: rate check logic for 60g
  2012-07-02  6:32 ` [PATCH 60g v2 2/5] wireless: rate check logic for 60g Vladimir Kondratiev
@ 2012-07-02 13:02   ` Johannes Berg
  0 siblings, 0 replies; 17+ messages in thread
From: Johannes Berg @ 2012-07-02 13:02 UTC (permalink / raw)
  To: Vladimir Kondratiev; +Cc: John W . Linville, linux-wireless, Luis R . Rodriguez

On Mon, 2012-07-02 at 09:32 +0300, Vladimir Kondratiev wrote:
> On the 60g band, there is no 'basic rates'. Only MCS used.
> Instead of mandatory basic rates, standard requires support for
> mandatory MCS 1..4

I also fixed this ... this code has nothing to do with "basic rates"...

johannes


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 1/5] wireless: add 802.11ad (60gHz band)
  2012-07-02  6:32 ` [PATCH 60g v2 1/5] wireless: add 802.11ad (60gHz band) Vladimir Kondratiev
@ 2012-07-02 14:22   ` Arik Nemtsov
  2012-07-02 15:12     ` Johannes Berg
  0 siblings, 1 reply; 17+ messages in thread
From: Arik Nemtsov @ 2012-07-02 14:22 UTC (permalink / raw)
  To: Vladimir Kondratiev
  Cc: John W . Linville, Johannes Berg, linux-wireless, Luis R . Rodriguez

On Mon, Jul 2, 2012 at 9:32 AM, Vladimir Kondratiev
<qca_vkondrat@qca.qualcomm.com> wrote:
> Add enumerations for both cfg80211 and nl80211.
> This expands wiphy.bands etc. arrays.
>
> Extend channel <-> frequency translation to cover 60g band
>
> Small fix for mac80211/tx.c required to fix compiler warning
>
> Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
> ---
>  include/linux/nl80211.h |    2 ++
>  include/net/cfg80211.h  |    2 ++
>  net/mac80211/tx.c       |    2 ++
>  net/wireless/util.c     |   30 ++++++++++++++++++++++--------
>  4 files changed, 28 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
> index c0fc5d2..679831e 100644
> --- a/include/linux/nl80211.h
> +++ b/include/linux/nl80211.h
> @@ -2539,10 +2539,12 @@ enum nl80211_tx_rate_attributes {
>   * enum nl80211_band - Frequency band
>   * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
>   * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
> + * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
>   */
>  enum nl80211_band {
>         NL80211_BAND_2GHZ,
>         NL80211_BAND_5GHZ,
> +       NL80211_BAND_60GHZ,
>  };

There's some code in cfg80211.h that uses this value:

enum ieee80211_band {
	IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
	IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,

	/* keep last */
	IEEE80211_NUM_BANDS
};

If the 60Ghz band goes here as well, IEEE80211_NUM_BANDS will be
incremented. I'm guessing this can be problematic for a lot of drivers
that use this value more or less blindly (and pass indices to FW etc).
At least the wlcore driver will be impacted.

So this probably should be added, but maybe keep IEEE80211_NUM_BANDS
the same for legacy reasons?

Arik

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad)
  2012-07-02 12:58   ` Johannes Berg
@ 2012-07-02 15:01     ` Vladimir Kondratiev
  2012-07-02 15:08       ` Johannes Berg
  0 siblings, 1 reply; 17+ messages in thread
From: Vladimir Kondratiev @ 2012-07-02 15:01 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Vladimir Kondratiev, John W . Linville, linux-wireless,
	Luis R . Rodriguez

On Monday, July 02, 2012 02:58:39 PM Johannes Berg wrote:
> > > Vladimir Kondratiev (5):
> > >   wireless: add 802.11ad (60gHz band)
> > >   wireless: rate check logic for 60g
> > >   wireless: regulatory for 60g
> > >   wireless: 60g protocol constants
> > >   wireless: bitrate calculation for 60g
> >
> > 
> >
> > Applied the first four patches, but I fixed the subjects for you (this
> > time)
> 
> And I had to squash patches to make it compile without warnings after
> each patch.
> 
> Please be more careful next time.
> 
> johannes

Thanks a lot! I'll do my best.

So, now I'll focus on the last patch - bitrate calculation.

My plan is:

- add new element like NL80211_RATE_INFO_BITRATE_HT with u32 data
- change nl80211_put_sta_rate() to fill both
  NL80211_RATE_INFO_BITRATE (with u16 value)
  and NL80211_RATE_INFO_BITRATE_HT (with u32 value)
- when bitrate not fit into u16, put 0 for u16 value and fill only u32

This opens migration path for the drivers and user space tools to the
new u32 representation without breaking existing code.

Comments?

Thanks, Vladimir

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad)
  2012-07-02 15:01     ` Vladimir Kondratiev
@ 2012-07-02 15:08       ` Johannes Berg
  2012-07-03  4:15         ` Julian Calaby
  0 siblings, 1 reply; 17+ messages in thread
From: Johannes Berg @ 2012-07-02 15:08 UTC (permalink / raw)
  To: Vladimir Kondratiev
  Cc: Vladimir Kondratiev, John W . Linville, linux-wireless,
	Luis R . Rodriguez

On Mon, 2012-07-02 at 18:01 +0300, Vladimir Kondratiev wrote:

> So, now I'll focus on the last patch - bitrate calculation.
> 
> My plan is:
> 
> - add new element like NL80211_RATE_INFO_BITRATE_HT with u32 data
> - change nl80211_put_sta_rate() to fill both
>   NL80211_RATE_INFO_BITRATE (with u16 value)
>   and NL80211_RATE_INFO_BITRATE_HT (with u32 value)
> - when bitrate not fit into u16, put 0 for u16 value and fill only u32

I think you should leave out the BITRATE value completely, not fill it
with 0.

> This opens migration path for the drivers and user space tools to the
> new u32 representation without breaking existing code.

Other than that, yes, good plan.

johannes


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 1/5] wireless: add 802.11ad (60gHz band)
  2012-07-02 14:22   ` Arik Nemtsov
@ 2012-07-02 15:12     ` Johannes Berg
  2012-07-02 15:15       ` Arik Nemtsov
  0 siblings, 1 reply; 17+ messages in thread
From: Johannes Berg @ 2012-07-02 15:12 UTC (permalink / raw)
  To: Arik Nemtsov
  Cc: Vladimir Kondratiev, John W . Linville, linux-wireless,
	Luis R . Rodriguez

On Mon, 2012-07-02 at 17:22 +0300, Arik Nemtsov wrote:

> enum ieee80211_band {
> 	IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
> 	IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
> 
> 	/* keep last */
> 	IEEE80211_NUM_BANDS
> };
> 
> If the 60Ghz band goes here as well, IEEE80211_NUM_BANDS will be
> incremented. 

Yes, this happened.

> I'm guessing this can be problematic for a lot of drivers
> that use this value more or less blindly (and pass indices to FW etc).
> At least the wlcore driver will be impacted.
> 
> So this probably should be added, but maybe keep IEEE80211_NUM_BANDS
> the same for legacy reasons?

Can't do that, it's used for array sizing etc.

It looks like your driver may crash as it accesses bands[x] for all
possible values of x ... might want to fix that soon as I've applied
these patches :)

johannes


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 1/5] wireless: add 802.11ad (60gHz band)
  2012-07-02 15:12     ` Johannes Berg
@ 2012-07-02 15:15       ` Arik Nemtsov
  0 siblings, 0 replies; 17+ messages in thread
From: Arik Nemtsov @ 2012-07-02 15:15 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Vladimir Kondratiev, John W . Linville, linux-wireless,
	Luis R . Rodriguez

On Mon, Jul 2, 2012 at 6:12 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Mon, 2012-07-02 at 17:22 +0300, Arik Nemtsov wrote:
>
>> enum ieee80211_band {
>>       IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
>>       IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
>>
>>       /* keep last */
>>       IEEE80211_NUM_BANDS
>> };
>>
>> If the 60Ghz band goes here as well, IEEE80211_NUM_BANDS will be
>> incremented.
>
> Yes, this happened.
>
>> I'm guessing this can be problematic for a lot of drivers
>> that use this value more or less blindly (and pass indices to FW etc).
>> At least the wlcore driver will be impacted.
>>
>> So this probably should be added, but maybe keep IEEE80211_NUM_BANDS
>> the same for legacy reasons?
>
> Can't do that, it's used for array sizing etc.
>
> It looks like your driver may crash as it accesses bands[x] for all
> possible values of x ... might want to fix that soon as I've applied
> these patches :)

Yes. That's the alternative :)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad)
  2012-07-02 15:08       ` Johannes Berg
@ 2012-07-03  4:15         ` Julian Calaby
  2012-07-03  6:50           ` Johannes Berg
  0 siblings, 1 reply; 17+ messages in thread
From: Julian Calaby @ 2012-07-03  4:15 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Vladimir Kondratiev, Vladimir Kondratiev, John W . Linville,
	linux-wireless, Luis R . Rodriguez

Hi,

On Tue, Jul 3, 2012 at 1:08 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Mon, 2012-07-02 at 18:01 +0300, Vladimir Kondratiev wrote:
>
>> So, now I'll focus on the last patch - bitrate calculation.
>>
>> My plan is:
>>
>> - add new element like NL80211_RATE_INFO_BITRATE_HT with u32 data
>> - change nl80211_put_sta_rate() to fill both
>>   NL80211_RATE_INFO_BITRATE (with u16 value)
>>   and NL80211_RATE_INFO_BITRATE_HT (with u32 value)
>> - when bitrate not fit into u16, put 0 for u16 value and fill only u32
>
> I think you should leave out the BITRATE value completely, not fill it
> with 0.

Why not make it 65535?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad)
  2012-07-03  4:15         ` Julian Calaby
@ 2012-07-03  6:50           ` Johannes Berg
  0 siblings, 0 replies; 17+ messages in thread
From: Johannes Berg @ 2012-07-03  6:50 UTC (permalink / raw)
  To: Julian Calaby
  Cc: Vladimir Kondratiev, Vladimir Kondratiev, John W . Linville,
	linux-wireless, Luis R . Rodriguez

On Tue, 2012-07-03 at 14:15 +1000, Julian Calaby wrote:

> > I think you should leave out the BITRATE value completely, not fill it
> > with 0.
> 
> Why not make it 65535?

Because that's confusing for userspace, that could very well be a valid
value, after all, in today's API.

johannes


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2012-07-03  6:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-02  6:32 [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Vladimir Kondratiev
2012-07-02  6:32 ` [PATCH 60g v2 1/5] wireless: add 802.11ad (60gHz band) Vladimir Kondratiev
2012-07-02 14:22   ` Arik Nemtsov
2012-07-02 15:12     ` Johannes Berg
2012-07-02 15:15       ` Arik Nemtsov
2012-07-02  6:32 ` [PATCH 60g v2 2/5] wireless: rate check logic for 60g Vladimir Kondratiev
2012-07-02 13:02   ` Johannes Berg
2012-07-02  6:32 ` [PATCH 60g v2 3/5] wireless: regulatory " Vladimir Kondratiev
2012-07-02  6:32 ` [PATCH 60g v2 4/5] wireless: 60g protocol constants Vladimir Kondratiev
2012-07-02  6:32 ` [PATCH 60g v2 5/5] wireless: bitrate calculation for 60g Vladimir Kondratiev
2012-07-02 12:54   ` Johannes Berg
2012-07-02 12:54 ` [PATCH 60g v2 0/5] Infrastructure for 60g (802.11ad) Johannes Berg
2012-07-02 12:58   ` Johannes Berg
2012-07-02 15:01     ` Vladimir Kondratiev
2012-07-02 15:08       ` Johannes Berg
2012-07-03  4:15         ` Julian Calaby
2012-07-03  6:50           ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.