diff options
author | John W. Linville <linville@tuxdriver.com> | 2009-03-26 17:40:01 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-22 16:54:36 -0400 |
commit | 964c1d417e4738d359ba263921a7b9c18fa711c4 (patch) | |
tree | cb9603bf5ddba3a4e2c97f201f26e317669cfa07 /drivers/net/wireless/rndis_wlan.c | |
parent | 5c8fa4f7e7fcceabb3b37d7ec66d3e7115a4bba3 (diff) |
rndis_wlan: convert get/set mode to cfg80211
Signed-off-by: John W. Linville <linville@tuxdriver.com>
[edit: made rndis_change_virtual_intf static]
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.c | 95 |
1 files changed, 43 insertions, 52 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index c995d7c3139c..a8758603e01c 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -406,8 +406,17 @@ struct rndis_wext_private { | |||
406 | u8 command_buffer[COMMAND_BUFFER_SIZE]; | 406 | u8 command_buffer[COMMAND_BUFFER_SIZE]; |
407 | }; | 407 | }; |
408 | 408 | ||
409 | /* | ||
410 | * cfg80211 ops | ||
411 | */ | ||
412 | static int rndis_change_virtual_intf(struct wiphy *wiphy, int ifindex, | ||
413 | enum nl80211_iftype type, u32 *flags, | ||
414 | struct vif_params *params); | ||
415 | |||
416 | struct cfg80211_ops rndis_config_ops = { | ||
417 | .change_virtual_intf = rndis_change_virtual_intf, | ||
418 | }; | ||
409 | 419 | ||
410 | struct cfg80211_ops rndis_config_ops = { }; | ||
411 | void *rndis_wiphy_privid = &rndis_wiphy_privid; | 420 | void *rndis_wiphy_privid = &rndis_wiphy_privid; |
412 | 421 | ||
413 | static const int bcm4320_power_output[4] = { 25, 50, 75, 100 }; | 422 | static const int bcm4320_power_output[4] = { 25, 50, 75, 100 }; |
@@ -1125,6 +1134,37 @@ static void set_multicast_list(struct usbnet *usbdev) | |||
1125 | 1134 | ||
1126 | 1135 | ||
1127 | /* | 1136 | /* |
1137 | * cfg80211 ops | ||
1138 | */ | ||
1139 | static int rndis_change_virtual_intf(struct wiphy *wiphy, int ifindex, | ||
1140 | enum nl80211_iftype type, u32 *flags, | ||
1141 | struct vif_params *params) | ||
1142 | { | ||
1143 | struct net_device *dev; | ||
1144 | struct usbnet *usbdev; | ||
1145 | int mode; | ||
1146 | |||
1147 | /* we're under RTNL */ | ||
1148 | dev = __dev_get_by_index(&init_net, ifindex); | ||
1149 | if (!dev) | ||
1150 | return -ENODEV; | ||
1151 | usbdev = netdev_priv(dev); | ||
1152 | |||
1153 | switch (type) { | ||
1154 | case NL80211_IFTYPE_ADHOC: | ||
1155 | mode = ndis_80211_infra_adhoc; | ||
1156 | break; | ||
1157 | case NL80211_IFTYPE_STATION: | ||
1158 | mode = ndis_80211_infra_infra; | ||
1159 | break; | ||
1160 | default: | ||
1161 | return -EINVAL; | ||
1162 | } | ||
1163 | |||
1164 | return set_infra_mode(usbdev, mode); | ||
1165 | } | ||
1166 | |||
1167 | /* | ||
1128 | * wireless extension handlers | 1168 | * wireless extension handlers |
1129 | */ | 1169 | */ |
1130 | 1170 | ||
@@ -1450,55 +1490,6 @@ static int rndis_iw_get_auth(struct net_device *dev, | |||
1450 | } | 1490 | } |
1451 | 1491 | ||
1452 | 1492 | ||
1453 | static int rndis_iw_get_mode(struct net_device *dev, | ||
1454 | struct iw_request_info *info, | ||
1455 | union iwreq_data *wrqu, char *extra) | ||
1456 | { | ||
1457 | struct usbnet *usbdev = netdev_priv(dev); | ||
1458 | struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev); | ||
1459 | |||
1460 | switch (priv->infra_mode) { | ||
1461 | case ndis_80211_infra_adhoc: | ||
1462 | wrqu->mode = IW_MODE_ADHOC; | ||
1463 | break; | ||
1464 | case ndis_80211_infra_infra: | ||
1465 | wrqu->mode = IW_MODE_INFRA; | ||
1466 | break; | ||
1467 | /*case ndis_80211_infra_auto_unknown:*/ | ||
1468 | default: | ||
1469 | wrqu->mode = IW_MODE_AUTO; | ||
1470 | break; | ||
1471 | } | ||
1472 | devdbg(usbdev, "SIOCGIWMODE: %08x", wrqu->mode); | ||
1473 | return 0; | ||
1474 | } | ||
1475 | |||
1476 | |||
1477 | static int rndis_iw_set_mode(struct net_device *dev, | ||
1478 | struct iw_request_info *info, union iwreq_data *wrqu, char *extra) | ||
1479 | { | ||
1480 | struct usbnet *usbdev = netdev_priv(dev); | ||
1481 | int mode; | ||
1482 | |||
1483 | devdbg(usbdev, "SIOCSIWMODE: %08x", wrqu->mode); | ||
1484 | |||
1485 | switch (wrqu->mode) { | ||
1486 | case IW_MODE_ADHOC: | ||
1487 | mode = ndis_80211_infra_adhoc; | ||
1488 | break; | ||
1489 | case IW_MODE_INFRA: | ||
1490 | mode = ndis_80211_infra_infra; | ||
1491 | break; | ||
1492 | /*case IW_MODE_AUTO:*/ | ||
1493 | default: | ||
1494 | mode = ndis_80211_infra_auto_unknown; | ||
1495 | break; | ||
1496 | } | ||
1497 | |||
1498 | return set_infra_mode(usbdev, mode); | ||
1499 | } | ||
1500 | |||
1501 | |||
1502 | static int rndis_iw_set_encode(struct net_device *dev, | 1493 | static int rndis_iw_set_encode(struct net_device *dev, |
1503 | struct iw_request_info *info, union iwreq_data *wrqu, char *extra) | 1494 | struct iw_request_info *info, union iwreq_data *wrqu, char *extra) |
1504 | { | 1495 | { |
@@ -2196,8 +2187,8 @@ static const iw_handler rndis_iw_handler[] = | |||
2196 | IW_IOCTL(SIOCGIWNAME) = (iw_handler) cfg80211_wext_giwname, | 2187 | IW_IOCTL(SIOCGIWNAME) = (iw_handler) cfg80211_wext_giwname, |
2197 | IW_IOCTL(SIOCSIWFREQ) = rndis_iw_set_freq, | 2188 | IW_IOCTL(SIOCSIWFREQ) = rndis_iw_set_freq, |
2198 | IW_IOCTL(SIOCGIWFREQ) = rndis_iw_get_freq, | 2189 | IW_IOCTL(SIOCGIWFREQ) = rndis_iw_get_freq, |
2199 | IW_IOCTL(SIOCSIWMODE) = rndis_iw_set_mode, | 2190 | IW_IOCTL(SIOCSIWMODE) = (iw_handler) cfg80211_wext_siwmode, |
2200 | IW_IOCTL(SIOCGIWMODE) = rndis_iw_get_mode, | 2191 | IW_IOCTL(SIOCGIWMODE) = (iw_handler) cfg80211_wext_giwmode, |
2201 | IW_IOCTL(SIOCGIWRANGE) = rndis_iw_get_range, | 2192 | IW_IOCTL(SIOCGIWRANGE) = rndis_iw_get_range, |
2202 | IW_IOCTL(SIOCSIWAP) = rndis_iw_set_bssid, | 2193 | IW_IOCTL(SIOCSIWAP) = rndis_iw_set_bssid, |
2203 | IW_IOCTL(SIOCGIWAP) = rndis_iw_get_bssid, | 2194 | IW_IOCTL(SIOCGIWAP) = rndis_iw_get_bssid, |