From patchwork Wed May 17 15:57:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 683874 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 06A65C77B7F for ; Wed, 17 May 2023 15:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232037AbjEQP7A (ORCPT ); Wed, 17 May 2023 11:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231894AbjEQP6y (ORCPT ); Wed, 17 May 2023 11:58:54 -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 B0E627DAA for ; Wed, 17 May 2023 08:58:31 -0700 (PDT) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 202305171558295a5879b3ee6acdab54 for ; Wed, 17 May 2023 17:58:29 +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=ZT7+g7B3Lbu99drej4ZddyowwBxP0nuUx4VS88186Es=; b=OTmSarLUw0pA6xy7u7l5FKpEmDX8pQVAYcMCiPvj+Ym0KglLFhEbIYSI5nHazJw1MZDMwZ 0rRkoy2A9ftyynVqELLWBaJVUfAg+ithhLgwK91W35/0K1Q3c6vcyTUp1CSWL5MQ09Pmgykr MdNtXdpV6aK7mbTefE9a9Yk+KauzU=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com, felix-haase@siemens.com Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH v5 06/10] tty: n_gsm: increase gsm_mux unsupported counted where appropriate Date: Wed, 17 May 2023 17:57:00 +0200 Message-Id: <20230517155704.5701-6-daniel.starke@siemens.com> In-Reply-To: <20230517155704.5701-1-daniel.starke@siemens.com> References: <20230517155704.5701-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 The structure gsm_mux contains the 'unsupported' field. However, there is currently no place in the code which increases this counter. Increase the 'unsupported' statistics counter in the following case: - an unsupported frame type has been requested by the peer via parameter negotiation - a control frame with an unsupported but known command has been received Note that we have no means to detect an inconsistent/unsupported adaptation sufficient accuracy as this changes the structure of the UI/UIH frames. E.g. a one byte header is added in case of convergence layer type 2 instead of 1 and contains the modem signal octet with the state of the signal lines. There is no checksum or other value which indicates of this field is correct or should be present. Therefore, we can only assume protocol correctness here. See also 'gsm_dlci_data()' where this is handled. Signed-off-by: Daniel Starke --- drivers/tty/n_gsm.c | 3 +++ 1 file changed, 3 insertions(+) v4 -> v5: No changes. Please note that I cannot response to emails until August 7th. Felix Haase will take over from our side for questions regarding this patch series or the n_gsm. Link: https://lore.kernel.org/all/20230426080315.7595-6-daniel.starke@siemens.com/ diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 5b6a03668c78..42a8507aae4a 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1590,6 +1590,7 @@ static int gsm_process_negotiation(struct gsm_mux *gsm, unsigned int addr, if (debug & DBG_ERRORS) pr_info("%s unsupported I frame request in PN\n", __func__); + gsm->unsupported++; return -EINVAL; default: if (debug & DBG_ERRORS) @@ -1897,6 +1898,8 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, /* Optional unsupported commands */ case CMD_RPN: /* Remote port negotiation */ case CMD_SNC: /* Service negotiation command */ + gsm->unsupported++; + fallthrough; default: /* Reply to bad commands with an NSC */ buf[0] = command;