From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C6F7C433EF for ; Fri, 3 Jun 2022 02:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236997AbiFCCq3 (ORCPT ); Thu, 2 Jun 2022 22:46:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbiFCCq2 (ORCPT ); Thu, 2 Jun 2022 22:46:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76F0733375; Thu, 2 Jun 2022 19:46:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21D42B82155; Fri, 3 Jun 2022 02:46:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7517EC385A5; Fri, 3 Jun 2022 02:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654224383; bh=uxZ53R3ThWE3FSFIh9D1ha7bSA75C1JjHKEUkquN/9Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IAgJSZ0A3zKUuOxFbkQYGjaNt+dv6aplR2WymS08Fj9kT2PAFST/PiaXke5d5Rg7k POIIB6tZwDwa9xSC1/bVxD4HYFQA0Tly29TyV2CL0PHRHRArTKN7I+NkgHf21+eNf9 ydC4EghpdIJZAcVrBgq2qVt+j3TSz4ghlyIqa5wL1/knGXjhb5KKLWn7ez9w2yJitR g5y2ZlUE4Mcl0diZnyxKfQTGjrmWd3p12dHAmHiM7kb9e/9SqQrCSR/Llo9N5kXbt/ PQ1IVVVJMmo7P7XrVAnuLVE3VnprYtkypTo4B9pUS0cog3dZNMYTgcJPUNsO4HEbjg QKVwTLPu+GJog== Date: Thu, 2 Jun 2022 19:46:22 -0700 From: Jakub Kicinski To: Kaarel =?UTF-8?B?UMOkcnRlbA==?= Cc: Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Eric Dumazet , 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: <20220602194622.0c54a256@kernel.org> 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 Precedence: bulk List-ID: X-Mailing-List: linux-can@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 You can change the carrier state from user space on a dummy device, that will inform the kernel of the operstate: # ip link add type dummy # ip link show dev dummy0 8: dummy0: mtu 1500 qdisc noop state DOWN mode DEFAULT gr= oup default qlen 1000 link/ether 8e:35:15:22:e3:d7 brd ff:ff:ff:ff:ff:ff # ip link set dev dummy0 up # ip link show dev dummy0 8: dummy0: mtu 1500 qdisc noqueue state UNKNO= WN mode DEFAULT group default qlen 1000 link/ether 8e:35:15:22:e3:d7 brd ff:ff:ff:ff:ff:ff # ip link set dev dummy0 carrier off # ip link set dev dummy0 carrier on # ip link show dev dummy0 8: dummy0: mtu 1500 qdisc noqueue state UP mo= de DEFAULT group default qlen 1000 link/ether 8e:35:15:22:e3:d7 brd ff:ff:ff:ff:ff:ff Flipping all soft devices which don't have a lower or don't expect user space management to UP is fine but doing it one by one feels icky. Yet another random thing a driver author has to know to flip. If people are confused about seeing UNKNOWN in ip link output maybe we should move displaying that under the -d flag (detailed output)? Saves space, and nobody will get confused.