Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2574011lqo; Mon, 20 May 2024 09:40:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVGzTBGdni7IPrjVfLTgQdZy2WSQgZtrPGev3fS8ZhJieZOe7SKUyqtP8L4SkrLJvOkryC88WHG27JH32zLF/3Lcf/3efZht+KlEV1eOw== X-Google-Smtp-Source: AGHT+IEI4gVQ5WxDv3kxU3DZAKZr+NmwVM1FAXDNNH0VOlGT4fvWKitOQj/6Zh2zRJHQt+V/zFH/ X-Received: by 2002:a17:902:cec8:b0:1f3:634:199a with SMTP id d9443c01a7336-1f306341bb8mr21766705ad.45.1716223253079; Mon, 20 May 2024 09:40:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716223253; cv=pass; d=google.com; s=arc-20160816; b=HG+/Oihauq9t4fIuGR+eq8Dmy7b5hX+vk6hgIZL7c4YOt85eIqt7rul+sIg5xj13NE T0psr+s8fERLSbRZ1zI7Aa12rALjXM6asqgbSe31CbzA0OUloxoe06baOpnanfBV1giI KphIjwh0tu0cwzHln9RcwWOlNDRL0p6gclctMVmi7bcwuhO/qdQfbpXlKIwT2pQoXA0/ MC3dIG9pRBZsQBD/6siFWtTjBZz0X1JLCeLx9wI2liG27ImERiuH5zpiBidMcx1IYrIQ 4klk27ZJ0AcqqE2pik3YEeTDJrM0tQZJkQqVYStw5fQg+Lz/7suYv5STyIarOavCkUSI srog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=44+Shx2cR1Hfv0wx9XFmyGvMXzzZI1ZQdUZwD+SFt+Q=; fh=4cfHHvMRvxrr4lXvRqQ13xW+EMunW4MjA7lyDAf7cC4=; b=FH9dugpCV6/cZFrE/s6zlKuarxRbNbum/1OiY281bbxdTb+FqVKdIRG09+y87N0n6a T6+YvAshi4+xNe5OHI/TwaKaPtWzsjtsLt7NvkVwSJr8pBIMcqrvqRAHs2kgfGn9ezd1 j8e6nLb0STcW/JVHjwQc1sfLTEyoD0tjlRk62HE2MWViOHmq/yPAKkVXnYvg46VfGNN3 RDGwuQd8ssUW8Gbil6piDNuCTNcB3wpYFSD9JA8cCw9KAEjROOOLQk8O6udiHzXtdRM6 MIkmhMVVXuPY4NAz1kvkPeC7Yk1FqUwwolMoaqkMnjm1S3CInACIS5YAKrk2EADzfBIR N+SA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RAQ1UoV6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4811-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c037ccdsi26502815ad.336.2024.05.20.09.40.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 09:40:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4811-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RAQ1UoV6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4811-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DF1FC28169E for ; Mon, 20 May 2024 16:40:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B13354BE8; Mon, 20 May 2024 16:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RAQ1UoV6" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46F47182D8 for ; Mon, 20 May 2024 16:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716223233; cv=none; b=IOIy9sEOjk1kH5BQqjw4bUc0DfwYtqmONsRxY8oBzwV4SKx0iDK54UkNTDuM0k423i8XswdznB9SpwqR8k9yJu4rd8Fm3msDpqJCyPzYF9HJzzNX4atWUBFgP8YL+w4KGgr2xbD75q5y5Z2w/Ajthoj/QdqOqB8ECgtIXEWxxzQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716223233; c=relaxed/simple; bh=ucJFe87g+Y3tQN+JE4bAEVQOCDcv3GikzpHob/3l2JM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=FmSOMmdtWLshlqSUoPzRksL9v0zIbzgRQjMjDbNvlJA30TFGLs5JEpbQwKS0aTU2NH2/d8fNu3n/L93l09RGK9SHsm8JCuwMcapt9oej5NLOoN173UoIgmN40wV82cTxm78LYULODszhN71tNsszy5UOnSq8UJk5vTc32tj2D90= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RAQ1UoV6; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2e73441edf7so3787891fa.1 for ; Mon, 20 May 2024 09:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716223230; x=1716828030; 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=44+Shx2cR1Hfv0wx9XFmyGvMXzzZI1ZQdUZwD+SFt+Q=; b=RAQ1UoV6G8yt/DkgFzfBYzdTN6zgx+A0I60JOavV8NN148KjYI/o9QZSPKAQaQcLFR G37QKN30KugOQzXv6FlAJEkpYXDaxkkjJbwUYEsE2O8u2g9qPeV6TGtMqt05BC5JBf4w zEYaSZClVc2/hpJaqrHnoEt9aSR3GeaIH6kjUDvipSHWAjJgd22nscMSvXWApfF29n0f JCt55P7X5hhX83xKu9+ulaks1rkDkqUfzVNb0HCLz0nr08WVSA5vGqD2glANwsrKWfr/ jGGmjuTcM2fpmoAde4AxiIqyJBotP8PukY+sDg4tpV5OzuiCYOXD5faU3GN4L9pednwh CZIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716223230; x=1716828030; 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=44+Shx2cR1Hfv0wx9XFmyGvMXzzZI1ZQdUZwD+SFt+Q=; b=gkE/d4l6XvvZR4NYLcQDMPEoWicYbnhGxMyDE+PIfkcfUsnY9abCWPkppPa5aQ/ujt nrAc4STYjZWztksdSRZMYd1rWLeeaKwEn3k2W2fkdqiSIAPym2dGvEW4W3Znfl+OE3PB Z/iI6bmQI5HdhWHJvY3VO5ox9GymcO+TzozqypcZTTuYYD+fYt7Rw+9fjBTdhtf+YGPi kWVBPIaWnoB8lL03Xn6FFrs+B+b8DPTHj60LGbP8re7vCVeOgDN8wBT71fqifZ7/eQ/z 9SAKQFPuiU5NE0Taxwmd2N5IobvGWfQVbNKXporExIhJ7wnwQpsGB/h633NYoTUgIeFv Inxw== X-Gm-Message-State: AOJu0Yx22DTdB88ji7ouk3SkAcNNxRbGK5Sz43Jx/S+4o0JD5nJahL3+ 3RE8lOtOr95lWZvwYbDRWab5WdRMI7/fHCjFFfaCeD1HbOgazz5YYoW91dqXCQy3w8rw/FaMQH+ HGAwN8kTxZzUEp6OcoDrrzS4AyFM= X-Received: by 2002:a2e:701:0:b0:2e5:374b:bf00 with SMTP id 38308e7fff4ca-2e5374bbf6fmr168040721fa.33.1716223230150; Mon, 20 May 2024 09:40:30 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240520162757.78187-1-silviu.barbulescu@nxp.com> <20240520162757.78187-2-silviu.barbulescu@nxp.com> In-Reply-To: <20240520162757.78187-2-silviu.barbulescu@nxp.com> From: Luiz Augusto von Dentz Date: Mon, 20 May 2024 12:40:17 -0400 Message-ID: Subject: Re: [PATCH BlueZ 1/2] shared/bap: Update BAP Broadcast Source state machine To: Silviu Florian Barbulescu Cc: linux-bluetooth@vger.kernel.org, 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 Hi Silviu, On Mon, May 20, 2024 at 12:28=E2=80=AFPM Silviu Florian Barbulescu wrote: > > Update BAP Broadcast Source state machine states to use BAP define states > for source Idle, Config, Streaming, and an intermediary state enabling. Not really following, what is an intermediary state? Or do you mean internal state? And more importantly why would we need an internal state like that? > Updated test-bap too. > > --- > src/shared/bap.c | 39 ++++++++++++++++++++------------------- > unit/test-bap.c | 4 ++-- > 2 files changed, 22 insertions(+), 21 deletions(-) > > diff --git a/src/shared/bap.c b/src/shared/bap.c > index 6572ef1d1..639149520 100644 > --- a/src/shared/bap.c > +++ b/src/shared/bap.c > @@ -1361,14 +1361,6 @@ static void ep_config_cb(struct bt_bap_stream *str= eam, int err) > if (err) > return; > > - if (bt_bap_stream_get_type(stream) =3D=3D BT_BAP_STREAM_TYPE_BCAS= T) { > - if (bt_bap_stream_io_dir(stream) =3D=3D BT_BAP_BCAST_SINK= ) > - stream_set_state(stream, BT_BAP_STREAM_STATE_QOS)= ; > - else if (bt_bap_stream_io_dir(stream) =3D=3D BT_BAP_BCAST= _SOURCE) > - stream_set_state(stream, BT_BAP_STREAM_STATE_CONF= IG); > - return; > - } > - > stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); > } > > @@ -1759,6 +1751,15 @@ static unsigned int bap_stream_metadata(struct bt_= bap_stream *stream, > return req->id; > } > > +static unsigned int bap_bcast_qos(struct bt_bap_stream *stream, > + struct bt_bap_qos *data, > + bt_bap_stream_func_t func, > + void *user_data) > +{ > + stream->qos =3D *data; > + return 1; > +} > + > static unsigned int bap_bcast_config(struct bt_bap_stream *stream, > struct bt_bap_qos *qos, struct iovec= *data, > bt_bap_stream_func_t func, void *use= r_data) > @@ -2071,7 +2072,7 @@ static unsigned int bap_bcast_get_state(struct bt_b= ap_stream *stream) > return stream->state; > } > > -static unsigned int bap_bcast_enable(struct bt_bap_stream *stream, > +static unsigned int bap_bcast_sink_enable(struct bt_bap_stream *stream, > bool enable_links, struct iovec *= data, > bt_bap_stream_func_t func, > void *user_data) > @@ -2081,22 +2082,21 @@ static unsigned int bap_bcast_enable(struct bt_ba= p_stream *stream, > return 1; > } > > -static unsigned int bap_bcast_start(struct bt_bap_stream *stream, > +static unsigned int bap_bcast_src_enable(struct bt_bap_stream *stream, > + bool enable_links, struct iovec *= data, > bt_bap_stream_func_t func, > void *user_data) > { > - stream_set_state(stream, BT_BAP_STREAM_STATE_STREAMING); > + stream_set_state(stream, BT_BAP_STREAM_STATE_ENABLING); > > return 1; > } > > -static unsigned int bap_bcast_sink_disable(struct bt_bap_stream *stream, > - bool disable_links, > +static unsigned int bap_bcast_start(struct bt_bap_stream *stream, > bt_bap_stream_func_t func, > void *user_data) > { > - bap_stream_io_detach(stream); > - stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); > + stream_set_state(stream, BT_BAP_STREAM_STATE_STREAMING); > > return 1; > } > @@ -2106,7 +2106,8 @@ static unsigned int bap_bcast_disable(struct bt_bap= _stream *stream, > bt_bap_stream_func_t func, > void *user_data) > { > - stream_set_state(stream, BT_BAP_STREAM_STATE_DISABLING); > + bap_stream_io_detach(stream); > + stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); > > return 1; > } > @@ -2205,14 +2206,14 @@ static const struct bt_bap_stream_ops stream_ops[= ] =3D { > bap_ucast_release, bap_ucast_detach), > STREAM_OPS(BT_BAP_BCAST_SINK, bap_bcast_set_state, > bap_bcast_get_state, > - bap_bcast_config, NULL, bap_bcast_enable, > - bap_bcast_start, bap_bcast_sink_disable, NULL, > + bap_bcast_config, NULL, bap_bcast_sink_enable, > + bap_bcast_start, bap_bcast_disable, NULL, > bap_bcast_metadata, bap_bcast_sink_get_dir, > bap_bcast_get_location, > bap_bcast_release, bap_bcast_sink_detach), > STREAM_OPS(BT_BAP_BCAST_SOURCE, bap_bcast_set_state, > bap_bcast_get_state, > - bap_bcast_config, NULL, bap_bcast_enable, > + bap_bcast_config, bap_bcast_qos, bap_bcast_src_en= able, > bap_bcast_start, bap_bcast_disable, NULL, > bap_bcast_metadata, bap_bcast_src_get_dir, > bap_bcast_get_location, > diff --git a/unit/test-bap.c b/unit/test-bap.c > index 46ee0e4e5..10f9e348c 100644 > --- a/unit/test-bap.c > +++ b/unit/test-bap.c > @@ -547,10 +547,10 @@ static void bsrc_state(struct bt_bap_stream *stream= , uint8_t old_state, > struct test_data *data =3D user_data; > > switch (new_state) { > - case BT_BAP_STREAM_STATE_QOS: > + case BT_BAP_STREAM_STATE_CONFIG: > bt_bap_stream_enable(stream, true, NULL, NULL, NULL); > break; > - case BT_BAP_STREAM_STATE_CONFIG: > + case BT_BAP_STREAM_STATE_ENABLING: > data->base =3D bt_bap_stream_get_base(stream); > > g_assert(data->base); > -- > 2.40.1 > --=20 Luiz Augusto von Dentz