rt2x00: Remove ieee80211_rx_status from rt2x00_dev
authorIvo van Doorn <ivdoorn@gmail.com>
Fri, 6 Aug 2010 18:49:27 +0000 (20:49 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 16 Aug 2010 19:26:43 +0000 (15:26 -0400)
rt2x00 was keeping a copy of ieee80211_rx_status embedded
into the rt2x00_dev structure. For each RX frame, this structure
was copied into the skb->cb where mac80211 would handle it further.

However at the moment only the fields current band, and frequency
were updated. Whereas the band was already provided directly within
the rt2x00_dev structure. Save a memcpy action, and reduce memory
a bit, by adding a curr_freq field to rt2x00_dev, and completely
remove the ieee80211_rx_status structure from rt2x00_dev.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00config.c
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 827a258..3a150d3 100644 (file)
@@ -494,7 +494,7 @@ static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxwi_w2)
        u8 offset1;
        u8 offset2;
 
-       if (rt2x00dev->rx_status.band == IEEE80211_BAND_2GHZ) {
+       if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
                rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &eeprom);
                offset0 = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG_OFFSET0);
                offset1 = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG_OFFSET1);
index edfc2b7..8c65244 100644 (file)
@@ -699,6 +699,7 @@ struct rt2x00_dev {
        struct ieee80211_hw *hw;
        struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
        enum ieee80211_band curr_band;
+       int curr_freq;
 
        /*
         * If enabled, the debugfs interface structures
@@ -851,11 +852,6 @@ struct rt2x00_dev {
        struct ieee80211_low_level_stats low_level_stats;
 
        /*
-        * RX configuration information.
-        */
-       struct ieee80211_rx_status rx_status;
-
-       /*
         * Scheduled work.
         * NOTE: intf_work will use ieee80211_iterate_active_interfaces()
         * which means it cannot be placed on the hw->workqueue
index fb23af4..34f34fa 100644 (file)
@@ -201,10 +201,8 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
                rt2x00link_reset_tuner(rt2x00dev, false);
 
        rt2x00dev->curr_band = conf->channel->band;
+       rt2x00dev->curr_freq = conf->channel->center_freq;
        rt2x00dev->tx_power = conf->power_level;
        rt2x00dev->short_retry = conf->short_frame_max_tx_count;
        rt2x00dev->long_retry = conf->long_frame_max_tx_count;
-
-       rt2x00dev->rx_status.band = conf->channel->band;
-       rt2x00dev->rx_status.freq = conf->channel->center_freq;
 }
index 6499cc4..e692608 100644 (file)
@@ -464,7 +464,7 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev,
 {
        struct rxdone_entry_desc rxdesc;
        struct sk_buff *skb;
-       struct ieee80211_rx_status *rx_status = &rt2x00dev->rx_status;
+       struct ieee80211_rx_status *rx_status;
        unsigned int header_length;
        int rate_idx;
 
@@ -535,19 +535,21 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev,
         */
        rt2x00link_update_stats(rt2x00dev, entry->skb, &rxdesc);
        rt2x00debug_update_crypto(rt2x00dev, &rxdesc);
+       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_RXDONE, entry->skb);
 
+       /*
+        * Initialize RX status information, and send frame
+        * to mac80211.
+        */
+       rx_status = IEEE80211_SKB_RXCB(entry->skb);
        rx_status->mactime = rxdesc.timestamp;
+       rx_status->band = rt2x00dev->curr_band;
+       rx_status->freq = rt2x00dev->curr_freq;
        rx_status->rate_idx = rate_idx;
        rx_status->signal = rxdesc.rssi;
        rx_status->flag = rxdesc.flags;
        rx_status->antenna = rt2x00dev->link.ant.active.rx;
 
-       /*
-        * Send frame to mac80211 & debugfs.
-        * mac80211 will clean up the skb structure.
-        */
-       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_RXDONE, entry->skb);
-       memcpy(IEEE80211_SKB_RXCB(entry->skb), rx_status, sizeof(*rx_status));
        ieee80211_rx_ni(rt2x00dev->hw, entry->skb);
 
        /*
index dc6f3eb..cff503f 100644 (file)
@@ -1050,7 +1050,7 @@ static void rt61pci_link_tuner(struct rt2x00_dev *rt2x00dev,
        /*
         * Determine r17 bounds.
         */
-       if (rt2x00dev->rx_status.band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
                low_bound = 0x28;
                up_bound = 0x48;
                if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) {
@@ -1972,7 +1972,7 @@ static int rt61pci_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxd_w1)
                return 0;
        }
 
-       if (rt2x00dev->rx_status.band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
                if (lna == 3 || lna == 2)
                        offset += 10;
        }
index aa9de18..c655296 100644 (file)
@@ -929,7 +929,7 @@ static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev,
        /*
         * Determine r17 bounds.
         */
-       if (rt2x00dev->rx_status.band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
                low_bound = 0x28;
                up_bound = 0x48;
 
@@ -1597,7 +1597,7 @@ static int rt73usb_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxd_w1)
                return 0;
        }
 
-       if (rt2x00dev->rx_status.band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
                if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) {
                        if (lna == 3 || lna == 2)
                                offset += 10;