diff --git a/doc/connectivity/bluetooth/bluetooth-le-host.rst b/doc/connectivity/bluetooth/bluetooth-le-host.rst index 26b21f8ca2b..3fad3425681 100644 --- a/doc/connectivity/bluetooth/bluetooth-le-host.rst +++ b/doc/connectivity/bluetooth/bluetooth-le-host.rst @@ -153,6 +153,119 @@ an application comes in direct contact with it only when using it in the so-called Connection-oriented Channels (CoC) mode. More information on this can be found in the :ref:`L2CAP API section `. +Terminology +----------- + +The definitions are from the Core Specification version 5.4, volume 3, part A +1.4. + +.. list-table:: + :header-rows: 1 + + * - Term + - Description + + * - Upper layer + - Layer above L2CAP, it exchanges data in form of SDUs. It may be an + application or a higher level protocol. + + * - Lower layer + - Layer below L2CAP, it exchanges data in form of PDUs (or fragments). It is + usually the HCI. + + * - Service Data Unit (SDU) + - Packet of data that L2CAP exchanges with the upper layer. + + This term is relevant only in Enhanced Retransmission mode, Streaming + mode, Retransmission mode and Flow Control Mode, not in Basic L2CAP mode. + + * - Protocol Data Unit (PDU) + - Packet of data containing L2CAP data. PDUs always start with Basic L2CAP + header. + + Types of PDUs for LE: :ref:`B-frames ` and + :ref:`K-frames `. + + Types of PDUs for BR/EDR: I-frames, S-frames, C-frames and G-frames. + + * - Maximum Transmission Unit (MTU) + - Maximum size of an SDU that the upper layer is capable of accepting. + + * - Maximum Payload Size (MPS) + - Maximum payload size that the L2CAP layer is capable of accepting. + + In Basic L2CAP mode, the MTU size is equal to MPS. In credit-based + channels without segmentation, the MTU is MPS minus 2. + + * - Basic L2CAP header + - Present at the beginning of each PDU. It contains two fields, the PDU + length and the Channel Identifier (CID). + +PDU Types +--------- + +.. _bluetooth_l2cap_b_frame: + +B-frame: Basic information frame +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +PDU used in Basic L2CAP mode. It contains the payload received from the upper +layer or delivered to the upper layer as its payload. + +.. image:: img/l2cap_b_frame.drawio.svg + :align: center + :width: 45% + :alt: Representation of a B-frame PDU. The PDU is split into two rectangles, + the first one being the L2CAP header, its size is 4 octets and its made + of the PDU length and the channel ID. The second rectangle represents + the information payload and its size is less or equal to MPS. + +.. _bluetooth_l2cap_k_frame: + +K-frame: Credit-based frame +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +PDU used in LE Credit Based Flow Control mode and Enhanced Credit Based Flow +Control mode. It contains a SDU segment and additional protocol information. + +.. image:: img/l2cap_k_frame_1.drawio.svg + :width: 45% + :alt: Representation of a starting K-frame PDU. The PDU is split into three + rectangles, the first one being the L2CAP header, its size is 4 octets + and its made of the PDU length and the channel ID. The second rectangle + represents the L2CAP SDU length, its size is 2 octets. The third + rectangle represents the information payload and its size is less or + equal to MPS minus 2 octets. The information payload contains the L2CAP + SDU. + +.. image:: img/l2cap_k_frame.drawio.svg + :align: right + :width: 45% + :alt: Representation of K-frames PDUs after the starting one. The PDU is split + into two rectangles, the first one being the L2CAP header, its size is 4 + octets and its made of the PDU length and the channel ID. The second + rectangle represents the information payload and its size is less or + equal to MPS. The information payload contains the L2CAP SDU. + +Relevant Kconfig +---------------- + +.. list-table:: + :header-rows: 1 + + * - Kconfig symbol + - Description + + * - :kconfig:option:`CONFIG_BT_BUF_ACL_RX_SIZE` + - Represents the MPS + + * - :kconfig:option:`CONFIG_BT_L2CAP_TX_MTU` + - Represents the L2CAP MTU + + * - :kconfig:option:`CONFIG_BT_L2CAP_DYNAMIC_CHANNEL` + - Enables LE Credit Based Flow Control and thus the stack may use + :ref:`K-frame ` PDUs + GATT ==== diff --git a/doc/connectivity/bluetooth/img/l2cap_b_frame.drawio.svg b/doc/connectivity/bluetooth/img/l2cap_b_frame.drawio.svg new file mode 100644 index 00000000000..fe1339030f2 --- /dev/null +++ b/doc/connectivity/bluetooth/img/l2cap_b_frame.drawio.svg @@ -0,0 +1,4 @@ + + + +
L2CAP HDR
(PDU length + channel ID)
Information Payload
B-frame PDU
4 octets
≤ MPS
\ No newline at end of file diff --git a/doc/connectivity/bluetooth/img/l2cap_k_frame.drawio.svg b/doc/connectivity/bluetooth/img/l2cap_k_frame.drawio.svg new file mode 100644 index 00000000000..fd94fd35c22 --- /dev/null +++ b/doc/connectivity/bluetooth/img/l2cap_k_frame.drawio.svg @@ -0,0 +1,4 @@ + + + +
L2CAP HDR
(PDU length + channel ID)
Information Payload (L2CAP SDU)
K-frame PDU (next ones)
4 octets
≤ MPS
\ No newline at end of file diff --git a/doc/connectivity/bluetooth/img/l2cap_k_frame_1.drawio.svg b/doc/connectivity/bluetooth/img/l2cap_k_frame_1.drawio.svg new file mode 100644 index 00000000000..2ff7c11d12b --- /dev/null +++ b/doc/connectivity/bluetooth/img/l2cap_k_frame_1.drawio.svg @@ -0,0 +1,4 @@ + + + +
L2CAP HDR
(PDU length + channel ID)
Information Payload
(L2CAP SDU)
K-frame PDU (first one)
4 octets
≤ MPS-2
L2CAP SDU length
2 octets
\ No newline at end of file