aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-10-10 10:38:30 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-10-11 02:34:24 -0400
commitbd1eb66ba4eee21de3be24212b135f57101ad930 (patch)
tree37b3c0f63a3487429ce735c56f80968b6b198444
parent76ef7cf7722331097f5f47d23342128b1b5d072d (diff)
Bluetooth: AMP: Handle AMP_LINK connection
AMP_LINK represents physical link between AMP controllers. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
-rw-r--r--include/net/bluetooth/hci_core.h13
-rw-r--r--net/bluetooth/hci_core.c22
-rw-r--r--net/bluetooth/hci_event.c1
3 files changed, 33 insertions, 3 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index b697ef342020..d5ed054d77cf 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -73,6 +73,7 @@ struct discovery_state {
73struct hci_conn_hash { 73struct hci_conn_hash {
74 struct list_head list; 74 struct list_head list;
75 unsigned int acl_num; 75 unsigned int acl_num;
76 unsigned int amp_num;
76 unsigned int sco_num; 77 unsigned int sco_num;
77 unsigned int le_num; 78 unsigned int le_num;
78}; 79};
@@ -449,6 +450,9 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
449 case ACL_LINK: 450 case ACL_LINK:
450 h->acl_num++; 451 h->acl_num++;
451 break; 452 break;
453 case AMP_LINK:
454 h->amp_num++;
455 break;
452 case LE_LINK: 456 case LE_LINK:
453 h->le_num++; 457 h->le_num++;
454 break; 458 break;
@@ -470,6 +474,9 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
470 case ACL_LINK: 474 case ACL_LINK:
471 h->acl_num--; 475 h->acl_num--;
472 break; 476 break;
477 case AMP_LINK:
478 h->amp_num--;
479 break;
473 case LE_LINK: 480 case LE_LINK:
474 h->le_num--; 481 h->le_num--;
475 break; 482 break;
@@ -486,6 +493,8 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
486 switch (type) { 493 switch (type) {
487 case ACL_LINK: 494 case ACL_LINK:
488 return h->acl_num; 495 return h->acl_num;
496 case AMP_LINK:
497 return h->amp_num;
489 case LE_LINK: 498 case LE_LINK:
490 return h->le_num; 499 return h->le_num;
491 case SCO_LINK: 500 case SCO_LINK:
@@ -801,6 +810,10 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
801 sco_disconn_cfm(conn, reason); 810 sco_disconn_cfm(conn, reason);
802 break; 811 break;
803 812
813 /* L2CAP would be handled for BREDR chan */
814 case AMP_LINK:
815 break;
816
804 default: 817 default:
805 BT_ERR("unknown link type %d", conn->type); 818 BT_ERR("unknown link type %d", conn->type);
806 break; 819 break;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index bd26cb52aaa9..2e72c410fb47 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2379,6 +2379,9 @@ static struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
2379 case ACL_LINK: 2379 case ACL_LINK:
2380 cnt = hdev->acl_cnt; 2380 cnt = hdev->acl_cnt;
2381 break; 2381 break;
2382 case AMP_LINK:
2383 cnt = hdev->block_cnt;
2384 break;
2382 case SCO_LINK: 2385 case SCO_LINK:
2383 case ESCO_LINK: 2386 case ESCO_LINK:
2384 cnt = hdev->sco_cnt; 2387 cnt = hdev->sco_cnt;
@@ -2508,11 +2511,19 @@ static void hci_sched_acl_blk(struct hci_dev *hdev)
2508 struct hci_chan *chan; 2511 struct hci_chan *chan;
2509 struct sk_buff *skb; 2512 struct sk_buff *skb;
2510 int quote; 2513 int quote;
2514 u8 type;
2511 2515
2512 __check_timeout(hdev, cnt); 2516 __check_timeout(hdev, cnt);
2513 2517
2518 BT_DBG("%s", hdev->name);
2519
2520 if (hdev->dev_type == HCI_AMP)
2521 type = AMP_LINK;
2522 else
2523 type = ACL_LINK;
2524
2514 while (hdev->block_cnt > 0 && 2525 while (hdev->block_cnt > 0 &&
2515 (chan = hci_chan_sent(hdev, ACL_LINK, &quote))) { 2526 (chan = hci_chan_sent(hdev, type, &quote))) {
2516 u32 priority = (skb_peek(&chan->data_q))->priority; 2527 u32 priority = (skb_peek(&chan->data_q))->priority;
2517 while (quote > 0 && (skb = skb_peek(&chan->data_q))) { 2528 while (quote > 0 && (skb = skb_peek(&chan->data_q))) {
2518 int blocks; 2529 int blocks;
@@ -2545,14 +2556,19 @@ static void hci_sched_acl_blk(struct hci_dev *hdev)
2545 } 2556 }
2546 2557
2547 if (cnt != hdev->block_cnt) 2558 if (cnt != hdev->block_cnt)
2548 hci_prio_recalculate(hdev, ACL_LINK); 2559 hci_prio_recalculate(hdev, type);
2549} 2560}
2550 2561
2551static void hci_sched_acl(struct hci_dev *hdev) 2562static void hci_sched_acl(struct hci_dev *hdev)
2552{ 2563{
2553 BT_DBG("%s", hdev->name); 2564 BT_DBG("%s", hdev->name);
2554 2565
2555 if (!hci_conn_num(hdev, ACL_LINK)) 2566 /* No ACL link over BR/EDR controller */
2567 if (!hci_conn_num(hdev, ACL_LINK) && hdev->dev_type == HCI_BREDR)
2568 return;
2569
2570 /* No AMP link over AMP controller */
2571 if (!hci_conn_num(hdev, AMP_LINK) && hdev->dev_type == HCI_AMP)
2556 return; 2572 return;
2557 2573
2558 switch (hdev->flow_ctl_mode) { 2574 switch (hdev->flow_ctl_mode) {
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 5c0b6c161a01..0383635f91fb 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2733,6 +2733,7 @@ static void hci_num_comp_blocks_evt(struct hci_dev *hdev, struct sk_buff *skb)
2733 2733
2734 switch (conn->type) { 2734 switch (conn->type) {
2735 case ACL_LINK: 2735 case ACL_LINK:
2736 case AMP_LINK:
2736 hdev->block_cnt += block_count; 2737 hdev->block_cnt += block_count;
2737 if (hdev->block_cnt > hdev->num_blocks) 2738 if (hdev->block_cnt > hdev->num_blocks)
2738 hdev->block_cnt = hdev->num_blocks; 2739 hdev->block_cnt = hdev->num_blocks;