2012-03-27 13:56:21

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 0/3] trivial changes preparing mac80211 for multi-channel

Hi,

This patchset contains 3 patches from my previous RFC. One of them has
been fixed as suggested.


-- Pozdrawiam / Best regards, Michal Kazior.



2012-03-27 14:53:50

by Naveen Goswamy

[permalink] [raw]
Subject: brcmsmac not working well


I have the BCM4313 [14e4:4727] (rev 01)

When using wireshark, I see that I am getting many {TCP Retransmission,TCP Dup
ACK,TCP RST} with {TCP, HTTP, SSH} when using brcmsmac driver in the 3.2.1
kernel. I've tried 3.3-rc5 kernel with similar results.

I notice a lot of these popping up in /var/log/messages as well:

ieee80211 phy0: wl0: brcms_c_d11hdrs_mac80211: txop exceeded phylen 155/256 dur
1746/1504
ieee80211 phy0: wl0: brcms_c_d11hdrs_mac80211: txop exceeded phylen 130/256 dur
1546/1504
ieee80211 phy0: wl0: brcms_c_d11hdrs_mac80211: txop exceeded phylen 130/256 dur
1546/1504


any ideas how to solve this?

Thanks,

Naveen


2012-03-27 15:08:15

by Johannes Berg

[permalink] [raw]
Subject: Re: brcmsmac not working well

Please don't hijack threads.

johannes



2012-03-27 15:04:35

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/3] mac80211: prepare ieee80211_mandatory_rates to per-vif

Now I'm confused, and I probably confused you as well ...

> -u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
> +u32 ieee80211_mandatory_rates(struct ieee80211_sub_if_data *sdata,
> enum ieee80211_band band)
> {
> + struct ieee80211_local *local = sdata->local;
> struct ieee80211_supported_band *sband;
> struct ieee80211_rate *bitrates;
> u32 mandatory_rates;

Shouldn't we just remove the sdata/local argument? We don't need it
after all, except for the fallback case that never happens (so we can do
something like "return 1" after the warning)?

johannes


2012-03-27 13:56:25

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 3/3] mac80211: prepare ieee80211_*_duration to per-vif

In preparation for multi-channel operation.

Signed-off-by: Michal Kazior <[email protected]>
---
drivers/net/wireless/ath/ath5k/ath5k.h | 1 +
drivers/net/wireless/ath/ath5k/pcu.c | 9 ++++++---
drivers/net/wireless/ath/ath5k/qcu.c | 3 ++-
include/net/mac80211.h | 1 +
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/rc80211_minstrel.c | 11 ++++++-----
net/mac80211/rc80211_minstrel_ht.c | 4 ++--
net/mac80211/tx.c | 4 ++--
net/mac80211/util.c | 22 +++++++++++-----------
9 files changed, 32 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 8d434b8..2a4371d 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1525,6 +1525,7 @@ void ath5k_eeprom_detach(struct ath5k_hw *ah);
/* Protocol Control Unit Functions */
/* Helpers */
int ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
+ struct ieee80211_supported_band *sband,
int len, struct ieee80211_rate *rate, bool shortpre);
unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah);
unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah);
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
index cebfd6f..1220273 100644
--- a/drivers/net/wireless/ath/ath5k/pcu.c
+++ b/drivers/net/wireless/ath/ath5k/pcu.c
@@ -111,6 +111,7 @@ static const unsigned int ack_rates_high[] =
*/
int
ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
+ struct ieee80211_supported_band *sband,
int len, struct ieee80211_rate *rate, bool shortpre)
{
int sifs, preamble, plcp_bits, sym_time;
@@ -120,7 +121,7 @@ ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
/* Fallback */
if (!ah->ah_bwmode) {
__le16 raw_dur = ieee80211_generic_frame_duration(ah->hw,
- NULL, len, rate);
+ NULL, sband, len, rate);

/* subtract difference between long and short preamble */
dur = le16_to_cpu(raw_dur);
@@ -302,14 +303,16 @@ ath5k_hw_write_rate_duration(struct ath5k_hw *ah)
* actual rate for this rate. See mac80211 tx.c
* ieee80211_duration() for a brief description of
* what rate we should choose to TX ACKs. */
- tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, false);
+ tx_time = ath5k_hw_get_frame_duration(ah, &ah->sbands[band], 10,
+ rate, false);

ath5k_hw_reg_write(ah, tx_time, reg);

if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE))
continue;

- tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, true);
+ tx_time = ath5k_hw_get_frame_duration(ah, &ah->sbands[band],
+ 10, rate, true);
ath5k_hw_reg_write(ah, tx_time,
reg + (AR5K_SET_SHORT_PREAMBLE << 2));
}
diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c
index 30b50f9..557a04f 100644
--- a/drivers/net/wireless/ath/ath5k/qcu.c
+++ b/drivers/net/wireless/ath/ath5k/qcu.c
@@ -602,7 +602,8 @@ int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time)
else
rate = &ah->sbands[IEEE80211_BAND_2GHZ].bitrates[0];

- ack_tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, false);
+ ack_tx_time = ath5k_hw_get_frame_duration(ah,
+ &ah->sbands[channel->band], 10, rate, false);

/* ack_tx_time includes an SIFS already */
eifs = ack_tx_time + sifs + 2 * slot_time;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 9a012be..12116d3 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2842,6 +2842,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
*/
__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
+ struct ieee80211_supported_band *sband,
size_t frame_len,
struct ieee80211_rate *rate);

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 822dafd..0b5fa05 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1383,7 +1383,7 @@ static inline int __ieee80211_resume(struct ieee80211_hw *hw)
extern void *mac80211_wiphy_privid; /* for wiphy privid */
u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
enum nl80211_iftype type);
-int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
+int ieee80211_frame_duration(struct ieee80211_supported_band *sband, size_t len,
int rate, int erp, int short_preamble);
void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
struct ieee80211_hdr *hdr, const u8 *tsc,
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index b39dda5..a146ef7 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -334,14 +334,15 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,


static void
-calc_rate_durations(struct ieee80211_local *local, struct minstrel_rate *d,
+calc_rate_durations(struct ieee80211_supported_band *sband,
+ struct minstrel_rate *d,
struct ieee80211_rate *rate)
{
int erp = !!(rate->flags & IEEE80211_RATE_ERP_G);

- d->perfect_tx_time = ieee80211_frame_duration(local, 1200,
+ d->perfect_tx_time = ieee80211_frame_duration(sband, 1200,
rate->bitrate, erp, 1);
- d->ack_time = ieee80211_frame_duration(local, 10,
+ d->ack_time = ieee80211_frame_duration(sband, 10,
rate->bitrate, erp, 1);
}

@@ -386,7 +387,7 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,

mi->lowest_rix = rate_lowest_index(sband, sta);
ctl_rate = &sband->bitrates[mi->lowest_rix];
- mi->sp_ack_dur = ieee80211_frame_duration(local, 10, ctl_rate->bitrate,
+ mi->sp_ack_dur = ieee80211_frame_duration(sband, 10, ctl_rate->bitrate,
!!(ctl_rate->flags & IEEE80211_RATE_ERP_G), 1);

for (i = 0; i < sband->n_bitrates; i++) {
@@ -402,7 +403,7 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,

mr->rix = i;
mr->bitrate = sband->bitrates[i].bitrate / 5;
- calc_rate_durations(local, mr, &sband->bitrates[i]);
+ calc_rate_durations(sband, mr, &sband->bitrates[i]);

/* calculate maximum number of retransmissions before
* fallback (based on maximum segment size) */
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 16e0b27..c222ff4 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -712,8 +712,8 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
memset(mi, 0, sizeof(*mi));
mi->stats_update = jiffies;

- ack_dur = ieee80211_frame_duration(local, 10, 60, 1, 1);
- mi->overhead = ieee80211_frame_duration(local, 0, 60, 1, 1) + ack_dur;
+ ack_dur = ieee80211_frame_duration(sband, 10, 60, 1, 1);
+ mi->overhead = ieee80211_frame_duration(sband, 0, 60, 1, 1) + ack_dur;
mi->overhead_rtscts = mi->overhead + 2 * ack_dur;

mi->avg_ampdu_len = MINSTREL_FRAC(1, 1);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 782a601..bedffc6 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -159,7 +159,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
/* Time needed to transmit ACK
* (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up
* to closest integer */
- dur = ieee80211_frame_duration(local, 10, rate, erp,
+ dur = ieee80211_frame_duration(sband, 10, rate, erp,
tx->sdata->vif.bss_conf.use_short_preamble);

if (next_frag_len) {
@@ -167,7 +167,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
* transmit next fragment plus ACK and 2 x SIFS. */
dur *= 2; /* ACK + SIFS */
/* next fragment */
- dur += ieee80211_frame_duration(local, next_frag_len,
+ dur += ieee80211_frame_duration(sband, next_frag_len,
txrate->bitrate, erp,
tx->sdata->vif.bss_conf.use_short_preamble);
}
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 928721d..6e0af19 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -106,7 +106,7 @@ void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx)
}
}

-int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
+int ieee80211_frame_duration(struct ieee80211_supported_band *sband, size_t len,
int rate, int erp, int short_preamble)
{
int dur;
@@ -120,7 +120,7 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
* DIV_ROUND_UP() operations.
*/

- if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ || erp) {
+ if (sband->band == IEEE80211_BAND_5GHZ || erp) {
/*
* OFDM:
*
@@ -162,10 +162,10 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
/* Exported duration function for driver use */
__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
+ struct ieee80211_supported_band *sband,
size_t frame_len,
struct ieee80211_rate *rate)
{
- struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_sub_if_data *sdata;
u16 dur;
int erp;
@@ -179,7 +179,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
erp = rate->flags & IEEE80211_RATE_ERP_G;
}

- dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, erp,
+ dur = ieee80211_frame_duration(sband, frame_len, rate->bitrate, erp,
short_preamble);

return cpu_to_le16(dur);
@@ -198,7 +198,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
u16 dur;
struct ieee80211_supported_band *sband;

- sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
+ sband = local->hw.wiphy->bands[frame_txctl->band];

short_preamble = false;

@@ -213,13 +213,13 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
}

/* CTS duration */
- dur = ieee80211_frame_duration(local, 10, rate->bitrate,
+ dur = ieee80211_frame_duration(sband, 10, rate->bitrate,
erp, short_preamble);
/* Data frame duration */
- dur += ieee80211_frame_duration(local, frame_len, rate->bitrate,
+ dur += ieee80211_frame_duration(sband, frame_len, rate->bitrate,
erp, short_preamble);
/* ACK duration */
- dur += ieee80211_frame_duration(local, 10, rate->bitrate,
+ dur += ieee80211_frame_duration(sband, 10, rate->bitrate,
erp, short_preamble);

return cpu_to_le16(dur);
@@ -239,7 +239,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
u16 dur;
struct ieee80211_supported_band *sband;

- sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
+ sband = local->hw.wiphy->bands[frame_txctl->band];

short_preamble = false;

@@ -253,11 +253,11 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
}

/* Data frame duration */
- dur = ieee80211_frame_duration(local, frame_len, rate->bitrate,
+ dur = ieee80211_frame_duration(sband, frame_len, rate->bitrate,
erp, short_preamble);
if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) {
/* ACK duration */
- dur += ieee80211_frame_duration(local, 10, rate->bitrate,
+ dur += ieee80211_frame_duration(sband, 10, rate->bitrate,
erp, short_preamble);
}

--
1.7.0.4


2012-03-27 16:50:29

by Arend van Spriel

[permalink] [raw]
Subject: Re: brcmsmac not working well

On 03/27/2012 04:53 PM, Naveen Goswamy wrote:
> I have the BCM4313 [14e4:4727] (rev 01)
>
> When using wireshark, I see that I am getting many {TCP
Retransmission,TCP Dup
> ACK,TCP RST} with {TCP, HTTP, SSH} when using brcmsmac driver in the
3.2.1
> kernel. I've tried 3.3-rc5 kernel with similar results.
>
> I notice a lot of these popping up in /var/log/messages as well:
>
> ieee80211 phy0: wl0: brcms_c_d11hdrs_mac80211: txop exceeded phylen
155/256 dur
> 1746/1504
> ieee80211 phy0: wl0: brcms_c_d11hdrs_mac80211: txop exceeded phylen
130/256 dur
> 1546/1504
> ieee80211 phy0: wl0: brcms_c_d11hdrs_mac80211: txop exceeded phylen
130/256 dur
> 1546/1504
>
>
> any ideas how to solve this?
Starting a new thread (I hope)

These messages are only indicating (possible) violation of the WMM txop
parameter. So what problem are you looking into here beside the issues
you observe in wireshark. I mean the problem that made you decide to run
wireshark.

Gr. AvS


2012-03-28 07:05:16

by Michal Kazior

[permalink] [raw]
Subject: Re: [PATCH 2/3] mac80211: prepare ieee80211_sta_get_rates to per-vif

Johannes Berg wrote:
> On Tue, 2012-03-27 at 15:55 +0200, Michal Kazior wrote:
>
>> -u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
>> +u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
>> struct ieee802_11_elems *elems,
>> enum ieee80211_band band)
>> {
>> + struct ieee80211_local *local = sdata->local;
>> struct ieee80211_supported_band *sband;
>> struct ieee80211_rate *bitrates;
>> size_t num_rates;
>
> Ditto here, though I actually got confused even further ... we shouldn't
> remove the local/sdata arguments, we should only remove the use of
> local->hw.conf.channel! IOW simply something like this:
>
> - if (!sband) {
> - WARN_ON(1);
> - sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
> - }
> + if (WARN_ON(!sband))
> + return 1;
>
> should be sufficient instead of doing all the prototype changes?

You're right. I'll resend a new patchset.


-- Pozdrawiam / Best regards, Michal Kazior.

2012-03-27 13:56:23

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 2/3] mac80211: prepare ieee80211_sta_get_rates to per-vif

In preparation for multi-channel operation.

Signed-off-by: Michal Kazior <[email protected]>
---
net/mac80211/ibss.c | 4 ++--
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/mesh.c | 2 +-
net/mac80211/mesh_plink.c | 2 +-
net/mac80211/util.c | 3 ++-
5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 50ba1fa..8bea83b 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -409,7 +409,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
sta = sta_info_get(sdata, mgmt->sa);

if (elems->supp_rates) {
- supp_rates = ieee80211_sta_get_rates(local, elems,
+ supp_rates = ieee80211_sta_get_rates(sdata, elems,
band);
if (sta) {
u32 prev_rates;
@@ -560,7 +560,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
sdata->name, mgmt->bssid);
#endif
ieee80211_sta_join_ibss(sdata, bss);
- supp_rates = ieee80211_sta_get_rates(local, elems, band);
+ supp_rates = ieee80211_sta_get_rates(sdata, elems, band);
ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
supp_rates, true);
rcu_read_unlock();
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index de9346e..822dafd 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1458,7 +1458,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
const size_t supp_rates_len,
const u8 *supp_rates);
-u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
+u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
struct ieee802_11_elems *elems,
enum ieee80211_band band);
int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index e5fbb7c..0e6106e 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -651,7 +651,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,

if (elems.mesh_id && elems.mesh_config &&
mesh_matches_local(&elems, sdata)) {
- supp_rates = ieee80211_sta_get_rates(local, &elems, band);
+ supp_rates = ieee80211_sta_get_rates(sdata, &elems, band);
mesh_neighbour_update(mgmt->sa, supp_rates, sdata, &elems);
}
}
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 4e53c4c..aee6014 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -592,7 +592,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
return;
}

- rates = ieee80211_sta_get_rates(local, &elems, rx_status->band);
+ rates = ieee80211_sta_get_rates(sdata, &elems, rx_status->band);
sta = mesh_plink_alloc(sdata, mgmt->sa, rates, &elems);
if (!sta) {
mpl_dbg("Mesh plink error: plink table full\n");
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 959b2c4..928721d 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1105,10 +1105,11 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
}
}

-u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
+u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
struct ieee802_11_elems *elems,
enum ieee80211_band band)
{
+ struct ieee80211_local *local = sdata->local;
struct ieee80211_supported_band *sband;
struct ieee80211_rate *bitrates;
size_t num_rates;
--
1.7.0.4


2012-03-27 15:07:03

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/3] mac80211: prepare ieee80211_sta_get_rates to per-vif

On Tue, 2012-03-27 at 15:55 +0200, Michal Kazior wrote:

> -u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
> +u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
> struct ieee802_11_elems *elems,
> enum ieee80211_band band)
> {
> + struct ieee80211_local *local = sdata->local;
> struct ieee80211_supported_band *sband;
> struct ieee80211_rate *bitrates;
> size_t num_rates;

Ditto here, though I actually got confused even further ... we shouldn't
remove the local/sdata arguments, we should only remove the use of
local->hw.conf.channel! IOW simply something like this:

- if (!sband) {
- WARN_ON(1);
- sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
- }
+ if (WARN_ON(!sband))
+ return 1;

should be sufficient instead of doing all the prototype changes?

johannes


2012-03-27 13:56:23

by Michal Kazior

[permalink] [raw]
Subject: [PATCH 1/3] mac80211: prepare ieee80211_mandatory_rates to per-vif

In preparation for multi-channel operation.

Signed-off-by: Michal Kazior <[email protected]>
---
net/mac80211/ibss.c | 6 +++---
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/iface.c | 2 +-
net/mac80211/util.c | 3 ++-
4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 33fd8d9..50ba1fa 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -332,7 +332,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,

/* make sure mandatory rates are always added */
sta->sta.supp_rates[band] = supp_rates |
- ieee80211_mandatory_rates(local, band);
+ ieee80211_mandatory_rates(sdata, band);

return ieee80211_ibss_finish_sta(sta, auth);
}
@@ -417,7 +417,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
prev_rates = sta->sta.supp_rates[band];
/* make sure mandatory rates are always added */
sta->sta.supp_rates[band] = supp_rates |
- ieee80211_mandatory_rates(local, band);
+ ieee80211_mandatory_rates(sdata, band);

if (sta->sta.supp_rates[band] != prev_rates) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG
@@ -604,7 +604,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,

/* make sure mandatory rates are always added */
sta->sta.supp_rates[band] = supp_rates |
- ieee80211_mandatory_rates(local, band);
+ ieee80211_mandatory_rates(sdata, band);

spin_lock(&ifibss->incomplete_lock);
list_add(&sta->list, &ifibss->incomplete_stations);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index d9798a3..de9346e 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1406,7 +1406,7 @@ void ieee802_11_parse_elems(u8 *start, size_t len,
u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
struct ieee802_11_elems *elems,
u64 filter, u32 crc);
-u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
+u32 ieee80211_mandatory_rates(struct ieee80211_sub_if_data *sdata,
enum ieee80211_band band);

void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 401c01f..c7c60ce 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1005,7 +1005,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,

/* reset some values that shouldn't be kept across type changes */
sdata->vif.bss_conf.basic_rates =
- ieee80211_mandatory_rates(sdata->local,
+ ieee80211_mandatory_rates(sdata,
sdata->local->hw.conf.channel->band);
sdata->drop_unencrypted = 0;
if (type == NL80211_IFTYPE_STATION)
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 32f7a3b..959b2c4 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -868,9 +868,10 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
ieee80211_set_wmm_default(sdata, true);
}

-u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
+u32 ieee80211_mandatory_rates(struct ieee80211_sub_if_data *sdata,
enum ieee80211_band band)
{
+ struct ieee80211_local *local = sdata->local;
struct ieee80211_supported_band *sband;
struct ieee80211_rate *bitrates;
u32 mandatory_rates;
--
1.7.0.4