aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcm43xx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/bcm43xx')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c33
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.h24
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_radio.c7
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_xmit.c5
5 files changed, 26 insertions, 45 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index d8f5600578b4..df317c1e12a8 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -1547,7 +1547,7 @@ static void handle_irq_noise(struct bcm43xx_private *bcm)
1547 goto generate_new; 1547 goto generate_new;
1548 1548
1549 /* Get the noise samples. */ 1549 /* Get the noise samples. */
1550 assert(bcm->noisecalc.nr_samples <= 8); 1550 assert(bcm->noisecalc.nr_samples < 8);
1551 i = bcm->noisecalc.nr_samples; 1551 i = bcm->noisecalc.nr_samples;
1552 noise[0] = limit_value(noise[0], 0, ARRAY_SIZE(radio->nrssi_lt) - 1); 1552 noise[0] = limit_value(noise[0], 0, ARRAY_SIZE(radio->nrssi_lt) - 1);
1553 noise[1] = limit_value(noise[1], 0, ARRAY_SIZE(radio->nrssi_lt) - 1); 1553 noise[1] = limit_value(noise[1], 0, ARRAY_SIZE(radio->nrssi_lt) - 1);
@@ -1885,6 +1885,15 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id, struct pt_re
1885 1885
1886 spin_lock(&bcm->irq_lock); 1886 spin_lock(&bcm->irq_lock);
1887 1887
1888 /* Only accept IRQs, if we are initialized properly.
1889 * This avoids an RX race while initializing.
1890 * We should probably not enable IRQs before we are initialized
1891 * completely, but some careful work is needed to fix this. I think it
1892 * is best to stay with this cheap workaround for now... .
1893 */
1894 if (unlikely(bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED))
1895 goto out;
1896
1888 reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); 1897 reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
1889 if (reason == 0xffffffff) { 1898 if (reason == 0xffffffff) {
1890 /* irq not for us (shared irq) */ 1899 /* irq not for us (shared irq) */
@@ -1906,19 +1915,11 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id, struct pt_re
1906 1915
1907 bcm43xx_interrupt_ack(bcm, reason); 1916 bcm43xx_interrupt_ack(bcm, reason);
1908 1917
1909 /* Only accept IRQs, if we are initialized properly. 1918 /* disable all IRQs. They are enabled again in the bottom half. */
1910 * This avoids an RX race while initializing. 1919 bcm->irq_savedstate = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL);
1911 * We should probably not enable IRQs before we are initialized 1920 /* save the reason code and call our bottom half. */
1912 * completely, but some careful work is needed to fix this. I think it 1921 bcm->irq_reason = reason;
1913 * is best to stay with this cheap workaround for now... . 1922 tasklet_schedule(&bcm->isr_tasklet);
1914 */
1915 if (likely(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED)) {
1916 /* disable all IRQs. They are enabled again in the bottom half. */
1917 bcm->irq_savedstate = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL);
1918 /* save the reason code and call our bottom half. */
1919 bcm->irq_reason = reason;
1920 tasklet_schedule(&bcm->isr_tasklet);
1921 }
1922 1923
1923out: 1924out:
1924 mmiowb(); 1925 mmiowb();
@@ -3698,6 +3699,10 @@ static void bcm43xx_ieee80211_set_security(struct net_device *net_dev,
3698 secinfo->encrypt = sec->encrypt; 3699 secinfo->encrypt = sec->encrypt;
3699 dprintk(", .encrypt = %d", sec->encrypt); 3700 dprintk(", .encrypt = %d", sec->encrypt);
3700 } 3701 }
3702 if (sec->flags & SEC_AUTH_MODE) {
3703 secinfo->auth_mode = sec->auth_mode;
3704 dprintk(", .auth_mode = %d", sec->auth_mode);
3705 }
3701 dprintk("\n"); 3706 dprintk("\n");
3702 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED && 3707 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED &&
3703 !bcm->ieee->host_encrypt) { 3708 !bcm->ieee->host_encrypt) {
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.h b/drivers/net/wireless/bcm43xx/bcm43xx_main.h
index 30a202b258b5..116493671f88 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.h
@@ -112,30 +112,6 @@ int bcm43xx_channel_to_freq(struct bcm43xx_private *bcm,
112 return bcm43xx_channel_to_freq_bg(channel); 112 return bcm43xx_channel_to_freq_bg(channel);
113} 113}
114 114
115/* Lightweight function to check if a channel number is valid.
116 * Note that this does _NOT_ check for geographical restrictions!
117 */
118static inline
119int bcm43xx_is_valid_channel_a(u8 channel)
120{
121 return (channel >= IEEE80211_52GHZ_MIN_CHANNEL
122 && channel <= IEEE80211_52GHZ_MAX_CHANNEL);
123}
124static inline
125int bcm43xx_is_valid_channel_bg(u8 channel)
126{
127 return (channel >= IEEE80211_24GHZ_MIN_CHANNEL
128 && channel <= IEEE80211_24GHZ_MAX_CHANNEL);
129}
130static inline
131int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm,
132 u8 channel)
133{
134 if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A)
135 return bcm43xx_is_valid_channel_a(channel);
136 return bcm43xx_is_valid_channel_bg(channel);
137}
138
139void bcm43xx_tsf_read(struct bcm43xx_private *bcm, u64 *tsf); 115void bcm43xx_tsf_read(struct bcm43xx_private *bcm, u64 *tsf);
140void bcm43xx_tsf_write(struct bcm43xx_private *bcm, u64 tsf); 116void bcm43xx_tsf_write(struct bcm43xx_private *bcm, u64 tsf);
141 117
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
index af5c0bff1696..bb9c484d7e19 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
@@ -1594,11 +1594,11 @@ int bcm43xx_radio_selectchannel(struct bcm43xx_private *bcm,
1594 u16 r8, tmp; 1594 u16 r8, tmp;
1595 u16 freq; 1595 u16 freq;
1596 1596
1597 if (!ieee80211_is_valid_channel(bcm->ieee, channel))
1598 return -EINVAL;
1597 if ((radio->manufact == 0x17F) && 1599 if ((radio->manufact == 0x17F) &&
1598 (radio->version == 0x2060) && 1600 (radio->version == 0x2060) &&
1599 (radio->revision == 1)) { 1601 (radio->revision == 1)) {
1600 if (channel > 200)
1601 return -EINVAL;
1602 freq = channel2freq_a(channel); 1602 freq = channel2freq_a(channel);
1603 1603
1604 r8 = bcm43xx_radio_read16(bcm, 0x0008); 1604 r8 = bcm43xx_radio_read16(bcm, 0x0008);
@@ -1651,9 +1651,6 @@ int bcm43xx_radio_selectchannel(struct bcm43xx_private *bcm,
1651 TODO(); //TODO: TSSI2dbm workaround 1651 TODO(); //TODO: TSSI2dbm workaround
1652 bcm43xx_phy_xmitpower(bcm);//FIXME correct? 1652 bcm43xx_phy_xmitpower(bcm);//FIXME correct?
1653 } else { 1653 } else {
1654 if ((channel < 1) || (channel > 14))
1655 return -EINVAL;
1656
1657 if (synthetic_pu_workaround) 1654 if (synthetic_pu_workaround)
1658 bcm43xx_synth_pu_workaround(bcm, channel); 1655 bcm43xx_synth_pu_workaround(bcm, channel);
1659 1656
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index c35cb3a0777e..5c36e29efff7 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -119,7 +119,7 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev,
119 channel = bcm43xx_freq_to_channel(bcm, data->freq.m); 119 channel = bcm43xx_freq_to_channel(bcm, data->freq.m);
120 freq = data->freq.m; 120 freq = data->freq.m;
121 } 121 }
122 if (!bcm43xx_is_valid_channel(bcm, channel)) 122 if (!ieee80211_is_valid_channel(bcm->ieee, channel))
123 goto out_unlock; 123 goto out_unlock;
124 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { 124 if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) {
125 //ieee80211softmac_disassoc(softmac, $REASON); 125 //ieee80211softmac_disassoc(softmac, $REASON);
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c
index d8ece28c079f..6dbd855b3647 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c
@@ -296,11 +296,14 @@ void bcm43xx_generate_txhdr(struct bcm43xx_private *bcm,
296 u16 control = 0; 296 u16 control = 0;
297 u16 wsec_rate = 0; 297 u16 wsec_rate = 0;
298 u16 encrypt_frame; 298 u16 encrypt_frame;
299 const u16 ftype = WLAN_FC_GET_TYPE(le16_to_cpu(wireless_header->frame_ctl));
300 const int is_mgt = (ftype == IEEE80211_FTYPE_MGMT);
299 301
300 /* Now construct the TX header. */ 302 /* Now construct the TX header. */
301 memset(txhdr, 0, sizeof(*txhdr)); 303 memset(txhdr, 0, sizeof(*txhdr));
302 304
303 bitrate = bcm->softmac->txrates.default_rate; 305 bitrate = ieee80211softmac_suggest_txrate(bcm->softmac,
306 is_multicast_ether_addr(wireless_header->addr1), is_mgt);
304 ofdm_modulation = !(ieee80211_is_cck_rate(bitrate)); 307 ofdm_modulation = !(ieee80211_is_cck_rate(bitrate));
305 fallback_bitrate = bcm43xx_calc_fallback_rate(bitrate); 308 fallback_bitrate = bcm43xx_calc_fallback_rate(bitrate);
306 fallback_ofdm_modulation = !(ieee80211_is_cck_rate(fallback_bitrate)); 309 fallback_ofdm_modulation = !(ieee80211_is_cck_rate(fallback_bitrate));