* [PATCH] mac80211: make retry limits part of hw config
@ 2008-10-10 23:53 Johannes Berg
2008-10-11 13:40 ` Ivo van Doorn
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Johannes Berg @ 2008-10-10 23:53 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Ivo van Doorn, Michael Buesch
Instead of having a separate callback, use the HW config callback
with a new flag to change retry limits.
Not the cleanest of all patches in the driver area, but it should
not change anything wrt. how they work.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
drivers/net/wireless/ath9k/main.c | 1
drivers/net/wireless/b43/main.c | 67 +++++++++++++-----------------
drivers/net/wireless/b43legacy/main.c | 70 ++++++++++++++------------------
drivers/net/wireless/rt2x00/rt2400pci.c | 2
drivers/net/wireless/rt2x00/rt2500pci.c | 2
drivers/net/wireless/rt2x00/rt2x00.h | 3 +
drivers/net/wireless/rt2x00/rt2x00mac.c | 9 ++++
drivers/net/wireless/rt2x00/rt61pci.c | 2
drivers/net/wireless/rt2x00/rt73usb.c | 2
include/net/mac80211.h | 14 ++++--
net/mac80211/debugfs.c | 4 -
net/mac80211/ieee80211_i.h | 2
net/mac80211/main.c | 4 -
net/mac80211/tx.c | 4 -
net/mac80211/wext.c | 28 +++++-------
15 files changed, 106 insertions(+), 108 deletions(-)
--- everything.orig/include/net/mac80211.h 2008-10-10 23:27:46.000000000 +0200
+++ everything/include/net/mac80211.h 2008-10-10 23:31:21.000000000 +0200
@@ -473,6 +473,7 @@ static inline int __deprecated __IEEE802
* @IEEE80211_CONF_CHANGE_PS: the PS flag changed
* @IEEE80211_CONF_CHANGE_POWER: the TX power changed
* @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed
+ * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
*/
enum ieee80211_conf_changed {
IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
@@ -482,6 +483,7 @@ enum ieee80211_conf_changed {
IEEE80211_CONF_CHANGE_PS = BIT(4),
IEEE80211_CONF_CHANGE_POWER = BIT(5),
IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
+ IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
};
/**
@@ -497,6 +499,12 @@ enum ieee80211_conf_changed {
* @ht_cap: describes current self configuration of 802.11n HT capabilities
* @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
* @channel: the channel to tune to
+ * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
+ * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
+ * but actually means the number of transmissions not the number of retries
+ * @short_frame_max_tx_count: Maximum number of transmissions for a "short" frame,
+ * called "dot11ShortRetryLimit" in 802.11, but actually means the number
+ * of transmissions not the number of retries
*/
struct ieee80211_conf {
int beacon_int;
@@ -506,6 +514,8 @@ struct ieee80211_conf {
u16 listen_interval;
bool radio_enabled;
+ u8 long_frame_max_tx_count, short_frame_max_tx_count;
+
struct ieee80211_channel *channel;
struct ieee80211_sta_ht_cap ht_cap;
@@ -1192,8 +1202,6 @@ enum ieee80211_ampdu_mlme_action {
* the device does fragmentation by itself; if this method is assigned then
* the stack will not do fragmentation.
*
- * @set_retry_limit: Configuration of retry limits (if device needs it)
- *
* @sta_notify: Notifies low level driver about addition or removal
* of assocaited station or AP.
*
@@ -1263,8 +1271,6 @@ struct ieee80211_ops {
u32 *iv32, u16 *iv16);
int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
- int (*set_retry_limit)(struct ieee80211_hw *hw,
- u32 short_retry, u32 long_retr);
void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
enum sta_notify_cmd, struct ieee80211_sta *sta);
int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
--- everything.orig/net/mac80211/ieee80211_i.h 2008-10-10 23:27:46.000000000 +0200
+++ everything/net/mac80211/ieee80211_i.h 2008-10-10 23:31:22.000000000 +0200
@@ -632,8 +632,6 @@ struct ieee80211_local {
int rts_threshold;
int fragmentation_threshold;
- int short_retry_limit; /* dot11ShortRetryLimit */
- int long_retry_limit; /* dot11LongRetryLimit */
struct crypto_blkcipher *wep_tx_tfm;
struct crypto_blkcipher *wep_rx_tfm;
--- everything.orig/net/mac80211/main.c 2008-10-10 23:27:46.000000000 +0200
+++ everything/net/mac80211/main.c 2008-10-10 23:31:22.000000000 +0200
@@ -673,8 +673,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(
local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
- local->short_retry_limit = 7;
- local->long_retry_limit = 4;
+ local->hw.conf.long_frame_max_tx_count = 4;
+ local->hw.conf.short_frame_max_tx_count = 7;
local->hw.conf.radio_enabled = true;
INIT_LIST_HEAD(&local->interfaces);
--- everything.orig/net/mac80211/wext.c 2008-10-10 23:27:46.000000000 +0200
+++ everything/net/mac80211/wext.c 2008-10-10 23:31:22.000000000 +0200
@@ -802,21 +802,16 @@ static int ieee80211_ioctl_siwretry(stru
(retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
return -EINVAL;
- if (retry->flags & IW_RETRY_MAX)
- local->long_retry_limit = retry->value;
- else if (retry->flags & IW_RETRY_MIN)
- local->short_retry_limit = retry->value;
- else {
- local->long_retry_limit = retry->value;
- local->short_retry_limit = retry->value;
+ if (retry->flags & IW_RETRY_MAX) {
+ local->hw.conf.long_frame_max_tx_count = retry->value;
+ } else if (retry->flags & IW_RETRY_MIN) {
+ local->hw.conf.short_frame_max_tx_count = retry->value;
+ } else {
+ local->hw.conf.long_frame_max_tx_count = retry->value;
+ local->hw.conf.short_frame_max_tx_count = retry->value;
}
- if (local->ops->set_retry_limit) {
- return local->ops->set_retry_limit(
- local_to_hw(local),
- local->short_retry_limit,
- local->long_retry_limit);
- }
+ ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS);
return 0;
}
@@ -833,14 +828,15 @@ static int ieee80211_ioctl_giwretry(stru
/* first return min value, iwconfig will ask max value
* later if needed */
retry->flags |= IW_RETRY_LIMIT;
- retry->value = local->short_retry_limit;
- if (local->long_retry_limit != local->short_retry_limit)
+ retry->value = local->hw.conf.short_frame_max_tx_count;
+ if (local->hw.conf.long_frame_max_tx_count !=
+ local->hw.conf.short_frame_max_tx_count)
retry->flags |= IW_RETRY_MIN;
return 0;
}
if (retry->flags & IW_RETRY_MAX) {
retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
- retry->value = local->long_retry_limit;
+ retry->value = local->hw.conf.long_frame_max_tx_count;
}
return 0;
--- everything.orig/drivers/net/wireless/ath9k/main.c 2008-10-10 23:27:47.000000000 +0200
+++ everything/drivers/net/wireless/ath9k/main.c 2008-10-10 23:31:23.000000000 +0200
@@ -1657,7 +1657,6 @@ static struct ieee80211_ops ath9k_ops =
.get_tkip_seq = NULL,
.set_rts_threshold = NULL,
.set_frag_threshold = NULL,
- .set_retry_limit = NULL,
.get_tsf = ath9k_get_tsf,
.reset_tsf = ath9k_reset_tsf,
.tx_last_beacon = NULL,
--- everything.orig/drivers/net/wireless/b43/main.c 2008-10-10 23:27:47.000000000 +0200
+++ everything/drivers/net/wireless/b43/main.c 2008-10-10 23:31:23.000000000 +0200
@@ -3320,6 +3320,22 @@ init_failure:
return err;
}
+/* Write the short and long frame retry limit values. */
+static void b43_set_retry_limits(struct b43_wldev *dev,
+ unsigned int short_retry,
+ unsigned int long_retry)
+{
+ /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
+ * the chip-internal counter. */
+ short_retry = min(short_retry, (unsigned int)0xF);
+ long_retry = min(long_retry, (unsigned int)0xF);
+
+ b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT,
+ short_retry);
+ b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT,
+ long_retry);
+}
+
static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
{
struct b43_wl *wl = hw_to_b43_wl(hw);
@@ -3333,6 +3349,20 @@ static int b43_op_config(struct ieee8021
mutex_lock(&wl->mutex);
+ if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
+ dev = wl->current_dev;
+ if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED))) {
+ err = -ENODEV;
+ goto out_unlock_mutex;
+ }
+ b43_set_retry_limits(dev, conf->short_frame_max_tx_count,
+ conf->long_frame_max_tx_count);
+ changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
+ }
+
+ if (!changed)
+ goto out_unlock_mutex;
+
/* Switch the band (if necessary). This might change the active core. */
err = b43_switch_band(wl, conf->channel);
if (err)
@@ -3860,22 +3890,6 @@ static void b43_imcfglo_timeouts_workaro
#endif /* CONFIG_SSB_DRIVER_PCICORE */
}
-/* Write the short and long frame retry limit values. */
-static void b43_set_retry_limits(struct b43_wldev *dev,
- unsigned int short_retry,
- unsigned int long_retry)
-{
- /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
- * the chip-internal counter. */
- short_retry = min(short_retry, (unsigned int)0xF);
- long_retry = min(long_retry, (unsigned int)0xF);
-
- b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT,
- short_retry);
- b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT,
- long_retry);
-}
-
static void b43_set_synth_pu_delay(struct b43_wldev *dev, bool idle)
{
u16 pu_delay;
@@ -4196,26 +4210,6 @@ static void b43_op_stop(struct ieee80211
cancel_work_sync(&(wl->txpower_adjust_work));
}
-static int b43_op_set_retry_limit(struct ieee80211_hw *hw,
- u32 short_retry_limit, u32 long_retry_limit)
-{
- struct b43_wl *wl = hw_to_b43_wl(hw);
- struct b43_wldev *dev;
- int err = 0;
-
- mutex_lock(&wl->mutex);
- dev = wl->current_dev;
- if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED))) {
- err = -ENODEV;
- goto out_unlock;
- }
- b43_set_retry_limits(dev, short_retry_limit, long_retry_limit);
-out_unlock:
- mutex_unlock(&wl->mutex);
-
- return err;
-}
-
static int b43_op_beacon_set_tim(struct ieee80211_hw *hw,
struct ieee80211_sta *sta, bool set)
{
@@ -4252,7 +4246,6 @@ static const struct ieee80211_ops b43_hw
.get_tx_stats = b43_op_get_tx_stats,
.start = b43_op_start,
.stop = b43_op_stop,
- .set_retry_limit = b43_op_set_retry_limit,
.set_tim = b43_op_beacon_set_tim,
.sta_notify = b43_op_sta_notify,
};
--- everything.orig/drivers/net/wireless/b43legacy/main.c 2008-10-10 23:27:47.000000000 +0200
+++ everything/drivers/net/wireless/b43legacy/main.c 2008-10-10 23:31:23.000000000 +0200
@@ -2556,6 +2556,20 @@ init_failure:
return err;
}
+/* Write the short and long frame retry limit values. */
+static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev,
+ unsigned int short_retry,
+ unsigned int long_retry)
+{
+ /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
+ * the chip-internal counter. */
+ short_retry = min(short_retry, (unsigned int)0xF);
+ long_retry = min(long_retry, (unsigned int)0xF);
+
+ b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry);
+ b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry);
+}
+
static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
u32 changed)
{
@@ -2570,10 +2584,27 @@ static int b43legacy_op_dev_config(struc
int err = 0;
u32 savedirqs;
+ mutex_lock(&wl->mutex);
+ dev = wl->current_dev;
+
+ if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
+ if (unlikely(!dev ||
+ (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED))) {
+ err = -ENODEV;
+ goto out_unlock_mutex;
+ }
+ b43legacy_set_retry_limits(dev,
+ conf->short_frame_max_tx_count,
+ conf->long_frame_max_tx_count);
+ changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
+ }
+
+ if (!changed)
+ goto out_unlock_mutex;
+
antenna_tx = B43legacy_ANTENNA_DEFAULT;
antenna_rx = B43legacy_ANTENNA_DEFAULT;
- mutex_lock(&wl->mutex);
dev = wl->current_dev;
phy = &dev->phy;
@@ -2989,20 +3020,6 @@ static void b43legacy_imcfglo_timeouts_w
#endif /* CONFIG_SSB_DRIVER_PCICORE */
}
-/* Write the short and long frame retry limit values. */
-static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev,
- unsigned int short_retry,
- unsigned int long_retry)
-{
- /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
- * the chip-internal counter. */
- short_retry = min(short_retry, (unsigned int)0xF);
- long_retry = min(long_retry, (unsigned int)0xF);
-
- b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry);
- b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry);
-}
-
static void b43legacy_set_synth_pu_delay(struct b43legacy_wldev *dev,
bool idle) {
u16 pu_delay = 1050;
@@ -3367,28 +3384,6 @@ static void b43legacy_op_stop(struct iee
mutex_unlock(&wl->mutex);
}
-static int b43legacy_op_set_retry_limit(struct ieee80211_hw *hw,
- u32 short_retry_limit,
- u32 long_retry_limit)
-{
- struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
- struct b43legacy_wldev *dev;
- int err = 0;
-
- mutex_lock(&wl->mutex);
- dev = wl->current_dev;
- if (unlikely(!dev ||
- (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED))) {
- err = -ENODEV;
- goto out_unlock;
- }
- b43legacy_set_retry_limits(dev, short_retry_limit, long_retry_limit);
-out_unlock:
- mutex_unlock(&wl->mutex);
-
- return err;
-}
-
static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw,
struct ieee80211_sta *sta, bool set)
{
@@ -3414,7 +3409,6 @@ static const struct ieee80211_ops b43leg
.get_tx_stats = b43legacy_op_get_tx_stats,
.start = b43legacy_op_start,
.stop = b43legacy_op_stop,
- .set_retry_limit = b43legacy_op_set_retry_limit,
.set_tim = b43legacy_op_beacon_set_tim,
};
--- everything.orig/drivers/net/wireless/rt2x00/rt2400pci.c 2008-10-10 23:27:46.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt2400pci.c 2008-10-10 23:27:48.000000000 +0200
@@ -1576,7 +1576,6 @@ static const struct ieee80211_ops rt2400
.config_interface = rt2x00mac_config_interface,
.configure_filter = rt2x00mac_configure_filter,
.get_stats = rt2x00mac_get_stats,
- .set_retry_limit = rt2400pci_set_retry_limit,
.bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt2400pci_conf_tx,
.get_tx_stats = rt2x00mac_get_tx_stats,
@@ -1605,6 +1604,7 @@ static const struct rt2x00lib_ops rt2400
.config_intf = rt2400pci_config_intf,
.config_erp = rt2400pci_config_erp,
.config = rt2400pci_config,
+ .set_retry_limit = rt2400pci_set_retry_limit,
};
static const struct data_queue_desc rt2400pci_queue_rx = {
--- everything.orig/drivers/net/wireless/rt2x00/rt2x00.h 2008-10-10 23:27:47.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt2x00.h 2008-10-10 23:27:48.000000000 +0200
@@ -599,6 +599,9 @@ struct rt2x00lib_ops {
#define CONFIG_UPDATE_SLOT_TIME ( 1 << 5 )
#define CONFIG_UPDATE_BEACON_INT ( 1 << 6 )
#define CONFIG_UPDATE_ALL 0xffff
+
+ int (*set_retry_limit) (struct ieee80211_hw *hw,
+ u32 short_limit, u32 long_limit);
};
/*
--- everything.orig/drivers/net/wireless/rt2x00/rt2500pci.c 2008-10-10 23:27:46.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt2500pci.c 2008-10-10 23:27:48.000000000 +0200
@@ -1877,7 +1877,6 @@ static const struct ieee80211_ops rt2500
.config_interface = rt2x00mac_config_interface,
.configure_filter = rt2x00mac_configure_filter,
.get_stats = rt2x00mac_get_stats,
- .set_retry_limit = rt2500pci_set_retry_limit,
.bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt2x00mac_conf_tx,
.get_tx_stats = rt2x00mac_get_tx_stats,
@@ -1906,6 +1905,7 @@ static const struct rt2x00lib_ops rt2500
.config_intf = rt2500pci_config_intf,
.config_erp = rt2500pci_config_erp,
.config = rt2500pci_config,
+ .set_retry_limit = rt2500pci_set_retry_limit,
};
static const struct data_queue_desc rt2500pci_queue_rx = {
--- everything.orig/drivers/net/wireless/rt2x00/rt61pci.c 2008-10-10 23:27:47.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt61pci.c 2008-10-10 23:27:48.000000000 +0200
@@ -2726,7 +2726,6 @@ static const struct ieee80211_ops rt61pc
.configure_filter = rt2x00mac_configure_filter,
.set_key = rt2x00mac_set_key,
.get_stats = rt2x00mac_get_stats,
- .set_retry_limit = rt61pci_set_retry_limit,
.bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt61pci_conf_tx,
.get_tx_stats = rt2x00mac_get_tx_stats,
@@ -2759,6 +2758,7 @@ static const struct rt2x00lib_ops rt61pc
.config_intf = rt61pci_config_intf,
.config_erp = rt61pci_config_erp,
.config = rt61pci_config,
+ .set_retry_limit = rt61pci_set_retry_limit,
};
static const struct data_queue_desc rt61pci_queue_rx = {
--- everything.orig/drivers/net/wireless/rt2x00/rt73usb.c 2008-10-10 23:27:47.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt73usb.c 2008-10-10 23:27:48.000000000 +0200
@@ -2317,7 +2317,6 @@ static const struct ieee80211_ops rt73us
.configure_filter = rt2x00mac_configure_filter,
.set_key = rt2x00mac_set_key,
.get_stats = rt2x00mac_get_stats,
- .set_retry_limit = rt73usb_set_retry_limit,
.bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt73usb_conf_tx,
.get_tx_stats = rt2x00mac_get_tx_stats,
@@ -2349,6 +2348,7 @@ static const struct rt2x00lib_ops rt73us
.config_intf = rt73usb_config_intf,
.config_erp = rt73usb_config_erp,
.config = rt73usb_config,
+ .set_retry_limit = rt73usb_set_retry_limit,
};
static const struct data_queue_desc rt73usb_queue_rx = {
--- everything.orig/drivers/net/wireless/rt2x00/rt2x00mac.c 2008-10-10 23:27:46.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt2x00mac.c 2008-10-10 23:31:23.000000000 +0200
@@ -349,6 +349,15 @@ int rt2x00mac_config(struct ieee80211_hw
if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
return 0;
+ if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
+ rt2x00dev->ops->lib->set_retry_limit(hw,
+ conf->short_frame_max_tx_count,
+ conf->long_frame_max_tx_count);
+ }
+ changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
+ if (!changed)
+ return 0;
+
/*
* Only change device state when the radio is enabled. It does not
* matter what parameters we have configured when the radio is disabled
--- everything.orig/net/mac80211/debugfs.c 2008-10-10 23:27:46.000000000 +0200
+++ everything/net/mac80211/debugfs.c 2008-10-10 23:27:48.000000000 +0200
@@ -52,9 +52,9 @@ DEBUGFS_READONLY_FILE(rts_threshold, 20,
DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
local->fragmentation_threshold);
DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d",
- local->short_retry_limit);
+ local->hw.conf.short_frame_max_tx_count);
DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d",
- local->long_retry_limit);
+ local->hw.conf.long_frame_max_tx_count);
DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d",
local->total_ps_buffered);
DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x",
--- everything.orig/net/mac80211/tx.c 2008-10-10 23:27:46.000000000 +0200
+++ everything/net/mac80211/tx.c 2008-10-10 23:31:22.000000000 +0200
@@ -507,10 +507,10 @@ ieee80211_tx_h_misc(struct ieee80211_tx_
info->flags |=
IEEE80211_TX_CTL_LONG_RETRY_LIMIT;
info->control.retry_limit =
- tx->local->long_retry_limit;
+ tx->local->hw.conf.long_frame_max_tx_count - 1;
} else {
info->control.retry_limit =
- tx->local->short_retry_limit;
+ tx->local->hw.conf.short_frame_max_tx_count - 1;
}
} else {
info->control.retry_limit = 1;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mac80211: make retry limits part of hw config
2008-10-10 23:53 [PATCH] mac80211: make retry limits part of hw config Johannes Berg
@ 2008-10-11 13:40 ` Ivo van Doorn
2008-10-11 13:46 ` Johannes Berg
2008-10-11 13:41 ` Michael Buesch
2008-10-14 17:17 ` [PATCH v2] " Johannes Berg
2 siblings, 1 reply; 6+ messages in thread
From: Ivo van Doorn @ 2008-10-11 13:40 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless, Michael Buesch
On Saturday 11 October 2008, Johannes Berg wrote:
> Instead of having a separate callback, use the HW config callback
> with a new flag to change retry limits.
>
> Not the cleanest of all patches in the driver area, but it should
> not change anything wrt. how they work.
For rt2x00 it looks good, the entire config handling in rt2x00 will
be changed anyway because of your patch
mac80211: introduce hw config change flags
Because that one really makes things easier. :)
Ivo
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> ---
> drivers/net/wireless/ath9k/main.c | 1
> drivers/net/wireless/b43/main.c | 67 +++++++++++++-----------------
> drivers/net/wireless/b43legacy/main.c | 70 ++++++++++++++------------------
> drivers/net/wireless/rt2x00/rt2400pci.c | 2
> drivers/net/wireless/rt2x00/rt2500pci.c | 2
> drivers/net/wireless/rt2x00/rt2x00.h | 3 +
> drivers/net/wireless/rt2x00/rt2x00mac.c | 9 ++++
> drivers/net/wireless/rt2x00/rt61pci.c | 2
> drivers/net/wireless/rt2x00/rt73usb.c | 2
> include/net/mac80211.h | 14 ++++--
> net/mac80211/debugfs.c | 4 -
> net/mac80211/ieee80211_i.h | 2
> net/mac80211/main.c | 4 -
> net/mac80211/tx.c | 4 -
> net/mac80211/wext.c | 28 +++++-------
> 15 files changed, 106 insertions(+), 108 deletions(-)
>
> --- everything.orig/include/net/mac80211.h 2008-10-10 23:27:46.000000000 +0200
> +++ everything/include/net/mac80211.h 2008-10-10 23:31:21.000000000 +0200
> @@ -473,6 +473,7 @@ static inline int __deprecated __IEEE802
> * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
> * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
> * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed
> + * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
> */
> enum ieee80211_conf_changed {
> IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
> @@ -482,6 +483,7 @@ enum ieee80211_conf_changed {
> IEEE80211_CONF_CHANGE_PS = BIT(4),
> IEEE80211_CONF_CHANGE_POWER = BIT(5),
> IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
> + IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
> };
>
> /**
> @@ -497,6 +499,12 @@ enum ieee80211_conf_changed {
> * @ht_cap: describes current self configuration of 802.11n HT capabilities
> * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
> * @channel: the channel to tune to
> + * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
> + * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
> + * but actually means the number of transmissions not the number of retries
> + * @short_frame_max_tx_count: Maximum number of transmissions for a "short" frame,
> + * called "dot11ShortRetryLimit" in 802.11, but actually means the number
> + * of transmissions not the number of retries
> */
> struct ieee80211_conf {
> int beacon_int;
> @@ -506,6 +514,8 @@ struct ieee80211_conf {
> u16 listen_interval;
> bool radio_enabled;
>
> + u8 long_frame_max_tx_count, short_frame_max_tx_count;
> +
> struct ieee80211_channel *channel;
>
> struct ieee80211_sta_ht_cap ht_cap;
> @@ -1192,8 +1202,6 @@ enum ieee80211_ampdu_mlme_action {
> * the device does fragmentation by itself; if this method is assigned then
> * the stack will not do fragmentation.
> *
> - * @set_retry_limit: Configuration of retry limits (if device needs it)
> - *
> * @sta_notify: Notifies low level driver about addition or removal
> * of assocaited station or AP.
> *
> @@ -1263,8 +1271,6 @@ struct ieee80211_ops {
> u32 *iv32, u16 *iv16);
> int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
> int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
> - int (*set_retry_limit)(struct ieee80211_hw *hw,
> - u32 short_retry, u32 long_retr);
> void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> enum sta_notify_cmd, struct ieee80211_sta *sta);
> int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
> --- everything.orig/net/mac80211/ieee80211_i.h 2008-10-10 23:27:46.000000000 +0200
> +++ everything/net/mac80211/ieee80211_i.h 2008-10-10 23:31:22.000000000 +0200
> @@ -632,8 +632,6 @@ struct ieee80211_local {
>
> int rts_threshold;
> int fragmentation_threshold;
> - int short_retry_limit; /* dot11ShortRetryLimit */
> - int long_retry_limit; /* dot11LongRetryLimit */
>
> struct crypto_blkcipher *wep_tx_tfm;
> struct crypto_blkcipher *wep_rx_tfm;
> --- everything.orig/net/mac80211/main.c 2008-10-10 23:27:46.000000000 +0200
> +++ everything/net/mac80211/main.c 2008-10-10 23:31:22.000000000 +0200
> @@ -673,8 +673,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(
>
> local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
> local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
> - local->short_retry_limit = 7;
> - local->long_retry_limit = 4;
> + local->hw.conf.long_frame_max_tx_count = 4;
> + local->hw.conf.short_frame_max_tx_count = 7;
> local->hw.conf.radio_enabled = true;
>
> INIT_LIST_HEAD(&local->interfaces);
> --- everything.orig/net/mac80211/wext.c 2008-10-10 23:27:46.000000000 +0200
> +++ everything/net/mac80211/wext.c 2008-10-10 23:31:22.000000000 +0200
> @@ -802,21 +802,16 @@ static int ieee80211_ioctl_siwretry(stru
> (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
> return -EINVAL;
>
> - if (retry->flags & IW_RETRY_MAX)
> - local->long_retry_limit = retry->value;
> - else if (retry->flags & IW_RETRY_MIN)
> - local->short_retry_limit = retry->value;
> - else {
> - local->long_retry_limit = retry->value;
> - local->short_retry_limit = retry->value;
> + if (retry->flags & IW_RETRY_MAX) {
> + local->hw.conf.long_frame_max_tx_count = retry->value;
> + } else if (retry->flags & IW_RETRY_MIN) {
> + local->hw.conf.short_frame_max_tx_count = retry->value;
> + } else {
> + local->hw.conf.long_frame_max_tx_count = retry->value;
> + local->hw.conf.short_frame_max_tx_count = retry->value;
> }
>
> - if (local->ops->set_retry_limit) {
> - return local->ops->set_retry_limit(
> - local_to_hw(local),
> - local->short_retry_limit,
> - local->long_retry_limit);
> - }
> + ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS);
>
> return 0;
> }
> @@ -833,14 +828,15 @@ static int ieee80211_ioctl_giwretry(stru
> /* first return min value, iwconfig will ask max value
> * later if needed */
> retry->flags |= IW_RETRY_LIMIT;
> - retry->value = local->short_retry_limit;
> - if (local->long_retry_limit != local->short_retry_limit)
> + retry->value = local->hw.conf.short_frame_max_tx_count;
> + if (local->hw.conf.long_frame_max_tx_count !=
> + local->hw.conf.short_frame_max_tx_count)
> retry->flags |= IW_RETRY_MIN;
> return 0;
> }
> if (retry->flags & IW_RETRY_MAX) {
> retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
> - retry->value = local->long_retry_limit;
> + retry->value = local->hw.conf.long_frame_max_tx_count;
> }
>
> return 0;
> --- everything.orig/drivers/net/wireless/ath9k/main.c 2008-10-10 23:27:47.000000000 +0200
> +++ everything/drivers/net/wireless/ath9k/main.c 2008-10-10 23:31:23.000000000 +0200
> @@ -1657,7 +1657,6 @@ static struct ieee80211_ops ath9k_ops =
> .get_tkip_seq = NULL,
> .set_rts_threshold = NULL,
> .set_frag_threshold = NULL,
> - .set_retry_limit = NULL,
> .get_tsf = ath9k_get_tsf,
> .reset_tsf = ath9k_reset_tsf,
> .tx_last_beacon = NULL,
> --- everything.orig/drivers/net/wireless/b43/main.c 2008-10-10 23:27:47.000000000 +0200
> +++ everything/drivers/net/wireless/b43/main.c 2008-10-10 23:31:23.000000000 +0200
> @@ -3320,6 +3320,22 @@ init_failure:
> return err;
> }
>
> +/* Write the short and long frame retry limit values. */
> +static void b43_set_retry_limits(struct b43_wldev *dev,
> + unsigned int short_retry,
> + unsigned int long_retry)
> +{
> + /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
> + * the chip-internal counter. */
> + short_retry = min(short_retry, (unsigned int)0xF);
> + long_retry = min(long_retry, (unsigned int)0xF);
> +
> + b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT,
> + short_retry);
> + b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT,
> + long_retry);
> +}
> +
> static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
> {
> struct b43_wl *wl = hw_to_b43_wl(hw);
> @@ -3333,6 +3349,20 @@ static int b43_op_config(struct ieee8021
>
> mutex_lock(&wl->mutex);
>
> + if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
> + dev = wl->current_dev;
> + if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED))) {
> + err = -ENODEV;
> + goto out_unlock_mutex;
> + }
> + b43_set_retry_limits(dev, conf->short_frame_max_tx_count,
> + conf->long_frame_max_tx_count);
> + changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
> + }
> +
> + if (!changed)
> + goto out_unlock_mutex;
> +
> /* Switch the band (if necessary). This might change the active core. */
> err = b43_switch_band(wl, conf->channel);
> if (err)
> @@ -3860,22 +3890,6 @@ static void b43_imcfglo_timeouts_workaro
> #endif /* CONFIG_SSB_DRIVER_PCICORE */
> }
>
> -/* Write the short and long frame retry limit values. */
> -static void b43_set_retry_limits(struct b43_wldev *dev,
> - unsigned int short_retry,
> - unsigned int long_retry)
> -{
> - /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
> - * the chip-internal counter. */
> - short_retry = min(short_retry, (unsigned int)0xF);
> - long_retry = min(long_retry, (unsigned int)0xF);
> -
> - b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT,
> - short_retry);
> - b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT,
> - long_retry);
> -}
> -
> static void b43_set_synth_pu_delay(struct b43_wldev *dev, bool idle)
> {
> u16 pu_delay;
> @@ -4196,26 +4210,6 @@ static void b43_op_stop(struct ieee80211
> cancel_work_sync(&(wl->txpower_adjust_work));
> }
>
> -static int b43_op_set_retry_limit(struct ieee80211_hw *hw,
> - u32 short_retry_limit, u32 long_retry_limit)
> -{
> - struct b43_wl *wl = hw_to_b43_wl(hw);
> - struct b43_wldev *dev;
> - int err = 0;
> -
> - mutex_lock(&wl->mutex);
> - dev = wl->current_dev;
> - if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED))) {
> - err = -ENODEV;
> - goto out_unlock;
> - }
> - b43_set_retry_limits(dev, short_retry_limit, long_retry_limit);
> -out_unlock:
> - mutex_unlock(&wl->mutex);
> -
> - return err;
> -}
> -
> static int b43_op_beacon_set_tim(struct ieee80211_hw *hw,
> struct ieee80211_sta *sta, bool set)
> {
> @@ -4252,7 +4246,6 @@ static const struct ieee80211_ops b43_hw
> .get_tx_stats = b43_op_get_tx_stats,
> .start = b43_op_start,
> .stop = b43_op_stop,
> - .set_retry_limit = b43_op_set_retry_limit,
> .set_tim = b43_op_beacon_set_tim,
> .sta_notify = b43_op_sta_notify,
> };
> --- everything.orig/drivers/net/wireless/b43legacy/main.c 2008-10-10 23:27:47.000000000 +0200
> +++ everything/drivers/net/wireless/b43legacy/main.c 2008-10-10 23:31:23.000000000 +0200
> @@ -2556,6 +2556,20 @@ init_failure:
> return err;
> }
>
> +/* Write the short and long frame retry limit values. */
> +static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev,
> + unsigned int short_retry,
> + unsigned int long_retry)
> +{
> + /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
> + * the chip-internal counter. */
> + short_retry = min(short_retry, (unsigned int)0xF);
> + long_retry = min(long_retry, (unsigned int)0xF);
> +
> + b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry);
> + b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry);
> +}
> +
> static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
> u32 changed)
> {
> @@ -2570,10 +2584,27 @@ static int b43legacy_op_dev_config(struc
> int err = 0;
> u32 savedirqs;
>
> + mutex_lock(&wl->mutex);
> + dev = wl->current_dev;
> +
> + if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
> + if (unlikely(!dev ||
> + (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED))) {
> + err = -ENODEV;
> + goto out_unlock_mutex;
> + }
> + b43legacy_set_retry_limits(dev,
> + conf->short_frame_max_tx_count,
> + conf->long_frame_max_tx_count);
> + changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
> + }
> +
> + if (!changed)
> + goto out_unlock_mutex;
> +
> antenna_tx = B43legacy_ANTENNA_DEFAULT;
> antenna_rx = B43legacy_ANTENNA_DEFAULT;
>
> - mutex_lock(&wl->mutex);
> dev = wl->current_dev;
> phy = &dev->phy;
>
> @@ -2989,20 +3020,6 @@ static void b43legacy_imcfglo_timeouts_w
> #endif /* CONFIG_SSB_DRIVER_PCICORE */
> }
>
> -/* Write the short and long frame retry limit values. */
> -static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev,
> - unsigned int short_retry,
> - unsigned int long_retry)
> -{
> - /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
> - * the chip-internal counter. */
> - short_retry = min(short_retry, (unsigned int)0xF);
> - long_retry = min(long_retry, (unsigned int)0xF);
> -
> - b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry);
> - b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry);
> -}
> -
> static void b43legacy_set_synth_pu_delay(struct b43legacy_wldev *dev,
> bool idle) {
> u16 pu_delay = 1050;
> @@ -3367,28 +3384,6 @@ static void b43legacy_op_stop(struct iee
> mutex_unlock(&wl->mutex);
> }
>
> -static int b43legacy_op_set_retry_limit(struct ieee80211_hw *hw,
> - u32 short_retry_limit,
> - u32 long_retry_limit)
> -{
> - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
> - struct b43legacy_wldev *dev;
> - int err = 0;
> -
> - mutex_lock(&wl->mutex);
> - dev = wl->current_dev;
> - if (unlikely(!dev ||
> - (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED))) {
> - err = -ENODEV;
> - goto out_unlock;
> - }
> - b43legacy_set_retry_limits(dev, short_retry_limit, long_retry_limit);
> -out_unlock:
> - mutex_unlock(&wl->mutex);
> -
> - return err;
> -}
> -
> static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw,
> struct ieee80211_sta *sta, bool set)
> {
> @@ -3414,7 +3409,6 @@ static const struct ieee80211_ops b43leg
> .get_tx_stats = b43legacy_op_get_tx_stats,
> .start = b43legacy_op_start,
> .stop = b43legacy_op_stop,
> - .set_retry_limit = b43legacy_op_set_retry_limit,
> .set_tim = b43legacy_op_beacon_set_tim,
> };
>
> --- everything.orig/drivers/net/wireless/rt2x00/rt2400pci.c 2008-10-10 23:27:46.000000000 +0200
> +++ everything/drivers/net/wireless/rt2x00/rt2400pci.c 2008-10-10 23:27:48.000000000 +0200
> @@ -1576,7 +1576,6 @@ static const struct ieee80211_ops rt2400
> .config_interface = rt2x00mac_config_interface,
> .configure_filter = rt2x00mac_configure_filter,
> .get_stats = rt2x00mac_get_stats,
> - .set_retry_limit = rt2400pci_set_retry_limit,
> .bss_info_changed = rt2x00mac_bss_info_changed,
> .conf_tx = rt2400pci_conf_tx,
> .get_tx_stats = rt2x00mac_get_tx_stats,
> @@ -1605,6 +1604,7 @@ static const struct rt2x00lib_ops rt2400
> .config_intf = rt2400pci_config_intf,
> .config_erp = rt2400pci_config_erp,
> .config = rt2400pci_config,
> + .set_retry_limit = rt2400pci_set_retry_limit,
> };
>
> static const struct data_queue_desc rt2400pci_queue_rx = {
> --- everything.orig/drivers/net/wireless/rt2x00/rt2x00.h 2008-10-10 23:27:47.000000000 +0200
> +++ everything/drivers/net/wireless/rt2x00/rt2x00.h 2008-10-10 23:27:48.000000000 +0200
> @@ -599,6 +599,9 @@ struct rt2x00lib_ops {
> #define CONFIG_UPDATE_SLOT_TIME ( 1 << 5 )
> #define CONFIG_UPDATE_BEACON_INT ( 1 << 6 )
> #define CONFIG_UPDATE_ALL 0xffff
> +
> + int (*set_retry_limit) (struct ieee80211_hw *hw,
> + u32 short_limit, u32 long_limit);
> };
>
> /*
> --- everything.orig/drivers/net/wireless/rt2x00/rt2500pci.c 2008-10-10 23:27:46.000000000 +0200
> +++ everything/drivers/net/wireless/rt2x00/rt2500pci.c 2008-10-10 23:27:48.000000000 +0200
> @@ -1877,7 +1877,6 @@ static const struct ieee80211_ops rt2500
> .config_interface = rt2x00mac_config_interface,
> .configure_filter = rt2x00mac_configure_filter,
> .get_stats = rt2x00mac_get_stats,
> - .set_retry_limit = rt2500pci_set_retry_limit,
> .bss_info_changed = rt2x00mac_bss_info_changed,
> .conf_tx = rt2x00mac_conf_tx,
> .get_tx_stats = rt2x00mac_get_tx_stats,
> @@ -1906,6 +1905,7 @@ static const struct rt2x00lib_ops rt2500
> .config_intf = rt2500pci_config_intf,
> .config_erp = rt2500pci_config_erp,
> .config = rt2500pci_config,
> + .set_retry_limit = rt2500pci_set_retry_limit,
> };
>
> static const struct data_queue_desc rt2500pci_queue_rx = {
> --- everything.orig/drivers/net/wireless/rt2x00/rt61pci.c 2008-10-10 23:27:47.000000000 +0200
> +++ everything/drivers/net/wireless/rt2x00/rt61pci.c 2008-10-10 23:27:48.000000000 +0200
> @@ -2726,7 +2726,6 @@ static const struct ieee80211_ops rt61pc
> .configure_filter = rt2x00mac_configure_filter,
> .set_key = rt2x00mac_set_key,
> .get_stats = rt2x00mac_get_stats,
> - .set_retry_limit = rt61pci_set_retry_limit,
> .bss_info_changed = rt2x00mac_bss_info_changed,
> .conf_tx = rt61pci_conf_tx,
> .get_tx_stats = rt2x00mac_get_tx_stats,
> @@ -2759,6 +2758,7 @@ static const struct rt2x00lib_ops rt61pc
> .config_intf = rt61pci_config_intf,
> .config_erp = rt61pci_config_erp,
> .config = rt61pci_config,
> + .set_retry_limit = rt61pci_set_retry_limit,
> };
>
> static const struct data_queue_desc rt61pci_queue_rx = {
> --- everything.orig/drivers/net/wireless/rt2x00/rt73usb.c 2008-10-10 23:27:47.000000000 +0200
> +++ everything/drivers/net/wireless/rt2x00/rt73usb.c 2008-10-10 23:27:48.000000000 +0200
> @@ -2317,7 +2317,6 @@ static const struct ieee80211_ops rt73us
> .configure_filter = rt2x00mac_configure_filter,
> .set_key = rt2x00mac_set_key,
> .get_stats = rt2x00mac_get_stats,
> - .set_retry_limit = rt73usb_set_retry_limit,
> .bss_info_changed = rt2x00mac_bss_info_changed,
> .conf_tx = rt73usb_conf_tx,
> .get_tx_stats = rt2x00mac_get_tx_stats,
> @@ -2349,6 +2348,7 @@ static const struct rt2x00lib_ops rt73us
> .config_intf = rt73usb_config_intf,
> .config_erp = rt73usb_config_erp,
> .config = rt73usb_config,
> + .set_retry_limit = rt73usb_set_retry_limit,
> };
>
> static const struct data_queue_desc rt73usb_queue_rx = {
> --- everything.orig/drivers/net/wireless/rt2x00/rt2x00mac.c 2008-10-10 23:27:46.000000000 +0200
> +++ everything/drivers/net/wireless/rt2x00/rt2x00mac.c 2008-10-10 23:31:23.000000000 +0200
> @@ -349,6 +349,15 @@ int rt2x00mac_config(struct ieee80211_hw
> if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
> return 0;
>
> + if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
> + rt2x00dev->ops->lib->set_retry_limit(hw,
> + conf->short_frame_max_tx_count,
> + conf->long_frame_max_tx_count);
> + }
> + changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
> + if (!changed)
> + return 0;
> +
> /*
> * Only change device state when the radio is enabled. It does not
> * matter what parameters we have configured when the radio is disabled
> --- everything.orig/net/mac80211/debugfs.c 2008-10-10 23:27:46.000000000 +0200
> +++ everything/net/mac80211/debugfs.c 2008-10-10 23:27:48.000000000 +0200
> @@ -52,9 +52,9 @@ DEBUGFS_READONLY_FILE(rts_threshold, 20,
> DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
> local->fragmentation_threshold);
> DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d",
> - local->short_retry_limit);
> + local->hw.conf.short_frame_max_tx_count);
> DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d",
> - local->long_retry_limit);
> + local->hw.conf.long_frame_max_tx_count);
> DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d",
> local->total_ps_buffered);
> DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x",
> --- everything.orig/net/mac80211/tx.c 2008-10-10 23:27:46.000000000 +0200
> +++ everything/net/mac80211/tx.c 2008-10-10 23:31:22.000000000 +0200
> @@ -507,10 +507,10 @@ ieee80211_tx_h_misc(struct ieee80211_tx_
> info->flags |=
> IEEE80211_TX_CTL_LONG_RETRY_LIMIT;
> info->control.retry_limit =
> - tx->local->long_retry_limit;
> + tx->local->hw.conf.long_frame_max_tx_count - 1;
> } else {
> info->control.retry_limit =
> - tx->local->short_retry_limit;
> + tx->local->hw.conf.short_frame_max_tx_count - 1;
> }
> } else {
> info->control.retry_limit = 1;
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mac80211: make retry limits part of hw config
2008-10-10 23:53 [PATCH] mac80211: make retry limits part of hw config Johannes Berg
2008-10-11 13:40 ` Ivo van Doorn
@ 2008-10-11 13:41 ` Michael Buesch
2008-10-11 13:48 ` Johannes Berg
2008-10-14 17:17 ` [PATCH v2] " Johannes Berg
2 siblings, 1 reply; 6+ messages in thread
From: Michael Buesch @ 2008-10-11 13:41 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless, Ivo van Doorn
On Saturday 11 October 2008 01:53:55 Johannes Berg wrote:
> static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
> {
> struct b43_wl *wl = hw_to_b43_wl(hw);
> @@ -3333,6 +3349,20 @@ static int b43_op_config(struct ieee8021
>
> mutex_lock(&wl->mutex);
>
> + if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
> + dev = wl->current_dev;
> + if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED))) {
> + err = -ENODEV;
> + goto out_unlock_mutex;
> + }
> + b43_set_retry_limits(dev, conf->short_frame_max_tx_count,
> + conf->long_frame_max_tx_count);
> + changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
> + }
> +
> + if (!changed)
> + goto out_unlock_mutex;
> +
> /* Switch the band (if necessary). This might change the active core. */
> err = b43_switch_band(wl, conf->channel);
> if (err)
This must be done _after_ bandswitch. (You also have a valid dev pointer there.
Just do it after the checks done there).
> @@ -2570,10 +2584,27 @@ static int b43legacy_op_dev_config(struc
> int err = 0;
> u32 savedirqs;
>
> + mutex_lock(&wl->mutex);
> + dev = wl->current_dev;
> +
> + if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
> + if (unlikely(!dev ||
> + (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED))) {
> + err = -ENODEV;
> + goto out_unlock_mutex;
> + }
> + b43legacy_set_retry_limits(dev,
> + conf->short_frame_max_tx_count,
> + conf->long_frame_max_tx_count);
> + changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
> + }
> +
> + if (!changed)
> + goto out_unlock_mutex;
> +
> antenna_tx = B43legacy_ANTENNA_DEFAULT;
> antenna_rx = B43legacy_ANTENNA_DEFAULT;
>
> - mutex_lock(&wl->mutex);
> dev = wl->current_dev;
This also is a bit fishy.
> phy = &dev->phy;
>
> @@ -2989,20 +3020,6 @@ static void b43legacy_imcfglo_timeouts_w
> #endif /* CONFIG_SSB_DRIVER_PCICORE */
> }
>
--
Greetings Michael.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mac80211: make retry limits part of hw config
2008-10-11 13:40 ` Ivo van Doorn
@ 2008-10-11 13:46 ` Johannes Berg
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2008-10-11 13:46 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: John Linville, linux-wireless, Michael Buesch
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
On Sat, 2008-10-11 at 15:40 +0200, Ivo van Doorn wrote:
> On Saturday 11 October 2008, Johannes Berg wrote:
> > Instead of having a separate callback, use the HW config callback
> > with a new flag to change retry limits.
> >
> > Not the cleanest of all patches in the driver area, but it should
> > not change anything wrt. how they work.
>
> For rt2x00 it looks good, the entire config handling in rt2x00 will
> be changed anyway because of your patch
> mac80211: introduce hw config change flags
> Because that one really makes things easier. :)
Yeah I figured you'd say that :)
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mac80211: make retry limits part of hw config
2008-10-11 13:41 ` Michael Buesch
@ 2008-10-11 13:48 ` Johannes Berg
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2008-10-11 13:48 UTC (permalink / raw)
To: Michael Buesch; +Cc: John Linville, linux-wireless, Ivo van Doorn
[-- Attachment #1: Type: text/plain, Size: 2009 bytes --]
On Sat, 2008-10-11 at 15:41 +0200, Michael Buesch wrote:
> On Saturday 11 October 2008 01:53:55 Johannes Berg wrote:
> > static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
> > {
> > struct b43_wl *wl = hw_to_b43_wl(hw);
> > @@ -3333,6 +3349,20 @@ static int b43_op_config(struct ieee8021
> >
> > mutex_lock(&wl->mutex);
> >
> > + if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
> > + dev = wl->current_dev;
> > + if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED))) {
> > + err = -ENODEV;
> > + goto out_unlock_mutex;
> > + }
> > + b43_set_retry_limits(dev, conf->short_frame_max_tx_count,
> > + conf->long_frame_max_tx_count);
> > + changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
> > + }
> > +
> > + if (!changed)
> > + goto out_unlock_mutex;
> > +
> > /* Switch the band (if necessary). This might change the active core. */
> > err = b43_switch_band(wl, conf->channel);
> > if (err)
>
> This must be done _after_ bandswitch. (You also have a valid dev pointer there.
> Just do it after the checks done there).
Possibly, but the original code didn't do that either and I didn't want
to think much :)
> > + mutex_lock(&wl->mutex);
> > + dev = wl->current_dev;
> > +
> > + if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
> > + if (unlikely(!dev ||
> > + (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED))) {
> > + err = -ENODEV;
> > + goto out_unlock_mutex;
> > + }
> > + b43legacy_set_retry_limits(dev,
> > + conf->short_frame_max_tx_count,
> > + conf->long_frame_max_tx_count);
> > + changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
> > + }
> > +
> > + if (!changed)
> > + goto out_unlock_mutex;
> > +
> > antenna_tx = B43legacy_ANTENNA_DEFAULT;
> > antenna_rx = B43legacy_ANTENNA_DEFAULT;
> >
> > - mutex_lock(&wl->mutex);
> > dev = wl->current_dev;
>
> This also is a bit fishy.
Which part? the double assignment of "wl"?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] mac80211: make retry limits part of hw config
2008-10-10 23:53 [PATCH] mac80211: make retry limits part of hw config Johannes Berg
2008-10-11 13:40 ` Ivo van Doorn
2008-10-11 13:41 ` Michael Buesch
@ 2008-10-14 17:17 ` Johannes Berg
2 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2008-10-14 17:17 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Ivo van Doorn, Michael Buesch
Instead of having a separate callback, use the HW config callback
with a new flag to change retry limits.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
v2: update b43 changes
drivers/net/wireless/ath9k/main.c | 1
drivers/net/wireless/b43/main.c | 60 ++++++++++++--------------------
drivers/net/wireless/b43legacy/main.c | 59 +++++++++++--------------------
drivers/net/wireless/rt2x00/rt2400pci.c | 2 -
drivers/net/wireless/rt2x00/rt2500pci.c | 2 -
drivers/net/wireless/rt2x00/rt2x00.h | 3 +
drivers/net/wireless/rt2x00/rt2x00mac.c | 9 ++++
drivers/net/wireless/rt2x00/rt61pci.c | 2 -
drivers/net/wireless/rt2x00/rt73usb.c | 2 -
include/net/mac80211.h | 14 +++++--
net/mac80211/debugfs.c | 4 +-
net/mac80211/ieee80211_i.h | 2 -
net/mac80211/main.c | 4 +-
net/mac80211/tx.c | 4 +-
net/mac80211/wext.c | 28 ++++++--------
15 files changed, 89 insertions(+), 107 deletions(-)
--- everything.orig/include/net/mac80211.h 2008-10-14 16:31:10.000000000 +0200
+++ everything/include/net/mac80211.h 2008-10-14 19:10:01.000000000 +0200
@@ -473,6 +473,7 @@ static inline int __deprecated __IEEE802
* @IEEE80211_CONF_CHANGE_PS: the PS flag changed
* @IEEE80211_CONF_CHANGE_POWER: the TX power changed
* @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed
+ * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
*/
enum ieee80211_conf_changed {
IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
@@ -482,6 +483,7 @@ enum ieee80211_conf_changed {
IEEE80211_CONF_CHANGE_PS = BIT(4),
IEEE80211_CONF_CHANGE_POWER = BIT(5),
IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
+ IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
};
/**
@@ -497,6 +499,12 @@ enum ieee80211_conf_changed {
* @ht_cap: describes current self configuration of 802.11n HT capabilities
* @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
* @channel: the channel to tune to
+ * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
+ * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
+ * but actually means the number of transmissions not the number of retries
+ * @short_frame_max_tx_count: Maximum number of transmissions for a "short" frame,
+ * called "dot11ShortRetryLimit" in 802.11, but actually means the number
+ * of transmissions not the number of retries
*/
struct ieee80211_conf {
int beacon_int;
@@ -506,6 +514,8 @@ struct ieee80211_conf {
u16 listen_interval;
bool radio_enabled;
+ u8 long_frame_max_tx_count, short_frame_max_tx_count;
+
struct ieee80211_channel *channel;
struct ieee80211_sta_ht_cap ht_cap;
@@ -1192,8 +1202,6 @@ enum ieee80211_ampdu_mlme_action {
* the device does fragmentation by itself; if this method is assigned then
* the stack will not do fragmentation.
*
- * @set_retry_limit: Configuration of retry limits (if device needs it)
- *
* @sta_notify: Notifies low level driver about addition or removal
* of assocaited station or AP.
*
@@ -1263,8 +1271,6 @@ struct ieee80211_ops {
u32 *iv32, u16 *iv16);
int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
- int (*set_retry_limit)(struct ieee80211_hw *hw,
- u32 short_retry, u32 long_retr);
void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
enum sta_notify_cmd, struct ieee80211_sta *sta);
int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
--- everything.orig/net/mac80211/ieee80211_i.h 2008-10-14 16:31:10.000000000 +0200
+++ everything/net/mac80211/ieee80211_i.h 2008-10-14 19:10:02.000000000 +0200
@@ -632,8 +632,6 @@ struct ieee80211_local {
int rts_threshold;
int fragmentation_threshold;
- int short_retry_limit; /* dot11ShortRetryLimit */
- int long_retry_limit; /* dot11LongRetryLimit */
struct crypto_blkcipher *wep_tx_tfm;
struct crypto_blkcipher *wep_rx_tfm;
--- everything.orig/net/mac80211/main.c 2008-10-14 16:31:10.000000000 +0200
+++ everything/net/mac80211/main.c 2008-10-14 19:10:05.000000000 +0200
@@ -673,8 +673,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(
local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
- local->short_retry_limit = 7;
- local->long_retry_limit = 4;
+ local->hw.conf.long_frame_max_tx_count = 4;
+ local->hw.conf.short_frame_max_tx_count = 7;
local->hw.conf.radio_enabled = true;
INIT_LIST_HEAD(&local->interfaces);
--- everything.orig/net/mac80211/wext.c 2008-10-14 12:24:43.000000000 +0200
+++ everything/net/mac80211/wext.c 2008-10-14 19:10:05.000000000 +0200
@@ -802,21 +802,16 @@ static int ieee80211_ioctl_siwretry(stru
(retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
return -EINVAL;
- if (retry->flags & IW_RETRY_MAX)
- local->long_retry_limit = retry->value;
- else if (retry->flags & IW_RETRY_MIN)
- local->short_retry_limit = retry->value;
- else {
- local->long_retry_limit = retry->value;
- local->short_retry_limit = retry->value;
+ if (retry->flags & IW_RETRY_MAX) {
+ local->hw.conf.long_frame_max_tx_count = retry->value;
+ } else if (retry->flags & IW_RETRY_MIN) {
+ local->hw.conf.short_frame_max_tx_count = retry->value;
+ } else {
+ local->hw.conf.long_frame_max_tx_count = retry->value;
+ local->hw.conf.short_frame_max_tx_count = retry->value;
}
- if (local->ops->set_retry_limit) {
- return local->ops->set_retry_limit(
- local_to_hw(local),
- local->short_retry_limit,
- local->long_retry_limit);
- }
+ ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS);
return 0;
}
@@ -833,14 +828,15 @@ static int ieee80211_ioctl_giwretry(stru
/* first return min value, iwconfig will ask max value
* later if needed */
retry->flags |= IW_RETRY_LIMIT;
- retry->value = local->short_retry_limit;
- if (local->long_retry_limit != local->short_retry_limit)
+ retry->value = local->hw.conf.short_frame_max_tx_count;
+ if (local->hw.conf.long_frame_max_tx_count !=
+ local->hw.conf.short_frame_max_tx_count)
retry->flags |= IW_RETRY_MIN;
return 0;
}
if (retry->flags & IW_RETRY_MAX) {
retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
- retry->value = local->long_retry_limit;
+ retry->value = local->hw.conf.long_frame_max_tx_count;
}
return 0;
--- everything.orig/drivers/net/wireless/ath9k/main.c 2008-10-14 12:24:44.000000000 +0200
+++ everything/drivers/net/wireless/ath9k/main.c 2008-10-14 19:10:05.000000000 +0200
@@ -1657,7 +1657,6 @@ static struct ieee80211_ops ath9k_ops =
.get_tkip_seq = NULL,
.set_rts_threshold = NULL,
.set_frag_threshold = NULL,
- .set_retry_limit = NULL,
.get_tsf = ath9k_get_tsf,
.reset_tsf = ath9k_reset_tsf,
.tx_last_beacon = NULL,
--- everything.orig/drivers/net/wireless/b43/main.c 2008-10-14 12:24:44.000000000 +0200
+++ everything/drivers/net/wireless/b43/main.c 2008-10-14 19:12:26.000000000 +0200
@@ -3320,6 +3320,22 @@ init_failure:
return err;
}
+/* Write the short and long frame retry limit values. */
+static void b43_set_retry_limits(struct b43_wldev *dev,
+ unsigned int short_retry,
+ unsigned int long_retry)
+{
+ /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
+ * the chip-internal counter. */
+ short_retry = min(short_retry, (unsigned int)0xF);
+ long_retry = min(long_retry, (unsigned int)0xF);
+
+ b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT,
+ short_retry);
+ b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT,
+ long_retry);
+}
+
static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
{
struct b43_wl *wl = hw_to_b43_wl(hw);
@@ -3340,6 +3356,13 @@ static int b43_op_config(struct ieee8021
dev = wl->current_dev;
phy = &dev->phy;
+ if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
+ b43_set_retry_limits(dev, conf->short_frame_max_tx_count,
+ conf->long_frame_max_tx_count);
+ changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
+ if (!changed)
+ goto out_unlock_mutex;
+
/* Disable IRQs while reconfiguring the device.
* This makes it possible to drop the spinlock throughout
* the reconfiguration process. */
@@ -3860,22 +3883,6 @@ static void b43_imcfglo_timeouts_workaro
#endif /* CONFIG_SSB_DRIVER_PCICORE */
}
-/* Write the short and long frame retry limit values. */
-static void b43_set_retry_limits(struct b43_wldev *dev,
- unsigned int short_retry,
- unsigned int long_retry)
-{
- /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
- * the chip-internal counter. */
- short_retry = min(short_retry, (unsigned int)0xF);
- long_retry = min(long_retry, (unsigned int)0xF);
-
- b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT,
- short_retry);
- b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT,
- long_retry);
-}
-
static void b43_set_synth_pu_delay(struct b43_wldev *dev, bool idle)
{
u16 pu_delay;
@@ -4196,26 +4203,6 @@ static void b43_op_stop(struct ieee80211
cancel_work_sync(&(wl->txpower_adjust_work));
}
-static int b43_op_set_retry_limit(struct ieee80211_hw *hw,
- u32 short_retry_limit, u32 long_retry_limit)
-{
- struct b43_wl *wl = hw_to_b43_wl(hw);
- struct b43_wldev *dev;
- int err = 0;
-
- mutex_lock(&wl->mutex);
- dev = wl->current_dev;
- if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED))) {
- err = -ENODEV;
- goto out_unlock;
- }
- b43_set_retry_limits(dev, short_retry_limit, long_retry_limit);
-out_unlock:
- mutex_unlock(&wl->mutex);
-
- return err;
-}
-
static int b43_op_beacon_set_tim(struct ieee80211_hw *hw,
struct ieee80211_sta *sta, bool set)
{
@@ -4252,7 +4239,6 @@ static const struct ieee80211_ops b43_hw
.get_tx_stats = b43_op_get_tx_stats,
.start = b43_op_start,
.stop = b43_op_stop,
- .set_retry_limit = b43_op_set_retry_limit,
.set_tim = b43_op_beacon_set_tim,
.sta_notify = b43_op_sta_notify,
};
--- everything.orig/drivers/net/wireless/b43legacy/main.c 2008-10-14 12:24:44.000000000 +0200
+++ everything/drivers/net/wireless/b43legacy/main.c 2008-10-14 19:13:36.000000000 +0200
@@ -2556,6 +2556,20 @@ init_failure:
return err;
}
+/* Write the short and long frame retry limit values. */
+static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev,
+ unsigned int short_retry,
+ unsigned int long_retry)
+{
+ /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
+ * the chip-internal counter. */
+ short_retry = min(short_retry, (unsigned int)0xF);
+ long_retry = min(long_retry, (unsigned int)0xF);
+
+ b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry);
+ b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry);
+}
+
static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
u32 changed)
{
@@ -2577,6 +2591,14 @@ static int b43legacy_op_dev_config(struc
dev = wl->current_dev;
phy = &dev->phy;
+ if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
+ b43legacy_set_retry_limits(dev,
+ conf->short_frame_max_tx_count,
+ conf->long_frame_max_tx_count);
+ changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
+ if (!changed)
+ goto out_unlock_mutex;
+
/* Switch the PHY mode (if necessary). */
switch (conf->channel->band) {
case IEEE80211_BAND_2GHZ:
@@ -2989,20 +3011,6 @@ static void b43legacy_imcfglo_timeouts_w
#endif /* CONFIG_SSB_DRIVER_PCICORE */
}
-/* Write the short and long frame retry limit values. */
-static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev,
- unsigned int short_retry,
- unsigned int long_retry)
-{
- /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing
- * the chip-internal counter. */
- short_retry = min(short_retry, (unsigned int)0xF);
- long_retry = min(long_retry, (unsigned int)0xF);
-
- b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry);
- b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry);
-}
-
static void b43legacy_set_synth_pu_delay(struct b43legacy_wldev *dev,
bool idle) {
u16 pu_delay = 1050;
@@ -3367,28 +3375,6 @@ static void b43legacy_op_stop(struct iee
mutex_unlock(&wl->mutex);
}
-static int b43legacy_op_set_retry_limit(struct ieee80211_hw *hw,
- u32 short_retry_limit,
- u32 long_retry_limit)
-{
- struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
- struct b43legacy_wldev *dev;
- int err = 0;
-
- mutex_lock(&wl->mutex);
- dev = wl->current_dev;
- if (unlikely(!dev ||
- (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED))) {
- err = -ENODEV;
- goto out_unlock;
- }
- b43legacy_set_retry_limits(dev, short_retry_limit, long_retry_limit);
-out_unlock:
- mutex_unlock(&wl->mutex);
-
- return err;
-}
-
static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw,
struct ieee80211_sta *sta, bool set)
{
@@ -3414,7 +3400,6 @@ static const struct ieee80211_ops b43leg
.get_tx_stats = b43legacy_op_get_tx_stats,
.start = b43legacy_op_start,
.stop = b43legacy_op_stop,
- .set_retry_limit = b43legacy_op_set_retry_limit,
.set_tim = b43legacy_op_beacon_set_tim,
};
--- everything.orig/drivers/net/wireless/rt2x00/rt2400pci.c 2008-10-14 12:24:44.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt2400pci.c 2008-10-14 16:31:10.000000000 +0200
@@ -1576,7 +1576,6 @@ static const struct ieee80211_ops rt2400
.config_interface = rt2x00mac_config_interface,
.configure_filter = rt2x00mac_configure_filter,
.get_stats = rt2x00mac_get_stats,
- .set_retry_limit = rt2400pci_set_retry_limit,
.bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt2400pci_conf_tx,
.get_tx_stats = rt2x00mac_get_tx_stats,
@@ -1605,6 +1604,7 @@ static const struct rt2x00lib_ops rt2400
.config_intf = rt2400pci_config_intf,
.config_erp = rt2400pci_config_erp,
.config = rt2400pci_config,
+ .set_retry_limit = rt2400pci_set_retry_limit,
};
static const struct data_queue_desc rt2400pci_queue_rx = {
--- everything.orig/drivers/net/wireless/rt2x00/rt2x00.h 2008-10-14 12:24:44.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt2x00.h 2008-10-14 16:31:10.000000000 +0200
@@ -599,6 +599,9 @@ struct rt2x00lib_ops {
#define CONFIG_UPDATE_SLOT_TIME ( 1 << 5 )
#define CONFIG_UPDATE_BEACON_INT ( 1 << 6 )
#define CONFIG_UPDATE_ALL 0xffff
+
+ int (*set_retry_limit) (struct ieee80211_hw *hw,
+ u32 short_limit, u32 long_limit);
};
/*
--- everything.orig/drivers/net/wireless/rt2x00/rt2500pci.c 2008-10-14 12:24:44.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt2500pci.c 2008-10-14 16:31:10.000000000 +0200
@@ -1877,7 +1877,6 @@ static const struct ieee80211_ops rt2500
.config_interface = rt2x00mac_config_interface,
.configure_filter = rt2x00mac_configure_filter,
.get_stats = rt2x00mac_get_stats,
- .set_retry_limit = rt2500pci_set_retry_limit,
.bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt2x00mac_conf_tx,
.get_tx_stats = rt2x00mac_get_tx_stats,
@@ -1906,6 +1905,7 @@ static const struct rt2x00lib_ops rt2500
.config_intf = rt2500pci_config_intf,
.config_erp = rt2500pci_config_erp,
.config = rt2500pci_config,
+ .set_retry_limit = rt2500pci_set_retry_limit,
};
static const struct data_queue_desc rt2500pci_queue_rx = {
--- everything.orig/drivers/net/wireless/rt2x00/rt61pci.c 2008-10-14 12:24:44.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt61pci.c 2008-10-14 16:31:10.000000000 +0200
@@ -2726,7 +2726,6 @@ static const struct ieee80211_ops rt61pc
.configure_filter = rt2x00mac_configure_filter,
.set_key = rt2x00mac_set_key,
.get_stats = rt2x00mac_get_stats,
- .set_retry_limit = rt61pci_set_retry_limit,
.bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt61pci_conf_tx,
.get_tx_stats = rt2x00mac_get_tx_stats,
@@ -2759,6 +2758,7 @@ static const struct rt2x00lib_ops rt61pc
.config_intf = rt61pci_config_intf,
.config_erp = rt61pci_config_erp,
.config = rt61pci_config,
+ .set_retry_limit = rt61pci_set_retry_limit,
};
static const struct data_queue_desc rt61pci_queue_rx = {
--- everything.orig/drivers/net/wireless/rt2x00/rt73usb.c 2008-10-14 12:24:44.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt73usb.c 2008-10-14 16:31:10.000000000 +0200
@@ -2317,7 +2317,6 @@ static const struct ieee80211_ops rt73us
.configure_filter = rt2x00mac_configure_filter,
.set_key = rt2x00mac_set_key,
.get_stats = rt2x00mac_get_stats,
- .set_retry_limit = rt73usb_set_retry_limit,
.bss_info_changed = rt2x00mac_bss_info_changed,
.conf_tx = rt73usb_conf_tx,
.get_tx_stats = rt2x00mac_get_tx_stats,
@@ -2349,6 +2348,7 @@ static const struct rt2x00lib_ops rt73us
.config_intf = rt73usb_config_intf,
.config_erp = rt73usb_config_erp,
.config = rt73usb_config,
+ .set_retry_limit = rt73usb_set_retry_limit,
};
static const struct data_queue_desc rt73usb_queue_rx = {
--- everything.orig/drivers/net/wireless/rt2x00/rt2x00mac.c 2008-10-14 12:24:44.000000000 +0200
+++ everything/drivers/net/wireless/rt2x00/rt2x00mac.c 2008-10-14 19:10:03.000000000 +0200
@@ -349,6 +349,15 @@ int rt2x00mac_config(struct ieee80211_hw
if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
return 0;
+ if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
+ rt2x00dev->ops->lib->set_retry_limit(hw,
+ conf->short_frame_max_tx_count,
+ conf->long_frame_max_tx_count);
+ }
+ changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS;
+ if (!changed)
+ return 0;
+
/*
* Only change device state when the radio is enabled. It does not
* matter what parameters we have configured when the radio is disabled
--- everything.orig/net/mac80211/debugfs.c 2008-10-14 12:24:44.000000000 +0200
+++ everything/net/mac80211/debugfs.c 2008-10-14 16:31:10.000000000 +0200
@@ -52,9 +52,9 @@ DEBUGFS_READONLY_FILE(rts_threshold, 20,
DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
local->fragmentation_threshold);
DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d",
- local->short_retry_limit);
+ local->hw.conf.short_frame_max_tx_count);
DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d",
- local->long_retry_limit);
+ local->hw.conf.long_frame_max_tx_count);
DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d",
local->total_ps_buffered);
DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x",
--- everything.orig/net/mac80211/tx.c 2008-10-14 16:31:10.000000000 +0200
+++ everything/net/mac80211/tx.c 2008-10-14 19:10:02.000000000 +0200
@@ -507,10 +507,10 @@ ieee80211_tx_h_misc(struct ieee80211_tx_
info->flags |=
IEEE80211_TX_CTL_LONG_RETRY_LIMIT;
info->control.retry_limit =
- tx->local->long_retry_limit;
+ tx->local->hw.conf.long_frame_max_tx_count - 1;
} else {
info->control.retry_limit =
- tx->local->short_retry_limit;
+ tx->local->hw.conf.short_frame_max_tx_count - 1;
}
} else {
info->control.retry_limit = 1;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-10-14 17:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-10 23:53 [PATCH] mac80211: make retry limits part of hw config Johannes Berg
2008-10-11 13:40 ` Ivo van Doorn
2008-10-11 13:46 ` Johannes Berg
2008-10-11 13:41 ` Michael Buesch
2008-10-11 13:48 ` Johannes Berg
2008-10-14 17:17 ` [PATCH v2] " Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).