Skip to content
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

Make mctp-req generic #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

leiyu-bytedance
Copy link

No description provided.

@jk-ozlabs jk-ozlabs self-requested a review October 31, 2022 00:55
Copy link
Member

@jk-ozlabs jk-ozlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good: a couple of fixups mentioned in the code though.

I think we should simplify the user interface for this a little - I'd suggest making the data argument mandatory (sending sequential bytes was handy while bringing up the kernel interface, but now that's done, it's no longer very useful). That means we could drop the len argument too (since we can calculate that from the data argument). I'm also fine with making the type argument mandatory too - assuming PLDM is a bit strange (again, this was from the kernel bringup, where we just needed an arbitrary type value).

Then, we would no longer need the conditional code in the mctp_req() function that re-uses the rxbuf, and just always use separate buffers for tx & rx.

src/mctp-req.c Show resolved Hide resolved
src/mctp-req.c Show resolved Hide resolved
src/mctp-req.c Show resolved Hide resolved
src/mctp-req.c Outdated Show resolved Hide resolved
src/mctp-req.c Show resolved Hide resolved
@leiyu-bytedance
Copy link
Author

Added a new commit to install the systemd units.

@jk-ozlabs
Copy link
Member

Added a new commit to install the systemd units.

That would be better as a separate PR.

@jk-ozlabs
Copy link
Member

@leiyu-bytedance just wanted to check-in on this - anything pending from your side?

@leiyu-bytedance
Copy link
Author

Oh, we totally missed this.
Will update the PRs a bit later

The usage description is missing the `data` argument, add it and an
example of how it is used.

Signed-off-by: Lei YU <[email protected]>
The mctp-req was acting like a echo client that sends and receive the
same data.

Change the code to make it a generic sender and receiver, so that user
could use it to send all types of data and prints the received data.
* Add a `type` argument to specify the mctp type, default to 1 (PLDM).
* Remove the code that expects the same len and data for sent and
  received data.
* Add print of the received data.

Tested: Get UUID of an endpoint:

    $ mctp-req eid 9 type 0 data 80:03
    req:  sending to (net 1, eid 9), type 0, len 2
    req:  message from (net 1, eid 9) type 0 len 19
    data:
    0x00 0x03 0x00 0x7e 0x92 0x05 0xfc 0x01 0xc2 0xeb 0x11 0x80 0x00 0xb8
    0xce 0xf6 0xae 0xcd 0x16

Signed-off-by: Lei YU <[email protected]>
@leiyu-bytedance
Copy link
Author

Added a new commit to install the systemd units.

That would be better as a separate PR.

#13

@khangng-ampere
Copy link

@leiyu-bytedance The new branch lost some requested change above, you may want to review them again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants