History log of /openbmc/libmctp/core.c (Results 1 – 25 of 69)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 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 ...


# 18b9a37b 22-Nov-2024 Matt Johnston <matt@codeconstruct.com.au>

core: Drop packets with broadcast source EID

That has no valid use case, so should be disallowed to avoid unforeseen
problems.

Change-Id: I514e5d910fb3b92606aae86aee282a97e6166a15
Signed-off-by: Ma

core: Drop packets with broadcast source EID

That has no valid use case, so should be disallowed to avoid unforeseen
problems.

Change-Id: I514e5d910fb3b92606aae86aee282a97e6166a15
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 ...


# 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 ...


# 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>


# 86e9a97a 28-Oct-2024 Matt Johnston <matt@codeconstruct.com.au>

core: Fix size check to match comment

Change-Id: I924e5dac387c2dee078bc0fac4bdbebda242c997
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>


# 133df7ab 14-May-2024 John Chung <john.chung@arm.com>

core: Allow to handle destination null and broadcast endpoint id

mctp daemon might query endpoint (i.e., get endpoint id command)
by physical addressed requests and set destination eid as 0.

Curren

core: Allow to handle destination null and broadcast endpoint id

mctp daemon might query endpoint (i.e., get endpoint id command)
by physical addressed requests and set destination eid as 0.

Current implementation will block handling destination null and
broadcast endpoint id for MCTP control message type.

Change-Id: Ie17035f88a80649e848fab93159a23172de0a33a
Signed-off-by: John Chung <john.chung@arm.com>

show more ...


# 487b31e0 14-Sep-2022 Rashmica Gupta <rashmica@linux.ibm.com>

core: Ensure mctp_pktbuf_alloc() initialises end-offset in-bounds

Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com>
Change-Id: I423fea60fbc5a40e66761b3a66bf9b44c3a9bc84


# b7824b66 08-Aug-2023 Benjamin Gwin <bgwin@google.com>

core: Fix use of wrong 'free' function

This memory was allocated using `__mctp_alloc` but mistakenly being free
with plain `free`, causing a potential heap corruption or crash if users
define their

core: Fix use of wrong 'free' function

This memory was allocated using `__mctp_alloc` but mistakenly being free
with plain `free`, causing a potential heap corruption or crash if users
define their own malloc hooks.

Signed-off-by: Benjamin Gwin <bgwin@google.com>
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I1d78f62098e5d9b57e58e4dd90c4841b2923300d

show more ...


# 7f7fdc1d 12-May-2023 Andrew Jeffery <andrew@aj.id.au>

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ic5b4c8584fafe5ebe3d01c1f685cab271dd9690b

show more ...


# 2608b294 30-Mar-2023 Pedro Martelletto <martelletto@google.com>

core: check for __mctp_alloc() failure in mctp_pktbuf_alloc()

Check for allocation failure in mctp_pktbuf_alloc(), as done
elsewhere in the code.

Change-Id: If3b6d84335d87f4d0ddef059910e63edab82a30

core: check for __mctp_alloc() failure in mctp_pktbuf_alloc()

Check for allocation failure in mctp_pktbuf_alloc(), as done
elsewhere in the code.

Change-Id: If3b6d84335d87f4d0ddef059910e63edab82a30e
Signed-off-by: Pedro Martelletto <martelletto@google.com>
Signed-off-by: Moritz Fischer <moritzf@google.com>

show more ...


# 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 ...


# 7aaccb51 28-Jun-2022 Moritz Fischer <moritzf@google.com>

core: Address a handful of compiler warnings

Address a handful of compiler warnings where void pointers are
incremented.

Suggested-by: Younghyun Park <younghyunpark@google.com>
Signed-off-by: Morit

core: Address a handful of compiler warnings

Address a handful of compiler warnings where void pointers are
incremented.

Suggested-by: Younghyun Park <younghyunpark@google.com>
Signed-off-by: Moritz Fischer <moritzf@google.com>
Change-Id: I6171efce851a6b9585b069d12daa389e2338a98b

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 ...


# 663ec39e 07-Oct-2021 Brad Bishop <bradleyb@fuzziesquirrel.com>

core: check n_busses before transmit

Handle the unusual case of no buses - for example with the null binding.

Change-Id: Ia61123d43efa16c5e00fa0f718d4a6206ee6ffae
Signed-off-by: Brad Bishop <bradle

core: check n_busses before transmit

Handle the unusual case of no buses - for example with the null binding.

Change-Id: Ia61123d43efa16c5e00fa0f718d4a6206ee6ffae
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>

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 ...


# 34d4c96f 16-Jun-2021 Sumanth Bhat <sumanth.bhat@linux.intel.com>

core: Handle exhaution of message contexts

If message contexts are exhausted, there is a possibility of
NULL pointer dereference. Close this attack surface with a
check on the message context creati

core: Handle exhaution of message contexts

If message contexts are exhausted, there is a possibility of
NULL pointer dereference. Close this attack surface with a
check on the message context creation status.

Signed-off-by: Sumanth Bhat <sumanth.bhat@linux.intel.com>
Change-Id: I208349b74a27a14b180c976bd78ec81a7991e43f

show more ...


123