/openbmc/libmctp/ |
H A D | core.c | 140 static void *mctp_msg_dup(const void *msg, size_t msg_len, struct mctp *mctp) in mctp_msg_dup() argument 142 void *copy = __mctp_msg_alloc(msg_len, mctp); in mctp_msg_dup() 153 static struct mctp_msg_ctx *mctp_msg_ctx_lookup(struct mctp *mctp, uint8_t src, in mctp_msg_ctx_lookup() argument 160 for (i = 0; i < ARRAY_SIZE(mctp->msg_ctxs); i++) { in mctp_msg_ctx_lookup() 161 struct mctp_msg_ctx *ctx = &mctp->msg_ctxs[i]; in mctp_msg_ctx_lookup() 170 static struct mctp_msg_ctx *mctp_msg_ctx_create(struct mctp *mctp, uint8_t src, in mctp_msg_ctx_create() argument 176 for (i = 0; i < ARRAY_SIZE(mctp->msg_ctxs); i++) { in mctp_msg_ctx_create() 177 struct mctp_msg_ctx *tmp = &mctp->msg_ctxs[i]; in mctp_msg_ctx_create() 192 ctx->buf_alloc_size = mctp->max_message_size; in mctp_msg_ctx_create() 193 ctx->buf = __mctp_msg_alloc(ctx->buf_alloc_size, mctp); in mctp_msg_ctx_create() [all …]
|
H A D | libmctp.h | 64 struct mctp; 90 struct mctp *mctp_init(void); 92 void mctp_destroy(struct mctp *mctp); 95 int mctp_setup(struct mctp *mctp, size_t struct_mctp_size); 97 void mctp_cleanup(struct mctp *mctp); 99 void mctp_set_max_message_size(struct mctp *mctp, size_t message_size); 102 void mctp_set_capture_handler(struct mctp *mctp, mctp_capture_fn fn, 112 int mctp_register_bus(struct mctp *mctp, struct mctp_binding *binding, 115 void mctp_unregister_bus(struct mctp *mctp, struct mctp_binding *binding); 125 int mctp_bridge_busses(struct mctp *mctp, struct mctp_binding *b1, [all …]
|
H A D | control.c | 42 __mctp_msg_alloc(sizeof(*resp), bus->mctp); in mctp_ctrl_set_endpoint_id() 54 int rc = mctp_message_tx_alloced(bus->mctp, src_eid, false, msg_tag, in mctp_ctrl_set_endpoint_id() 73 __mctp_msg_alloc(sizeof(*resp), bus->mctp); in mctp_ctrl_get_endpoint_id() 86 int rc = mctp_message_tx_alloced(bus->mctp, src_eid, false, msg_tag, in mctp_ctrl_get_endpoint_id() 142 __mctp_msg_alloc(total_sz, bus->mctp); in mctp_ctrl_get_version() 154 int rc = mctp_message_tx_alloced(bus->mctp, src_eid, false, msg_tag, in mctp_ctrl_get_version() 172 bus->mctp->control.num_msg_types; in mctp_ctrl_get_types() 175 __mctp_msg_alloc(total_sz, bus->mctp); in mctp_ctrl_get_types() 183 resp->type_count = bus->mctp->control.num_msg_types; in mctp_ctrl_get_types() 184 memcpy(resp->types, bus->mctp->control.msg_types, in mctp_ctrl_get_types() [all …]
|
H A D | CMakeLists.txt | 25 add_library (mctp STATIC alloc.c astlpc.c crc32.c core.c log.c libmctp.h serial.c crc-16-ccitt.c co… target 27 target_include_directories (mctp PUBLIC 34 target_link_libraries (test_eid mctp) 38 target_link_libraries (test_seq mctp) 42 target_link_libraries (test_bridge mctp) 46 target_link_libraries (test_astlpc mctp) 50 target_link_libraries (test_serial mctp) 54 target_link_libraries (test_cmds mctp) 58 target_link_libraries (test_core mctp) 61 install (TARGETS mctp DESTINATION lib)
|
H A D | libmctp-alloc.h | 8 struct mctp; 13 void *__mctp_msg_alloc(size_t size, struct mctp *mctp); 14 void __mctp_msg_free(void *ptr, struct mctp *mctp);
|
H A D | Makefile.am | 21 systemd/system/mctp-demux.service \ 22 systemd/system/mctp-demux.socket 25 bin_PROGRAMS = utils/mctp-demux-daemon 26 noinst_PROGRAMS = utils/mctp-in utils/mctp-pipe 27 utils_mctp_demux_daemon_SOURCES = utils/mctp-demux-daemon.c 29 utils_mctp_demux_daemon_SOURCES += utils/mctp-capture.c
|
H A D | alloc.c | 80 void *__mctp_msg_alloc(size_t size, struct mctp *mctp) in __mctp_msg_alloc() argument 82 void *ctx = mctp_get_alloc_ctx(mctp); in __mctp_msg_alloc() 89 void __mctp_msg_free(void *ptr, struct mctp *mctp) in __mctp_msg_free() argument 91 void *ctx = mctp_get_alloc_ctx(mctp); in __mctp_msg_free()
|
/openbmc/libmctp/tests/ |
H A D | test_core.c | 138 struct mctp *mctp = NULL; in mctp_core_test_simple_rx() local 147 mctp_test_stack_init(&mctp, &binding, TEST_DEST_EID); in mctp_core_test_simple_rx() 148 mctp_set_rx_all(mctp, rx_message, &test_param); in mctp_core_test_simple_rx() 161 mctp_destroy(mctp); in mctp_core_test_simple_rx() 166 struct mctp *mctp = NULL; in mctp_core_test_receive_equal_length_fragments() local 177 mctp_test_stack_init(&mctp, &binding, TEST_DEST_EID); in mctp_core_test_receive_equal_length_fragments() 178 mctp_set_rx_all(mctp, rx_message, &test_param); in mctp_core_test_receive_equal_length_fragments() 202 mctp_destroy(mctp); in mctp_core_test_receive_equal_length_fragments() 207 struct mctp *mctp = NULL; in mctp_core_test_receive_unexpected_smaller_middle_fragment() local 218 mctp_test_stack_init(&mctp, &binding, TEST_DEST_EID); in mctp_core_test_receive_unexpected_smaller_middle_fragment() [all …]
|
H A D | test_i2c.c | 43 struct mctp *mctp; member 100 rc = mctp_message_tx(tx_test->mctp, dest_eid, tag_owner, msg_tag, in run_tx_test() 104 while (!mctp_is_tx_ready(tx_test->mctp, dest_eid)) { in run_tx_test() 130 mctp_message_tx(tx_test->mctp, eid, tag_owner, msg_tag, in test_neigh_expiry() 141 mctp_message_tx(tx_test->mctp, EID_B, tag_owner, msg_tag, mctp_msg_src, in test_neigh_expiry() 152 mctp_message_tx(tx_test->mctp, EID_B, tag_owner, msg_tag, mctp_msg_src, in test_neigh_expiry() 200 mctp_message_tx(tx_test->mctp, EID_B, tag_owner, msg_tag, in test_neigh_expiry() 211 mctp_message_tx(tx_test->mctp, EID_B, tag_owner, msg_tag, mctp_msg_src, in test_neigh_expiry() 232 tx_test->mctp = mctp_init(); in main() 233 assert(tx_test->mctp); in main() [all …]
|
H A D | test_serial.c | 70 struct mctp *mctp; member 112 scenario[0].mctp = mctp_init(); in main() 113 assert(scenario[0].mctp); in main() 121 mctp_register_bus(scenario[0].mctp, mctp_binding_serial_core(a->serial), in main() 125 scenario[1].mctp = mctp_init(); in main() 126 assert(scenario[1].mctp); in main() 127 mctp_set_rx_all(scenario[1].mctp, rx_message, NULL); in main() 135 mctp_register_bus(scenario[1].mctp, mctp_binding_serial_core(b->serial), in main() 139 rc = mctp_message_tx(scenario[0].mctp, 9, tag_owner, msg_tag, in main() 153 mctp_destroy(scenario[1].mctp); in main() [all …]
|
H A D | test-utils.c | 61 struct mctp *mctp, mctp_eid_t eid) in mctp_binding_test_register_bus() argument 63 mctp_register_bus(mctp, &binding->binding, eid); in mctp_binding_test_register_bus() 66 void mctp_test_stack_init(struct mctp **mctp, in mctp_test_stack_init() argument 69 *mctp = mctp_init(); in mctp_test_stack_init() 70 assert(*mctp); in mctp_test_stack_init() 75 mctp_binding_test_register_bus(*binding, *mctp, eid); in mctp_test_stack_init()
|
H A D | test_astlpc.c | 50 struct mctp *mctp; member 181 ep->mctp = mctp_init(); in endpoint_init() 182 assert(ep->mctp); in endpoint_init() 192 return mctp_register_bus(ep->mctp, &ep->astlpc->binding, eid); in endpoint_init() 198 mctp_destroy(ep->mctp); in endpoint_destroy() 259 mctp_set_rx_all(ctx.host.mctp, astlpc_test_rx_message, &ctx); in astlpc_test_packetised_message_bmc_to_host() 262 rc = mctp_message_tx(ctx.bmc.mctp, 9, MCTP_MESSAGE_TO_SRC, 0, msg, in astlpc_test_packetised_message_bmc_to_host() 301 mctp_set_rx_all(ctx.bmc.mctp, astlpc_test_rx_message, &ctx); in astlpc_test_simple_message_host_to_bmc() 304 rc = mctp_message_tx(ctx.host.mctp, 8, MCTP_MESSAGE_TO_DST, tag, msg, in astlpc_test_simple_message_host_to_bmc() 343 mctp_set_rx_all(ctx.host.mctp, astlpc_test_rx_message, &ctx); in astlpc_test_simple_message_bmc_to_host() [all …]
|
H A D | test-utils.h | 15 struct mctp *mctp, mctp_eid_t eid); 24 void mctp_test_stack_init(struct mctp **mctp,
|
H A D | test_eid.c | 17 struct mctp *mctp; member 55 mctp_test_stack_init(&ctx->mctp, &ctx->binding, local_eid); in main() 57 mctp_set_rx_all(ctx->mctp, test_rx, ctx); in main() 79 mctp_destroy(ctx->mctp); in main()
|
/openbmc/libmctp/utils/ |
H A D | mctp-astlpc-daemon.c | 21 struct mctp *mctp; member 32 mctp_message_tx(ctx->mctp, eid, 0, MCTP_MESSAGE_TO_SRC, msg, len); in tx_message() 55 struct mctp *mctp; in main() local 59 mctp = mctp_init(); in main() 60 assert(mctp); in main() 65 mctp_astlpc_register_bus(astlpc, mctp, local_eid); in main() 68 ctx->mctp = mctp; in main() 70 mctp_set_rx_all(mctp, rx_message, ctx); in main()
|
H A D | meson.build | 1 demux_sources = ['mctp-demux-daemon.c'] 4 # While mctp-demux-daemon will build without pcap, it won't 6 # TODO only build mctp-demux-daemon when pcap is available. 9 demux_sources += 'mctp-capture.c' 13 'mctp-demux-daemon', 22 'mctp-pipe', 23 'mctp-pipe.c', 30 'mctp-in', 31 'mctp-in.c',
|
H A D | mctp-pipe.c | 34 struct mctp *mctp[2]; in main() local 36 mctp[0] = mctp_init(); in main() 37 mctp[1] = mctp_init(); in main() 39 assert(mctp[0] && mctp[1]); in main() 53 mctp_register_bus(mctp[0], mctp_binding_serial_core(serial[0]), in main() 55 mctp_register_bus(mctp[1], mctp_binding_serial_core(serial[1]), in main() 58 mctp_set_rx_all(mctp[1], rx_message, NULL); in main() 96 mctp_message_tx(mctp[0], eids[1], in main()
|
H A D | mctp-in.c | 31 struct mctp *mctp; in main() local 34 mctp = mctp_init(); in main() 35 assert(mctp); in main() 42 mctp_register_bus(mctp, mctp_binding_serial_core(serial), 8); in main() 44 mctp_set_rx_all(mctp, rx_message, NULL); in main()
|
H A D | mctp-demux-daemon.c | 50 int (*init)(struct mctp *mctp, struct binding *binding, mctp_eid_t eid, 52 void (*destroy)(struct mctp *mctp, struct binding *binding); 65 struct mctp *mctp; member 88 rc = mctp_message_tx(ctx->mctp, eid, MCTP_MESSAGE_TO_SRC, 0, msg, len); in tx_message() 159 static int binding_null_init(struct mctp *mctp __unused, in binding_null_init() 171 static int binding_serial_init(struct mctp *mctp, struct binding *binding, in binding_serial_init() argument 193 mctp_register_bus(mctp, mctp_binding_serial_core(serial), eid); in binding_serial_init() 211 static int binding_astlpc_init(struct mctp *mctp, struct binding *binding, in binding_astlpc_init() argument 231 mctp_register_bus(mctp, mctp_binding_astlpc_core(astlpc), eid); in binding_astlpc_init() 237 static void binding_astlpc_destroy(struct mctp *mctp, struct binding *binding) in binding_astlpc_destroy() argument [all …]
|
H A D | mctp-capture.c | 122 struct mctp_hdr *mctp = in capture_socket() local 124 mctp->ver = 1; in capture_socket() 125 mctp->flags_seq_tag = 0xc0; //set SOM and EOM in capture_socket() 127 mctp->dest = eid; in capture_socket() 128 mctp->src = 0; in capture_socket() 130 mctp->dest = 0; in capture_socket() 131 mctp->src = eid; in capture_socket()
|
/openbmc/openbmc/meta-ibm/recipes-phosphor/libmctp/ |
H A D | libmctp_%.bbappend | 5 install -m 0644 ${UNPACKDIR}/mctp ${D}${sysconfdir}/default/mctp 6 install -d ${D}${systemd_system_unitdir}/mctp-demux.service.d 7 …install -D -m 0644 ${UNPACKDIR}/service-override.conf ${D}${systemd_system_unitdir}/mctp-demux.ser… 10 SRC_URI:append:p10bmc = " file://mctp" 16 SRC_URI:append:witherspoon-tacoma = " file://mctp" 22 FILES:${PN}:append = " ${systemd_system_unitdir}/mctp-demux.service.d/service-override.conf"
|
/openbmc/openbmc/meta-facebook/meta-yosemite4/recipes-networking/mctp/ |
H A D | mctp_%.bbappend | 6 file://mctp-config \ 22 install -d ${D}${libexecdir}/mctp 24 install -m 0755 ${UNPACKDIR}/mctp-config \ 25 ${D}${libexecdir}/mctp/ 27 ${D}${libexecdir}/mctp/ 29 ${D}${libexecdir}/mctp/
|
/openbmc/libmctp/tests/fuzz/ |
H A D | i2c-fuzz.c | 49 struct mctp *mctp; member 177 uint8_t *fake_send_data = __mctp_msg_alloc(len, ctx->mctp); in do_tx() 185 rc = mctp_message_tx_request(ctx->mctp, dest, fake_send_data, in do_tx() 192 mctp_message_tx_alloced(ctx->mctp, eid, tag_owner, tag, in do_tx() 235 ctx->mctp = mctp_init(); in LLVMFuzzerTestOneInput() 236 mctp_register_bus(ctx->mctp, mctp_binding_i2c_core(ctx->i2c), OWN_EID); in LLVMFuzzerTestOneInput() 237 mctp_set_rx_all(ctx->mctp, fuzz_i2c_rxmsg, ctx); in LLVMFuzzerTestOneInput() 238 mctp_set_now_op(ctx->mctp, fuzz_now, ctx); in LLVMFuzzerTestOneInput() 248 mctp_destroy(ctx->mctp); in LLVMFuzzerTestOneInput()
|
/openbmc/linux/net/mctp/ |
H A D | neigh.c | 32 mutex_lock(&net->mctp.neigh_lock); in mctp_neigh_add() 55 list_add_rcu(&neigh->list, &net->mctp.neighbours); in mctp_neigh_add() 58 mutex_unlock(&net->mctp.neigh_lock); in mctp_neigh_add() 76 mutex_lock(&net->mctp.neigh_lock); in mctp_neigh_remove_dev() 77 list_for_each_entry_safe(neigh, tmp, &net->mctp.neighbours, list) { in mctp_neigh_remove_dev() 85 mutex_unlock(&net->mctp.neigh_lock); in mctp_neigh_remove_dev() 95 mutex_lock(&net->mctp.neigh_lock); in mctp_neigh_remove() 96 list_for_each_entry_safe(neigh, tmp, &net->mctp.neighbours, list) { in mctp_neigh_remove() 106 mutex_unlock(&net->mctp.neigh_lock); in mctp_neigh_remove() 258 list_for_each_entry_rcu(neigh, &net->mctp.neighbours, list) { in mctp_rtm_getneigh() [all …]
|
/openbmc/openbmc/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/ |
H A D | mctp-config | 14 mctp link set mctpi3c${busnum} up 15 mctp addr add ${localEid} dev mctpi3c${busnum} 23 mctp link set mctpi2c${busnum} up 24 mctp addr add ${localEid} dev mctpi2c${busnum}
|