Skip to content

Commit b8d3227

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 b8d3227

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

conf/mctpd.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ 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+
# A value of 0 disables polling.
22+
endpoint_poll_ms = 0

src/mctpd.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ static const char *conf_file_default = MCTPD_CONF_FILE_DEFAULT;
6161

6262
static const mctp_eid_t eid_alloc_min = 0x08;
6363
static const mctp_eid_t eid_alloc_max = 0xfe;
64+
static const uint64_t max_poll_interval_ms = 10000;
65+
static const uint64_t min_poll_interval_ms = 2500;
6466

6567
// arbitrary sanity
6668
static size_t MAX_PEER_SIZE = 1000000;
@@ -266,6 +268,10 @@ struct ctx {
266268

267269
// maximum pool size for assumed MCTP Bridge
268270
uint8_t max_pool_size;
271+
272+
// bus owner/bridge polling interval in usecs for
273+
// checking endpoint's accessibility.
274+
uint64_t endpoint_poll;
269275
};
270276

271277
static int emit_endpoint_added(const struct peer *peer);
@@ -4992,6 +4998,18 @@ static int parse_config_bus_owner(struct ctx *ctx, toml_table_t *bus_owner)
49924998
return rc;
49934999
}
49945000

5001+
val = toml_int_in(bus_owner, "endpoint_poll_ms");
5002+
if (val.ok && val.u.i) {
5003+
uint64_t i = val.u.i;
5004+
if ((i > max_poll_interval_ms) || (i < min_poll_interval_ms)) {
5005+
warnx("endpoint polling interval invalid (%lu - %lu ms)",
5006+
min_poll_interval_ms, max_poll_interval_ms);
5007+
return -1;
5008+
}
5009+
5010+
ctx->endpoint_poll = i * 1000;
5011+
}
5012+
49955013
return 0;
49965014
}
49975015

@@ -5096,6 +5114,7 @@ static void setup_config_defaults(struct ctx *ctx)
50965114
ctx->max_pool_size = 15;
50975115
ctx->dyn_eid_min = eid_alloc_min;
50985116
ctx->dyn_eid_max = eid_alloc_max;
5117+
ctx->endpoint_poll = 0;
50995118
}
51005119

51015120
static void free_config(struct ctx *ctx)

0 commit comments

Comments
 (0)