From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752341AbcBUVqF (ORCPT ); Sun, 21 Feb 2016 16:46:05 -0500 Received: from mail.tnode.com ([46.54.226.45]:42959 "EHLO mail.tnode.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbcBUVp7 (ORCPT ); Sun, 21 Feb 2016 16:45:59 -0500 From: Andrej Krpic To: linux-kernel@vger.kernel.org Cc: jslaby@suse.com, gregkh@linuxfoundation.org, Andrej Krpic 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 Message-Id: <1456090717-19913-9-git-send-email-ak77@tnode.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456090717-19913-1-git-send-email-ak77@tnode.com> References: <1456090717-19913-1-git-send-email-ak77@tnode.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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