[drivers rtl8180] Use CTS protection when necessary
authorJoshua Oreman <oremanj@xenon.get-linux.org>
Sat, 13 Jun 2009 02:02:48 +0000 (19:02 -0700)
committerJoshua Oreman <oremanj@xenon.get-linux.org>
Sat, 13 Jun 2009 02:02:48 +0000 (19:02 -0700)
src/drivers/net/rtl818x/rtl8180.c
src/drivers/net/rtl818x/rtl8180.h

index e09002a..5cdfbd5 100644 (file)
@@ -184,6 +184,11 @@ static int rtl8180_tx(struct net80211_device *dev, struct io_buffer *iob)
                        plcp_len |= 1 << 15;
        }
 
+       if (dev->phy_flags & NET80211_PHY_USE_PROTECTION) {
+               tx_flags |= RTL818X_TX_DESC_FLAG_CTS;
+               tx_flags |= priv->hw_rtscts_rate << 19;
+       }
+
        entry = &priv->tx_ring[priv->tx_prod];
 
        if (entry->flags & RTL818X_TX_DESC_FLAG_OWN) {
@@ -559,13 +564,25 @@ static int rtl8180_config(struct net80211_device *dev, int changed)
                   logical rate */
                int hw_rate;
                for (hw_rate = 0; hw_rate < RTL818X_NR_RATES &&
-                            rtl818x_rates[hw_rate] != dev->rates[dev->rate];
+                            rtl818x_rates[hw_rate] !=
+                            NET80211_RATE_VALUE ( dev->rates[dev->rate] );
                     hw_rate++)
                        ;
                if (hw_rate >= RTL818X_NR_RATES)
                        return -EINVAL;
 
                priv->hw_rate = hw_rate;
+
+               /* and the RTS/CTS rate */
+               for (hw_rate = 0; hw_rate < RTL818X_NR_RATES &&
+                            rtl818x_rates[hw_rate] !=
+                          NET80211_RATE_VALUE ( dev->rates[dev->rtscts_rate] );
+                    hw_rate++)
+                       ;
+               if (hw_rate >= RTL818X_NR_RATES)
+                       hw_rate = priv->hw_rate;
+
+               priv->hw_rtscts_rate = hw_rate;
        }
 
        return 0;
index a2e1586..2bdbcfd 100644 (file)
@@ -62,6 +62,7 @@ struct rtl8180_priv {
        const struct rtl818x_rf_ops *rf;
        int rf_flag; /* whatever RF driver wishes to use it for */
        int hw_rate;
+       int hw_rtscts_rate;
 
        struct spi_bit_basher spibit;
        struct spi_device eeprom;