Skip to content

Commit f2fcfcd

Browse files
Gustavo F. Padovanholtmann
Gustavo F. Padovan
authored andcommitted
Bluetooth: Add configuration support for ERTM and Streaming mode
Add support to config_req and config_rsp to configure ERTM and Streaming mode. If the remote device specifies ERTM or Streaming mode, then the same mode is proposed. Otherwise ERTM or Basic mode is used. And in case of a state 2 device, the remote device should propose the same mode. If not, then the channel gets disconnected. Signed-off-by: Gustavo F. Padovan <gustavo@las.ic.unicamp.br> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 65c7c49 commit f2fcfcd

File tree

2 files changed

+255
-35
lines changed

2 files changed

+255
-35
lines changed

Diff for: include/net/bluetooth/l2cap.h

+21-7
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727

2828
/* L2CAP defaults */
2929
#define L2CAP_DEFAULT_MTU 672
30+
#define L2CAP_DEFAULT_MIN_MTU 48
3031
#define L2CAP_DEFAULT_FLUSH_TO 0xffff
31-
#define L2CAP_DEFAULT_RX_WINDOW 1
32+
#define L2CAP_DEFAULT_TX_WINDOW 1
3233
#define L2CAP_DEFAULT_MAX_RECEIVE 1
3334
#define L2CAP_DEFAULT_RETRANS_TO 300 /* 300 milliseconds */
3435
#define L2CAP_DEFAULT_MONITOR_TO 1000 /* 1 second */
@@ -272,6 +273,9 @@ struct l2cap_pinfo {
272273
__u16 omtu;
273274
__u16 flush_to;
274275
__u8 mode;
276+
__u8 num_conf_req;
277+
__u8 num_conf_rsp;
278+
275279
__u8 fcs;
276280
__u8 sec_level;
277281
__u8 role_switch;
@@ -280,23 +284,33 @@ struct l2cap_pinfo {
280284
__u8 conf_req[64];
281285
__u8 conf_len;
282286
__u8 conf_state;
283-
__u8 conf_retry;
284287

285288
__u8 ident;
286289

290+
__u8 remote_tx_win;
291+
__u8 remote_max_tx;
292+
__u16 retrans_timeout;
293+
__u16 monitor_timeout;
294+
__u16 max_pdu_size;
295+
287296
__le16 sport;
288297

289298
struct l2cap_conn *conn;
290299
struct sock *next_c;
291300
struct sock *prev_c;
292301
};
293302

294-
#define L2CAP_CONF_REQ_SENT 0x01
295-
#define L2CAP_CONF_INPUT_DONE 0x02
296-
#define L2CAP_CONF_OUTPUT_DONE 0x04
297-
#define L2CAP_CONF_CONNECT_PEND 0x80
303+
#define L2CAP_CONF_REQ_SENT 0x01
304+
#define L2CAP_CONF_INPUT_DONE 0x02
305+
#define L2CAP_CONF_OUTPUT_DONE 0x04
306+
#define L2CAP_CONF_MTU_DONE 0x08
307+
#define L2CAP_CONF_MODE_DONE 0x10
308+
#define L2CAP_CONF_CONNECT_PEND 0x20
309+
#define L2CAP_CONF_STATE2_DEVICE 0x80
310+
311+
#define L2CAP_CONF_MAX_CONF_REQ 2
312+
#define L2CAP_CONF_MAX_CONF_RSP 2
298313

299-
#define L2CAP_CONF_MAX_RETRIES 2
300314

301315
void l2cap_load(void);
302316

0 commit comments

Comments
 (0)