From patchwork Fri Aug 5 21:56:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 595596 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAF23C25B08 for ; Fri, 5 Aug 2022 21:59:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241814AbiHEV7E (ORCPT ); Fri, 5 Aug 2022 17:59:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241728AbiHEV6l (ORCPT ); Fri, 5 Aug 2022 17:58:41 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CDC680480 for ; Fri, 5 Aug 2022 14:56:26 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id c19-20020a17090ae11300b001f2f94ed5c6so8261926pjz.1 for ; Fri, 05 Aug 2022 14:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ihsODam4fhUsGf7+sq5s4Ez5Ukgxqbms2G1kVORuuRE=; b=ZTGUqgMkYIN99pth/0dZn5rDsOr4/kaw+SRkIeUYGmWqf/PEAWDb4qammQ/AZkh+tM q70PBKFDC1I5UiaGvt8cRf1M585xqEejOdt8cYgJ9k0P/VbLJQdB54yJqyxPEdfXfZMd vv8mjsjOiSwcK9wsrGt8Ne3RPzclflkzejxLHl7Usnu5MKiG85eJTC5qkL2GXsd25JjY /EjgDIB/VnMu1iRqAtIYHR9uZdsno0U2f+oLJXQlezv2q3pN/9DvuVLy6iJxJTIqcsqq C3ioXo5Z6IhPdghFBPYdDwoJXplIfViodg39DEMcltud882wiAmMi0T8oa57DCauX1gc Grhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ihsODam4fhUsGf7+sq5s4Ez5Ukgxqbms2G1kVORuuRE=; b=qTreyyxpWXmLR0AqzmO6Kap6/qjFxs3SegOYihKjfQDNbcR6eVhPf1X14e8tzFbIah mCZLHTkl3h3HuDJlamk9r55pfopeZhXXacw/hpEVS7GneGe/8Eabj0NWz5ISas3KzV86 7EQHwPqxZPe5KRVZv8pII5P3BCp7POjNsn/ungOn7rdotzG+hZ0fjWDv8VX+ctrKZSQ4 2qLDl/HBZbdwXxkjzMd3efTh0+oaGlTy8ZJcJ5O9qkQ/iwVXqGkE8FSIB3MgEgx/jaJ5 0RKBUVsLsHhgm7/uM4hbDN+CKpXVqj0w7qXCi47HI68x6XaWl9DhvhH10usr3FQ4fOXt g0Tw== X-Gm-Message-State: ACgBeo0yTRqD4nvLIqa0jzJ6iu/rxh+d9NncvQvyjQJDG4EiHnREp4yG ZvUrUK9DpUTjLVUh0ur6VYiLN3ECUFyl3g== X-Google-Smtp-Source: AA6agR7sfvsNxvZ/CgcEUch0E8fSWxkWll3lJrdxWHQzAxZkLPyMLSaOcKRwxJVNeqkw11EZjbmLHA== X-Received: by 2002:a17:90b:3711:b0:1f5:179c:ad64 with SMTP id mg17-20020a17090b371100b001f5179cad64mr17612851pjb.11.1659736585039; Fri, 05 Aug 2022 14:56:25 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id 13-20020a62190d000000b0052d4ffac466sm3447036pfz.188.2022.08.05.14.56.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 14:56:23 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/2] bthost: Add qos support to bthost_set_cig_params Date: Fri, 5 Aug 2022 14:56:21 -0700 Message-Id: <20220805215622.3958723-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This enables setting QoS other then the mandatory 16_2_1. --- emulator/bthost.c | 26 +++++++++++++++----------- emulator/bthost.h | 4 +++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/emulator/bthost.c b/emulator/bthost.c index 75fa625b1..f067d39a0 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -3131,25 +3131,29 @@ bool bthost_search_ext_adv_addr(struct bthost *bthost, const uint8_t *addr) } void bthost_set_cig_params(struct bthost *bthost, uint8_t cig_id, - uint8_t cis_id) + uint8_t cis_id, const struct bt_iso_qos *qos) { struct bt_hci_cmd_le_set_cig_params *cp; cp = malloc(sizeof(*cp) + sizeof(*cp->cis)); memset(cp, 0, sizeof(*cp) + sizeof(*cp->cis)); cp->cig_id = cig_id; - put_le24(10000, cp->c_interval); - put_le24(10000, cp->p_interval); - cp->c_latency = cpu_to_le16(10); - cp->p_latency = cpu_to_le16(10); + put_le24(qos->in.interval ? qos->in.interval : qos->out.interval, + cp->c_interval); + put_le24(qos->out.interval ? qos->out.interval : qos->in.interval, + cp->p_interval); + cp->c_latency = cpu_to_le16(qos->in.latency ? qos->in.latency : + qos->out.latency); + cp->p_latency = cpu_to_le16(qos->out.latency ? qos->out.latency : + qos->in.latency); cp->num_cis = 0x01; cp->cis[0].cis_id = cis_id; - cp->cis[0].c_sdu = 40; - cp->cis[0].p_sdu = 40; - cp->cis[0].c_phy = 0x02; - cp->cis[0].p_phy = 0x02; - cp->cis[0].c_rtn = 2; - cp->cis[0].p_rtn = 2; + cp->cis[0].c_sdu = qos->in.sdu; + cp->cis[0].p_sdu = qos->out.sdu; + cp->cis[0].c_phy = qos->in.phy ? qos->in.phy : qos->out.phy; + cp->cis[0].p_phy = qos->out.phy ? qos->out.phy : qos->in.phy; + cp->cis[0].c_rtn = qos->in.rtn; + cp->cis[0].p_rtn = qos->out.rtn; send_command(bthost, BT_HCI_CMD_LE_SET_CIG_PARAMS, cp, sizeof(*cp) + sizeof(*cp->cis)); diff --git a/emulator/bthost.h b/emulator/bthost.h index fd177ac29..3d7a124f0 100644 --- a/emulator/bthost.h +++ b/emulator/bthost.h @@ -12,6 +12,8 @@ #include #include +#include "lib/bluetooth.h" + typedef void (*bthost_send_func) (const struct iovec *iov, int iovlen, void *user_data); @@ -101,7 +103,7 @@ void bthost_create_big(struct bthost *bthost, uint8_t num_bis); bool bthost_search_ext_adv_addr(struct bthost *bthost, const uint8_t *addr); void bthost_set_cig_params(struct bthost *bthost, uint8_t cig_id, - uint8_t cis_id); + uint8_t cis_id, const struct bt_iso_qos *qos); void bthost_create_cis(struct bthost *bthost, uint16_t cis_handle, uint16_t acl_handle); From patchwork Fri Aug 5 21:56:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 596045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5DD5C00140 for ; Fri, 5 Aug 2022 21:59:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241804AbiHEV7L (ORCPT ); Fri, 5 Aug 2022 17:59:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241756AbiHEV6r (ORCPT ); Fri, 5 Aug 2022 17:58:47 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD52E7D1ED for ; Fri, 5 Aug 2022 14:56:28 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id v16-20020a17090abb9000b001f25244c65dso9436534pjr.2 for ; Fri, 05 Aug 2022 14:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=9f9AWVp7VcaHr2xN9dHaI/ZYFXw1Uu6aa7/4yC21DJk=; b=Nx8Y/C5Dk/Nbm0JZ2GkSdnz/yiWpgl4Ymk++ZSbJNvfDG8cH3VCjHd28c1ojpHCty9 fe+j5FOBHUMNswOu3uMWHNEzYtoZ0Pe6LcJgmBuVG6GNCz4aeGIs9v63fXfkIgOTQhSq ELQ1/fA/QTi7CQ15EZRCXBvaP5VklRzo/MlqjJCLFYuXh+xPLoEExTMggZqXwrmmvWgM 6w3CYh8Ernotmh5y+o2G5/o6EzDCcMNFruNqdHANCp4jk3a4QSoT5bpHFSap7A+A8Zsj wQI+ZqB1OKUhYuUiswmiVLadgb0e8T8zKpS2TmFSRsZt1RrI3DFhpyeBNsYqRGDIU9YI OM1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9f9AWVp7VcaHr2xN9dHaI/ZYFXw1Uu6aa7/4yC21DJk=; b=lISIxVyOJvxkeLsjnkGRVUM2qdTozuDxPu6cu7COztWMaOAwaBRBkXXtzzo1w2BJvy mNuHvoKrYvOQe/MI9kN5KwvmupbgwQ+T078eJgTbtsvtbfYUPlwNbOGwTMp/4OsqrUtT 6PG3d/AhcPvxHYz4iIGBuF4HQXXkPGuptSLLEJplPGfUc40+5YvYFSCd/ktUWsJwOa3I FwiyUZTIkT4sl9+DvF+FQBk64pecsU6hFkJ8eoMu/XB5DT3+Z58GqXf3uGRFQtI9r4P6 Vg5UpM+3XovFkVnXu45ovCYx9WzjiohnuDbYxDeiYrRFbc0D4pR38u4dmIhiQ5iopv9Z glAw== X-Gm-Message-State: ACgBeo3qnG06/wxL0C16tE0gK7uwH4lEfvapJeU5AXlfH0MMh1HUnvMV KX4oohwrpegfRZ7KzS9ijtSacgbfhNqq4w== X-Google-Smtp-Source: AA6agR5SaHANEPWLgI3LlNSr8QfBuaAoLxdQiqqNQnXgRIdwC+XY51ea3VmbR6AfITaC8pc8U2lMjQ== X-Received: by 2002:a17:90b:1807:b0:1f5:7835:7fbc with SMTP id lw7-20020a17090b180700b001f578357fbcmr8309784pjb.170.1659736587448; Fri, 05 Aug 2022 14:56:27 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id 13-20020a62190d000000b0052d4ffac466sm3447036pfz.188.2022.08.05.14.56.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 14:56:26 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 2/2] iso-tester: Add ISO 48_2_1 Defer Receive - Success Date: Fri, 5 Aug 2022 14:56:22 -0700 Message-Id: <20220805215622.3958723-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220805215622.3958723-1-luiz.dentz@gmail.com> References: <20220805215622.3958723-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds a test to check if different QoS are properly handled when acting as peripheral. --- tools/iso-tester.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/iso-tester.c b/tools/iso-tester.c index 56c17b78b..df46bc953 100644 --- a/tools/iso-tester.c +++ b/tools/iso-tester.c @@ -541,6 +541,12 @@ static const struct iovec send_16_2_1 = { .iov_len = sizeof(data_16_2_1), }; +static const uint8_t data_48_2_1[100] = { [0 ... 99] = 0xff }; +static const struct iovec send_48_2_1 = { + .iov_base = (void *)data_48_2_1, + .iov_len = sizeof(data_48_2_1), +}; + static const struct iso_client_data connect_16_2_1_send = { .qos = QOS_16_2_1, .expect_err = 0, @@ -582,6 +588,14 @@ static const struct iso_client_data listen_16_2_1_defer_recv = { .defer = true, }; +static const struct iso_client_data listen_48_2_1_defer_recv = { + .qos = QOS_48_2_1, + .expect_err = 0, + .recv = &send_48_2_1, + .server = true, + .defer = true, +}; + static const struct iso_client_data listen_16_2_1_defer_reject = { .qos = QOS_16_2_1, .expect_err = -1, @@ -973,7 +987,7 @@ static bool check_io_qos(const struct bt_iso_io_qos *io1, return false; } - if (io1->sdu != io2->sdu) { + if (io1->sdu && io2->sdu && io1->sdu != io2->sdu) { tester_warn("Unexpected IO SDU: %u != %u", io1->sdu, io2->sdu); return false; } @@ -1450,7 +1464,7 @@ static void setup_listen(struct test_data *data, uint8_t num, GIOFunc func) client = hciemu_get_client(data->hciemu, 0); host = hciemu_client_host(client); - bthost_set_cig_params(host, 0x01, 0x01); + bthost_set_cig_params(host, 0x01, 0x01, &isodata->qos); bthost_create_cis(host, 257, data->acl_handle); } } @@ -1701,6 +1715,10 @@ int main(int argc, char *argv[]) test_iso("ISO Defer Receive - Success", &listen_16_2_1_defer_recv, setup_powered, test_listen); + test_iso("ISO 48_2_1 Defer Receive - Success", + &listen_48_2_1_defer_recv, + setup_powered, test_listen); + test_iso("ISO Defer Reject - Success", &listen_16_2_1_defer_reject, setup_powered, test_listen);