From a2fdbcccf2a759f02603d233fc5b3892c6ec1ba5 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 16 Aug 2007 21:25:10 +0300 Subject: [PATCH 02/31] iwlwifi: iwl_get_sta_id AP mode fix This patch fixes bug in iwl_get_sta_id in AP mode and returns correct sta_id instead of IWL_BROADCAST_ID. Signed-off-by: Emmanuel Grumbach Signed-off-by: Tomas Winkler Signed-off-by: Zhu Yi --- drivers/net/wireless/iwl-base.c | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 45a3474..feca1e7 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -2828,14 +2828,23 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) is_multicast_ether_addr(hdr->addr1)) return IWL_BROADCAST_ID; + switch (priv->iw_mode) { + /* If this frame is part of a BSS network (we're a station), then * we use the AP's station id */ - if (priv->iw_mode == IEEE80211_IF_TYPE_STA) + case IEEE80211_IF_TYPE_STA: return IWL_AP_ID; + /* If we are an AP, then find the station, or use BCAST */ + case IEEE80211_IF_TYPE_AP: + sta_id = iwl_hw_find_station(priv, hdr->addr1); + if (sta_id != IWL_INVALID_STATION) + return sta_id; + return IWL_BROADCAST_ID; + /* If this frame is part of a IBSS network, then we use the * target specific station id */ - if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) { + case IEEE80211_IF_TYPE_IBSS: sta_id = iwl_hw_find_station(priv, hdr->addr1); if (sta_id != IWL_INVALID_STATION) return sta_id; @@ -2850,10 +2859,11 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) MAC_ARG(hdr->addr1)); iwl_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); return IWL_BROADCAST_ID; - } - /* Otherwise we default to the broadcast station id */ - return IWL_BROADCAST_ID; + default: + IWL_WARNING("Unkown mode of operation: %d", priv->iw_mode); + return IWL_BROADCAST_ID; + } } /* -- 1.5.2