blob: 2bd7b79d1873d4bad4b6c939c6e3e6c5aeae8117 [file] [log] [blame]
Utkarsh Saxena96194882017-04-03 13:21:58 +05301/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
Amir Levy9659e592016-10-27 18:08:27 +03002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/fs.h>
14#include <linux/sched.h>
15#include "ipa_i.h"
16
17struct ipa3_intf {
18 char name[IPA_RESOURCE_NAME_MAX];
19 struct list_head link;
20 u32 num_tx_props;
21 u32 num_rx_props;
22 u32 num_ext_props;
23 struct ipa_ioc_tx_intf_prop *tx;
24 struct ipa_ioc_rx_intf_prop *rx;
25 struct ipa_ioc_ext_intf_prop *ext;
26 enum ipa_client_type excp_pipe;
27};
28
29struct ipa3_push_msg {
30 struct ipa_msg_meta meta;
31 ipa_msg_free_fn callback;
32 void *buff;
33 struct list_head link;
34};
35
36struct ipa3_pull_msg {
37 struct ipa_msg_meta meta;
38 ipa_msg_pull_fn callback;
39 struct list_head link;
40};
41
42/**
43 * ipa3_register_intf() - register "logical" interface
44 * @name: [in] interface name
45 * @tx: [in] TX properties of the interface
46 * @rx: [in] RX properties of the interface
47 *
48 * Register an interface and its tx and rx properties, this allows
49 * configuration of rules from user-space
50 *
51 * Returns: 0 on success, negative on failure
52 *
53 * Note: Should not be called from atomic context
54 */
55int ipa3_register_intf(const char *name, const struct ipa_tx_intf *tx,
56 const struct ipa_rx_intf *rx)
57{
58 return ipa3_register_intf_ext(name, tx, rx, NULL);
59}
60
61/**
62 * ipa3_register_intf_ext() - register "logical" interface which has only
63 * extended properties
64 * @name: [in] interface name
65 * @tx: [in] TX properties of the interface
66 * @rx: [in] RX properties of the interface
67 * @ext: [in] EXT properties of the interface
68 *
69 * Register an interface and its tx, rx and ext properties, this allows
70 * configuration of rules from user-space
71 *
72 * Returns: 0 on success, negative on failure
73 *
74 * Note: Should not be called from atomic context
75 */
76int ipa3_register_intf_ext(const char *name, const struct ipa_tx_intf *tx,
77 const struct ipa_rx_intf *rx,
78 const struct ipa_ext_intf *ext)
79{
80 struct ipa3_intf *intf;
81 u32 len;
82
83 if (name == NULL || (tx == NULL && rx == NULL && ext == NULL)) {
84 IPAERR("invalid params name=%p tx=%p rx=%p ext=%p\n", name,
85 tx, rx, ext);
86 return -EINVAL;
87 }
88
89 if (tx && tx->num_props > IPA_NUM_PROPS_MAX) {
90 IPAERR("invalid tx num_props=%d max=%d\n", tx->num_props,
91 IPA_NUM_PROPS_MAX);
92 return -EINVAL;
93 }
94
95 if (rx && rx->num_props > IPA_NUM_PROPS_MAX) {
96 IPAERR("invalid rx num_props=%d max=%d\n", rx->num_props,
97 IPA_NUM_PROPS_MAX);
98 return -EINVAL;
99 }
100
101 if (ext && ext->num_props > IPA_NUM_PROPS_MAX) {
102 IPAERR("invalid ext num_props=%d max=%d\n", ext->num_props,
103 IPA_NUM_PROPS_MAX);
104 return -EINVAL;
105 }
106
107 len = sizeof(struct ipa3_intf);
108 intf = kzalloc(len, GFP_KERNEL);
109 if (intf == NULL) {
110 IPAERR("fail to alloc 0x%x bytes\n", len);
111 return -ENOMEM;
112 }
113
114 strlcpy(intf->name, name, IPA_RESOURCE_NAME_MAX);
115
116 if (tx) {
117 intf->num_tx_props = tx->num_props;
118 len = tx->num_props * sizeof(struct ipa_ioc_tx_intf_prop);
119 intf->tx = kzalloc(len, GFP_KERNEL);
120 if (intf->tx == NULL) {
121 IPAERR("fail to alloc 0x%x bytes\n", len);
122 kfree(intf);
123 return -ENOMEM;
124 }
125 memcpy(intf->tx, tx->prop, len);
126 }
127
128 if (rx) {
129 intf->num_rx_props = rx->num_props;
130 len = rx->num_props * sizeof(struct ipa_ioc_rx_intf_prop);
131 intf->rx = kzalloc(len, GFP_KERNEL);
132 if (intf->rx == NULL) {
133 IPAERR("fail to alloc 0x%x bytes\n", len);
134 kfree(intf->tx);
135 kfree(intf);
136 return -ENOMEM;
137 }
138 memcpy(intf->rx, rx->prop, len);
139 }
140
141 if (ext) {
142 intf->num_ext_props = ext->num_props;
143 len = ext->num_props * sizeof(struct ipa_ioc_ext_intf_prop);
144 intf->ext = kzalloc(len, GFP_KERNEL);
145 if (intf->ext == NULL) {
146 IPAERR("fail to alloc 0x%x bytes\n", len);
147 kfree(intf->rx);
148 kfree(intf->tx);
149 kfree(intf);
150 return -ENOMEM;
151 }
152 memcpy(intf->ext, ext->prop, len);
153 }
154
155 if (ext && ext->excp_pipe_valid)
156 intf->excp_pipe = ext->excp_pipe;
157 else
158 intf->excp_pipe = IPA_CLIENT_APPS_LAN_CONS;
159
160 mutex_lock(&ipa3_ctx->lock);
161 list_add_tail(&intf->link, &ipa3_ctx->intf_list);
162 mutex_unlock(&ipa3_ctx->lock);
163
164 return 0;
165}
166
167/**
168 * ipa3_deregister_intf() - de-register previously registered logical interface
169 * @name: [in] interface name
170 *
171 * De-register a previously registered interface
172 *
173 * Returns: 0 on success, negative on failure
174 *
175 * Note: Should not be called from atomic context
176 */
177int ipa3_deregister_intf(const char *name)
178{
179 struct ipa3_intf *entry;
180 struct ipa3_intf *next;
181 int result = -EINVAL;
182
183 if ((name == NULL) ||
184 (strnlen(name, IPA_RESOURCE_NAME_MAX) == IPA_RESOURCE_NAME_MAX)) {
185 IPAERR("invalid param name=%s\n", name);
186 return result;
187 }
188
189 mutex_lock(&ipa3_ctx->lock);
190 list_for_each_entry_safe(entry, next, &ipa3_ctx->intf_list, link) {
191 if (!strcmp(entry->name, name)) {
192 list_del(&entry->link);
193 kfree(entry->ext);
194 kfree(entry->rx);
195 kfree(entry->tx);
196 kfree(entry);
197 result = 0;
198 break;
199 }
200 }
201 mutex_unlock(&ipa3_ctx->lock);
202
203 return result;
204}
205
206/**
207 * ipa3_query_intf() - query logical interface properties
208 * @lookup: [inout] interface name and number of properties
209 *
210 * Obtain the handle and number of tx and rx properties for the named
211 * interface, used as part of querying the tx and rx properties for
212 * configuration of various rules from user-space
213 *
214 * Returns: 0 on success, negative on failure
215 *
216 * Note: Should not be called from atomic context
217 */
218int ipa3_query_intf(struct ipa_ioc_query_intf *lookup)
219{
220 struct ipa3_intf *entry;
221 int result = -EINVAL;
222
223 if (lookup == NULL) {
224 IPAERR("invalid param lookup=%p\n", lookup);
225 return result;
226 }
227
228 if (strnlen(lookup->name, IPA_RESOURCE_NAME_MAX) ==
229 IPA_RESOURCE_NAME_MAX) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +0530230 IPAERR_RL("Interface name too long. (%s)\n", lookup->name);
Amir Levy9659e592016-10-27 18:08:27 +0300231 return result;
232 }
233
234 mutex_lock(&ipa3_ctx->lock);
235 list_for_each_entry(entry, &ipa3_ctx->intf_list, link) {
236 if (!strcmp(entry->name, lookup->name)) {
237 lookup->num_tx_props = entry->num_tx_props;
238 lookup->num_rx_props = entry->num_rx_props;
239 lookup->num_ext_props = entry->num_ext_props;
240 lookup->excp_pipe = entry->excp_pipe;
241 result = 0;
242 break;
243 }
244 }
245 mutex_unlock(&ipa3_ctx->lock);
246
247 return result;
248}
249
250/**
251 * ipa3_query_intf_tx_props() - qeury TX props of an interface
252 * @tx: [inout] interface tx attributes
253 *
254 * Obtain the tx properties for the specified interface
255 *
256 * Returns: 0 on success, negative on failure
257 *
258 * Note: Should not be called from atomic context
259 */
260int ipa3_query_intf_tx_props(struct ipa_ioc_query_intf_tx_props *tx)
261{
262 struct ipa3_intf *entry;
263 int result = -EINVAL;
264
265 if (tx == NULL) {
266 IPAERR("invalid param tx=%p\n", tx);
267 return result;
268 }
269
270 if (strnlen(tx->name, IPA_RESOURCE_NAME_MAX) == IPA_RESOURCE_NAME_MAX) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +0530271 IPAERR_RL("Interface name too long. (%s)\n", tx->name);
Amir Levy9659e592016-10-27 18:08:27 +0300272 return result;
273 }
274
275 mutex_lock(&ipa3_ctx->lock);
276 list_for_each_entry(entry, &ipa3_ctx->intf_list, link) {
277 if (!strcmp(entry->name, tx->name)) {
Skylar Chang1b598102017-03-01 16:08:27 -0800278 /* add the entry check */
279 if (entry->num_tx_props != tx->num_tx_props) {
280 IPAERR("invalid entry number(%u %u)\n",
281 entry->num_tx_props,
282 tx->num_tx_props);
283 mutex_unlock(&ipa3_ctx->lock);
284 return result;
285 }
Amir Levy9659e592016-10-27 18:08:27 +0300286 memcpy(tx->tx, entry->tx, entry->num_tx_props *
287 sizeof(struct ipa_ioc_tx_intf_prop));
288 result = 0;
289 break;
290 }
291 }
292 mutex_unlock(&ipa3_ctx->lock);
293
294 return result;
295}
296
297/**
298 * ipa3_query_intf_rx_props() - qeury RX props of an interface
299 * @rx: [inout] interface rx attributes
300 *
301 * Obtain the rx properties for the specified interface
302 *
303 * Returns: 0 on success, negative on failure
304 *
305 * Note: Should not be called from atomic context
306 */
307int ipa3_query_intf_rx_props(struct ipa_ioc_query_intf_rx_props *rx)
308{
309 struct ipa3_intf *entry;
310 int result = -EINVAL;
311
312 if (rx == NULL) {
313 IPAERR("invalid param rx=%p\n", rx);
314 return result;
315 }
316
317 if (strnlen(rx->name, IPA_RESOURCE_NAME_MAX) == IPA_RESOURCE_NAME_MAX) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +0530318 IPAERR_RL("Interface name too long. (%s)\n", rx->name);
Amir Levy9659e592016-10-27 18:08:27 +0300319 return result;
320 }
321
322 mutex_lock(&ipa3_ctx->lock);
323 list_for_each_entry(entry, &ipa3_ctx->intf_list, link) {
324 if (!strcmp(entry->name, rx->name)) {
Skylar Chang1b598102017-03-01 16:08:27 -0800325 /* add the entry check */
326 if (entry->num_rx_props != rx->num_rx_props) {
327 IPAERR("invalid entry number(%u %u)\n",
328 entry->num_rx_props,
329 rx->num_rx_props);
330 mutex_unlock(&ipa3_ctx->lock);
331 return result;
332 }
Amir Levy9659e592016-10-27 18:08:27 +0300333 memcpy(rx->rx, entry->rx, entry->num_rx_props *
334 sizeof(struct ipa_ioc_rx_intf_prop));
335 result = 0;
336 break;
337 }
338 }
339 mutex_unlock(&ipa3_ctx->lock);
340
341 return result;
342}
343
344/**
345 * ipa3_query_intf_ext_props() - qeury EXT props of an interface
346 * @ext: [inout] interface ext attributes
347 *
348 * Obtain the ext properties for the specified interface
349 *
350 * Returns: 0 on success, negative on failure
351 *
352 * Note: Should not be called from atomic context
353 */
354int ipa3_query_intf_ext_props(struct ipa_ioc_query_intf_ext_props *ext)
355{
356 struct ipa3_intf *entry;
357 int result = -EINVAL;
358
359 if (ext == NULL) {
360 IPAERR("invalid param ext=%p\n", ext);
361 return result;
362 }
363
364 mutex_lock(&ipa3_ctx->lock);
365 list_for_each_entry(entry, &ipa3_ctx->intf_list, link) {
366 if (!strcmp(entry->name, ext->name)) {
Skylar Chang1b598102017-03-01 16:08:27 -0800367 /* add the entry check */
368 if (entry->num_ext_props != ext->num_ext_props) {
369 IPAERR("invalid entry number(%u %u)\n",
370 entry->num_ext_props,
371 ext->num_ext_props);
372 mutex_unlock(&ipa3_ctx->lock);
373 return result;
374 }
Amir Levy9659e592016-10-27 18:08:27 +0300375 memcpy(ext->ext, entry->ext, entry->num_ext_props *
376 sizeof(struct ipa_ioc_ext_intf_prop));
377 result = 0;
378 break;
379 }
380 }
381 mutex_unlock(&ipa3_ctx->lock);
382 return result;
383}
384
Gidon Studinski3021a6f2016-11-10 12:48:48 +0200385static void ipa3_send_msg_free(void *buff, u32 len, u32 type)
386{
387 kfree(buff);
388}
389
Amir Levy9659e592016-10-27 18:08:27 +0300390/**
391 * ipa3_send_msg() - Send "message" from kernel client to IPA driver
392 * @meta: [in] message meta-data
393 * @buff: [in] the payload for message
394 * @callback: [in] free callback
395 *
396 * Client supplies the message meta-data and payload which IPA driver buffers
397 * till read by user-space. After read from user space IPA driver invokes the
398 * callback supplied to free the message payload. Client must not touch/free
399 * the message payload after calling this API.
400 *
401 * Returns: 0 on success, negative on failure
402 *
403 * Note: Should not be called from atomic context
404 */
405int ipa3_send_msg(struct ipa_msg_meta *meta, void *buff,
406 ipa_msg_free_fn callback)
407{
408 struct ipa3_push_msg *msg;
Gidon Studinski3021a6f2016-11-10 12:48:48 +0200409 void *data = NULL;
Amir Levy9659e592016-10-27 18:08:27 +0300410
411 if (meta == NULL || (buff == NULL && callback != NULL) ||
412 (buff != NULL && callback == NULL)) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +0530413 IPAERR_RL("invalid param meta=%p buff=%p, callback=%p\n",
Amir Levy9659e592016-10-27 18:08:27 +0300414 meta, buff, callback);
415 return -EINVAL;
416 }
417
418 if (meta->msg_type >= IPA_EVENT_MAX_NUM) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +0530419 IPAERR_RL("unsupported message type %d\n", meta->msg_type);
Amir Levy9659e592016-10-27 18:08:27 +0300420 return -EINVAL;
421 }
422
423 msg = kzalloc(sizeof(struct ipa3_push_msg), GFP_KERNEL);
424 if (msg == NULL) {
425 IPAERR("fail to alloc ipa_msg container\n");
426 return -ENOMEM;
427 }
428
429 msg->meta = *meta;
Gidon Studinski3021a6f2016-11-10 12:48:48 +0200430 if (meta->msg_len > 0 && buff) {
431 data = kmalloc(meta->msg_len, GFP_KERNEL);
432 if (data == NULL) {
433 IPAERR("fail to alloc data container\n");
434 kfree(msg);
435 return -ENOMEM;
436 }
437 memcpy(data, buff, meta->msg_len);
438 msg->buff = data;
439 msg->callback = ipa3_send_msg_free;
440 }
Amir Levy9659e592016-10-27 18:08:27 +0300441
442 mutex_lock(&ipa3_ctx->msg_lock);
443 list_add_tail(&msg->link, &ipa3_ctx->msg_list);
444 mutex_unlock(&ipa3_ctx->msg_lock);
445 IPA_STATS_INC_CNT(ipa3_ctx->stats.msg_w[meta->msg_type]);
446
447 wake_up(&ipa3_ctx->msg_waitq);
Gidon Studinski3021a6f2016-11-10 12:48:48 +0200448 if (buff)
449 callback(buff, meta->msg_len, meta->msg_type);
Amir Levy9659e592016-10-27 18:08:27 +0300450
451 return 0;
452}
453
454/**
455 * ipa3_register_pull_msg() - register pull message type
456 * @meta: [in] message meta-data
457 * @callback: [in] pull callback
458 *
459 * Register message callback by kernel client with IPA driver for IPA driver to
460 * pull message on-demand.
461 *
462 * Returns: 0 on success, negative on failure
463 *
464 * Note: Should not be called from atomic context
465 */
466int ipa3_register_pull_msg(struct ipa_msg_meta *meta, ipa_msg_pull_fn callback)
467{
468 struct ipa3_pull_msg *msg;
469
470 if (meta == NULL || callback == NULL) {
471 IPAERR("invalid param meta=%p callback=%p\n", meta, callback);
472 return -EINVAL;
473 }
474
475 msg = kzalloc(sizeof(struct ipa3_pull_msg), GFP_KERNEL);
476 if (msg == NULL) {
477 IPAERR("fail to alloc ipa_msg container\n");
478 return -ENOMEM;
479 }
480
481 msg->meta = *meta;
482 msg->callback = callback;
483
484 mutex_lock(&ipa3_ctx->msg_lock);
485 list_add_tail(&msg->link, &ipa3_ctx->pull_msg_list);
486 mutex_unlock(&ipa3_ctx->msg_lock);
487
488 return 0;
489}
490
491/**
492 * ipa3_deregister_pull_msg() - De-register pull message type
493 * @meta: [in] message meta-data
494 *
495 * De-register "message" by kernel client from IPA driver
496 *
497 * Returns: 0 on success, negative on failure
498 *
499 * Note: Should not be called from atomic context
500 */
501int ipa3_deregister_pull_msg(struct ipa_msg_meta *meta)
502{
503 struct ipa3_pull_msg *entry;
504 struct ipa3_pull_msg *next;
505 int result = -EINVAL;
506
507 if (meta == NULL) {
508 IPAERR("invalid param name=%p\n", meta);
509 return result;
510 }
511
512 mutex_lock(&ipa3_ctx->msg_lock);
513 list_for_each_entry_safe(entry, next, &ipa3_ctx->pull_msg_list, link) {
514 if (entry->meta.msg_len == meta->msg_len &&
515 entry->meta.msg_type == meta->msg_type) {
516 list_del(&entry->link);
517 kfree(entry);
518 result = 0;
519 break;
520 }
521 }
522 mutex_unlock(&ipa3_ctx->msg_lock);
523 return result;
524}
525
526/**
527 * ipa3_read() - read message from IPA device
528 * @filp: [in] file pointer
529 * @buf: [out] buffer to read into
530 * @count: [in] size of above buffer
531 * @f_pos: [inout] file position
532 *
533 * Uer-space should continually read from /dev/ipa, read wll block when there
534 * are no messages to read. Upon return, user-space should read the ipa_msg_meta
535 * from the start of the buffer to know what type of message was read and its
536 * length in the remainder of the buffer. Buffer supplied must be big enough to
537 * hold the message meta-data and the largest defined message type
538 *
539 * Returns: how many bytes copied to buffer
540 *
541 * Note: Should not be called from atomic context
542 */
543ssize_t ipa3_read(struct file *filp, char __user *buf, size_t count,
544 loff_t *f_pos)
545{
546 char __user *start;
547 struct ipa3_push_msg *msg = NULL;
548 int ret;
Mohammed Javid60d8d0a2017-06-29 11:35:19 +0530549 DEFINE_WAIT_FUNC(wait, woken_wake_function);
Amir Levy9659e592016-10-27 18:08:27 +0300550 int locked;
551
552 start = buf;
553
Mohammed Javid60d8d0a2017-06-29 11:35:19 +0530554 add_wait_queue(&ipa3_ctx->msg_waitq, &wait);
Amir Levy9659e592016-10-27 18:08:27 +0300555 while (1) {
Gidon Studinski3021a6f2016-11-10 12:48:48 +0200556 mutex_lock(&ipa3_ctx->msg_lock);
557 locked = 1;
Amir Levy9659e592016-10-27 18:08:27 +0300558
Amir Levy9659e592016-10-27 18:08:27 +0300559 if (!list_empty(&ipa3_ctx->msg_list)) {
560 msg = list_first_entry(&ipa3_ctx->msg_list,
561 struct ipa3_push_msg, link);
562 list_del(&msg->link);
563 }
564
565 IPADBG_LOW("msg=%p\n", msg);
566
567 if (msg) {
568 locked = 0;
569 mutex_unlock(&ipa3_ctx->msg_lock);
570 if (copy_to_user(buf, &msg->meta,
571 sizeof(struct ipa_msg_meta))) {
572 ret = -EFAULT;
Utkarsh Saxena96194882017-04-03 13:21:58 +0530573 kfree(msg);
574 msg = NULL;
Amir Levy9659e592016-10-27 18:08:27 +0300575 break;
576 }
577 buf += sizeof(struct ipa_msg_meta);
578 count -= sizeof(struct ipa_msg_meta);
579 if (msg->buff) {
580 if (copy_to_user(buf, msg->buff,
581 msg->meta.msg_len)) {
582 ret = -EFAULT;
Utkarsh Saxena96194882017-04-03 13:21:58 +0530583 kfree(msg);
584 msg = NULL;
Amir Levy9659e592016-10-27 18:08:27 +0300585 break;
586 }
587 buf += msg->meta.msg_len;
588 count -= msg->meta.msg_len;
589 msg->callback(msg->buff, msg->meta.msg_len,
590 msg->meta.msg_type);
591 }
592 IPA_STATS_INC_CNT(
593 ipa3_ctx->stats.msg_r[msg->meta.msg_type]);
594 kfree(msg);
595 }
596
597 ret = -EAGAIN;
598 if (filp->f_flags & O_NONBLOCK)
599 break;
600
601 ret = -EINTR;
602 if (signal_pending(current))
603 break;
604
605 if (start != buf)
606 break;
607
608 locked = 0;
609 mutex_unlock(&ipa3_ctx->msg_lock);
Mohammed Javid60d8d0a2017-06-29 11:35:19 +0530610 wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
Amir Levy9659e592016-10-27 18:08:27 +0300611 }
612
Mohammed Javid60d8d0a2017-06-29 11:35:19 +0530613 remove_wait_queue(&ipa3_ctx->msg_waitq, &wait);
Amir Levy9659e592016-10-27 18:08:27 +0300614 if (start != buf && ret != -EFAULT)
615 ret = buf - start;
616
617 if (locked)
618 mutex_unlock(&ipa3_ctx->msg_lock);
619
620 return ret;
621}
622
623/**
624 * ipa3_pull_msg() - pull the specified message from client
625 * @meta: [in] message meta-data
626 * @buf: [out] buffer to read into
627 * @count: [in] size of above buffer
628 *
629 * Populate the supplied buffer with the pull message which is fetched
630 * from client, the message must have previously been registered with
631 * the IPA driver
632 *
633 * Returns: how many bytes copied to buffer
634 *
635 * Note: Should not be called from atomic context
636 */
637int ipa3_pull_msg(struct ipa_msg_meta *meta, char *buff, size_t count)
638{
639 struct ipa3_pull_msg *entry;
640 int result = -EINVAL;
641
642 if (meta == NULL || buff == NULL || !count) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +0530643 IPAERR_RL("invalid param name=%p buff=%p count=%zu\n",
Amir Levy9659e592016-10-27 18:08:27 +0300644 meta, buff, count);
645 return result;
646 }
647
648 mutex_lock(&ipa3_ctx->msg_lock);
649 list_for_each_entry(entry, &ipa3_ctx->pull_msg_list, link) {
650 if (entry->meta.msg_len == meta->msg_len &&
651 entry->meta.msg_type == meta->msg_type) {
652 result = entry->callback(buff, count, meta->msg_type);
653 break;
654 }
655 }
656 mutex_unlock(&ipa3_ctx->msg_lock);
657 return result;
658}