Skip to content

Commit 7e121bd

Browse files
committed
mctpd: move allocate EIDs logging internal to endpoint_allocate_eids()
Some failure paths log internally, others do not. Make this consistent, and do all logging inside the function. Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
1 parent 87b7deb commit 7e121bd

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/mctpd.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,20 +2461,8 @@ static int method_assign_endpoint(sd_bus_message *call, void *data,
24612461
if (!peer_path)
24622462
goto err;
24632463

2464-
if (peer->pool_size > 0) {
2465-
rc = endpoint_allocate_eids(peer);
2466-
if (rc < 0) {
2467-
warnx("Failed to allocate downstream EIDs");
2468-
} else {
2469-
if (peer->ctx->verbose) {
2470-
fprintf(stderr,
2471-
"Downstream EIDs assigned from %d to %d : pool size %d\n",
2472-
peer->pool_start,
2473-
peer->pool_start + peer->pool_size - 1,
2474-
peer->pool_size);
2475-
}
2476-
}
2477-
}
2464+
if (peer->pool_size > 0)
2465+
endpoint_allocate_eids(peer);
24782466

24792467
return sd_bus_reply_method_return(call, "yisb", peer->eid, peer->net,
24802468
peer_path, 1);
@@ -4532,6 +4520,7 @@ static int endpoint_allocate_eids(struct peer *peer)
45324520
mctp_ctrl_cmd_allocate_eids_alloc_eids, &allocated_pool_size,
45334521
&allocated_pool_start);
45344522
if (rc) {
4523+
warnx("Failed to allocate downstream EIDs");
45354524
//reset peer pool
45364525
peer->pool_size = 0;
45374526
peer->pool_start = 0;
@@ -4566,6 +4555,14 @@ static int endpoint_allocate_eids(struct peer *peer)
45664555
CC_MCTP_DBUS_IFACE_BRIDGE, peer->eid, strerror(-rc));
45674556
}
45684557

4558+
if (peer->ctx->verbose) {
4559+
fprintf(stderr,
4560+
"Bridge (eid %d) assigned pool [%d, %d], size %d\n",
4561+
peer->eid, peer->pool_start,
4562+
peer->pool_start + peer->pool_size - 1,
4563+
peer->pool_size);
4564+
}
4565+
45694566
// TODO: Polling logic for downstream EID
45704567

45714568
return 0;

0 commit comments

Comments
 (0)