Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2863548rdb; Tue, 12 Sep 2023 14:48:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRaFijVKYw03sTcQdqdlrQc9Jj6PeILIx2pSFGWIhw7TwiVeacB03l2fLoPxa3H38UL/Tv X-Received: by 2002:a05:6808:5d0:b0:3a7:82e8:8fd1 with SMTP id d16-20020a05680805d000b003a782e88fd1mr997310oij.20.1694555313529; Tue, 12 Sep 2023 14:48:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694555313; cv=none; d=google.com; s=arc-20160816; b=k1c8udtjmivsSHwLfhoRUaQ6Bo9/plRkRqdH4UgnsmuEmu8bv4GYSD9k73h2I8d2GB 5mHF1Cd6ABEVzrnh1Kzo8MJOwaQ1sdJaa5wLq4shTMkVVwzP+y7zbxp1Mfl1qkIQIIRp DaZUOACQ5KgAJ8olSR9blTRJhW7E/vYLNj546bmPtJbupmBuKjo7mtcaAGY9Wqtqaocm Z/F7d9k8XCcrTuQqBItuJSdBi9/FE588YIlSjP7a82W/eq4Xe5wOUWUpqY02bXM307f8 ulLpUMRbTslxp24MPNAwPuScNd8BXTKAs8mK7HkZdz9n8k4ycVbgfcXFNPSmTx2LRxK5 h/Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=FHTeaXWUdZVddvHMf1/OUQRqRHd72N11rSxf4Q8vN/4=; fh=zpsGmPRThnOS0D8g6XiJgqE31wSFf5WMZAlzpIHSPz0=; b=Tq5CMplm0zV0gmM3BOQDdpqoKi9E7D4ty+yrfNTaqai4ZkVPXDauKpMp8vkJkkTVvj 8MflVLNCOkZqN4EYnw45zDXLKEXSeJucKj7PNLDvcvzpOvl6EKp5vDMpr7vs9ycN26+Z /cVB0gKTNFNzDJ9BxVNLhi/LG1Aw7m45JXLnWLjZ+DeLbOPSjJ4ClgtFQ/dfBG5nqPAu uPhB8psNpCeD5zKA7NpHMyw5Tol7pxyNCrTA6y9dUw+TiOXUB9XB59cJIUOy0QkOtEH+ 82u1Kn9muxpI8C1C4ebNSri4D6GD9H8WpQDn8WkSNO42o+JjpCturmfi7I1r4J3F6uOn rnyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="nDMl/6am"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id h7-20020a636c07000000b00553ce421356si8441903pgc.56.2023.09.12.14.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 14:48:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="nDMl/6am"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 5B1B8801D992; Tue, 12 Sep 2023 11:44:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232253AbjILSon (ORCPT + 99 others); Tue, 12 Sep 2023 14:44:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjILSom (ORCPT ); Tue, 12 Sep 2023 14:44:42 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E521C10D3 for ; Tue, 12 Sep 2023 11:44:37 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2bcb0b973a5so96637131fa.3 for ; Tue, 12 Sep 2023 11:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694544276; x=1695149076; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FHTeaXWUdZVddvHMf1/OUQRqRHd72N11rSxf4Q8vN/4=; b=nDMl/6amUdWik/PVluTirekRUcvyqhk1BVRLFSVvHkKlGJbPZpthK7Sgbxw5li1ntS iVAOlNcRH+6Xo+Ah71vJoN8bLyoqKv9XsP+4uEb25OutnkLPp7Dx6lVUaqaCqDmrQvix qE5X9POrmAPGsx4QFqv3Zny8JcjzTEyVpXT3gc+aXL4aoY2GLs3XsLmnzvOQf2ti3WbG NrFcyt36WBJt818VP970h+UM+4cF/JHoNTjs395yT1Tt35O7d8ZyoG/vbKcBRhHiwxWk 24b7SyWw306a7zn4+FjgskmXgTCPobx5nJxSDZdASu1B4rFGfI95yUXVo6RjFczwP9pE /u6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694544276; x=1695149076; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FHTeaXWUdZVddvHMf1/OUQRqRHd72N11rSxf4Q8vN/4=; b=UuQ5J95q2R75Aq/670XMcCBk5GpgcIY5JOOiYJI17np0biFDJjNfsMYxxb+A+Ke2t1 dmI7DS7Z2O+7TnhEN7/+lvRRyeD/tVQpPs4SZ0PU89X4RhjW3Qc8+aQtoMSzfgNQuJWF 6d2dGjES8zQoXN5llab1c9DiFHSkjbfV+0jMYhM5M3tUejz1nHuA1yr73AFhgdQ5fk2u 4UoNYE0uUJX4Pjn6JA+1Vbh5XiCCMUvJooQwoaDTllK4hzd35udNQ9bLYa/P82ASGz1f /zX9hy/8v8N0lconT3eT1nqIXUief5oRhr1l4HyJcl8jZIrTymbkNZ8JKiWAp0XTQ3Tu nWFQ== X-Gm-Message-State: AOJu0YxxaZdXEXSlY6kjmraS7xURmOZr8CVO6KKrRtk2n3fsJOzPi6oZ ksSfQk9KhwDB3u73cwwWR0AFWyuyJ0yYhc1VJ+E= X-Received: by 2002:a2e:80d3:0:b0:2b6:df23:2117 with SMTP id r19-20020a2e80d3000000b002b6df232117mr544988ljg.43.1694544276003; Tue, 12 Sep 2023 11:44:36 -0700 (PDT) MIME-Version: 1.0 References: <20230911074711.62493-1-silviu.barbulescu@nxp.com> <20230911074711.62493-2-silviu.barbulescu@nxp.com> In-Reply-To: <20230911074711.62493-2-silviu.barbulescu@nxp.com> From: Luiz Augusto von Dentz Date: Tue, 12 Sep 2023 11:44:23 -0700 Message-ID: Subject: Re: [PATCH 1/2] shared/bap:Update stream enable/disable flow bcast source To: Silviu Florian Barbulescu Cc: linux-bluetooth@vger.kernel.org, claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, iulia.tanasescu@nxp.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Sep 2023 11:44:40 -0700 (PDT) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Hi Silviu, On Mon, Sep 11, 2023 at 12:47=E2=80=AFAM Silviu Florian Barbulescu wrote: > > Update stream enable/disable flow for BAP broadcast source > > --- > src/shared/bap.c | 51 +++++++++++++++++++++++++++++++++++------------- > src/shared/bap.h | 2 ++ > 2 files changed, 39 insertions(+), 14 deletions(-) > > diff --git a/src/shared/bap.c b/src/shared/bap.c > index 1c43680c2..801716dd9 100644 > --- a/src/shared/bap.c > +++ b/src/shared/bap.c > @@ -1331,6 +1331,11 @@ static void stream_set_state_broadcast(struct bt_b= ap_stream *stream, > ep->old_state =3D ep->state; > ep->state =3D state; > > + DBG(bap, "stream %p dir 0x%02x: %s -> %s", stream, > + bt_bap_stream_get_dir(stream), > + bt_bap_stream_statestr(stream->ep->old_state), > + bt_bap_stream_statestr(stream->ep->state)); > + > bt_bap_ref(bap); > > for (entry =3D queue_get_entries(bap->state_cbs); entry; > @@ -1492,7 +1497,7 @@ static void ep_config_cb(struct bt_bap_stream *stre= am, int err) > return; > > if (bt_bap_stream_get_type(stream) =3D=3D BT_BAP_STREAM_TYPE_BCAS= T) { > - stream_set_state_broadcast(stream, BT_BAP_STREAM_STATE_CO= NFIG); > + stream_set_state_broadcast(stream, BT_BAP_STREAM_STATE_QO= S); > return; > } > > @@ -4698,13 +4703,19 @@ unsigned int bt_bap_stream_enable(struct bt_bap_s= tream *stream, > break; > case BT_BAP_STREAM_TYPE_BCAST: > stream_set_state_broadcast(stream, > - BT_BAP_STREAM_STATE_STREAMING); > + BT_BAP_STREAM_STATE_CONFIG); > return 1; > } > > return ret; > } > > +void bt_bap_stream_streaming(struct bt_bap_stream *stream) > +{ > + stream_set_state_broadcast(stream, > + BT_BAP_STREAM_STATE_STREAMING); > +} > + > unsigned int bt_bap_stream_start(struct bt_bap_stream *stream, > bt_bap_stream_func_t func, > void *user_data) > @@ -4779,24 +4790,36 @@ unsigned int bt_bap_stream_disable(struct bt_bap_= stream *stream, > return 0; > } > > - memset(&disable, 0, sizeof(disable)); > + switch (bt_bap_stream_get_type(stream)) { > + case BT_BAP_STREAM_TYPE_UCAST: > + memset(&disable, 0, sizeof(disable)); > > - disable.ase =3D stream->ep->id; > + disable.ase =3D stream->ep->id; > > - iov.iov_base =3D &disable; > - iov.iov_len =3D sizeof(disable); > + iov.iov_base =3D &disable; > + iov.iov_len =3D sizeof(disable); > > - req =3D bap_req_new(stream, BT_ASCS_DISABLE, &iov, 1, func, user_= data); > + req =3D bap_req_new(stream, BT_ASCS_DISABLE, &iov, 1, fun= c, > + user_data); > > - if (!bap_queue_req(stream->bap, req)) { > - bap_req_free(req); > - return 0; > - } > + if (!bap_queue_req(stream->bap, req)) { > + bap_req_free(req); > + return 0; > + } > > - if (disable_links) > - queue_foreach(stream->links, bap_stream_disable_link, NUL= L); > + if (disable_links) > + queue_foreach(stream->links, bap_stream_disable_l= ink, > + NULL); > > - return req->id; > + return req->id; > + > + case BT_BAP_STREAM_TYPE_BCAST: > + stream_set_state_broadcast(stream, > + BT_BAP_STREAM_STATE_RELEASING); > + return 1; > + } > + > + return 0; > } > > unsigned int bt_bap_stream_stop(struct bt_bap_stream *stream, > diff --git a/src/shared/bap.h b/src/shared/bap.h > index edb5c1bed..d3c9b241e 100644 > --- a/src/shared/bap.h > +++ b/src/shared/bap.h > @@ -264,6 +264,8 @@ unsigned int bt_bap_stream_start(struct bt_bap_stream= *stream, > bt_bap_stream_func_t func, > void *user_data); > > +void bt_bap_stream_streaming(struct bt_bap_stream *stream); > + Lets use bt_bap_stream_start and handle this internally instead of introducing new APIs specific to broadcast. > unsigned int bt_bap_stream_disable(struct bt_bap_stream *stream, > bool disable_links, > bt_bap_stream_func_t func, > -- > 2.34.1 > --=20 Luiz Augusto von Dentz