2007-09-25 20:57:13 -04:00
|
|
|
/*
|
2009-01-17 14:42:32 -05:00
|
|
|
Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
|
2007-09-25 20:57:13 -04:00
|
|
|
<http://rt2x00.serialmonkey.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the
|
|
|
|
Free Software Foundation, Inc.,
|
|
|
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
Module: rt2x00lib
|
|
|
|
Abstract: rt2x00 generic configuration routines.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
|
|
|
|
#include "rt2x00.h"
|
|
|
|
#include "rt2x00lib.h"
|
|
|
|
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev,
|
|
|
|
struct rt2x00_intf *intf,
|
2008-09-10 18:01:58 -04:00
|
|
|
enum nl80211_iftype type,
|
2009-01-21 06:47:05 -05:00
|
|
|
const u8 *mac, const u8 *bssid)
|
2007-09-25 20:57:13 -04:00
|
|
|
{
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
struct rt2x00intf_conf conf;
|
|
|
|
unsigned int flags = 0;
|
2007-09-25 20:57:13 -04:00
|
|
|
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
conf.type = type;
|
2007-10-06 08:14:29 -04:00
|
|
|
|
|
|
|
switch (type) {
|
2008-09-10 18:01:58 -04:00
|
|
|
case NL80211_IFTYPE_ADHOC:
|
|
|
|
case NL80211_IFTYPE_AP:
|
2008-12-20 04:55:34 -05:00
|
|
|
case NL80211_IFTYPE_MESH_POINT:
|
2008-12-20 04:57:02 -05:00
|
|
|
case NL80211_IFTYPE_WDS:
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
conf.sync = TSF_SYNC_BEACON;
|
2007-10-06 08:14:29 -04:00
|
|
|
break;
|
2008-09-10 18:01:58 -04:00
|
|
|
case NL80211_IFTYPE_STATION:
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
conf.sync = TSF_SYNC_INFRA;
|
2007-10-06 08:14:29 -04:00
|
|
|
break;
|
|
|
|
default:
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
conf.sync = TSF_SYNC_NONE;
|
2007-10-06 08:14:29 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
/*
|
|
|
|
* Note that when NULL is passed as address we will send
|
|
|
|
* 00:00:00:00:00 to the device to clear the address.
|
|
|
|
* This will prevent the device being confused when it wants
|
|
|
|
* to ACK frames or consideres itself associated.
|
|
|
|
*/
|
|
|
|
memset(&conf.mac, 0, sizeof(conf.mac));
|
|
|
|
if (mac)
|
|
|
|
memcpy(&conf.mac, mac, ETH_ALEN);
|
|
|
|
|
|
|
|
memset(&conf.bssid, 0, sizeof(conf.bssid));
|
|
|
|
if (bssid)
|
|
|
|
memcpy(&conf.bssid, bssid, ETH_ALEN);
|
|
|
|
|
|
|
|
flags |= CONFIG_UPDATE_TYPE;
|
|
|
|
if (mac || (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count))
|
|
|
|
flags |= CONFIG_UPDATE_MAC;
|
|
|
|
if (bssid || (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count))
|
|
|
|
flags |= CONFIG_UPDATE_BSSID;
|
|
|
|
|
|
|
|
rt2x00dev->ops->lib->config_intf(rt2x00dev, intf, &conf, flags);
|
|
|
|
}
|
|
|
|
|
2008-03-09 17:46:18 -04:00
|
|
|
void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
|
|
|
|
struct rt2x00_intf *intf,
|
|
|
|
struct ieee80211_bss_conf *bss_conf)
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
{
|
2008-03-09 17:46:18 -04:00
|
|
|
struct rt2x00lib_erp erp;
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
|
2008-03-09 17:46:18 -04:00
|
|
|
memset(&erp, 0, sizeof(erp));
|
|
|
|
|
|
|
|
erp.short_preamble = bss_conf->use_short_preamble;
|
2008-07-09 09:12:06 -04:00
|
|
|
erp.cts_protection = bss_conf->use_cts_prot;
|
|
|
|
|
2008-10-29 12:17:57 -04:00
|
|
|
erp.slot_time = bss_conf->use_short_slot ? SHORT_SLOT_TIME : SLOT_TIME;
|
|
|
|
erp.sifs = SIFS;
|
|
|
|
erp.pifs = bss_conf->use_short_slot ? SHORT_PIFS : PIFS;
|
|
|
|
erp.difs = bss_conf->use_short_slot ? SHORT_DIFS : DIFS;
|
|
|
|
erp.eifs = bss_conf->use_short_slot ? SHORT_EIFS : EIFS;
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
|
2008-11-09 14:47:00 -05:00
|
|
|
erp.ack_timeout = PLCP + erp.difs + GET_DURATION(ACK_SIZE, 10);
|
|
|
|
erp.ack_consume_time = SIFS + PLCP + GET_DURATION(ACK_SIZE, 10);
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
|
2008-03-09 17:46:18 -04:00
|
|
|
if (bss_conf->use_short_preamble) {
|
|
|
|
erp.ack_timeout += SHORT_PREAMBLE;
|
|
|
|
erp.ack_consume_time += SHORT_PREAMBLE;
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
} else {
|
2008-03-09 17:46:18 -04:00
|
|
|
erp.ack_timeout += PREAMBLE;
|
|
|
|
erp.ack_consume_time += PREAMBLE;
|
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-03 09:49:59 -05:00
|
|
|
}
|
|
|
|
|
2008-10-29 12:17:57 -04:00
|
|
|
erp.basic_rates = bss_conf->basic_rates;
|
|
|
|
|
2008-03-25 09:13:18 -04:00
|
|
|
rt2x00dev->ops->lib->config_erp(rt2x00dev, &erp);
|
2007-09-25 20:57:13 -04:00
|
|
|
}
|
|
|
|
|
2008-12-02 12:20:22 -05:00
|
|
|
static inline
|
|
|
|
enum antenna rt2x00lib_config_antenna_check(enum antenna current_ant,
|
|
|
|
enum antenna default_ant)
|
|
|
|
{
|
|
|
|
if (current_ant != ANTENNA_SW_DIVERSITY)
|
|
|
|
return current_ant;
|
|
|
|
return (default_ant != ANTENNA_SW_DIVERSITY) ? default_ant : ANTENNA_B;
|
|
|
|
}
|
|
|
|
|
2007-10-13 10:26:36 -04:00
|
|
|
void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
|
2008-11-01 19:38:10 -04:00
|
|
|
struct antenna_setup *ant)
|
2007-10-13 10:26:36 -04:00
|
|
|
{
|
2008-12-02 12:20:22 -05:00
|
|
|
struct antenna_setup *def = &rt2x00dev->default_ant;
|
|
|
|
struct antenna_setup *active = &rt2x00dev->link.ant.active;
|
|
|
|
|
2008-11-01 19:38:10 -04:00
|
|
|
/*
|
|
|
|
* Failsafe: Make sure we are not sending the
|
|
|
|
* ANTENNA_SW_DIVERSITY state to the driver.
|
|
|
|
* If that happes fallback to hardware default,
|
|
|
|
* or our own default.
|
2008-12-02 12:20:22 -05:00
|
|
|
* The calls to rt2x00lib_config_antenna_check()
|
|
|
|
* might have caused that we restore back to the already
|
|
|
|
* active setting. If that has happened we can quit.
|
2008-11-01 19:38:10 -04:00
|
|
|
*/
|
2008-12-02 12:20:22 -05:00
|
|
|
ant->rx = rt2x00lib_config_antenna_check(ant->rx, def->rx);
|
|
|
|
ant->tx = rt2x00lib_config_antenna_check(ant->tx, def->tx);
|
2007-10-13 10:26:36 -04:00
|
|
|
|
2008-12-02 12:20:22 -05:00
|
|
|
if (ant->rx == active->rx && ant->tx == active->tx)
|
2008-02-25 17:15:08 -05:00
|
|
|
return;
|
|
|
|
|
2007-10-27 07:39:28 -04:00
|
|
|
/*
|
|
|
|
* Antenna setup changes require the RX to be disabled,
|
|
|
|
* else the changes will be ignored by the device.
|
|
|
|
*/
|
2008-08-29 15:04:26 -04:00
|
|
|
if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
|
2008-02-25 17:15:05 -05:00
|
|
|
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF_LINK);
|
2007-10-27 07:39:28 -04:00
|
|
|
|
2007-10-13 10:26:36 -04:00
|
|
|
/*
|
|
|
|
* Write new antenna setup to device and reset the link tuner.
|
|
|
|
* The latter is required since we need to recalibrate the
|
|
|
|
* noise-sensitivity ratio for the new setup.
|
|
|
|
*/
|
2008-11-01 19:38:10 -04:00
|
|
|
rt2x00dev->ops->lib->config_ant(rt2x00dev, ant);
|
2008-10-29 12:17:57 -04:00
|
|
|
|
2008-12-20 04:53:29 -05:00
|
|
|
rt2x00link_reset_tuner(rt2x00dev, true);
|
2007-10-13 10:26:36 -04:00
|
|
|
|
2008-12-02 12:20:22 -05:00
|
|
|
memcpy(active, ant, sizeof(*ant));
|
2007-10-27 07:39:28 -04:00
|
|
|
|
2008-08-29 15:04:26 -04:00
|
|
|
if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
|
2008-02-25 17:15:05 -05:00
|
|
|
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK);
|
2007-10-13 10:26:36 -04:00
|
|
|
}
|
|
|
|
|
2007-09-25 14:55:39 -04:00
|
|
|
void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
|
2008-10-29 12:17:57 -04:00
|
|
|
struct ieee80211_conf *conf,
|
|
|
|
unsigned int ieee80211_flags)
|
2007-09-25 20:57:13 -04:00
|
|
|
{
|
2007-10-06 07:34:52 -04:00
|
|
|
struct rt2x00lib_conf libconf;
|
2007-09-25 20:57:13 -04:00
|
|
|
|
2007-10-06 07:34:52 -04:00
|
|
|
memset(&libconf, 0, sizeof(libconf));
|
|
|
|
|
2008-10-29 12:17:57 -04:00
|
|
|
libconf.conf = conf;
|
2007-10-06 07:34:52 -04:00
|
|
|
|
2008-10-29 12:17:57 -04:00
|
|
|
if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) {
|
2007-10-06 07:34:52 -04:00
|
|
|
memcpy(&libconf.rf,
|
2008-01-24 13:38:38 -05:00
|
|
|
&rt2x00dev->spec.channels[conf->channel->hw_value],
|
2007-10-06 07:34:52 -04:00
|
|
|
sizeof(libconf.rf));
|
2008-08-04 10:38:47 -04:00
|
|
|
|
|
|
|
memcpy(&libconf.channel,
|
|
|
|
&rt2x00dev->spec.channels_info[conf->channel->hw_value],
|
|
|
|
sizeof(libconf.channel));
|
2007-10-06 07:34:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Start configuration.
|
|
|
|
*/
|
2008-10-29 12:17:57 -04:00
|
|
|
rt2x00dev->ops->lib->config(rt2x00dev, &libconf, ieee80211_flags);
|
2007-09-25 20:57:13 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Some configuration changes affect the link quality
|
|
|
|
* which means we need to reset the link tuner.
|
|
|
|
*/
|
2008-10-29 12:17:57 -04:00
|
|
|
if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL)
|
2008-12-20 04:53:29 -05:00
|
|
|
rt2x00link_reset_tuner(rt2x00dev, false);
|
2007-09-25 20:57:13 -04:00
|
|
|
|
2008-10-29 12:17:57 -04:00
|
|
|
rt2x00dev->curr_band = conf->channel->band;
|
2007-09-25 20:57:13 -04:00
|
|
|
rt2x00dev->tx_power = conf->power_level;
|
2008-12-02 12:20:04 -05:00
|
|
|
rt2x00dev->short_retry = conf->short_frame_max_tx_count;
|
|
|
|
rt2x00dev->long_retry = conf->long_frame_max_tx_count;
|
2007-10-13 10:26:57 -04:00
|
|
|
|
2008-10-29 12:17:57 -04:00
|
|
|
rt2x00dev->rx_status.band = conf->channel->band;
|
|
|
|
rt2x00dev->rx_status.freq = conf->channel->center_freq;
|
2007-09-25 20:57:13 -04:00
|
|
|
}
|