diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2011-11-07 07:20:33 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-11-08 09:53:57 -0500 |
commit | 66af7aaf9edff55b7995bbe1ff508513666d0671 (patch) | |
tree | 6aef0205219427e3c629397fd8f62843b835d644 | |
parent | 9f5a0d7bf079e9e26771ad13ff1c2cb3adf80963 (diff) |
Bluetooth: EFS: parse L2CAP config response
Add parsing Extended Flow Specification in L2CAP Config Response.
Based upon haijun.liu <haijun.liu@atheros.com> series of patches
(sent Sun, 22 Aug 2010)
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r-- | net/bluetooth/l2cap_core.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index a50610b8a00c..f8506849b67e 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -2351,6 +2351,7 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len, voi | |||
2351 | int type, olen; | 2351 | int type, olen; |
2352 | unsigned long val; | 2352 | unsigned long val; |
2353 | struct l2cap_conf_rfc rfc; | 2353 | struct l2cap_conf_rfc rfc; |
2354 | struct l2cap_conf_efs efs; | ||
2354 | 2355 | ||
2355 | BT_DBG("chan %p, rsp %p, len %d, req %p", chan, rsp, len, data); | 2356 | BT_DBG("chan %p, rsp %p, len %d, req %p", chan, rsp, len, data); |
2356 | 2357 | ||
@@ -2393,6 +2394,19 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len, voi | |||
2393 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_EWS, 2, | 2394 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_EWS, 2, |
2394 | chan->tx_win); | 2395 | chan->tx_win); |
2395 | break; | 2396 | break; |
2397 | |||
2398 | case L2CAP_CONF_EFS: | ||
2399 | if (olen == sizeof(efs)) | ||
2400 | memcpy(&efs, (void *)val, olen); | ||
2401 | |||
2402 | if (chan->local_stype != L2CAP_SERV_NOTRAFIC && | ||
2403 | efs.stype != L2CAP_SERV_NOTRAFIC && | ||
2404 | efs.stype != chan->local_stype) | ||
2405 | return -ECONNREFUSED; | ||
2406 | |||
2407 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_EFS, | ||
2408 | sizeof(efs), (unsigned long) &efs); | ||
2409 | break; | ||
2396 | } | 2410 | } |
2397 | } | 2411 | } |
2398 | 2412 | ||
@@ -2407,7 +2421,17 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len, voi | |||
2407 | chan->retrans_timeout = le16_to_cpu(rfc.retrans_timeout); | 2421 | chan->retrans_timeout = le16_to_cpu(rfc.retrans_timeout); |
2408 | chan->monitor_timeout = le16_to_cpu(rfc.monitor_timeout); | 2422 | chan->monitor_timeout = le16_to_cpu(rfc.monitor_timeout); |
2409 | chan->mps = le16_to_cpu(rfc.max_pdu_size); | 2423 | chan->mps = le16_to_cpu(rfc.max_pdu_size); |
2424 | |||
2425 | if (test_bit(FLAG_EFS_ENABLE, &chan->flags)) { | ||
2426 | chan->local_msdu = le16_to_cpu(efs.msdu); | ||
2427 | chan->local_sdu_itime = | ||
2428 | le32_to_cpu(efs.sdu_itime); | ||
2429 | chan->local_acc_lat = le32_to_cpu(efs.acc_lat); | ||
2430 | chan->local_flush_to = | ||
2431 | le32_to_cpu(efs.flush_to); | ||
2432 | } | ||
2410 | break; | 2433 | break; |
2434 | |||
2411 | case L2CAP_MODE_STREAMING: | 2435 | case L2CAP_MODE_STREAMING: |
2412 | chan->mps = le16_to_cpu(rfc.max_pdu_size); | 2436 | chan->mps = le16_to_cpu(rfc.max_pdu_size); |
2413 | } | 2437 | } |