aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/wext-compat.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-01 15:26:59 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:52 -0400
commit9930380f0bd8405fa6a51d644f3de88c30666519 (patch)
tree71cd68830b11b648d6b79f1575dc9960631a2ab2 /net/wireless/wext-compat.c
parentab737a4f7dbe57b12b73f482a7b973bf00b41942 (diff)
cfg80211: implement IWRATE
For now, let's implement that using a very hackish way: simply mirror the wext API in the cfg80211 API. This will have to be changed later when we implement proper bitrate API. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/wext-compat.c')
-rw-r--r--net/wireless/wext-compat.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 2f72dae2634f..3a5f999703f1 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -1093,3 +1093,66 @@ int cfg80211_wds_wext_giwap(struct net_device *dev,
1093 return 0; 1093 return 0;
1094} 1094}
1095EXPORT_SYMBOL_GPL(cfg80211_wds_wext_giwap); 1095EXPORT_SYMBOL_GPL(cfg80211_wds_wext_giwap);
1096
1097int cfg80211_wext_siwrate(struct net_device *dev,
1098 struct iw_request_info *info,
1099 struct iw_param *rate, char *extra)
1100{
1101 struct wireless_dev *wdev = dev->ieee80211_ptr;
1102 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
1103 struct cfg80211_bitrate_mask mask;
1104
1105 if (!rdev->ops->set_bitrate_mask)
1106 return -EOPNOTSUPP;
1107
1108 mask.fixed = 0;
1109 mask.maxrate = 0;
1110
1111 if (rate->value < 0) {
1112 /* nothing */
1113 } else if (rate->fixed) {
1114 mask.fixed = rate->value / 1000; /* kbps */
1115 } else {
1116 mask.maxrate = rate->value / 1000; /* kbps */
1117 }
1118
1119 return rdev->ops->set_bitrate_mask(wdev->wiphy, dev, NULL, &mask);
1120}
1121EXPORT_SYMBOL_GPL(cfg80211_wext_siwrate);
1122
1123int cfg80211_wext_giwrate(struct net_device *dev,
1124 struct iw_request_info *info,
1125 struct iw_param *rate, char *extra)
1126{
1127 struct wireless_dev *wdev = dev->ieee80211_ptr;
1128 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
1129 /* we are under RTNL - globally locked - so can use a static struct */
1130 static struct station_info sinfo;
1131 u8 *addr;
1132 int err;
1133
1134 if (wdev->iftype != NL80211_IFTYPE_STATION)
1135 return -EOPNOTSUPP;
1136
1137 if (!rdev->ops->get_station)
1138 return -EOPNOTSUPP;
1139
1140 addr = wdev->wext.connect.bssid;
1141 if (!addr)
1142 return -EOPNOTSUPP;
1143
1144 err = rdev->ops->get_station(&rdev->wiphy, dev, addr, &sinfo);
1145 if (err)
1146 return err;
1147
1148 if (!(sinfo.filled & STATION_INFO_TX_BITRATE))
1149 return -EOPNOTSUPP;
1150
1151 rate->value = 0;
1152
1153 if (!(sinfo.txrate.flags & RATE_INFO_FLAGS_MCS))
1154 rate->value = 100000 * sinfo.txrate.legacy;
1155
1156 return 0;
1157}
1158EXPORT_SYMBOL_GPL(cfg80211_wext_giwrate);