From patchwork Mon Jan 25 15:22:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Palmas X-Patchwork-Id: 371110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85470C43332 for ; Tue, 26 Jan 2021 19:32:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6250323110 for ; Tue, 26 Jan 2021 19:32:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388379AbhAZFnT (ORCPT ); Tue, 26 Jan 2021 00:43:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730009AbhAYPgH (ORCPT ); Mon, 25 Jan 2021 10:36:07 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18BB9C061225; Mon, 25 Jan 2021 07:23:10 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id u14so11435554wmq.4; Mon, 25 Jan 2021 07:23:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bonaNtQOYdal1eJtZWnTWz1u25uAbcWM2s+Tk4ODo6o=; b=nDw4+r+GuwRJX5fPNU4BcC6ZlTzTTY4EI2/3gSnuZZpYf8l12Ql+FFL/MOn+Gngf5R xz0Skd06kxpS+pwljFitrBrZ+8E11D5GeQl9MbQIO4u23DF/f6XwPK0raexzxwDhi+sw GsHLw4PfVRHWMA7RuJzi70Rg4GEefl/2egTZp9XqPqbC4UPZ7Ewo0pCoNZ55TLy7yUuV xtb202eOC2FP5z+7UYsf4K41T9fmeOvleuCZrTHRAQZDMldoH2CzU1/o92M5Xo+QULOA ynvxmaK4aSfjStoyeyqIsTxJcwAmWTbRc4TUD3FkNA+DzlnZF2od3XMlwtoByDNypQm5 o/tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bonaNtQOYdal1eJtZWnTWz1u25uAbcWM2s+Tk4ODo6o=; b=NOmr9aC2pnpIBAic8wvKtuic4NOnrkQ4ceA94F95v/taJJighV3o0HgwL9BuhdAq6M EPfgjcc9Zr08qBuBKmTT7cTc+BREmjznfwArSzZOxPDpCi013ZKrBXBnkNNDOkcTvj90 nE7wZOL5vc3WKQXki9xArBIz2z3NNO/Nhq0ny9zsvhj4hozykFdgvyut7X26kN5Ib4o3 xhUHieqosCcggw0UHg+EdkiOUBU2XqThK14XOfETmOIEHyh7lW7VS8SLexJBu8wtLfES PjaImxJ0B0GhKs9A/7cB73Fc/6PosnsTzb+jjjPDdVPSRFnloyzLek9dcqIySq1pvfwK mbAQ== X-Gm-Message-State: AOAM532bDcmt+u6W9B77BjKTEdywwQxynjDZ7qbXLOPApPcI14CzYVWP yE5DDQ67kJVlAm7ndCEcgcQ= X-Google-Smtp-Source: ABdhPJzDzziMZ3RQVf8GVDCFp9muT3RhPjTIECOGJiaXXW9bFFUnZMnwjH16axbS8S/sVTkrQmacfw== X-Received: by 2002:a1c:6709:: with SMTP id b9mr623368wmc.102.1611588188781; Mon, 25 Jan 2021 07:23:08 -0800 (PST) Received: from LABNL-ITC-SW01.tmt.telital.com (static-82-85-31-68.clienti.tiscali.it. [82.85.31.68]) by smtp.gmail.com with ESMTPSA id l84sm13071307wmf.17.2021.01.25.07.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 07:23:08 -0800 (PST) From: Daniele Palmas To: =?utf-8?q?Bj=C3=B8rn_Mork?= , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org, Aleksander Morgado , Daniele Palmas Subject: [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces Date: Mon, 25 Jan 2021 16:22:34 +0100 Message-Id: <20210125152235.2942-2-dnlplm@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210125152235.2942-1-dnlplm@gmail.com> References: <20210125152235.2942-1-dnlplm@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add qmimux interface sysfs file qmap/mux_id to show qmap id set during the interface creation, in order to provide a method for userspace to associate QMI control channels to network interfaces. Signed-off-by: Daniele Palmas Acked-by: Aleksander Morgado --- drivers/net/usb/qmi_wwan.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 7ea113f51074..9b85e2ed4760 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -218,6 +218,31 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb) return 1; } +static ssize_t mux_id_show(struct device *d, struct device_attribute *attr, char *buf) +{ + struct net_device *dev = to_net_dev(d); + struct qmimux_priv *priv; + ssize_t count = 0; + + priv = netdev_priv(dev); + count += scnprintf(&buf[count], PAGE_SIZE - count, + "0x%02x\n", priv->mux_id); + + return count; +} + +static DEVICE_ATTR_RO(mux_id); + +static struct attribute *qmi_wwan_sysfs_qmimux_attrs[] = { + &dev_attr_mux_id.attr, + NULL, +}; + +static struct attribute_group qmi_wwan_sysfs_qmimux_attr_group = { + .name = "qmap", + .attrs = qmi_wwan_sysfs_qmimux_attrs, +}; + static int qmimux_register_device(struct net_device *real_dev, u8 mux_id) { struct net_device *new_dev; @@ -240,6 +265,8 @@ static int qmimux_register_device(struct net_device *real_dev, u8 mux_id) goto out_free_newdev; } + new_dev->sysfs_groups[0] = &qmi_wwan_sysfs_qmimux_attr_group; + err = register_netdevice(new_dev); if (err < 0) goto out_free_newdev; From patchwork Mon Jan 25 15:22:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniele Palmas X-Patchwork-Id: 371119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F05E3C433DB for ; Tue, 26 Jan 2021 05:43:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C858F229C4 for ; Tue, 26 Jan 2021 05:43:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728891AbhAZFn3 (ORCPT ); Tue, 26 Jan 2021 00:43:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730006AbhAYPgH (ORCPT ); Mon, 25 Jan 2021 10:36:07 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA59EC061226; Mon, 25 Jan 2021 07:23:20 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id d16so12338230wro.11; Mon, 25 Jan 2021 07:23:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/tGkcqmhsn9CH2w55SDFq0iWv5ul//RuUKfZo0AIfJg=; b=HnHOkdT1DhgRrkY8rKkFowRSqjP4WIjbOC7Gr1OxgfxKF0C/1wqRnl1LEzemX8WDKT KjGGdJA9L0zON2nYPsLmRovk0XazESNve4EV9b+Bm/zmi5VhTdVAcPDEE+ruKrMsVny+ T/pAYsB3OqgujebXrkhiVCIEuyScUrkpFdOsBH5EVwWpLW4nruf/QO6kbOY9wBc7T0yT en0CPipnxRTh6Eq4dU2YZx2Xtcy4lPy+ZRgD+kjB4Qrrcej/T993RnIk54sm6oMeS42o a+Exro6v2ntvYrq7a2Y7yyMxB+ZmElJMuiQVz1fVTBuaLtAGb7I+Qqn9V7ojQYGrvRQd 17Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/tGkcqmhsn9CH2w55SDFq0iWv5ul//RuUKfZo0AIfJg=; b=mLqZZnNgErTFm/hHK7J0yshc6tEVpf8A2Eckf6dr36hjNi1Xq2g6O02eObZcgYU39W IaRvibN9+odaDfqMd6FlUsjVHJ3wQhVypBiwZEo8FvBnFbGzD4lXrRVV66nVkGkGjtJQ ZbIZ5rl8DL+PNdOhnQNO5cjeTZWan17BzCckXZAyhuLMVY8EnBHktSg3qYdS0ZKSm0M0 AiPclL1QGP41xWCqYUSHk2zzDUZDztbToLUpB81kne44tF/ni1T3DYiCLgnsiSbvfFNT WNSl+ypsyiYuXAdMkMYeBC1+SulyOooVBx/m+T8jNmvYRr/vO6RkzX2YqMprpGwbPx/Z 2jVQ== X-Gm-Message-State: AOAM5329oUGOq2LdvbcQUxTk6xqOw0Hkv7YMATukPVl/Q5W27Q8TnwKY GTONPPBJdtpaJwHXB1ASl+w= X-Google-Smtp-Source: ABdhPJyI02B9YvkJbG2iUp+OLQYdbcmGCYVgEgNwtD+Atj06XYHgnMluRL8L0x0CKHacE30e4DAV4Q== X-Received: by 2002:adf:e88f:: with SMTP id d15mr1556733wrm.17.1611588199706; Mon, 25 Jan 2021 07:23:19 -0800 (PST) Received: from LABNL-ITC-SW01.tmt.telital.com (static-82-85-31-68.clienti.tiscali.it. [82.85.31.68]) by smtp.gmail.com with ESMTPSA id l84sm13071307wmf.17.2021.01.25.07.23.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 07:23:19 -0800 (PST) From: Daniele Palmas To: =?utf-8?q?Bj=C3=B8rn_Mork?= , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org, Aleksander Morgado , Daniele Palmas Subject: [PATCH net-next 2/2] net: qmi_wwan: document qmap/mux_id sysfs file Date: Mon, 25 Jan 2021 16:22:35 +0100 Message-Id: <20210125152235.2942-3-dnlplm@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210125152235.2942-1-dnlplm@gmail.com> References: <20210125152235.2942-1-dnlplm@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Document qmap/mux_id sysfs file showing qmimux interface id Signed-off-by: Daniele Palmas Acked-by: Bjørn Mork --- Documentation/ABI/testing/sysfs-class-net-qmi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-net-qmi b/Documentation/ABI/testing/sysfs-class-net-qmi index c310db4ccbc2..ed79f5893421 100644 --- a/Documentation/ABI/testing/sysfs-class-net-qmi +++ b/Documentation/ABI/testing/sysfs-class-net-qmi @@ -48,3 +48,13 @@ Description: Write a number ranging from 1 to 254 to delete a previously created qmap mux based network device. + +What: /sys/class/net//qmap/mux_id +Date: January 2021 +KernelVersion: 5.12 +Contact: Daniele Palmas +Description: + Unsigned integer + + Indicates the mux id associated to the qmimux network interface + during its creation.