public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hci_event: handling CIS QoS
@ 2022-11-16 14:33 Abhay Maheta
  2022-11-16 15:03 ` bluez.test.bot
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Abhay Maheta @ 2022-11-16 14:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Abhay Maheta

This sets QoS on CIS connction establishement.

Signed-off-by: Abhay Maheta <abhay.maheshbhai.maheta@intel.com>
---
 net/bluetooth/hci_event.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index faca701bce2a..d04af3ad6b73 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -6778,6 +6778,7 @@ static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data,
 	struct hci_evt_le_cis_established *ev = data;
 	struct hci_conn *conn;
 	u16 handle = __le16_to_cpu(ev->handle);
+	__le32 interval;
 
 	bt_dev_dbg(hdev, "status 0x%2.2x", ev->status);
 
@@ -6798,22 +6799,25 @@ static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data,
 		goto unlock;
 	}
 
-	if (conn->role == HCI_ROLE_SLAVE) {
-		__le32 interval;
+	memset(&interval, 0, sizeof(interval));
+	memcpy(&interval, ev->c_latency, sizeof(ev->c_latency));
+	/* Converting from microseconds to milliseconds */
+	conn->iso_qos.in.latency = (__u16)(le16_to_cpu(interval) / 1000);
 
-		memset(&interval, 0, sizeof(interval));
+	memcpy(&interval, ev->p_latency, sizeof(ev->p_latency));
+	/* Converting from microseconds to milliseconds */
+	conn->iso_qos.out.latency = (__u16)(le16_to_cpu(interval) / 1000);
 
-		memcpy(&interval, ev->c_latency, sizeof(ev->c_latency));
-		conn->iso_qos.in.interval = le32_to_cpu(interval);
-		memcpy(&interval, ev->p_latency, sizeof(ev->p_latency));
-		conn->iso_qos.out.interval = le32_to_cpu(interval);
-		conn->iso_qos.in.latency = le16_to_cpu(ev->interval);
-		conn->iso_qos.out.latency = le16_to_cpu(ev->interval);
-		conn->iso_qos.in.sdu = le16_to_cpu(ev->c_mtu);
-		conn->iso_qos.out.sdu = le16_to_cpu(ev->p_mtu);
-		conn->iso_qos.in.phy = ev->c_phy;
-		conn->iso_qos.out.phy = ev->p_phy;
-	}
+	/* Converting interval to microseconds */
+	conn->iso_qos.in.interval =
+		(__u32)((le32_to_cpu(ev->interval) * 125 / 100) * 1000);
+	conn->iso_qos.out.interval =
+		(__u32)((le32_to_cpu(ev->interval) * 125 / 100) * 1000);
+
+	conn->iso_qos.in.sdu = le16_to_cpu(ev->c_mtu);
+	conn->iso_qos.out.sdu = le16_to_cpu(ev->p_mtu);
+	conn->iso_qos.in.phy = ev->c_phy;
+	conn->iso_qos.out.phy = ev->p_phy;
 
 	if (!ev->status) {
 		conn->state = BT_CONNECTED;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-18  7:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-16 14:33 [PATCH] hci_event: handling CIS QoS Abhay Maheta
2022-11-16 15:03 ` bluez.test.bot
2022-11-16 21:28   ` Luiz Augusto von Dentz
2022-11-16 15:27 ` [PATCH] " Paul Menzel
2022-11-16 23:01 ` kernel test robot
2022-11-18  4:15 ` bluez.test.bot
2022-11-18  5:05 ` bluez.test.bot
2022-11-18  5:56 ` bluez.test.bot
2022-11-18  7:07 ` bluez.test.bot
2022-11-18  7:54 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox