From patchwork Thu Jun 3 04:49:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 12296065 X-Patchwork-Delegate: johannes@sipsolutions.net 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 28D28C47096 for ; Thu, 3 Jun 2021 04:50:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FD24613EE for ; Thu, 3 Jun 2021 04:50:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229786AbhFCEwE (ORCPT ); Thu, 3 Jun 2021 00:52:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbhFCEwD (ORCPT ); Thu, 3 Jun 2021 00:52:03 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49687C06174A; Wed, 2 Jun 2021 21:50:07 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id a5so6899341lfm.0; Wed, 02 Jun 2021 21:50:07 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=zqKGPh2sFHvHDPUOdf/BuenLWamDTQPRfxgjQFjdLik=; b=ICtBHhnlYLayEfFAoEECXkECT70TRWFmqt4dq4WM6UJl5dzo2g9YbRs/WmEtsrPcGQ PwVkJpSRlwjO5Q6XtXpqGIP5Dnb5tTYxEAeY5lo78JTpO3qIBiUyqJSsFtN51RvZj/XG CsNAw2Sq1F72HCZng8kueeQbflC/gdlpJAVtoKZifaJbOEF9S0Z/CsFH2sIpiZ6ZwHlm xYVHYQs6dBUJZYC0I54ZCATW/YgkYFazxx7yqcEmN/WCWKgrldmBOqRLf5tuBacAyuGw 0Lfn1n6JjFG91s/CB9j1tlYUAVxKjl02MNc/rCjzS+1rcddp6p8fwzGSDZbfkLBo+2eo Auuw== 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:mime-version:content-transfer-encoding; bh=zqKGPh2sFHvHDPUOdf/BuenLWamDTQPRfxgjQFjdLik=; b=VzspNt1zwf2FjVww8xOQiJSCf2lk98yEceXok6MYzcaDoBlGeSQG3tbFEgQ4HOkrcZ 6TXXOvyrbmdVHoYJauxJwYmTwPK2bAqlxh49l6Mx/o38wPnQT/vDcO3AKhWaTe29vTB7 fkunKYojiBbW314OuJUUc8SLQLYY4XefT57D/4wcRcWFICTTBdyp3jQTQtSWHoi0PbN4 489OShVbUWTl2W3OPQMvJhZtdYhm/G1gK2MMXmvr0puaHOhGP+Yl15a2maF4NbdLWn7B hyHuz1BYjrD26wsOZtD5MkWv9Pg/rFgS+W5UKL3m5ekPcAQmzgn7aavs2Tnk4skg1m0h 2QRg== X-Gm-Message-State: AOAM533+tiHEIvu0Q2KGurJRQkYWGmwz5UVrSxNS5GlaCYogx/LabcTX nxzDWVBj/0ES0WCtqyDfYlk= X-Google-Smtp-Source: ABdhPJwsXeAq0PJAwgA4obBVAwF0dBlX+NCMXMD3eaPgjxfSZshNDR0/RADw7ee8kBDT8CC/jL/u1w== X-Received: by 2002:a05:6512:411:: with SMTP id u17mr11418179lfk.287.1622695804290; Wed, 02 Jun 2021 21:50:04 -0700 (PDT) Received: from rsa-laptop.internal.lan ([217.25.229.52]) by smtp.gmail.com with ESMTPSA id z2sm191328lfe.229.2021.06.02.21.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 21:50:03 -0700 (PDT) From: Sergey Ryazanov To: Johannes Berg , Loic Poulain Cc: M Chetan Kumar , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC 1/6] rtnetlink: fix alloc() method introduction Date: Thu, 3 Jun 2021 07:49:49 +0300 Message-Id: <20210603044954.8091-2-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210603044954.8091-1-ryazanov.s.a@gmail.com> References: <20210603044954.8091-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org RTNL checks for the setup() callback existing in a few place as a sanity check. The introduction of the alloc() method makes the setup() method optional. So allow RTNL families that define at least one alloc() or setup() method. Fixes: ???? ("rtnetlink: add alloc() method to rtnl_link_ops") Signed-off-by: Sergey Ryazanov --- net/core/rtnetlink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 49a27bf6e4a7..56ac16abe0ba 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -376,12 +376,12 @@ int __rtnl_link_register(struct rtnl_link_ops *ops) if (rtnl_link_ops_get(ops->kind)) return -EEXIST; - /* The check for setup is here because if ops + /* The check for alloc/setup is here because if ops * does not have that filled up, it is not possible * to use the ops for creating device. So do not * fill up dellink as well. That disables rtnl_dellink. */ - if (ops->setup && !ops->dellink) + if ((ops->alloc || ops->setup) && !ops->dellink) ops->dellink = unregister_netdevice_queue; list_add_tail(&ops->list, &link_ops); @@ -3421,7 +3421,7 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, return -EOPNOTSUPP; } - if (!ops->setup) + if (!ops->alloc && !ops->setup) return -EOPNOTSUPP; if (!ifname[0]) { From patchwork Thu Jun 3 04:49:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 12296071 X-Patchwork-Delegate: johannes@sipsolutions.net 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 BFD19C47082 for ; Thu, 3 Jun 2021 04:51:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1FD3613D2 for ; Thu, 3 Jun 2021 04:51:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbhFCExF (ORCPT ); Thu, 3 Jun 2021 00:53:05 -0400 Received: from mail-lf1-f50.google.com ([209.85.167.50]:41831 "EHLO mail-lf1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbhFCExF (ORCPT ); Thu, 3 Jun 2021 00:53:05 -0400 Received: by mail-lf1-f50.google.com with SMTP id v8so6839218lft.8; Wed, 02 Jun 2021 21:51:05 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=+nCi9Jm6RS+Yo4xLrj1ulwofTdiOXC2p9T7X0aXtR8w=; b=JwxPuEWg1X84SZu+RUEfDIO6hQm8CuzSaB94KXZmH2Cv64ZRN7m2HhOiqc732T1HBa GwtyQSay42iBwDN4XGMIRjOHWDOhja9/DTnr6omS61C3ZWRhZPisS42HaQVIEWIEiMjS dRFhdJq0BIDwgIjrmNg4xeE9vtwVfMGub23jdPRHr9jEAUJZPiwYEg4WomStCVOEj892 nXPwOc5yr37bkVPKyQ/kCieFfLAXvlYXdhPijWtOgu6cyAS5C57eQ0MFtx3mKtvzfgow mnu7QCy3LYQacFNwVuDkZSnR13OOorIKvl5hWSdYu9iBcBNcYQ2d2kdDBurXRv5eJvrq L2uw== 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:mime-version:content-transfer-encoding; bh=+nCi9Jm6RS+Yo4xLrj1ulwofTdiOXC2p9T7X0aXtR8w=; b=e4KHNENbBqGTszEP6fthXYAJ691SqmNzUhMWSIwurtLOOdfU8x5g+IuUtlvSA9jGio HR+C48rswfrrf/qdFokeu1Mhjz7CIbYIfiR3kRk9dxpg/7AGCalgQCBpszYn9M/m2+fc n0vUgGgOwyLuAcTY6n6liQAgWfWCipWRqdhG9tG7SC0UzOmmxjIqeHWMJHVD7oLPZjvi NqcjL+0mfS2Dr/pHIb5T0GB0XsG3gKIv69QdczK8k91r41JbhT4zuiTZwNXCLJYOsIDt yr7TUKWDD69ZNGr/zcuIzG13tP/aMgS/tVCtCeZb+UfSRe3cL7ugHGufYF6dLKW/CrUM UJlg== X-Gm-Message-State: AOAM530B+H36hIPJ8oLHVrJX8hH7rhHTcGlZf0mAhG2Mo/jk+b/62evZ TQBILG06UMwQwYDhWVG+F7w= X-Google-Smtp-Source: ABdhPJxoWm3n+xVxYAPRD2ma8LJYiwycuwtUbkKgwG0whdSfB6s07YFMF0pFxo8lP5tArax5zpgWUw== X-Received: by 2002:a19:c209:: with SMTP id l9mr16177432lfc.277.1622695805129; Wed, 02 Jun 2021 21:50:05 -0700 (PDT) Received: from rsa-laptop.internal.lan ([217.25.229.52]) by smtp.gmail.com with ESMTPSA id z2sm191328lfe.229.2021.06.02.21.50.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 21:50:04 -0700 (PDT) From: Sergey Ryazanov To: Johannes Berg , Loic Poulain Cc: M Chetan Kumar , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC 2/6] wwan: fix module initialization Date: Thu, 3 Jun 2021 07:49:50 +0300 Message-Id: <20210603044954.8091-3-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210603044954.8091-1-ryazanov.s.a@gmail.com> References: <20210603044954.8091-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Recover the successful return from the module initialization function that was accidentally lost during the netdev creation support integration. Fixes: ???? ("wwan: add interface creation support") Signed-off-by: Sergey Ryazanov --- drivers/net/wwan/wwan_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index e2490c73ac33..32b2096c5036 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -737,7 +737,8 @@ static int __init wwan_init(void) goto destroy; } - err = 0; + return 0; + destroy: class_destroy(wwan_class); unregister: From patchwork Thu Jun 3 04:49:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 12296067 X-Patchwork-Delegate: johannes@sipsolutions.net 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 D812BC47097 for ; Thu, 3 Jun 2021 04:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA70660232 for ; Thu, 3 Jun 2021 04:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbhFCEwI (ORCPT ); Thu, 3 Jun 2021 00:52:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229761AbhFCEwI (ORCPT ); Thu, 3 Jun 2021 00:52:08 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99A8DC061756; Wed, 2 Jun 2021 21:50:07 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id p20so5453723ljj.8; Wed, 02 Jun 2021 21:50:07 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=PMkoIgykrLxKf1BVjDSZxKW8LJf0Zsrl2rpAZilwckI=; b=qPtMwgZPykmzU0IQ4Q8WNo09olOm3BkywOwwMd/B3jiVJcB4mDps+6JJRqmYwyhFF/ Bmmve3oavc5VXdywYoZAlDcqgXKwhjYvlE9Bu3AGU6KK71i1m3b1cHtUdJztwRS5X05P nEcOUIO0/mBR/qpw2FlK5kFziC0RIJpxp4vc7cisqwPJx3XbKZ9mweyjaJ0cwFm2sVvK YvDBYI/ouHAyardvK86QubN4ZGF9AiCiBZG27NHf0+Wfi7jeUPBXHeA7x5BX+eFcj1S6 6yZYUfLBI+SBzLMVzV5y6ZuyXRPyC+gpc5GNPdZcsMFePPzWZ/zhD/uwy5rZqBeoam5l Tppw== 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:mime-version:content-transfer-encoding; bh=PMkoIgykrLxKf1BVjDSZxKW8LJf0Zsrl2rpAZilwckI=; b=G3pQ6Sg9wFptVPCjbOOa2szWGbziaWQ0r63HG/krjZ8be9voK42qFxMBxzs850hKbn BxAtF++8bjNdRGPxcmU/ZxId884dudQDMcMEukEXHCHbB8Z/ViWR4uZKZTYxK/qx1svu qGSgJLanaiINQ1AqsdTttgB4tVoaT736pLEBfMJx8uly5PVyWnjinSRHUjkHU43yryiK 3yy1KAKtQ4gGAp2KQQii84guYCAOMCKh0jW0ZUOu7guhA4jndEfsGjf3PR0NIuNlbf95 MBWEtuodNPPRmd6fF0go6inpPXOM/G8ceBIIEjBVYvS5/FVvFALO0dNCRt6fstteYPZj IJSA== X-Gm-Message-State: AOAM532SIr/Ukl9lshW9rCA6VP8BDC+n+UlEZmgqMWyK2uJwuixeAijp RAahFoqTTiuelUSWLZHD3go= X-Google-Smtp-Source: ABdhPJxrQYuTfTewbIIEDOKB5JbVPNslaAhZpQumZGikRou//p9oyGs8n0szLM8kbAyNBlumAbUHAA== X-Received: by 2002:a2e:89d7:: with SMTP id c23mr28046893ljk.318.1622695805979; Wed, 02 Jun 2021 21:50:05 -0700 (PDT) Received: from rsa-laptop.internal.lan ([217.25.229.52]) by smtp.gmail.com with ESMTPSA id z2sm191328lfe.229.2021.06.02.21.50.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 21:50:05 -0700 (PDT) From: Sergey Ryazanov To: Johannes Berg , Loic Poulain Cc: M Chetan Kumar , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC 3/6] rtnetlink: fill IFLA_PARENT_DEV_NAME on link dump Date: Thu, 3 Jun 2021 07:49:51 +0300 Message-Id: <20210603044954.8091-4-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210603044954.8091-1-ryazanov.s.a@gmail.com> References: <20210603044954.8091-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Return a parent device using the FLA_PARENT_DEV_NAME attribute during links dump. This should help a user figure out which links belong to a particular HW device. E.g. what data channels exists on a specific WWAN modem. Signed-off-by: Sergey Ryazanov --- net/core/rtnetlink.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 56ac16abe0ba..120887c892de 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1819,6 +1819,11 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, if (rtnl_fill_prop_list(skb, dev)) goto nla_put_failure; + if (dev->dev.parent && + nla_put_string(skb, IFLA_PARENT_DEV_NAME, + dev_name(dev->dev.parent))) + goto nla_put_failure; + nlmsg_end(skb, nlh); return 0; From patchwork Thu Jun 3 04:49:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 12296061 X-Patchwork-Delegate: johannes@sipsolutions.net 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 421C2C47096 for ; Thu, 3 Jun 2021 04:50:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 192A9613D2 for ; Thu, 3 Jun 2021 04:50:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbhFCEvx (ORCPT ); Thu, 3 Jun 2021 00:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbhFCEvw (ORCPT ); Thu, 3 Jun 2021 00:51:52 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83FEEC06175F; Wed, 2 Jun 2021 21:50:08 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id i9so6804205lfe.13; Wed, 02 Jun 2021 21:50:08 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=x4E5XTU7wD0xWqzH6jn3ez00Wy8uYqD5Mj232oqDNsc=; b=eSLOFmSpN0Bfsyg7YN/0klrX/bMhgfpC0raOfDEdildqldck+gVj30/hLvyhUWaaLA OWqACChSQVNqKOb7qefVQmXZmg6C+f6/6zrdcUT427v05KeLUqo9Bx1JSHd6OQcrHIk/ DGMQahAUvbivHH1CQ/gtmrU5K1QbWSCk8TVkJ7tjkkJFx91uSjhClB8lWyBpq7Eno6WC /ktbYcBZzZgobvyGUQN18u9om1hlAmL9lGIQORIEJGWtbvkC2Y9oeXqpKGgNTT1g3OGR o7kCTHYyV9Z6RArcDfjoIlR6YSCcOauDa6KnlTCmdVk23htJn6pXyfwVYokToQZKruHN O2rg== 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:mime-version:content-transfer-encoding; bh=x4E5XTU7wD0xWqzH6jn3ez00Wy8uYqD5Mj232oqDNsc=; b=jLq0FjfiRL4eFp6fl5USSUdI2+VbigorO6xPbSi3U8qYO05igEUsO7s+v1BKwITTMz KS6DmtJ7hkl79N/5q1ZFWODc/2A8ItjVtg8hAEOq9xhSoZOJYKTjC2R3sjsGDetnQCGG UEWr2hZRPlOJ5F1NboBiZidovy1SRw13FniIG8lNnVFBJDMKhkfK9UyBQURvEDtCsCU8 e9ZLkkP8w5pJzQDHF6baFMt8lZuNtpwIkkgxv7ILsuv2y14y/NQKy4fMED3xKWjhyckl 6pY3o7+2rjT4QAI0W15iF8LReJ2LDId0wi+2x8Yd4Ncz0ockd2qn6NXZYZfzfSsttkBe NFEw== X-Gm-Message-State: AOAM533ZO5RYcm0X7iBjbT45lpK0MKk/z/Lh71KrRIcdHvgok0W2L1Ka zobq91zRC9Ff4aTBOABMeZWoGeomFE4= X-Google-Smtp-Source: ABdhPJw/S5Yo2Yo1LzYzIVt579lrIsi7FuNnPKhzsIni/2IlkV+ANwej29J/SFFYAkF750OJ8UvxHQ== X-Received: by 2002:ac2:560f:: with SMTP id v15mr14866462lfd.431.1622695806931; Wed, 02 Jun 2021 21:50:06 -0700 (PDT) Received: from rsa-laptop.internal.lan ([217.25.229.52]) by smtp.gmail.com with ESMTPSA id z2sm191328lfe.229.2021.06.02.21.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 21:50:06 -0700 (PDT) From: Sergey Ryazanov To: Johannes Berg , Loic Poulain Cc: M Chetan Kumar , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC 4/6 iproute2] Update kernel headers Date: Thu, 3 Jun 2021 07:49:52 +0300 Message-Id: <20210603044954.8091-5-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210603044954.8091-1-ryazanov.s.a@gmail.com> References: <20210603044954.8091-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org A partial headers update that brings WWAN-related attributes. Included in the series mainly to make it possible to quickly compile and test the utility. Signed-off-by: Sergey Ryazanov --- include/uapi/linux/if_link.h | 6 ++++++ include/uapi/linux/wwan.h | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 include/uapi/linux/wwan.h diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 50193377..1cf48416 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -341,6 +341,12 @@ enum { IFLA_ALT_IFNAME, /* Alternative ifname */ IFLA_PERM_ADDRESS, IFLA_PROTO_DOWN_REASON, + + /* device (sysfs) name as parent, used instead + * of IFLA_LINK where there's no parent netdev + */ + IFLA_PARENT_DEV_NAME, + __IFLA_MAX }; diff --git a/include/uapi/linux/wwan.h b/include/uapi/linux/wwan.h new file mode 100644 index 00000000..32a2720b --- /dev/null +++ b/include/uapi/linux/wwan.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* + * Copyright (C) 2021 Intel Corporation. + */ +#ifndef _UAPI_WWAN_H_ +#define _UAPI_WWAN_H_ + +enum { + IFLA_WWAN_UNSPEC, + IFLA_WWAN_LINK_ID, /* u32 */ + + __IFLA_WWAN_MAX +}; +#define IFLA_WWAN_MAX (__IFLA_WWAN_MAX - 1) + +#endif /* _UAPI_WWAN_H_ */ From patchwork Thu Jun 3 04:49:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 12296063 X-Patchwork-Delegate: johannes@sipsolutions.net 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 82ED9C47097 for ; Thu, 3 Jun 2021 04:50:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6479B60232 for ; Thu, 3 Jun 2021 04:50:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229707AbhFCEvy (ORCPT ); Thu, 3 Jun 2021 00:51:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbhFCEvx (ORCPT ); Thu, 3 Jun 2021 00:51:53 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 651D8C06175F; Wed, 2 Jun 2021 21:50:09 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id p17so6087977lfc.6; Wed, 02 Jun 2021 21:50:09 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=fTdsf02HyDf/I+gguBoc3k+gpG0A/WMGol4iK1ZVOZc=; b=DLfK+DCaDJmEF4dYS5CQKPrECP6jb1y+ZiBEhRRuerKfnChFMTjpVj24fSQcGDjRjR uUeRleW0o+ZNI1GizFu5PKmdxWaqSFSgzwmtXDhXEg1pDV3BZJ/bXLmApFIVDhRDLte5 iMzJxNmJvxD+6DWwO25vNP+3Kg539DIP749NpajYAcsSbe4iU16Tj95Ap/wbneRahW68 Q5jkm/We+lkPKCehHWeXMr1BmB7V/fgC5UxBkmy/2GQ6GlP2arGXRMHjKwxr0P1NAO+i Put0R5ox5lFtIpLYvkY4lN0OlyakvwykLCUqothg0pcOCeVUnBDH64rp/BvZ+uwIEIlv /JcQ== 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:mime-version:content-transfer-encoding; bh=fTdsf02HyDf/I+gguBoc3k+gpG0A/WMGol4iK1ZVOZc=; b=b9cTwqZEjJ3m0Sc8IVwcEyTQOD/7RtNrfSfkDNT4NFD4Z+c7voRGYCJvZjxG0Hn6Ao keAO5MvoqjUDdXEXZIfanc54ILY7i2BtbnvCGx+VYZfhugUWLOs7xSoVsMqES4GFNDJM kNbFlrFX/wrS7I9fuLk0Dg97gT0FQ+REEDPKG6QdBM4kmmb+8muEpC5OLVxzfLuYzQyY Wo7IdOARrQ/0hzSsdDN4+9HgBd2dOej4e1VBTSI2wcD5FSu+u0TPdD7BM2da77IPp/4q DwHBwlktNTbcwx1+WTjFXLVWWoIk9soy5Wwuh1lQ7XGkolVBYsL1wcDHI25s//6Gd6MH 3i1Q== X-Gm-Message-State: AOAM533UcVzkiEuO6j/NFQB6qMITsbh4rszBqZl9VmE/c7KOtTgg9aI8 OWOZ5k037H5VNvjER+mKSFA= X-Google-Smtp-Source: ABdhPJyg23KAcM5+N2uW9j16dVyl5nYDhlMNtIg5cotw10Lw+W6ozJ21KaN+DHANOCgmAODg4JQ60Q== X-Received: by 2002:a19:4086:: with SMTP id n128mr25173479lfa.464.1622695807834; Wed, 02 Jun 2021 21:50:07 -0700 (PDT) Received: from rsa-laptop.internal.lan ([217.25.229.52]) by smtp.gmail.com with ESMTPSA id z2sm191328lfe.229.2021.06.02.21.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 21:50:07 -0700 (PDT) From: Sergey Ryazanov To: Johannes Berg , Loic Poulain Cc: M Chetan Kumar , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC 5/6 iproute2] iplink: add support for parent device Date: Thu, 3 Jun 2021 07:49:53 +0300 Message-Id: <20210603044954.8091-6-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210603044954.8091-1-ryazanov.s.a@gmail.com> References: <20210603044954.8091-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add support for specifying a parent device (struct device) by its name during the link creation and printing parent name in the links list. This option will be used to create WWAN links and possibly by other device classes that do not have a "natural parent netdev". Signed-off-by: Sergey Ryazanov --- ip/ipaddress.c | 7 +++++++ ip/iplink.c | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index cfb24f5c..98f25a5b 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -1176,6 +1176,13 @@ int print_linkinfo(struct nlmsghdr *n, void *arg) RTA_PAYLOAD(tb[IFLA_PHYS_SWITCH_ID]), b1, sizeof(b1))); } + + if (tb[IFLA_PARENT_DEV_NAME]) { + print_string(PRINT_ANY, + "parentdev_name", + "parentdev-name %s ", + rta_getattr_str(tb[IFLA_PARENT_DEV_NAME])); + } } if ((do_link || show_details) && tb[IFLA_IFALIAS]) { diff --git a/ip/iplink.c b/ip/iplink.c index faafd7e8..190ce7d9 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -63,7 +63,7 @@ void iplink_usage(void) { if (iplink_have_newlink()) { fprintf(stderr, - "Usage: ip link add [link DEV] [ name ] NAME\n" + "Usage: ip link add [link DEV | parentdev-name NAME] [ name ] NAME\n" " [ txqueuelen PACKETS ]\n" " [ address LLADDR ]\n" " [ broadcast LLADDR ]\n" @@ -938,6 +938,10 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type) *argv); addattr32(&req->n, sizeof(*req), IFLA_GSO_MAX_SEGS, max_segs); + } else if (strcmp(*argv, "parentdev-name") == 0) { + NEXT_ARG(); + addattr_l(&req->n, sizeof(*req), IFLA_PARENT_DEV_NAME, + *argv, strlen(*argv) + 1); } else { if (matches(*argv, "help") == 0) usage(); From patchwork Thu Jun 3 04:49:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 12296073 X-Patchwork-Delegate: johannes@sipsolutions.net 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 87C61C47096 for ; Thu, 3 Jun 2021 04:51:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 706FB60232 for ; Thu, 3 Jun 2021 04:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229881AbhFCExI (ORCPT ); Thu, 3 Jun 2021 00:53:08 -0400 Received: from mail-lj1-f177.google.com ([209.85.208.177]:40532 "EHLO mail-lj1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229867AbhFCExH (ORCPT ); Thu, 3 Jun 2021 00:53:07 -0400 Received: by mail-lj1-f177.google.com with SMTP id u22so5456397ljh.7; Wed, 02 Jun 2021 21:51:09 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=kYTcTtjZwGkx5E7kMKtJMXD4K6b64JEpdLABcMx78NQ=; b=CE20pSVwKLwe7CY/XHFAmVU/OGPJ1uYvAa5X7lrCRdoABAeS7Je4SFHfTB5NfhsCmW vEONblUWTJXMiT3oxhnPi0xC1/J4f763+SxVwc+oJXixTzglFTG4nx8kgrmjRZMi/2+G PagoyLwd8oPUTmRQO3hnBH0q9e7LjcDheePB48nWthXxMwoQq4OkSbSSz8eR6DlODnnB 2Cg7ky2n8lZDIurXOKzwN1NcHaAjFzDg3I3qrdf5WHXn1qcdLnoWuyGXZnNA52WPsI3i fWkinYm4mbxSfl9M+n8dDxOutUyt0HNKdFoIDqp42hwtkl2WVyTpWml4FRpWxL7eVQMC s7cw== 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:mime-version:content-transfer-encoding; bh=kYTcTtjZwGkx5E7kMKtJMXD4K6b64JEpdLABcMx78NQ=; b=S5VKyaoDFt4rX8b2NO8Dd0MTzxVFaF3fiRNe3SKfTvnXm06aPtZxMHDDGmY3EbpwvO AN+5VSBKM2egDoxh13sLe6oAJZpj1BoiRmw06Y3h+sY82n+kL0nR/lInFWkYnj73dAm/ hGDizP8HnO8gFweBODxCyV4nB2qHNMPSy/pEwX7EC2CumL/O7xKQybqqXQmi4Z6/uVEh NeQzIHgMbU5CWJhtvPRHYhbABwiyxOCwpbfp6gO4lM6JuEau9YFCtWsA16RJ8NemN/5e DWjneOlgx1mMQvoTfRCDOsPEKBU1BvsV06a1qxUacDYHpBAAX3oCO5nxzGZjq9HQoncm 6cHA== X-Gm-Message-State: AOAM53321BaYey4sZH+s7S6blCNfwsvJ0VZQzFgCH6JJIHmlsgTOKi+I 7zzKPDTLJ+wyQLY9y+QShkw= X-Google-Smtp-Source: ABdhPJxjQj5PILjjPSo6RIe5dOO5A4V7v+EFF0penkxLQ28ZVWlzKCeBAf7hMn9J/xVqAazTPq3C4A== X-Received: by 2002:a2e:5cc4:: with SMTP id q187mr5100292ljb.177.1622695808920; Wed, 02 Jun 2021 21:50:08 -0700 (PDT) Received: from rsa-laptop.internal.lan ([217.25.229.52]) by smtp.gmail.com with ESMTPSA id z2sm191328lfe.229.2021.06.02.21.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 21:50:08 -0700 (PDT) From: Sergey Ryazanov To: Johannes Berg , Loic Poulain Cc: M Chetan Kumar , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC 6/6 iproute2] iplink: support for WWAN devices Date: Thu, 3 Jun 2021 07:49:54 +0300 Message-Id: <20210603044954.8091-7-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210603044954.8091-1-ryazanov.s.a@gmail.com> References: <20210603044954.8091-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The WWAN subsystem has been extended to generalize the per data channel network interfaces management. This change implements support for WWAN links handling. And actively uses the earlier introduced ip-link capability to specify the parent by its device name. The WWAN interface for a new data channel should be created with a command like this: ip link add dev wwan0-2 parentdev-name wwan0 type wwan linkid 2 Where: wwan0 is the modem HW device name (should be taken from /sys/class/wwan) and linkid is an identifier of the opened data channel. Signed-off-by: Sergey Ryazanov --- ip/Makefile | 2 +- ip/iplink.c | 3 +- ip/iplink_wwan.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 ip/iplink_wwan.c diff --git a/ip/Makefile b/ip/Makefile index 4cad619c..b03af29b 100644 --- a/ip/Makefile +++ b/ip/Makefile @@ -11,7 +11,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \ iplink_bridge.o iplink_bridge_slave.o ipfou.o iplink_ipvlan.o \ iplink_geneve.o iplink_vrf.o iproute_lwtunnel.o ipmacsec.o ipila.o \ ipvrf.o iplink_xstats.o ipseg6.o iplink_netdevsim.o iplink_rmnet.o \ - ipnexthop.o ipmptcp.o iplink_bareudp.o + ipnexthop.o ipmptcp.o iplink_bareudp.o iplink_wwan.o RTMONOBJ=rtmon.o diff --git a/ip/iplink.c b/ip/iplink.c index 190ce7d9..4073d6e8 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -56,7 +56,8 @@ void iplink_types_usage(void) " ipip | ipoib | ipvlan | ipvtap |\n" " macsec | macvlan | macvtap |\n" " netdevsim | nlmon | rmnet | sit | team | team_slave |\n" - " vcan | veth | vlan | vrf | vti | vxcan | vxlan | xfrm }\n"); + " vcan | veth | vlan | vrf | vti | vxcan | vxlan | wwan |\n" + " xfrm }\n"); } void iplink_usage(void) diff --git a/ip/iplink_wwan.c b/ip/iplink_wwan.c new file mode 100644 index 00000000..3510477a --- /dev/null +++ b/ip/iplink_wwan.c @@ -0,0 +1,72 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#include +#include +#include + +#include "utils.h" +#include "ip_common.h" + +static void print_explain(FILE *f) +{ + fprintf(f, + "Usage: ... wwan linkid LINKID\n" + "\n" + "Where: LINKID := 0-4294967295\n" + ); +} + +static void explain(void) +{ + print_explain(stderr); +} + +static int wwan_parse_opt(struct link_util *lu, int argc, char **argv, + struct nlmsghdr *n) +{ + while (argc > 0) { + if (matches(*argv, "linkid") == 0) { + __u32 linkid; + + NEXT_ARG(); + if (get_u32(&linkid, *argv, 0)) + invarg("linkid", *argv); + addattr32(n, 1024, IFLA_WWAN_LINK_ID, linkid); + } else if (matches(*argv, "help") == 0) { + explain(); + return -1; + } else { + fprintf(stderr, "wwan: unknown command \"%s\"?\n", + *argv); + explain(); + return -1; + } + argc--, argv++; + } + + return 0; +} + +static void wwan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) +{ + if (!tb) + return; + + if (tb[IFLA_WWAN_LINK_ID]) + print_uint(PRINT_ANY, "linkid", "linkid %u ", + rta_getattr_u32(tb[IFLA_WWAN_LINK_ID])); +} + +static void wwan_print_help(struct link_util *lu, int argc, char **argv, + FILE *f) +{ + print_explain(f); +} + +struct link_util wwan_link_util = { + .id = "wwan", + .maxattr = IFLA_WWAN_MAX, + .parse_opt = wwan_parse_opt, + .print_opt = wwan_print_opt, + .print_help = wwan_print_help, +};