From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, corbet@lwn.net,
vladimir.oltean@nxp.com, willemb@google.com,
sdf.kernel@gmail.com, ecree.xilinx@gmail.com,
jesse.brandeburg@intel.com, linux-doc@vger.kernel.org,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 06/10] docs: net: refresh netdev feature guidance
Date: Tue, 26 May 2026 09:01:47 -0700 [thread overview]
Message-ID: <20260526160151.2793354-7-kuba@kernel.org> (raw)
In-Reply-To: <20260526160151.2793354-1-kuba@kernel.org>
Update netdev feature documentation for current locking rules and
feature semantics. Clarify hw_features updates and netdev_update_features()
locking, keep the NETIF_F_NEVER_CHANGE rule with the VLAN challenged
exception, fix the HSR duplication wording, and document netdev->netmem_tx
as a device flag rather than a feature bit.
Split the list of basic feature sets from the "extra" ones like
vlan_features. A bunch of the newer fields weren't documented and
having them all together would be confusing.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
Documentation/networking/netdev-features.rst | 60 +++++++++++++-------
1 file changed, 39 insertions(+), 21 deletions(-)
diff --git a/Documentation/networking/netdev-features.rst b/Documentation/networking/netdev-features.rst
index 02bd7536fc0c..6293d47e5b09 100644
--- a/Documentation/networking/netdev-features.rst
+++ b/Documentation/networking/netdev-features.rst
@@ -18,29 +18,38 @@ that relieve an OS of various tasks like generating and checking checksums,
splitting packets, classifying them. Those capabilities and their state
are commonly referred to as netdev features in Linux kernel world.
-There are currently three sets of features relevant to the driver, and
-one used internally by network core:
+There are currently three main sets of features on each netdevice,
+first and second are initialized by the driver:
1. netdev->hw_features set contains features whose state may possibly
be changed (enabled or disabled) for a particular device by user's
- request. This set should be initialized in ndo_init callback and not
- changed later.
+ request. Drivers normally initialize this set before registration or
+ in the ndo_init callback. Changes after registration should be made
+ very carefully as other parts of the code may assume hw_features are
+ static. At the very least changes must be made under rtnl_lock and
+ the netdev instance lock, and followed by netdev_update_features().
2. netdev->features set contains features which are currently enabled
for a device. This should be changed only by network core or in
error paths of ndo_set_features callback.
- 3. netdev->vlan_features set contains features whose state is inherited
- by child VLAN devices (limits netdev->features set). This is currently
- used for all VLAN devices whether tags are stripped or inserted in
- hardware or software.
-
- 4. netdev->wanted_features set contains feature set requested by user.
+ 3. netdev->wanted_features set contains feature set requested by user.
This set is filtered by ndo_fix_features callback whenever it or
some device-specific conditions change. This set is internal to
networking core and should not be referenced in drivers.
+On top of those three main sets, each netdev has:
+ 1. Sets which control features inherited by child devices (VLAN, MPLS,
+ hw_enc for L3/L4 tunnels). These sets allow the driver to limit which
+ netdev->features are propagated, in case HW cannot perform the offloads
+ with the extra headers present.
+
+ 2. netdev->mangleid_features, TSO features which are supported only when
+ IP ID field can be mangled (constant instead of incrementing) during TSO.
+
+ 3. netdev->gso_partial_features, additional TSO features which HW can
+ support via NETIF_F_GSO_PARTIAL.
Part II: Controlling enabled features
=====================================
@@ -62,11 +71,15 @@ ndo_*_features callbacks are called with rtnl_lock held. Missing callbacks
are treated as always returning success.
A driver that wants to trigger recalculation must do so by calling
-netdev_update_features() while holding rtnl_lock. This should not be done
-from ndo_*_features callbacks. netdev->features should not be modified by
-driver except by means of ndo_fix_features callback.
-
+netdev_update_features() while holding rtnl_lock. If the device uses the
+netdev instance lock, that lock must be held as well. This should not be
+done from ndo_*_features callbacks. netdev->features should not be modified
+by driver except by means of ndo_fix_features callback.
+ndo_features_check is called for each skb before that skb is passed to
+ndo_start_xmit. Driver may perform any non-trivial checks (e.g. exact
+header geometry / length) and withdraw features like HW_CSUM or TSO,
+requesting the networking stack to fall back to the software implementation.
Part III: Implementation hints
==============================
@@ -83,8 +96,9 @@ stateless). It can be called multiple times between successive
ndo_set_features calls.
Callback must not alter features contained in NETIF_F_SOFT_FEATURES or
-NETIF_F_NEVER_CHANGE sets. The exception is NETIF_F_VLAN_CHALLENGED but
-care must be taken as the change won't affect already configured VLANs.
+NETIF_F_NEVER_CHANGE, except that NETIF_F_VLAN_CHALLENGED may be changed.
+Care must be taken as changes to NETIF_F_VLAN_CHALLENGED won't affect already
+configured VLANs.
* ndo_set_features:
@@ -186,10 +200,14 @@ Redundancy) frames from one port to another in hardware.
* hsr-dup-offload
This should be set for devices which duplicate outgoing HSR (High-availability
-Seamless Redundancy) or PRP (Parallel Redundancy Protocol) tags automatically
-frames in hardware.
+Seamless Redundancy) or PRP (Parallel Redundancy Protocol) frames
+automatically in hardware.
-* netmem-tx
+Part V: Related device flags
+============================
-This should be set for devices which support netmem TX. See
-Documentation/networking/netmem.rst
+* netdev->netmem_tx
+
+This is not a netdev feature bit. Drivers support netmem TX by setting
+netdev->netmem_tx to one of the values in enum netmem_tx_mode.
+See Documentation/networking/netmem.rst.
--
2.54.0
next prev parent reply other threads:[~2026-05-26 16:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 16:01 [PATCH net-next 00/10] docs: net: updates for old and cobwebbed docs Jakub Kicinski
2026-05-26 16:01 ` [PATCH net-next 01/10] docs: net: netdevices: small fixes and clarifications Jakub Kicinski
2026-05-26 16:01 ` [PATCH net-next 02/10] docs: net: fix minor issues with driver guide Jakub Kicinski
2026-05-26 16:01 ` [PATCH net-next 03/10] docs: net: statistics: fix kernel-internal stats list Jakub Kicinski
2026-05-26 16:01 ` [PATCH net-next 04/10] docs: net: update devmem code examples Jakub Kicinski
2026-05-26 16:01 ` [PATCH net-next 05/10] docs: net: fix minor issues with the NAPI guide Jakub Kicinski
2026-05-26 16:01 ` Jakub Kicinski [this message]
2026-05-26 18:41 ` [PATCH net-next 06/10] docs: net: refresh netdev feature guidance Maxime Chevallier
2026-05-26 16:01 ` [PATCH net-next 07/10] docs: net: fix minor issues with checksum offloads Jakub Kicinski
2026-05-26 16:01 ` [PATCH net-next 08/10] docs: net: add Rx notes to the checksum guide Jakub Kicinski
2026-05-26 18:56 ` Willem de Bruijn
2026-05-26 16:01 ` [PATCH net-next 09/10] docs: net: render the checksum comment in checksum-offloads.rst Jakub Kicinski
2026-05-26 18:56 ` Willem de Bruijn
2026-05-26 16:01 ` [PATCH net-next 10/10] docs: net: fix minor issues with segmentation offloads Jakub Kicinski
2026-05-26 18:48 ` [PATCH net-next 00/10] docs: net: updates for old and cobwebbed docs Randy Dunlap
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=20260526160151.2793354-7-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jesse.brandeburg@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf.kernel@gmail.com \
--cc=vladimir.oltean@nxp.com \
--cc=willemb@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox