From: Andrej Krpic <ak77@tnode.com>
To: linux-kernel@vger.kernel.org
Cc: jslaby@suse.com, gregkh@linuxfoundation.org,
Andrej Krpic <ak77@tnode.com>
Subject: [PATCH 8/8] tty: n_gsm: Enable reception of frames separated with a single SOF marker
Date: Sun, 21 Feb 2016 22:38:37 +0100 [thread overview]
Message-ID: <1456090717-19913-9-git-send-email-ak77@tnode.com> (raw)
In-Reply-To: <1456090717-19913-1-git-send-email-ak77@tnode.com>
Frames may be separated with a single SOF (5.2.6.1 of 27.010 mux spec).
While transmission of a single SOF between frames is implemented in
gsm_data_kick, the reception isn't.
As a side effect, it is now possible to receive and ignore a stream of
consecutive SOFs (5.2.5 of 27.010 mux spec).
Signed-off-by: Andrej Krpic <ak77@tnode.com>
---
drivers/tty/n_gsm.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index b0d9edd..12b149d 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1895,9 +1895,14 @@ static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)
}
break;
case GSM_ADDRESS: /* Address EA */
- gsm->fcs = gsm_fcs_add(gsm->fcs, c);
+ /* Ignore (not first) GSM0_SOF as it decodes into
+ * reserved DLCI 62 (5.6 of the 27.010 mux spec).
+ */
+ if (c == GSM0_SOF)
+ break;
if (gsm_read_ea(&gsm->address, c))
gsm->state = GSM_CONTROL;
+ gsm->fcs = gsm_fcs_add(gsm->fcs, c);
break;
case GSM_CONTROL: /* Control Byte */
gsm->fcs = gsm_fcs_add(gsm->fcs, c);
@@ -1944,13 +1949,10 @@ static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)
case GSM_FCS: /* FCS follows the packet */
gsm->received_fcs = c;
gsm_queue(gsm);
- gsm->state = GSM_SSOF;
- break;
- case GSM_SSOF:
- if (c == GSM0_SOF) {
- gsm->state = GSM_SEARCH;
- break;
- }
+ /* Frames can be separated with a single GSM0_SOF.
+ * Deal with consecutive GSM0_SOFs in GSM_ADDRESS.
+ */
+ gsm->state = GSM_SEARCH;
break;
}
}
--
2.7.0
next prev parent reply other threads:[~2016-02-21 21:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-21 21:38 [PATCH 0/8] tty: n_gsm: Make mux work as a responder station Andrej Krpic
2016-02-21 21:38 ` [PATCH 1/8] tty: n_gsm: fix formatting errors Andrej Krpic
2016-02-21 22:30 ` Joe Perches
2016-02-23 0:37 ` Andrej Krpic
2016-02-21 21:38 ` [PATCH 2/8] tty: n_gsm: fix C/R bit when sending as a responder Andrej Krpic
2016-02-21 21:38 ` [PATCH 3/8] tty: n_gsm: make mux work as a responder station Andrej Krpic
2016-02-21 21:38 ` [PATCH 4/8] tty: n_gsm: send DM response when accessing an invalid channel Andrej Krpic
2016-02-21 21:38 ` [PATCH 5/8] tty: n_gsm: replace dead code with a meaningful comment Andrej Krpic
2016-02-21 21:38 ` [PATCH 6/8] tty: n_gsm: add missing length field in control channel commands Andrej Krpic
2016-02-21 21:38 ` [PATCH 7/8] tty: n_gsm: properly format Modem Status Command message Andrej Krpic
2016-02-21 21:38 ` Andrej Krpic [this message]
2016-02-21 23:42 ` [PATCH 0/8] tty: n_gsm: Make mux work as a responder station One Thousand Gnomes
2016-02-23 0:28 ` Andrej Krpic
-- strict thread matches above, loose matches on Subject: below --
2016-02-22 22:53 Andrej Krpic
2016-02-22 22:53 ` [PATCH 8/8] tty: n_gsm: Enable reception of frames separated with a single SOF marker Andrej Krpic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456090717-19913-9-git-send-email-ak77@tnode.com \
--to=ak77@tnode.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).