Skip to content

Commit eea40ad

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 ce42b09 commit eea40ad

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
@@ -59,6 +59,8 @@ static const char *mctpd_appid = "67369c05-4b97-4b7e-be72-65cfd8639f10";
5959

6060
static const char *conf_file_default = MCTPD_CONF_FILE_DEFAULT;
6161

62+
static const uint64_t max_poll_interval_ms = 10000;
63+
static const uint64_t min_poll_interval_ms = 2500;
6264
static const mctp_eid_t eid_alloc_min = 0x08;
6365
static const mctp_eid_t eid_alloc_max = 0xfe;
6466
static const uint8_t MCTP_TYPE_VENDOR_PCIE = 0x7e;
@@ -268,6 +270,10 @@ struct ctx {
268270

269271
// maximum pool size for assumed MCTP Bridge
270272
uint8_t max_pool_size;
273+
274+
// bus owner/bridge polling interval in usecs for
275+
// checking endpoint's accessibility.
276+
uint64_t endpoint_poll;
271277
};
272278

273279
static int emit_endpoint_added(const struct peer *peer);
@@ -5050,6 +5056,18 @@ static int parse_config_bus_owner(struct ctx *ctx, toml_table_t *bus_owner)
50505056
return rc;
50515057
}
50525058

5059+
val = toml_int_in(bus_owner, "endpoint_poll_ms");
5060+
if (val.ok && val.u.i) {
5061+
uint64_t i = val.u.i;
5062+
if ((i > max_poll_interval_ms) || (i < min_poll_interval_ms)) {
5063+
warnx("endpoint polling interval invalid (%lu - %lu ms)",
5064+
min_poll_interval_ms, max_poll_interval_ms);
5065+
return -1;
5066+
}
5067+
5068+
ctx->endpoint_poll = i * 1000;
5069+
}
5070+
50535071
return 0;
50545072
}
50555073

@@ -5154,6 +5172,7 @@ static void setup_config_defaults(struct ctx *ctx)
51545172
ctx->max_pool_size = 15;
51555173
ctx->dyn_eid_min = eid_alloc_min;
51565174
ctx->dyn_eid_max = eid_alloc_max;
5175+
ctx->endpoint_poll = 0;
51575176
}
51585177

51595178
static void free_config(struct ctx *ctx)

0 commit comments

Comments
 (0)