Skip to content

Commit 9f2978d

Browse files
Introduce new max mctp bridge pool size configuration
* For mctp bridge to have contiguous bridge EID with it's downstream endpoints, we introduce max_pool_size, bus-owner configuration, to be assumed pool size before we get it's actual size via SET_ENDPOINT_ID command response. Signed-off-by: Faizan Ali <[email protected]>
1 parent 3cd6653 commit 9f2978d

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

conf/mctpd.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ mode = "bus-owner"
55
[mctp]
66
message_timeout_ms = 30
77

8+
# bus-owner configuration
9+
[bus-owner]
10+
max_pool_size = 15
11+
812
# Specify a UUID: not generally required - mctpd will query the system UUID
913
# where available.
1014
# uuid = "21f0f554-7f7c-4211-9ca1-6d0f000ea9e7"

src/mctpd.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ struct ctx {
221221

222222
// Verbose logging
223223
bool verbose;
224+
225+
// maximum pool size for assumed MCTP Bridge
226+
uint8_t max_pool_size;
224227
};
225228

226229
static int emit_endpoint_added(const struct peer *peer);
@@ -3938,9 +3941,27 @@ static int parse_config_mctp(struct ctx *ctx, toml_table_t *mctp_tab)
39383941
return 0;
39393942
}
39403943

3944+
static int parse_config_bus_owner(struct ctx *ctx, toml_table_t *bus_owner)
3945+
{
3946+
toml_datum_t val;
3947+
3948+
val = toml_int_in(bus_owner, "max_pool_size");
3949+
if (val.ok) {
3950+
int64_t i = val.u.i;
3951+
if (i <= 0 || i > (eid_alloc_max - eid_alloc_min)) {
3952+
warnx("invalid max_pool_size value (must be 1-%d)",
3953+
eid_alloc_max - eid_alloc_min);
3954+
return -1;
3955+
}
3956+
ctx->max_pool_size = i;
3957+
}
3958+
3959+
return 0;
3960+
}
3961+
39413962
static int parse_config(struct ctx *ctx)
39423963
{
3943-
toml_table_t *conf_root, *mctp_tab;
3964+
toml_table_t *conf_root, *mctp_tab, *bus_owner;
39443965
bool conf_file_specified;
39453966
char errbuf[256] = { 0 };
39463967
const char *filename;
@@ -3985,6 +4006,13 @@ static int parse_config(struct ctx *ctx)
39854006
goto out_free;
39864007
}
39874008

4009+
bus_owner = toml_table_in(conf_root, "bus-owner");
4010+
if (bus_owner) {
4011+
rc = parse_config_bus_owner(ctx, bus_owner);
4012+
if (rc)
4013+
goto out_free;
4014+
}
4015+
39884016
rc = 0;
39894017

39904018
out_free:
@@ -3998,6 +4026,7 @@ static void setup_config_defaults(struct ctx *ctx)
39984026
{
39994027
ctx->mctp_timeout = 250000; // 250ms
40004028
ctx->default_role = ENDPOINT_ROLE_BUS_OWNER;
4029+
ctx->max_pool_size = 15;
40014030
}
40024031

40034032
static void free_config(struct ctx *ctx)

0 commit comments

Comments
 (0)