[PATCH 13/13] Add IBSS support

Kalle Valo kvalo at qca.qualcomm.com
Thu May 23 07:07:54 EDT 2013


It doesn't work yet, but I'll send it anyway to avoid conflicts.

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 main.c    |   36 ++++++++++++++++++++----------------
 smd.c     |    7 +++++++
 wcn36xx.h |    1 +
 3 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/main.c b/main.c
index 3049761..128956a 100644
--- a/main.c
+++ b/main.c
@@ -226,7 +226,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 		if (bss_conf->enable_beacon) {
 			wcn->beacon_enable = true;
 			skb = ieee80211_beacon_get_tim(hw, vif, &tim_off, &tim_len);
-			wcn36xx_smd_config_bss(wcn, NL80211_IFTYPE_AP,
+			wcn36xx_smd_config_bss(wcn, wcn->iftype,
 					       wcn->addresses[0].addr, false);
 			wcn36xx_smd_send_beacon(wcn, skb, tim_off, 0);
 		} else {
@@ -257,21 +257,24 @@ static int wcn36xx_add_interface(struct ieee80211_hw *hw,
 	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac add interface vif %p type %d",
 		    vif, vif->type);
 
-	if(vif) {
-		switch (vif->type) {
-		case NL80211_IFTYPE_STATION:
-			wcn36xx_smd_add_sta_self(wcn, wcn->addresses[0].addr, 0);
-			break;
-		case NL80211_IFTYPE_AP:
-			wcn36xx_smd_add_sta_self(wcn, wcn->addresses[0].addr, 0);
-			break;
-		default:
-			wcn36xx_warn("Unsupported interface type requested: %d",
-				     vif->type);
-			return -EOPNOTSUPP;
-		}
+	switch (vif->type) {
+	case NL80211_IFTYPE_STATION:
+		wcn36xx_smd_add_sta_self(wcn, wcn->addresses[0].addr, 0);
+		break;
+	case NL80211_IFTYPE_AP:
+		wcn36xx_smd_add_sta_self(wcn, wcn->addresses[0].addr, 0);
+		break;
+	case NL80211_IFTYPE_ADHOC:
+		wcn36xx_smd_add_sta_self(wcn, wcn->addresses[0].addr, 0);
+		break;
+	default:
+		wcn36xx_warn("Unsupported interface type requested: %d",
+			     vif->type);
+		return -EOPNOTSUPP;
 	}
 
+	wcn->iftype = vif->type;
+
 	return 0;
 }
 
@@ -396,8 +399,9 @@ static int wcn36xx_init_ieee80211(struct wcn36xx * wcn_priv)
 		IEEE80211_HW_AP_LINK_PS |
 		IEEE80211_HW_HAS_RATE_CONTROL;
 
-	wcn_priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)|
-		BIT(NL80211_IFTYPE_AP);
+	wcn_priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
+		BIT(NL80211_IFTYPE_AP) |
+		BIT(NL80211_IFTYPE_ADHOC);
 
 	wcn_priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wcn_band_2ghz;
 
diff --git a/smd.c b/smd.c
index 38d2280..90e5e33 100644
--- a/smd.c
+++ b/smd.c
@@ -611,6 +611,13 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, enum nl80211_iftype type,
 
 		/* AP */
 		bss->oper_mode = 0;
+	} else if (type == NL80211_IFTYPE_ADHOC) {
+		bss->bss_type = WCN36XX_HAL_IBSS_MODE;
+
+		/* AP */
+		bss->oper_mode = 0;
+	} else {
+		wcn36xx_warn("Unknown type for bss config: %d", type);
 	}
 
 	bss->nw_type = WCN36XX_HAL_11G_NW_TYPE;
diff --git a/wcn36xx.h b/wcn36xx.h
index 540d80c..986330c 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -98,6 +98,7 @@ struct wcn36xx {
 	struct mac_address addresses[2];
 	int ch;
 	struct wcn36xx_hal_mac_ssid ssid;
+	enum nl80211_iftype iftype;
 
 	u8 fw_revision;
 	u8 fw_version;




More information about the wcn36xx mailing list