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

Connection error in SPDM_EMU when using SPDM over MCTP #312

Open
amuthakrishnasamy opened this issue Dec 7, 2023 · 3 comments
Open

Connection error in SPDM_EMU when using SPDM over MCTP #312

amuthakrishnasamy opened this issue Dec 7, 2023 · 3 comments

Comments

@amuthakrishnasamy
Copy link

Hi Jiewen,

I am creating requester and responder model using SPDM_EMU.
Raspberry pi is used to simulate requester model and Riscv32 processor to used to simulate responder model.
Requester and responder is connected thru I2C.
However, for requester implementation in https://github.com/DMTF/spdm-emu/blob/main/spdm_emu/spdm_emu_common/spdm_emu.c SPDM_EMU, init_client function, I see the socket communication is happening thru TCP packet
bool init_client(SOCKET *sock, uint16_t port)
{
SOCKET client_socket;
struct sockaddr_in server_addr;
int32_t ret_val;

#ifdef _MSC_VER
WSADATA ws;
if (WSAStartup(MAKEWORD(2, 2), &ws) != 0) {
printf("Init Windows socket Failed - %x\n", WSAGetLastError());
return false;
}
#endif
client_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (client_socket == INVALID_SOCKET) {
printf("Create socket Failed - %x\n",
#ifdef _MSC_VER
WSAGetLastError()
#else
errno
#endif
);
return false;
}

I am getting connection error ( on requester side) due to there is no TCP connection between requester and responder.
What would be the suggested implementation that I can use to make connection between requester and responder over MCTP transport layer and I2C/SMBUS.

Thanks
AKrishnasamy

@jyao1
Copy link
Member

jyao1 commented Dec 9, 2023

spdm-emu is just an emulation program running on Windows/Linux OS environment with TCP/IP.

If you want to use it MCTP, then it is NOT an emulation. It is a real platform environment.
You need to write your own device layer function to send/receive function.

See https://github.com/DMTF/libspdm/blob/main/doc/user_guide.md#spdm-responder

0.5, implement required SPDM device IO functions - libspdm_device_send_message_func and libspdm_device_receive_message_func according to spdm_common_lib.

@admiyo
Copy link

admiyo commented Dec 14, 2023

If I run --trans MCTP it still does everything as tcp/ip.

MCTP supports a socket layer, so instead of listening on tcp, it should listen on an MCTP socket, like the echo listener here:

https://github.com/CodeConstruct/mctp/blob/main/src/mctp-echo.c

But all the socket calls are TCP/IP.

Is this a change in how it was intended to be used?

@alistair23
Copy link
Contributor

Another option is to use SPDM-Utils. Like spdm-emu it uses libspdm but is aimed at testing real devices instead of emulators.

SPDM-Utils can currently communicate with a SPDM device over PCIe DOE. We don't yet have MCTP support, but we are working on it. It should be pretty easy for you to extend SPDM-Utils to support MCTP as well

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

No branches or pull requests

4 participants