Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd1eb66b authored by Andrei Emeltchenko's avatar Andrei Emeltchenko Committed by Gustavo Padovan
Browse files

Bluetooth: AMP: Handle AMP_LINK connection



AMP_LINK represents physical link between AMP controllers.

Signed-off-by: default avatarAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent 76ef7cf7
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -73,6 +73,7 @@ struct discovery_state {
struct hci_conn_hash {
struct hci_conn_hash {
	struct list_head list;
	struct list_head list;
	unsigned int     acl_num;
	unsigned int     acl_num;
	unsigned int     amp_num;
	unsigned int     sco_num;
	unsigned int     sco_num;
	unsigned int     le_num;
	unsigned int     le_num;
};
};
@@ -449,6 +450,9 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
	case ACL_LINK:
	case ACL_LINK:
		h->acl_num++;
		h->acl_num++;
		break;
		break;
	case AMP_LINK:
		h->amp_num++;
		break;
	case LE_LINK:
	case LE_LINK:
		h->le_num++;
		h->le_num++;
		break;
		break;
@@ -470,6 +474,9 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
	case ACL_LINK:
	case ACL_LINK:
		h->acl_num--;
		h->acl_num--;
		break;
		break;
	case AMP_LINK:
		h->amp_num--;
		break;
	case LE_LINK:
	case LE_LINK:
		h->le_num--;
		h->le_num--;
		break;
		break;
@@ -486,6 +493,8 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
	switch (type) {
	switch (type) {
	case ACL_LINK:
	case ACL_LINK:
		return h->acl_num;
		return h->acl_num;
	case AMP_LINK:
		return h->amp_num;
	case LE_LINK:
	case LE_LINK:
		return h->le_num;
		return h->le_num;
	case SCO_LINK:
	case SCO_LINK:
@@ -801,6 +810,10 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
		sco_disconn_cfm(conn, reason);
		sco_disconn_cfm(conn, reason);
		break;
		break;


	/* L2CAP would be handled for BREDR chan */
	case AMP_LINK:
		break;

	default:
	default:
		BT_ERR("unknown link type %d", conn->type);
		BT_ERR("unknown link type %d", conn->type);
		break;
		break;
+19 −3
Original line number Original line Diff line number Diff line
@@ -2379,6 +2379,9 @@ static struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
	case ACL_LINK:
	case ACL_LINK:
		cnt = hdev->acl_cnt;
		cnt = hdev->acl_cnt;
		break;
		break;
	case AMP_LINK:
		cnt = hdev->block_cnt;
		break;
	case SCO_LINK:
	case SCO_LINK:
	case ESCO_LINK:
	case ESCO_LINK:
		cnt = hdev->sco_cnt;
		cnt = hdev->sco_cnt;
@@ -2508,11 +2511,19 @@ static void hci_sched_acl_blk(struct hci_dev *hdev)
	struct hci_chan *chan;
	struct hci_chan *chan;
	struct sk_buff *skb;
	struct sk_buff *skb;
	int quote;
	int quote;
	u8 type;


	__check_timeout(hdev, cnt);
	__check_timeout(hdev, cnt);


	BT_DBG("%s", hdev->name);

	if (hdev->dev_type == HCI_AMP)
		type = AMP_LINK;
	else
		type = ACL_LINK;

	while (hdev->block_cnt > 0 &&
	while (hdev->block_cnt > 0 &&
	       (chan = hci_chan_sent(hdev, ACL_LINK, &quote))) {
	       (chan = hci_chan_sent(hdev, type, &quote))) {
		u32 priority = (skb_peek(&chan->data_q))->priority;
		u32 priority = (skb_peek(&chan->data_q))->priority;
		while (quote > 0 && (skb = skb_peek(&chan->data_q))) {
		while (quote > 0 && (skb = skb_peek(&chan->data_q))) {
			int blocks;
			int blocks;
@@ -2545,14 +2556,19 @@ static void hci_sched_acl_blk(struct hci_dev *hdev)
	}
	}


	if (cnt != hdev->block_cnt)
	if (cnt != hdev->block_cnt)
		hci_prio_recalculate(hdev, ACL_LINK);
		hci_prio_recalculate(hdev, type);
}
}


static void hci_sched_acl(struct hci_dev *hdev)
static void hci_sched_acl(struct hci_dev *hdev)
{
{
	BT_DBG("%s", hdev->name);
	BT_DBG("%s", hdev->name);


	if (!hci_conn_num(hdev, ACL_LINK))
	/* No ACL link over BR/EDR controller */
	if (!hci_conn_num(hdev, ACL_LINK) && hdev->dev_type == HCI_BREDR)
		return;

	/* No AMP link over AMP controller */
	if (!hci_conn_num(hdev, AMP_LINK) && hdev->dev_type == HCI_AMP)
		return;
		return;


	switch (hdev->flow_ctl_mode) {
	switch (hdev->flow_ctl_mode) {
+1 −0
Original line number Original line Diff line number Diff line
@@ -2733,6 +2733,7 @@ static void hci_num_comp_blocks_evt(struct hci_dev *hdev, struct sk_buff *skb)


		switch (conn->type) {
		switch (conn->type) {
		case ACL_LINK:
		case ACL_LINK:
		case AMP_LINK:
			hdev->block_cnt += block_count;
			hdev->block_cnt += block_count;
			if (hdev->block_cnt > hdev->num_blocks)
			if (hdev->block_cnt > hdev->num_blocks)
				hdev->block_cnt = hdev->num_blocks;
				hdev->block_cnt = hdev->num_blocks;