0a6d6821 | 22-Aug-2023 |
Andrew Jeffery <andrew@aj.id.au> |
transport: Stabilise core transport and implementation APIs
The following two patches demonstrate their use in pldmd:
1. https://gerrit.openbmc.org/c/openbmc/pldm/+/63652 2. https://gerrit.openbmc.
transport: Stabilise core transport and implementation APIs
The following two patches demonstrate their use in pldmd:
1. https://gerrit.openbmc.org/c/openbmc/pldm/+/63652 2. https://gerrit.openbmc.org/c/openbmc/pldm/+/65676
In the process, deprecate the old requester APIs. These are unsuitable for OpenBMC going forward, which will rely on AF_MCTP sockets for the MCTP transport implementation.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I94a9d9ff5fc67d5d6cf9a2393ebef12fa7b277d7
show more ...
|
45816b89 | 22-Aug-2023 |
Andrew Jeffery <andrew@aj.id.au> |
transport: mctp-demux: Drop ABI annotation for internal symbols
The symbols need to be exposed beyond the translation unit and so cannot be static, but we also do not want them exposed in the public
transport: mctp-demux: Drop ABI annotation for internal symbols
The symbols need to be exposed beyond the translation unit and so cannot be static, but we also do not want them exposed in the public symbol table of the shared object as they only exist for internal purposes.
Drop the ABI annotation so the symbols are hidden from the symbol table by the linker.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I1316705277b683767ab15bb6526010b0c7c6e121
show more ...
|
16cd5232 | 22-Aug-2023 |
Thu Nguyen <thu@os.amperecomputing.com> |
transport: Match specified metadata in pldm_transport_send_recv_msg()
The mctp-demux broadcasts the PLDM RX response messages to all of mctp socket instances. That means the GetSensorReading respons
transport: Match specified metadata in pldm_transport_send_recv_msg()
The mctp-demux broadcasts the PLDM RX response messages to all of mctp socket instances. That means the GetSensorReading response from one instance (pldmd) can be received by the other instance (pldmtool) which is waiting for the response of GetPDR request message. When the gap time between the two requests of pldmtool is long enough the number of GetSensorReading response messages can be more than 32. That means the instance ID of new GetPDR command in pldmtool can equal with the used and free one in GetSensorReading. So the `pldm_transport_send_recv_msg()` will match the response of GetSensorReading with the response of GetPDR. So only comparing the instance ID in `pldm_transport_send_recv_msg` is not enough.
Section "Requirements for requesters" in DSP0240 version 1.1.0, "A PLDM terminus that issues PLDM requests should be prepared to handle the order of responses that may not match the order in which the requests were sent (that is, it should not automatically assume that a response that it receives is in the order in which the request was sent). It should check to see that the PLDM Type, PLDM Command Code, and Instance ID values in the response match up with a corresponding outstanding command before acting on any parameters returned in the response."
Add the PLDM type and command code on matching the response of `pldm_transport_send_recv_msg()`.
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com> Change-Id: I7284bd4ecd8be3786fa078af1eb3f06046e4baa3
show more ...
|
24576290 | 30-Jul-2023 |
Rashmica Gupta <rashmica@linux.ibm.com> |
transport: Generalise the pldm_transport_recv_msg() API
Currently pldm_transport_recv_msg() only works for requesters as the TID param is an input. Responders need the source TID of the message rece
transport: Generalise the pldm_transport_recv_msg() API
Currently pldm_transport_recv_msg() only works for requesters as the TID param is an input. Responders need the source TID of the message received so they know where to send the response.
The TID was being used to look up the EID mapped to the TID and failing the function call if it didn't match. This check doesn't need to happen at this level, and can be added in at the requester API level if required.
Make the TID param an output, and use the EID of the message to lookup the TID.
Change-Id: I671dbfe2d94a9ad8d77ea0ef150f1c744f928c53 Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com>
show more ...
|
7caa8af1 | 17-Aug-2023 |
Andrew Jeffery <andrew@aj.id.au> |
transport: af-mctp: Ensure malloc() succeeds in *_recv()
Avoid a potential NULL-pointer dereference - don't assume we're executing under Linux.
Fixes: ba6971b9ae69 ("requester: Add af_mctp transpor
transport: af-mctp: Ensure malloc() succeeds in *_recv()
Avoid a potential NULL-pointer dereference - don't assume we're executing under Linux.
Fixes: ba6971b9ae69 ("requester: Add af_mctp transport") Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ieb73ace2b981eb94b710000b25e8bed3a6e34e7e
show more ...
|
ac24737c | 17-Aug-2023 |
Andrew Jeffery <andrew@aj.id.au> |
transport: af-mctp: Assign out-params on success in *_recv()
More specifically, don't assign to out-params while it's possible we can fail.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id
transport: af-mctp: Assign out-params on success in *_recv()
More specifically, don't assign to out-params while it's possible we can fail.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ib848d1b363288e5f0b76885ff96500d09ddfc2bf
show more ...
|
2a6a342d | 17-Aug-2023 |
Andrew Jeffery <andrew@aj.id.au> |
transport: af-mctp: Organise variable declarations in *_recv()
Align more closely with kernel-style C where we can.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ic40d0801fbfd3fde4ad49
transport: af-mctp: Organise variable declarations in *_recv()
Align more closely with kernel-style C where we can.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ic40d0801fbfd3fde4ad4955903cb90265b6fe4b4
show more ...
|
27f041ca | 17-Aug-2023 |
Andrew Jeffery <andrew@aj.id.au> |
transport: mctp-demux: Use a common cleanup path in *_recv()
Previously the error paths were all individually freeing the heap-allocated message data buffer. Provide a common path instead, as we wil
transport: mctp-demux: Use a common cleanup path in *_recv()
Previously the error paths were all individually freeing the heap-allocated message data buffer. Provide a common path instead, as we will soon add another error path to the implementation.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I3356cc503cf774f68237548b79a9a0b0d76134d7
show more ...
|
ef293fcb | 17-Aug-2023 |
Andrew Jeffery <andrew@aj.id.au> |
transport: mctp-demux: Organise variable declarations in *_recv()
Align more closely with kernel-style C where we can.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I361a10a6a59c4bf4dc
transport: mctp-demux: Organise variable declarations in *_recv()
Align more closely with kernel-style C where we can.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I361a10a6a59c4bf4dce53d5112e7fe06e7a71444
show more ...
|
f1ebde49 | 30-Jul-2023 |
Rashmica Gupta <rashmica@linux.ibm.com> |
transport: Fix doxygen and variables for send and recv functions
This was missed updated properly when making the transport functions work for both requesters and responders.
Fixes: c1b66f420912 ("
transport: Fix doxygen and variables for send and recv functions
This was missed updated properly when making the transport functions work for both requesters and responders.
Fixes: c1b66f420912 ("requester: Add new APIs to support multiple transports") Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com> Change-Id: Ie32f11a98ab1b11caaafbca5e837e1eda5c9cc37
show more ...
|
d10c6b0c | 23-Jul-2023 |
Rashmica Gupta <rashmica@linux.ibm.com> |
requester: Use the EID as the TID when we don't have the TID
We are doing this in other places, so for consistencies sake do it here too.
Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com> Chan
requester: Use the EID as the TID when we don't have the TID
We are doing this in other places, so for consistencies sake do it here too.
Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com> Change-Id: I94935561dd3871ba3b0b179b4311fafcb3bcb1b4
show more ...
|
36402ffb | 16-Aug-2023 |
BonnieLo-wiwynn <Bonnie_Lo@wiwynn.com> |
transport: fix init_pollfd function parameter
The init_pollfd function parameter was declared as pldm_transport_af_mctp, but it seems like it is intended to use pldm_transport instead. The headers w
transport: fix init_pollfd function parameter
The init_pollfd function parameter was declared as pldm_transport_af_mctp, but it seems like it is intended to use pldm_transport instead. The headers were not included in c files, so it didn't cause conflicting types at compile time.
Change-Id: I54f1397efee0ae5e68a24f1473e0395f02d53eaf Fixes: c1b66f4 ("requester: Add new APIs to support multiple transports") Fixes: ba6971b ("requester: Add af_mctp transport") Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
show more ...
|
def8e024 | 16-Aug-2023 |
Pavithra Barithaya <pavithra.b@ibm.com> |
pdr: Stabilize pldm_entity_node_get_remote_container_id()
Use of pldm_entity_node_get_remote_container_id() is demonstrated here:
https://gerrit.openbmc.org/c/openbmc/pldm/+/39198
Change-Id: If8df
pdr: Stabilize pldm_entity_node_get_remote_container_id()
Use of pldm_entity_node_get_remote_container_id() is demonstrated here:
https://gerrit.openbmc.org/c/openbmc/pldm/+/39198
Change-Id: If8df1d73b1ea6e319b200ee76d4d4ac2e00ef9aa Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>
show more ...
|
b4cd5172 | 14-Aug-2023 |
Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com> |
transport: register init_pollfd callback for af-mctp
This was missed when initializing af-mctp.
Fixes: ba6971b9ae69 ("requester: Add af_mctp transport") Change-Id: Idf3589a2544ce277639e89359904112a
transport: register init_pollfd callback for af-mctp
This was missed when initializing af-mctp.
Fixes: ba6971b9ae69 ("requester: Add af_mctp transport") Change-Id: Idf3589a2544ce277639e89359904112aeae09073 Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
show more ...
|
7062382a | 10-Aug-2023 |
Andrew Jeffery <andrew@aj.id.au> |
pdr: Avoid ID overflow in pldm_entity_association_tree_add_entity()
Return early from pldm_entity_association_tree_add_entity() if the container ID space has been exhausted.
Signed-off-by: Andrew
pdr: Avoid ID overflow in pldm_entity_association_tree_add_entity()
Return early from pldm_entity_association_tree_add_entity() if the container ID space has been exhausted.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ifc4ef529a8746c3b27b8925be1a038089f2f2729
show more ...
|
255f6549 | 10-Aug-2023 |
Andrew Jeffery <andrew@aj.id.au> |
pdr: Remove pldm_entity_association_pdr_add()
pldm_entity_association_pdr_add() was deprecated with the stabilisation of pldm_entity_association_pdr_add_check() in 096685b4768e ("pdr: Stabilise pldm
pdr: Remove pldm_entity_association_pdr_add()
pldm_entity_association_pdr_add() was deprecated with the stabilisation of pldm_entity_association_pdr_add_check() in 096685b4768e ("pdr: Stabilise pldm_entity_association_pdr_add_check()"). We've had an intervening tag, so remove it now
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I43df7451d3ed8d6c8f755e6bf23f335e2911184c
show more ...
|
1ade87f4 | 28-Jul-2023 |
Pavithra Barithaya <pavithra.b@ibm.com> |
pdr : Stabilize pldm_entity_association_tree_add_entity()
Use of pldm_entity_association_tree_add_entity() is demonstrated here:
https://gerrit.openbmc.org/c/openbmc/pldm/+/44699
Change-Id: I4f756
pdr : Stabilize pldm_entity_association_tree_add_entity()
Use of pldm_entity_association_tree_add_entity() is demonstrated here:
https://gerrit.openbmc.org/c/openbmc/pldm/+/44699
Change-Id: I4f75685bba5b44da0b3b853dbc2853b4d5676530 Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>
show more ...
|
dc1edacf | 07-Aug-2023 |
Andrew Jeffery <andrew@aj.id.au> |
transport: test: Pass time to trigger pldm_transport_poll(..., 0)
The test transport uses a timerfd to implement latency when required, but also to indicate readiness when latency hasn't been specif
transport: test: Pass time to trigger pldm_transport_poll(..., 0)
The test transport uses a timerfd to implement latency when required, but also to indicate readiness when latency hasn't been specified. The implementation for immediate readiness is a bit of a hack, as it just sets an exceptionally short timer period (1ns). However, intermittently it appears this 1ns expiry is not exceeded by the time we test the fd state via poll().
To resolve that issue, ensure we've waited twice the timer expiry period.
Also fix a subsequent segfault when the readiness test fails. The memcmp(msg, ...) invocation must be protected by a prior `ASSERT_EQ()` as the msg pointer may not be valid if the result is not PLDM_REQUESTER_SUCCESS (execution is allowed to proceed if an EXPECT_*() condition fails).
Prior to the fix the failure was often triggered at least once with the following invocation:
``` meson test -C build --repeat 10 --test-args="--gtest_filter=Transport.send_recv_drain_one_unwanted" transport ```
After the fix, increasing the repeat count up to 100 failed to reproduce the failure.
Fixes: f56e4dcd2545 ("transport: free un-wanted responses in pldm_transport_send_recv_msg()") Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: If67c58f5c7f06ce76d24b8c6b9430ae080d83441
show more ...
|
7570fae4 | 28-Jul-2023 |
Pavithra Barithaya <pavithra.b@ibm.com> |
pdr: Stabilise pldm_entity_association_tree_find_with_locality()
Use of pldm_entity_association_tree_find_with_locality()(Previously pldm_entity_association_tree_find_if_remote())is demonstrated her
pdr: Stabilise pldm_entity_association_tree_find_with_locality()
Use of pldm_entity_association_tree_find_with_locality()(Previously pldm_entity_association_tree_find_if_remote())is demonstrated here:
https://gerrit.openbmc.org/c/openbmc/pldm/+/44699
Change-Id: I715bcd63eb05442be097d6cc0682b1fb25ea3c07 Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>
show more ...
|
302d9ff2 | 01-Aug-2023 |
Sagar Srinivas <sagar.srinivas@ibm.com> |
pdr: Rename pldm_entity_association_tree_find_if_remote()
Rename pldm_entity_association_tree_find_if_remote() to pldm_entity_association_tree_find_with_locality(), instead of being specific on remo
pdr: Rename pldm_entity_association_tree_find_if_remote()
Rename pldm_entity_association_tree_find_if_remote() to pldm_entity_association_tree_find_with_locality(), instead of being specific on remote entity, rather keeping it generic.
Discussion at https://gerrit.openbmc.org/c/openbmc/libpldm/+/65481/7/src/pdr.c
Change-Id: Icb89d6919d8a2cba6fbba216dd2be70637ba0216 Signed-off-by: Sagar Srinivas <sagar.srinivas@ibm.com>
show more ...
|
f3e0a2da | 31-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
msgbuf: Remove duplicate fixup of _Static_assert() for C++
Not entirely sure how we didn't catch this previously.
Fixes: 062c8762c7eb ("msgbuf: Add insert and span APIs") Signed-off-by: Andrew Jeff
msgbuf: Remove duplicate fixup of _Static_assert() for C++
Not entirely sure how we didn't catch this previously.
Fixes: 062c8762c7eb ("msgbuf: Add insert and span APIs") Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I1fcff90cb9f31fb3f5036393201a8ab5e27724b7
show more ...
|
f56e4dcd | 23-Jul-2023 |
Thu Nguyen <thu@os.amperecomputing.com> |
transport: free un-wanted responses in pldm_transport_send_recv_msg()
mctp-demux broadcasts the PLDM response messages to all of mctp socket instances. That means the GetSensorReading response from
transport: free un-wanted responses in pldm_transport_send_recv_msg()
mctp-demux broadcasts the PLDM response messages to all of mctp socket instances. That means the GetSensorReading response from one instance (pldmd) can be received by the other instance (pldmtool) which is waiting for the response of GetPDR request message. When the gap time between the two requests of pldmtool is long enough the number of GetSensorReading response messages can be more than 32. That means the instance ID of new GetPDR command in pldmtool can equal with the used and free one in GetSensorReading. The `pldm_transport_send_recv_msg()` will detect the reponse of GetSensorReading as the response of the GetPDR request.
To prevent this unexpected behavior the `pldm_transport_send_recv_msg()` should free the un-wanted responses before sending new PLDM request. The serialised message to be sent must already encode an allocated instance ID, which by the specification must not be reused before expiry. Therefore after the socket is drained, any subsequent response containing the request's instance ID must be the response matching the request.
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com> [AJ: Add a test, massage the commit message] Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I6c684bdaea2ba5d96b24ecd3c72e846c644fb16d
show more ...
|
ef485068 | 14-Jul-2023 |
Thu Nguyen <thu@os.amperecomputing.com> |
transport: Correct comparison in while loop condition
With the latest libpldm code version 0.4, sometimes the calling `pldmtool platform GetPDR` command while polling the sensors will be ended with
transport: Correct comparison in while loop condition
With the latest libpldm code version 0.4, sometimes the calling `pldmtool platform GetPDR` command while polling the sensors will be ended with the error `Failed to receive RC = 8`. This error code is printed when the `pldm_transport_send_recv_msg()` responses PLDM_REQUESTER_RECV_FAIL when it exits the while loop. The while loop will continue while the now time is still not later than the end time. The comparison should be corrected.
Tested: 1. Call "pldmtool platform GetPDR" while reading the sensors. 2. No "Failed to receive RC = 8". 3. Added a test case and verified we see multiple invocations of poll:
``` 22:49:31.807615 timerfd_create(CLOCK_MONOTONIC, 0) = 3 22:49:31.807774 timerfd_settime(3, 0, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=0, tv_nsec=0}}, NULL) = 0 22:49:31.807893 timerfd_settime(3, 0, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=1, tv_nsec=0}}, NULL) = 0 22:49:31.808009 ppoll([{fd=3, events=POLLIN}], 1, {tv_sec=4, tv_nsec=800000000}, NULL, 0) = 1 ([{fd=3, revents=POLLIN}], left {tv_sec=3, tv_nsec=799317702}) 22:49:32.809245 timerfd_settime(3, 0, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=0, tv_nsec=0}}, NULL) = 0 22:49:32.810336 timerfd_settime(3, 0, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=4, tv_nsec=0}}, NULL) = 0 22:49:32.810899 ppoll([{fd=3, events=POLLIN}], 1, {tv_sec=3, tv_nsec=798000000}, NULL, 0) = 0 (Timeout) 22:49:36.614235 close(3) = 0 ```
Fixes: abaf61f45e2a ("transport: Prevent sticking in waiting for response") Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com> [AJ: Add unit test] Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: If1829a35d755d68fd6a18d8e6ad54d1648ccc4ce
show more ...
|
9a6ba89c | 18-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
transport: Introduce a transport for testing purposes
I've put the test transport header along side the source file as its presence and implementation is an internal detail to support the test suite
transport: Introduce a transport for testing purposes
I've put the test transport header along side the source file as its presence and implementation is an internal detail to support the test suite. No consumers of libpldm outside its test suite should have any need for the test transport. We can always choose to make the header public if for some reason someone does eventually want to use it.
In addition, add a new test suite exercising the transport interfaces.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ie9906bdc6a397436b91198196de04ffd6c93fc46
show more ...
|
ef47e2f4 | 19-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
libpldm: Migrate ARRAY_SIZE() to internal header
This allows use of the macro throughout the codebase, discouraging copy/paste.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ia05cfbf2f
libpldm: Migrate ARRAY_SIZE() to internal header
This allows use of the macro throughout the codebase, discouraging copy/paste.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ia05cfbf2f1d82a80c276d60f1d9eecb2075fdc59
show more ...
|