Linux wireless drivers development
 help / color / mirror / Atom feed
From: Eliad Peller <eliad@wizery.com>
To: Luciano Coelho <coelho@ti.com>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH 11/29] wl12xx: move ssid and ssid_len into wlvif
Date: Wed,  5 Oct 2011 11:55:48 +0200	[thread overview]
Message-ID: <1317808566-18857-12-git-send-email-eliad@wizery.com> (raw)
In-Reply-To: <1317808566-18857-1-git-send-email-eliad@wizery.com>

move ssid and ssid_len into the per-interface data, rather than
being global.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 drivers/net/wireless/wl12xx/cmd.c    |   14 +++++++-------
 drivers/net/wireless/wl12xx/main.c   |   21 +++++++++++----------
 drivers/net/wireless/wl12xx/wl12xx.h |    5 +++--
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
index a0a5051..d81c550 100644
--- a/drivers/net/wireless/wl12xx/cmd.c
+++ b/drivers/net/wireless/wl12xx/cmd.c
@@ -576,8 +576,8 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 	cmd->sta.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
 	cmd->sta.beacon_interval = cpu_to_le16(wl->beacon_int);
 	cmd->sta.ssid_type = WL12XX_SSID_TYPE_ANY;
-	cmd->sta.ssid_len = wl->ssid_len;
-	memcpy(cmd->sta.ssid, wl->ssid, wl->ssid_len);
+	cmd->sta.ssid_len = wlvif->ssid_len;
+	memcpy(cmd->sta.ssid, wlvif->ssid, wlvif->ssid_len);
 	memcpy(cmd->sta.bssid, vif->bss_conf.bssid, ETH_ALEN);
 	cmd->sta.local_rates = cpu_to_le32(wlvif->rate_set);
 
@@ -659,7 +659,7 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 	wl1271_debug(DEBUG_CMD, "cmd role start ap %d", wl->role_id);
 
 	/* trying to use hidden SSID with an old hostapd version */
-	if (wl->ssid_len == 0 && !bss_conf->hidden_ssid) {
+	if (wlvif->ssid_len == 0 && !bss_conf->hidden_ssid) {
 		wl1271_error("got a null SSID from beacon/bss");
 		ret = -EINVAL;
 		goto out;
@@ -693,8 +693,8 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 	if (!bss_conf->hidden_ssid) {
 		/* take the SSID from the beacon for backward compatibility */
 		cmd->ap.ssid_type = WL12XX_SSID_TYPE_PUBLIC;
-		cmd->ap.ssid_len = wl->ssid_len;
-		memcpy(cmd->ap.ssid, wl->ssid, wl->ssid_len);
+		cmd->ap.ssid_len = wlvif->ssid_len;
+		memcpy(cmd->ap.ssid, wlvif->ssid, wlvif->ssid_len);
 	} else {
 		cmd->ap.ssid_type = WL12XX_SSID_TYPE_HIDDEN;
 		cmd->ap.ssid_len = bss_conf->ssid_len;
@@ -791,8 +791,8 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 	cmd->ibss.beacon_interval = cpu_to_le16(wl->beacon_int);
 	cmd->ibss.dtim_interval = bss_conf->dtim_period;
 	cmd->ibss.ssid_type = WL12XX_SSID_TYPE_ANY;
-	cmd->ibss.ssid_len = wl->ssid_len;
-	memcpy(cmd->ibss.ssid, wl->ssid, wl->ssid_len);
+	cmd->ibss.ssid_len = wlvif->ssid_len;
+	memcpy(cmd->ibss.ssid, wlvif->ssid, wlvif->ssid_len);
 	memcpy(cmd->ibss.bssid, vif->bss_conf.bssid, ETH_ALEN);
 	cmd->sta.local_rates = cpu_to_le32(wlvif->rate_set);
 
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 28e53a9..c8acd33 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -2103,8 +2103,6 @@ deinit:
 	wl1271_tx_reset(wl, reset_tx_queues);
 	wl1271_power_off(wl);
 
-	memset(wl->ssid, 0, IEEE80211_MAX_SSID_LEN + 1);
-	wl->ssid_len = 0;
 	wl->band = IEEE80211_BAND_2GHZ;
 
 	wl->rx_counter = 0;
@@ -3073,9 +3071,10 @@ out:
 	return ret;
 }
 
-static int wl1271_ssid_set(struct wl1271 *wl, struct sk_buff *skb,
+static int wl1271_ssid_set(struct ieee80211_vif *vif, struct sk_buff *skb,
 			    int offset)
 {
+	struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
 	u8 ssid_len;
 	const u8 *ptr = cfg80211_find_ie(WLAN_EID_SSID, skb->data + offset,
 					 skb->len - offset);
@@ -3091,8 +3090,8 @@ static int wl1271_ssid_set(struct wl1271 *wl, struct sk_buff *skb,
 		return -EINVAL;
 	}
 
-	wl->ssid_len = ssid_len;
-	memcpy(wl->ssid, ptr+2, ssid_len);
+	wlvif->ssid_len = ssid_len;
+	memcpy(wlvif->ssid, ptr+2, ssid_len);
 	return 0;
 }
 
@@ -3128,17 +3127,19 @@ static void wl12xx_remove_vendor_ie(struct sk_buff *skb,
 }
 
 static int wl1271_ap_set_probe_resp_tmpl(struct wl1271 *wl,
+					 struct ieee80211_vif *vif,
 					 u8 *probe_rsp_data,
 					 size_t probe_rsp_len,
 					 u32 rates)
 {
-	struct ieee80211_bss_conf *bss_conf = &wl->vif->bss_conf;
+	struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
+	struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
 	u8 probe_rsp_templ[WL1271_CMD_TEMPL_MAX_SIZE];
 	int ssid_ie_offset, ie_offset, templ_len;
 	const u8 *ptr;
 
 	/* no need to change probe response if the SSID is set correctly */
-	if (wl->ssid_len > 0)
+	if (wlvif->ssid_len > 0)
 		return wl1271_cmd_template_set(wl,
 					       CMD_TEMPL_AP_PROBE_RESPONSE,
 					       probe_rsp_data,
@@ -3251,7 +3252,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl,
 
 		wl1271_debug(DEBUG_MASTER, "beacon updated");
 
-		ret = wl1271_ssid_set(wl, beacon, ieoffset);
+		ret = wl1271_ssid_set(vif, beacon, ieoffset);
 		if (ret < 0) {
 			dev_kfree_skb(beacon);
 			goto out;
@@ -3286,7 +3287,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl,
 		hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
 						 IEEE80211_STYPE_PROBE_RESP);
 		if (is_ap)
-			ret = wl1271_ap_set_probe_resp_tmpl(wl,
+			ret = wl1271_ap_set_probe_resp_tmpl(wl, vif,
 						beacon->data,
 						beacon->len,
 						min_rate);
@@ -3523,7 +3524,7 @@ sta_not_found:
 			wl->probereq = wl1271_cmd_build_ap_probe_req(wl, NULL);
 			ieoffset = offsetof(struct ieee80211_mgmt,
 					    u.probe_req.variable);
-			wl1271_ssid_set(wl, wl->probereq, ieoffset);
+			wl1271_ssid_set(vif, wl->probereq, ieoffset);
 
 			/* enable the connection monitoring feature */
 			ret = wl1271_acx_conn_monit_params(wl, true);
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 61f3658..df24500 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -399,8 +399,6 @@ struct wl1271 {
 	s8 hw_pg_ver;
 
 	u8 mac_addr[ETH_ALEN];
-	u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
-	u8 ssid_len;
 	int channel;
 	u8 role_id;
 	u8 dev_role_id;
@@ -629,6 +627,9 @@ struct wl12xx_vif {
 	u8 bss_type;
 	u8 p2p; /* we are using p2p role */
 
+	u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
+	u8 ssid_len;
+
 	u32 basic_rate_set;
 
 	/*
-- 
1.7.6.401.g6a319


  parent reply	other threads:[~2011-10-05  9:56 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05  9:55 [PATCH 00/29] wl12xx: start preparing the driver for multi-vif support Eliad Peller
2011-10-05  9:55 ` [PATCH 01/29] wl12xx: disable AP-mode-specific quirks Eliad Peller
2011-10-05  9:55 ` [PATCH 02/29] wl12xx: replace wl->mac_addr with vif->addr Eliad Peller
2011-10-05  9:55 ` [PATCH 03/29] wl12xx: start reworking the init sequence Eliad Peller
2011-10-05  9:55 ` [PATCH 04/29] wl12xx: define wl12xx_vif Eliad Peller
2011-10-05  9:55 ` [PATCH 05/29] wl12xx: move rate_set into wlvif Eliad Peller
2011-10-05  9:55 ` [PATCH 06/29] wl12xx: move basic_rate " Eliad Peller
2011-10-05  9:55 ` [PATCH 07/29] wl12xx: replace wl->bssid with vif->bss_conf.bssid Eliad Peller
2011-10-05  9:55 ` [PATCH 08/29] wl12xx: move bss_type into wlvif Eliad Peller
2011-10-05  9:55 ` [PATCH 09/29] wl12xx: remove set_bss_type field Eliad Peller
2011-10-05  9:55 ` [PATCH 10/29] wl12xx: move p2p into wlvif Eliad Peller
2011-10-05  9:55 ` Eliad Peller [this message]
2011-10-05  9:55 ` [PATCH 12/29] wl12xx: move probereq " Eliad Peller
2011-10-05  9:55 ` [PATCH 13/29] wl12xx: move aid " Eliad Peller
2011-10-05  9:55 ` [PATCH 14/29] wl12xx: move role_id " Eliad Peller
2011-10-05  9:55 ` [PATCH 15/29] wl12xx: move dev_role_id " Eliad Peller
2011-10-05  9:55 ` [PATCH 16/29] wl12xx: move sta_hlid " Eliad Peller
2011-10-05  9:55 ` [PATCH 17/29] wl12xx: move ap_global_hlid and ap_bcast_hlid " Eliad Peller
2011-10-05  9:55 ` [PATCH 18/29] wl12xx: move session_counter " Eliad Peller
2011-10-05  9:55 ` [PATCH 19/29] wl12xx: move some logic into wl12xx_init_vif_data Eliad Peller
2011-10-05  9:55 ` [PATCH 20/29] wl12xx: move dev_hlid into wlvif Eliad Peller
2011-10-05  9:55 ` [PATCH 21/29] wl12xx: move beacon_int " Eliad Peller
2011-10-05  9:55 ` [PATCH 22/29] wl12xx: move default_key " Eliad Peller
2011-10-05  9:56 ` [PATCH 23/29] wl12xx: move pspoll_work " Eliad Peller
2011-10-05  9:56 ` [PATCH 24/29] wl12xx: move ps_compl " Eliad Peller
2011-10-05  9:56 ` [PATCH 25/29] wl12xx: move ps_poll_failures and psm_entry_retry " Eliad Peller
2011-10-05  9:56 ` [PATCH 26/29] wl12xx: move rssi_thold and last_rssi_event " Eliad Peller
2011-10-05  9:56 ` [PATCH 27/29] wl12xx: move ba fields " Eliad Peller
2011-10-05  9:56 ` [PATCH 28/29] wl12xx: move ap_hlid_map into wlvif.ap Eliad Peller
2011-10-05  9:56 ` [PATCH 29/29] wl12xx: move recorded_ap_keys into wlvif Eliad Peller
2011-10-06 13:18 ` [PATCH 00/29] wl12xx: start preparing the driver for multi-vif support Luciano Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1317808566-18857-12-git-send-email-eliad@wizery.com \
    --to=eliad@wizery.com \
    --cc=coelho@ti.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox