diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 11:20:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 11:20:34 -0400 |
commit | 9779a8325a9bbf4ccd3853e0e4064984cf9da9c9 (patch) | |
tree | 7814d54c7554210ee03d0dbecc546cc2e8a876ec /drivers/uwb/wlp/wlp-internal.h | |
parent | 309e1e4240636f3a9704d77a164a08e1f5a81fea (diff) | |
parent | 61e0e79ee3c609eb34edf2fe023708cba6a79b1f (diff) |
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb
* 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb: (47 commits)
uwb: wrong sizeof argument in mac address compare
uwb: don't use printk_ratelimit() so often
uwb: use kcalloc where appropriate
uwb: use time_after() when purging stale beacons
uwb: add credits for the original developers of the UWB/WUSB/WLP subsystems
uwb: add entries in the MAINTAINERS file
uwb: depend on EXPERIMENTAL
wusb: wusb-cbaf (CBA driver) sysfs ABI simplification
uwb: document UWB and WUSB sysfs files
uwb: add symlinks in sysfs between radio controllers and PALs
uwb: dont tranmit identification IEs
uwb: i1480/GUWA100U: fix firmware download issues
uwb: i1480: remove MAC/PHY information checking function
uwb: add Intel i1480 HWA to the UWB RC quirk table
uwb: disable command/event filtering for D-Link DUB-1210
uwb: initialize the debug sub-system
uwb: Fix handling IEs with empty IE data in uwb_est_get_size()
wusb: fix bmRequestType for Abort RPipe request
wusb: fix error path for wusb_set_dev_addr()
wusb: add HWA host controller driver
...
Diffstat (limited to 'drivers/uwb/wlp/wlp-internal.h')
-rw-r--r-- | drivers/uwb/wlp/wlp-internal.h | 228 |
1 files changed, 228 insertions, 0 deletions
diff --git a/drivers/uwb/wlp/wlp-internal.h b/drivers/uwb/wlp/wlp-internal.h new file mode 100644 index 000000000000..1c94fabfb1a7 --- /dev/null +++ b/drivers/uwb/wlp/wlp-internal.h | |||
@@ -0,0 +1,228 @@ | |||
1 | /* | ||
2 | * WiMedia Logical Link Control Protocol (WLP) | ||
3 | * Internal API | ||
4 | * | ||
5 | * Copyright (C) 2007 Intel Corporation | ||
6 | * Reinette Chatre <reinette.chatre@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 | |||
24 | #ifndef __WLP_INTERNAL_H__ | ||
25 | #define __WLP_INTERNAL_H__ | ||
26 | |||
27 | /** | ||
28 | * State of WSS connection | ||
29 | * | ||
30 | * A device needs to connect to a neighbor in an activated WSS before data | ||
31 | * can be transmitted. The spec also distinguishes between a new connection | ||
32 | * attempt and a connection attempt after previous connection attempts. The | ||
33 | * state WLP_WSS_CONNECT_FAILED is used for this scenario. See WLP 0.99 | ||
34 | * [7.2.6] | ||
35 | */ | ||
36 | enum wlp_wss_connect { | ||
37 | WLP_WSS_UNCONNECTED = 0, | ||
38 | WLP_WSS_CONNECTED, | ||
39 | WLP_WSS_CONNECT_FAILED, | ||
40 | }; | ||
41 | |||
42 | extern struct kobj_type wss_ktype; | ||
43 | extern struct attribute_group wss_attr_group; | ||
44 | |||
45 | extern int uwb_rc_ie_add(struct uwb_rc *, const struct uwb_ie_hdr *, size_t); | ||
46 | extern int uwb_rc_ie_rm(struct uwb_rc *, enum uwb_ie); | ||
47 | |||
48 | |||
49 | /* This should be changed to a dynamic array where entries are sorted | ||
50 | * by eth_addr and search is done in a binary form | ||
51 | * | ||
52 | * Although thinking twice about it: this technologie's maximum reach | ||
53 | * is 10 meters...unless you want to pack too much stuff in around | ||
54 | * your radio controller/WLP device, the list will probably not be | ||
55 | * too big. | ||
56 | * | ||
57 | * In any case, there is probably some data structure in the kernel | ||
58 | * than we could reused for that already. | ||
59 | * | ||
60 | * The below structure is really just good while we support one WSS per | ||
61 | * host. | ||
62 | */ | ||
63 | struct wlp_eda_node { | ||
64 | struct list_head list_node; | ||
65 | unsigned char eth_addr[ETH_ALEN]; | ||
66 | struct uwb_dev_addr dev_addr; | ||
67 | struct wlp_wss *wss; | ||
68 | unsigned char virt_addr[ETH_ALEN]; | ||
69 | u8 tag; | ||
70 | enum wlp_wss_connect state; | ||
71 | }; | ||
72 | |||
73 | typedef int (*wlp_eda_for_each_f)(struct wlp *, struct wlp_eda_node *, void *); | ||
74 | |||
75 | extern void wlp_eda_init(struct wlp_eda *); | ||
76 | extern void wlp_eda_release(struct wlp_eda *); | ||
77 | extern int wlp_eda_create_node(struct wlp_eda *, | ||
78 | const unsigned char eth_addr[ETH_ALEN], | ||
79 | const struct uwb_dev_addr *); | ||
80 | extern void wlp_eda_rm_node(struct wlp_eda *, const struct uwb_dev_addr *); | ||
81 | extern int wlp_eda_update_node(struct wlp_eda *, | ||
82 | const struct uwb_dev_addr *, | ||
83 | struct wlp_wss *, | ||
84 | const unsigned char virt_addr[ETH_ALEN], | ||
85 | const u8, const enum wlp_wss_connect); | ||
86 | extern int wlp_eda_update_node_state(struct wlp_eda *, | ||
87 | const struct uwb_dev_addr *, | ||
88 | const enum wlp_wss_connect); | ||
89 | |||
90 | extern int wlp_copy_eda_node(struct wlp_eda *, struct uwb_dev_addr *, | ||
91 | struct wlp_eda_node *); | ||
92 | extern int wlp_eda_for_each(struct wlp_eda *, wlp_eda_for_each_f , void *); | ||
93 | extern int wlp_eda_for_virtual(struct wlp_eda *, | ||
94 | const unsigned char eth_addr[ETH_ALEN], | ||
95 | struct uwb_dev_addr *, | ||
96 | wlp_eda_for_each_f , void *); | ||
97 | |||
98 | |||
99 | extern void wlp_remove_neighbor_tmp_info(struct wlp_neighbor_e *); | ||
100 | |||
101 | extern size_t wlp_wss_key_print(char *, size_t, u8 *); | ||
102 | |||
103 | /* Function called when no more references to WSS exists */ | ||
104 | extern void wlp_wss_release(struct kobject *); | ||
105 | |||
106 | extern void wlp_wss_reset(struct wlp_wss *); | ||
107 | extern int wlp_wss_create_activate(struct wlp_wss *, struct wlp_uuid *, | ||
108 | char *, unsigned, unsigned); | ||
109 | extern int wlp_wss_enroll_activate(struct wlp_wss *, struct wlp_uuid *, | ||
110 | struct uwb_dev_addr *); | ||
111 | extern ssize_t wlp_discover(struct wlp *); | ||
112 | |||
113 | extern int wlp_enroll_neighbor(struct wlp *, struct wlp_neighbor_e *, | ||
114 | struct wlp_wss *, struct wlp_uuid *); | ||
115 | extern int wlp_wss_is_active(struct wlp *, struct wlp_wss *, | ||
116 | struct uwb_dev_addr *); | ||
117 | |||
118 | struct wlp_assoc_conn_ctx { | ||
119 | struct work_struct ws; | ||
120 | struct wlp *wlp; | ||
121 | struct sk_buff *skb; | ||
122 | struct wlp_eda_node eda_entry; | ||
123 | }; | ||
124 | |||
125 | |||
126 | extern int wlp_wss_connect_prep(struct wlp *, struct wlp_eda_node *, void *); | ||
127 | extern int wlp_wss_send_copy(struct wlp *, struct wlp_eda_node *, void *); | ||
128 | |||
129 | |||
130 | /* Message handling */ | ||
131 | struct wlp_assoc_frame_ctx { | ||
132 | struct work_struct ws; | ||
133 | struct wlp *wlp; | ||
134 | struct sk_buff *skb; | ||
135 | struct uwb_dev_addr src; | ||
136 | }; | ||
137 | |||
138 | extern int wlp_wss_prep_hdr(struct wlp *, struct wlp_eda_node *, void *); | ||
139 | extern void wlp_handle_d1_frame(struct work_struct *); | ||
140 | extern int wlp_parse_d2_frame_to_cache(struct wlp *, struct sk_buff *, | ||
141 | struct wlp_neighbor_e *); | ||
142 | extern int wlp_parse_d2_frame_to_enroll(struct wlp_wss *, struct sk_buff *, | ||
143 | struct wlp_neighbor_e *, | ||
144 | struct wlp_uuid *); | ||
145 | extern void wlp_handle_c1_frame(struct work_struct *); | ||
146 | extern void wlp_handle_c3_frame(struct work_struct *); | ||
147 | extern int wlp_parse_c3c4_frame(struct wlp *, struct sk_buff *, | ||
148 | struct wlp_uuid *, u8 *, | ||
149 | struct uwb_mac_addr *); | ||
150 | extern int wlp_parse_f0(struct wlp *, struct sk_buff *); | ||
151 | extern int wlp_send_assoc_frame(struct wlp *, struct wlp_wss *, | ||
152 | struct uwb_dev_addr *, enum wlp_assoc_type); | ||
153 | extern ssize_t wlp_get_version(struct wlp *, struct wlp_attr_version *, | ||
154 | u8 *, ssize_t); | ||
155 | extern ssize_t wlp_get_wssid(struct wlp *, struct wlp_attr_wssid *, | ||
156 | struct wlp_uuid *, ssize_t); | ||
157 | extern int __wlp_alloc_device_info(struct wlp *); | ||
158 | extern int __wlp_setup_device_info(struct wlp *); | ||
159 | |||
160 | extern struct wlp_wss_attribute wss_attribute_properties; | ||
161 | extern struct wlp_wss_attribute wss_attribute_members; | ||
162 | extern struct wlp_wss_attribute wss_attribute_state; | ||
163 | |||
164 | static inline | ||
165 | size_t wlp_wss_uuid_print(char *buf, size_t bufsize, struct wlp_uuid *uuid) | ||
166 | { | ||
167 | size_t result; | ||
168 | |||
169 | result = scnprintf(buf, bufsize, | ||
170 | "%02x:%02x:%02x:%02x:%02x:%02x:" | ||
171 | "%02x:%02x:%02x:%02x:%02x:%02x:" | ||
172 | "%02x:%02x:%02x:%02x", | ||
173 | uuid->data[0], uuid->data[1], | ||
174 | uuid->data[2], uuid->data[3], | ||
175 | uuid->data[4], uuid->data[5], | ||
176 | uuid->data[6], uuid->data[7], | ||
177 | uuid->data[8], uuid->data[9], | ||
178 | uuid->data[10], uuid->data[11], | ||
179 | uuid->data[12], uuid->data[13], | ||
180 | uuid->data[14], uuid->data[15]); | ||
181 | return result; | ||
182 | } | ||
183 | |||
184 | /** | ||
185 | * FIXME: How should a nonce be displayed? | ||
186 | */ | ||
187 | static inline | ||
188 | size_t wlp_wss_nonce_print(char *buf, size_t bufsize, struct wlp_nonce *nonce) | ||
189 | { | ||
190 | size_t result; | ||
191 | |||
192 | result = scnprintf(buf, bufsize, | ||
193 | "%02x %02x %02x %02x %02x %02x " | ||
194 | "%02x %02x %02x %02x %02x %02x " | ||
195 | "%02x %02x %02x %02x", | ||
196 | nonce->data[0], nonce->data[1], | ||
197 | nonce->data[2], nonce->data[3], | ||
198 | nonce->data[4], nonce->data[5], | ||
199 | nonce->data[6], nonce->data[7], | ||
200 | nonce->data[8], nonce->data[9], | ||
201 | nonce->data[10], nonce->data[11], | ||
202 | nonce->data[12], nonce->data[13], | ||
203 | nonce->data[14], nonce->data[15]); | ||
204 | return result; | ||
205 | } | ||
206 | |||
207 | |||
208 | static inline | ||
209 | void wlp_session_cb(struct wlp *wlp) | ||
210 | { | ||
211 | struct completion *completion = wlp->session->cb_priv; | ||
212 | complete(completion); | ||
213 | } | ||
214 | |||
215 | static inline | ||
216 | int wlp_uuid_is_set(struct wlp_uuid *uuid) | ||
217 | { | ||
218 | struct wlp_uuid zero_uuid = { .data = { 0x00, 0x00, 0x00, 0x00, | ||
219 | 0x00, 0x00, 0x00, 0x00, | ||
220 | 0x00, 0x00, 0x00, 0x00, | ||
221 | 0x00, 0x00, 0x00, 0x00} }; | ||
222 | |||
223 | if (!memcmp(uuid, &zero_uuid, sizeof(*uuid))) | ||
224 | return 0; | ||
225 | return 1; | ||
226 | } | ||
227 | |||
228 | #endif /* __WLP_INTERNAL_H__ */ | ||