Przemyslaw Czarnowski | 391795d | 2020-03-19 23:41:53 +0100 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ |
| 2 | |
| 3 | #ifdef HAVE_CONFIG_H |
| 4 | #include "config.h" |
| 5 | #endif |
| 6 | |
| 7 | #include <assert.h> |
| 8 | #include <stdbool.h> |
| 9 | #include <stdlib.h> |
| 10 | #include <string.h> |
| 11 | |
| 12 | #include "libmctp.h" |
| 13 | #include "libmctp-alloc.h" |
| 14 | #include "libmctp-astpcie.h" |
| 15 | #include "container_of.h" |
| 16 | |
| 17 | #include "astpcie.h" |
| 18 | |
| 19 | #define binding_to_astpcie(b) \ |
| 20 | container_of(b, struct mctp_binding_astpcie, binding) |
| 21 | |
| 22 | /* dummy start function */ |
| 23 | int mctp_binding_astpcie_start(struct mctp_binding *binding) { |
| 24 | return -1; |
| 25 | } |
| 26 | |
| 27 | /* dummy tx function */ |
| 28 | int mctp_binding_astpcie_tx(struct mctp_binding *binding, |
| 29 | struct mctp_pktbuf *pkt) { |
| 30 | return -1; |
| 31 | } |
| 32 | |
| 33 | struct mctp_binding_astpcie *mctp_binding_astpcie_init(void) |
| 34 | { |
| 35 | struct mctp_binding_astpcie *pcie; |
| 36 | pcie = __mctp_alloc(sizeof(*pcie)); |
| 37 | memset(pcie, 0, sizeof(*pcie)); |
| 38 | |
| 39 | pcie->binding.name = "astpcie"; |
| 40 | pcie->binding.version = 1; |
| 41 | pcie->binding.tx = mctp_binding_astpcie_tx; |
| 42 | pcie->binding.start = mctp_binding_astpcie_start; |
| 43 | pcie->binding.pkt_size = MCTP_PACKET_SIZE(MCTP_BTU); |
| 44 | pcie->binding.pkt_pad = 0; |
| 45 | |
| 46 | return pcie; |
| 47 | } |
| 48 | |
| 49 | void mctp_binding_astpcie_free(struct mctp_binding_astpcie *b) { |
| 50 | __mctp_free(b); |
| 51 | } |
| 52 | |
| 53 | struct mctp_binding *mctp_binding_astpcie_core(struct mctp_binding_astpcie *b) { |
| 54 | return &b->binding; |
| 55 | } |