linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	linux-kernel@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH 15/37] docs: networking: convert operstates.txt to ReST
Date: Thu, 30 Apr 2020 18:04:10 +0200	[thread overview]
Message-ID: <aca46c2bc16a33b9da2f1943edf520baf72c508b.1588261997.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1588261997.git.mchehab+huawei@kernel.org>

- add SPDX header;
- add a document title;
- adjust chapters, adding proper markups;
- mark lists as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 Documentation/networking/index.rst            |  1 +
 .../{operstates.txt => operstates.rst}        | 45 ++++++++++++++-----
 2 files changed, 34 insertions(+), 12 deletions(-)
 rename Documentation/networking/{operstates.txt => operstates.rst} (87%)

diff --git a/Documentation/networking/index.rst b/Documentation/networking/index.rst
index b7f558480aca..028a36821b9a 100644
--- a/Documentation/networking/index.rst
+++ b/Documentation/networking/index.rst
@@ -88,6 +88,7 @@ Contents:
    nf_conntrack-sysctl
    nf_flowtable
    openvswitch
+   operstates
 
 .. only::  subproject and html
 
diff --git a/Documentation/networking/operstates.txt b/Documentation/networking/operstates.rst
similarity index 87%
rename from Documentation/networking/operstates.txt
rename to Documentation/networking/operstates.rst
index b203d1334822..9c918f7cb0e8 100644
--- a/Documentation/networking/operstates.txt
+++ b/Documentation/networking/operstates.rst
@@ -1,5 +1,12 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+==================
+Operational States
+==================
+
 
 1. Introduction
+===============
 
 Linux distinguishes between administrative and operational state of an
 interface. Administrative state is the result of "ip link set dev
@@ -20,6 +27,7 @@ and changeable from userspace under certain rules.
 
 
 2. Querying from userspace
+==========================
 
 Both admin and operational state can be queried via the netlink
 operation RTM_GETLINK. It is also possible to subscribe to RTNLGRP_LINK
@@ -30,16 +38,20 @@ These values contain interface state:
 
 ifinfomsg::if_flags & IFF_UP:
  Interface is admin up
+
 ifinfomsg::if_flags & IFF_RUNNING:
  Interface is in RFC2863 operational state UP or UNKNOWN. This is for
  backward compatibility, routing daemons, dhcp clients can use this
  flag to determine whether they should use the interface.
+
 ifinfomsg::if_flags & IFF_LOWER_UP:
  Driver has signaled netif_carrier_on()
+
 ifinfomsg::if_flags & IFF_DORMANT:
  Driver has signaled netif_dormant_on()
 
 TLV IFLA_OPERSTATE
+------------------
 
 contains RFC2863 state of the interface in numeric representation:
 
@@ -47,26 +59,33 @@ IF_OPER_UNKNOWN (0):
  Interface is in unknown state, neither driver nor userspace has set
  operational state. Interface must be considered for user data as
  setting operational state has not been implemented in every driver.
+
 IF_OPER_NOTPRESENT (1):
  Unused in current kernel (notpresent interfaces normally disappear),
  just a numerical placeholder.
+
 IF_OPER_DOWN (2):
  Interface is unable to transfer data on L1, f.e. ethernet is not
  plugged or interface is ADMIN down.
+
 IF_OPER_LOWERLAYERDOWN (3):
  Interfaces stacked on an interface that is IF_OPER_DOWN show this
  state (f.e. VLAN).
+
 IF_OPER_TESTING (4):
  Unused in current kernel.
+
 IF_OPER_DORMANT (5):
  Interface is L1 up, but waiting for an external event, f.e. for a
  protocol to establish. (802.1X)
+
 IF_OPER_UP (6):
  Interface is operational up and can be used.
 
 This TLV can also be queried via sysfs.
 
 TLV IFLA_LINKMODE
+-----------------
 
 contains link policy. This is needed for userspace interaction
 described below.
@@ -75,6 +94,7 @@ This TLV can also be queried via sysfs.
 
 
 3. Kernel driver API
+====================
 
 Kernel drivers have access to two flags that map to IFF_LOWER_UP and
 IFF_DORMANT. These flags can be set from everywhere, even from
@@ -126,6 +146,7 @@ netif_carrier_ok() && !netif_dormant():
 
 
 4. Setting from userspace
+=========================
 
 Applications have to use the netlink interface to influence the
 RFC2863 operational state of an interface. Setting IFLA_LINKMODE to 1
@@ -139,18 +160,18 @@ are multicasted on the netlink group RTNLGRP_LINK.
 
 So basically a 802.1X supplicant interacts with the kernel like this:
 
--subscribe to RTNLGRP_LINK
--set IFLA_LINKMODE to 1 via RTM_SETLINK
--query RTM_GETLINK once to get initial state
--if initial flags are not (IFF_LOWER_UP && !IFF_DORMANT), wait until
- netlink multicast signals this state
--do 802.1X, eventually abort if flags go down again
--send RTM_SETLINK to set operstate to IF_OPER_UP if authentication
- succeeds, IF_OPER_DORMANT otherwise
--see how operstate and IFF_RUNNING is echoed via netlink multicast
--set interface back to IF_OPER_DORMANT if 802.1X reauthentication
- fails
--restart if kernel changes IFF_LOWER_UP or IFF_DORMANT flag
+- subscribe to RTNLGRP_LINK
+- set IFLA_LINKMODE to 1 via RTM_SETLINK
+- query RTM_GETLINK once to get initial state
+- if initial flags are not (IFF_LOWER_UP && !IFF_DORMANT), wait until
+  netlink multicast signals this state
+- do 802.1X, eventually abort if flags go down again
+- send RTM_SETLINK to set operstate to IF_OPER_UP if authentication
+  succeeds, IF_OPER_DORMANT otherwise
+- see how operstate and IFF_RUNNING is echoed via netlink multicast
+- set interface back to IF_OPER_DORMANT if 802.1X reauthentication
+  fails
+- restart if kernel changes IFF_LOWER_UP or IFF_DORMANT flag
 
 if supplicant goes down, bring back IFLA_LINKMODE to 0 and
 IFLA_OPERSTATE to a sane value.
-- 
2.25.4


  parent reply	other threads:[~2020-04-30 16:06 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 16:03 [PATCH 00/37] net: manually convert files to ReST format - part 2 Mauro Carvalho Chehab
2020-04-30 16:03 ` [PATCH 01/37] docs: networking: convert l2tp.txt to ReST Mauro Carvalho Chehab
2020-04-30 16:03 ` [PATCH 02/37] docs: networking: convert lapb-module.txt " Mauro Carvalho Chehab
2020-04-30 16:03 ` [PATCH 03/37] docs: networking: convert ltpc.txt " Mauro Carvalho Chehab
2020-04-30 16:03 ` [PATCH 04/37] docs: networking: convert mac80211-injection.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 05/37] docs: networking: convert mpls-sysctl.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 06/37] docs: networking: convert multiqueue.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 07/37] docs: networking: convert netconsole.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 08/37] docs: networking: convert netdev-features.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 09/37] docs: networking: convert netdevices.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 10/37] docs: networking: convert netfilter-sysctl.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 11/37] docs: networking: convert netif-msg.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 12/37] docs: networking: convert nf_conntrack-sysctl.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 13/37] docs: networking: convert nf_flowtable.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 14/37] docs: networking: convert openvswitch.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` Mauro Carvalho Chehab [this message]
2020-04-30 16:04 ` [PATCH 16/37] docs: networking: convert packet_mmap.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 17/37] docs: networking: convert phonet.txt " Mauro Carvalho Chehab
2020-04-30 18:46   ` Rémi Denis-Courmont
2020-04-30 16:04 ` [PATCH 18/37] docs: networking: convert pktgen.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 19/37] docs: networking: convert PLIP.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 20/37] docs: networking: convert ppp_generic.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 21/37] docs: networking: convert proc_net_tcp.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 22/37] docs: networking: convert radiotap-headers.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 23/37] docs: networking: convert ray_cs.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 24/37] docs: networking: convert rds.txt " Mauro Carvalho Chehab
2020-04-30 16:08   ` santosh.shilimkar
2020-04-30 16:04 ` [PATCH 25/37] docs: networking: convert regulatory.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 26/37] docs: networking: convert rxrpc.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 27/37] docs: networking: convert sctp.txt " Mauro Carvalho Chehab
2020-04-30 16:46   ` Marcelo Ricardo Leitner
2020-04-30 16:04 ` [PATCH 28/37] docs: networking: convert secid.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 29/37] docs: networking: convert seg6-sysctl.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 30/37] docs: networking: convert skfp.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 31/37] docs: networking: convert strparser.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 32/37] docs: networking: convert switchdev.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 33/37] docs: networking: convert tc-actions-env-rules.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 34/37] docs: networking: convert tcp-thin.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 35/37] docs: networking: convert team.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 36/37] docs: networking: convert timestamping.txt " Mauro Carvalho Chehab
2020-04-30 16:04 ` [PATCH 37/37] docs: networking: convert tproxy.txt " Mauro Carvalho Chehab
2020-04-30 19:56 ` [PATCH 00/37] net: manually convert files to ReST format - part 2 David Miller

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=aca46c2bc16a33b9da2f1943edf520baf72c508b.1588261997.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).