]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: ISO: Rework sync_interval to be sync_factor
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 8 Jun 2023 18:12:18 +0000 (11:12 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 29 Jun 2023 17:52:18 +0000 (10:52 -0700)
This rework sync_interval to be sync_factor as having sync_interval in
the order of seconds is sometimes not disarable.

Wit sync_factor the application can tell how many SDU intervals it wants
to send an announcement with PA, the EA interval is set to 2 times that
so a factor of 24 of BIG SDU interval of 10ms would look like the
following:

< HCI Command: LE Set Extended Advertising Parameters (0x08|0x0036) plen 25
        Handle: 0x01
        Properties: 0x0000
        Min advertising interval: 480.000 msec (0x0300)
        Max advertising interval: 480.000 msec (0x0300)
        Channel map: 37, 38, 39 (0x07)
        Own address type: Random (0x01)
        Peer address type: Public (0x00)
        Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
        Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
        TX power: Host has no preference (0x7f)
        Primary PHY: LE 1M (0x01)
        Secondary max skip: 0x00
        Secondary PHY: LE 2M (0x02)
        SID: 0x00
        Scan request notifications: Disabled (0x00)
< HCI Command: LE Set Periodic Advertising Parameters (0x08|0x003e) plen 7
        Handle: 1
        Min interval: 240.00 msec (0x00c0)
        Max interval: 240.00 msec (0x00c0)
        Properties: 0x0000

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/bluetooth/bluetooth.h
net/bluetooth/hci_conn.c
net/bluetooth/iso.c

index 1b4230cd42a37ea46e3ce96796e87cdcc43dac57..af729859385ed866350a032f2f721fbbf47157f1 100644 (file)
@@ -185,7 +185,7 @@ struct bt_iso_ucast_qos {
 struct bt_iso_bcast_qos {
        __u8  big;
        __u8  bis;
-       __u8  sync_interval;
+       __u8  sync_factor;
        __u8  packing;
        __u8  framing;
        struct bt_iso_io_qos in;
index 2275e0d9f8419a8f9cf19618d0a213ebac8f0d08..24407a974b9cc345e86f8688d0faaf3284f80377 100644 (file)
@@ -2075,10 +2075,10 @@ static int create_big_sync(struct hci_dev *hdev, void *data)
                flags |= MGMT_ADV_FLAG_SEC_2M;
 
        /* Align intervals */
-       interval = qos->bcast.out.interval / 1250;
+       interval = (qos->bcast.out.interval / 1250) * qos->bcast.sync_factor;
 
        if (qos->bcast.bis)
-               sync_interval = qos->bcast.sync_interval * 1600;
+               sync_interval = interval * 4;
 
        err = hci_start_per_adv_sync(hdev, qos->bcast.bis, conn->le_per_adv_data_len,
                                     conn->le_per_adv_data, flags, interval,
index 34d55a85d8f6f9f2117d1932a65a49f6901c3ccc..0e6cc57b3911ef12a7b7c619bb4abbfbea610b42 100644 (file)
@@ -704,7 +704,7 @@ static struct bt_iso_qos default_qos = {
        .bcast = {
                .big                    = BT_ISO_QOS_BIG_UNSET,
                .bis                    = BT_ISO_QOS_BIS_UNSET,
-               .sync_interval          = 0x00,
+               .sync_factor            = 0x01,
                .packing                = 0x00,
                .framing                = 0x00,
                .in                     = DEFAULT_IO_QOS,
@@ -1213,7 +1213,7 @@ static bool check_ucast_qos(struct bt_iso_qos *qos)
 
 static bool check_bcast_qos(struct bt_iso_qos *qos)
 {
-       if (qos->bcast.sync_interval > 0x07)
+       if (qos->bcast.sync_factor == 0x00)
                return false;
 
        if (qos->bcast.packing > 0x01)