From patchwork Wed Apr 26 08:03:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 87714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp80662vqo; Wed, 26 Apr 2023 01:12:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7eqiodFFKFHkViABGYndNfVjGQLLmrL6PYTZtTh09IpD1xYEa9fHnpg7QdICCULf62LpSV X-Received: by 2002:a17:903:244f:b0:1a6:98a4:e941 with SMTP id l15-20020a170903244f00b001a698a4e941mr2200109pls.2.1682496746621; Wed, 26 Apr 2023 01:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682496746; cv=none; d=google.com; s=arc-20160816; b=LGPtIcB+rue126CgDNhhbxNm6DZxCrpcjV/TIgLVpWh0cfNs/AuRJrI+R/Iw4nbA1C LNiGlKfQmtlXXW3SDjmEE54K73xIBC8nvp2R4SltRcMuwkJZPP2FmmtzdXzVZfnjEk3Y EAFavCAIARmeRwSa6kPuYFEf8SnOFMIckKmEMrj596Pv7F8f0Um6vbEiMv+XstBVllQ9 qDcLrukdm4W+VHfUbVAdGdxpewfxtW+n5dsp0oLuwDzKm5ebiGCqBp5oRi1ke/kY6S0r 5ujI3pFSczJv4EbOsfPxkE7hlxAjDyDRH2hL7Lstat5Rks5hGetUoEeuOHcAhNvJragM kDww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=saTOVTX775J8QuM0f3QiYXo+gF2XB4EnX95vsbsYgmg=; b=Nz/bHP19liTx8IubzP73sPkeSAcS8AZL9Z4ajLJXqAB8kuOlf+I30D0/xL96YCnpdh JyVDkg2GX/aAnmQsjUw1DodGv9HfPY0r1yZuHQJF7uSG1iMYVXa+5ZdX11mtNx561fVl WVjgOIodNzhyAqfxwKF93x4JnKdgvihp/f7hEjj8fHyAFfViMLPeubGv0sMoCMMyWSWt bqyhdmxKCoYSpZP2Z3pzDl1lhMt/35dX4KPTMFICSq6ZOF9dXz2VKNRlJ011AnzYmdnL a4ZsCk97/Iii0K4wve6e4uHSQYHDhYBMgG04Q9+vEIcDU0+GC7C3YiRtJLp6lLzIHmyl rRUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=H4A9kP5Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t6-20020a170902e84600b001a66c501a46si17278178plg.136.2023.04.26.01.12.11; Wed, 26 Apr 2023 01:12:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=H4A9kP5Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239987AbjDZIDy (ORCPT + 99 others); Wed, 26 Apr 2023 04:03:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239962AbjDZIDh (ORCPT ); Wed, 26 Apr 2023 04:03:37 -0400 Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1196CDC for ; Wed, 26 Apr 2023 01:03:34 -0700 (PDT) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 20230426080332c5d2d6dab017c90b88 for ; Wed, 26 Apr 2023 10:03:32 +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=saTOVTX775J8QuM0f3QiYXo+gF2XB4EnX95vsbsYgmg=; b=H4A9kP5YhkfD+yrRnUdwwGuDj+lWE7tRshaKZLg3c2yOrbUb7TVnK6QQZHQmcYUNMgbaBN TDTWPD4BcK+9YqPawXyq4EtNO7s13h1TPu9TIuHvMrp4jX86gjUE+V7pVLGyT7kFodwJLUdd aOYfaHspkuG36aDzD02WLeeGbF3WQ=; 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 v4 6/8] tty: n_gsm: increase gsm_mux unsupported counted where appropriate Date: Wed, 26 Apr 2023 10:03:13 +0200 Message-Id: <20230426080315.7595-6-daniel.starke@siemens.com> In-Reply-To: <20230426080315.7595-1-daniel.starke@siemens.com> References: <20230426080315.7595-1-daniel.starke@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-314044:519-21489:flowmailer X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764225708464304933?= X-GMAIL-MSGID: =?utf-8?q?1764225708464304933?= 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(+) v3 -> v4: No changes. Link: https://lore.kernel.org/all/20230424075251.5216-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;