Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp108421iof; Sun, 5 Jun 2022 22:38:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9SnhwKMvVsBuUmCmnPMNwnh+OFkQ4o0yppmi1eCD+ArGE0jEbJtft1Hzu5VMxnVqp5rKO X-Received: by 2002:a17:902:7886:b0:167:5c8c:4d3e with SMTP id q6-20020a170902788600b001675c8c4d3emr11799117pll.74.1654493908775; Sun, 05 Jun 2022 22:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654493908; cv=none; d=google.com; s=arc-20160816; b=ArGKU86xixkalEM7SJ1X1TWAovCKlp1veQE+po9Bor5OgPB8Inq+si6zJUjUzVeedB ri7tQtIzGYK8YZifmulyXfDVIWDIFS4cr4Qfuf2tPJo/Ig9sxkWQUHchZOjdHE4dBFYJ SAhDlfalYPUnbf6DGERkRqjjCsaKHszsesvQB0S77TbKjYgAqBbMPNNXX2CHbkGvl3uO ew4bafw93bFeQEEGIQobtumpUhM6jUSKbomW0WdM+9C1+AQPsuoEHuDxVX6tT5LUmZLg C0vPnKUFBXUZtCQLiPjXHOLwRYf+M1RS4rTKHc+u3r7O0XeBQf3CYTudc96YzNJFY3C8 LEZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=x8SxNnSlRoxPxJO9Uoy9HTF5RbNrzxny49a/wwWHJlI=; b=cERE9r1DmkXIEthgyIDLtu0ABVl7o6q1xbiZjgPr957POGen8ku3GgpRpk2vspZSTd QCdV4QNSKv64GF7y1hlREFk6ENnqpcyRLL0Uhg4nxIukCa7OyUgZI4a3v4ulBiXAXm// jKKe5IBshn0vLS2YtW44Zle3HQK7ogNcgvH3YeNSjSTgwsrQCqiTCixSGUTlzSkdBSy9 tYMR7HT1YSWHvmYvEYY+r/r60YL3OJzcvrcdU2nfnJDr4I5J2QX9VoZdk+1lB4JRZ4zc 4wWD71Ut/PaBx2wYWRjEqkqbhNAw9rBtd30kE/gscJkq7u8HBickNy0geIroN521eYt0 gYPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20210112.gappssmtp.com header.s=20210112 header.b=m+Dp64OK; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d68-20020a636847000000b003fdb97d8757si3781724pgc.378.2022.06.05.22.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:38:28 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@networkplumber-org.20210112.gappssmtp.com header.s=20210112 header.b=m+Dp64OK; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3A1012B1962; Sun, 5 Jun 2022 21:41:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231496AbiFCDjO (ORCPT + 99 others); Thu, 2 Jun 2022 23:39:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231161AbiFCDjL (ORCPT ); Thu, 2 Jun 2022 23:39:11 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAC521CB1D for ; Thu, 2 Jun 2022 20:39:09 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id b5so5981220plx.10 for ; Thu, 02 Jun 2022 20:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x8SxNnSlRoxPxJO9Uoy9HTF5RbNrzxny49a/wwWHJlI=; b=m+Dp64OKhHxtIwoYnPdn8ou+Ei7x0N76Ed4+7OCiDQ9nPxlgSDaVPEilak1ti2967e tANiXmeB9ZSfnsWI9uzMHrKPTcwBDqFDrPqIW9fAVTMk+WleIsfRHMtwPnAh1vYzmAGz 6w39s2xoN5VdcT4fN9W0P/PoN4joxlBE4YdpvMqrxJCAGZFgSAUPvGK2gRdEjLLyaHji gDtPyD4nY5579am5AhI9bYGp6jT+3UL0lWNQcM0kQxtQ/mt8F278e2oO4AGRsFNpuZxl bWoEwhx2q41m6Hb6bFGEm5eaCz5R3Meg4gDXlwylma4f4mg5iHpc2kqSoK9s1oU0Qdeh 7+1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x8SxNnSlRoxPxJO9Uoy9HTF5RbNrzxny49a/wwWHJlI=; b=JS+nZa+GH0QJPVcUmwdIo+xOPsCS73pklDbvfEJVs0F/6Ylt1PFBe+L0asW11yI3Hy PWpt/8nS6TKlazNYh/2AP/GkDb+9vTNLuPYWQGepWlbxyj7DEslqSjxUXVySFCdwV8Ya hCcoSgq8t//NLOu1qabNmxDVVWjzZFth4jLUBsHSGQndKUvgFDZz2XBZ/9AbmQkQCOYS l3KDz/MVHxUWvLBTsM55swPZgfVa0PRvTUOp9g99qx+MQcqSlW1RrQpRACmnyHThH9g+ XAt1TN1cYpTbjvmVRncENcugXvHTUExsKiyzxaZPdy3sLpWCV3SfY0i4A0/1JZz6d8ms KBRg== X-Gm-Message-State: AOAM533bIztAFxJN4QT3Glkwbbs+0f2iaGrYC5bpFjBcrZnWFsdzFQ7/ I+aap9ljW3ykM/WEPbXmDXCVUw== X-Received: by 2002:a17:902:b214:b0:161:f6d8:45cd with SMTP id t20-20020a170902b21400b00161f6d845cdmr8296208plr.95.1654227549020; Thu, 02 Jun 2022 20:39:09 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id ft19-20020a17090b0f9300b001e2fed48f48sm4029801pjb.41.2022.06.02.20.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 20:39:08 -0700 (PDT) Date: Thu, 2 Jun 2022 20:39:04 -0700 From: Stephen Hemminger To: Kaarel =?UTF-8?B?UMOkcnRlbA==?= Cc: Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: add operstate for vcan and dummy Message-ID: <20220602203904.65f7261f@hermes.local> In-Reply-To: <20220602081929.21929-1-kaarelp2rtel@gmail.com> References: <20220602081929.21929-1-kaarelp2rtel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Thu, 2 Jun 2022 11:19:29 +0300 Kaarel P=C3=A4rtel wrote: > The idea here is simple. The vcan and the dummy network devices > currently do not set the operational state of the interface. > The result is that the interface state will be UNKNOWN. >=20 > The kernel considers the unknown state to be the same as up: > https://elixir.bootlin.com/linux/latest/source/include/linux/netdevice.h#= L4125 >=20 > However for users this creates confusion: > https://serverfault.com/questions/629676/dummy-network-interface-in-linux >=20 > The change in this patch is very simple. When the interface is set up, the > operational state is set to IF_OPER_UP. >=20 > Signed-off-by: Kaarel P=C3=A4rtel > --- > drivers/net/can/vcan.c | 1 + > drivers/net/dummy.c | 1 + > 2 files changed, 2 insertions(+) >=20 > diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c > index a15619d883ec..79768f9d4294 100644 > --- a/drivers/net/can/vcan.c > +++ b/drivers/net/can/vcan.c > @@ -162,6 +162,7 @@ static void vcan_setup(struct net_device *dev) > =20 > dev->netdev_ops =3D &vcan_netdev_ops; > dev->needs_free_netdev =3D true; > + dev->operstate =3D IF_OPER_UP; > } > =20 > static struct rtnl_link_ops vcan_link_ops __read_mostly =3D { > diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c > index f82ad7419508..ab128f66de00 100644 > --- a/drivers/net/dummy.c > +++ b/drivers/net/dummy.c > @@ -133,6 +133,7 @@ static void dummy_setup(struct net_device *dev) > =20 > dev->min_mtu =3D 0; > dev->max_mtu =3D 0; > + dev->operstate =3D IF_OPER_UP; > } > =20 > static int dummy_validate(struct nlattr *tb[], struct nlattr *data[], Normally carrier state is propogated to operstate by linkwatch. You may need to add a call for that.