diff options
author | Stefano Panella <stefano.panella@csr.com> | 2008-12-12 08:00:06 -0500 |
---|---|---|
committer | David Vrabel <david.vrabel@csr.com> | 2008-12-12 08:00:06 -0500 |
commit | 5b37717a23b8e40f6cf7ad85a26ddcf41c171e2c (patch) | |
tree | 3c611f907bc61c6e1900c4092e8f2f1e8eefd907 /include/linux/uwb.h | |
parent | c35fa3ea1ae8198bd65c2c6e59d9ebd68c115a59 (diff) |
uwb: improved MAS allocator and reservation conflict handling
Greatly enhance the MAS allocator:
- Handle row and column reservations.
- Permit all the available MAS to be allocated.
- Follows the WiMedia rules on MAS selection.
Take appropriate action when reservation conflicts are detected.
- Correctly identify which reservation wins the conflict.
- Protect alien BP reservations.
- If an owned reservation loses, resize/move it.
- Follow the backoff procedure before requesting additional MAS.
When reservations are terminated, move the remaining reservations (if
necessary) so they keep following the MAS allocation rules.
Signed-off-by: Stefano Panella <stefano.panella@csr.com>
Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'include/linux/uwb.h')
-rw-r--r-- | include/linux/uwb.h | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/include/linux/uwb.h b/include/linux/uwb.h index d7ed5201ade6..c02128991ff7 100644 --- a/include/linux/uwb.h +++ b/include/linux/uwb.h | |||
@@ -67,6 +67,7 @@ struct uwb_dev { | |||
67 | struct uwb_dev_addr dev_addr; | 67 | struct uwb_dev_addr dev_addr; |
68 | int beacon_slot; | 68 | int beacon_slot; |
69 | DECLARE_BITMAP(streams, UWB_NUM_STREAMS); | 69 | DECLARE_BITMAP(streams, UWB_NUM_STREAMS); |
70 | DECLARE_BITMAP(last_availability_bm, UWB_NUM_MAS); | ||
70 | }; | 71 | }; |
71 | #define to_uwb_dev(d) container_of(d, struct uwb_dev, dev) | 72 | #define to_uwb_dev(d) container_of(d, struct uwb_dev, dev) |
72 | 73 | ||
@@ -109,6 +110,9 @@ struct uwbd { | |||
109 | */ | 110 | */ |
110 | struct uwb_mas_bm { | 111 | struct uwb_mas_bm { |
111 | DECLARE_BITMAP(bm, UWB_NUM_MAS); | 112 | DECLARE_BITMAP(bm, UWB_NUM_MAS); |
113 | DECLARE_BITMAP(unsafe_bm, UWB_NUM_MAS); | ||
114 | int safe; | ||
115 | int unsafe; | ||
112 | }; | 116 | }; |
113 | 117 | ||
114 | /** | 118 | /** |
@@ -134,14 +138,24 @@ struct uwb_mas_bm { | |||
134 | * FIXME: further target states TBD. | 138 | * FIXME: further target states TBD. |
135 | */ | 139 | */ |
136 | enum uwb_rsv_state { | 140 | enum uwb_rsv_state { |
137 | UWB_RSV_STATE_NONE, | 141 | UWB_RSV_STATE_NONE = 0, |
138 | UWB_RSV_STATE_O_INITIATED, | 142 | UWB_RSV_STATE_O_INITIATED, |
139 | UWB_RSV_STATE_O_PENDING, | 143 | UWB_RSV_STATE_O_PENDING, |
140 | UWB_RSV_STATE_O_MODIFIED, | 144 | UWB_RSV_STATE_O_MODIFIED, |
141 | UWB_RSV_STATE_O_ESTABLISHED, | 145 | UWB_RSV_STATE_O_ESTABLISHED, |
146 | UWB_RSV_STATE_O_TO_BE_MOVED, | ||
147 | UWB_RSV_STATE_O_MOVE_EXPANDING, | ||
148 | UWB_RSV_STATE_O_MOVE_COMBINING, | ||
149 | UWB_RSV_STATE_O_MOVE_REDUCING, | ||
142 | UWB_RSV_STATE_T_ACCEPTED, | 150 | UWB_RSV_STATE_T_ACCEPTED, |
143 | UWB_RSV_STATE_T_DENIED, | 151 | UWB_RSV_STATE_T_DENIED, |
152 | UWB_RSV_STATE_T_CONFLICT, | ||
144 | UWB_RSV_STATE_T_PENDING, | 153 | UWB_RSV_STATE_T_PENDING, |
154 | UWB_RSV_STATE_T_EXPANDING_ACCEPTED, | ||
155 | UWB_RSV_STATE_T_EXPANDING_CONFLICT, | ||
156 | UWB_RSV_STATE_T_EXPANDING_PENDING, | ||
157 | UWB_RSV_STATE_T_EXPANDING_DENIED, | ||
158 | UWB_RSV_STATE_T_RESIZED, | ||
145 | 159 | ||
146 | UWB_RSV_STATE_LAST, | 160 | UWB_RSV_STATE_LAST, |
147 | }; | 161 | }; |
@@ -166,6 +180,12 @@ struct uwb_rsv_target { | |||
166 | }; | 180 | }; |
167 | }; | 181 | }; |
168 | 182 | ||
183 | struct uwb_rsv_move { | ||
184 | struct uwb_mas_bm final_mas; | ||
185 | struct uwb_ie_drp *companion_drp_ie; | ||
186 | struct uwb_mas_bm companion_mas; | ||
187 | }; | ||
188 | |||
169 | /* | 189 | /* |
170 | * Number of streams reserved for reservations targeted at DevAddrs. | 190 | * Number of streams reserved for reservations targeted at DevAddrs. |
171 | */ | 191 | */ |
@@ -203,6 +223,7 @@ typedef void (*uwb_rsv_cb_f)(struct uwb_rsv *rsv); | |||
203 | * | 223 | * |
204 | * @status: negotiation status | 224 | * @status: negotiation status |
205 | * @stream: stream index allocated for this reservation | 225 | * @stream: stream index allocated for this reservation |
226 | * @tiebreaker: conflict tiebreaker for this reservation | ||
206 | * @mas: reserved MAS | 227 | * @mas: reserved MAS |
207 | * @drp_ie: the DRP IE | 228 | * @drp_ie: the DRP IE |
208 | * @ie_valid: true iff the DRP IE matches the reservation parameters | 229 | * @ie_valid: true iff the DRP IE matches the reservation parameters |
@@ -225,19 +246,22 @@ struct uwb_rsv { | |||
225 | enum uwb_drp_type type; | 246 | enum uwb_drp_type type; |
226 | int max_mas; | 247 | int max_mas; |
227 | int min_mas; | 248 | int min_mas; |
228 | int sparsity; | 249 | int max_interval; |
229 | bool is_multicast; | 250 | bool is_multicast; |
230 | 251 | ||
231 | uwb_rsv_cb_f callback; | 252 | uwb_rsv_cb_f callback; |
232 | void *pal_priv; | 253 | void *pal_priv; |
233 | 254 | ||
234 | enum uwb_rsv_state state; | 255 | enum uwb_rsv_state state; |
256 | bool needs_release_companion_mas; | ||
235 | u8 stream; | 257 | u8 stream; |
258 | u8 tiebreaker; | ||
236 | struct uwb_mas_bm mas; | 259 | struct uwb_mas_bm mas; |
237 | struct uwb_ie_drp *drp_ie; | 260 | struct uwb_ie_drp *drp_ie; |
261 | struct uwb_rsv_move mv; | ||
238 | bool ie_valid; | 262 | bool ie_valid; |
239 | struct timer_list timer; | 263 | struct timer_list timer; |
240 | bool expired; | 264 | struct work_struct handle_timeout_work; |
241 | }; | 265 | }; |
242 | 266 | ||
243 | static const | 267 | static const |
@@ -279,6 +303,13 @@ struct uwb_drp_avail { | |||
279 | bool ie_valid; | 303 | bool ie_valid; |
280 | }; | 304 | }; |
281 | 305 | ||
306 | struct uwb_drp_backoff_win { | ||
307 | u8 window; | ||
308 | u8 n; | ||
309 | int total_expired; | ||
310 | struct timer_list timer; | ||
311 | bool can_reserve_extra_mases; | ||
312 | }; | ||
282 | 313 | ||
283 | const char *uwb_rsv_state_str(enum uwb_rsv_state state); | 314 | const char *uwb_rsv_state_str(enum uwb_rsv_state state); |
284 | const char *uwb_rsv_type_str(enum uwb_drp_type type); | 315 | const char *uwb_rsv_type_str(enum uwb_drp_type type); |
@@ -294,6 +325,8 @@ void uwb_rsv_terminate(struct uwb_rsv *rsv); | |||
294 | 325 | ||
295 | void uwb_rsv_accept(struct uwb_rsv *rsv, uwb_rsv_cb_f cb, void *pal_priv); | 326 | void uwb_rsv_accept(struct uwb_rsv *rsv, uwb_rsv_cb_f cb, void *pal_priv); |
296 | 327 | ||
328 | void uwb_rsv_get_usable_mas(struct uwb_rsv *orig_rsv, struct uwb_mas_bm *mas); | ||
329 | |||
297 | /** | 330 | /** |
298 | * Radio Control Interface instance | 331 | * Radio Control Interface instance |
299 | * | 332 | * |
@@ -364,12 +397,18 @@ struct uwb_rc { | |||
364 | 397 | ||
365 | struct uwbd uwbd; | 398 | struct uwbd uwbd; |
366 | 399 | ||
400 | struct uwb_drp_backoff_win bow; | ||
367 | struct uwb_drp_avail drp_avail; | 401 | struct uwb_drp_avail drp_avail; |
368 | struct list_head reservations; | 402 | struct list_head reservations; |
403 | struct list_head cnflt_alien_list; | ||
404 | struct uwb_mas_bm cnflt_alien_bitmap; | ||
369 | struct mutex rsvs_mutex; | 405 | struct mutex rsvs_mutex; |
406 | spinlock_t rsvs_lock; | ||
370 | struct workqueue_struct *rsv_workq; | 407 | struct workqueue_struct *rsv_workq; |
371 | struct work_struct rsv_update_work; | ||
372 | 408 | ||
409 | struct delayed_work rsv_update_work; | ||
410 | struct delayed_work rsv_alien_bp_work; | ||
411 | int set_drp_ie_pending; | ||
373 | struct mutex ies_mutex; | 412 | struct mutex ies_mutex; |
374 | struct uwb_rc_cmd_set_ie *ies; | 413 | struct uwb_rc_cmd_set_ie *ies; |
375 | size_t ies_capacity; | 414 | size_t ies_capacity; |