diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-12-18 19:31:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:36 -0500 |
commit | 32bfd35d4b63bd63de4bb0d791ef049c3c868726 (patch) | |
tree | c1c213a35a00bcbe71a2ecc6521e19dec66cf6eb /drivers/net/wireless/iwlwifi | |
parent | f653211197f3841f383fa9757ef8ce182c6cf627 (diff) |
mac80211: dont use interface indices in drivers
This patch gets rid of the if_id stuff where possible in favour of
a new per-virtual-interface structure "struct ieee80211_vif". This
structure is located at the end of the per-interface structure and
contains a variable length driver-use data area.
This has two advantages:
* removes the need to look up interfaces by if_id, this is better
for working with network namespaces and performance
* allows drivers to store and retrieve per-interface data without
having to allocate own lists/hash tables
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 28 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 28 |
4 files changed, 30 insertions, 30 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index e97f1fb48b97..20b925f57e35 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -863,7 +863,7 @@ struct iwl3945_priv { | |||
863 | u32 timestamp1; | 863 | u32 timestamp1; |
864 | u16 beacon_int; | 864 | u16 beacon_int; |
865 | struct iwl3945_driver_hw_info hw_setting; | 865 | struct iwl3945_driver_hw_info hw_setting; |
866 | int interface_id; | 866 | struct ieee80211_vif *vif; |
867 | 867 | ||
868 | /* Current association information needed to configure the | 868 | /* Current association information needed to configure the |
869 | * hardware */ | 869 | * hardware */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 241f4448a4ad..aad7f70bab76 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h | |||
@@ -1212,7 +1212,7 @@ struct iwl4965_priv { | |||
1212 | u32 timestamp1; | 1212 | u32 timestamp1; |
1213 | u16 beacon_int; | 1213 | u16 beacon_int; |
1214 | struct iwl4965_driver_hw_info hw_setting; | 1214 | struct iwl4965_driver_hw_info hw_setting; |
1215 | int interface_id; | 1215 | struct ieee80211_vif *vif; |
1216 | 1216 | ||
1217 | /* Current association information needed to configure the | 1217 | /* Current association information needed to configure the |
1218 | * hardware */ | 1218 | * hardware */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index b662ff3b9141..1830e13d5cfd 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -2767,8 +2767,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, | |||
2767 | goto drop_unlock; | 2767 | goto drop_unlock; |
2768 | } | 2768 | } |
2769 | 2769 | ||
2770 | if (!priv->interface_id) { | 2770 | if (!priv->vif) { |
2771 | IWL_DEBUG_DROP("Dropping - !priv->interface_id\n"); | 2771 | IWL_DEBUG_DROP("Dropping - !priv->vif\n"); |
2772 | goto drop_unlock; | 2772 | goto drop_unlock; |
2773 | } | 2773 | } |
2774 | 2774 | ||
@@ -3549,7 +3549,7 @@ static void iwl3945_bg_beacon_update(struct work_struct *work) | |||
3549 | struct sk_buff *beacon; | 3549 | struct sk_buff *beacon; |
3550 | 3550 | ||
3551 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ | 3551 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ |
3552 | beacon = ieee80211_beacon_get(priv->hw, priv->interface_id, NULL); | 3552 | beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); |
3553 | 3553 | ||
3554 | if (!beacon) { | 3554 | if (!beacon) { |
3555 | IWL_ERROR("update beacon failed\n"); | 3555 | IWL_ERROR("update beacon failed\n"); |
@@ -6780,7 +6780,7 @@ static void iwl3945_bg_post_associate(struct work_struct *data) | |||
6780 | 6780 | ||
6781 | mutex_lock(&priv->mutex); | 6781 | mutex_lock(&priv->mutex); |
6782 | 6782 | ||
6783 | if (!priv->interface_id || !priv->is_open) { | 6783 | if (!priv->vif || !priv->is_open) { |
6784 | mutex_unlock(&priv->mutex); | 6784 | mutex_unlock(&priv->mutex); |
6785 | return; | 6785 | return; |
6786 | } | 6786 | } |
@@ -6981,15 +6981,15 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, | |||
6981 | unsigned long flags; | 6981 | unsigned long flags; |
6982 | DECLARE_MAC_BUF(mac); | 6982 | DECLARE_MAC_BUF(mac); |
6983 | 6983 | ||
6984 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); | 6984 | IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); |
6985 | 6985 | ||
6986 | if (priv->interface_id) { | 6986 | if (priv->vif) { |
6987 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); | 6987 | IWL_DEBUG_MAC80211("leave - vif != NULL\n"); |
6988 | return -EOPNOTSUPP; | 6988 | return -EOPNOTSUPP; |
6989 | } | 6989 | } |
6990 | 6990 | ||
6991 | spin_lock_irqsave(&priv->lock, flags); | 6991 | spin_lock_irqsave(&priv->lock, flags); |
6992 | priv->interface_id = conf->if_id; | 6992 | priv->vif = conf->vif; |
6993 | 6993 | ||
6994 | spin_unlock_irqrestore(&priv->lock, flags); | 6994 | spin_unlock_irqrestore(&priv->lock, flags); |
6995 | 6995 | ||
@@ -7157,7 +7157,8 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv) | |||
7157 | * clear sta table, add BCAST sta... */ | 7157 | * clear sta table, add BCAST sta... */ |
7158 | } | 7158 | } |
7159 | 7159 | ||
7160 | static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, | 7160 | static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, |
7161 | struct ieee80211_vif *vif, | ||
7161 | struct ieee80211_if_conf *conf) | 7162 | struct ieee80211_if_conf *conf) |
7162 | { | 7163 | { |
7163 | struct iwl3945_priv *priv = hw->priv; | 7164 | struct iwl3945_priv *priv = hw->priv; |
@@ -7179,7 +7180,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7179 | 7180 | ||
7180 | mutex_lock(&priv->mutex); | 7181 | mutex_lock(&priv->mutex); |
7181 | 7182 | ||
7182 | IWL_DEBUG_MAC80211("enter: interface id %d\n", if_id); | ||
7183 | if (conf->bssid) | 7183 | if (conf->bssid) |
7184 | IWL_DEBUG_MAC80211("bssid: %s\n", | 7184 | IWL_DEBUG_MAC80211("bssid: %s\n", |
7185 | print_mac(mac, conf->bssid)); | 7185 | print_mac(mac, conf->bssid)); |
@@ -7196,8 +7196,8 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7196 | return 0; | 7196 | return 0; |
7197 | } | 7197 | } |
7198 | 7198 | ||
7199 | if (priv->interface_id != if_id) { | 7199 | if (priv->vif != vif) { |
7200 | IWL_DEBUG_MAC80211("leave - interface_id != if_id\n"); | 7200 | IWL_DEBUG_MAC80211("leave - priv->vif != vif\n"); |
7201 | mutex_unlock(&priv->mutex); | 7201 | mutex_unlock(&priv->mutex); |
7202 | return 0; | 7202 | return 0; |
7203 | } | 7203 | } |
@@ -7295,8 +7295,8 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, | |||
7295 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7295 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
7296 | iwl3945_commit_rxon(priv); | 7296 | iwl3945_commit_rxon(priv); |
7297 | } | 7297 | } |
7298 | if (priv->interface_id == conf->if_id) { | 7298 | if (priv->vif == conf->vif) { |
7299 | priv->interface_id = 0; | 7299 | priv->vif = NULL; |
7300 | memset(priv->bssid, 0, ETH_ALEN); | 7300 | memset(priv->bssid, 0, ETH_ALEN); |
7301 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); | 7301 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); |
7302 | priv->essid_len = 0; | 7302 | priv->essid_len = 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index ce0574b087fb..52eb37f4ac78 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -2897,8 +2897,8 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, | |||
2897 | goto drop_unlock; | 2897 | goto drop_unlock; |
2898 | } | 2898 | } |
2899 | 2899 | ||
2900 | if (!priv->interface_id) { | 2900 | if (!priv->vif) { |
2901 | IWL_DEBUG_DROP("Dropping - !priv->interface_id\n"); | 2901 | IWL_DEBUG_DROP("Dropping - !priv->vif\n"); |
2902 | goto drop_unlock; | 2902 | goto drop_unlock; |
2903 | } | 2903 | } |
2904 | 2904 | ||
@@ -3893,7 +3893,7 @@ static void iwl4965_bg_beacon_update(struct work_struct *work) | |||
3893 | struct sk_buff *beacon; | 3893 | struct sk_buff *beacon; |
3894 | 3894 | ||
3895 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ | 3895 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ |
3896 | beacon = ieee80211_beacon_get(priv->hw, priv->interface_id, NULL); | 3896 | beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); |
3897 | 3897 | ||
3898 | if (!beacon) { | 3898 | if (!beacon) { |
3899 | IWL_ERROR("update beacon failed\n"); | 3899 | IWL_ERROR("update beacon failed\n"); |
@@ -7214,7 +7214,7 @@ static void iwl4965_bg_post_associate(struct work_struct *data) | |||
7214 | 7214 | ||
7215 | mutex_lock(&priv->mutex); | 7215 | mutex_lock(&priv->mutex); |
7216 | 7216 | ||
7217 | if (!priv->interface_id || !priv->is_open) { | 7217 | if (!priv->vif || !priv->is_open) { |
7218 | mutex_unlock(&priv->mutex); | 7218 | mutex_unlock(&priv->mutex); |
7219 | return; | 7219 | return; |
7220 | } | 7220 | } |
@@ -7425,15 +7425,15 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, | |||
7425 | unsigned long flags; | 7425 | unsigned long flags; |
7426 | DECLARE_MAC_BUF(mac); | 7426 | DECLARE_MAC_BUF(mac); |
7427 | 7427 | ||
7428 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); | 7428 | IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); |
7429 | 7429 | ||
7430 | if (priv->interface_id) { | 7430 | if (priv->vif) { |
7431 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); | 7431 | IWL_DEBUG_MAC80211("leave - vif != NULL\n"); |
7432 | return 0; | 7432 | return 0; |
7433 | } | 7433 | } |
7434 | 7434 | ||
7435 | spin_lock_irqsave(&priv->lock, flags); | 7435 | spin_lock_irqsave(&priv->lock, flags); |
7436 | priv->interface_id = conf->if_id; | 7436 | priv->vif = conf->vif; |
7437 | 7437 | ||
7438 | spin_unlock_irqrestore(&priv->lock, flags); | 7438 | spin_unlock_irqrestore(&priv->lock, flags); |
7439 | 7439 | ||
@@ -7617,7 +7617,8 @@ static void iwl4965_config_ap(struct iwl4965_priv *priv) | |||
7617 | * clear sta table, add BCAST sta... */ | 7617 | * clear sta table, add BCAST sta... */ |
7618 | } | 7618 | } |
7619 | 7619 | ||
7620 | static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, | 7620 | static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, |
7621 | struct ieee80211_vif *vif, | ||
7621 | struct ieee80211_if_conf *conf) | 7622 | struct ieee80211_if_conf *conf) |
7622 | { | 7623 | { |
7623 | struct iwl4965_priv *priv = hw->priv; | 7624 | struct iwl4965_priv *priv = hw->priv; |
@@ -7637,7 +7638,6 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7637 | 7638 | ||
7638 | mutex_lock(&priv->mutex); | 7639 | mutex_lock(&priv->mutex); |
7639 | 7640 | ||
7640 | IWL_DEBUG_MAC80211("enter: interface id %d\n", if_id); | ||
7641 | if (conf->bssid) | 7641 | if (conf->bssid) |
7642 | IWL_DEBUG_MAC80211("bssid: %s\n", | 7642 | IWL_DEBUG_MAC80211("bssid: %s\n", |
7643 | print_mac(mac, conf->bssid)); | 7643 | print_mac(mac, conf->bssid)); |
@@ -7654,8 +7654,8 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7654 | return 0; | 7654 | return 0; |
7655 | } | 7655 | } |
7656 | 7656 | ||
7657 | if (priv->interface_id != if_id) { | 7657 | if (priv->vif != vif) { |
7658 | IWL_DEBUG_MAC80211("leave - interface_id != if_id\n"); | 7658 | IWL_DEBUG_MAC80211("leave - priv->vif != vif\n"); |
7659 | mutex_unlock(&priv->mutex); | 7659 | mutex_unlock(&priv->mutex); |
7660 | return 0; | 7660 | return 0; |
7661 | } | 7661 | } |
@@ -7753,8 +7753,8 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, | |||
7753 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7753 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
7754 | iwl4965_commit_rxon(priv); | 7754 | iwl4965_commit_rxon(priv); |
7755 | } | 7755 | } |
7756 | if (priv->interface_id == conf->if_id) { | 7756 | if (priv->vif == conf->vif) { |
7757 | priv->interface_id = 0; | 7757 | priv->vif = NULL; |
7758 | memset(priv->bssid, 0, ETH_ALEN); | 7758 | memset(priv->bssid, 0, ETH_ALEN); |
7759 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); | 7759 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); |
7760 | priv->essid_len = 0; | 7760 | priv->essid_len = 0; |