mac80211: standardize adding supported rates IEs
authorArik Nemtsov <arik@wizery.com>
Wed, 28 Sep 2011 11:12:51 +0000 (14:12 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 30 Sep 2011 19:57:06 +0000 (15:57 -0400)
Relocate the mesh implementation of adding the (extended) supported
rates IE to util.c, anticipating its use by other parts of mac80211.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Cc: Kalyan C Gaddam <chakkal@iit.edu>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/mac80211.h
net/mac80211/mesh.c
net/mac80211/mesh.h
net/mac80211/mesh_plink.c
net/mac80211/tx.c
net/mac80211/util.c

index 1e83afae3c64719c02f33dddc102343f34d73d4e..b5f7ada2f87bff460e9fa80c67d5100057b1b133 100644 (file)
@@ -3444,4 +3444,9 @@ void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
                                   int rssi_max_thold);
 
 void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif);
+
+int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb);
+
+int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
+                               struct sk_buff *skb);
 #endif /* MAC80211_H */
index a4225ae69681dbac88d9e664f747526f55c5fb70..a7078fdba8ca7e3cf2a1f047f1f39c57c643f63e 100644 (file)
@@ -320,64 +320,6 @@ mesh_add_rsn_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
        return 0;
 }
 
-int
-mesh_add_srates_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
-{
-       struct ieee80211_local *local = sdata->local;
-       struct ieee80211_supported_band *sband;
-       int rate;
-       u8 i, rates, *pos;
-
-       sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
-       rates = sband->n_bitrates;
-       if (rates > 8)
-               rates = 8;
-
-       if (skb_tailroom(skb) < rates + 2)
-               return -ENOMEM;
-
-       pos = skb_put(skb, rates + 2);
-       *pos++ = WLAN_EID_SUPP_RATES;
-       *pos++ = rates;
-       for (i = 0; i < rates; i++) {
-               rate = sband->bitrates[i].bitrate;
-               *pos++ = (u8) (rate / 5);
-       }
-
-       return 0;
-}
-
-int
-mesh_add_ext_srates_ie(struct sk_buff *skb,
-                      struct ieee80211_sub_if_data *sdata)
-{
-       struct ieee80211_local *local = sdata->local;
-       struct ieee80211_supported_band *sband;
-       int rate;
-       u8 i, exrates, *pos;
-
-       sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
-       exrates = sband->n_bitrates;
-       if (exrates > 8)
-               exrates -= 8;
-       else
-               exrates = 0;
-
-       if (skb_tailroom(skb) < exrates + 2)
-               return -ENOMEM;
-
-       if (exrates) {
-               pos = skb_put(skb, exrates + 2);
-               *pos++ = WLAN_EID_EXT_SUPP_RATES;
-               *pos++ = exrates;
-               for (i = 8; i < sband->n_bitrates; i++) {
-                       rate = sband->bitrates[i].bitrate;
-                       *pos++ = (u8) (rate / 5);
-               }
-       }
-       return 0;
-}
-
 int mesh_add_ds_params_ie(struct sk_buff *skb,
                          struct ieee80211_sub_if_data *sdata)
 {
index 7118e8e8855ce5bbff0b0b98e3a573b3bf3bb3aa..8c00e2d1d63612f3dfd483960805021f79acb204 100644 (file)
@@ -210,10 +210,6 @@ int mesh_add_rsn_ie(struct sk_buff *skb,
                    struct ieee80211_sub_if_data *sdata);
 int mesh_add_vendor_ies(struct sk_buff *skb,
                        struct ieee80211_sub_if_data *sdata);
-int mesh_add_srates_ie(struct sk_buff *skb,
-                      struct ieee80211_sub_if_data *sdata);
-int mesh_add_ext_srates_ie(struct sk_buff *skb,
-                          struct ieee80211_sub_if_data *sdata);
 int mesh_add_ds_params_ie(struct sk_buff *skb,
                          struct ieee80211_sub_if_data *sdata);
 void mesh_rmc_free(struct ieee80211_sub_if_data *sdata);
index 1213a23ff0fa7e28cfb547bbbcb29855891974f2..9cc5029b3c46ae6fc15716cff8766e672b011306 100644 (file)
@@ -185,8 +185,8 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
                        pos = skb_put(skb, 2);
                        memcpy(pos + 2, &plid, 2);
                }
-               if (mesh_add_srates_ie(skb, sdata) ||
-                   mesh_add_ext_srates_ie(skb, sdata) ||
+               if (ieee80211_add_srates_ie(&sdata->vif, skb) ||
+                   ieee80211_add_ext_srates_ie(&sdata->vif, skb) ||
                    mesh_add_rsn_ie(skb, sdata) ||
                    mesh_add_meshid_ie(skb, sdata) ||
                    mesh_add_meshconf_ie(skb, sdata))
index 7cd6c28968b282763fa4739fd13296ed3ad99550..542272acfc1a4677c08cf2a1f9c6e45ceb7ae5ed 100644 (file)
@@ -2307,9 +2307,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
                *pos++ = WLAN_EID_SSID;
                *pos++ = 0x0;
 
-               if (mesh_add_srates_ie(skb, sdata) ||
+               if (ieee80211_add_srates_ie(&sdata->vif, skb) ||
                    mesh_add_ds_params_ie(skb, sdata) ||
-                   mesh_add_ext_srates_ie(skb, sdata) ||
+                   ieee80211_add_ext_srates_ie(&sdata->vif, skb) ||
                    mesh_add_rsn_ie(skb, sdata) ||
                    mesh_add_meshid_ie(skb, sdata) ||
                    mesh_add_meshconf_ie(skb, sdata) ||
index 2c9dc360dc6dc08c166104ba79e950c9b5a4fbe4..9d4f14621bb089d1aecf63fb1aec5f42eec24726 100644 (file)
@@ -1364,3 +1364,60 @@ void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif)
        _ieee80211_enable_rssi_reports(sdata, 0, 0);
 }
 EXPORT_SYMBOL(ieee80211_disable_rssi_reports);
+
+int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb)
+{
+       struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+       struct ieee80211_local *local = sdata->local;
+       struct ieee80211_supported_band *sband;
+       int rate;
+       u8 i, rates, *pos;
+
+       sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
+       rates = sband->n_bitrates;
+       if (rates > 8)
+               rates = 8;
+
+       if (skb_tailroom(skb) < rates + 2)
+               return -ENOMEM;
+
+       pos = skb_put(skb, rates + 2);
+       *pos++ = WLAN_EID_SUPP_RATES;
+       *pos++ = rates;
+       for (i = 0; i < rates; i++) {
+               rate = sband->bitrates[i].bitrate;
+               *pos++ = (u8) (rate / 5);
+       }
+
+       return 0;
+}
+
+int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb)
+{
+       struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+       struct ieee80211_local *local = sdata->local;
+       struct ieee80211_supported_band *sband;
+       int rate;
+       u8 i, exrates, *pos;
+
+       sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
+       exrates = sband->n_bitrates;
+       if (exrates > 8)
+               exrates -= 8;
+       else
+               exrates = 0;
+
+       if (skb_tailroom(skb) < exrates + 2)
+               return -ENOMEM;
+
+       if (exrates) {
+               pos = skb_put(skb, exrates + 2);
+               *pos++ = WLAN_EID_EXT_SUPP_RATES;
+               *pos++ = exrates;
+               for (i = 8; i < sband->n_bitrates; i++) {
+                       rate = sband->bitrates[i].bitrate;
+                       *pos++ = (u8) (rate / 5);
+               }
+       }
+       return 0;
+}