Merge tag 'r8169-20060920-00' of git://electric-eye.fr.zoreil.com/home/romieu/linux...
[pandora-kernel.git] / drivers / net / wireless / bcm43xx / bcm43xx_xmit.c
index 5ee572e..c0efbfe 100644 (file)
@@ -215,7 +215,7 @@ static void bcm43xx_generate_rts(const struct bcm43xx_phyinfo *phy,
        u8 fallback_bitrate;
        int ofdm_modulation;
        int fallback_ofdm_modulation;
-       u8 *sa, *da;
+//     u8 *sa, *da;
        u16 flen;
 
 //FIXME        sa = ieee80211_get_SA((struct ieee80211_hdr *)wlhdr);
@@ -267,7 +267,7 @@ assert(dur);
 //printk(BCM43xx_MACFMT "  " BCM43xx_MACFMT "  " BCM43xx_MACFMT "\n", BCM43xx_MACARG(wlhdr->addr1), BCM43xx_MACARG(wlhdr->addr2), BCM43xx_MACARG(wlhdr->addr3));
 //printk(BCM43xx_MACFMT "  " BCM43xx_MACFMT "\n", BCM43xx_MACARG(sa), BCM43xx_MACARG(da));
        memcpy(txhdr->rts_cts_mac1, wlhdr->addr1, ETH_ALEN);//FIXME!
-       memcpy(txhdr->rts_cts_mac2, sa, ETH_ALEN);
+//     memcpy(txhdr->rts_cts_mac2, sa, ETH_ALEN);
 
        *flags |= BCM43xx_TXHDRFLAG_RTSCTS;
        *flags |= BCM43xx_TXHDRFLAG_RTS;
@@ -284,7 +284,7 @@ void bcm43xx_generate_txhdr(struct bcm43xx_private *bcm,
                            const int is_first_fragment,
                            const u16 cookie)
 {
-       const struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
+       const struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
        const struct ieee80211_hdr_4addr *wireless_header = (const struct ieee80211_hdr_4addr *)fragment_data;
        const struct ieee80211_security *secinfo = &bcm->ieee->sec;
        u8 bitrate;
@@ -296,11 +296,14 @@ void bcm43xx_generate_txhdr(struct bcm43xx_private *bcm,
        u16 control = 0;
        u16 wsec_rate = 0;
        u16 encrypt_frame;
+       const u16 ftype = WLAN_FC_GET_TYPE(le16_to_cpu(wireless_header->frame_ctl));
+       const int is_mgt = (ftype == IEEE80211_FTYPE_MGMT);
 
        /* Now construct the TX header. */
        memset(txhdr, 0, sizeof(*txhdr));
 
-       bitrate = bcm->softmac->txrates.default_rate;
+       bitrate = ieee80211softmac_suggest_txrate(bcm->softmac,
+               is_multicast_ether_addr(wireless_header->addr1), is_mgt);
        ofdm_modulation = !(ieee80211_is_cck_rate(bitrate));
        fallback_bitrate = bcm43xx_calc_fallback_rate(bitrate);
        fallback_ofdm_modulation = !(ieee80211_is_cck_rate(fallback_bitrate));
@@ -382,8 +385,8 @@ static s8 bcm43xx_rssi_postprocess(struct bcm43xx_private *bcm,
                                   u8 in_rssi, int ofdm,
                                   int adjust_2053, int adjust_2050)
 {
-       struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
-       struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
+       struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
+       struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
        s32 tmp;
 
        switch (radio->version) {
@@ -439,10 +442,12 @@ static s8 bcm43xx_rssi_postprocess(struct bcm43xx_private *bcm,
        return (s8)tmp;
 }
 
+//TODO
+#if 0
 static s8 bcm43xx_rssinoise_postprocess(struct bcm43xx_private *bcm,
                                        u8 in_rssi)
 {
-       struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
+       struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
        s8 ret;
 
        if (phy->type == BCM43xx_PHYTYPE_A) {
@@ -453,11 +458,14 @@ static s8 bcm43xx_rssinoise_postprocess(struct bcm43xx_private *bcm,
 
        return ret;
 }
+#endif
 
 int bcm43xx_rx(struct bcm43xx_private *bcm,
               struct sk_buff *skb,
               struct bcm43xx_rxhdr *rxhdr)
 {
+       struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
+       struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
        struct bcm43xx_plcp_hdr4 *plcp;
        struct ieee80211_rx_stats stats;
        struct ieee80211_hdr_4addr *wlhdr;
@@ -484,23 +492,22 @@ int bcm43xx_rx(struct bcm43xx_private *bcm,
 
        memset(&stats, 0, sizeof(stats));
        stats.mac_time = le16_to_cpu(rxhdr->mactime);
-       stats.rssi = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm,
+       stats.rssi = rxhdr->rssi;
+       stats.signal = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm,
                                              !!(rxflags1 & BCM43xx_RXHDR_FLAGS1_2053RSSIADJ),
                                              !!(rxflags3 & BCM43xx_RXHDR_FLAGS3_2050RSSIADJ));
-       stats.signal = rxhdr->signal_quality;   //FIXME
 //TODO stats.noise = 
        if (is_ofdm)
                stats.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp);
        else
                stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp);
-//printk("RX ofdm %d, rate == %u\n", is_ofdm, stats.rate);
-       stats.received_channel = bcm->current_core->radio->channel;
+       stats.received_channel = radio->channel;
 //TODO stats.control = 
        stats.mask = IEEE80211_STATMASK_SIGNAL |
 //TODO              IEEE80211_STATMASK_NOISE |
                     IEEE80211_STATMASK_RATE |
                     IEEE80211_STATMASK_RSSI;
-       if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A)
+       if (phy->type == BCM43xx_PHYTYPE_A)
                stats.freq = IEEE80211_52GHZ_BAND;
        else
                stats.freq = IEEE80211_24GHZ_BAND;
@@ -575,5 +582,3 @@ int bcm43xx_rx(struct bcm43xx_private *bcm,
 
        return err;
 }
-
-/* vim: set ts=8 sw=8 sts=8: */