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>
diff --git a/tests/test_core.c b/tests/test_core.c
index ead3990..2f5d2c7 100644
--- a/tests/test_core.c
+++ b/tests/test_core.c
@@ -97,11 +97,11 @@
rx_pkt->start = 0;
rx_pkt->end = MCTP_PACKET_SIZE(len);
rx_pkt->mctp_hdr_off = 0;
- rx_pkt->next = NULL;
memcpy(rx_pkt->data, &pktbuf->hdr, sizeof(pktbuf->hdr));
memcpy(rx_pkt->data + sizeof(pktbuf->hdr), pktbuf->payload, alloc_size);
mctp_bus_rx((struct mctp_binding *)binding, rx_pkt);
+ __mctp_free(rx_pkt);
}
static void receive_one_fragment(struct mctp_binding_test *binding,