diff mbox series

[BlueZ,v3,3/4] shared/bap: Add Broadcast QOS copy functions

Message ID 20240219121509.5702-4-andrei.istodorescu@nxp.com
State New
Headers show
Series Update Sink BASE management | expand

Commit Message

Andrei Istodorescu Feb. 19, 2024, 12:15 p.m. UTC
BAP works with bt_bap_qos structures and kernel with bt_iso_qos. These
functions are utilitary functions to allow jumping easily from one
structure to another.
---
 src/shared/bap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 src/shared/bap.h |  4 ++++
 2 files changed, 48 insertions(+)

Comments

Luiz Augusto von Dentz Feb. 20, 2024, 5:32 p.m. UTC | #1
Hi Andrei,

On Mon, Feb 19, 2024 at 7:15 AM Andrei Istodorescu
<andrei.istodorescu@nxp.com> wrote:
>
> BAP works with bt_bap_qos structures and kernel with bt_iso_qos. These
> functions are utilitary functions to allow jumping easily from one
> structure to another.
> ---
>  src/shared/bap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  src/shared/bap.h |  4 ++++
>  2 files changed, 48 insertions(+)
>
> diff --git a/src/shared/bap.c b/src/shared/bap.c
> index c3d96c08fddc..19e40e3c70f4 100644
> --- a/src/shared/bap.c
> +++ b/src/shared/bap.c
> @@ -6527,3 +6527,47 @@ void bt_bap_parse_bis(void *data, void *user_data)
>         queue_foreach(subgroup->bises, bis_to_pac, subgroup);
>         cleanup_subgroup(subgroup);
>  }
> +
> +void bt_bap_bcast_qos_iso_to_bap(struct bt_bap_qos *bap_qos,
> +               struct bt_iso_qos *iso_qos)
> +{
> +       bap_qos->bcast.big = iso_qos->bcast.big;
> +       bap_qos->bcast.bis = iso_qos->bcast.bis;
> +       bap_qos->bcast.sync_factor = iso_qos->bcast.sync_factor;
> +       bap_qos->bcast.packing = iso_qos->bcast.packing;
> +       bap_qos->bcast.framing = iso_qos->bcast.framing;
> +       bap_qos->bcast.encryption = iso_qos->bcast.encryption;
> +       if (bap_qos->bcast.bcode && bap_qos->bcast.bcode->iov_base)
> +               memcpy(bap_qos->bcast.bcode->iov_base, iso_qos->bcast.bcode,
> +                               bap_qos->bcast.bcode->iov_len);
> +       bap_qos->bcast.options = iso_qos->bcast.options;
> +       bap_qos->bcast.skip = iso_qos->bcast.skip;
> +       bap_qos->bcast.sync_timeout = iso_qos->bcast.sync_timeout;
> +       bap_qos->bcast.sync_cte_type = iso_qos->bcast.sync_cte_type;
> +       bap_qos->bcast.mse = iso_qos->bcast.mse;
> +       bap_qos->bcast.timeout = iso_qos->bcast.timeout;
> +       memcpy(&bap_qos->bcast.io_qos, &iso_qos->bcast.out,
> +                       sizeof(struct bt_iso_io_qos));
> +}
> +
> +void bt_bap_bcast_qos_bap_to_iso(struct bt_iso_qos *iso_qos,
> +               struct bt_bap_qos *bap_qos)
> +{
> +       iso_qos->bcast.big = bap_qos->bcast.big;
> +       iso_qos->bcast.bis = bap_qos->bcast.bis;
> +       iso_qos->bcast.sync_factor = bap_qos->bcast.sync_factor;
> +       iso_qos->bcast.packing = bap_qos->bcast.packing;
> +       iso_qos->bcast.framing = bap_qos->bcast.framing;
> +       iso_qos->bcast.encryption = bap_qos->bcast.encryption;
> +       if (bap_qos->bcast.bcode && bap_qos->bcast.bcode->iov_base)
> +               memcpy(iso_qos->bcast.bcode, bap_qos->bcast.bcode->iov_base,
> +                               bap_qos->bcast.bcode->iov_len);
> +       iso_qos->bcast.options = bap_qos->bcast.options;
> +       iso_qos->bcast.skip = bap_qos->bcast.skip;
> +       iso_qos->bcast.sync_timeout = bap_qos->bcast.sync_timeout;
> +       iso_qos->bcast.sync_cte_type = bap_qos->bcast.sync_cte_type;
> +       iso_qos->bcast.mse = bap_qos->bcast.mse;
> +       iso_qos->bcast.timeout = bap_qos->bcast.timeout;
> +       memcpy(&iso_qos->bcast.out, &bap_qos->bcast.io_qos,
> +                       sizeof(struct bt_iso_io_qos));
> +}
> diff --git a/src/shared/bap.h b/src/shared/bap.h
> index aed3bf52b8d9..968257651766 100644
> --- a/src/shared/bap.h
> +++ b/src/shared/bap.h
> @@ -354,4 +354,8 @@ struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream);
>  bool bt_bap_parse_base(struct bt_bap *bap, void *data, size_t len,
>                 util_debug_func_t func, struct bt_bap_base *base);
>  void bt_bap_parse_bis(void *data, void *user_data);
> +void bt_bap_bcast_qos_iso_to_bap(struct bt_bap_qos *bap_qos,
> +               struct bt_iso_qos *iso_qos);
> +void bt_bap_bcast_qos_bap_to_iso(struct bt_iso_qos *iso_qos,
> +               struct bt_bap_qos *bap_qos);

Not sure if that is the best place to have this sort of helper
function, usually bap.h don't have to deal with bt_iso_qos, also this
seems to not care about unicast either.

> --
> 2.40.1
>
diff mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index c3d96c08fddc..19e40e3c70f4 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -6527,3 +6527,47 @@  void bt_bap_parse_bis(void *data, void *user_data)
 	queue_foreach(subgroup->bises, bis_to_pac, subgroup);
 	cleanup_subgroup(subgroup);
 }
+
+void bt_bap_bcast_qos_iso_to_bap(struct bt_bap_qos *bap_qos,
+		struct bt_iso_qos *iso_qos)
+{
+	bap_qos->bcast.big = iso_qos->bcast.big;
+	bap_qos->bcast.bis = iso_qos->bcast.bis;
+	bap_qos->bcast.sync_factor = iso_qos->bcast.sync_factor;
+	bap_qos->bcast.packing = iso_qos->bcast.packing;
+	bap_qos->bcast.framing = iso_qos->bcast.framing;
+	bap_qos->bcast.encryption = iso_qos->bcast.encryption;
+	if (bap_qos->bcast.bcode && bap_qos->bcast.bcode->iov_base)
+		memcpy(bap_qos->bcast.bcode->iov_base, iso_qos->bcast.bcode,
+				bap_qos->bcast.bcode->iov_len);
+	bap_qos->bcast.options = iso_qos->bcast.options;
+	bap_qos->bcast.skip = iso_qos->bcast.skip;
+	bap_qos->bcast.sync_timeout = iso_qos->bcast.sync_timeout;
+	bap_qos->bcast.sync_cte_type = iso_qos->bcast.sync_cte_type;
+	bap_qos->bcast.mse = iso_qos->bcast.mse;
+	bap_qos->bcast.timeout = iso_qos->bcast.timeout;
+	memcpy(&bap_qos->bcast.io_qos, &iso_qos->bcast.out,
+			sizeof(struct bt_iso_io_qos));
+}
+
+void bt_bap_bcast_qos_bap_to_iso(struct bt_iso_qos *iso_qos,
+		struct bt_bap_qos *bap_qos)
+{
+	iso_qos->bcast.big = bap_qos->bcast.big;
+	iso_qos->bcast.bis = bap_qos->bcast.bis;
+	iso_qos->bcast.sync_factor = bap_qos->bcast.sync_factor;
+	iso_qos->bcast.packing = bap_qos->bcast.packing;
+	iso_qos->bcast.framing = bap_qos->bcast.framing;
+	iso_qos->bcast.encryption = bap_qos->bcast.encryption;
+	if (bap_qos->bcast.bcode && bap_qos->bcast.bcode->iov_base)
+		memcpy(iso_qos->bcast.bcode, bap_qos->bcast.bcode->iov_base,
+				bap_qos->bcast.bcode->iov_len);
+	iso_qos->bcast.options = bap_qos->bcast.options;
+	iso_qos->bcast.skip = bap_qos->bcast.skip;
+	iso_qos->bcast.sync_timeout = bap_qos->bcast.sync_timeout;
+	iso_qos->bcast.sync_cte_type = bap_qos->bcast.sync_cte_type;
+	iso_qos->bcast.mse = bap_qos->bcast.mse;
+	iso_qos->bcast.timeout = bap_qos->bcast.timeout;
+	memcpy(&iso_qos->bcast.out, &bap_qos->bcast.io_qos,
+			sizeof(struct bt_iso_io_qos));
+}
diff --git a/src/shared/bap.h b/src/shared/bap.h
index aed3bf52b8d9..968257651766 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -354,4 +354,8 @@  struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream);
 bool bt_bap_parse_base(struct bt_bap *bap, void *data, size_t len,
 		util_debug_func_t func, struct bt_bap_base *base);
 void bt_bap_parse_bis(void *data, void *user_data);
+void bt_bap_bcast_qos_iso_to_bap(struct bt_bap_qos *bap_qos,
+		struct bt_iso_qos *iso_qos);
+void bt_bap_bcast_qos_bap_to_iso(struct bt_iso_qos *iso_qos,
+		struct bt_bap_qos *bap_qos);