Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response
@ 2025-02-14 15:37 Luiz Augusto von Dentz
  2025-02-14 16:35 ` [v1] " bluez.test.bot
  0 siblings, 1 reply; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2025-02-14 15:37 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

L2CAP_ECRED_CONN_RSP needs to respond DCID in the same order received as
SCID but the order is reversed due to use of list_add which actually
prepend channels to the list so the response is reversed:

> ACL Data RX: Handle 16 flags 0x02 dlen 26
      LE L2CAP: Enhanced Credit Connection Request (0x17) ident 2 len 18
        PSM: 39 (0x0027)
        MTU: 256
        MPS: 251
        Credits: 65535
        Source CID: 116
        Source CID: 117
        Source CID: 118
        Source CID: 119
        Source CID: 120
< ACL Data TX: Handle 16 flags 0x00 dlen 26
      LE L2CAP: Enhanced Credit Connection Response (0x18) ident 2 len 18
        MTU: 517
        MPS: 247
        Credits: 3
        Result: Connection successful (0x0000)
        Destination CID: 68
        Destination CID: 67
        Destination CID: 66
        Destination CID: 65
        Destination CID: 64

Closes: https://github.com/bluez/bluez/issues/1094
Fixes: 9aa9d9473f15 ("Bluetooth: L2CAP: Fix responding with wrong PDU type")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/l2cap_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index fec11e576f31..2ffb8c35dbe2 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -632,7 +632,8 @@ void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
 	    test_bit(FLAG_HOLD_HCI_CONN, &chan->flags))
 		hci_conn_hold(conn->hcon);
 
-	list_add(&chan->list, &conn->chan_l);
+	/* Append to the list since the order matters for ECRED */
+	list_add_tail(&chan->list, &conn->chan_l);
 }
 
 void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
-- 
2.48.1


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

* RE: [v1] Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response
  2025-02-14 15:37 [PATCH v1] Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response Luiz Augusto von Dentz
@ 2025-02-14 16:35 ` bluez.test.bot
  2025-02-14 17:10   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 6+ messages in thread
From: bluez.test.bot @ 2025-02-14 16:35 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 3441 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=934075

---Test result---

Test Summary:
CheckPatch                    PENDING   0.40 seconds
GitLint                       PENDING   0.32 seconds
SubjectPrefix                 PASS      0.41 seconds
BuildKernel                   PASS      23.77 seconds
CheckAllWarning               PASS      26.41 seconds
CheckSparse                   PASS      29.88 seconds
BuildKernel32                 PASS      23.75 seconds
TestRunnerSetup               PASS      430.58 seconds
TestRunner_l2cap-tester       PASS      20.96 seconds
TestRunner_iso-tester         FAIL      146.20 seconds
TestRunner_bnep-tester        PASS      4.90 seconds
TestRunner_mgmt-tester        FAIL      128.43 seconds
TestRunner_rfcomm-tester      PASS      8.10 seconds
TestRunner_sco-tester         PASS      9.56 seconds
TestRunner_ioctl-tester       PASS      8.34 seconds
TestRunner_mesh-tester        FAIL      6.32 seconds
TestRunner_smp-tester         PASS      7.23 seconds
TestRunner_userchan-tester    PASS      4.99 seconds
IncrementalBuild              PENDING   0.77 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 125, Passed: 109 (87.2%), Failed: 12, Not Run: 4

Failed Test Cases
ISO Connect2 CIG 0x01 - Success                      Timed out    2.745 seconds
ISO Defer Connect2 CIG 0x01 - Success                Timed out    2.263 seconds
ISO Connected2 Suspend - Success                     Timed out    4.786 seconds
ISO AC 6(ii) - Success                               Timed out    1.888 seconds
ISO AC 7(ii) - Success                               Timed out    2.508 seconds
ISO AC 8(ii) - Success                               Timed out    2.503 seconds
ISO AC 9(ii) - Success                               Timed out    2.536 seconds
ISO AC 11(ii) - Success                              Timed out    2.501 seconds
ISO AC 1 + 2 - Success                               Timed out    1.980 seconds
ISO AC 1 + 2 CIG 0x01/0x02 - Success                 Timed out    1.998 seconds
ISO Reconnect AC 6(i) - Success                      Timed out    2.017 seconds
ISO Reconnect AC 6(ii) - Success                     Timed out    1.999 seconds
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4

Failed Test Cases
LL Privacy - Add Device 3 (AL is full)               Failed       0.194 seconds
LL Privacy - Set Flags 2 (Enable RL)                 Failed       0.134 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 9 (90.0%), Failed: 1, Not Run: 0

Failed Test Cases
Mesh - Send cancel - 2                               Failed       0.119 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


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

* Re: [v1] Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response
  2025-02-14 16:35 ` [v1] " bluez.test.bot
@ 2025-02-14 17:10   ` Luiz Augusto von Dentz
  2025-02-14 17:59     ` Arkadiusz Bokowy
       [not found]     ` <CAGFh026Kopho-c3Oi2JmwY1SynYGnh2pcPf3-Y6Dzkjm4-hGjA@mail.gmail.com>
  0 siblings, 2 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2025-02-14 17:10 UTC (permalink / raw)
  To: linux-bluetooth, Arkadiusz Bokowy

Hi Arkadiusz,

On Fri, Feb 14, 2025 at 11:35 AM <bluez.test.bot@gmail.com> wrote:
>
> This is automated email and please do not reply to this email!
>
> Dear submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=934075
>
> ---Test result---
>
> Test Summary:
> CheckPatch                    PENDING   0.40 seconds
> GitLint                       PENDING   0.32 seconds
> SubjectPrefix                 PASS      0.41 seconds
> BuildKernel                   PASS      23.77 seconds
> CheckAllWarning               PASS      26.41 seconds
> CheckSparse                   PASS      29.88 seconds
> BuildKernel32                 PASS      23.75 seconds
> TestRunnerSetup               PASS      430.58 seconds
> TestRunner_l2cap-tester       PASS      20.96 seconds
> TestRunner_iso-tester         FAIL      146.20 seconds
> TestRunner_bnep-tester        PASS      4.90 seconds
> TestRunner_mgmt-tester        FAIL      128.43 seconds
> TestRunner_rfcomm-tester      PASS      8.10 seconds
> TestRunner_sco-tester         PASS      9.56 seconds
> TestRunner_ioctl-tester       PASS      8.34 seconds
> TestRunner_mesh-tester        FAIL      6.32 seconds
> TestRunner_smp-tester         PASS      7.23 seconds
> TestRunner_userchan-tester    PASS      4.99 seconds
> IncrementalBuild              PENDING   0.77 seconds
>
> Details
> ##############################
> Test: CheckPatch - PENDING
> Desc: Run checkpatch.pl script
> Output:
>
> ##############################
> Test: GitLint - PENDING
> Desc: Run gitlint
> Output:
>
> ##############################
> Test: TestRunner_iso-tester - FAIL
> Desc: Run iso-tester with test-runner
> Output:
> Total: 125, Passed: 109 (87.2%), Failed: 12, Not Run: 4
>
> Failed Test Cases
> ISO Connect2 CIG 0x01 - Success                      Timed out    2.745 seconds
> ISO Defer Connect2 CIG 0x01 - Success                Timed out    2.263 seconds
> ISO Connected2 Suspend - Success                     Timed out    4.786 seconds
> ISO AC 6(ii) - Success                               Timed out    1.888 seconds
> ISO AC 7(ii) - Success                               Timed out    2.508 seconds
> ISO AC 8(ii) - Success                               Timed out    2.503 seconds
> ISO AC 9(ii) - Success                               Timed out    2.536 seconds
> ISO AC 11(ii) - Success                              Timed out    2.501 seconds
> ISO AC 1 + 2 - Success                               Timed out    1.980 seconds
> ISO AC 1 + 2 CIG 0x01/0x02 - Success                 Timed out    1.998 seconds
> ISO Reconnect AC 6(i) - Success                      Timed out    2.017 seconds
> ISO Reconnect AC 6(ii) - Success                     Timed out    1.999 seconds
> ##############################
> Test: TestRunner_mgmt-tester - FAIL
> Desc: Run mgmt-tester with test-runner
> Output:
> Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4

Looks like these errors are due to fa4d477ab535 ("btdev: Broadcast
EXT_ADV packets based on its interval"), if I revert it passes all
tests, so something is not quite right with it or we need to fix
iso-tester. It seems you remove scan_ext_adv from
cmd_set_ext_scan_enable_complete, I suspect that is the reason since
it probably no longer pickup things immediately which makes a lot of
tests very slow.

> Failed Test Cases
> LL Privacy - Add Device 3 (AL is full)               Failed       0.194 seconds
> LL Privacy - Set Flags 2 (Enable RL)                 Failed       0.134 seconds
> ##############################
> Test: TestRunner_mesh-tester - FAIL
> Desc: Run mesh-tester with test-runner
> Output:
> Total: 10, Passed: 9 (90.0%), Failed: 1, Not Run: 0
>
> Failed Test Cases
> Mesh - Send cancel - 2                               Failed       0.119 seconds
> ##############################
> Test: IncrementalBuild - PENDING
> Desc: Incremental build with the patches in the series
> Output:
>
>
>
> ---
> Regards,
> Linux Bluetooth
>


-- 
Luiz Augusto von Dentz

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

* Re: [v1] Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response
  2025-02-14 17:10   ` Luiz Augusto von Dentz
@ 2025-02-14 17:59     ` Arkadiusz Bokowy
       [not found]     ` <CAGFh026Kopho-c3Oi2JmwY1SynYGnh2pcPf3-Y6Dzkjm4-hGjA@mail.gmail.com>
  1 sibling, 0 replies; 6+ messages in thread
From: Arkadiusz Bokowy @ 2025-02-14 17:59 UTC (permalink / raw)
  To: linux-bluetooth

> Looks like these errors are due to fa4d477ab535 ("btdev: Broadcast
> EXT_ADV packets based on its interval"), if I revert it passes all
> tests, so something is not quite right with it or we need to fix
> iso-tester. It seems you remove scan_ext_adv from
> cmd_set_ext_scan_enable_complete, I suspect that is the reason since
> it probably no longer pickup things immediately which makes a lot of
> tests very slow.

Hmm... OK, I'll look at it over the weekend and I will try to fix it.
Maybe I will have more luck with setting up a proper testing setup
this time.

Anyway, It's strange that this was not caught by the CI:
https://marc.info/?l=linux-bluetooth&m=173945291115583&w=2

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

* Re: [v1] Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response
       [not found]     ` <CAGFh026Kopho-c3Oi2JmwY1SynYGnh2pcPf3-Y6Dzkjm4-hGjA@mail.gmail.com>
@ 2025-02-14 18:05       ` Luiz Augusto von Dentz
  2025-02-15 20:56         ` Arkadiusz Bokowy
  0 siblings, 1 reply; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2025-02-14 18:05 UTC (permalink / raw)
  To: Arkadiusz Bokowy; +Cc: linux-bluetooth

Hi Arkadiusz,

On Fri, Feb 14, 2025 at 12:56 PM Arkadiusz Bokowy
<arkadiusz.bokowy@gmail.com> wrote:
>
> > Looks like these errors are due to fa4d477ab535 ("btdev: Broadcast
> > EXT_ADV packets based on its interval"), if I revert it passes all
> > tests, so something is not quite right with it or we need to fix
> > iso-tester. It seems you remove scan_ext_adv from
> > cmd_set_ext_scan_enable_complete, I suspect that is the reason since
> > it probably no longer pickup things immediately which makes a lot of
> > tests very slow.
>
> Hmm... OK, I'll look at it over the weekend and I will try to fix it. Maybe I will have more luck with setting up a proper testing setup this time.
>
> Anyway, It's strange that this was not caught by the CI: https://marc.info/?l=linux-bluetooth&m=173945291115583&w=2

That is because the kernel CI that uses the testers, not BlueZ, we
could perhaps attempt to run Kernel CI with userspace changes like
this but then we need some logic to detect when something related to
kernel CI is changed e.g. emulator changes.

-- 
Luiz Augusto von Dentz

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

* Re: [v1] Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response
  2025-02-14 18:05       ` Luiz Augusto von Dentz
@ 2025-02-15 20:56         ` Arkadiusz Bokowy
  0 siblings, 0 replies; 6+ messages in thread
From: Arkadiusz Bokowy @ 2025-02-15 20:56 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

>> Looks like these errors are due to fa4d477ab535 ("btdev: Broadcast
>> EXT_ADV packets based on its interval"), if I revert it passes all
>> tests, so something is not quite right with it or we need to fix
>> iso-tester. It seems you remove scan_ext_adv from
>> cmd_set_ext_scan_enable_complete, I suspect that is the reason since
>> it probably no longer pickup things immediately which makes a lot of
>> tests very slow.
>
> Hmm... OK, I'll look at it over the weekend and I will try to fix it. Maybe I will have more luck with setting up a proper testing setup this time.

This time I've tried a different setup for running tests and I was
able to run more of them. However, not with a 100% success rate yet...
Failing tests:
- L2CAP LE Client - Write 32k Success
- Mesh - Read Mesh Features
- Mesh - Read Mesh Features - Disabled
- all tests in tools/ioctl-tester (maybe my kernel mises some feature,
but I'm not sure which)

So, I was able to verify the patch properly this time. The "v2 -
bthost: Set advertising intervals to valid value" passes all mgmt
tests and ISO tests in particular.

Regards,
Arek

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

end of thread, other threads:[~2025-02-15 20:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-14 15:37 [PATCH v1] Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response Luiz Augusto von Dentz
2025-02-14 16:35 ` [v1] " bluez.test.bot
2025-02-14 17:10   ` Luiz Augusto von Dentz
2025-02-14 17:59     ` Arkadiusz Bokowy
     [not found]     ` <CAGFh026Kopho-c3Oi2JmwY1SynYGnh2pcPf3-Y6Dzkjm4-hGjA@mail.gmail.com>
2025-02-14 18:05       ` Luiz Augusto von Dentz
2025-02-15 20:56         ` Arkadiusz Bokowy

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