Skip to content

Commit 37eb1b1

Browse files
authored
Merge branch 'main' into mctp_add_retry_
2 parents 2e60e4e + 7ea8652 commit 37eb1b1

13 files changed

Lines changed: 599 additions & 33 deletions

File tree

.github/workflows/pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
run: meson test -C build --verbose
3131

3232
- uses: actions/upload-artifact@v4
33+
if: always()
3334
with:
3435
name: default-meson-testlog
3536
path: build/meson-logs/testlog.txt
@@ -60,6 +61,7 @@ jobs:
6061
run: meson test -C build --verbose
6162

6263
- uses: actions/upload-artifact@v4
64+
if: always()
6365
with:
6466
name: no-libsystemd-meson-testlog
6567
path: build/meson-logs/testlog.txt

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1212

1313
1. Fixed `mctp-bench` compile on musl libc
1414

15+
### Added
16+
17+
1. `mctpd` now implements the Get Vendor Define Message Support control protocol
18+
command, and allows registration of vendor-defined message types via
19+
dbus.
20+
1521
## [2.3] - 2025-10-22
1622

1723
### Fixed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ during development:
125125

126126
```sh
127127
cd obj
128-
pytest
128+
pytest ../tests
129129
```
130130

131131
To run without an existing dbus session:
132132
```sh
133-
dbus-run-session env DBUS_STARTER_BUS_TYPE=user pytest
133+
dbus-run-session env DBUS_STARTER_BUS_TYPE=user pytest ../tests
134134
```
135135

136136
The test infrastructure depends on a few python packages, including the pytest

docs/mctpd.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ the MCTP stack, such as supported message types.
3232
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
3333
au.com.codeconstruct.MCTP1 interface - - -
3434
.RegisterTypeSupport method yau - -
35+
.RegisterVDMTypeSupport method yvq - -
3536
```
3637

3738
#### `.RegisterTypeSupport`: `yau`
@@ -53,6 +54,28 @@ De-registration is automatic - the specified types (and versions) are registered
5354
for as long as the dbus sender remains attached to the message bus, and are
5455
unregistered on disconnect.
5556

57+
#### `.RegisterVDMTypeSupport`: `yvq`
58+
59+
This method is used to add support for MCTP Vendor Defined Message (VDM) types.
60+
Once called successfully, subsequent responses for Get Vendor Defined Message
61+
Support control commands will include this new VDM type.
62+
63+
`RegisterVDMTypeSupport <vid format> <vendor id> <command set type>`
64+
65+
If the VDM type is already registered, then dbus call will fail.
66+
67+
- `<vid format>` Vendor ID format:
68+
- `0x00` - PCI/PCIe Vendor ID (16-bit)
69+
- `0x01` - IANA Enterprise Number (32-bit)
70+
- `<vendor id>` Vendor identifier as a variant type:
71+
- For PCIe format: 16-bit unsigned integer (`q`)
72+
- For IANA format: 32-bit unsigned integer (`u`)
73+
- `<command set type>` Command set type (16-bit unsigned integer) as defined by the vendor
74+
75+
De-registration is automatic - the specified VDM types are registered for as
76+
long as the dbus sender remains attached to the message bus, and are
77+
removed when the sender disconnects.
78+
5679
Also it hosts two trees of MCTP objects:
5780

5881
* Interfaces: Local hardware transport bindings that connect us to a MCTP bus

meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ if libsystemd.found()
9292
dependencies: [libsystemd, toml_dep],
9393
install: true,
9494
install_dir: get_option('sbindir'),
95+
c_args: ['-DOPS_SD_EVENT=1'],
9596
)
9697

9798
mctpd_test = executable('test-mctpd',
@@ -100,6 +101,7 @@ if libsystemd.found()
100101
] + test_ops_sources + netlink_sources + util_sources,
101102
include_directories: include_directories('src'),
102103
dependencies: [libsystemd, toml_dep],
104+
c_args: ['-DOPS_SD_EVENT=1'],
103105
)
104106
endif
105107

src/mctp-ops.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ const struct mctp_ops mctp_ops = {
7474
.recvfrom = mctp_op_recvfrom,
7575
.close = mctp_op_close,
7676
},
77+
#if OPS_SD_EVENT
78+
.sd_event = {
79+
.add_time_relative = sd_event_add_time_relative,
80+
.source_set_time_relative = sd_event_source_set_time_relative,
81+
},
82+
#endif
7783
.bug_warn = mctp_bug_warn,
7884
};
7985

src/mctp-ops.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
#include <sys/socket.h>
1111
#include <stdarg.h>
12+
#if OPS_SD_EVENT
13+
#include <systemd/sd-event.h>
14+
#endif
1215

1316
#define _GNU_SOURCE
1417

@@ -24,9 +27,19 @@ struct socket_ops {
2427
int (*close)(int sd);
2528
};
2629

30+
#if OPS_SD_EVENT
31+
struct sd_event_ops {
32+
typeof(sd_event_add_time_relative) *add_time_relative;
33+
typeof(sd_event_source_set_time_relative) *source_set_time_relative;
34+
};
35+
#endif
36+
2737
struct mctp_ops {
2838
struct socket_ops mctp;
2939
struct socket_ops nl;
40+
#if OPS_SD_EVENT
41+
struct sd_event_ops sd_event;
42+
#endif
3043
void (*bug_warn)(const char *fmt, va_list args);
3144
};
3245

0 commit comments

Comments
 (0)