aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOleksij Rempel <o.rempel@pengutronix.de>2025-09-24 14:02:41 +0200
committerPaolo Abeni <pabeni@redhat.com>2025-09-30 09:48:31 +0200
commit7bd80ed89d72285515db673803b021469ba71ee8 (patch)
treec92364da79b65325d85f9c0fcb3a62a4011edbf4 /include
parentMerge branch 'dpll-add-phase-offset-averaging-factor' (diff)
downloadlinux-7bd80ed89d72285515db673803b021469ba71ee8.tar.gz
linux-7bd80ed89d72285515db673803b021469ba71ee8.zip
Documentation: net: add flow control guide and document ethtool API
Introduce a new document, flow_control.rst, to provide a comprehensive guide on Ethernet Flow Control in Linux. The guide explains how flow control works, how autonegotiation resolves pause capabilities, and how to configure it using ethtool and Netlink. In parallel, document the pause and pause-stat attributes in the ethtool.yaml netlink spec. This enables the ynl tool to generate kernel-doc comments for the corresponding enums in the UAPI header, making the C interface self-documenting. Finally, replace the legacy flow control section in phy.rst with a reference to the new document and add pointers in the relevant C source files. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://patch.msgid.link/20250924120241.724850-1-o.rempel@pengutronix.de Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ethtool.h45
-rw-r--r--include/uapi/linux/ethtool_netlink_generated.h4
2 files changed, 44 insertions, 5 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c2d8b4ec62eb..eeed1ea50369 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -953,9 +953,48 @@ struct kernel_ethtool_ts_info {
* @get_pause_stats: Report pause frame statistics. Drivers must not zero
* statistics which they don't report. The stats structure is initialized
* to ETHTOOL_STAT_NOT_SET indicating driver does not report statistics.
- * @get_pauseparam: Report pause parameters
- * @set_pauseparam: Set pause parameters. Returns a negative error code
- * or zero.
+ *
+ * @get_pauseparam: Report the configured policy for link-wide PAUSE
+ * (IEEE 802.3 Annex 31B). Drivers must fill struct ethtool_pauseparam
+ * such that:
+ * @autoneg:
+ * This refers to **Pause Autoneg** (IEEE 802.3 Annex 31B) only
+ * and is independent of generic link autonegotiation configured
+ * via ethtool -s.
+ * true -> the device follows the negotiated result of pause
+ * autonegotiation (Pause/Asym);
+ * false -> the device uses a forced MAC state independent of
+ * negotiation.
+ * @rx_pause/@tx_pause:
+ * represent the desired policy (preferred configuration).
+ * In autoneg mode they describe what is to be advertised;
+ * in forced mode they describe the MAC state to apply.
+ *
+ * Drivers (and/or frameworks) should persist this policy across link
+ * changes and reapply appropriate MAC programming when link parameters
+ * change.
+ *
+ * @set_pauseparam: Apply a policy for link-wide PAUSE (IEEE 802.3 Annex 31B).
+ * If @autoneg is true:
+ * Arrange for pause advertisement (Pause/Asym) based on
+ * @rx_pause/@tx_pause and program the MAC to follow the
+ * negotiated result (which may be symmetric, asymmetric, or off
+ * depending on the link partner).
+ * If @autoneg is false:
+ * Do not rely on autonegotiation; force the MAC RX/TX pause
+ * state directly per @rx_pause/@tx_pause.
+ *
+ * Implementations that integrate with PHYLIB/PHYLINK should cooperate
+ * with those frameworks for advertisement and resolution; MAC drivers are
+ * still responsible for applying the required MAC state.
+ *
+ * Return: 0 on success or a negative errno. Return -EOPNOTSUPP if
+ * link-wide PAUSE is unsupported. If only symmetric pause is supported,
+ * reject unsupported asymmetric requests with -EINVAL (or document any
+ * coercion policy).
+ *
+ * See also: Documentation/networking/flow_control.rst
+ *
* @self_test: Run specified self-tests
* @get_strings: Return a set of strings that describe the requested objects
* @set_phys_id: Identify the physical devices, e.g. by flashing an LED
diff --git a/include/uapi/linux/ethtool_netlink_generated.h b/include/uapi/linux/ethtool_netlink_generated.h
index 0e8ac0d974e2..3dd9d7cde86e 100644
--- a/include/uapi/linux/ethtool_netlink_generated.h
+++ b/include/uapi/linux/ethtool_netlink_generated.h
@@ -375,7 +375,7 @@ enum {
ETHTOOL_A_COALESCE_MAX = (__ETHTOOL_A_COALESCE_CNT - 1)
};
-enum {
+enum ethtool_a_pause_stat {
ETHTOOL_A_PAUSE_STAT_UNSPEC,
ETHTOOL_A_PAUSE_STAT_PAD,
ETHTOOL_A_PAUSE_STAT_TX_FRAMES,
@@ -385,7 +385,7 @@ enum {
ETHTOOL_A_PAUSE_STAT_MAX = (__ETHTOOL_A_PAUSE_STAT_CNT - 1)
};
-enum {
+enum ethtool_a_pause {
ETHTOOL_A_PAUSE_UNSPEC,
ETHTOOL_A_PAUSE_HEADER,
ETHTOOL_A_PAUSE_AUTONEG,