All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Kaarel Pärtel" <kaarelp2rtel@gmail.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: add operstate for vcan and dummy
Date: Thu, 2 Jun 2022 19:46:22 -0700	[thread overview]
Message-ID: <20220602194622.0c54a256@kernel.org> (raw)
In-Reply-To: <20220602081929.21929-1-kaarelp2rtel@gmail.com>

On Thu,  2 Jun 2022 11:19:29 +0300 Kaarel Pärtel 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.
> 
> The kernel considers the unknown state to be the same as up:
> https://elixir.bootlin.com/linux/latest/source/include/linux/netdevice.h#L4125
> 
> However for users this creates confusion:
> https://serverfault.com/questions/629676/dummy-network-interface-in-linux
> 
> The change in this patch is very simple. When the interface is set up, the
> operational state is set to IF_OPER_UP.
> 
> Signed-off-by: Kaarel Pärtel <kaarelp2rtel@gmail.com>

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: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN 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 up
# ip link show dev dummy0
8: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 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: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode 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.

  reply	other threads:[~2022-06-03  2:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02  8:19 [PATCH] net: add operstate for vcan and dummy Kaarel Pärtel
2022-06-03  2:46 ` Jakub Kicinski [this message]
2022-06-03  3:39 ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220602194622.0c54a256@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kaarelp2rtel@gmail.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.