Merge branch 'upstream-fixes' into upstream
[powerpc.git] / include / net / ieee80211softmac.h
index b971d8c..703463a 100644 (file)
@@ -86,6 +86,9 @@ struct ieee80211softmac_assoc_info {
        
        /* BSSID we're trying to associate to */
        char bssid[ETH_ALEN];
+
+       /* Rates supported by the network */
+       struct ieee80211softmac_ratesinfo supported_rates;
        
        /* some flags.
         * static_essid is valid if the essid is constant,
@@ -96,10 +99,13 @@ struct ieee80211softmac_assoc_info {
         *
         * bssvalid is true if we found a matching network
         * and saved it's BSSID into the bssid above.
+        *
+        * bssfixed is used for SIOCSIWAP.
         */
        u8 static_essid:1,
           associating:1,
-          bssvalid:1;
+          bssvalid:1,
+          bssfixed:1;
 
        /* Scan retries remaining */
        int scan_retry;
@@ -129,23 +135,26 @@ enum {
 struct ieee80211softmac_txrates {
        /* The Bit-Rate to be used for multicast frames. */
        u8 mcast_rate;
-       /* The Bit-Rate to be used for multicast fallback
-        * (If the device supports fallback and hardware-retry)
-        */
-       u8 mcast_fallback;
+
+       /* The Bit-Rate to be used for multicast management frames. */
+       u8 mgt_mcast_rate;
+
        /* The Bit-Rate to be used for any other (normal) data packet. */
        u8 default_rate;
        /* The Bit-Rate to be used for default fallback
         * (If the device supports fallback and hardware-retry)
         */
        u8 default_fallback;
+
+       /* This is the rate that the user asked for */
+       u8 user_rate;
 };
 
 /* Bits for txrates_change callback. */
 #define IEEE80211SOFTMAC_TXRATECHG_DEFAULT             (1 << 0) /* default_rate */
 #define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK       (1 << 1) /* default_fallback */
 #define IEEE80211SOFTMAC_TXRATECHG_MCAST               (1 << 2) /* mcast_rate */
-#define IEEE80211SOFTMAC_TXRATECHG_MCAST_FBACK         (1 << 3) /* mcast_fallback */
+#define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST           (1 << 3) /* mgt_mcast_rate */
 
 struct ieee80211softmac_device {
        /* 802.11 structure for data stuff */
@@ -201,7 +210,8 @@ struct ieee80211softmac_device {
        
        /* couple of flags */
        u8 scanning:1, /* protects scanning from being done multiple times at once */
-          associated:1;
+          associated:1,
+          running:1;
        
        struct ieee80211softmac_scaninfo *scaninfo;
        struct ieee80211softmac_assoc_info associnfo;
@@ -246,6 +256,28 @@ extern void ieee80211softmac_fragment_lost(struct net_device *dev,
  * Note that the rates need to be sorted. */
 extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates);
 
+/* Helper function which advises you the rate at which a frame should be
+ * transmitted at. */
+static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac,
+                                                int is_multicast,
+                                                int is_mgt)
+{
+       struct ieee80211softmac_txrates *txrates = &mac->txrates;
+
+       if (!mac->associated)
+               return txrates->mgt_mcast_rate;
+
+       /* We are associated, sending unicast frame */
+       if (!is_multicast)
+               return txrates->default_rate;
+
+       /* We are associated, sending multicast frame */
+       if (is_mgt)
+               return txrates->mgt_mcast_rate;
+       else
+               return txrates->mcast_rate;
+}
+
 /* Start the SoftMAC. Call this after you initialized the device
  * and it is ready to run.
  */
@@ -267,8 +299,9 @@ extern void ieee80211softmac_stop(struct net_device *dev);
 #define IEEE80211SOFTMAC_EVENT_AUTH_FAILED             5
 #define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT            6
 #define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7
+#define IEEE80211SOFTMAC_EVENT_DISASSOCIATED           8
 /* keep this updated! */
-#define IEEE80211SOFTMAC_EVENT_LAST                    7
+#define IEEE80211SOFTMAC_EVENT_LAST                    8
 /*
  * If you want to be notified of certain events, you can call
  * ieee80211softmac_notify[_atomic] with