• Iulia Tanasescu's avatar
    Bluetooth: ISO: Add support for connecting multiple BISes · a0bfde16
    Iulia Tanasescu authored
    It is required for some configurations to have multiple BISes as part
    of the same BIG.
    
    Similar to the flow implemented for unicast, DEFER_SETUP will also be
    used to bind multiple BISes for the same BIG, before starting Periodic
    Advertising and creating the BIG.
    
    The user will have to open a new socket for each BIS. By setting the
    BT_DEFER_SETUP socket option and calling connect, a new connection
    will be added for the BIG and advertising handle set by the socket
    QoS parameters. Since all BISes will be bound for the same BIG and
    advertising handle, the socket QoS options and base parameters should
    match for all connections.
    
    By calling connect on a socket that does not have the BT_DEFER_SETUP
    option set, periodic advertising will be started and the BIG will
    be created, with a BIS for each previously bound connection. Since
    a BIG cannot be reconfigured with additional BISes after creation,
    no more connections can be bound for the BIG after the start periodic
    advertising and create BIG commands have been queued.
    
    The bis_cleanup function has also been updated, so that the advertising
    set and the BIG will not be terminated unless there are no more
    bound or connected BISes.
    
    The HCI_CONN_BIG_CREATED connection flag has been added to indicate
    that the BIG has been successfully created. This flag is checked at
    bis_cleanup, so that the BIG is only terminated if the
    HCI_LE_Create_BIG_Complete has been received.
    
    This implementation has been tested on hardware, using the "isotest"
    tool with an additional command line option, to specify the number of
    BISes to create as part of the desired BIG:
    
        tools/isotest -i hci0 -s 00:00:00:00:00:00 -N 2 -G 1 -T 1
    
    The btmon log shows that a BIG containing 2 BISes has been created:
    
    < HCI Command: LE Create Broadcast Isochronous Group (0x08|0x0068) plen 31
            Handle: 0x01
            Advertising Handle: 0x01
            Number of BIS: 2
            SDU Interval: 10000 us (0x002710)
            Maximum SDU size: 40
            Maximum Latency: 10 ms (0x000a)
            RTN: 0x02
            PHY: LE 2M (0x02)
            Packing: Sequential (0x00)
            Framing: Unframed (0x00)
            Encryption: 0x00
            Broadcast Code: 00000000000000000000000000000000
    
    > HCI Event: Command Status (0x0f) plen 4
          LE Create Broadcast Isochronous Group (0x08|0x0068) ncmd 1
            Status: Success (0x00)
    
    > HCI Event: LE Meta Event (0x3e) plen 23
          LE Broadcast Isochronous Group Complete (0x1b)
            Status: Success (0x00)
            Handle: 0x01
            BIG Synchronization Delay: 1974 us (0x0007b6)
            Transport Latency: 1974 us (0x0007b6)
            PHY: LE 2M (0x02)
            NSE: 3
            BN: 1
            PTO: 1
            IRC: 3
            Maximum PDU: 40
            ISO Interval: 10.00 msec (0x0008)
            Connection Handle #0: 10
            Connection Handle #1: 11
    
    < HCI Command: LE Setup Isochronous Data Path (0x08|0x006e) plen 13
            Handle: 10
            Data Path Direction: Input (Host to Controller) (0x00)
            Data Path: HCI (0x00)
            Coding Format: Transparent (0x03)
            Company Codec ID: Ericsson Technology Licensing (0)
            Vendor Codec ID: 0
            Controller Delay: 0 us (0x000000)
            Codec Configuration Length: 0
            Codec Configuration:
    
    > HCI Event: Command Complete (0x0e) plen 6
          LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
            Status: Success (0x00)
            Handle: 10
    
    < HCI Command: LE Setup Isochronous Data Path (0x08|0x006e) plen 13
            Handle: 11
            Data Path Direction: Input (Host to Controller) (0x00)
            Data Path: HCI (0x00)
            Coding Format: Transparent (0x03)
            Company Codec ID: Ericsson Technology Licensing (0)
            Vendor Codec ID: 0
            Controller Delay: 0 us (0x000000)
            Codec Configuration Length: 0
            Codec Configuration:
    
    > HCI Event: Command Complete (0x0e) plen 6
          LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
            Status: Success (0x00)
            Handle: 11
    
    < ISO Data TX: Handle 10 flags 0x02 dlen 44
    
    < ISO Data TX: Handle 11 flags 0x02 dlen 44
    
    > HCI Event: Number of Completed Packets (0x13) plen 5
            Num handles: 1
            Handle: 10
            Count: 1
    
    > HCI Event: Number of Completed Packets (0x13) plen 5
            Num handles: 1
            Handle: 11
            Count: 1
    Signed-off-by: default avatarIulia Tanasescu <iulia.tanasescu@nxp.com>
    Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
    a0bfde16
hci_conn.c 73.5 KB