iwlwifi: mvm: Add support for additional addresses
authorIlan Peer <ilan.peer@intel.com>
Thu, 7 Feb 2013 15:09:09 +0000 (17:09 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 6 Mar 2013 15:47:23 +0000 (16:47 +0100)
Use the number of addresses (max 5) from the NVM
instead of limiting to 2 artificially.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/mvm/mac80211.c
drivers/net/wireless/iwlwifi/mvm/mvm.h

index 65fc5531f7ba48896e6d43259f1f013b3ebd203f..d08ae2604d7bcb80787e4483b8ef544a8e6883c4 100644 (file)
@@ -105,7 +105,7 @@ static const struct ieee80211_iface_combination iwl_mvm_iface_combinations[] = {
 int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
 {
        struct ieee80211_hw *hw = mvm->hw;
-       int num_mac, ret;
+       int num_mac, ret, i;
 
        /* Tell mac80211 our characteristics */
        hw->flags = IEEE80211_HW_SIGNAL_DBM |
@@ -156,11 +156,15 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
        memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN);
        hw->wiphy->addresses = mvm->addresses;
        hw->wiphy->n_addresses = 1;
-       num_mac = mvm->nvm_data->n_hw_addrs;
-       if (num_mac > 1) {
-               memcpy(mvm->addresses[1].addr, mvm->addresses[0].addr,
+
+       /* Extract additional MAC addresses if available */
+       num_mac = (mvm->nvm_data->n_hw_addrs > 1) ?
+               min(IWL_MVM_MAX_ADDRESSES, mvm->nvm_data->n_hw_addrs) : 1;
+
+       for (i = 1; i < num_mac; i++) {
+               memcpy(mvm->addresses[i].addr, mvm->addresses[i-1].addr,
                       ETH_ALEN);
-               mvm->addresses[1].addr[5]++;
+               mvm->addresses[i].addr[5]++;
                hw->wiphy->n_addresses++;
        }
 
index 23c39eab4d97ecb4333cb0eed8a68e4ea8226b18..efe5da992897f0aedb49fa4bf9bb6a8ad9779521 100644 (file)
@@ -79,7 +79,7 @@
 #include "fw-api.h"
 
 #define IWL_INVALID_MAC80211_QUEUE     0xff
-#define IWL_MVM_MAX_ADDRESSES          2
+#define IWL_MVM_MAX_ADDRESSES          5
 /* RSSI offset for WkP */
 #define IWL_RSSI_OFFSET 50