1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *	Copyright (c) 2004, 2005 Jeroen Vreeken (pe1rxq@amsat.org)
4  *
5  *	Parts of this driver have been derived from a wlan-ng version
6  *	modified by ZyDAS.
7  *	Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
8  */
9 
10 #ifndef _INCLUDE_ZD1201_H_
11 #define _INCLUDE_ZD1201_H_
12 
13 #define ZD1201_NUMKEYS		4
14 #define ZD1201_MAXKEYLEN	13
15 #define ZD1201_MAXMULTI		16
16 #define ZD1201_FRAGMAX		2500
17 #define ZD1201_FRAGMIN		256
18 #define ZD1201_RTSMAX		2500
19 
20 #define ZD1201_RXSIZE		3000
21 
22 struct zd1201 {
23 	struct usb_device	*usb;
24 	int			removed;
25 	struct net_device	*dev;
26 	struct iw_statistics	iwstats;
27 
28 	int			endp_in;
29 	int			endp_out;
30 	int			endp_out2;
31 	struct urb		*rx_urb;
32 	struct urb		*tx_urb;
33 
34 	unsigned char 		rxdata[ZD1201_RXSIZE];
35 	int			rxlen;
36 	wait_queue_head_t	rxdataq;
37 	int			rxdatas;
38 	struct hlist_head	fraglist;
39 	unsigned char		txdata[ZD1201_RXSIZE];
40 
41 	int			ap;
42 	char			essid[IW_ESSID_MAX_SIZE+1];
43 	int			essidlen;
44 	int			mac_enabled;
45 	int			was_enabled;
46 	int			monitor;
47 	int			encode_enabled;
48 	int			encode_restricted;
49 	unsigned char		encode_keys[ZD1201_NUMKEYS][ZD1201_MAXKEYLEN];
50 	int			encode_keylen[ZD1201_NUMKEYS];
51 };
52 
53 struct zd1201_frag {
54 	struct hlist_node	fnode;
55 	int			seq;
56 	struct sk_buff		*skb;
57 };
58 
59 #define ZD1201SIWHOSTAUTH SIOCIWFIRSTPRIV
60 #define ZD1201GIWHOSTAUTH ZD1201SIWHOSTAUTH+1
61 #define ZD1201SIWAUTHSTA SIOCIWFIRSTPRIV+2
62 #define ZD1201SIWMAXASSOC SIOCIWFIRSTPRIV+4
63 #define ZD1201GIWMAXASSOC ZD1201SIWMAXASSOC+1
64 
65 #define ZD1201_FW_TIMEOUT	(1000)
66 
67 #define ZD1201_TX_TIMEOUT	(2000)
68 
69 #define ZD1201_USB_CMDREQ	0
70 #define ZD1201_USB_RESREQ	1
71 
72 #define	ZD1201_CMDCODE_INIT	0x00
73 #define ZD1201_CMDCODE_ENABLE	0x01
74 #define ZD1201_CMDCODE_DISABLE	0x02
75 #define ZD1201_CMDCODE_ALLOC	0x0a
76 #define ZD1201_CMDCODE_INQUIRE	0x11
77 #define ZD1201_CMDCODE_SETRXRID	0x17
78 #define ZD1201_CMDCODE_ACCESS	0x21
79 
80 #define ZD1201_PACKET_EVENTSTAT	0x0
81 #define ZD1201_PACKET_RXDATA	0x1
82 #define ZD1201_PACKET_INQUIRE	0x2
83 #define ZD1201_PACKET_RESOURCE	0x3
84 
85 #define ZD1201_ACCESSBIT	0x0100
86 
87 #define ZD1201_RID_CNFPORTTYPE		0xfc00
88 #define ZD1201_RID_CNFOWNMACADDR	0xfc01
89 #define ZD1201_RID_CNFDESIREDSSID	0xfc02
90 #define ZD1201_RID_CNFOWNCHANNEL	0xfc03
91 #define ZD1201_RID_CNFOWNSSID		0xfc04
92 #define ZD1201_RID_CNFMAXDATALEN	0xfc07
93 #define ZD1201_RID_CNFPMENABLED		0xfc09
94 #define ZD1201_RID_CNFPMEPS		0xfc0a
95 #define ZD1201_RID_CNFMAXSLEEPDURATION	0xfc0c
96 #define ZD1201_RID_CNFDEFAULTKEYID	0xfc23
97 #define ZD1201_RID_CNFDEFAULTKEY0	0xfc24
98 #define ZD1201_RID_CNFDEFAULTKEY1	0xfc25
99 #define ZD1201_RID_CNFDEFAULTKEY2	0xfc26
100 #define ZD1201_RID_CNFDEFAULTKEY3	0xfc27
101 #define ZD1201_RID_CNFWEBFLAGS		0xfc28
102 #define ZD1201_RID_CNFAUTHENTICATION	0xfc2a
103 #define ZD1201_RID_CNFMAXASSOCSTATIONS	0xfc2b
104 #define ZD1201_RID_CNFHOSTAUTH		0xfc2e
105 #define ZD1201_RID_CNFGROUPADDRESS	0xfc80
106 #define ZD1201_RID_CNFFRAGTHRESHOLD	0xfc82
107 #define ZD1201_RID_CNFRTSTHRESHOLD	0xfc83
108 #define ZD1201_RID_TXRATECNTL		0xfc84
109 #define ZD1201_RID_PROMISCUOUSMODE	0xfc85
110 #define ZD1201_RID_CNFBASICRATES	0xfcb3
111 #define ZD1201_RID_AUTHENTICATESTA	0xfce3
112 #define ZD1201_RID_CURRENTBSSID		0xfd42
113 #define ZD1201_RID_COMMSQUALITY		0xfd43
114 #define ZD1201_RID_CURRENTTXRATE	0xfd44
115 #define ZD1201_RID_CNFMAXTXBUFFERNUMBER	0xfda0
116 #define ZD1201_RID_CURRENTCHANNEL	0xfdc1
117 
118 #define ZD1201_INQ_SCANRESULTS		0xf101
119 
120 #define ZD1201_INF_LINKSTATUS		0xf200
121 #define ZD1201_INF_ASSOCSTATUS		0xf201
122 #define ZD1201_INF_AUTHREQ		0xf202
123 
124 #define ZD1201_ASSOCSTATUS_STAASSOC	0x1
125 #define ZD1201_ASSOCSTATUS_REASSOC	0x2
126 #define ZD1201_ASSOCSTATUS_DISASSOC	0x3
127 #define ZD1201_ASSOCSTATUS_ASSOCFAIL	0x4
128 #define ZD1201_ASSOCSTATUS_AUTHFAIL	0x5
129 
130 #define ZD1201_PORTTYPE_IBSS		0
131 #define ZD1201_PORTTYPE_BSS		1
132 #define ZD1201_PORTTYPE_WDS		2
133 #define ZD1201_PORTTYPE_PSEUDOIBSS	3
134 #define ZD1201_PORTTYPE_AP		6
135 
136 #define ZD1201_RATEB1	1
137 #define ZD1201_RATEB2	2
138 #define ZD1201_RATEB5	4	/* 5.5 really, but 5 is shorter :) */
139 #define ZD1201_RATEB11	8
140 
141 #define ZD1201_CNFAUTHENTICATION_OPENSYSTEM	0x0001
142 #define ZD1201_CNFAUTHENTICATION_SHAREDKEY	0x0002
143 
144 #endif /* _INCLUDE_ZD1201_H_ */
145