Repository navigation
mctpd: Automatic Discovery Notify for endpoint role #159
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -537,6 +537,11 @@ async def handle_mctp_control(self, sock, addr, data): | |
| ) | ||
| await sock.send(raddr, data) | ||
|
|
||
| elif opcode == 0x0D: | ||
| # Discovery Notify — respond with completion_code = 0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor, but not sure we need an em-dash here. |
||
| data = bytes(hdr + [0x00]) | ||
| await sock.send(raddr, data) | ||
|
|
||
| else: | ||
| await sock.send( | ||
| raddr, bytes(hdr + [0x05]) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| import asyncdbus | ||
| from mctp_test_utils import ( | ||
| mctpd_mctp_iface_control_obj, | ||
| mctpd_mctp_iface_endpoint_obj, | ||
| mctpd_mctp_endpoint_control_obj, | ||
| ) | ||
| from mctpenv import ( | ||
|
|
@@ -218,3 +219,34 @@ async def test_simple(self, dbus, mctpd): | |
| mctpd.network.mctp_socket, MCTPControlCommand(True, 0, 0x0B) | ||
| ) | ||
| assert rsp.hex(' ') == '00 0b 05' | ||
|
|
||
|
|
||
| class TestDiscoveryNotify: | ||
| """Discovery Notify for I3C endpoints with a 6-byte bus owner PID.""" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't really explain what the test is checking, just the test environment. |
||
|
|
||
| # Example 6-byte I3C Provisional ID of the bus owner | ||
| BO_PID = bytes([0x00, 0x6C, 0x90, 0x01, 0x23, 0x45]) | ||
|
|
||
| @pytest.fixture | ||
| async def iface(self): | ||
| return System.Interface( | ||
| "mctp0", 1, 1, bytes([0x1D]), 68, 254, True, PhysicalBinding.I3C | ||
| ) | ||
|
|
||
| @pytest.fixture | ||
| async def sysnet(self, iface): | ||
| system = System() | ||
| await system.add_interface(iface) | ||
| network = Network() | ||
| network.add_endpoint(Endpoint(iface, self.BO_PID, eid=8)) | ||
| return Sysnet(system, network) | ||
|
|
||
| async def test_discovery_notify_on_set_bus_owner(self, dbus, mctpd): | ||
| """Discovery Notify is sent automatically when the 6-byte I3C bus owner PID is set.""" | ||
| iface = mctpd.system.interfaces[0] | ||
| bo = mctpd.network.endpoints[0] | ||
|
|
||
| ep = await mctpd_mctp_iface_endpoint_obj(dbus, iface) | ||
| # Set the bus owner's 6-byte I3C PID; this satisfies all conditions | ||
| # and triggers Discovery Notify to the bus owner immediately. | ||
| await ep.set_bus_owner(bo.lladdr) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't actually checking anything. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like it should be a (writable) property then? Should clients be able to query the current bus owner value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to property.
I think getter is needed for non-basic type properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that looks good for the interface.
And yes, all good with the explicit get & set methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thought here: what's the API intention for when no bus owner is set? and how do we distinguish that from cases where there is no physical addressing mechanism (eg, USB & serial transports).
We should probably document that here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi. I see only I3C and PCIe spec mention abount sending discovery notify to announce endpoint presence.
can I add to doc like this ?
For transport types that do not use physical addressing for bus owner communication (such as USB and serial), this property has no effect; Discovery Notify is only triggered on transports that require it (PCIe VDM and I3C).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated docs..