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
diff --git a/tests/test-utils.c b/tests/test-utils.c
index 71de8a3..dc0a5f3 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -27,6 +27,8 @@
test->binding.name = "test";
test->binding.version = 1;
test->binding.tx = mctp_binding_test_tx;
+ test->binding.pkt_size = MCTP_BMTU;
+ test->binding.pkt_pad = 0;
return test;
}
@@ -35,7 +37,7 @@
{
struct mctp_pktbuf *pkt;
- pkt = mctp_pktbuf_alloc(len);
+ pkt = mctp_pktbuf_alloc(&test->binding, len);
assert(pkt);
memcpy(mctp_pktbuf_hdr(pkt), buf, len);
mctp_bus_rx(&test->binding, pkt);