blob: d79c99cd2c2d94c1d56e2edd3c682e6f1f381ee2 [file] [log] [blame]
Jeremy Kerr3d36ee22019-05-30 11:15:37 +08001/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
Jeremy Kerr4cdc2002019-02-07 16:49:12 +08002
3#include <assert.h>
Andrew Jeffery89a28782022-09-29 11:46:31 +09304#include <errno.h>
Jeremy Kerr4cdc2002019-02-07 16:49:12 +08005#include <stdbool.h>
6#include <stdlib.h>
7#include <string.h>
Jeremy Kerr4cdc2002019-02-07 16:49:12 +08008
John Chungb3de3432024-04-19 11:47:01 +08009#include "crc-16-ccitt.h"
10
Jeremy Kerrc7e764a2019-05-28 16:49:03 +080011#ifdef HAVE_CONFIG_H
12#include "config.h"
13#endif
14
15#ifdef MCTP_HAVE_FILEIO
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080016#include <fcntl.h>
Andrew Jeffery1111c6a2022-07-25 20:44:39 +093017#include <poll.h>
18#include <unistd.h>
Jeremy Kerr597b3692019-09-03 16:24:48 +080019#else
Matt Johnston6e0c5d62024-09-10 16:03:13 +080020static const size_t write(int fd, const void *buf, size_t len)
Jeremy Kerr597b3692019-09-03 16:24:48 +080021{
22 return -1;
23}
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080024#endif
25
26#define pr_fmt(x) "serial: " x
27
Matt Johnston4a09e1d2024-09-13 14:55:58 +080028#define SERIAL_BTU MCTP_BTU
29
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080030#include "libmctp.h"
31#include "libmctp-alloc.h"
32#include "libmctp-log.h"
33#include "libmctp-serial.h"
Przemyslaw Czarnowskiff25d7e2020-03-26 11:39:37 +010034#include "container_of.h"
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080035
36struct mctp_binding_serial {
Andrew Jeffery1111c6a2022-07-25 20:44:39 +093037 struct mctp_binding binding;
38 int fd;
39 unsigned long bus_id;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080040
Patrick Williamsa721c2d2022-12-04 14:30:26 -060041 mctp_serial_tx_fn tx_fn;
42 void *tx_fn_data;
Jeremy Kerr597b3692019-09-03 16:24:48 +080043
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080044 /* receive buffer and state */
Patrick Williamsa721c2d2022-12-04 14:30:26 -060045 uint8_t rxbuf[1024];
46 struct mctp_pktbuf *rx_pkt;
Matt Johnston4a09e1d2024-09-13 14:55:58 +080047 uint8_t rx_storage[MCTP_PKTBUF_SIZE(SERIAL_BTU)];
Patrick Williamsa721c2d2022-12-04 14:30:26 -060048 uint8_t rx_exp_len;
49 uint16_t rx_fcs;
John Chungb3de3432024-04-19 11:47:01 +080050 uint16_t rx_fcs_calc;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080051 enum {
52 STATE_WAIT_SYNC_START,
53 STATE_WAIT_REVISION,
54 STATE_WAIT_LEN,
55 STATE_DATA,
56 STATE_DATA_ESCAPED,
57 STATE_WAIT_FCS1,
58 STATE_WAIT_FCS2,
59 STATE_WAIT_SYNC_END,
60 } rx_state;
Jeremy Kerrc67605b2019-02-07 21:52:00 +080061
62 /* temporary transmit buffer */
Patrick Williamsa721c2d2022-12-04 14:30:26 -060063 uint8_t txbuf[256];
Matt Johnston4a09e1d2024-09-13 14:55:58 +080064 /* used by the MCTP stack */
65 uint8_t tx_storage[MCTP_PKTBUF_SIZE(SERIAL_BTU)];
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080066};
67
Patrick Williamsa721c2d2022-12-04 14:30:26 -060068#define binding_to_serial(b) \
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080069 container_of(b, struct mctp_binding_serial, binding)
70
Patrick Williamsa721c2d2022-12-04 14:30:26 -060071#define MCTP_SERIAL_REVISION 0x01
72#define MCTP_SERIAL_FRAMING_FLAG 0x7e
73#define MCTP_SERIAL_ESCAPE 0x7d
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080074
75struct mctp_serial_header {
Patrick Williamsa721c2d2022-12-04 14:30:26 -060076 uint8_t flag;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080077 uint8_t revision;
Patrick Williamsa721c2d2022-12-04 14:30:26 -060078 uint8_t len;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080079};
80
81struct mctp_serial_trailer {
Patrick Williamsa721c2d2022-12-04 14:30:26 -060082 uint8_t fcs_msb;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080083 uint8_t fcs_lsb;
Patrick Williamsa721c2d2022-12-04 14:30:26 -060084 uint8_t flag;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080085};
86
Matt Johnstone79ac012024-12-10 18:17:52 +080087/*
88 * @fn: A function that will copy data from the buffer at src into the dst object
89 * @dst: An opaque object to pass as state to fn
90 * @src: A pointer to the buffer of data to copy to dst
91 * @len: The length of the data pointed to by src
92 * @return: 0 on succes, negative error code on failure
93 *
94 * Pre-condition: fn returns a write count or a negative error code
95 * Post-condition: All bytes written or an error has occurred
96 */
97static ssize_t mctp_write_all(mctp_serial_tx_fn fn, void *dst, uint8_t *src,
98 size_t len)
99{
100 uint8_t *__src = src;
101 ssize_t wrote;
102 while (len) {
103 wrote = fn(dst, __src, len);
104 if (wrote < 0) {
105 break;
106 }
107 __src += wrote;
108 len -= wrote;
109 }
110 return len ? wrote : 0;
111}
112
113static int mctp_serial_write(void *fildesp, void *buf, size_t nbyte)
114{
115 ssize_t wrote;
116 int fildes = *((int *)fildesp);
117
118 return ((wrote = write(fildes, buf, nbyte)) < 0) ? -errno : wrote;
119}
120
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800121static size_t mctp_serial_pkt_escape(struct mctp_pktbuf *pkt, uint8_t *buf)
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800122{
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800123 uint8_t total_len;
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800124 uint8_t *p;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800125 int i, j;
126
127 total_len = pkt->end - pkt->mctp_hdr_off;
128
129 p = (void *)mctp_pktbuf_hdr(pkt);
130
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800131 for (i = 0, j = 0; i < total_len; i++, j++) {
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800132 uint8_t c = p[i];
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800133 if (c == 0x7e || c == 0x7d) {
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800134 if (buf)
135 buf[j] = 0x7d;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800136 j++;
137 c ^= 0x20;
138 }
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800139 if (buf)
140 buf[j] = c;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800141 }
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800142
143 return j;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800144}
145
146static int mctp_binding_serial_tx(struct mctp_binding *b,
Patrick Williamsa721c2d2022-12-04 14:30:26 -0600147 struct mctp_pktbuf *pkt)
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800148{
149 struct mctp_binding_serial *serial = binding_to_serial(b);
150 struct mctp_serial_header *hdr;
151 struct mctp_serial_trailer *tlr;
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800152 uint8_t *buf;
153 size_t len;
John Chungb3de3432024-04-19 11:47:01 +0800154 uint16_t fcs;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800155
156 /* the length field in the header excludes serial framing
157 * and escape sequences */
158 len = mctp_pktbuf_size(pkt);
159
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800160 hdr = (void *)serial->txbuf;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800161 hdr->flag = MCTP_SERIAL_FRAMING_FLAG;
162 hdr->revision = MCTP_SERIAL_REVISION;
163 hdr->len = len;
164
John Chungb3de3432024-04-19 11:47:01 +0800165 // Calculate fcs
166 fcs = crc_16_ccitt(FCS_INIT_16, (const uint8_t *)hdr + 1, 2);
167 fcs = crc_16_ccitt(fcs, (const uint8_t *)mctp_pktbuf_hdr(pkt), len);
168
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800169 buf = (void *)(hdr + 1);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800170
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800171 len = mctp_serial_pkt_escape(pkt, NULL);
172 if (len + sizeof(*hdr) + sizeof(*tlr) > sizeof(serial->txbuf))
Andrew Jeffery0721f582022-09-29 12:12:39 +0930173 return -EMSGSIZE;
Jeremy Kerrc67605b2019-02-07 21:52:00 +0800174
175 mctp_serial_pkt_escape(pkt, buf);
176
177 buf += len;
178
179 tlr = (void *)buf;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800180 tlr->flag = MCTP_SERIAL_FRAMING_FLAG;
John Chungb3de3432024-04-19 11:47:01 +0800181 tlr->fcs_msb = fcs >> 8;
182 tlr->fcs_lsb = fcs & 0xff;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800183
Jeremy Kerr597b3692019-09-03 16:24:48 +0800184 len += sizeof(*hdr) + sizeof(*tlr);
185
Andrew Jefferyad772b92020-01-10 16:04:18 +1030186 if (!serial->tx_fn)
Matt Johnstone79ac012024-12-10 18:17:52 +0800187 return mctp_write_all(mctp_serial_write, &serial->fd,
Andrew Jeffery89a28782022-09-29 11:46:31 +0930188 &serial->txbuf[0], len);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800189
Patrick Williamsa721c2d2022-12-04 14:30:26 -0600190 return mctp_write_all(serial->tx_fn, serial->tx_fn_data,
191 &serial->txbuf[0], len);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800192}
193
194static void mctp_serial_finish_packet(struct mctp_binding_serial *serial,
Patrick Williamsa721c2d2022-12-04 14:30:26 -0600195 bool valid)
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800196{
197 struct mctp_pktbuf *pkt = serial->rx_pkt;
198 assert(pkt);
199
200 if (valid)
Jeremy Kerr0a00dca2019-03-01 08:01:35 +0800201 mctp_bus_rx(&serial->binding, pkt);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800202
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800203 serial->rx_pkt = NULL;
204}
205
Matt Johnston4a09e1d2024-09-13 14:55:58 +0800206static void mctp_serial_start_packet(struct mctp_binding_serial *serial)
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800207{
Matt Johnston4a09e1d2024-09-13 14:55:58 +0800208 serial->rx_pkt = mctp_pktbuf_init(&serial->binding, serial->rx_storage);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800209}
210
Patrick Williamsa721c2d2022-12-04 14:30:26 -0600211static void mctp_rx_consume_one(struct mctp_binding_serial *serial, uint8_t c)
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800212{
213 struct mctp_pktbuf *pkt = serial->rx_pkt;
John Chungb3de3432024-04-19 11:47:01 +0800214 bool valid = false;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800215
216 mctp_prdebug("state: %d, char 0x%02x", serial->rx_state, c);
217
218 assert(!pkt == (serial->rx_state == STATE_WAIT_SYNC_START ||
219 serial->rx_state == STATE_WAIT_REVISION ||
220 serial->rx_state == STATE_WAIT_LEN));
221
222 switch (serial->rx_state) {
223 case STATE_WAIT_SYNC_START:
224 if (c != MCTP_SERIAL_FRAMING_FLAG) {
225 mctp_prdebug("lost sync, dropping packet");
226 if (pkt)
227 mctp_serial_finish_packet(serial, false);
228 } else {
229 serial->rx_state = STATE_WAIT_REVISION;
230 }
231 break;
232
233 case STATE_WAIT_REVISION:
234 if (c == MCTP_SERIAL_REVISION) {
235 serial->rx_state = STATE_WAIT_LEN;
John Chungb3de3432024-04-19 11:47:01 +0800236 serial->rx_fcs_calc = crc_16_ccitt_byte(FCS_INIT_16, c);
Nikhil Namjoshi1fe58992024-01-09 04:00:12 +0000237 } else if (c == MCTP_SERIAL_FRAMING_FLAG) {
238 /* Handle the case where there are bytes dropped in request,
239 * and the state machine is out of sync. The failed request's
240 * trailing footer i.e. 0x7e would be interpreted as next
241 * request's framing footer. So if we are in STATE_WAIT_REVISION
242 * and receive 0x7e byte, then contine to stay in
243 * STATE_WAIT_REVISION
244 */
245 mctp_prdebug(
246 "Received serial framing flag 0x%02x while waiting"
247 " for serial revision 0x%02x.",
248 c, MCTP_SERIAL_REVISION);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800249 } else {
250 mctp_prdebug("invalid revision 0x%02x", c);
251 serial->rx_state = STATE_WAIT_SYNC_START;
252 }
253 break;
254 case STATE_WAIT_LEN:
Jeremy Kerrdf15f7e2019-08-05 15:41:19 +0800255 if (c > serial->binding.pkt_size ||
Patrick Williamsa721c2d2022-12-04 14:30:26 -0600256 c < sizeof(struct mctp_hdr)) {
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800257 mctp_prdebug("invalid size %d", c);
258 serial->rx_state = STATE_WAIT_SYNC_START;
259 } else {
Matt Johnston4a09e1d2024-09-13 14:55:58 +0800260 mctp_serial_start_packet(serial);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800261 pkt = serial->rx_pkt;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800262 serial->rx_exp_len = c;
263 serial->rx_state = STATE_DATA;
John Chungb3de3432024-04-19 11:47:01 +0800264 serial->rx_fcs_calc =
265 crc_16_ccitt_byte(serial->rx_fcs_calc, c);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800266 }
267 break;
268
269 case STATE_DATA:
270 if (c == MCTP_SERIAL_ESCAPE) {
271 serial->rx_state = STATE_DATA_ESCAPED;
272 } else {
273 mctp_pktbuf_push(pkt, &c, 1);
John Chungb3de3432024-04-19 11:47:01 +0800274 serial->rx_fcs_calc =
275 crc_16_ccitt_byte(serial->rx_fcs_calc, c);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800276 if (pkt->end - pkt->mctp_hdr_off == serial->rx_exp_len)
277 serial->rx_state = STATE_WAIT_FCS1;
278 }
279 break;
280
281 case STATE_DATA_ESCAPED:
282 c ^= 0x20;
283 mctp_pktbuf_push(pkt, &c, 1);
John Chungb3de3432024-04-19 11:47:01 +0800284 serial->rx_fcs_calc = crc_16_ccitt_byte(serial->rx_fcs_calc, c);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800285 if (pkt->end - pkt->mctp_hdr_off == serial->rx_exp_len)
286 serial->rx_state = STATE_WAIT_FCS1;
287 else
288 serial->rx_state = STATE_DATA;
289 break;
290
291 case STATE_WAIT_FCS1:
292 serial->rx_fcs = c << 8;
293 serial->rx_state = STATE_WAIT_FCS2;
294 break;
295 case STATE_WAIT_FCS2:
296 serial->rx_fcs |= c;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800297 serial->rx_state = STATE_WAIT_SYNC_END;
298 break;
299
300 case STATE_WAIT_SYNC_END:
John Chungb3de3432024-04-19 11:47:01 +0800301 if (serial->rx_fcs == serial->rx_fcs_calc) {
302 if (c == MCTP_SERIAL_FRAMING_FLAG) {
303 valid = true;
304 } else {
305 valid = false;
306 mctp_prdebug("missing end frame marker");
307 }
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800308 } else {
John Chungb3de3432024-04-19 11:47:01 +0800309 valid = false;
310 mctp_prdebug("invalid fcs : 0x%04x, expect 0x%04x",
311 serial->rx_fcs, serial->rx_fcs_calc);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800312 }
John Chungb3de3432024-04-19 11:47:01 +0800313
314 mctp_serial_finish_packet(serial, valid);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800315 serial->rx_state = STATE_WAIT_SYNC_START;
316 break;
317 }
318
319 mctp_prdebug(" -> state: %d", serial->rx_state);
320}
Patrick Williamsa721c2d2022-12-04 14:30:26 -0600321static void mctp_rx_consume(struct mctp_binding_serial *serial, const void *buf,
322 size_t len)
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800323{
324 size_t i;
325
326 for (i = 0; i < len; i++)
Matt Johnston3ef47782024-12-11 15:19:06 +0800327 mctp_rx_consume_one(serial, ((const uint8_t *)buf)[i]);
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800328}
329
Jeremy Kerrc7e764a2019-05-28 16:49:03 +0800330#ifdef MCTP_HAVE_FILEIO
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800331int mctp_serial_read(struct mctp_binding_serial *serial)
332{
333 ssize_t len;
334
335 len = read(serial->fd, serial->rxbuf, sizeof(serial->rxbuf));
336 if (len == 0)
337 return -1;
338
339 if (len < 0) {
Matt Johnston3ef47782024-12-11 15:19:06 +0800340 mctp_prerr("can't read from serial device: %s",
341 strerror(errno));
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800342 return -1;
343 }
344
345 mctp_rx_consume(serial, serial->rxbuf, len);
346
347 return 0;
348}
349
Andrew Jeffery1111c6a2022-07-25 20:44:39 +0930350int mctp_serial_init_pollfd(struct mctp_binding_serial *serial,
351 struct pollfd *pollfd)
352{
353 pollfd->fd = serial->fd;
354 pollfd->events = POLLIN;
355
356 return 0;
357}
358
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800359int mctp_serial_open_path(struct mctp_binding_serial *serial,
Patrick Williamsa721c2d2022-12-04 14:30:26 -0600360 const char *device)
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800361{
362 serial->fd = open(device, O_RDWR);
363 if (serial->fd < 0)
Matt Johnston3ef47782024-12-11 15:19:06 +0800364 mctp_prerr("can't open device %s: %s", device, strerror(errno));
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800365
366 return 0;
367}
368
369void mctp_serial_open_fd(struct mctp_binding_serial *serial, int fd)
370{
371 serial->fd = fd;
372}
373#endif
374
Jeremy Kerr597b3692019-09-03 16:24:48 +0800375void mctp_serial_set_tx_fn(struct mctp_binding_serial *serial,
Patrick Williamsa721c2d2022-12-04 14:30:26 -0600376 mctp_serial_tx_fn fn, void *data)
Jeremy Kerr597b3692019-09-03 16:24:48 +0800377{
378 serial->tx_fn = fn;
379 serial->tx_fn_data = data;
380}
381
Patrick Williamsa721c2d2022-12-04 14:30:26 -0600382int mctp_serial_rx(struct mctp_binding_serial *serial, const void *buf,
383 size_t len)
Jeremy Kerr597b3692019-09-03 16:24:48 +0800384{
385 mctp_rx_consume(serial, buf, len);
Andrew Jeffery00e67702020-01-24 12:25:50 +1030386 return 0;
Jeremy Kerr597b3692019-09-03 16:24:48 +0800387}
388
Jeremy Kerr3b36d172019-09-04 11:56:09 +0800389static int mctp_serial_core_start(struct mctp_binding *binding)
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800390{
Jeremy Kerr3b36d172019-09-04 11:56:09 +0800391 mctp_binding_set_tx_enabled(binding, true);
392 return 0;
393}
394
395struct mctp_binding *mctp_binding_serial_core(struct mctp_binding_serial *b)
396{
397 return &b->binding;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800398}
399
400struct mctp_binding_serial *mctp_serial_init(void)
401{
402 struct mctp_binding_serial *serial;
403
404 serial = __mctp_alloc(sizeof(*serial));
Jeremy Kerr0bead572019-09-02 16:45:33 +0800405 memset(serial, 0, sizeof(*serial));
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800406 serial->fd = -1;
407 serial->rx_state = STATE_WAIT_SYNC_START;
408 serial->rx_pkt = NULL;
409 serial->binding.name = "serial";
410 serial->binding.version = 1;
Matt Johnston4a09e1d2024-09-13 14:55:58 +0800411 serial->binding.pkt_size = MCTP_PACKET_SIZE(SERIAL_BTU);
Andrew Jeffery39da3d02021-03-12 16:51:26 +1030412 serial->binding.pkt_header = 0;
Konstantin Aladyshev2a2a0f62023-08-25 23:40:02 +0300413 serial->binding.pkt_trailer = 0;
Matt Johnston4a09e1d2024-09-13 14:55:58 +0800414 serial->binding.tx_storage = serial->tx_storage;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800415
Jeremy Kerr3b36d172019-09-04 11:56:09 +0800416 serial->binding.start = mctp_serial_core_start;
Jeremy Kerr4cdc2002019-02-07 16:49:12 +0800417 serial->binding.tx = mctp_binding_serial_tx;
418
419 return serial;
420}
421
Andrew Jefferyf8b47492020-03-10 23:48:59 +1030422void mctp_serial_destroy(struct mctp_binding_serial *serial)
423{
424 __mctp_free(serial);
425}