History

Bluetooth: L2CAP: Derive MPS from connection MTU

This ensures the MPS can fit in a single HCI fragment so each segment don't have to be reassembled at HCI level, in addition to that also remove the debugfs entry to configure the MPS.

Luiz Augusto von Dentz committed 8 years ago

Commit fe149311 parent a357ea02 files · +7 −8Browse files

Unified · Split

2 files
  1. include/net/bluetooth/l2cap.h +0 −1
  2. net/bluetooth/l2cap_core.c +7 −7
include/net/bluetooth/l2cap.h+0−1
@@ -456,7 +456,6 @@ struct l2cap_conn_param_update_rsp { · 455 unmodified lines
456#define L2CAP_CONN_PARAM_REJECTED 0x0001456#define L2CAP_CONN_PARAM_REJECTED 0x0001
457 457
458#define L2CAP_LE_MAX_CREDITS 10458#define L2CAP_LE_MAX_CREDITS 10
459#define L2CAP_LE_DEFAULT_MPS 230
460 459
461struct l2cap_le_conn_req {460struct l2cap_le_conn_req {
462 __le16 psm;461 __le16 psm;
net/bluetooth/l2cap_core.c+7−7
@@ -52,7 +52,6 @@ static LIST_HEAD(chan_list); · 51 unmodified lines
52static DEFINE_RWLOCK(chan_list_lock);52static DEFINE_RWLOCK(chan_list_lock);
53 53
54static u16 le_max_credits = L2CAP_LE_MAX_CREDITS;54static u16 le_max_credits = L2CAP_LE_MAX_CREDITS;
55static u16 le_default_mps = L2CAP_LE_DEFAULT_MPS;
56 55
57static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn,56static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn,
58 u8 code, u8 ident, u16 dlen, void *data);57 u8 code, u8 ident, u16 dlen, void *data);
@@ -520,7 +519,8 @@ static void l2cap_le_flowctl_init(struct l2cap_chan *chan) · 461 unmodified lines
520 chan->sdu_len = 0;519 chan->sdu_len = 0;
521 chan->tx_credits = 0;520 chan->tx_credits = 0;
522 chan->rx_credits = le_max_credits;521 chan->rx_credits = le_max_credits;
523 chan->mps = min_t(u16, chan->imtu, le_default_mps);522 /* Derive MPS from connection MTU to stop HCI fragmentation */
523 chan->mps = min_t(u16, chan->imtu, chan->conn->mtu - L2CAP_HDR_SIZE);
524 524
525 skb_queue_head_init(&chan->tx_q);525 skb_queue_head_init(&chan->tx_q);
526}526}
@@ -1282,6 +1282,8 @@ static void l2cap_le_connect(struct l2cap_chan *chan) · 755 unmodified lines
1282 if (test_and_set_bit(FLAG_LE_CONN_REQ_SENT, &chan->flags))1282 if (test_and_set_bit(FLAG_LE_CONN_REQ_SENT, &chan->flags))
1283 return;1283 return;
1284 1284
1285 l2cap_le_flowctl_init(chan);
1286
1285 req.psm = chan->psm;1287 req.psm = chan->psm;
1286 req.scid = cpu_to_le16(chan->scid);1288 req.scid = cpu_to_le16(chan->scid);
1287 req.mtu = cpu_to_le16(chan->imtu);1289 req.mtu = cpu_to_le16(chan->imtu);
@@ -5493,8 +5495,6 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn, · 4205 unmodified lines
5493 goto response_unlock;5495 goto response_unlock;
5494 }5496 }
5495 5497
5496 l2cap_le_flowctl_init(chan);
5497
5498 bacpy(&chan->src, &conn->hcon->src);5498 bacpy(&chan->src, &conn->hcon->src);
5499 bacpy(&chan->dst, &conn->hcon->dst);5499 bacpy(&chan->dst, &conn->hcon->dst);
5500 chan->src_type = bdaddr_src_type(conn->hcon);5500 chan->src_type = bdaddr_src_type(conn->hcon);
@@ -5506,6 +5506,9 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn, · 5 unmodified lines
5506 chan->tx_credits = __le16_to_cpu(req->credits);5506 chan->tx_credits = __le16_to_cpu(req->credits);
5507 5507
5508 __l2cap_chan_add(conn, chan);5508 __l2cap_chan_add(conn, chan);
5509
5510 l2cap_le_flowctl_init(chan);
5511
5509 dcid = chan->scid;5512 dcid = chan->scid;
5510 credits = chan->rx_credits;5513 credits = chan->rx_credits;
5511 5514
@@ -7102,7 +7105,6 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, · 1590 unmodified lines
7102 case L2CAP_MODE_BASIC:7105 case L2CAP_MODE_BASIC:
7103 break;7106 break;
7104 case L2CAP_MODE_LE_FLOWCTL:7107 case L2CAP_MODE_LE_FLOWCTL:
7105 l2cap_le_flowctl_init(chan);
7106 break;7108 break;
7107 case L2CAP_MODE_ERTM:7109 case L2CAP_MODE_ERTM:
7108 case L2CAP_MODE_STREAMING:7110 case L2CAP_MODE_STREAMING:
@@ -7647,8 +7649,6 @@ int __init l2cap_init(void) · 538 unmodified lines
7647 7649
7648 debugfs_create_u16("l2cap_le_max_credits", 0644, bt_debugfs,7650 debugfs_create_u16("l2cap_le_max_credits", 0644, bt_debugfs,
7649 &le_max_credits);7651 &le_max_credits);
7650 debugfs_create_u16("l2cap_le_default_mps", 0644, bt_debugfs,
7651 &le_default_mps);
7652 7652
7653 return 0;7653 return 0;
7654}7654}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t