wext.c 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. * Intel Wireless Multicomm 3200 WiFi driver
  3. *
  4. * Copyright (C) 2009 Intel Corporation <ilw@linux.intel.com>
  5. * Samuel Ortiz <samuel.ortiz@intel.com>
  6. * Zhu Yi <yi.zhu@intel.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License version
  10. * 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  20. * 02110-1301, USA.
  21. *
  22. */
  23. #include <linux/wireless.h>
  24. #include <net/cfg80211.h>
  25. #include "iwm.h"
  26. #include "commands.h"
  27. static int iwm_wext_siwfreq(struct net_device *dev,
  28. struct iw_request_info *info,
  29. struct iw_freq *freq, char *extra)
  30. {
  31. struct iwm_priv *iwm = ndev_to_iwm(dev);
  32. switch (iwm->conf.mode) {
  33. case UMAC_MODE_IBSS:
  34. return cfg80211_ibss_wext_siwfreq(dev, info, freq, extra);
  35. default:
  36. return -EOPNOTSUPP;
  37. }
  38. }
  39. static int iwm_wext_giwfreq(struct net_device *dev,
  40. struct iw_request_info *info,
  41. struct iw_freq *freq, char *extra)
  42. {
  43. struct iwm_priv *iwm = ndev_to_iwm(dev);
  44. switch (iwm->conf.mode) {
  45. case UMAC_MODE_IBSS:
  46. return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
  47. case UMAC_MODE_BSS:
  48. return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
  49. default:
  50. return -EOPNOTSUPP;
  51. }
  52. }
  53. static int iwm_wext_siwap(struct net_device *dev, struct iw_request_info *info,
  54. struct sockaddr *ap_addr, char *extra)
  55. {
  56. struct iwm_priv *iwm = ndev_to_iwm(dev);
  57. switch (iwm->conf.mode) {
  58. case UMAC_MODE_IBSS:
  59. return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
  60. case UMAC_MODE_BSS:
  61. return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
  62. default:
  63. return -EOPNOTSUPP;
  64. }
  65. }
  66. static int iwm_wext_giwap(struct net_device *dev, struct iw_request_info *info,
  67. struct sockaddr *ap_addr, char *extra)
  68. {
  69. struct iwm_priv *iwm = ndev_to_iwm(dev);
  70. switch (iwm->conf.mode) {
  71. case UMAC_MODE_IBSS:
  72. return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
  73. case UMAC_MODE_BSS:
  74. return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
  75. default:
  76. return -EOPNOTSUPP;
  77. }
  78. }
  79. static int iwm_wext_siwessid(struct net_device *dev,
  80. struct iw_request_info *info,
  81. struct iw_point *data, char *ssid)
  82. {
  83. struct iwm_priv *iwm = ndev_to_iwm(dev);
  84. switch (iwm->conf.mode) {
  85. case UMAC_MODE_IBSS:
  86. return cfg80211_ibss_wext_siwessid(dev, info, data, ssid);
  87. case UMAC_MODE_BSS:
  88. return cfg80211_mgd_wext_siwessid(dev, info, data, ssid);
  89. default:
  90. return -EOPNOTSUPP;
  91. }
  92. }
  93. static int iwm_wext_giwessid(struct net_device *dev,
  94. struct iw_request_info *info,
  95. struct iw_point *data, char *ssid)
  96. {
  97. struct iwm_priv *iwm = ndev_to_iwm(dev);
  98. switch (iwm->conf.mode) {
  99. case UMAC_MODE_IBSS:
  100. return cfg80211_ibss_wext_giwessid(dev, info, data, ssid);
  101. case UMAC_MODE_BSS:
  102. return cfg80211_mgd_wext_giwessid(dev, info, data, ssid);
  103. default:
  104. return -EOPNOTSUPP;
  105. }
  106. }
  107. static const iw_handler iwm_handlers[] =
  108. {
  109. (iw_handler) NULL, /* SIOCSIWCOMMIT */
  110. (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */
  111. (iw_handler) NULL, /* SIOCSIWNWID */
  112. (iw_handler) NULL, /* SIOCGIWNWID */
  113. (iw_handler) iwm_wext_siwfreq, /* SIOCSIWFREQ */
  114. (iw_handler) iwm_wext_giwfreq, /* SIOCGIWFREQ */
  115. (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */
  116. (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */
  117. (iw_handler) NULL, /* SIOCSIWSENS */
  118. (iw_handler) NULL, /* SIOCGIWSENS */
  119. (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */
  120. (iw_handler) cfg80211_wext_giwrange, /* SIOCGIWRANGE */
  121. (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
  122. (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
  123. (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
  124. (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
  125. (iw_handler) NULL, /* SIOCSIWSPY */
  126. (iw_handler) NULL, /* SIOCGIWSPY */
  127. (iw_handler) NULL, /* SIOCSIWTHRSPY */
  128. (iw_handler) NULL, /* SIOCGIWTHRSPY */
  129. (iw_handler) iwm_wext_siwap, /* SIOCSIWAP */
  130. (iw_handler) iwm_wext_giwap, /* SIOCGIWAP */
  131. (iw_handler) NULL, /* SIOCSIWMLME */
  132. (iw_handler) NULL, /* SIOCGIWAPLIST */
  133. (iw_handler) cfg80211_wext_siwscan, /* SIOCSIWSCAN */
  134. (iw_handler) cfg80211_wext_giwscan, /* SIOCGIWSCAN */
  135. (iw_handler) iwm_wext_siwessid, /* SIOCSIWESSID */
  136. (iw_handler) iwm_wext_giwessid, /* SIOCGIWESSID */
  137. (iw_handler) NULL, /* SIOCSIWNICKN */
  138. (iw_handler) NULL, /* SIOCGIWNICKN */
  139. (iw_handler) NULL, /* -- hole -- */
  140. (iw_handler) NULL, /* -- hole -- */
  141. (iw_handler) NULL, /* SIOCSIWRATE */
  142. (iw_handler) cfg80211_wext_giwrate, /* SIOCGIWRATE */
  143. (iw_handler) cfg80211_wext_siwrts, /* SIOCSIWRTS */
  144. (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */
  145. (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */
  146. (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */
  147. (iw_handler) cfg80211_wext_siwtxpower, /* SIOCSIWTXPOW */
  148. (iw_handler) cfg80211_wext_giwtxpower, /* SIOCGIWTXPOW */
  149. (iw_handler) NULL, /* SIOCSIWRETRY */
  150. (iw_handler) NULL, /* SIOCGIWRETRY */
  151. (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */
  152. (iw_handler) cfg80211_wext_giwencode, /* SIOCGIWENCODE */
  153. (iw_handler) cfg80211_wext_siwpower, /* SIOCSIWPOWER */
  154. (iw_handler) cfg80211_wext_giwpower, /* SIOCGIWPOWER */
  155. (iw_handler) NULL, /* -- hole -- */
  156. (iw_handler) NULL, /* -- hole -- */
  157. (iw_handler) cfg80211_wext_siwgenie, /* SIOCSIWGENIE */
  158. (iw_handler) NULL, /* SIOCGIWGENIE */
  159. (iw_handler) cfg80211_wext_siwauth, /* SIOCSIWAUTH */
  160. (iw_handler) cfg80211_wext_giwauth, /* SIOCGIWAUTH */
  161. (iw_handler) cfg80211_wext_siwencodeext, /* SIOCSIWENCODEEXT */
  162. (iw_handler) NULL, /* SIOCGIWENCODEEXT */
  163. (iw_handler) NULL, /* SIOCSIWPMKSA */
  164. (iw_handler) NULL, /* -- hole -- */
  165. };
  166. const struct iw_handler_def iwm_iw_handler_def = {
  167. .num_standard = ARRAY_SIZE(iwm_handlers),
  168. .standard = (iw_handler *) iwm_handlers,
  169. .get_wireless_stats = cfg80211_wireless_stats,
  170. };