From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756255AbcBVWyB (ORCPT ); Mon, 22 Feb 2016 17:54:01 -0500 Received: from [46.54.226.45] ([46.54.226.45]:48857 "EHLO mail.tnode.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1756210AbcBVWx6 (ORCPT ); Mon, 22 Feb 2016 17:53:58 -0500 From: Andrej Krpic To: xinhuix.pan@intel.com Cc: linux-kernel@vger.kernel.org, jslaby@suse.com, gregkh@linuxfoundation.org, Andrej Krpic Subject: [PATCH 2/8] tty: n_gsm: fix C/R bit when sending as a responder Date: Mon, 22 Feb 2016 23:53:10 +0100 Message-Id: <1456181596-11736-3-git-send-email-ak77@tnode.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456181596-11736-1-git-send-email-ak77@tnode.com> References: <1456181596-11736-1-git-send-email-ak77@tnode.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to the specification (3GPP TS 27.010 v12.0.0 R1, 5.2.1.2), C/R bit must be the same for corresponding command and response. If mux is an initiator (station that initiates DLC 0), valid sent commands and received responses must have C/R bit set to 1. For a station that is a responder, valid sent commands and received responses must have C/R bit set to 0. Change the value of C/R bit in command and response frames to depend on whether the station is initator or not. Signed-off-by: Andrej Krpic --- drivers/tty/n_gsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index cc3b374..a0fb92c 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -622,7 +622,7 @@ static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) static inline void gsm_response(struct gsm_mux *gsm, int addr, int control) { - gsm_send(gsm, addr, 0, control); + gsm_send(gsm, addr, gsm->initiator ? 0 : 1, control); } /** @@ -636,7 +636,7 @@ static inline void gsm_response(struct gsm_mux *gsm, int addr, int control) static inline void gsm_command(struct gsm_mux *gsm, int addr, int control) { - gsm_send(gsm, addr, 1, control); + gsm_send(gsm, addr, gsm->initiator ? 1 : 0, control); } /* Data transmission */ -- 2.7.0