#
a3830d25 |
| 13-Jan-2025 |
Matt Johnston <matt@codeconstruct.com.au> |
Fix test-i2c leak, and mctp_pktbuf storage alignment
- Ensure mctp_pktbuf storage is correctly aligned - Deallocate mctp and i2c instances to avoid failure with asan.
These previously succeeded in
Fix test-i2c leak, and mctp_pktbuf storage alignment
- Ensure mctp_pktbuf storage is correctly aligned - Deallocate mctp and i2c instances to avoid failure with asan.
These previously succeeded in CI so are both fixed in this commit.
Fixes: e5b941d9d764 ("i2c: Add binding for MCTP over I2C transport") Fixes: 4a09e1dc4883 ("core: Reuse buffers for tx, allow message pools") Change-Id: I747bfff6faf3a5b0a982ae266bcef02ecbc4ee8a Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
show more ...
|
#
4a09e1dc |
| 13-Sep-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
core: Reuse buffers for tx, allow message pools
Use new m_msg_alloc/m_msg_free operations for whole-message MCTP buffers. m_realloc is no longer used, instead the maximum sized buffer is allocated f
core: Reuse buffers for tx, allow message pools
Use new m_msg_alloc/m_msg_free operations for whole-message MCTP buffers. m_realloc is no longer used, instead the maximum sized buffer is allocated for each reassembly. This allows applications to keep a pool of MCTP message buffers.
Don't create a queue of packets to transmit, instead reuse a single binding-provided tx_storage buffer for each transmitted packet, which can be static for bindings that have a known maximum packet size.
Asynchronous users/bindings can no longer rely on the core for queueing TX packets, instead they should test mctp_is_tx_ready() prior to calling mctp_message_tx(). The stack will return -EBUSY from mctp_message_tx() if there is already a message pending to send.
Bindings must be updated to add the tx_storage member, and the core will no longer free packets passed to mctp_bus_rx().
Change-Id: I2598bb91026ccef01b268c52b06c0f8e20bebb1e Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
show more ...
|
#
6e0c5d6d |
| 10-Sep-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
serial: Fix const correctness of write stub
Change-Id: If76a2f81cdd120c93a4b9bcc1bb08da573d3a755 Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
|
#
e79ac010 |
| 10-Dec-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
serial: Replace mctp_write_all with a function
Brace grouped expressions are a GNU extension so don't work with -Wpedantic
Change-Id: I9ec2b0542251c59856be0e7470e117c76e210b95 Signed-off-by: Matt J
serial: Replace mctp_write_all with a function
Brace grouped expressions are a GNU extension so don't work with -Wpedantic
Change-Id: I9ec2b0542251c59856be0e7470e117c76e210b95 Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
show more ...
|
#
3ef47785 |
| 11-Dec-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
Fix warnings reported by -Wpedantic
Previously CI hasn't been running with -Wpedantic (using autoconf), so these haven't been reported previously.
- replace BUILD_ASSERT with static_assert() - don'
Fix warnings reported by -Wpedantic
Previously CI hasn't been running with -Wpedantic (using autoconf), so these haven't been reported previously.
- replace BUILD_ASSERT with static_assert() - don't use %m GNU extension for printf - don't use arithmetic on void* - remove unused variables
Change-Id: I97d1acc908f06773b8b1ee95bfee80760fdc7a63 Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
show more ...
|
#
b3de343e |
| 18-Apr-2024 |
John Chung <john.chung@arm.com> |
serial: Support Frame Check Sequence
According to DSP0253, implementing frame check sequence via crc-16-ccitt calculation. crc-16-ccitt implementation refer to RFC1662 Appendix C.
Tested: Verified
serial: Support Frame Check Sequence
According to DSP0253, implementing frame check sequence via crc-16-ccitt calculation. crc-16-ccitt implementation refer to RFC1662 Appendix C.
Tested: Verified on sending/receiving mctp packets with mctp-serial kernel driver.
Change-Id: I8417d521589e9f40a0ca68596cdcfd061fd919cc Signed-off-by: John Chung <john.chung@arm.com>
show more ...
|
#
1fe5899e |
| 08-Jan-2024 |
Nikhil Namjoshi <nikhilnamjoshi@google.com> |
serial: Recover the state machine when a request's bytes are dropped
Today we use the byte 0x7e to indicate serial framing flag and serial trailing flag as well. In cases, when a request fails due t
serial: Recover the state machine when a request's bytes are dropped
Today we use the byte 0x7e to indicate serial framing flag and serial trailing flag as well. In cases, when a request fails due to certain bytes getting dropped, the libmctp serial state machine never recovers and all the subsequent requests fail. This is happens because the serial trailing flag is same as the framing flag.
Assuming an example packet
7e 01 04 ff ff ff ff 85 72 7e where 7e -> MCTP Serial Framing Flag 01 -> MCTP Serial Revision 04 -> Length of the Data bytes Next 4 bytes -> Data Bytes 85 -> fcs1 72 -> fcs2 7e -> MCTP Serial Trailing Flag
If some bytes are dropped (say 1st 4 bytes 7e 01 04 ff) in hardware or on the requester driver, then the libmctp responder state machine will catch this and drop all the packets until it gets the next MCTP Serial Framing Byte. However since the MCTP Serial Trailing byte of the current request is also 0x7e, the state machine would assume this to be start of the packet for next request and will soon realize that the next byte 0x7e (next request's MCTP Serial Framing Byte) is not MCTP_SERIAL_REVISION i.e. 0x01. So it will start dropping bytes for the next request too.
We can recover from this scenario, as here the failed request's trailer flag would take us to STATE_WAIT_REVISION, where we will receive 0x7e (next request's framing flag)
Tested: Verified the fix on a real scenario where bytes get dropped in USB hardware. The state machine responds with failure for the current request, but is able to process the next requests fine.
Change-Id: I9d853876a9765671d0067df21aab006bcf116dbc Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
show more ...
|
#
2a2a0f6f |
| 25-Aug-2023 |
Konstantin Aladyshev <aladyshev22@gmail.com> |
serial: Initialize pkt_trailer for the binding
Currently the pkt_trailer for the binding is not initialized explicitly. Fix typo to correct the issue.
Change-Id: I2d3af589886fabd17aa8f7c432bf92cd92
serial: Initialize pkt_trailer for the binding
Currently the pkt_trailer for the binding is not initialized explicitly. Fix typo to correct the issue.
Change-Id: I2d3af589886fabd17aa8f7c432bf92cd923e0640 Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
show more ...
|
#
a721c2d8 |
| 04-Dec-2022 |
Patrick Williams <patrick@stwcx.xyz> |
format: reformat with clang-format
Reformat everything with clang-format and remove .clang-ignore and custom code formatter.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I93dfca67
format: reformat with clang-format
Reformat everything with clang-format and remove .clang-ignore and custom code formatter.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I93dfca67948d3fbcc0f05ece4ae3e4dd9495ab57
show more ...
|
#
0721f585 |
| 28-Sep-2022 |
Andrew Jeffery <andrew@aj.id.au> |
core: Define return value behaviours for binding Tx callbacks
Binding Tx callbacks must return 0 upon success or a negative error code on failure. Some error codes invoke specific error handling beh
core: Define return value behaviours for binding Tx callbacks
Binding Tx callbacks must return 0 upon success or a negative error code on failure. Some error codes invoke specific error handling behaviours. If a binding Tx callback returns the following negative error codes:
1. EMSGSIZE: The packet whose transmission failed is dequeued from the transmit queue and dropped, as it will never be successfully transmitted
2. EBUSY: The packet whose transmission failed remains queued for a subsequent attempt.
This prevents Tx queue stalls for bindings such as astlpc where reinitialisation can renegotiate the Tx buffer size to a lower value than the size of packets already in the Tx queue. Previously the implementation in core failed to discard the packet from the binding Tx queue if transmission of the head packet was not possible.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I7dde22bd7340f2c028adf5112d7d4ab78cac66a6
show more ...
|
#
89a28781 |
| 28-Sep-2022 |
Andrew Jeffery <andrew@aj.id.au> |
serial: Give write callbacks a consistent behaviour
Require that the write callbacks return either the number of bytes written or a negative error code. From there, ensure the return value behaviour
serial: Give write callbacks a consistent behaviour
Require that the write callbacks return either the number of bytes written or a negative error code. From there, ensure the return value behaviour is the same for the fd and custom handler paths.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Id9b90cf4e5c5815dc6385c3d493e2bbbd8e47616
show more ...
|
#
8f53d631 |
| 25-Jul-2022 |
Andrew Jeffery <andrew@aj.id.au> |
mctp-demux-daemon: Exploit binding mctp_*_init_pollfd() APIs
Once bindings are correctly implemented as async the daemon itself will follow.
Finally, now they're unused, drop the mctp_*_get_fd() AP
mctp-demux-daemon: Exploit binding mctp_*_init_pollfd() APIs
Once bindings are correctly implemented as async the daemon itself will follow.
Finally, now they're unused, drop the mctp_*_get_fd() APIs as they're strictly less powerful.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ibc2bbc1d75b031e4422429d606e6345d794cb44d
show more ...
|
#
1111c6a5 |
| 25-Jul-2022 |
Andrew Jeffery <andrew@aj.id.au> |
bindings: Add mctp_*_init_pollfd() API
The new API allows the binding to own the poll(2) parameters, providing the opportunity for it to properly idle when it's unable to send control messages. Desp
bindings: Add mctp_*_init_pollfd() API
The new API allows the binding to own the poll(2) parameters, providing the opportunity for it to properly idle when it's unable to send control messages. Despite this, we hold off on adjusting the behaviour directly in this commit, as it would constitute a regression until mctp-demux-daemon has also been converted to exploit the new API.
Change-Id: Ic5a7c5a943566a0f36695daa64457440886fb2ab Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|
Revision tags: v0.11 |
|
#
39da3d03 |
| 12-Mar-2021 |
Andrew Jeffery <andrew@aj.id.au> |
libmctp: Split padding in pktbuf into header and trailer
The astlpc binding will shortly make use of a medium-specific trailer to implement a CRC-32 integrity check over packet data. Allow for mediu
libmctp: Split padding in pktbuf into header and trailer
The astlpc binding will shortly make use of a medium-specific trailer to implement a CRC-32 integrity check over packet data. Allow for medium-specific trailer data in the pktbuf in order to remove the need for a bounce-buffer. The binding will trim the pktbuf to the payload length before passing the instance up the stack.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ib215a552ff218b007f7f119c5235fbc75d9ca6cb
show more ...
|
Revision tags: v0.10 |
|
#
ff25d7eb |
| 26-Mar-2020 |
Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> |
Extract container_of definition out of individual bindings
This will make possible reuse this portion on code in the future.
Testing: no change in functionality; compiles successfuly
Signed-off-by
Extract container_of definition out of individual bindings
This will make possible reuse this portion on code in the future.
Testing: no change in functionality; compiles successfuly
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Change-Id: Ie92161c547e275d9aa00d643d8d4879d2f5dd199
show more ...
|
#
f8b4749a |
| 10-Mar-2020 |
Andrew Jeffery <andrew@aj.id.au> |
serial: Add mctp_serial_destroy()
Provide an abstraction to clean up memory to avoid false-positives from leak sanitizers.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I3b8b044c81cb5b
serial: Add mctp_serial_destroy()
Provide an abstraction to clean up memory to avoid false-positives from leak sanitizers.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I3b8b044c81cb5ba99fb91261d5bf952993497dd7
show more ...
|
#
73c268e4 |
| 29-Jan-2020 |
Andrew Jeffery <andrew@aj.id.au> |
libmctp: Clarify BTU-related symbols
DSP0236 defines a Baseline Transmission Unit (BTU), which dictates the minimum supported packet payload size. The packet size is the BTU + the packet header. The
libmctp: Clarify BTU-related symbols
DSP0236 defines a Baseline Transmission Unit (BTU), which dictates the minimum supported packet payload size. The packet size is the BTU + the packet header. The maximum (payload) transport unit size for a given binding may be larger than the BTU.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I2c4013531efd572d95c5a61e4d59309490505a8f
show more ...
|
#
00e6770b |
| 23-Jan-2020 |
Andrew Jeffery <andrew@aj.id.au> |
serial: Fix control reaching end of non-void function
Detected with CFLAGS="-Wall -Werror":
serial.c: In function ‘mctp_serial_rx’: serial.c:325:1: error: control reaches end of non-void function [
serial: Fix control reaching end of non-void function
Detected with CFLAGS="-Wall -Werror":
serial.c: In function ‘mctp_serial_rx’: serial.c:325:1: error: control reaches end of non-void function [-Werror=return-type] 325 | } | ^ cc1: all warnings being treated as errors
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I59ee6c392c6172f3d978076df0278c8b73d69931
show more ...
|
#
ad772b97 |
| 09-Jan-2020 |
Andrew Jeffery <andrew@aj.id.au> |
serial: Fix unused result warning for write()
serial.c: In function ‘mctp_binding_serial_tx’: serial.c:145:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-
serial: Fix unused result warning for write()
serial.c: In function ‘mctp_binding_serial_tx’: serial.c:145:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result] 145 | write(serial->fd, serial->txbuf, len); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CCLD libmctp.la
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ie85426ee2c33bc11f730a9ce66a5c6c7c841b920
show more ...
|
#
1e0af042 |
| 09-Jan-2020 |
Andrew Jeffery <andrew@aj.id.au> |
bindings: Fix spaced-indentation
The spaces throw off indentation autodetection implemented by vim-sleuth[1].
[1] https://github.com/tpope/vim-sleuth
Signed-off-by: Andrew Jeffery <andrew@aj.id.au
bindings: Fix spaced-indentation
The spaces throw off indentation autodetection implemented by vim-sleuth[1].
[1] https://github.com/tpope/vim-sleuth
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Idfb65904511edd4dc180a0881b0b67f425c29f64
show more ...
|
#
c6f676d1 |
| 18-Dec-2019 |
Jeremy Kerr <jk@ozlabs.org> |
serial,astlpc: only include unistd.h if we're using file IO
We currently include unistd.h for all astlpc.c and serial.c builds, but we're only using it for read() & write().
This change moves the u
serial,astlpc: only include unistd.h if we're using file IO
We currently include unistd.h for all astlpc.c and serial.c builds, but we're only using it for read() & write().
This change moves the unistd include (which may not be available on all platforms) to within the HAVE_FILEIO conditional.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Reported-by: Jet Li <Jet.Li@ibm.com> Change-Id: I7aaf46094f94269c681afc41a3092708c5137688
show more ...
|
#
3b36d17c |
| 03-Sep-2019 |
Jeremy Kerr <jk@ozlabs.org> |
API: Add binding accessors to generic struct mctp_binding
Rather than have every binding include their own wrappers around binding<->core functions, introduce an accessor to retrieve the struct mctp
API: Add binding accessors to generic struct mctp_binding
Rather than have every binding include their own wrappers around binding<->core functions, introduce an accessor to retrieve the struct mctp_binding from each.
This means we no longer need the binding-specific registration callbacks. However, we do now need a ->start callback, to allow bindings to perform post-registration init.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Change-Id: I6cee9e93f37520f85c155a0ca34017cc0675552c
show more ...
|
#
597b3697 |
| 03-Sep-2019 |
Jeremy Kerr <jk@ozlabs.org> |
serial: Add non-fileio interface to serial binding
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Change-Id: I86d04368bdb5b2348f947717c1806cbbbdd29b17
|
#
df15f7e9 |
| 05-Aug-2019 |
Jeremy Kerr <jk@ozlabs.org> |
core,bindings: Allow bindings to specify packet size
Currently, we fix all packet sizes to the baseline MTU size. However, bindings may support larger packet sizes.
This change makes the packet all
core,bindings: Allow bindings to specify packet size
Currently, we fix all packet sizes to the baseline MTU size. However, bindings may support larger packet sizes.
This change makes the packet allocator use binding-specific parameters to suit the binding itself, and uses the max packet size in the packetisation path.
Since packet sizes may now exceed 255, we change the size and offset types from uint8_t to size_t.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Change-Id: Ica932479f251dc33c67ea19e9e3e5a193cbe0b32
show more ...
|
#
0bead57e |
| 02-Sep-2019 |
Jeremy Kerr <jk@ozlabs.org> |
serial: zero struct mctp_binding_serial on init
Ensure we're starting from a known state.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Change-Id: I342b43f3b7bf219af3224966d62a5a6869e99f02
|