cfmuxl.c (11e4afb49b7fa1fc8e1ffd850c1806dd86a08204) cfmuxl.c (b31fa5bad576cd8180a5ad70c648333b44320d44)
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
8
6#include <linux/stddef.h>
7#include <linux/spinlock.h>
8#include <linux/slab.h>
9#include <net/caif/cfpkt.h>
10#include <net/caif/cfmuxl.h>
11#include <net/caif/cfsrvl.h>
12#include <net/caif/cffrml.h>
13

--- 171 unchanged lines hidden (view full) ---

185
186static int cfmuxl_receive(struct cflayer *layr, struct cfpkt *pkt)
187{
188 int ret;
189 struct cfmuxl *muxl = container_obj(layr);
190 u8 id;
191 struct cflayer *up;
192 if (cfpkt_extr_head(pkt, &id, 1) < 0) {
9#include <linux/stddef.h>
10#include <linux/spinlock.h>
11#include <linux/slab.h>
12#include <net/caif/cfpkt.h>
13#include <net/caif/cfmuxl.h>
14#include <net/caif/cfsrvl.h>
15#include <net/caif/cffrml.h>
16

--- 171 unchanged lines hidden (view full) ---

188
189static int cfmuxl_receive(struct cflayer *layr, struct cfpkt *pkt)
190{
191 int ret;
192 struct cfmuxl *muxl = container_obj(layr);
193 u8 id;
194 struct cflayer *up;
195 if (cfpkt_extr_head(pkt, &id, 1) < 0) {
193 pr_err("CAIF: %s(): erroneous Caif Packet\n", __func__);
196 pr_err("erroneous Caif Packet\n");
194 cfpkt_destroy(pkt);
195 return -EPROTO;
196 }
197
198 spin_lock(&muxl->receive_lock);
199 up = get_up(muxl, id);
200 spin_unlock(&muxl->receive_lock);
201 if (up == NULL) {
197 cfpkt_destroy(pkt);
198 return -EPROTO;
199 }
200
201 spin_lock(&muxl->receive_lock);
202 up = get_up(muxl, id);
203 spin_unlock(&muxl->receive_lock);
204 if (up == NULL) {
202 pr_info("CAIF: %s():Received data on unknown link ID = %d "
203 "(0x%x) up == NULL", __func__, id, id);
205 pr_info("Received data on unknown link ID = %d (0x%x) up == NULL",
206 id, id);
204 cfpkt_destroy(pkt);
205 /*
206 * Don't return ERROR, since modem misbehaves and sends out
207 * flow on before linksetup response.
208 */
209 return /* CFGLU_EPROT; */ 0;
210 }
211 cfsrvl_get(up);

--- 6 unchanged lines hidden (view full) ---

218{
219 int ret;
220 struct cfmuxl *muxl = container_obj(layr);
221 u8 linkid;
222 struct cflayer *dn;
223 struct caif_payload_info *info = cfpkt_info(pkt);
224 dn = get_dn(muxl, cfpkt_info(pkt)->dev_info);
225 if (dn == NULL) {
207 cfpkt_destroy(pkt);
208 /*
209 * Don't return ERROR, since modem misbehaves and sends out
210 * flow on before linksetup response.
211 */
212 return /* CFGLU_EPROT; */ 0;
213 }
214 cfsrvl_get(up);

--- 6 unchanged lines hidden (view full) ---

221{
222 int ret;
223 struct cfmuxl *muxl = container_obj(layr);
224 u8 linkid;
225 struct cflayer *dn;
226 struct caif_payload_info *info = cfpkt_info(pkt);
227 dn = get_dn(muxl, cfpkt_info(pkt)->dev_info);
228 if (dn == NULL) {
226 pr_warning("CAIF: %s(): Send data on unknown phy "
227 "ID = %d (0x%x)\n",
228 __func__, info->dev_info->id, info->dev_info->id);
229 pr_warn("Send data on unknown phy ID = %d (0x%x)\n",
230 info->dev_info->id, info->dev_info->id);
229 return -ENOTCONN;
230 }
231 info->hdr_len += 1;
232 linkid = info->channel_id;
233 cfpkt_add_head(pkt, &linkid, 1);
234 ret = dn->transmit(dn, pkt);
235 /* Remove MUX protocol header upon error. */
236 if (ret < 0)

--- 16 unchanged lines hidden ---
231 return -ENOTCONN;
232 }
233 info->hdr_len += 1;
234 linkid = info->channel_id;
235 cfpkt_add_head(pkt, &linkid, 1);
236 ret = dn->transmit(dn, pkt);
237 /* Remove MUX protocol header upon error. */
238 if (ret < 0)

--- 16 unchanged lines hidden ---