iwlwifi: fix add_interface
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Johannes Berg
maintainerPATCH 1/3 iwlwifi: fix add_interface
The iwlwifi drivers both make mac80211 accept an arbitrary number of virtual interfaces while in reality they can only support one. Fix that.
---
Please apply this to 2.6.24 as that has userspace interface (nl80211) to add/remove virtual interfaces. There's *LOTS* to be done for proper support, e.g. monitor mode is completely messed up, but this at least doesn't let the user create multiple interfaces that won't work.
Please push to Jeff for .24.
drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/iwl3945-base.c +1 -1
@@ -6942,7 +6942,7 @@ static int iwl_mac_add_interface(structif (priv->interface_id) {IWL_DEBUG_MAC80211 ("leave - interface_id != 0\n" ); -return 0 ; +return -EOPNOTSUPP ; }spin_lock_irqsave (&priv->lock, flags);
drivers/net/wireless/iwlwifi/iwl4965-base.c +1 -1
@@ -7332,7 +7332,7 @@ static int iwl_mac_add_interface(structif (priv->interface_id) {IWL_DEBUG_MAC80211 ("leave - interface_id != 0\n" ); -return 0 ; +return -EOPNOTSUPP ; }spin_lock_irqsave (&priv->lock, flags);
Johannes Berg
maintainerPATCH 2/3 mac80211: support devices/drivers that cannot change MAC address
In reply to a message not in the archiveThe iwlwifi drivers do not allow changing the MAC address (because the drivers ignore the MAC address mac80211 gives them). So far I haven't been successful in making them not ignore it, so this adds mac80211 support for allowing them to disable MAC changing completely.
--- include/net/mac80211.h | 4 ++++ net/mac80211/ieee80211_iface.c | 7 +++++++ 2 files changed, 11 insertions(+)
include/net/mac80211.h +4 -0
@@ -662,12 +662,16 @@ enum sta_notify_cmd {* @IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED: * Channels are already configured to the default regulatory domain * specified in the device's EEPROM +* +* @IEEE80211_HW_NO_MAC_CHANGE_SUPPORT: hardware (or driver) does not +* support changing MAC address away from the pre-programmed one */ enum ieee80211_hw_flags {IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE =1 <<0 ,IEEE80211_HW_RX_INCLUDES_FCS =1 <<1 ,IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING =1 <<2 ,IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED =1 <<3 , +IEEE80211_HW_NO_MAC_CHANGE_SUPPORT =1 <<4 , };/**
net/mac80211/ieee80211_iface.c +7 -0
@@ -38,6 +38,11 @@ static void ieee80211_if_sdata_deinit(st } } +static int ieee80211_no_change_mac (struct net_device *dev,void *p) +{ +return -EOPNOTSUPP ; +} +/* Must be called with rtnl lock held. */ int ieee80211_if_add (struct net_device *dev,const char *name,struct net_device **new_dev,int type)
@@ -63,6 +68,8 @@ int ieee80211_if_add(struct net_device * ndev->mem_start = dev->mem_start; ndev->mem_end = dev->mem_end;SET_NETDEV_DEV (ndev,wiphy_dev (local->hw.wiphy)); +if (local->hw.flags &IEEE80211_HW_NO_MAC_CHANGE_SUPPORT ) + ndev->set_mac_address = ieee80211_no_change_mac; sdata =IEEE80211_DEV_TO_SUB_IF (ndev); ndev->ieee80211_ptr = &sdata->wdev;
Johannes Berg
maintainerPATCH 3/3 iwlwifi: do not allow MAC address change
In reply to a message not in the archiveThe iwlwifi drivers do not allow changing the MAC address (because the drivers ignore the MAC address mac80211 gives them). So far I haven't been successful in making them not ignore it, so this makes them tell mac80211 that they cannot change the MAC address which will disable MAC changing completely.
--- drivers/net/wireless/iwlwifi/iwl3945-base.c | 3 ++- drivers/net/wireless/iwlwifi/iwl4965-base.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/iwl3945-base.c +2 -1
@@ -8381,7 +8381,8 @@ static int iwl_pci_probe(struct pci_dev hw->max_signal =100 ;/* link quality indication (%) */ /* Tell mac80211 our Tx characteristics */ - hw->flags =IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE ; + hw->flags =IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | +IEEE80211_HW_NO_MAC_CHANGE_SUPPORT ; hw->queues =4 ;
drivers/net/wireless/iwlwifi/iwl4965-base.c +2 -1
@@ -8983,7 +8983,8 @@ static int iwl_pci_probe(struct pci_dev hw->max_signal =100 ;/* link quality indication (%) */ /* Tell mac80211 our Tx characteristics */ - hw->flags =IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE ; + hw->flags =IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | +IEEE80211_HW_NO_MAC_CHANGE_SUPPORT ; hw->queues =4 ;#ifdef CONFIG_IWLWIFI_HT
Re: [PATCH (2.6.24) 0/3] last minute iwlwifi fixes
In reply to a message not in the archiveIn general it is possible to change the mac address and there was a patch for it if I remember correctly. It had some issues so I nacked it, it slipped from my attention after that. I'll try to dig the history.
Tomas
Quoted 13 lines · Johannes Berg
So I took another look at iwlwifi and identified a bunch of user-visible problems with the drivers. Unfortunately, I was unable to fix one of them (MAC address setting ignored) so I added a workaround. I've repeatedly pointed out that iwlwifi needs fixing here but I guess for .24 we'll just have to live with not being able to change the MAC address.
johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Johannes Berg
maintainerRe: [PATCH (2.6.24) 0/3] last minute iwlwifi fixes
Quoted 4 lines · Tomas Winkler
In general it is possible to change the mac address and there was a patch for it if I remember correctly. It had some issues so I nacked it, it slipped from my attention after that. I'll try to dig the history.
Thanks. I didn't feel confident enough with the driver to make such a change since I have no idea where it should/would be uploaded to the hardware and whether maybe the ucode gets it from the eeprom too etc.
If you can get a patch that makes this work I'm all for it since the mac80211 hack isn't too nice anyway.
johannes
Re: [PATCH (2.6.24) 0/3] last minute iwlwifi fixes
Quoted 7 lines · Johannes Berg
Quoted 4 lines · Tomas Winkler
In general it is possible to change the mac address and there was a patch for it if I remember correctly. It had some issues so I nacked it, it slipped from my attention after that. I'll try to dig the history.
Quoted 7 lines
Thanks. I didn't feel confident enough with the driver to make such a change since I have no idea where it should/would be uploaded to the hardware and whether maybe the ucode gets it from the eeprom too etc.
If you can get a patch that makes this work I'm all for it since the mac80211 hack isn't too nice anyway.
I found it, there was a patch by Ian Schram <[email protected]> '[PATCH] allow changing mac_addr by userspace'
It should work I nacked it just because I wanted to remove a filed he was using, it never happened so I think we can apply it for 24 and then I get back to rework it.
I'll resend it rebased to current everything.
Quoted 2 lines
johannes
Johannes Berg
maintainerRe: [PATCH (2.6.24) 0/3] last minute iwlwifi fixes
Quoted 6 lines · Tomas Winkler
I found it, there was a patch by Ian Schram <[email protected]> '[PATCH] allow changing
mac_addrby userspace'
It should work I nacked it just because I wanted to remove a filed he was using, it never happened so I think we can apply it for 24 and then I get back to rework it.
I'll resend it rebased to current everything.
Great, thanks. Actually, John will probably prefer if you send him a version against .24 as well. John, please drop 2 and 3 of this series then in favour of that patch.
johannes
Re: [PATCH (2.6.24) 0/3] last minute iwlwifi fixes
sorry for stupid question but what is the git for 24.?
Quoted 16 lines · Johannes Berg
Quoted 6 lines · Tomas Winkler
I found it, there was a patch by Ian Schram <[email protected]> '[PATCH] allow changing
mac_addrby userspace'
It should work I nacked it just because I wanted to remove a filed he was using, it never happened so I think we can apply it for 24 and then I get back to rework it.
I'll resend it rebased to current everything.Great, thanks. Actually, John will probably prefer if you send him a version against .24 as well. John, please drop 2 and 3 of this series then in favour of that patch.
johannes
Johannes Berg
maintainerRe: [PATCH (2.6.24) 0/3] last minute iwlwifi fixes
Quoted 1 line · Tomas Winkler
sorry for stupid question but what is the git for 24.?
I don't think we have anything pending in git or I guess John would probably call it upstream-fixes-jgarzik or something. I diff against Linus's tree right now.
johannes
PATCH 1/1 ubject: [PATCH 1/1] iwlwifi: fix iwl_mac_add_interface handler
In reply to a message not in the archivePatch for 2.6.24
This patch fixes iwl_mac_add_interface.
1. Currently only one interface is supported, instead of silently retuning 0
now it returns -EOPNOTSUPP (By Johannes Berg)
2. It enables changing mac address from user space (By Ian Schram)
--- drivers/net/wireless/iwlwifi/iwl3945-base.c | 11 +++++++---- drivers/net/wireless/iwlwifi/iwl4965-base.c | 8 +++++--- 2 files changed, 12 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlwifi/iwl3945-base.c +7 -4
@@ -6936,13 +6936,10 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,DECLARE_MAC_BUF (mac);IWL_DEBUG_MAC80211 ("enter: id %d, type %d\n" , conf->if_id, conf->type); -if (conf->mac_addr) -IWL_DEBUG_MAC80211 ("enter: MAC %s\n" , -print_mac (mac, conf->mac_addr));if (priv->interface_id) {IWL_DEBUG_MAC80211 ("leave - interface_id != 0\n" ); -return 0 ; +return -EOPNOTSUPP ; }spin_lock_irqsave (&priv->lock, flags);
@@ -6951,6 +6948,12 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,spin_unlock_irqrestore (&priv->lock, flags);mutex_lock (&priv->mutex); + +if (conf->mac_addr) { +IWL_DEBUG_MAC80211 ("Set: %s\n" ,print_mac (mac, conf->mac_addr)); +memcpy (priv->mac_addr, conf->mac_addr,ETH_ALEN ); + } +iwl_set_mode (priv, conf->type);IWL_DEBUG_MAC80211 ("leave\n" );
drivers/net/wireless/iwlwifi/iwl4965-base.c +5 -3
@@ -7326,9 +7326,6 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,DECLARE_MAC_BUF (mac);IWL_DEBUG_MAC80211 ("enter: id %d, type %d\n" , conf->if_id, conf->type); -if (conf->mac_addr) -IWL_DEBUG_MAC80211 ("enter: MAC %s\n" , -print_mac (mac, conf->mac_addr));if (priv->interface_id) {IWL_DEBUG_MAC80211 ("leave - interface_id != 0\n" );
@@ -7341,6 +7338,11 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,spin_unlock_irqrestore (&priv->lock, flags);mutex_lock (&priv->mutex); + +if (conf->mac_addr) { +IWL_DEBUG_MAC80211 ("Set %s\n" ,print_mac (mac, conf->mac_addr)); +memcpy (priv->mac_addr, conf->mac_addr,ETH_ALEN ); + }iwl_set_mode (priv, conf->type);IWL_DEBUG_MAC80211 ("leave\n" );
Signature · 8 lines
1.5.2.2 --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.