diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-04-19 15:34:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-19 15:34:48 -0400 |
commit | bb411b4db2767cfd4a99b3328da843ce4ea1596a (patch) | |
tree | 8b03d033476d9bb4abbff4f214a1b942081828e9 /include | |
parent | 44c866a0a57b08b7090be24ccb33679ed1d4f476 (diff) | |
parent | 26954c7f26068b6ced108806fdd39aee5cd54e6f (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-next-2.6
Diffstat (limited to 'include')
-rw-r--r-- | include/net/bluetooth/l2cap.h | 130 |
1 files changed, 62 insertions, 68 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 2b9ca0d5c4a0..7a215a7f9e39 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -276,10 +276,52 @@ struct l2cap_conn_param_update_rsp { | |||
276 | #define L2CAP_CONN_PARAM_ACCEPTED 0x0000 | 276 | #define L2CAP_CONN_PARAM_ACCEPTED 0x0000 |
277 | #define L2CAP_CONN_PARAM_REJECTED 0x0001 | 277 | #define L2CAP_CONN_PARAM_REJECTED 0x0001 |
278 | 278 | ||
279 | /* ----- L2CAP connections ----- */ | 279 | /* ----- L2CAP channels and connections ----- */ |
280 | struct l2cap_chan_list { | 280 | struct srej_list { |
281 | struct sock *head; | 281 | __u8 tx_seq; |
282 | rwlock_t lock; | 282 | struct list_head list; |
283 | }; | ||
284 | |||
285 | struct l2cap_chan { | ||
286 | struct sock *sk; | ||
287 | __u8 ident; | ||
288 | |||
289 | __u8 conf_req[64]; | ||
290 | __u8 conf_len; | ||
291 | __u8 num_conf_req; | ||
292 | __u8 num_conf_rsp; | ||
293 | |||
294 | __u16 conn_state; | ||
295 | |||
296 | __u8 next_tx_seq; | ||
297 | __u8 expected_ack_seq; | ||
298 | __u8 expected_tx_seq; | ||
299 | __u8 buffer_seq; | ||
300 | __u8 buffer_seq_srej; | ||
301 | __u8 srej_save_reqseq; | ||
302 | __u8 frames_sent; | ||
303 | __u8 unacked_frames; | ||
304 | __u8 retry_count; | ||
305 | __u8 num_acked; | ||
306 | __u16 sdu_len; | ||
307 | __u16 partial_sdu_len; | ||
308 | struct sk_buff *sdu; | ||
309 | |||
310 | __u8 remote_tx_win; | ||
311 | __u8 remote_max_tx; | ||
312 | __u16 remote_mps; | ||
313 | |||
314 | struct timer_list retrans_timer; | ||
315 | struct timer_list monitor_timer; | ||
316 | struct timer_list ack_timer; | ||
317 | struct sk_buff *tx_send_head; | ||
318 | struct sk_buff_head tx_q; | ||
319 | struct sk_buff_head srej_q; | ||
320 | struct sk_buff_head busy_q; | ||
321 | struct work_struct busy_work; | ||
322 | struct list_head srej_l; | ||
323 | |||
324 | struct list_head list; | ||
283 | }; | 325 | }; |
284 | 326 | ||
285 | struct l2cap_conn { | 327 | struct l2cap_conn { |
@@ -305,29 +347,16 @@ struct l2cap_conn { | |||
305 | 347 | ||
306 | __u8 disc_reason; | 348 | __u8 disc_reason; |
307 | 349 | ||
308 | struct l2cap_chan_list chan_list; | 350 | struct list_head chan_l; |
309 | }; | 351 | rwlock_t chan_lock; |
310 | |||
311 | struct sock_del_list { | ||
312 | struct sock *sk; | ||
313 | struct list_head list; | ||
314 | }; | 352 | }; |
315 | 353 | ||
316 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | 354 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 |
317 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 | 355 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 |
318 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 | 356 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 |
319 | 357 | ||
320 | /* ----- L2CAP channel and socket info ----- */ | 358 | /* ----- L2CAP socket info ----- */ |
321 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) | 359 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) |
322 | #define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue) | ||
323 | #define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue) | ||
324 | #define BUSY_QUEUE(sk) (&l2cap_pi(sk)->busy_queue) | ||
325 | #define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list) | ||
326 | |||
327 | struct srej_list { | ||
328 | __u8 tx_seq; | ||
329 | struct list_head list; | ||
330 | }; | ||
331 | 360 | ||
332 | struct l2cap_pinfo { | 361 | struct l2cap_pinfo { |
333 | struct bt_sock bt; | 362 | struct bt_sock bt; |
@@ -339,8 +368,6 @@ struct l2cap_pinfo { | |||
339 | __u16 omtu; | 368 | __u16 omtu; |
340 | __u16 flush_to; | 369 | __u16 flush_to; |
341 | __u8 mode; | 370 | __u8 mode; |
342 | __u8 num_conf_req; | ||
343 | __u8 num_conf_rsp; | ||
344 | 371 | ||
345 | __u8 fcs; | 372 | __u8 fcs; |
346 | __u8 sec_level; | 373 | __u8 sec_level; |
@@ -348,49 +375,18 @@ struct l2cap_pinfo { | |||
348 | __u8 force_reliable; | 375 | __u8 force_reliable; |
349 | __u8 flushable; | 376 | __u8 flushable; |
350 | 377 | ||
351 | __u8 conf_req[64]; | ||
352 | __u8 conf_len; | ||
353 | __u8 conf_state; | 378 | __u8 conf_state; |
354 | __u16 conn_state; | ||
355 | |||
356 | __u8 next_tx_seq; | ||
357 | __u8 expected_ack_seq; | ||
358 | __u8 expected_tx_seq; | ||
359 | __u8 buffer_seq; | ||
360 | __u8 buffer_seq_srej; | ||
361 | __u8 srej_save_reqseq; | ||
362 | __u8 frames_sent; | ||
363 | __u8 unacked_frames; | ||
364 | __u8 retry_count; | ||
365 | __u8 num_acked; | ||
366 | __u16 sdu_len; | ||
367 | __u16 partial_sdu_len; | ||
368 | struct sk_buff *sdu; | ||
369 | |||
370 | __u8 ident; | ||
371 | 379 | ||
372 | __u8 tx_win; | 380 | __u8 tx_win; |
373 | __u8 max_tx; | 381 | __u8 max_tx; |
374 | __u8 remote_tx_win; | ||
375 | __u8 remote_max_tx; | ||
376 | __u16 retrans_timeout; | 382 | __u16 retrans_timeout; |
377 | __u16 monitor_timeout; | 383 | __u16 monitor_timeout; |
378 | __u16 remote_mps; | ||
379 | __u16 mps; | 384 | __u16 mps; |
380 | 385 | ||
381 | __le16 sport; | 386 | __le16 sport; |
382 | 387 | ||
383 | struct timer_list retrans_timer; | ||
384 | struct timer_list monitor_timer; | ||
385 | struct timer_list ack_timer; | ||
386 | struct sk_buff_head tx_queue; | ||
387 | struct sk_buff_head srej_queue; | ||
388 | struct sk_buff_head busy_queue; | ||
389 | struct work_struct busy_work; | ||
390 | struct srej_list srej_l; | ||
391 | struct l2cap_conn *conn; | 388 | struct l2cap_conn *conn; |
392 | struct sock *next_c; | 389 | struct l2cap_chan *chan; |
393 | struct sock *prev_c; | ||
394 | }; | 390 | }; |
395 | 391 | ||
396 | #define L2CAP_CONF_REQ_SENT 0x01 | 392 | #define L2CAP_CONF_REQ_SENT 0x01 |
@@ -417,24 +413,23 @@ struct l2cap_pinfo { | |||
417 | #define L2CAP_CONN_RNR_SENT 0x0200 | 413 | #define L2CAP_CONN_RNR_SENT 0x0200 |
418 | #define L2CAP_CONN_SAR_RETRY 0x0400 | 414 | #define L2CAP_CONN_SAR_RETRY 0x0400 |
419 | 415 | ||
420 | #define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ | 416 | #define __mod_retrans_timer() mod_timer(&chan->retrans_timer, \ |
421 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); | 417 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); |
422 | #define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \ | 418 | #define __mod_monitor_timer() mod_timer(&chan->monitor_timer, \ |
423 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); | 419 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); |
424 | #define __mod_ack_timer() mod_timer(&l2cap_pi(sk)->ack_timer, \ | 420 | #define __mod_ack_timer() mod_timer(&chan->ack_timer, \ |
425 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); | 421 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); |
426 | 422 | ||
427 | static inline int l2cap_tx_window_full(struct sock *sk) | 423 | static inline int l2cap_tx_window_full(struct l2cap_chan *ch) |
428 | { | 424 | { |
429 | struct l2cap_pinfo *pi = l2cap_pi(sk); | ||
430 | int sub; | 425 | int sub; |
431 | 426 | ||
432 | sub = (pi->next_tx_seq - pi->expected_ack_seq) % 64; | 427 | sub = (ch->next_tx_seq - ch->expected_ack_seq) % 64; |
433 | 428 | ||
434 | if (sub < 0) | 429 | if (sub < 0) |
435 | sub += 64; | 430 | sub += 64; |
436 | 431 | ||
437 | return sub == pi->remote_tx_win; | 432 | return sub == ch->remote_tx_win; |
438 | } | 433 | } |
439 | 434 | ||
440 | #define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1) | 435 | #define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1) |
@@ -450,18 +445,17 @@ extern struct bt_sock_list l2cap_sk_list; | |||
450 | int l2cap_init_sockets(void); | 445 | int l2cap_init_sockets(void); |
451 | void l2cap_cleanup_sockets(void); | 446 | void l2cap_cleanup_sockets(void); |
452 | 447 | ||
453 | u8 l2cap_get_ident(struct l2cap_conn *conn); | ||
454 | void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data); | 448 | void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data); |
455 | int l2cap_build_conf_req(struct sock *sk, void *data); | 449 | void __l2cap_connect_rsp_defer(struct sock *sk); |
456 | int __l2cap_wait_ack(struct sock *sk); | 450 | int __l2cap_wait_ack(struct sock *sk); |
457 | 451 | ||
458 | struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len); | 452 | struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len); |
459 | struct sk_buff *l2cap_create_basic_pdu(struct sock *sk, struct msghdr *msg, size_t len); | 453 | struct sk_buff *l2cap_create_basic_pdu(struct sock *sk, struct msghdr *msg, size_t len); |
460 | struct sk_buff *l2cap_create_iframe_pdu(struct sock *sk, struct msghdr *msg, size_t len, u16 control, u16 sdulen); | 454 | struct sk_buff *l2cap_create_iframe_pdu(struct sock *sk, struct msghdr *msg, size_t len, u16 control, u16 sdulen); |
461 | int l2cap_sar_segment_sdu(struct sock *sk, struct msghdr *msg, size_t len); | 455 | int l2cap_sar_segment_sdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); |
462 | void l2cap_do_send(struct sock *sk, struct sk_buff *skb); | 456 | void l2cap_do_send(struct sock *sk, struct sk_buff *skb); |
463 | void l2cap_streaming_send(struct sock *sk); | 457 | void l2cap_streaming_send(struct l2cap_chan *chan); |
464 | int l2cap_ertm_send(struct sock *sk); | 458 | int l2cap_ertm_send(struct l2cap_chan *chan); |
465 | 459 | ||
466 | void l2cap_sock_set_timer(struct sock *sk, long timeout); | 460 | void l2cap_sock_set_timer(struct sock *sk, long timeout); |
467 | void l2cap_sock_clear_timer(struct sock *sk); | 461 | void l2cap_sock_clear_timer(struct sock *sk); |
@@ -470,8 +464,8 @@ void l2cap_sock_kill(struct sock *sk); | |||
470 | void l2cap_sock_init(struct sock *sk, struct sock *parent); | 464 | void l2cap_sock_init(struct sock *sk, struct sock *parent); |
471 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, | 465 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, |
472 | int proto, gfp_t prio); | 466 | int proto, gfp_t prio); |
473 | void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err); | 467 | void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *chan, int err); |
474 | void l2cap_chan_del(struct sock *sk, int err); | 468 | void l2cap_chan_del(struct l2cap_chan *chan, int err); |
475 | int l2cap_do_connect(struct sock *sk); | 469 | int l2cap_do_connect(struct sock *sk); |
476 | 470 | ||
477 | #endif /* __L2CAP_H */ | 471 | #endif /* __L2CAP_H */ |