Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1156031
Add ALLOCATE_ENDPOINT_ID control message support
faizana-nvidia Apr 22, 2025
51a23b4
mctp-control-spec: clarify naming for allocate endpoint IDs defintions
jk-ozlabs Aug 22, 2025
a6529a7
Add mctp bridge endpoint support
faizana-nvidia Apr 23, 2025
0a01694
mctpd: fix EID allocation when only single-EID ranges are present
jk-ozlabs Aug 21, 2025
4ebfd23
mctpd: endpoint_send_set_endpoint_id should only send a Set Endpoint …
jk-ozlabs Aug 21, 2025
56f1c96
Implement ALLOCATE_ENDPOINT_ID support for bridges
faizana-nvidia Apr 24, 2025
1668942
mctpd: minor endpoint_allocate_eid fixups
jk-ozlabs Aug 21, 2025
82859ae
mctpd: rename allocate_eid functions
jk-ozlabs Aug 22, 2025
10fc698
Update mctp document with mctp bridge support
faizana-nvidia Jun 25, 2025
b385d45
Add tests for dynamic bridge eid and downstream eid assignment
faizana-nvidia Jun 30, 2025
44bd750
Add interface au.com.codeconstruct.MCTP.Bridge1
faizana-nvidia Jul 17, 2025
00ed3ee
tests: mctpd: split dynamic bridge test into smaller components
jk-ozlabs Aug 20, 2025
72b1c2a
tests: mctpd: add bridge conflict-from-learnt-eid test
jk-ozlabs Aug 20, 2025
27e5cc4
tests: mctpd: ensure that lack of bridge range space does not prevent…
jk-ozlabs Aug 21, 2025
b81d58f
mctpd: return EEXIST for address conflicts in bridge ranges
jk-ozlabs Aug 21, 2025
c5a6bc9
tests: mctpd: check that SetupEndpoint will not allocate to a bridge …
jk-ozlabs Aug 21, 2025
7686f6c
docs: mctpd: minor bridge doc fixes
jk-ozlabs Aug 21, 2025
a985b9c
docs: mctpd: don't specify EID ranges as contiguous
jk-ozlabs Aug 21, 2025
87b7deb
docs: Add note about bridge allocations on BusOwner1.LearnEndpoint me…
jk-ozlabs Aug 21, 2025
7e121bd
mctpd: move allocate EIDs logging internal to endpoint_allocate_eids()
jk-ozlabs Aug 21, 2025
ec91de4
mctpd: allow bridge allocation with SetupEndpoint
jk-ozlabs Aug 21, 2025
dce893e
mctpd: prevent add-then-remove during SetupEndpoint reassignment
jk-ozlabs Aug 21, 2025
9a13f15
mctpd: remove unnecessary `else` block
jk-ozlabs Aug 21, 2025
0460303
mctpd: use boolean operator for bridge pool check
jk-ozlabs Aug 25, 2025
29b403b
mctpd: constify is_eid_in_bridge_pool
jk-ozlabs Aug 25, 2025
4e6d7db
mctpd: Rename net_learn argument for add_peer, and explain in comments
jk-ozlabs Aug 22, 2025
1805d0b
mctpd: allow for pool allocations that are smaller than our max limit
jk-ozlabs Aug 22, 2025
64de199
tests: remove unused Endpoint.pool_size member
jk-ozlabs Aug 25, 2025
f4870bc
CHANGELOG: Add entry for bridge support
jk-ozlabs Aug 22, 2025
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5. When in endpoint mode, `mctpd` now handles to Set Endpoint ID messages,
assigning an EID to local interfaces.

6. `mctpd` now handles downstream MCTP bridges, which may request an EID
pool from their Set Endpoint ID response. It will attempt an EID allocation
from the dynamic range, and pass this to the bridge using a subsequent
Allocate Endpoint IDs command.

## [2.2] - 2025-07-28

### Fixed
Expand Down
31 changes: 30 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 All @@ -148,6 +152,14 @@ Like SetupEndpoint but will not assign EIDs, will only query endpoints for a
current EID. The `new` return value is set to `false` for an already known
endpoint, or `true` when an endpoint's EID is newly discovered.

Because we are not issuing a Set Endpoint ID as part of the LearnEndpoint call,
we do not have any details of the endpoint's bridge pool range. So,
LearnEndpoint is unsuitable for use with bridge endpoints - it cannot provide
the bridge with its own EID pool. `mctpd` will warn if the device type
reports as a bridge.

Bridge endpoints should be initialised with `AssignEndpoint` instead.

## Network objects: `/au/com/codeconstruct/networks/<net>`

These objects represent MCTP networks which have been added use `mctp link`
Expand Down Expand Up @@ -215,6 +227,23 @@ 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

MCTP endpoints that are set up as a bridge device (and therefore have an
EID pool allocated to them, for downstream devices) also carry the
`MCTP.Bridge1` interface. This provides details of the allocated EID pool, via
two properties:

### `.PoolStart`: `y`

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

### `.PoolEnd`: `y`

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

## Configuration

`mctpd` reads configuration data from a TOML file, typically `/etc/mctpd.conf`.
Expand Down
44 changes: 44 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_allocate_eids_alloc_eids = 0,
mctp_ctrl_cmd_allocate_eids_force_alloc = 1,
mctp_ctrl_cmd_allocate_eids_get_alloc_info = 2,
mctp_ctrl_cmd_allocate_eids_reserved = 3
} mctp_ctrl_cmd_allocate_eids_op;

struct mctp_ctrl_cmd_allocate_eids {
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_allocate_eids {
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 Expand Up @@ -257,6 +279,28 @@ struct mctp_ctrl_resp_resolve_endpoint_id {
#define MCTP_SET_EID_ACCEPTED 0x0
#define MCTP_SET_EID_REJECTED 0x1

/* MCTP Get Endpoint ID request and response fields
* See DSP0236 v1.3.0 Table 15.
*/
#define MCTP_GET_EID_EP_TYPE_SHIFT 4
#define MCTP_GET_EID_EP_TYPE_MASK 0x03
#define GET_MCTP_GET_EID_EP_TYPE(field) \
(((field) >> MCTP_GET_EID_EP_TYPE_SHIFT) & MCTP_GET_EID_EP_TYPE_MASK)
#define MCTP_GET_EID_EP_TYPE_EP 0
#define MCTP_GET_EID_EP_TYPE_BRIDGE 1

#define MCTP_GET_EID_EID_TYPE_SHIFT 0
#define MCTP_GET_EID_EID_TYPE_MASK 0x03
#define GET_MCTP_GET_EID_EID_TYPE(field) \
(((field) >> MCTP_GET_EID_EID_TYPE_SHIFT) & MCTP_GET_EID_EID_TYPE_MASK)
#define MCTP_GET_EID_EID_TYPE_DYNAMIC 0
/* Static EID is supported, may or may not match current */
#define MCTP_GET_EID_EID_TYPE_STATIC 1
/* Current eid is the same as static */
#define MCTP_GET_EID_EID_TYPE_STATIC_SAME 2
/* Current eid is different from static */
#define MCTP_GET_EID_EID_TYPE_STATIC_DIFFERENT 3

#define MCTP_EID_ALLOCATION_STATUS_SHIFT 0x0
#define MCTP_EID_ALLOCATION_STATUS_MASK 0x3
#define SET_MCTP_EID_ALLOCATION_STATUS(status) \
Expand Down
Loading