Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: Mesh: Op agg mdl coex #64088

Conversation

Andrewpini
Copy link
Collaborator

@Andrewpini Andrewpini commented Oct 18, 2023

  • Refactors the implementation of the Opcode Aggregator models to allow them to coexist on the same device.
  • Adds coexistence Bsim test for Opcode Aggregator models. The test verifies that the Opcode Aggregator server and client can be present and functional when operating on the same device.
  • Adds coexistence Bsim test for Opcode Aggregator models using loopback. The test verifies that the Opcode Aggregator server and client can send messages to each other on the loopback interface.

Copy link
Collaborator

@alxelax alxelax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just needs some updates.

@@ -1506,8 +1506,10 @@ int bt_mesh_model_send(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *msg,
const struct bt_mesh_send_cb *cb, void *cb_data)
{
if (IS_ENABLED(CONFIG_BT_MESH_OP_AGG) && bt_mesh_op_agg_accept(ctx)) {
return bt_mesh_op_agg_send(model, ctx, msg, cb);
if (IS_ENABLED(CONFIG_BT_MESH_OP_AGG_SRV) && bt_mesh_op_agg_srv_accept(ctx, msg)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does server checking go first?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just made most sense to me. The aggregation process for the server is fully dependent on internal behavoir and should under normal circumstances complete in a very short time. The client aggregation however is completly dependent on how the user utilize the API. I wanted to avoid a situation where starting a client sequence on the device would block any incoming sequences to the server, since doing it the other way around would put the status responses in the ongoing aggregated sequence buffer rather than in the response buffer. Ideally (as discussed outside this PR) we should have a way to tag access messages to know if the message belongs to a agg sequence or a agg response (or non of them). Then we could remove the else if and make the decision based on the tag. But this would require major rework and potentially change API, so I think this is the best solution for now if we don't want to spend much more time fixing this properly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally (as discussed outside this PR) we should have a way to tag access messages to know if the message belongs to a agg sequence or a agg response (or non of them).

I need to look deeply but first thing that comes to me is to add tag field into bt_mesh_msg_ctx. I think we also need to look at this in the context of response delay randomization. Currently we don't have any API for sending a response message. If we introduce it, it could also be used to solve this issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create a separate task for this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to NCSDK-23176

tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh Outdated Show resolved Hide resolved
subsys/bluetooth/mesh/op_agg_cli.c Outdated Show resolved Hide resolved
subsys/bluetooth/mesh/op_agg_srv.c Outdated Show resolved Hide resolved
tests/bsim/bluetooth/mesh/src/test_op_agg.c Outdated Show resolved Hide resolved
@Andrewpini Andrewpini force-pushed the NCSDK-23391_OpAgg_cli_and_srv_on_same_dev branch from e9a8864 to f243f21 Compare October 19, 2023 13:27
Copy link
Collaborator

@PavelVPV PavelVPV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good! Only few comments

@@ -1506,8 +1506,10 @@ int bt_mesh_model_send(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *msg,
const struct bt_mesh_send_cb *cb, void *cb_data)
{
if (IS_ENABLED(CONFIG_BT_MESH_OP_AGG) && bt_mesh_op_agg_accept(ctx)) {
return bt_mesh_op_agg_send(model, ctx, msg, cb);
if (IS_ENABLED(CONFIG_BT_MESH_OP_AGG_SRV) && bt_mesh_op_agg_srv_accept(ctx, msg)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally (as discussed outside this PR) we should have a way to tag access messages to know if the message belongs to a agg sequence or a agg response (or non of them).

I need to look deeply but first thing that comes to me is to add tag field into bt_mesh_msg_ctx. I think we also need to look at this in the context of response delay randomization. Currently we don't have any API for sending a response message. If we introduce it, it could also be used to solve this issue.

subsys/bluetooth/mesh/op_agg.c Outdated Show resolved Hide resolved
subsys/bluetooth/mesh/op_agg_cli.c Outdated Show resolved Hide resolved
subsys/bluetooth/mesh/op_agg_srv.c Outdated Show resolved Hide resolved
Refactors the implementation of the Opcode Aggregator
models to allow them to coexist on the same device.

Signed-off-by: Anders Storrø <[email protected]>
Adds coexistence Bsim test for Opcode Aggregator models.
The test verifies that the Opcode Aggregator server and client can be
present and functional when operating on the same device.

Signed-off-by: Anders Storrø <[email protected]>
Adds coexistence Bsim test for Opcode Aggregator models using loopback.
The test verifies that the Opcode Aggregator server and client can send
messages to each other on the loopback interface.

Signed-off-by: Anders Storrø <[email protected]>
@Andrewpini Andrewpini force-pushed the NCSDK-23391_OpAgg_cli_and_srv_on_same_dev branch from f243f21 to 9a020c4 Compare October 20, 2023 08:45
@carlescufi carlescufi merged commit fe9ffda into zephyrproject-rtos:main Oct 20, 2023
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants