Lines Matching +full:- +full:eproto
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson AB 2010
37 struct cfrfml *rfml = container_obj(&srvl->layer); in cfrfml_release()
39 if (rfml->incomplete_frm) in cfrfml_release()
40 cfpkt_destroy(rfml->incomplete_frm); in cfrfml_release()
54 cfsrvl_init(&this->serv, channel_id, dev_info, false); in cfrfml_create()
55 this->serv.release = cfrfml_release; in cfrfml_create()
56 this->serv.layer.receive = cfrfml_receive; in cfrfml_create()
57 this->serv.layer.transmit = cfrfml_transmit; in cfrfml_create()
60 tmp = (mtu_size - RFM_HEAD_SIZE - 6) / 16; in cfrfml_create()
63 this->fragment_size = tmp; in cfrfml_create()
64 spin_lock_init(&this->sync); in cfrfml_create()
65 snprintf(this->serv.layer.name, CAIF_LAYER_NAME_SZ, in cfrfml_create()
68 return &this->serv.layer; in cfrfml_create()
75 *err = -EPROTO; in rfm_append()
76 /* n-th but not last segment */ in rfm_append()
82 if (memcmp(seghead, rfml->seghead, 6) != 0) in rfm_append()
85 tmppkt = cfpkt_append(rfml->incomplete_frm, pkt, in rfm_append()
86 rfml->pdu_size + RFM_HEAD_SIZE); in rfm_append()
89 *err = -ENOMEM; in rfm_append()
106 caif_assert(layr->up != NULL); in cfrfml_receive()
107 caif_assert(layr->receive != NULL); in cfrfml_receive()
109 spin_lock(&rfml->sync); in cfrfml_receive()
111 err = -EPROTO; in cfrfml_receive()
117 if (rfml->incomplete_frm == NULL) { in cfrfml_receive()
119 if (cfpkt_peek_head(pkt, rfml->seghead, 6) != 0) in cfrfml_receive()
122 rfml->pdu_size = get_unaligned_le16(rfml->seghead+4); in cfrfml_receive()
126 rfml->incomplete_frm = pkt; in cfrfml_receive()
137 rfml->incomplete_frm = tmppkt; in cfrfml_receive()
147 if (rfml->incomplete_frm) { in cfrfml_receive()
157 rfml->incomplete_frm = NULL; in cfrfml_receive()
162 err = -EPROTO; in cfrfml_receive()
163 if (rfml->pdu_size != cfpkt_getlen(pkt) - RFM_HEAD_SIZE + 1) in cfrfml_receive()
167 err = rfml->serv.layer.up->receive(rfml->serv.layer.up, pkt); in cfrfml_receive()
176 if (rfml->incomplete_frm) in cfrfml_receive()
177 cfpkt_destroy(rfml->incomplete_frm); in cfrfml_receive()
178 rfml->incomplete_frm = NULL; in cfrfml_receive()
183 layr->up->ctrlcmd(layr->up, CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND, in cfrfml_receive()
184 rfml->serv.dev_info.id); in cfrfml_receive()
186 spin_unlock(&rfml->sync); in cfrfml_receive()
188 if (unlikely(err == -EAGAIN)) in cfrfml_receive()
190 err = -EIO; in cfrfml_receive()
198 caif_assert(cfpkt_getlen(pkt) < rfml->fragment_size + RFM_HEAD_SIZE); in cfrfml_transmit_segment()
200 /* Add info for MUX-layer to route the packet out. */ in cfrfml_transmit_segment()
201 cfpkt_info(pkt)->channel_id = rfml->serv.layer.id; in cfrfml_transmit_segment()
207 cfpkt_info(pkt)->hdr_len = RFM_HEAD_SIZE; in cfrfml_transmit_segment()
208 cfpkt_info(pkt)->dev_info = &rfml->serv.dev_info; in cfrfml_transmit_segment()
210 return rfml->serv.layer.dn->transmit(rfml->serv.layer.dn, pkt); in cfrfml_transmit_segment()
222 caif_assert(layr->dn != NULL); in cfrfml_transmit()
223 caif_assert(layr->dn->transmit != NULL); in cfrfml_transmit()
225 if (!cfsrvl_ready(&rfml->serv, &err)) in cfrfml_transmit()
228 err = -EPROTO; in cfrfml_transmit()
229 if (cfpkt_getlen(pkt) <= RFM_HEAD_SIZE-1) in cfrfml_transmit()
233 if (cfpkt_getlen(pkt) > rfml->fragment_size + RFM_HEAD_SIZE) in cfrfml_transmit()
239 while (cfpkt_getlen(frontpkt) > rfml->fragment_size + RFM_HEAD_SIZE) { in cfrfml_transmit()
242 err = -EPROTO; in cfrfml_transmit()
253 rearpkt = cfpkt_split(frontpkt, rfml->fragment_size); in cfrfml_transmit()
267 err = -EPROTO; in cfrfml_transmit()
274 err = -EPROTO; in cfrfml_transmit()
288 layr->up->ctrlcmd(layr->up, CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND, in cfrfml_transmit()
289 rfml->serv.dev_info.id); in cfrfml_transmit()