mac80211: dont use interface indices in drivers
[deliverable/linux.git] / drivers / net / wireless / b43 / xmit.c
index 557abe1f1a05af47668ac4276201520e1dcf36b4..5014213b77523431da6c3f48a75708363e5a8cca 100644 (file)
@@ -30,7 +30,7 @@
 #include "xmit.h"
 #include "phy.h"
 #include "dma.h"
-#include "pio.h"
+
 
 /* Extract the bitrate out of a CCK PLCP header. */
 static u8 b43_plcp_get_bitrate_cck(struct b43_plcp_hdr6 *plcp)
@@ -221,7 +221,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev,
        } else {
                int fbrate_base100kbps = B43_RATE_TO_BASE100KBPS(rate_fb);
                txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw,
-                                                                dev->wl->if_id,
+                                                                txctl->vif,
                                                                 fragment_len,
                                                                 fbrate_base100kbps);
        }
@@ -270,14 +270,15 @@ static void generate_txhdr_fw4(struct b43_wldev *dev,
                phy_ctl |= B43_TX4_PHY_OFDM;
        if (dev->short_preamble)
                phy_ctl |= B43_TX4_PHY_SHORTPRMBL;
-       switch (txctl->antenna_sel_tx) {
-       case 0:
+
+       switch (b43_ieee80211_antenna_sanitize(dev, txctl->antenna_sel_tx)) {
+       case 0: /* Default */
                phy_ctl |= B43_TX4_PHY_ANTLAST;
                break;
-       case 1:
+       case 1: /* Antenna 0 */
                phy_ctl |= B43_TX4_PHY_ANT0;
                break;
-       case 2:
+       case 2: /* Antenna 1 */
                phy_ctl |= B43_TX4_PHY_ANT1;
                break;
        default:
@@ -311,7 +312,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev,
                rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb);
 
                if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) {
-                       ieee80211_ctstoself_get(dev->wl->hw, dev->wl->if_id,
+                       ieee80211_ctstoself_get(dev->wl->hw, txctl->vif,
                                                fragment_data, fragment_len,
                                                txctl,
                                                (struct ieee80211_cts *)(txhdr->
@@ -319,7 +320,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev,
                        mac_ctl |= B43_TX4_MAC_SENDCTS;
                        len = sizeof(struct ieee80211_cts);
                } else {
-                       ieee80211_rts_get(dev->wl->hw, dev->wl->if_id,
+                       ieee80211_rts_get(dev->wl->hw, txctl->vif,
                                          fragment_data, fragment_len, txctl,
                                          (struct ieee80211_rts *)(txhdr->
                                                                   rts_frame));
@@ -489,7 +490,6 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
        }
        wlhdr = (struct ieee80211_hdr *)(skb->data);
        fctl = le16_to_cpu(wlhdr->frame_control);
-       skb_trim(skb, skb->len - FCS_LEN);
 
        if (macstat & B43_RX_MAC_DEC) {
                unsigned int keyidx;
@@ -526,8 +526,24 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
        else
                status.rate = b43_plcp_get_bitrate_cck(plcp);
        status.antenna = !!(phystat0 & B43_RX_PHYST0_ANT);
-       status.mactime = mactime;
-       status.flag |= RX_FLAG_TSFT;
+
+       /*
+        * If monitors are present get full 64-bit timestamp. This
+        * code assumes we get to process the packet within 16 bits
+        * of timestamp, i.e. about 65 milliseconds after the PHY
+        * received the first symbol.
+        */
+       if (dev->wl->radiotap_enabled) {
+               u16 low_mactime_now;
+
+               b43_tsf_read(dev, &status.mactime);
+               low_mactime_now = status.mactime;
+               status.mactime = status.mactime & ~0xFFFFULL;
+               status.mactime += mactime;
+               if (low_mactime_now <= mactime)
+                       status.mactime -= 0x10000;
+               status.flag |= RX_FLAG_TSFT;
+       }
 
        chanid = (chanstat & B43_RX_CHAN_ID) >> B43_RX_CHAN_ID_SHIFT;
        switch (chanstat & B43_RX_CHAN_PHYTYPE) {
@@ -588,10 +604,7 @@ void b43_handle_txstatus(struct b43_wldev *dev,
                        dev->wl->ieee_stats.dot11RTSSuccessCount++;
        }
 
-       if (b43_using_pio(dev))
-               b43_pio_handle_txstatus(dev, status);
-       else
-               b43_dma_handle_txstatus(dev, status);
+       b43_dma_handle_txstatus(dev, status);
 }
 
 /* Handle TX status report as received through DMA/PIO queues */
@@ -620,19 +633,13 @@ void b43_handle_hwtxstatus(struct b43_wldev *dev,
 /* Stop any TX operation on the device (suspend the hardware queues) */
 void b43_tx_suspend(struct b43_wldev *dev)
 {
-       if (b43_using_pio(dev))
-               b43_pio_freeze_txqueues(dev);
-       else
-               b43_dma_tx_suspend(dev);
+       b43_dma_tx_suspend(dev);
 }
 
 /* Resume any TX operation on the device (resume the hardware queues) */
 void b43_tx_resume(struct b43_wldev *dev)
 {
-       if (b43_using_pio(dev))
-               b43_pio_thaw_txqueues(dev);
-       else
-               b43_dma_tx_resume(dev);
+       b43_dma_tx_resume(dev);
 }
 
 #if 0
This page took 0.031798 seconds and 5 git commands to generate.