p80211netdev.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */
  2. /* p80211netdev.h
  3. *
  4. * WLAN net device structure and functions
  5. *
  6. * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
  7. * --------------------------------------------------------------------
  8. *
  9. * linux-wlan
  10. *
  11. * The contents of this file are subject to the Mozilla Public
  12. * License Version 1.1 (the "License"); you may not use this file
  13. * except in compliance with the License. You may obtain a copy of
  14. * the License at http://www.mozilla.org/MPL/
  15. *
  16. * Software distributed under the License is distributed on an "AS
  17. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  18. * implied. See the License for the specific language governing
  19. * rights and limitations under the License.
  20. *
  21. * Alternatively, the contents of this file may be used under the
  22. * terms of the GNU Public License version 2 (the "GPL"), in which
  23. * case the provisions of the GPL are applicable instead of the
  24. * above. If you wish to allow the use of your version of this file
  25. * only under the terms of the GPL and not to allow others to use
  26. * your version of this file under the MPL, indicate your decision
  27. * by deleting the provisions above and replace them with the notice
  28. * and other provisions required by the GPL. If you do not delete
  29. * the provisions above, a recipient may use your version of this
  30. * file under either the MPL or the GPL.
  31. *
  32. * --------------------------------------------------------------------
  33. *
  34. * Inquiries regarding the linux-wlan Open Source project can be
  35. * made directly to:
  36. *
  37. * AbsoluteValue Systems Inc.
  38. * info@linux-wlan.com
  39. * http://www.linux-wlan.com
  40. *
  41. * --------------------------------------------------------------------
  42. *
  43. * Portions of the development of this software were funded by
  44. * Intersil Corporation as part of PRISM(R) chipset product development.
  45. *
  46. * --------------------------------------------------------------------
  47. *
  48. * This file declares the structure type that represents each wlan
  49. * interface.
  50. *
  51. * --------------------------------------------------------------------
  52. */
  53. #ifndef _LINUX_P80211NETDEV_H
  54. #define _LINUX_P80211NETDEV_H
  55. #include <linux/interrupt.h>
  56. #include <linux/wireless.h>
  57. #include <linux/netdevice.h>
  58. #define WLAN_RELEASE "0.3.0-staging"
  59. #define WLAN_DEVICE_CLOSED 0
  60. #define WLAN_DEVICE_OPEN 1
  61. #define WLAN_MACMODE_NONE 0
  62. #define WLAN_MACMODE_IBSS_STA 1
  63. #define WLAN_MACMODE_ESS_STA 2
  64. #define WLAN_MACMODE_ESS_AP 3
  65. /* MSD States */
  66. #define WLAN_MSD_HWPRESENT_PENDING 1
  67. #define WLAN_MSD_HWFAIL 2
  68. #define WLAN_MSD_HWPRESENT 3
  69. #define WLAN_MSD_FWLOAD_PENDING 4
  70. #define WLAN_MSD_FWLOAD 5
  71. #define WLAN_MSD_RUNNING_PENDING 6
  72. #define WLAN_MSD_RUNNING 7
  73. #ifndef ETH_P_ECONET
  74. #define ETH_P_ECONET 0x0018 /* needed for 2.2.x kernels */
  75. #endif
  76. #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
  77. #ifndef ARPHRD_IEEE80211
  78. #define ARPHRD_IEEE80211 801 /* kernel 2.4.6 */
  79. #endif
  80. #ifndef ARPHRD_IEEE80211_PRISM /* kernel 2.4.18 */
  81. #define ARPHRD_IEEE80211_PRISM 802
  82. #endif
  83. /*--- NSD Capabilities Flags ------------------------------*/
  84. #define P80211_NSDCAP_HARDWAREWEP 0x01 /* hardware wep engine */
  85. #define P80211_NSDCAP_SHORT_PREAMBLE 0x10 /* hardware supports */
  86. #define P80211_NSDCAP_HWFRAGMENT 0x80 /* nsd handles frag/defrag */
  87. #define P80211_NSDCAP_AUTOJOIN 0x100 /* nsd does autojoin */
  88. #define P80211_NSDCAP_NOSCAN 0x200 /* nsd can scan */
  89. /* Received frame statistics */
  90. struct p80211_frmrx {
  91. u32 mgmt;
  92. u32 assocreq;
  93. u32 assocresp;
  94. u32 reassocreq;
  95. u32 reassocresp;
  96. u32 probereq;
  97. u32 proberesp;
  98. u32 beacon;
  99. u32 atim;
  100. u32 disassoc;
  101. u32 authen;
  102. u32 deauthen;
  103. u32 mgmt_unknown;
  104. u32 ctl;
  105. u32 pspoll;
  106. u32 rts;
  107. u32 cts;
  108. u32 ack;
  109. u32 cfend;
  110. u32 cfendcfack;
  111. u32 ctl_unknown;
  112. u32 data;
  113. u32 dataonly;
  114. u32 data_cfack;
  115. u32 data_cfpoll;
  116. u32 data__cfack_cfpoll;
  117. u32 null;
  118. u32 cfack;
  119. u32 cfpoll;
  120. u32 cfack_cfpoll;
  121. u32 data_unknown;
  122. u32 decrypt;
  123. u32 decrypt_err;
  124. };
  125. /* called by /proc/net/wireless */
  126. struct iw_statistics *p80211wext_get_wireless_stats(struct net_device *dev);
  127. /* wireless extensions' ioctls */
  128. extern struct iw_handler_def p80211wext_handler_def;
  129. /* WEP stuff */
  130. #define NUM_WEPKEYS 4
  131. #define MAX_KEYLEN 32
  132. #define HOSTWEP_DEFAULTKEY_MASK GENMASK(1, 0)
  133. #define HOSTWEP_SHAREDKEY BIT(3)
  134. #define HOSTWEP_DECRYPT BIT(4)
  135. #define HOSTWEP_ENCRYPT BIT(5)
  136. #define HOSTWEP_PRIVACYINVOKED BIT(6)
  137. #define HOSTWEP_EXCLUDEUNENCRYPTED BIT(7)
  138. extern int wlan_watchdog;
  139. extern int wlan_wext_write;
  140. /* WLAN device type */
  141. struct wlandevice {
  142. void *priv; /* private data for MSD */
  143. /* Subsystem State */
  144. char name[WLAN_DEVNAMELEN_MAX]; /* Dev name, from register_wlandev() */
  145. char *nsdname;
  146. u32 state; /* Device I/F state (open/closed) */
  147. u32 msdstate; /* state of underlying driver */
  148. u32 hwremoved; /* Has the hw been yanked out? */
  149. /* Hardware config */
  150. unsigned int irq;
  151. unsigned int iobase;
  152. unsigned int membase;
  153. u32 nsdcaps; /* NSD Capabilities flags */
  154. /* Config vars */
  155. unsigned int ethconv;
  156. /* device methods (init by MSD, used by p80211 */
  157. int (*open)(struct wlandevice *wlandev);
  158. int (*close)(struct wlandevice *wlandev);
  159. void (*reset)(struct wlandevice *wlandev);
  160. int (*txframe)(struct wlandevice *wlandev, struct sk_buff *skb,
  161. union p80211_hdr *p80211_hdr,
  162. struct p80211_metawep *p80211_wep);
  163. int (*mlmerequest)(struct wlandevice *wlandev, struct p80211msg *msg);
  164. int (*set_multicast_list)(struct wlandevice *wlandev,
  165. struct net_device *dev);
  166. void (*tx_timeout)(struct wlandevice *wlandev);
  167. /* 802.11 State */
  168. u8 bssid[WLAN_BSSID_LEN];
  169. struct p80211pstr32 ssid;
  170. u32 macmode;
  171. int linkstatus;
  172. /* WEP State */
  173. u8 wep_keys[NUM_WEPKEYS][MAX_KEYLEN];
  174. u8 wep_keylens[NUM_WEPKEYS];
  175. int hostwep;
  176. /* Request/Confirm i/f state (used by p80211) */
  177. unsigned long request_pending; /* flag, access atomically */
  178. /* netlink socket */
  179. /* queue for indications waiting for cmd completion */
  180. /* Linux netdevice and support */
  181. struct net_device *netdev; /* ptr to linux netdevice */
  182. /* Rx bottom half */
  183. struct tasklet_struct rx_bh;
  184. struct sk_buff_head nsd_rxq;
  185. /* 802.11 device statistics */
  186. struct p80211_frmrx rx;
  187. struct iw_statistics wstats;
  188. /* jkriegl: iwspy fields */
  189. u8 spy_number;
  190. char spy_address[IW_MAX_SPY][ETH_ALEN];
  191. struct iw_quality spy_stat[IW_MAX_SPY];
  192. };
  193. /* WEP stuff */
  194. int wep_change_key(struct wlandevice *wlandev, int keynum, u8 *key, int keylen);
  195. int wep_decrypt(struct wlandevice *wlandev, u8 *buf, u32 len, int key_override,
  196. u8 *iv, u8 *icv);
  197. int wep_encrypt(struct wlandevice *wlandev, u8 *buf, u8 *dst, u32 len,
  198. int keynum, u8 *iv, u8 *icv);
  199. int wlan_setup(struct wlandevice *wlandev, struct device *physdev);
  200. void wlan_unsetup(struct wlandevice *wlandev);
  201. int register_wlandev(struct wlandevice *wlandev);
  202. int unregister_wlandev(struct wlandevice *wlandev);
  203. void p80211netdev_rx(struct wlandevice *wlandev, struct sk_buff *skb);
  204. void p80211netdev_hwremoved(struct wlandevice *wlandev);
  205. #endif