From patchwork Wed Apr 5 05:47:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 670738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FA7EC76188 for ; Wed, 5 Apr 2023 05:48:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236900AbjDEFsw (ORCPT ); Wed, 5 Apr 2023 01:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236897AbjDEFsp (ORCPT ); Wed, 5 Apr 2023 01:48:45 -0400 Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5D7D198C for ; Tue, 4 Apr 2023 22:48:41 -0700 (PDT) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 20230405054839202dda9e880bc61d1a for ; Wed, 05 Apr 2023 07:48:39 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=daniel.starke@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=4HQ/5t4h1V7LJfN8OsbuPnPZmtymnOtNckgYd4DfAxE=; b=T4gOJLO0EONRcJ/JhF17g7thnU5wmgZ1MRfNRjRSe8lb5VDGp8sMWH+UBGvu67yrB49PXW gk1Hyi7XvA8pCFnPFfeoWTO2CWsV0QrYazyVvzAiymXj3By/y7doeRDKQ+uzGlxq+hVDgO8f AYBP/QQs4W4/B5TigMY06Pnw9iWIk=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH 3/9] tty: n_gsm: add missing description to gsm_config Date: Wed, 5 Apr 2023 07:47:24 +0200 Message-Id: <20230405054730.3850-3-daniel.starke@siemens.com> In-Reply-To: <20230405054730.3850-1-daniel.starke@siemens.com> References: <20230405054730.3850-1-daniel.starke@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-314044:519-21489:flowmailer Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Daniel Starke Currently, all available structure fields in gsmmux.h except those for gsm_config are commented. Fix this by adding appropriate comments to the not commented fields. Signed-off-by: Daniel Starke --- include/uapi/linux/gsmmux.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/uapi/linux/gsmmux.h b/include/uapi/linux/gsmmux.h index 33ee7b857c52..422a52e184b3 100644 --- a/include/uapi/linux/gsmmux.h +++ b/include/uapi/linux/gsmmux.h @@ -8,17 +8,17 @@ struct gsm_config { - unsigned int adaption; - unsigned int encapsulation; - unsigned int initiator; - unsigned int t1; - unsigned int t2; - unsigned int t3; - unsigned int n2; - unsigned int mru; - unsigned int mtu; - unsigned int k; - unsigned int i; + unsigned int adaption; /* Convergence layer type */ + unsigned int encapsulation; /* Framing (0 = basic option, 1 = advanced option) */ + unsigned int initiator; /* Initiator or responder */ + unsigned int t1; /* Acknowledgment timer */ + unsigned int t2; /* Response timer for multiplexer control channel */ + unsigned int t3; /* Response timer for wake-up procedure */ + unsigned int n2; /* Maximum number of retransmissions */ + unsigned int mru; /* Maximum incoming frame payload size */ + unsigned int mtu; /* Maximum outgoing frame payload size */ + unsigned int k; /* Window size */ + unsigned int i; /* Frame type (1 = UIH, 2 = UI) */ unsigned int unused[8]; /* Can not be used */ }; From patchwork Wed Apr 5 05:47:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 670735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA086C7619A for ; Wed, 5 Apr 2023 05:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236939AbjDEFuU (ORCPT ); Wed, 5 Apr 2023 01:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236955AbjDEFuU (ORCPT ); Wed, 5 Apr 2023 01:50:20 -0400 X-Greylist: delayed 68 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 04 Apr 2023 22:49:50 PDT Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9712A4C25 for ; Tue, 4 Apr 2023 22:49:50 -0700 (PDT) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 2023040505484094ac806db0d5d93c04 for ; Wed, 05 Apr 2023 07:48:40 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=daniel.starke@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=Zt+CBmSJELOiEDRewmYEmnsb90fmgUF3XjBBaB7lybI=; b=ZLwSkHl7t6441wzo0AjhjdUIRi7ulepI+nyh8xze81f3d75+5vGxkGjmyK13z8/pFqDDqk nw1PzS6U3fOJzY9nKMt8MUeELtOIbXFWv7/CfzAglp4ijzSmJcbCFGDEmrFMuiudeexOxxxx 1ztS4+2ixXR+dR0il1FOln+hDKpJw=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH 5/9] tty: n_gsm: add open_error counter to gsm_mux Date: Wed, 5 Apr 2023 07:47:26 +0200 Message-Id: <20230405054730.3850-5-daniel.starke@siemens.com> In-Reply-To: <20230405054730.3850-1-daniel.starke@siemens.com> References: <20230405054730.3850-1-daniel.starke@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-314044:519-21489:flowmailer Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Daniel Starke Extend the n_gsm link statistics by a failed link open counter in preparation for an upcoming patch which will expose these. This counter is increased whenever an attempt to open the control channel failed. Signed-off-by: Daniel Starke --- drivers/tty/n_gsm.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index d42b92cbae88..9f6669686c59 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -338,6 +338,7 @@ struct gsm_mux { unsigned long bad_fcs; unsigned long malformed; unsigned long io_error; + unsigned long open_error; unsigned long bad_size; unsigned long unsupported; }; @@ -1729,25 +1730,32 @@ static void gsm_control_negotiation(struct gsm_mux *gsm, unsigned int cr, struct gsm_dlci *dlci; struct gsm_dlci_param_bits *params; - if (dlen < sizeof(struct gsm_dlci_param_bits)) + if (dlen < sizeof(struct gsm_dlci_param_bits)) { + gsm->open_error++; return; + } /* Invalid DLCI? */ params = (struct gsm_dlci_param_bits *)data; addr = FIELD_GET(PN_D_FIELD_DLCI, params->d_bits); - if (addr == 0 || addr >= NUM_DLCI || !gsm->dlci[addr]) + if (addr == 0 || addr >= NUM_DLCI || !gsm->dlci[addr]) { + gsm->open_error++; return; + } dlci = gsm->dlci[addr]; /* Too late for parameter negotiation? */ - if ((!cr && dlci->state == DLCI_OPENING) || dlci->state == DLCI_OPEN) + if ((!cr && dlci->state == DLCI_OPENING) || dlci->state == DLCI_OPEN) { + gsm->open_error++; return; + } /* Process the received parameters */ if (gsm_process_negotiation(gsm, addr, cr, params) != 0) { /* Negotiation failed. Close the link. */ if (debug & DBG_ERRORS) pr_info("%s PN failed\n", __func__); + gsm->open_error++; gsm_dlci_close(dlci); return; } @@ -1767,6 +1775,7 @@ static void gsm_control_negotiation(struct gsm_mux *gsm, unsigned int cr, } else { if (debug & DBG_ERRORS) pr_info("%s PN in invalid state\n", __func__); + gsm->open_error++; } } @@ -2220,6 +2229,7 @@ static void gsm_dlci_t1(struct timer_list *t) dlci->retries--; mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100); } else { + gsm->open_error++; gsm_dlci_begin_close(dlci); /* prevent half open link */ } break; @@ -2235,6 +2245,7 @@ static void gsm_dlci_t1(struct timer_list *t) dlci->mode = DLCI_MODE_ADM; gsm_dlci_open(dlci); } else { + gsm->open_error++; gsm_dlci_begin_close(dlci); /* prevent half open link */ } @@ -2756,12 +2767,16 @@ static void gsm_queue(struct gsm_mux *gsm) switch (gsm->control) { case SABM|PF: - if (cr == 1) + if (cr == 1) { + gsm->open_error++; goto invalid; + } if (dlci == NULL) dlci = gsm_dlci_alloc(gsm, address); - if (dlci == NULL) + if (dlci == NULL) { + gsm->open_error++; return; + } if (dlci->dead) gsm_response(gsm, address, DM|PF); else { @@ -3754,8 +3769,10 @@ static int gsmld_ioctl(struct tty_struct *tty, unsigned int cmd, dlci = gsm->dlci[dc.channel]; if (!dlci) { dlci = gsm_dlci_alloc(gsm, dc.channel); - if (!dlci) + if (!dlci) { + gsm->open_error++; return -ENOMEM; + } } gsm_dlci_copy_config_values(dlci, &dc); if (copy_to_user((void __user *)arg, &dc, sizeof(dc))) @@ -3769,8 +3786,10 @@ static int gsmld_ioctl(struct tty_struct *tty, unsigned int cmd, dlci = gsm->dlci[dc.channel]; if (!dlci) { dlci = gsm_dlci_alloc(gsm, dc.channel); - if (!dlci) + if (!dlci) { + gsm->open_error++; return -ENOMEM; + } } return gsm_dlci_config(dlci, &dc, 0); default: From patchwork Wed Apr 5 05:47:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 670736 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C217C77B70 for ; Wed, 5 Apr 2023 05:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236931AbjDEFs4 (ORCPT ); Wed, 5 Apr 2023 01:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236920AbjDEFsp (ORCPT ); Wed, 5 Apr 2023 01:48:45 -0400 Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21B4A421A for ; Tue, 4 Apr 2023 22:48:44 -0700 (PDT) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 20230405054842112fff5f2d4fe2f374 for ; Wed, 05 Apr 2023 07:48:42 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=daniel.starke@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=lIFBSLziB/EDCfodaoQXEaZEnI8/9GXyz3jkwj8YkEw=; b=pbc5yB8pE+GCO3pUf+8d5AbLtbu1Xf85ojZhCLQIgW8VcU5fGYIscrknhGJin/Cq4gbq9R uv0l5XN8o23yGO3vDwsWWvRTSbkzkUmaOIC162iNXzuuMNFW49h+g4F7YAhnvaldwUsgnvTc vrOxgFrpC59XaVSFQcglrksBjiRYs=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH 8/9] tty: n_gsm: add DLCI specific rx/tx statistics Date: Wed, 5 Apr 2023 07:47:29 +0200 Message-Id: <20230405054730.3850-8-daniel.starke@siemens.com> In-Reply-To: <20230405054730.3850-1-daniel.starke@siemens.com> References: <20230405054730.3850-1-daniel.starke@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-314044:519-21489:flowmailer Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Daniel Starke Add counters for the number of data bytes received/transmitted per DLCI in for preparation for an upcoming patch which will expose these values to the user. Signed-off-by: Daniel Starke --- drivers/tty/n_gsm.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 49cb2dbfa233..61f9825fde3c 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -185,6 +185,9 @@ struct gsm_dlci { void (*data)(struct gsm_dlci *dlci, const u8 *data, int len); void (*prev_data)(struct gsm_dlci *dlci, const u8 *data, int len); struct net_device *net; /* network interface, if created */ + /* Statistics (not currently exposed) */ + u64 tx; /* Data bytes sent on this DLCI */ + u64 rx; /* Data bytes received on this DLCI */ }; /* @@ -1215,6 +1218,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) tty_port_tty_wakeup(&dlci->port); __gsm_data_queue(dlci, msg); + dlci->tx += len; /* Bytes of data we used up */ return size; } @@ -1459,6 +1463,7 @@ static int gsm_control_command(struct gsm_mux *gsm, int cmd, const u8 *data, msg->data[1] = (dlen << 1) | EA; memcpy(msg->data + 2, data, dlen); gsm_data_queue(gsm->dlci[0], msg); + gsm->dlci[0]->tx += dlen; return 0; } @@ -1485,6 +1490,7 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, const u8 *data, msg->data[1] = (dlen << 1) | EA; memcpy(msg->data + 2, data, dlen); gsm_data_queue(gsm->dlci[0], msg); + gsm->dlci[0]->tx += dlen; } /** @@ -1849,10 +1855,13 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, const u8 *data, int clen) { u8 buf[1]; + struct gsm_dlci *dlci = gsm->dlci[0]; + + if (dlci) + dlci->rx += clen; switch (command) { case CMD_CLD: { - struct gsm_dlci *dlci = gsm->dlci[0]; /* Modem wishes to close down */ if (dlci) { dlci->dead = true; @@ -1931,6 +1940,8 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command, ctrl = gsm->pending_cmd; dlci = gsm->dlci[0]; + if (dlci) + dlci->rx += clen; command |= 1; /* Does the reply match our command */ if (ctrl != NULL && (command == ctrl->cmd || command == CMD_NSC)) { @@ -2295,6 +2306,9 @@ static void gsm_dlci_begin_open(struct gsm_dlci *dlci) need_pn = true; } + dlci->tx = 0; + dlci->rx = 0; + switch (dlci->state) { case DLCI_CLOSED: case DLCI_WAITING_CONFIG: @@ -2327,6 +2341,9 @@ static void gsm_dlci_begin_open(struct gsm_dlci *dlci) */ static void gsm_dlci_set_opening(struct gsm_dlci *dlci) { + dlci->tx = 0; + dlci->rx = 0; + switch (dlci->state) { case DLCI_CLOSED: case DLCI_WAITING_CONFIG: @@ -2346,6 +2363,9 @@ static void gsm_dlci_set_opening(struct gsm_dlci *dlci) */ static void gsm_dlci_set_wait_config(struct gsm_dlci *dlci) { + dlci->tx = 0; + dlci->rx = 0; + switch (dlci->state) { case DLCI_CLOSED: case DLCI_CLOSING: @@ -2422,6 +2442,7 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen) fallthrough; case 1: /* Line state will go via DLCI 0 controls only */ default: + dlci->rx += clen; tty_insert_flip_string(port, data, clen); tty_flip_buffer_push(port); } @@ -2782,6 +2803,7 @@ static void gsm_queue(struct gsm_mux *gsm) gsm->open_error++; return; } + dlci->rx += gsm->len; if (dlci->dead) gsm_response(gsm, address, DM|PF); else { From patchwork Wed Apr 5 05:47:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 670737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 072E9C77B6C for ; Wed, 5 Apr 2023 05:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236903AbjDEFsz (ORCPT ); Wed, 5 Apr 2023 01:48:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236906AbjDEFsp (ORCPT ); Wed, 5 Apr 2023 01:48:45 -0400 Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AECA4480 for ; Tue, 4 Apr 2023 22:48:44 -0700 (PDT) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 202304050548425e846a43d665c487d6 for ; Wed, 05 Apr 2023 07:48:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=daniel.starke@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=1GS25vop8sxUpd2Jcu2/YctKoWgcop6YP071C0g8f7A=; b=p6+pVTkhM5dHMuDtxJ+UH1KIS+NvwW2qr4P8FNd+9AGfmKO28kGyEBq5/TmDeEiWqCnu4m O5rkj9Fe9FQWAWMW5I8aqd3auG9IzOWyRyWQLJ02CZoakX90NaVvKJ51z5tgXnF2S9c99myN XIndyBEAlHk73sljUrYeW/eSiD8yo=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH 9/9] tty: n_gsm: cleanup gsm_control_command and gsm_control_reply Date: Wed, 5 Apr 2023 07:47:30 +0200 Message-Id: <20230405054730.3850-9-daniel.starke@siemens.com> In-Reply-To: <20230405054730.3850-1-daniel.starke@siemens.com> References: <20230405054730.3850-1-daniel.starke@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-314044:519-21489:flowmailer Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Daniel Starke There are multiple places in gsm_control_command and gsm_control_reply that derive the specific DLCI handle directly out of the DLCI table in gsm. Add a local variable which holds this handle and use it instead to improve code readability. Signed-off-by: Daniel Starke --- drivers/tty/n_gsm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 61f9825fde3c..87720ebc38d7 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1454,16 +1454,17 @@ static int gsm_control_command(struct gsm_mux *gsm, int cmd, const u8 *data, int dlen) { struct gsm_msg *msg; + struct gsm_dlci *dlci = gsm->dlci[0]; - msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->dlci[0]->ftype); + msg = gsm_data_alloc(gsm, 0, dlen + 2, dlci->ftype); if (msg == NULL) return -ENOMEM; msg->data[0] = (cmd << 1) | CR | EA; /* Set C/R */ msg->data[1] = (dlen << 1) | EA; memcpy(msg->data + 2, data, dlen); - gsm_data_queue(gsm->dlci[0], msg); - gsm->dlci[0]->tx += dlen; + gsm_data_queue(dlci, msg); + dlci->tx += dlen; return 0; } @@ -1482,15 +1483,16 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, const u8 *data, int dlen) { struct gsm_msg *msg; + struct gsm_dlci *dlci = gsm->dlci[0]; - msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->dlci[0]->ftype); + msg = gsm_data_alloc(gsm, 0, dlen + 2, dlci->ftype); if (msg == NULL) return; msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */ msg->data[1] = (dlen << 1) | EA; memcpy(msg->data + 2, data, dlen); - gsm_data_queue(gsm->dlci[0], msg); - gsm->dlci[0]->tx += dlen; + gsm_data_queue(dlci, msg); + dlci->tx += dlen; } /**