From patchwork Mon Oct 12 12:08:43 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luciano Coelho X-Patchwork-Id: 53119 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9CCTovc000566 for ; Mon, 12 Oct 2009 12:29:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754691AbZJLMRD (ORCPT ); Mon, 12 Oct 2009 08:17:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753491AbZJLMRD (ORCPT ); Mon, 12 Oct 2009 08:17:03 -0400 Received: from smtp.nokia.com ([192.100.122.230]:51336 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754846AbZJLMRC (ORCPT ); Mon, 12 Oct 2009 08:17:02 -0400 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9CCEa9p007723; Mon, 12 Oct 2009 15:15:30 +0300 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 12 Oct 2009 15:14:36 +0300 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 12 Oct 2009 15:09:04 +0300 Received: from localhost.localdomain (pimenta.research.nokia.com [172.21.50.90]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9CC8vI9011869; Mon, 12 Oct 2009 15:09:01 +0300 From: Luciano Coelho To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org Subject: [PATCH 02/16] wl1271: workaround to send a disconnect before rejoining Date: Mon, 12 Oct 2009 15:08:43 +0300 Message-Id: <1255349337-9776-3-git-send-email-luciano.coelho@nokia.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1255349337-9776-1-git-send-email-luciano.coelho@nokia.com> References: <1255349337-9776-1-git-send-email-luciano.coelho@nokia.com> X-OriginalArrivalTime: 12 Oct 2009 12:09:04.0588 (UTC) FILETIME=[CAC6A8C0:01CA4B34] X-Nokia-AV: Clean Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index 96a5813..858bf6b 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h @@ -422,6 +422,9 @@ struct wl1271 { struct wl1271_tx_hw_res_if *tx_res_if; struct ieee80211_vif *vif; + + /* Used for a workaround to send disconnect before rejoining */ + bool joined; }; int wl1271_plt_start(struct wl1271 *wl); diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c index d09ad12..ef92834 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c @@ -191,6 +191,19 @@ int wl1271_cmd_join(struct wl1271 *wl) do_cal = false; } + /* FIXME: This is a workaround, because with the current stack, we + * cannot know when we have disassociated. So, if we have already + * joined, we disconnect before joining again. */ + if (wl->joined) { + ret = wl1271_cmd_disconnect(wl); + if (ret < 0) { + wl1271_error("failed to disconnect before rejoining"); + goto out; + } + + wl->joined = false; + } + join = kzalloc(sizeof(*join), GFP_KERNEL); if (!join) { ret = -ENOMEM; @@ -245,6 +258,8 @@ int wl1271_cmd_join(struct wl1271 *wl) goto out_free; } + wl->joined = true; + /* * ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to * simplify locking we just sleep instead, for now diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 3662715..b9f2091 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c @@ -648,6 +648,8 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) wl->tx_security_seq_32 = 0; wl->time_offset = 0; wl->session_counter = 0; + wl->joined = false; + for (i = 0; i < NUM_TX_QUEUES; i++) wl->tx_blocks_freed[i] = 0; @@ -1395,6 +1397,7 @@ static int __devinit wl1271_probe(struct spi_device *spi) wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET; wl->band = IEEE80211_BAND_2GHZ; wl->vif = NULL; + wl->joined = false; for (i = 0; i < ACX_TX_DESCRIPTORS; i++) wl->tx_frames[i] = NULL;