lkml.org 
[lkml]   [2022]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 6/6] tty: n_gsm: add debug bit for user payload
Date
From: Daniel Starke <daniel.starke@siemens.com>

A debug bit to output a complete transmission dump exists. Sometimes only
the user frames are relevant. Add an additional bit which limits the
transmission dump output to user data frames if set.

Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
---
drivers/tty/n_gsm.c | 5 +++++
1 file changed, 5 insertions(+)

Incorporated review comments from Jiri Slaby since v2:
- changed (1 << n) to BIT(n) in the debug macro definitions

Link: https://lore.kernel.org/all/1d8d0d72-a5b7-724e-a70a-71d9fd3330c4@kernel.org/

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index f8a8c4059907..6588b84eed96 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -69,6 +69,7 @@ module_param(debug, int, 0600);
#define DBG_DATA BIT(2) /* Data transmission details. */
#define DBG_ERRORS BIT(3) /* Details for fail conditions. */
#define DBG_TTY BIT(4) /* Transmission statistics for DLCI TTYs. */
+#define DBG_PAYLOAD BIT(5) /* Limits DBG_DUMP to payload frames. */

/* Defaults: these are from the specification */

@@ -598,6 +599,10 @@ static void gsm_print_packet(const char *hdr, int addr, int cr,
{
if (!(debug & DBG_DUMP))
return;
+ /* Only show user payload frames if debug & DBG_PAYLOAD */
+ if (!(debug & DBG_PAYLOAD) && addr != 0)
+ if ((control & ~PF) == UI || (control & ~PF) == UIH)
+ return;

pr_info("%s %d) %c: ", hdr, addr, "RC"[cr]);

--
2.34.1
\
 
 \ /
  Last update: 2022-08-31 09:41    [W:0.044 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site