2007-09-26 07:57:13 +07:00
|
|
|
/*
|
2008-02-03 21:42:53 +07:00
|
|
|
Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
|
2007-09-26 07:57:13 +07: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 21:49:59 +07:00
|
|
|
void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev,
|
|
|
|
struct rt2x00_intf *intf,
|
|
|
|
enum ieee80211_if_types type,
|
|
|
|
u8 *mac, u8 *bssid)
|
2007-09-26 07:57:13 +07: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 21:49:59 +07:00
|
|
|
struct rt2x00intf_conf conf;
|
|
|
|
unsigned int flags = 0;
|
2007-09-26 07:57:13 +07: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 21:49:59 +07:00
|
|
|
conf.type = type;
|
2007-10-06 19:14:29 +07:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case IEEE80211_IF_TYPE_IBSS:
|
|
|
|
case IEEE80211_IF_TYPE_AP:
|
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 21:49:59 +07:00
|
|
|
conf.sync = TSF_SYNC_BEACON;
|
2007-10-06 19:14:29 +07:00
|
|
|
break;
|
|
|
|
case IEEE80211_IF_TYPE_STA:
|
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 21:49:59 +07:00
|
|
|
conf.sync = TSF_SYNC_INFRA;
|
2007-10-06 19:14:29 +07: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 21:49:59 +07:00
|
|
|
conf.sync = TSF_SYNC_NONE;
|
2007-10-06 19:14:29 +07: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 21:49:59 +07: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-10 04:46:18 +07: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 21:49:59 +07:00
|
|
|
{
|
2008-03-10 04:46:18 +07: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 21:49:59 +07:00
|
|
|
|
2008-03-10 04:46:18 +07:00
|
|
|
memset(&erp, 0, sizeof(erp));
|
|
|
|
|
|
|
|
erp.short_preamble = bss_conf->use_short_preamble;
|
|
|
|
erp.ack_timeout = PLCP + 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 21:49:59 +07:00
|
|
|
|
|
|
|
if (rt2x00dev->hw->conf.flags & IEEE80211_CONF_SHORT_SLOT_TIME)
|
2008-03-10 04:46:18 +07:00
|
|
|
erp.ack_timeout += SHORT_DIFS;
|
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 21:49:59 +07:00
|
|
|
else
|
2008-03-10 04:46:18 +07:00
|
|
|
erp.ack_timeout += DIFS;
|
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 21:49:59 +07:00
|
|
|
|
2008-03-10 04:46:18 +07: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 21:49:59 +07:00
|
|
|
} else {
|
2008-03-10 04:46:18 +07: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 21:49:59 +07:00
|
|
|
}
|
|
|
|
|
2008-03-25 20:13:18 +07:00
|
|
|
rt2x00dev->ops->lib->config_erp(rt2x00dev, &erp);
|
2007-09-26 07:57:13 +07:00
|
|
|
}
|
|
|
|
|
2007-10-13 21:26:36 +07:00
|
|
|
void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
|
|
|
|
enum antenna rx, enum antenna tx)
|
|
|
|
{
|
|
|
|
struct rt2x00lib_conf libconf;
|
|
|
|
|
|
|
|
libconf.ant.rx = rx;
|
|
|
|
libconf.ant.tx = tx;
|
|
|
|
|
2008-02-26 05:15:08 +07:00
|
|
|
if (rx == rt2x00dev->link.ant.active.rx &&
|
|
|
|
tx == rt2x00dev->link.ant.active.tx)
|
|
|
|
return;
|
|
|
|
|
2007-10-27 18:39:28 +07:00
|
|
|
/*
|
|
|
|
* Antenna setup changes require the RX to be disabled,
|
|
|
|
* else the changes will be ignored by the device.
|
|
|
|
*/
|
|
|
|
if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
|
2008-02-26 05:15:05 +07:00
|
|
|
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF_LINK);
|
2007-10-27 18:39:28 +07:00
|
|
|
|
2007-10-13 21:26:36 +07: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.
|
|
|
|
*/
|
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 21:49:59 +07:00
|
|
|
rt2x00dev->ops->lib->config(rt2x00dev, &libconf, CONFIG_UPDATE_ANTENNA);
|
2007-10-13 21:26:36 +07:00
|
|
|
rt2x00lib_reset_link_tuner(rt2x00dev);
|
2008-05-23 23:13:56 +07:00
|
|
|
rt2x00_reset_link_ant_rssi(&rt2x00dev->link);
|
2007-10-13 21:26:36 +07:00
|
|
|
|
|
|
|
rt2x00dev->link.ant.active.rx = libconf.ant.rx;
|
|
|
|
rt2x00dev->link.ant.active.tx = libconf.ant.tx;
|
2007-10-27 18:39:28 +07:00
|
|
|
|
|
|
|
if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
|
2008-02-26 05:15:05 +07:00
|
|
|
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK);
|
2007-10-13 21:26:36 +07:00
|
|
|
}
|
|
|
|
|
2008-03-10 04:48:08 +07:00
|
|
|
static u32 rt2x00lib_get_basic_rates(struct ieee80211_supported_band *band)
|
|
|
|
{
|
|
|
|
const struct rt2x00_rate *rate;
|
|
|
|
unsigned int i;
|
|
|
|
u32 mask = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < band->n_bitrates; i++) {
|
|
|
|
rate = rt2x00_get_rate(band->bitrates[i].hw_value);
|
|
|
|
if (rate->flags & DEV_RATE_BASIC)
|
|
|
|
mask |= rate->ratemask;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mask;
|
|
|
|
}
|
|
|
|
|
2007-09-26 01:55:39 +07:00
|
|
|
void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
|
|
|
|
struct ieee80211_conf *conf, const int force_config)
|
2007-09-26 07:57:13 +07:00
|
|
|
{
|
2007-10-06 18:34:52 +07:00
|
|
|
struct rt2x00lib_conf libconf;
|
2008-01-25 01:38:38 +07:00
|
|
|
struct ieee80211_supported_band *band;
|
2007-10-13 21:26:23 +07:00
|
|
|
struct antenna_setup *default_ant = &rt2x00dev->default_ant;
|
2007-10-13 21:26:36 +07:00
|
|
|
struct antenna_setup *active_ant = &rt2x00dev->link.ant.active;
|
2007-09-26 07:57:13 +07:00
|
|
|
int flags = 0;
|
2007-10-06 18:34:52 +07:00
|
|
|
int short_slot_time;
|
2007-09-26 07:57:13 +07:00
|
|
|
|
|
|
|
/*
|
2007-09-26 01:55:39 +07:00
|
|
|
* In some situations we want to force all configurations
|
|
|
|
* to be reloaded (When resuming for instance).
|
2007-09-26 07:57:13 +07:00
|
|
|
*/
|
2007-09-26 01:55:39 +07:00
|
|
|
if (force_config) {
|
2007-09-26 07:57:13 +07:00
|
|
|
flags = CONFIG_UPDATE_ALL;
|
|
|
|
goto config;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check which configuration options have been
|
|
|
|
* updated and should be send to the device.
|
|
|
|
*/
|
2008-01-25 01:38:38 +07:00
|
|
|
if (rt2x00dev->rx_status.band != conf->channel->band)
|
2007-09-26 07:57:13 +07:00
|
|
|
flags |= CONFIG_UPDATE_PHYMODE;
|
2008-01-25 01:38:38 +07:00
|
|
|
if (rt2x00dev->rx_status.freq != conf->channel->center_freq)
|
2007-09-26 07:57:13 +07:00
|
|
|
flags |= CONFIG_UPDATE_CHANNEL;
|
|
|
|
if (rt2x00dev->tx_power != conf->power_level)
|
|
|
|
flags |= CONFIG_UPDATE_TXPOWER;
|
2007-10-13 21:26:23 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Determining changes in the antenna setups request several checks:
|
|
|
|
* antenna_sel_{r,t}x = 0
|
|
|
|
* -> Does active_{r,t}x match default_{r,t}x
|
|
|
|
* -> Is default_{r,t}x SW_DIVERSITY
|
|
|
|
* antenna_sel_{r,t}x = 1/2
|
|
|
|
* -> Does active_{r,t}x match antenna_sel_{r,t}x
|
|
|
|
* The reason for not updating the antenna while SW diversity
|
|
|
|
* should be used is simple: Software diversity means that
|
|
|
|
* we should switch between the antenna's based on the
|
|
|
|
* quality. This means that the current antenna is good enough
|
|
|
|
* to work with untill the link tuner decides that an antenna
|
|
|
|
* switch should be performed.
|
|
|
|
*/
|
|
|
|
if (!conf->antenna_sel_rx &&
|
|
|
|
default_ant->rx != ANTENNA_SW_DIVERSITY &&
|
|
|
|
default_ant->rx != active_ant->rx)
|
|
|
|
flags |= CONFIG_UPDATE_ANTENNA;
|
|
|
|
else if (conf->antenna_sel_rx &&
|
|
|
|
conf->antenna_sel_rx != active_ant->rx)
|
|
|
|
flags |= CONFIG_UPDATE_ANTENNA;
|
2007-10-13 21:26:57 +07:00
|
|
|
else if (active_ant->rx == ANTENNA_SW_DIVERSITY)
|
|
|
|
flags |= CONFIG_UPDATE_ANTENNA;
|
2007-10-13 21:26:23 +07:00
|
|
|
|
|
|
|
if (!conf->antenna_sel_tx &&
|
|
|
|
default_ant->tx != ANTENNA_SW_DIVERSITY &&
|
|
|
|
default_ant->tx != active_ant->tx)
|
|
|
|
flags |= CONFIG_UPDATE_ANTENNA;
|
|
|
|
else if (conf->antenna_sel_tx &&
|
|
|
|
conf->antenna_sel_tx != active_ant->tx)
|
2007-09-26 07:57:13 +07:00
|
|
|
flags |= CONFIG_UPDATE_ANTENNA;
|
2007-10-13 21:26:57 +07:00
|
|
|
else if (active_ant->tx == ANTENNA_SW_DIVERSITY)
|
|
|
|
flags |= CONFIG_UPDATE_ANTENNA;
|
2007-09-26 07:57:13 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The following configuration options are never
|
|
|
|
* stored anywhere and will always be updated.
|
|
|
|
*/
|
|
|
|
flags |= CONFIG_UPDATE_SLOT_TIME;
|
|
|
|
flags |= CONFIG_UPDATE_BEACON_INT;
|
|
|
|
|
2007-10-06 18:34:52 +07:00
|
|
|
/*
|
|
|
|
* We have determined what options should be updated,
|
|
|
|
* now precalculate device configuration values depending
|
|
|
|
* on what configuration options need to be updated.
|
|
|
|
*/
|
2007-09-26 07:57:13 +07:00
|
|
|
config:
|
2007-10-06 18:34:52 +07:00
|
|
|
memset(&libconf, 0, sizeof(libconf));
|
|
|
|
|
|
|
|
if (flags & CONFIG_UPDATE_PHYMODE) {
|
2008-01-25 01:38:38 +07:00
|
|
|
band = &rt2x00dev->bands[conf->channel->band];
|
2008-02-03 21:51:13 +07:00
|
|
|
|
|
|
|
libconf.band = conf->channel->band;
|
2008-03-10 04:48:08 +07:00
|
|
|
libconf.basic_rates = rt2x00lib_get_basic_rates(band);
|
2007-10-06 18:34:52 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & CONFIG_UPDATE_CHANNEL) {
|
|
|
|
memcpy(&libconf.rf,
|
2008-01-25 01:38:38 +07:00
|
|
|
&rt2x00dev->spec.channels[conf->channel->hw_value],
|
2007-10-06 18:34:52 +07:00
|
|
|
sizeof(libconf.rf));
|
|
|
|
}
|
|
|
|
|
2007-10-13 21:26:23 +07:00
|
|
|
if (flags & CONFIG_UPDATE_ANTENNA) {
|
|
|
|
if (conf->antenna_sel_rx)
|
|
|
|
libconf.ant.rx = conf->antenna_sel_rx;
|
|
|
|
else if (default_ant->rx != ANTENNA_SW_DIVERSITY)
|
|
|
|
libconf.ant.rx = default_ant->rx;
|
|
|
|
else if (active_ant->rx == ANTENNA_SW_DIVERSITY)
|
|
|
|
libconf.ant.rx = ANTENNA_B;
|
|
|
|
|
|
|
|
if (conf->antenna_sel_tx)
|
|
|
|
libconf.ant.tx = conf->antenna_sel_tx;
|
|
|
|
else if (default_ant->tx != ANTENNA_SW_DIVERSITY)
|
|
|
|
libconf.ant.tx = default_ant->tx;
|
|
|
|
else if (active_ant->tx == ANTENNA_SW_DIVERSITY)
|
|
|
|
libconf.ant.tx = ANTENNA_B;
|
|
|
|
}
|
|
|
|
|
2007-10-06 18:34:52 +07:00
|
|
|
if (flags & CONFIG_UPDATE_SLOT_TIME) {
|
|
|
|
short_slot_time = conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME;
|
|
|
|
|
|
|
|
libconf.slot_time =
|
|
|
|
short_slot_time ? SHORT_SLOT_TIME : SLOT_TIME;
|
|
|
|
libconf.sifs = SIFS;
|
|
|
|
libconf.pifs = short_slot_time ? SHORT_PIFS : PIFS;
|
|
|
|
libconf.difs = short_slot_time ? SHORT_DIFS : DIFS;
|
|
|
|
libconf.eifs = EIFS;
|
|
|
|
}
|
|
|
|
|
|
|
|
libconf.conf = conf;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Start configuration.
|
|
|
|
*/
|
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 21:49:59 +07:00
|
|
|
rt2x00dev->ops->lib->config(rt2x00dev, &libconf, flags);
|
2007-09-26 07:57:13 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Some configuration changes affect the link quality
|
|
|
|
* which means we need to reset the link tuner.
|
|
|
|
*/
|
|
|
|
if (flags & (CONFIG_UPDATE_CHANNEL | CONFIG_UPDATE_ANTENNA))
|
|
|
|
rt2x00lib_reset_link_tuner(rt2x00dev);
|
|
|
|
|
2007-10-13 21:26:57 +07:00
|
|
|
if (flags & CONFIG_UPDATE_PHYMODE) {
|
2008-01-25 01:38:38 +07:00
|
|
|
rt2x00dev->curr_band = conf->channel->band;
|
|
|
|
rt2x00dev->rx_status.band = conf->channel->band;
|
2007-10-13 21:26:57 +07:00
|
|
|
}
|
|
|
|
|
2008-01-25 01:38:38 +07:00
|
|
|
rt2x00dev->rx_status.freq = conf->channel->center_freq;
|
2007-09-26 07:57:13 +07:00
|
|
|
rt2x00dev->tx_power = conf->power_level;
|
2007-10-13 21:26:57 +07:00
|
|
|
|
|
|
|
if (flags & CONFIG_UPDATE_ANTENNA) {
|
|
|
|
rt2x00dev->link.ant.active.rx = libconf.ant.rx;
|
|
|
|
rt2x00dev->link.ant.active.tx = libconf.ant.tx;
|
|
|
|
}
|
2007-09-26 07:57:13 +07:00
|
|
|
}
|