Skip to content

Mctp bridge support #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion docs/mctpd.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ busctl call au.com.codeconstruct.MCTP1 \

Similar to SetupEndpoint, but will always assign an EID rather than querying for
existing ones. Will return `new = false` when an endpoint is already known to
`mctpd`.
`mctpd`. If the endpoint is an MCTP bridge (indicated by requesting a pool size
in its Set Endpoint ID response), this method attempts to allocate a contiguous
range of EIDs for the bridge's downstream endpoints. If sufficient contiguous EIDs
are not available within the dynamic allocation pool for the network, only the
bridge's own EID will be assigned, and downstream EID allocation will fail.

#### `.AssignEndpointStatic`: `ayy` → `yisb`

Expand Down Expand Up @@ -215,6 +219,22 @@ busctl call au.com.codeconstruct.MCTP1 \

Removes the MCTP endpoint from `mctpd`, and deletes routes and neighbour entries.

### MCTP bridge interface: `au.com.codeconstruct.MCTP.Bridge1` interface
For any endpoint which also happens to be an MCTP Bridge, if dynamic eid is
assgined to it via d-bus method `.AssignEndpoint`, such endpoint's pool
allocation details would be reflected into `au.com.codeconstruct.MCTP.Bridge1`
interface of bridge's endpoint object.

### `.PoolEnd`: `y`

A constant property representing last EID in the contiguous range allocated
for downstream endpoints.

### `.PoolStart`: `y`

A constant property representing first EID in the contiguous range allocated
for downstream endpoints.

## Configuration

`mctpd` reads configuration data from a TOML file, typically `/etc/mctpd.conf`.
Expand Down
22 changes: 22 additions & 0 deletions src/mctp-control-spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,28 @@ struct mctp_ctrl_resp_resolve_endpoint_id {
// ... uint8_t physical_address[N]
} __attribute__((__packed__));

typedef enum {
mctp_ctrl_cmd_alloc_eid_alloc_eid = 0,
mctp_ctrl_cmd_alloc_eid_force_alloc = 1,
mctp_ctrl_cmd_alloc_eid_get_alloc_info = 2,
mctp_ctrl_cmd_alloc_eid_reserved = 3
} mctp_ctrl_cmd_alloc_eid_op;

struct mctp_ctrl_cmd_alloc_eid {
struct mctp_ctrl_msg_hdr ctrl_hdr;
uint8_t alloc_eid_op;
uint8_t pool_size;
uint8_t start_eid;
} __attribute__((__packed__));

struct mctp_ctrl_resp_alloc_eid {
struct mctp_ctrl_msg_hdr ctrl_hdr;
uint8_t completion_code;
uint8_t status;
uint8_t eid_pool_size;
uint8_t eid_set;
} __attribute__((__packed__));

#define MCTP_CTRL_HDR_MSG_TYPE 0
#define MCTP_CTRL_HDR_FLAG_REQUEST (1 << 7)
#define MCTP_CTRL_HDR_FLAG_DGRAM (1 << 6)
Expand Down
Loading