Skip to content

Commit 7d84d9b

Browse files
mctpd: add endpoint polling interval configuration
Refering to DSP0236 sec 8.17.6 Reclaiming EIDs from hot-plug devices Requirement: The bus owner/bridge needs to periodically poll GET_ENDPOINT_ID control command to check if downstream endpoint is accessible. Once it's established that endpoin is accessible, polling needs to stop. Introduce new endpoint polling configuration to be used as periodic interval for sending poll command GET_ENDPOINT_ID by bus owner/bridge. Disable bridge poll via setting poll time as zero. Signed-off-by: Faizan Ali <faizana@nvidia.com>
1 parent 7ea8652 commit 7d84d9b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

conf/mctpd.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ message_timeout_ms = 30
1616
dynamic_eid_range = [8, 254]
1717

1818
max_pool_size = 15
19+
20+
# Bus Owner/bridge polling interval (ms) to check endpoint accessibility.
21+
endpoint_poll_ms = 0 # disable poll

src/mctpd.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ struct ctx {
266266

267267
// maximum pool size for assumed MCTP Bridge
268268
uint8_t max_pool_size;
269+
270+
// bus owner/bridge polling interval in usecs for
271+
// checking endpoint's accessibility.
272+
uint64_t endpoint_poll;
269273
};
270274

271275
static int emit_endpoint_added(const struct peer *peer);
@@ -4992,6 +4996,28 @@ static int parse_config_bus_owner(struct ctx *ctx, toml_table_t *bus_owner)
49924996
return rc;
49934997
}
49944998

4999+
val = toml_int_in(bus_owner, "endpoint_poll_ms");
5000+
if (val.ok) {
5001+
uint64_t i = val.u.i;
5002+
if (i == 0) {
5003+
ctx->endpoint_poll = 0;
5004+
if (ctx->verbose) {
5005+
fprintf(stderr, "Bridge poll is disabled\n");
5006+
}
5007+
return 0;
5008+
}
5009+
5010+
if ((i > 100 * 1000) ||
5011+
(i * 1000) < (MCTP_I2C_TSYM_TRECLAIM_MIN_US / 2)) {
5012+
warnx("endpoint polling interval invalid (%u - %u ms)",
5013+
(MCTP_I2C_TSYM_TRECLAIM_MIN_US / 2) / 1000,
5014+
100 * 1000);
5015+
return -1;
5016+
}
5017+
5018+
ctx->endpoint_poll = i * 1000;
5019+
}
5020+
49955021
return 0;
49965022
}
49975023

@@ -5096,6 +5122,7 @@ static void setup_config_defaults(struct ctx *ctx)
50965122
ctx->max_pool_size = 15;
50975123
ctx->dyn_eid_min = eid_alloc_min;
50985124
ctx->dyn_eid_max = eid_alloc_max;
5125+
ctx->endpoint_poll = 0;
50995126
}
51005127

51015128
static void free_config(struct ctx *ctx)

0 commit comments

Comments
 (0)