Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2384470rwd; Wed, 17 May 2023 09:13:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ58uBdG+xcIzWHX1yZi/+n2mrOxxWVmvkyJ6bvIaDL/z7CMLvZQiT/CjB4yKBm/zBj641z3 X-Received: by 2002:a17:902:d505:b0:1ab:1351:979e with SMTP id b5-20020a170902d50500b001ab1351979emr52349145plg.10.1684339987612; Wed, 17 May 2023 09:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684339987; cv=none; d=google.com; s=arc-20160816; b=qIJUEzQxSAaBLITInRvV8bg5K20a2+dp5H8xT6XXHofGOqKgq+IzBf6NMXKzEzI7Rn aKYLDgF+KQ8OmA8mJklopr/DF2AkrwTGVA2thGcoildZ1L+q9B7qcG1dv/PEqCB4NIS4 pgP4iZOExNfDhFBpJEc9exhU+g1wJ6DUXpC/h6D2zAmWxM2yWfe+8deL7k1sSpfggFUC rHZHecf5kyH9+cf+TZgPBOCKOkjM3MsYb94j9RFfJmfwMH5asXugBQ/tyNsa3tJtYYGW nzBsHpJCVqQ1aQZH35a14tQrMCjxbvcXXTPdEJmm9mVyfHAm2yvfVaZnnsiKKt2jtiaJ TQ5w== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=myO+P8WOEjna9leIj0Mi2o9ZV1FzreaUuCy/6birCxg=; b=HRr1Ib1OHKxYYbZh7eiOAtzwucAvaShAACNaLG6fuX/Dfm4Mr/pOTmAXZvgWtBhSFA Jp7RTv2nB0JM/KGDlvuyl8dQFOxW0KnSTXiRdn66ZtKCvABDK/0m1Qu1Q5pcf/v5HQuU 1OO6g/IA3UdADzF7plplVpnQZfxBEHMH/fW22AI3P4DrwIiqpz8IcMJkYm4GLRDgSmoF hkXRkv/PLU4HNLppAFx94ReFPefz0LnxAShOQw9XE+mDdiNU/lCQsCtfIPc8yZAup+ph s6/lfBzWu+nJ5UjCcLG9aFgAtDCCZ5bAy4GtappcbknijYARBRyeZ38oGcrnhNzdEtg2 dvnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=h3OcECnT; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020a170903234f00b001a9baadecc0si21875490plh.160.2023.05.17.09.12.55; Wed, 17 May 2023 09:13:07 -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=h3OcECnT; 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 S231644AbjEQP6n (ORCPT + 99 others); Wed, 17 May 2023 11:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231238AbjEQP6f (ORCPT ); Wed, 17 May 2023 11:58:35 -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 B34F230FD for ; Wed, 17 May 2023 08:58:29 -0700 (PDT) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 202305171558264d7acbcc892648136f for ; Wed, 17 May 2023 17:58:26 +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; bh=myO+P8WOEjna9leIj0Mi2o9ZV1FzreaUuCy/6birCxg=; b=h3OcECnT2RGiwr8E/X3Favf64LAC/N6yEQ2xq/npJpR5AyqhgZAu5fG3ZH8xpYBRo1jNlM 747whGj63viyftONRAziDSdytMJNK+SJ97KtC6j0dQs9hSv+u9HPd5bHvzk/BRBO+pwWYQT7 I3eOpTDThIN85c2OlwXNn5ZV4fx+E=; 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 01/10] tty: n_gsm: add restart flag to DLC specific ioctl config Date: Wed, 17 May 2023 17:56:55 +0200 Message-Id: <20230517155704.5701-1-daniel.starke@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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=unavailable 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 From: Daniel Starke Currently, changing the parameters of a DLCI gives no direct control to the user whether this should trigger a channel reset or not. The decision is solely made by the driver based on the assumption which parameter changes are compatible or not. Therefore, the user has no means to perform an automatic channel reset after parameter configuration for non-conflicting changes. Add the parameter 'flags' to 'gsm_dlci_config' to force a channel reset after ioctl setting regardless of whether the changes made require this or not by setting this to 'GSM_FL_RESTART'. Note that 'GSM_FL_RESTART' is currently the only allow flag to allow additions here. Signed-off-by: Daniel Starke --- drivers/tty/n_gsm.c | 4 ++++ include/uapi/linux/gsmmux.h | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) v4 -> v5: Changed GSM_FL_RESTART comment to be more specific about its use as suggested in the review comment. 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/DB9PR10MB5881B63FBBA7912DF5A7A6A8E0789@DB9PR10MB5881.EURPRD10.PROD.OUTLOOK.COM/ diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index b411a26cc092..66edcf65a4dd 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2532,6 +2532,8 @@ static int gsm_dlci_config(struct gsm_dlci *dlci, struct gsm_dlci_config *dc, in return -EINVAL; if (dc->k > 7) return -EINVAL; + if (dc->flags & ~GSM_FL_RESTART) /* allow future extensions */ + return -EINVAL; /* * See what is needed for reconfiguration @@ -2546,6 +2548,8 @@ static int gsm_dlci_config(struct gsm_dlci *dlci, struct gsm_dlci_config *dc, in /* Requires care */ if (dc->priority != dlci->prio) need_restart = true; + if (dc->flags & GSM_FL_RESTART) + need_restart = true; if ((open && gsm->wait_config) || need_restart) need_open = true; diff --git a/include/uapi/linux/gsmmux.h b/include/uapi/linux/gsmmux.h index eb67884e5f38..e56e2d7ea6eb 100644 --- a/include/uapi/linux/gsmmux.h +++ b/include/uapi/linux/gsmmux.h @@ -2,10 +2,22 @@ #ifndef _LINUX_GSMMUX_H #define _LINUX_GSMMUX_H +#include #include #include #include +/* + * flags definition for n_gsm + * + * Used by: + * struct gsm_dlci_config.flags + */ +/* Forces a DLCI reset if set. Otherwise, a DLCI reset is only done if + * incompatible settings were provided. Always cleared on retrieval. + */ +#define GSM_FL_RESTART _BITUL(0) + struct gsm_config { unsigned int adaption; @@ -58,7 +70,8 @@ struct gsm_dlci_config { __u32 priority; /* Priority (0 for default value) */ __u32 i; /* Frame type (1 = UIH, 2 = UI) */ __u32 k; /* Window size (0 for default value) */ - __u32 reserved[8]; /* For future use, must be initialized to zero */ + __u32 flags; /* DLCI specific flags. */ + __u32 reserved[7]; /* For future use, must be initialized to zero */ }; #define GSMIOC_GETCONF_DLCI _IOWR('G', 7, struct gsm_dlci_config) -- 2.34.1