diff options
| author | Manoj Prabhu B <bmanoj@codeaurora.org> | 2017-03-22 11:12:52 +0530 |
|---|---|---|
| committer | Manoj Prabhu B <bmanoj@codeaurora.org> | 2017-03-25 22:02:40 +0530 |
| commit | db3fd8b4bea013b409780daf050a60a65d78010a (patch) | |
| tree | 941e4d3e980cb270cc5f3e922c5df84de01c9fbc /drivers/char/diag/diag_memorydevice.c | |
| parent | 89bfd053bfb4afb40d86f58de52cb7b1433dccba (diff) | |
diag: Add support for header untagging
This patch provides the support for segregate different PD data onto
separate buffers and then onto its own data stream based on received
diag private id header from the peripheral data packets.
This patch adds a new feature mask supporting the feature and
a new IOCTL querying the support of the feature.
CRs-Fixed: 1112307
Change-Id: Id76e718f83e09defc221f9ee169d4676d8e57d8a
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
Diffstat (limited to 'drivers/char/diag/diag_memorydevice.c')
| -rw-r--r-- | drivers/char/diag/diag_memorydevice.c | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/drivers/char/diag/diag_memorydevice.c b/drivers/char/diag/diag_memorydevice.c index c552f263d7e5..dc3029cc459d 100644 --- a/drivers/char/diag/diag_memorydevice.c +++ b/drivers/char/diag/diag_memorydevice.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -29,6 +29,7 @@ #include "diagmem.h" #include "diagfwd.h" #include "diagfwd_peripheral.h" +#include "diag_ipc_logging.h" struct diag_md_info diag_md[NUM_DIAG_MD_DEV] = { { @@ -143,9 +144,24 @@ int diag_md_write(int id, unsigned char *buf, int len, int ctx) if (!buf || len < 0) return -EINVAL; - peripheral = GET_BUF_PERIPHERAL(ctx); - if (peripheral > NUM_PERIPHERALS) - return -EINVAL; + if (driver->pd_logging_mode) { + peripheral = GET_PD_CTXT(ctx); + switch (peripheral) { + case UPD_WLAN: + break; + case DIAG_ID_MPSS: + default: + peripheral = GET_BUF_PERIPHERAL(ctx); + if (peripheral > NUM_PERIPHERALS) + return -EINVAL; + break; + } + } else { + /* Account for Apps data as well */ + peripheral = GET_BUF_PERIPHERAL(ctx); + if (peripheral > NUM_PERIPHERALS) + return -EINVAL; + } session_info = diag_md_session_get_peripheral(peripheral); if (!session_info) @@ -219,18 +235,41 @@ int diag_md_copy_to_user(char __user *buf, int *pret, size_t buf_size, uint8_t peripheral = 0; struct diag_md_session_t *session_info = NULL; + mutex_lock(&driver->diagfwd_untag_mutex); + for (i = 0; i < NUM_DIAG_MD_DEV && !err; i++) { ch = &diag_md[i]; for (j = 0; j < ch->num_tbl_entries && !err; j++) { entry = &ch->tbl[j]; if (entry->len <= 0) continue; - peripheral = GET_BUF_PERIPHERAL(entry->ctx); - /* Account for Apps data as well */ - if (peripheral > NUM_PERIPHERALS) - goto drop_data; + if (driver->pd_logging_mode) { + peripheral = GET_PD_CTXT(entry->ctx); + switch (peripheral) { + case UPD_WLAN: + break; + case DIAG_ID_MPSS: + default: + peripheral = + GET_BUF_PERIPHERAL(entry->ctx); + if (peripheral > NUM_PERIPHERALS) + goto drop_data; + break; + } + } else { + /* Account for Apps data as well */ + peripheral = GET_BUF_PERIPHERAL(entry->ctx); + if (peripheral > NUM_PERIPHERALS) + goto drop_data; + } + session_info = diag_md_session_get_peripheral(peripheral); + if (!session_info) { + mutex_unlock(&driver->diagfwd_untag_mutex); + return -EIO; + } + if (session_info && info && (session_info->pid != info->pid)) continue; @@ -303,6 +342,8 @@ drop_data: if (drain_again) chk_logging_wakeup(); + mutex_unlock(&driver->diagfwd_untag_mutex); + return err; } @@ -322,7 +363,8 @@ int diag_md_close_peripheral(int id, uint8_t peripheral) spin_lock_irqsave(&ch->lock, flags); for (i = 0; i < ch->num_tbl_entries && !found; i++) { entry = &ch->tbl[i]; - if (GET_BUF_PERIPHERAL(entry->ctx) != peripheral) + if ((GET_BUF_PERIPHERAL(entry->ctx) != peripheral) || + (GET_PD_CTXT(entry->ctx) != peripheral)) continue; found = 1; if (ch->ops && ch->ops->write_done) { |
