Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2716613rdb; Mon, 12 Feb 2024 14:18:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW5LtrqPvVXTZDslOkRssFjyCSRgcQ4kHB8sgPnBuAfnHRHl5pIESSduRq55jZSu6hWrIpkY2Q+CEa7FRcBO4IAhOSPKEPDfAXcsxI1pw== X-Google-Smtp-Source: AGHT+IEliLik6kBHKDnqwmMbQvki4K8ds2og3g9+CyMSO1OYKtOhACZ56SX39OVIWQfaR91YzGe7 X-Received: by 2002:a0d:dc07:0:b0:604:92e0:c76f with SMTP id f7-20020a0ddc07000000b0060492e0c76fmr7389153ywe.30.1707776295770; Mon, 12 Feb 2024 14:18:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707776295; cv=pass; d=google.com; s=arc-20160816; b=Oso7TJU/Jwh5AnQlLpK2N81iWOYgYf87fQPsv2IkNYkIq6y7wYdK+O8KlkqYHjcPd9 u1AOR9Yz5f0f9qwyAFPo9JyOa2TNbP+K33WcIZTwKjEc6R4vW8DQ8uM+zxfqL2OH10gY 1xeuVwqqcM3n9O7g3oHMlNqZkrkm74ANjrlYl3wLai6APsv2P2oEtCl7ttErp2bR0hLD gFh+AdkbGdktMOPl1ncd4NgPaPuh3W9GjkqHROE+W1w2ntOpaRbuevlZe1xzAx3EnbOA JjJ6IuMwKU4Gb8Ai3nDmgeDRKvkem+hadTrFZAC2cVQQ6lJpOEIa5MBfob4R9pbaPGdw 1f/g== 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=hY33wlNxUbis34gZFjS1OCAARF3v45p4zZMAxR0g4lQ=; fh=Ziu8hojJApH5/lhrZTxEcfZed02j+k9CXEMyuhRRWVU=; b=QhXh/r17CyfIfAVzmAtMc5IGwqQA6QAzoAW7jONXhgD+ZqjdVfxYzoEquH7lKg/jZp +huSYhdagrv1dRvYBQNGoOMBGyNidt2YvhJatHFPASSqPC1ZHCecli83onwmV0j8CZ3Q ce8bduSEf5SDOT8Bb56mmJxJURSSNcAieM7LbE+rQurL2+Drd8MLC7bWsQl4/YyeLSUa UKypu2C+a6pjc4uk4tL6u7sYQT7u+oLwBIP9YYGwKl0RvZx8izUDM0TgkuNx5u1V0IcQ 528lp/VIrnYYy1q10gZ5gQtNiV9dVYfmIfL2iQt+xP+9DtIEyMiadV2I3EgQ7VqI77Ag JBBA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=g4p8hkk9; 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-1799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1799-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCVq/lMrHOWP4xL8tIEJf5kHCGEgVNiVK6cjS72t4+dvtXVSSBYjgYYNNwPu6bIzUGf5ubxtDZV/mwWKzKb0sIoFEL8Q0pioXutOjGj6Og== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k7-20020ac84747000000b0042c3986d756si1380325qtp.129.2024.02.12.14.18.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 14:18:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=g4p8hkk9; 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-1799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1799-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5BC0F1C2110E for ; Mon, 12 Feb 2024 22:18:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCE994D9F1; Mon, 12 Feb 2024 22:18:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g4p8hkk9" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 9014847A53 for ; Mon, 12 Feb 2024 22:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707776288; cv=none; b=Ge5ZB8YbvDtZcVSeFX+CrJxaUmxytiRZNMa8kmqv4ivMCjyK/MrDUsOcxcNQZH7wQ2LRYveDR7az5V4OV8hR+M8jICaK2FAOFfRqr1NIUVDdv/f+6DUVBqEuc+y4nnbUSlWZOOCbn6nd8wk/CHPMtcSshHJSImn5QA0t1OQEh+E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707776288; c=relaxed/simple; bh=sYwVbHLK05RmWYU6tMXarHgXiMJ/sVyNbJKJymf2WB4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=tizy/OtfS7xZZY5Si2vDLyZQzMChpiGGWv7y44nN6bRMow1FodeHEX4b+ioapKKGw+W8Ch7aOlsAdZREL2leAGCrOi4fNQJcnkReimJ7YpdNAikj9rHMR6LR6qP8GrAO2Rheh948Vk8Cvn6LWxvryx3Evc4/OkbiH9MeprVKDq0= 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=g4p8hkk9; arc=none smtp.client-ip=209.85.208.179 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-f179.google.com with SMTP id 38308e7fff4ca-2d0b4ea773eso49253831fa.0 for ; Mon, 12 Feb 2024 14:18:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707776284; x=1708381084; 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=hY33wlNxUbis34gZFjS1OCAARF3v45p4zZMAxR0g4lQ=; b=g4p8hkk9Xwf3zbFiJt89sfhteFukrFMzpLjxxp+iD9gqsCOqMFKPsx40tLLpJzgUzk 3XGjgc0ZoZiEBckpzPszUyGckcF7HHAHIj8vq2yaiB5OyVDER+2EFDDaKmlvYzPNSMZy 1/Cew435WwIzeKCK2J0tuSbPzObJU0hyOzDgg2RWzo08y35C/AWSmEESZyhn89bNAHMZ kJX7HkyzJbS4ILWMkSM+dOYU9vDw03RxAQSzdJDfL3D3Tsu/zW2yS9tIIW4lFx/AQtOs cswWob4mV3xBrV9FfcNl9g3xUmGg6k6F/oyRsFllZIx+C1WYefzz+HLEHx+Yd9KHsKky ujFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707776284; x=1708381084; 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=hY33wlNxUbis34gZFjS1OCAARF3v45p4zZMAxR0g4lQ=; b=iHu1lUH7HpVQyuJ1PXBZ1LhcEYbxSaKWt3WnBRGMkfsY2mlolm80isn8UbT8V+T4kj Z9iR2IHj7Ar7CiODXkFsFqDAbibdM3jP6HM7dGB3YMlQrAmmteyiUIf2VbtOCfTwbP04 qyG+IgM5uT1reQU8c7OstgVVIBoHSPyQv85INPUiu73/UqQHiUc9LPuqWHxgSBkQePGU fhi2Oy0n/9PQ2Q/9IAR6iHjeZzu6L5sWYv1J/PngDmDljMBbxwGe8eQq522MdrHKTyAA vXuHonz+4KeVeE0jCBYDNwTclo8quFuLxX2Z6SGeKZSF74ip2lZKwzX9p9h7YA6lc0FC niIw== X-Gm-Message-State: AOJu0YyniGdIrmXOUPpqtUxI+R2WYkkUqwgEOA/3d0fTy+yKjU/M6+wG QrB9bjzlkAsLKvi+jIoSa3ebcoRWTSS3Oj74rU4XgminCHX9H0Usgh+UUkjgOO60eMsp8VN8RdN AevaEphW0kAjoZpWJ4dW9vsNLo7MlmqpL X-Received: by 2002:a2e:9550:0:b0:2d0:bf87:b3a6 with SMTP id t16-20020a2e9550000000b002d0bf87b3a6mr5077364ljh.37.1707776284283; Mon, 12 Feb 2024 14:18:04 -0800 (PST) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240212153222.8191-1-silviu.barbulescu@nxp.com> <20240212153222.8191-3-silviu.barbulescu@nxp.com> In-Reply-To: <20240212153222.8191-3-silviu.barbulescu@nxp.com> From: Luiz Augusto von Dentz Date: Mon, 12 Feb 2024 17:17:52 -0500 Message-ID: Subject: Re: [PATCH BlueZ v2 2/7] shared/bap: Create multiple streams for the same pac 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, Feb 12, 2024 at 10:32=E2=80=AFAM Silviu Florian Barbulescu wrote: > > Broadcast source requires to create multiple streams for one pac. > This is required for multiple BISes support. > --- > src/shared/bap.c | 28 ++++++++++++++++++++++++---- > 1 file changed, 24 insertions(+), 4 deletions(-) > > diff --git a/src/shared/bap.c b/src/shared/bap.c > index e26dbf944..f0ffdebfe 100644 > --- a/src/shared/bap.c > +++ b/src/shared/bap.c > @@ -5156,7 +5156,7 @@ struct bt_bap_stream *bt_bap_stream_new(struct bt_b= ap *bap, > struct iovec *data) > { > struct bt_bap_stream *stream; > - struct bt_bap_endpoint *ep; > + struct bt_bap_endpoint *ep =3D NULL; > struct match_pac match; > > if (!bap) > @@ -5212,12 +5212,32 @@ struct bt_bap_stream *bt_bap_stream_new(struct bt= _bap *bap, > match.lpac =3D lpac; > match.rpac =3D rpac; > > - /* Check for existing stream */ > - ep =3D queue_find(bap->remote_eps, find_ep_pacs, &match); > + /* Broadcast source supports multiple endpoints (multiple BISes) > + * for one pac so allow it to register a new endpoint even if > + * others already exist. > + */ > + if (lpac->type !=3D BT_BAP_BCAST_SOURCE) { > + /* Check for existing stream */ > + ep =3D queue_find(bap->remote_eps, find_ep_pacs, &match); > + } > + > if (!ep) { > /* Check for unused ASE */ > ep =3D queue_find(bap->remote_eps, find_ep_unused, &match= ); > - if (!ep) { > + if (!ep && lpac->type =3D=3D BT_BAP_BCAST_SOURCE) { > + /* Push a new remote endpoint with direction > + * broadcast source > + */ > + ep =3D bap_endpoint_new_broadcast(bap->rdb, > + BT_BAP_BCAST_SOURCE); > + > + if (ep) > + queue_push_tail(bap->remote_eps, ep); > + else { > + DBG(bap, "Unable to create endpoint"); > + return NULL; > + } > + } else if (!ep) { Perhaps we need a dedicated callback from creating streams to avoid having to add such checks everywhere, that said I don't quite understand why we have Broadcast Source to find a remote endpoint, it shall use a local one instead and perhaps have the ep struct support multiple streams to be attached so we don't have to create dummy endpoints just to be able to create new streams. > DBG(bap, "Unable to find unused ASE"); > return NULL; > } > -- > 2.39.2 > --=20 Luiz Augusto von Dentz