Skip to content

Commit bcc2cbd

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 236330c commit bcc2cbd

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ struct ctx {
248248

249249
// maximum pool size for assumed MCTP Bridge
250250
uint8_t max_pool_size;
251+
252+
// bus owner/bridge polling interval in usecs for
253+
// checking endpoint's accessibility.
254+
uint64_t endpoint_poll;
251255
};
252256

253257
static int emit_endpoint_added(const struct peer *peer);
@@ -4752,6 +4756,26 @@ static int parse_config_bus_owner(struct ctx *ctx, toml_table_t *bus_owner)
47524756
return rc;
47534757
}
47544758

4759+
val = toml_int_in(bus_owner, "endpoint_poll_ms");
4760+
if (val.ok) {
4761+
uint64_t i = val.u.i;
4762+
if (i == 0) {
4763+
ctx->endpoint_poll = 0;
4764+
fprintf(stderr, "Bridge poll is disabled\n");
4765+
return 0;
4766+
}
4767+
4768+
if ((i > 100 * 1000) ||
4769+
(i * 1000) < (MCTP_I2C_TSYM_TRECLAIM_MIN_US / 2)) {
4770+
warnx("endpoint polling interval invalid (%u - %u ms)",
4771+
(MCTP_I2C_TSYM_TRECLAIM_MIN_US / 2) / 1000,
4772+
100 * 1000);
4773+
return -1;
4774+
}
4775+
4776+
ctx->endpoint_poll = i * 1000;
4777+
}
4778+
47554779
return 0;
47564780
}
47574781

@@ -4853,6 +4877,7 @@ static void setup_config_defaults(struct ctx *ctx)
48534877
ctx->max_pool_size = 15;
48544878
ctx->dyn_eid_min = eid_alloc_min;
48554879
ctx->dyn_eid_max = eid_alloc_max;
4880+
ctx->endpoint_poll = 2500000; //2.5s
48564881
}
48574882

48584883
static void free_config(struct ctx *ctx)

0 commit comments

Comments
 (0)