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 ...
|
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 ...
|
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 ...
|
14d2984b | 17-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
pdr: Remove pldm_pdr_add_fru_record_set()
pldm_pdr_add_fru_record_set() was deprecated in v0.4.0, remove it now.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I3a3f76baf9dca84e2c6b8674
pdr: Remove pldm_pdr_add_fru_record_set()
pldm_pdr_add_fru_record_set() was deprecated in v0.4.0, remove it now.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I3a3f76baf9dca84e2c6b867448257a0b6e2ab178
show more ...
|
c79a5df5 | 17-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
pdr: Remove pldm_pdr_add()
pldm_pdr_add() was deprecated in v0.4.0, remove it now.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ie8a00749a0473cb76e503cf88d5ae1379918a0a6 |
50dd159e | 14-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Remove pldm_bios_table_append_pad_checksum()
pldm_bios_table_append_pad_checksum() was deprecated in v0.4.0, remove it now.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I5
bios_table: Remove pldm_bios_table_append_pad_checksum()
pldm_bios_table_append_pad_checksum() was deprecated in v0.4.0, remove it now.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I5b0d5abdb32b3c814ff86a85492dce754b36b1e0
show more ...
|
4e1f131c | 14-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Remove pldm_bios_table_attr_value_entry_encode_integer()
pldm_bios_table_attr_value_entry_encode_integer() was deprecated in v0.4.0, remove it now.
Signed-off-by: Andrew Jeffery <andrew
bios_table: Remove pldm_bios_table_attr_value_entry_encode_integer()
pldm_bios_table_attr_value_entry_encode_integer() was deprecated in v0.4.0, remove it now.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I6269ffc48a4c6b44f77e82bef4fbe837e77874d6
show more ...
|
46d07685 | 14-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Remove pldm_bios_table_attr_value_entry_encode_string()
pldm_bios_table_attr_value_entry_encode_string() was deprecated in v0.4.0, remove it now.
Signed-off-by: Andrew Jeffery <andrew@a
bios_table: Remove pldm_bios_table_attr_value_entry_encode_string()
pldm_bios_table_attr_value_entry_encode_string() was deprecated in v0.4.0, remove it now.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I0a2bd8eef2f70a40158060cd50c49aa4d0ec4d72
show more ...
|
8b1c0340 | 14-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Remove pldm_bios_table_attr_value_entry_encode_enum()
pldm_bios_table_attr_value_entry_encode_enum() was deprecated in v0.4.0, so remove it now.
Signed-off-by: Andrew Jeffery <andrew@aj
bios_table: Remove pldm_bios_table_attr_value_entry_encode_enum()
pldm_bios_table_attr_value_entry_encode_enum() was deprecated in v0.4.0, so remove it now.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I13ed735a541b7df97b0dafbcc5ed62bb7984b571
show more ...
|
0ecf6bcf | 14-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Remove pldm_bios_table_attr_entry_integer_encode_length()
pldm_bios_table_attr_entry_integer_encode_length() was deprecated in v0.4.0, now remove it.
Signed-off-by: Andrew Jeffery <andr
bios_table: Remove pldm_bios_table_attr_entry_integer_encode_length()
pldm_bios_table_attr_entry_integer_encode_length() was deprecated in v0.4.0, now remove it.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ie26d609a0bcecee930222faf8ec5ef4524b583e5
show more ...
|
73d9176a | 27-Jun-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: pldm_bios_table_iter_next(): Invalid entry halts iteration
The attribute iterator machinary prevented misbehaviour through use of assert(). The attribute list is maintained as a linear s
bios_table: pldm_bios_table_iter_next(): Invalid entry halts iteration
The attribute iterator machinary prevented misbehaviour through use of assert(). The attribute list is maintained as a linear sequence of variably sized data structures that are packed against each other in the address space. The iterator is implemented by assigning a callback that can determine the length of each entry as appropriate for the entry's type, and then moving the iterator's cursor between elements.
The length derivation for some elements was protected by assert(). To avoid the asserts we rework the length callback prototype to return a signed size value and indicate an error state with a negative size.
pldm_bios_table_iter_next() is reworked to detect the error case on deriving the element size (negative size) and behave as if the iterator has terminated.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I80db3fe179201b169acc68c68633d8dd3f3a6334
show more ...
|
bf6699b6 | 05-Jul-2023 |
Andrew Jeffery <andrew@aj.id.au> |
tests: libpldm_bios_table_test: Fix 'Itearator' typo
Too many 'a's!
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Iab0afe009b8f47354a7f493951d9c5bebca41c3f |
0088a6ae | 27-Jun-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Deprecate pldm_bios_table_attr_value_entry_encode_integer()
Users should prefer pldm_bios_table_attr_value_entry_encode_integer_check() which returns an error code rather than preventing
bios_table: Deprecate pldm_bios_table_attr_value_entry_encode_integer()
Users should prefer pldm_bios_table_attr_value_entry_encode_integer_check() which returns an error code rather than preventing misbehaviour using assert().
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: If7b0290d93d96c893fe3e790ba7738ececc3d4df
show more ...
|
2d66393f | 26-Jun-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Deprecate pldm_bios_table_attr_value_entry_encode_string()
Users should prefer pldm_bios_table_attr_value_entry_encode_string_check() which returns an error code rather than preventing m
bios_table: Deprecate pldm_bios_table_attr_value_entry_encode_string()
Users should prefer pldm_bios_table_attr_value_entry_encode_string_check() which returns an error code rather than preventing misbehaviour via assert().
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Id1aea49a07ac52858c1a5977e4f96b987f705064
show more ...
|
7aeb7edb | 26-Jun-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Deprecate pldm_bios_table_attr_value_entry_encode_enum()
Users should prefer pldm_bios_table_attr_value_entry_encode_enum_check() which returns an error code instead of preventing misbeh
bios_table: Deprecate pldm_bios_table_attr_value_entry_encode_enum()
Users should prefer pldm_bios_table_attr_value_entry_encode_enum_check() which returns an error code instead of preventing misbehaviour via assert().
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I9442fd35a0d2240572d600189387215664bef60d
show more ...
|
fe0f01d8 | 26-Jun-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Transitive error handling for get_bios_attr_handle()
Most transitive callers of get_bios_attr_handle() exposed in the public API surface already had the ability to return an error code.
bios_table: Transitive error handling for get_bios_attr_handle()
Most transitive callers of get_bios_attr_handle() exposed in the public API surface already had the ability to return an error code. pldm_bios_table_attr_entry_integer_encode() was the one case where there wasn't the case, but the equivalent pldm_bios_table_attr_entry_integer_encode_check() API did already exist.
We reimplement pldm_bios_table_attr_entry_integer_encode() in terms of pldm_bios_table_attr_entry_integer_encode_check() and then deprecate pldm_bios_table_attr_entry_integer_encode() to continue working towards making the library assert()-safe.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ia97e51b25174d0536ebd53182e7006a553b35f94
show more ...
|
8cf70456 | 22-Jun-2023 |
Pavithra Barithaya <pavithra.b@ibm.com> |
pdr: Rework pldm_pdr_find_container_id_range_exclude() API
The API was returning the child container id, so renamed the API as pldm_pdr_find_child_container_id_index_range_exclude(). The API returns
pdr: Rework pldm_pdr_find_container_id_range_exclude() API
The API was returning the child container id, so renamed the API as pldm_pdr_find_child_container_id_index_range_exclude(). The API returns the child container id based on the index passed as an argument.
This commit addresses the comment in https://gerrit.openbmc.org/c/openbmc/libpldm/+/63615/comment/439b3560_78f6dbbc/
Fixes: 5dc025719dc3 (“pdr: Add pldm_pdr_find_container_id_range_exclude() API”) Change-Id: I811105d9ccc64e6f5ab28133e75ff63fdcc2c6bc Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>
show more ...
|
14a5fe82 | 26-Jun-2023 |
Andrew Jeffery <andrew@aj.id.au> |
tests: pdr: Guard TEST(EntityAssociationPDR, testFindContainerID)
As the APIs exercised have testing visibility the binary fails to link if the build is configured with `-Dabi=deprecated,stable`:
`
tests: pdr: Guard TEST(EntityAssociationPDR, testFindContainerID)
As the APIs exercised have testing visibility the binary fails to link if the build is configured with `-Dabi=deprecated,stable`:
``` ... [37/47] Linking target tests/libpldm_pdr_test FAILED: tests/libpldm_pdr_test c++ -o tests/libpldm_pdr_test tests/libpldm_pdr_test.p/libpldm_pdr_test.cpp.o -Wl,--as-needed -Wl,--no-undefined '-Wl,-rpath,$ORIGIN/..' -Wl,-rpath-link,/mnt/host/andrew/home/andrew/src/openbmc/libpldm/builds/aarch64/stable/ -Wl,--start-group libpldm.so.0.3.0 subprojects/googlete st/libgtest.a subprojects/googletest/libgtest_main.a subprojects/googletest/libgmock.a -Wl,--end-group -pthread /usr/bin/ld: tests/libpldm_pdr_test.p/libpldm_pdr_test.cpp.o: in function `EntityAssociationPDR_testFindContainerID_Test::TestBody()': /mnt/host/andrew/home/andrew/src/openbmc/libpldm/builds/aarch64/stable/../../../tests/libpldm_pdr_test.cpp:1655: undefined reference to `pldm_entity_association_tree_add_entity' /usr/bin/ld: /mnt/host/andrew/home/andrew/src/openbmc/libpldm/builds/aarch64/stable/../../../tests/libpldm_pdr_test.cpp:1660: undefined reference to `pldm_entity_association_tree_add_entity' /usr/bin/ld: /mnt/host/andrew/home/andrew/src/openbmc/libpldm/builds/aarch64/stable/../../../tests/libpldm_pdr_test.cpp:1664: undefined reference to `pldm_entity_association_tree_add_entity' /usr/bin/ld: /mnt/host/andrew/home/andrew/src/openbmc/libpldm/builds/aarch64/stable/../../../tests/libpldm_pdr_test.cpp:1678: undefined reference to `pldm_pdr_find_container_id_range_exclude' /usr/bin/ld: /mnt/host/andrew/home/andrew/src/openbmc/libpldm/builds/aarch64/stable/../../../tests/libpldm_pdr_test.cpp:1683: undefined reference to `pldm_pdr_find_container_id_range_exclude' collect2: error: ld returned 1 exit status ... ```
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I9b0c0b2f544d6c7f0b3b42a19b5a455cb78c08d5
show more ...
|
6409c8a0 | 13-Jun-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Remove deprecated APIs sanitized by assert()
pldmd has now been reworked to remove its use of the unchecked APIs[1].
[1]: https://gerrit.openbmc.org/c/openbmc/pldm/+/64181
Signed-off-b
bios_table: Remove deprecated APIs sanitized by assert()
pldmd has now been reworked to remove its use of the unchecked APIs[1].
[1]: https://gerrit.openbmc.org/c/openbmc/pldm/+/64181
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I04101c4e5f3408e27130dc7aa960f013eba3e0a3
show more ...
|
5dc02571 | 19-May-2023 |
Pavithra Barithaya <pavithra.b@ibm.com> |
pdr: Add pldm_pdr_find_container_id_range_exclude() API
This API is necessary to find the container id of contained entity which is not within the record handle ranges of the remote endpoint PDRs.Th
pdr: Add pldm_pdr_find_container_id_range_exclude() API
This API is necessary to find the container id of contained entity which is not within the record handle ranges of the remote endpoint PDRs.The remote endpoint has their own set of PDRs and have record handle ranges defined.
Change-Id: If28325869d4c5c797c33bc4efd41bee16777a7aa Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|
0c9f5a8a | 14-Jun-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Relax pldm_bios_table_attr_entry_enum_decode_pv_hdls_check()
Allow the number of handles decoded by pldm_bios_table_attr_entry_enum_decode_pv_hdls_check() to be fewer than the number of
bios_table: Relax pldm_bios_table_attr_entry_enum_decode_pv_hdls_check()
Allow the number of handles decoded by pldm_bios_table_attr_entry_enum_decode_pv_hdls_check() to be fewer than the number of handles reported by pldm_bios_table_attr_entry_enum_decode_pv_num_check(). The relaxation provides equivalent behaviour to pldm_bios_table_attr_entry_enum_decode_pv_hdls() but provides assert() safety by instead returning an error.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I1d51174450cbe97c9985a1361e235d90efc19b35
show more ...
|
98c1e69d | 14-Jun-2023 |
Andrew Jeffery <andrew@aj.id.au> |
bios_table: Relax pldm_bios_table_string_entry_decode_string_check()
Allow the string decoded by pldm_bios_table_string_entry_decode_string_check() to be truncated, as per the unchecked pldm_bios_ta
bios_table: Relax pldm_bios_table_string_entry_decode_string_check()
Allow the string decoded by pldm_bios_table_string_entry_decode_string_check() to be truncated, as per the unchecked pldm_bios_table_string_entry_decode_string(). With this change pldm_bios_table_string_entry_decode_string_check() provides assert() safety but is otherwise equivalent.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ia872f1496c642efbb34ee3ae29455f4eaf574082
show more ...
|
4d694346 | 19-May-2023 |
Pavithra Barithaya <pavithra.b@ibm.com> |
pdr: Add pldm_pdr_find_last_in_range()
Adds a new libpldm API to find the last PDR record from the PDR repo based on the range of record handle values given as input. This API is used when a record
pdr: Add pldm_pdr_find_last_in_range()
Adds a new libpldm API to find the last PDR record from the PDR repo based on the range of record handle values given as input. This API is used when a record needs to be added in a particular range of record handles to the repo that contains all PDRs (inclusive of BMC and remote endpoints).
Change-Id: Ica5187053361b27810577a4985fab4b994d35961 Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|