#
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 ...
|
#
4058b2cb |
| 07-Nov-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
control: Add basic MCTP Control Protocol handler
This will respond to the 4 mandatory MCTP Control Protocol commands. Applications can register supported types using mctp_control_add_type().
Change
control: Add basic MCTP Control Protocol handler
This will respond to the 4 mandatory MCTP Control Protocol commands. Applications can register supported types using mctp_control_add_type().
Change-Id: Ia904bcbe118626adf9254ffa71dd8e17fbdfc9b7 Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
show more ...
|
#
44e64dfa |
| 05-Nov-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
core: Add allocated tag expiry, mctp_set_now_op()
Allocated tags expire after 6 seconds, requiring a time source. The default will use clock_gettime(), though implementations can set MCTP_DEFAULT_CL
core: Add allocated tag expiry, mctp_set_now_op()
Allocated tags expire after 6 seconds, requiring a time source. The default will use clock_gettime(), though implementations can set MCTP_DEFAULT_CLOCK_GETTIME=0 and use mctp_set_now_op() for custom behavior.
Change-Id: Iaacf500bcd458c987f4b79c698bac9ae5ad5a73e Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
show more ...
|
#
f9b99f1f |
| 17-Sep-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
build: Generate libmctp-sizes.h
This can be used to allocate static storage for a struct mctp used with heapless mctp_setup().
core.c internal data structures are moved to core-internal.h so that s
build: Generate libmctp-sizes.h
This can be used to allocate static storage for a struct mctp used with heapless mctp_setup().
core.c internal data structures are moved to core-internal.h so that sizeof(struct mctp) can be compiled without linking other objects.
Change-Id: I72dcd46ef11d6f4b4f5ba1c9ae6c95e40dda40f8 Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
show more ...
|
#
61c95992 |
| 16-Sep-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
core: Add mctp_message_tx_request() function
This allocates a tag for messages sent with TO bit set.
Change-Id: Ia8403a06aa449e0218a30edf5ad69781c70d7c52 Signed-off-by: Matt Johnston <matt@codecons
core: Add mctp_message_tx_request() function
This allocates a tag for messages sent with TO bit set.
Change-Id: Ia8403a06aa449e0218a30edf5ad69781c70d7c52 Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
show more ...
|
#
722d0db2 |
| 13-Sep-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
core: Allow running without heap allocations
Replace buses with a static array, and add mctp_setup/mctp_cleanup to use an existing struct.
__mctp_alloc() and __mctp_free() no longer need to be func
core: Allow running without heap allocations
Replace buses with a static array, and add mctp_setup/mctp_cleanup to use an existing struct.
__mctp_alloc() and __mctp_free() no longer need to be functional, though are used as defaults if m_msg_alloc/m_msg_free are not provided.
Change-Id: Ib5826836efb59e416410b25f138cbaf5931278f3 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 ...
|
#
dfbf0fd0 |
| 28-Oct-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
core: const input arg for mctp_pktbuf_push()
Change-Id: I321c81ba86bf4d4dcd8f242d25ce4c9c2487b736 Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
|
#
f2988977 |
| 08-Nov-2022 |
Rashmica Gupta <rashmica@linux.ibm.com> |
pcap: Use SLL2 linktype for captures
This means we can use wireshark on our pcaps.
Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com> Change-Id: I215af00e064d352e41d0a8eb87d5a30582998676
|
#
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 ...
|
Revision tags: v0.11 |
|
#
f39c3857 |
| 10-Jan-2022 |
Sumanth Bhat <sumanth.bhat@linux.intel.com> |
core: Add TX/RX API that exposes message tag and tag owner
MCTP received packets can carry a message tag and tag owner bit which is set by a remote MCTP endpoint. This can be used by the remote MCTP
core: Add TX/RX API that exposes message tag and tag owner
MCTP received packets can carry a message tag and tag owner bit which is set by a remote MCTP endpoint. This can be used by the remote MCTP endpoint to track the responses. Thus, libmctp should provide a mechanism for the upper layer MCTP applications to respond with the same message tag.
This patchset extends TX and RX API with message tag and tag owner bits.
Signed-off-by: Sumanth Bhat <sumanth.bhat@linux.intel.com> Change-Id: I6d07eafa86c653abdd4313ab7cc77e5a93124477
show more ...
|
#
2094c3c0 |
| 25-Aug-2021 |
Andrew Jeffery <andrew@aj.id.au> |
libmctp: Add mctp_unregister_bus()
Allow for safe cleanup of busses associated with bindings when the binding has work to do in the tear-down path.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> C
libmctp: Add mctp_unregister_bus()
Allow for safe cleanup of busses associated with bindings when the binding has work to do in the tear-down path.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I7cc45e30d778554cfa33c49a47fe237b23fe5431
show more ...
|
#
5d3d4e6d |
| 20-Aug-2021 |
Andrew Jeffery <andrew@aj.id.au> |
core: Add infrastructure for packet captures
A callback and user data member is defined to abstract out the implementation details of capturing the packets. The captured packets are in DSP0236 form,
core: Add infrastructure for packet captures
A callback and user data member is defined to abstract out the implementation details of capturing the packets. The captured packets are in DSP0236 form, i.e. no binding metadata is present.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Id8234d6e8f7856c70a0ca3fe5d4cee38ec11bd8c
show more ...
|
#
eba19a3b |
| 09-Mar-2021 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Introduce protocol v3 with integrity checks
v3 of the binding adds a CRC-32 value as a medium-specific trailer to each packet passing over the binding interface.
The patch includes a naive
astlpc: Introduce protocol v3 with integrity checks
v3 of the binding adds a CRC-32 value as a medium-specific trailer to each packet passing over the binding interface.
The patch includes a naive bit-shift implementation of CRC-32, we can improve it later as necessary.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I93a95bccef30010d56e10e29b6d84554268ab7af
show more ...
|
#
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 ...
|
#
e889b19f |
| 11-Mar-2021 |
Andrew Jeffery <andrew@aj.id.au> |
core: Make pkt_size and pkt_pad size_t
Fix bad signedness comparison:
``` core.c: In function ‘mctp_binding_set_tx_enabled’: core.c:630:25: error: comparison of integer expressions of different sig
core: Make pkt_size and pkt_pad size_t
Fix bad signedness comparison:
``` core.c: In function ‘mctp_binding_set_tx_enabled’: core.c:630:25: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] 630 | if (binding->pkt_size < MCTP_PACKET_SIZE(MCTP_BTU)) { | ^ cc1: all warnings being treated as errors ```
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Idb91b16efa43526ea8e86fff666d0151f2987247
show more ...
|
#
2c820c5a |
| 01-Jul-2020 |
Sumanth Bhat <sumanth.bhat@linux.intel.com> |
core: Limit maximum size of an assembled MCTP message
If libmctp receives sequence of fragment MCTP packets and never receives EOM packet, this will cause heap memory to grow without bounds. This co
core: Limit maximum size of an assembled MCTP message
If libmctp receives sequence of fragment MCTP packets and never receives EOM packet, this will cause heap memory to grow without bounds. This commit puts an upper cap on maximum MCTP message size. This should protect us from any malicious device trying to exploiting this.
Also, this prevents overwhelming of the device's resources. Section 10.1.5 of DSP0236 (v1.3.1) allows configuration of endpoints to protect its resources.
Signed-off-by: Sumanth Bhat <sumanth.bhat@linux.intel.com> Change-Id: Id62cfab7c25b3e1ccf955f2e924844b58b4be154
show more ...
|
#
b942e3a3 |
| 22-Jun-2020 |
Andrew Jeffery <andrew@aj.id.au> |
core: Return size_t for mctp_pktbuf_size()
Large packets are enabled by e.g. MTU negotiation in the astlpc binding. Avoid truncating large packets in calls to the pktbuf APIs.
Signed-off-by: Andrew
core: Return size_t for mctp_pktbuf_size()
Large packets are enabled by e.g. MTU negotiation in the astlpc binding. Avoid truncating large packets in calls to the pktbuf APIs.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I1244d70fe93ca7538ca09256110d648c495c6aa7
show more ...
|
Revision tags: v0.10 |
|
#
3a540664 |
| 26-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Introduce MTU negotiation
MTU negotiation is implemented in a backwards-compatible manner with version 1 of the astlpc binding. Functionally, MTU negotation involves proposing arrangements o
astlpc: Introduce MTU negotiation
MTU negotiation is implemented in a backwards-compatible manner with version 1 of the astlpc binding. Functionally, MTU negotation involves proposing arrangements of the Rx and Tx buffer layouts. It is assumed that the MTU is a packet sized to fill the Tx buffer as described in the control space.
For v1 of the binding the MTU is defined in terms of the MCTP_BTU constant provided by libmctp.h. MCTP_BTU is used regardless of the buffer sizes specified in the control space (which MUST describe buffers supporting at least MCTP_BTU-sized packets).
For v2 of the binding the MTU is defined in terms of the appropriate buffer's size field in the control space.
The sequence of events for negotiating the MTU under v2 is as follows:
1. The BMC initialises its binding, filling out the Rx and Tx buffer properties with the largest configuration it supports.
2. The host initialises its binding, writing its maximum Rx buffer size before sending `channel-init` to the BMC.
3. The BMC receives `channel-init`, negotiates protocol version 2 and then validates the host's proposed buffer configuration. If the proposed configuration is invalid (e.g. out-of-bounds values) the BMC terminates channel initialisation leaving the channel-active bit clear and writing the zero to the negotiated version field. If the proposal is valid, the BMC calculates the buffer sizes according to the available constraints and writes the chosen buffer configuration to the control region.
4. Assuming the version negotiation and buffer configuration are successful, the BMC sets `channel-active` and notifies the host
5. The host reads `channel-active`, accepts the negotiation of v2 and validates the buffer configuration. If the validation passes, then the buffer configuration is the configuration used for the remainder of the session. If validation fails then the host MUST NOT send MCTP packets via the LPC binding until a valid buffer configuration can be negotiated.
Change-Id: I89107593f220418d746c2d73771348ed8f7f3e87 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|
#
ba6727e6 |
| 13-Mar-2020 |
Wiktor Gołgowski <wiktor.golgowski@linux.intel.com> |
core: Support transport control commands
This change introduces a control message request handler for MCTP bindings. If a handler is provided, transport control messages will be forwarded to the han
core: Support transport control commands
This change introduces a control message request handler for MCTP bindings. If a handler is provided, transport control messages will be forwarded to the handler, otherwise they will be forwarded to the default handler.
Change-Id: I62266d6bf2d512ec97759c0b8a3477c5e433d609 Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@linux.intel.com> [AJ: Split out general control message handler, formatting] Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|
#
fa56ca5f |
| 10-Mar-2020 |
Andrew Jeffery <andrew@aj.id.au> |
libmctp: Add mctp_destroy()
Provide an abstraction to clean up memory to avoid false-positives with leak sanitizers.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Id0f03ec61fcaf6eb0ed2
libmctp: Add mctp_destroy()
Provide an abstraction to clean up memory to avoid false-positives with leak sanitizers.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Id0f03ec61fcaf6eb0ed27e8f735720f1ea7e5e8e
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 ...
|
#
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 ...
|
#
1a4ec3cd |
| 02-Sep-2019 |
Jeremy Kerr <jk@ozlabs.org> |
core,API: Add bridge support
This change introduces a facility to bridge messages between two bindings.
This is implemented through a new mctp_bridge_busses() API, which applies a new routing polic
core,API: Add bridge support
This change introduces a facility to bridge messages between two bindings.
This is implemented through a new mctp_bridge_busses() API, which applies a new routing policy, sending packets from one binding to the other. This is in contrast to the current policy of dropping all non-local packets.
To do this, the message context code needs to know both source and destination EIDs, so add them to the mctp_msg_ctx_lookup() criteria.
Also, add a small test for bridge mode.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Change-Id: If532613525ddbf81df249e26d0f23825996f7bda
show more ...
|