aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rndis_wlan.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2009-06-16 10:17:21 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:52 -0400
commitd75ec2b7ec27fd6cdba78492fbd63bee4d091a87 (patch)
treeae6b40867e49d3c5d01268652e03fabe3fd8b9c2 /drivers/net/wireless/rndis_wlan.c
parent257862f3faef397f1a677ae6a5a1828fa00a97b1 (diff)
rndis_wlan: convert get/set frag/rts to cfg80211
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rndis_wlan.c')
-rw-r--r--drivers/net/wireless/rndis_wlan.c135
1 files changed, 63 insertions, 72 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index e8b0793b030a..edd4aad68be9 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -428,9 +428,12 @@ static int rndis_change_virtual_intf(struct wiphy *wiphy,
428static int rndis_scan(struct wiphy *wiphy, struct net_device *dev, 428static int rndis_scan(struct wiphy *wiphy, struct net_device *dev,
429 struct cfg80211_scan_request *request); 429 struct cfg80211_scan_request *request);
430 430
431static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed);
432
431static struct cfg80211_ops rndis_config_ops = { 433static struct cfg80211_ops rndis_config_ops = {
432 .change_virtual_intf = rndis_change_virtual_intf, 434 .change_virtual_intf = rndis_change_virtual_intf,
433 .scan = rndis_scan, 435 .scan = rndis_scan,
436 .set_wiphy_params = rndis_set_wiphy_params,
434}; 437};
435 438
436static void *rndis_wiphy_privid = &rndis_wiphy_privid; 439static void *rndis_wiphy_privid = &rndis_wiphy_privid;
@@ -969,6 +972,36 @@ static int set_infra_mode(struct usbnet *usbdev, int mode)
969} 972}
970 973
971 974
975static int set_rts_threshold(struct usbnet *usbdev, u32 rts_threshold)
976{
977 __le32 tmp;
978
979 devdbg(usbdev, "set_rts_threshold %i", rts_threshold);
980
981 if (rts_threshold < 0 || rts_threshold > 2347)
982 rts_threshold = 2347;
983
984 tmp = cpu_to_le32(rts_threshold);
985 return rndis_set_oid(usbdev, OID_802_11_RTS_THRESHOLD, &tmp,
986 sizeof(tmp));
987}
988
989
990static int set_frag_threshold(struct usbnet *usbdev, u32 frag_threshold)
991{
992 __le32 tmp;
993
994 devdbg(usbdev, "set_frag_threshold %i", frag_threshold);
995
996 if (frag_threshold < 256 || frag_threshold > 2346)
997 frag_threshold = 2346;
998
999 tmp = cpu_to_le32(frag_threshold);
1000 return rndis_set_oid(usbdev, OID_802_11_FRAGMENTATION_THRESHOLD, &tmp,
1001 sizeof(tmp));
1002}
1003
1004
972static void set_default_iw_params(struct usbnet *usbdev) 1005static void set_default_iw_params(struct usbnet *usbdev)
973{ 1006{
974 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); 1007 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
@@ -1246,6 +1279,28 @@ static int rndis_change_virtual_intf(struct wiphy *wiphy,
1246} 1279}
1247 1280
1248 1281
1282static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed)
1283{
1284 struct rndis_wlan_private *priv = wiphy_priv(wiphy);
1285 struct usbnet *usbdev = priv->usbdev;
1286 int err;
1287
1288 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
1289 err = set_frag_threshold(usbdev, wiphy->frag_threshold);
1290 if (err < 0)
1291 return err;
1292 }
1293
1294 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
1295 err = set_rts_threshold(usbdev, wiphy->rts_threshold);
1296 if (err < 0)
1297 return err;
1298 }
1299
1300 return 0;
1301}
1302
1303
1249#define SCAN_DELAY_JIFFIES (HZ) 1304#define SCAN_DELAY_JIFFIES (HZ)
1250static int rndis_scan(struct wiphy *wiphy, struct net_device *dev, 1305static int rndis_scan(struct wiphy *wiphy, struct net_device *dev,
1251 struct cfg80211_scan_request *request) 1306 struct cfg80211_scan_request *request)
@@ -1761,74 +1816,6 @@ static int rndis_iw_get_genie(struct net_device *dev,
1761} 1816}
1762 1817
1763 1818
1764static int rndis_iw_set_rts(struct net_device *dev,
1765 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1766{
1767 struct usbnet *usbdev = netdev_priv(dev);
1768 __le32 tmp;
1769 devdbg(usbdev, "SIOCSIWRTS");
1770
1771 tmp = cpu_to_le32(wrqu->rts.value);
1772 return rndis_set_oid(usbdev, OID_802_11_RTS_THRESHOLD, &tmp,
1773 sizeof(tmp));
1774}
1775
1776
1777static int rndis_iw_get_rts(struct net_device *dev,
1778 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1779{
1780 struct usbnet *usbdev = netdev_priv(dev);
1781 __le32 tmp;
1782 int len, ret;
1783
1784 len = sizeof(tmp);
1785 ret = rndis_query_oid(usbdev, OID_802_11_RTS_THRESHOLD, &tmp, &len);
1786 if (ret == 0) {
1787 wrqu->rts.value = le32_to_cpu(tmp);
1788 wrqu->rts.flags = 1;
1789 wrqu->rts.disabled = 0;
1790 }
1791
1792 devdbg(usbdev, "SIOCGIWRTS: %d", wrqu->rts.value);
1793
1794 return ret;
1795}
1796
1797
1798static int rndis_iw_set_frag(struct net_device *dev,
1799 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1800{
1801 struct usbnet *usbdev = netdev_priv(dev);
1802 __le32 tmp;
1803
1804 devdbg(usbdev, "SIOCSIWFRAG");
1805
1806 tmp = cpu_to_le32(wrqu->frag.value);
1807 return rndis_set_oid(usbdev, OID_802_11_FRAGMENTATION_THRESHOLD, &tmp,
1808 sizeof(tmp));
1809}
1810
1811
1812static int rndis_iw_get_frag(struct net_device *dev,
1813 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1814{
1815 struct usbnet *usbdev = netdev_priv(dev);
1816 __le32 tmp;
1817 int len, ret;
1818
1819 len = sizeof(tmp);
1820 ret = rndis_query_oid(usbdev, OID_802_11_FRAGMENTATION_THRESHOLD, &tmp,
1821 &len);
1822 if (ret == 0) {
1823 wrqu->frag.value = le32_to_cpu(tmp);
1824 wrqu->frag.flags = 1;
1825 wrqu->frag.disabled = 0;
1826 }
1827 devdbg(usbdev, "SIOCGIWFRAG: %d", wrqu->frag.value);
1828 return ret;
1829}
1830
1831
1832static int rndis_iw_set_freq(struct net_device *dev, 1819static int rndis_iw_set_freq(struct net_device *dev,
1833 struct iw_request_info *info, union iwreq_data *wrqu, char *extra) 1820 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1834{ 1821{
@@ -2017,10 +2004,10 @@ static const iw_handler rndis_iw_handler[] =
2017 IW_IOCTL(SIOCSIWESSID) = rndis_iw_set_essid, 2004 IW_IOCTL(SIOCSIWESSID) = rndis_iw_set_essid,
2018 IW_IOCTL(SIOCGIWESSID) = rndis_iw_get_essid, 2005 IW_IOCTL(SIOCGIWESSID) = rndis_iw_get_essid,
2019 IW_IOCTL(SIOCGIWRATE) = rndis_iw_get_rate, 2006 IW_IOCTL(SIOCGIWRATE) = rndis_iw_get_rate,
2020 IW_IOCTL(SIOCSIWRTS) = rndis_iw_set_rts, 2007 IW_IOCTL(SIOCSIWRTS) = (iw_handler) cfg80211_wext_siwrts,
2021 IW_IOCTL(SIOCGIWRTS) = rndis_iw_get_rts, 2008 IW_IOCTL(SIOCGIWRTS) = (iw_handler) cfg80211_wext_giwrts,
2022 IW_IOCTL(SIOCSIWFRAG) = rndis_iw_set_frag, 2009 IW_IOCTL(SIOCSIWFRAG) = (iw_handler) cfg80211_wext_siwfrag,
2023 IW_IOCTL(SIOCGIWFRAG) = rndis_iw_get_frag, 2010 IW_IOCTL(SIOCGIWFRAG) = (iw_handler) cfg80211_wext_giwfrag,
2024 IW_IOCTL(SIOCSIWTXPOW) = rndis_iw_set_txpower, 2011 IW_IOCTL(SIOCSIWTXPOW) = rndis_iw_set_txpower,
2025 IW_IOCTL(SIOCGIWTXPOW) = rndis_iw_get_txpower, 2012 IW_IOCTL(SIOCGIWTXPOW) = rndis_iw_get_txpower,
2026 IW_IOCTL(SIOCSIWENCODE) = rndis_iw_set_encode, 2013 IW_IOCTL(SIOCSIWENCODE) = rndis_iw_set_encode,
@@ -2470,6 +2457,10 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
2470 2457
2471 set_default_iw_params(usbdev); 2458 set_default_iw_params(usbdev);
2472 2459
2460 /* set default rts/frag */
2461 rndis_set_wiphy_params(wiphy,
2462 WIPHY_PARAM_FRAG_THRESHOLD | WIPHY_PARAM_RTS_THRESHOLD);
2463
2473 /* turn radio on */ 2464 /* turn radio on */
2474 priv->radio_on = 1; 2465 priv->radio_on = 1;
2475 disassociate(usbdev, 1); 2466 disassociate(usbdev, 1);